summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: fd3b333)
raw | patch | inline | side by side (parent: fd3b333)
author | cilix42 <cilix42@users.sourceforge.net> | |
Sun, 13 Jan 2008 18:17:32 +0000 (18:17 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Sun, 13 Jan 2008 18:17:32 +0000 (18:17 +0000) |
diff --git a/src/box3d.cpp b/src/box3d.cpp
index 631d5cfc1d27be44ea582aaddfb4eb0344114fc5..3c40a48000a29e18a01d93e67411c8672d153e70 100644 (file)
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
#include "2geom/geom.h"
#include "sp-guide.h"
#include "sp-namedview.h"
+#include "prefs-utils.h"
#include "desktop.h"
#include "macros.h"
@@ -1496,6 +1497,11 @@ box3d_push_back_corner_pair(SPBox3D *box, std::list<std::pair<Geom::Point, Geom:
void
box3d_convert_to_guides(SPBox3D *box, bool write_undo) {
+ if (prefs_get_int_attribute("tools.shapes.3dbox", "convertguides", 1) == 0) {
+ sp_item_convert_to_guides(SP_ITEM(box));
+ return;
+ }
+
SPDocument *doc = SP_OBJECT_DOCUMENT(box);
//SPDesktop *desktop = inkscape_active_desktop();
//Inkscape::XML::Document *xml_doc = sp_document_repr_doc(doc);
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index f24bf6ecc317f1584979a2c1182cf7bf976cdf43..7b3687607d7fb3abe1806b76a1747a608c009099 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
#include "attributes.h"
#include "document.h"
#include "uri.h"
+#include "inkscape.h"
+#include "desktop-handles.h"
#include "style.h"
#include <glibmm/i18n.h>
void
sp_item_convert_to_guides(SPItem *item) {
- NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(item, SPItem::GEOMETRIC_BBOX);
+ SPDesktop *dt = inkscape_active_desktop();
+ SPNamedView *nv = sp_desktop_namedview(dt);
+
+ gchar const *prefs_bbox = prefs_get_string_attribute("tools.select", "bounding_box");
+ SPItem::BBoxType bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::RENDERING_BBOX;
+
+ NR::Maybe<NR::Rect> bbox = sp_item_bbox_desktop(item, bbox_type);
if (!bbox) {
- g_print ("Cannot determine bounding box. Doing nothing.\n");
+ g_warning ("Cannot determine item's bounding box during conversion to guides.\n");
return;
}
diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp
index e8e04cc51ebc27da835b3e538665910ba461d55e..5770e623d753f6a8f1e12318b4c90aaf7a81187d 100644 (file)
--- a/src/sp-rect.cpp
+++ b/src/sp-rect.cpp
#include <glibmm/i18n.h>
#include "xml/repr.h"
#include "sp-guide.h"
+#include "prefs-utils.h"
#define noRECT_VERBOSE
void
sp_rect_convert_to_guides(SPRect *rect, bool write_undo) {
+ if (prefs_get_int_attribute("tools.shapes.rect", "convertguides", 1) == 0) {
+ sp_item_convert_to_guides(SP_ITEM(rect));
+ return;
+ }
+
SPDocument *doc = SP_OBJECT_DOCUMENT(rect);
std::list<std::pair<Geom::Point, Geom::Point> > pts;
index e88ba74b1884e162cbf9695d02338048feac9263..b0791426564a78f5eef7fc4e6c6ea184837bc01b 100644 (file)
@@ -229,6 +229,12 @@ void InkscapePreferences::AddGradientCheckbox(DialogPage& p, const std::string&
p.add_line( false, "", *cb, "", _("Whether selected objects display gradient editing controls"));
}
+void InkscapePreferences::AddConvertGuidesCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value) {
+ PrefCheckButton* cb = Gtk::manage( new PrefCheckButton);
+ cb->init ( _("Conversion to guides uses edges instead of bounding box"), prefs_path, "convertguides", def_value);
+ p.add_line( false, "", *cb, "", _("Converting an object to guides places these along the object's true edges (imitating the object's shape), not along the bounding box."));
+}
+
void StyleFromSelectionToTool(gchar const *prefs_path, StyleSwatch *swatch)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
//Rectangle
this->AddPage(_page_rectangle, _("Rectangle"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_RECT);
this->AddNewObjectsStyle(_page_rectangle, "tools.shapes.rect");
+ this->AddConvertGuidesCheckbox(_page_rectangle, "tools.shapes.rect", true);
//3D box
this->AddPage(_page_3dbox, _("3D Box"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_3DBOX);
this->AddNewObjectsStyle(_page_3dbox, "tools.shapes.3dbox");
+ this->AddConvertGuidesCheckbox(_page_3dbox, "tools.shapes.3dbox", true);
//ellipse
this->AddPage(_page_ellipse, _("Ellipse"), iter_shapes, PREFS_PAGE_TOOLS_SHAPES_ELLIPSE);
this->AddNewObjectsStyle(_page_ellipse, "tools.shapes.arc");
index b0c47a8f0826bbafbbe4af8a3268ac28d598fadc..fd340769ee2c5a5f138f66753141b31b982badde 100644 (file)
static void AddSelcueCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
static void AddGradientCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
+ static void AddConvertGuidesCheckbox(DialogPage& p, const std::string& prefs_path, bool def_value);
static void AddNewObjectsStyle(DialogPage& p, const std::string& prefs_path);
void on_pagelist_selection_changed();