diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-01-13 18:17:32 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-01-13 18:17:32 +0000 |
| commit | 30493d6d028485e65dd0fb61ea9978c7b128e817 (patch) | |
| tree | 04e31f55683821e8a109bdf9a5eb9f9f39ffbfe0 /src | |
| parent | * [INTL: pl] Updated Polish translation by Tomek ArgasiĆski (diff) | |
| download | inkscape-30493d6d028485e65dd0fb61ea9978c7b128e817.tar.gz inkscape-30493d6d028485e65dd0fb61ea9978c7b128e817.zip | |
Use visual/geometric bbox (as specified in Selector tool preferences) when converting to guidelines. Also, provide options to convert rectangles and 3D boxes using their bbox, too (i.e., disregarding their true shapes).
(bzr r4477)
Diffstat (limited to 'src')
| -rw-r--r-- | src/box3d.cpp | 6 | ||||
| -rw-r--r-- | src/sp-item.cpp | 12 | ||||
| -rw-r--r-- | src/sp-rect.cpp | 6 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/inkscape-preferences.h | 1 |
5 files changed, 31 insertions, 2 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp index 631d5cfc1..3c40a4800 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -34,6 +34,7 @@ #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 f24bf6ecc..7b3687607 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -34,6 +34,8 @@ #include "attributes.h" #include "document.h" #include "uri.h" +#include "inkscape.h" +#include "desktop-handles.h" #include "style.h" #include <glibmm/i18n.h> @@ -1579,9 +1581,15 @@ sp_item_first_item_child (SPObject *obj) 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 e8e04cc51..5770e623d 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -29,6 +29,7 @@ #include <glibmm/i18n.h> #include "xml/repr.h" #include "sp-guide.h" +#include "prefs-utils.h" #define noRECT_VERBOSE @@ -581,6 +582,11 @@ static void sp_rect_snappoints(SPItem const *item, SnapPointsIter p) 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; diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index e88ba74b1..b07914265 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -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; @@ -374,9 +380,11 @@ void InkscapePreferences::initPageTools() //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"); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index b0c47a8f0..fd340769e 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -215,6 +215,7 @@ protected: 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(); |
