From: cilix42 Date: Wed, 16 Jan 2008 09:36:32 +0000 (+0000) Subject: Add option in Preferences to keep objects after conversion to guides X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=af33014ef3896559f1521e15f1f1fe34c148ca48;p=inkscape.git Add option in Preferences to keep objects after conversion to guides --- diff --git a/src/box3d.cpp b/src/box3d.cpp index 4aca24c42..9faf47c7c 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -1531,8 +1531,6 @@ box3d_convert_to_guides(SPItem *item) { box3d_push_back_corner_pair(box, pts, 3, 7); sp_guide_pt_pairs_to_guides(doc, pts); - - SP_OBJECT(box)->deleteObject(true); } /* diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 4cf34e2c5..381f45e0d 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2441,13 +2441,17 @@ void sp_selection_to_marker(bool apply) _("Objects to marker")); } -static void sp_selection_to_guides_recursive(SPItem *item) { +static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem) { if (SP_IS_GROUP(item) && !SP_IS_BOX3D(item)) { for (GSList *i = sp_item_group_item_list (SP_GROUP(item)); i != NULL; i = i->next) { - sp_selection_to_guides_recursive(SP_ITEM(i->data)); + sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem); } } else { sp_item_convert_item_to_guides(item); + + if (deleteitem) { + SP_OBJECT(item)->deleteObject(true); + } } } @@ -2467,8 +2471,10 @@ void sp_selection_to_guides() return; } + bool deleteitem = (prefs_get_int_attribute("tools", "cvg_keep_objects", 0) == 0); + for (GSList const *i = items; i != NULL; i = i->next) { - sp_selection_to_guides_recursive(SP_ITEM(i->data)); + sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem); } sp_document_done (doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides")); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 63d20d320..6b61e3246 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1622,8 +1622,6 @@ sp_item_convert_to_guides(SPItem *item) { pts.push_back(std::make_pair(D.to_2geom(), A.to_2geom())); sp_guide_pt_pairs_to_guides(SP_OBJECT_DOCUMENT(item), pts); - - SP_OBJECT(item)->deleteObject(true); } /* diff --git a/src/sp-path.cpp b/src/sp-path.cpp index a8e3ad6ee..4b897158b 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -165,8 +165,6 @@ sp_path_convert_to_guides(SPItem *item) } sp_guide_pt_pairs_to_guides(doc, pts); - - SP_OBJECT(path)->deleteObject(true); } /** diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index a26d41599..cf399d324 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -607,8 +607,6 @@ sp_rect_convert_to_guides(SPItem *item) { pts.push_back(std::make_pair(A4.to_2geom(), A1.to_2geom())); sp_guide_pt_pairs_to_guides(doc, pts); - - SP_OBJECT(rect)->deleteObject(true); } /* diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index ca25ad127..b0c8bcb85 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -334,6 +334,11 @@ void InkscapePreferences::initPageTools() _page_tools.add_line( true, "", _t_bbox_geometric, "", _("This bounding box includes only the bare path")); + _page_tools.add_group_header( _("Conversion to guides:")); + _t_cvg_keep_objects.init ( _("Keep objects after conversion to guides"), "tools", "cvg_keep_objects", false); + _page_tools.add_line( true, "", _t_cvg_keep_objects, "", + _("When converting an object to guides, don't delete the object after the conversion.")); + _calligrapy_use_abs_size.init ( _("Width is in absolute units"), "tools.calligraphic", "abs_width", false); _calligrapy_keep_selected.init ( _("Select new path"), "tools.calligraphic", "keep_selected", true); _connector_ignore_text.init( _("Don't attach connectors to text objects"), "tools.connector", "ignoretext", true); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 02f2c2da4..15d6ee54e 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -123,6 +123,7 @@ protected: PrefRadioButton _t_sel_trans_obj, _t_sel_trans_outl, _t_sel_cue_none, _t_sel_cue_mark, _t_sel_cue_box, _t_bbox_visual, _t_bbox_geometric; + PrefCheckButton _t_cvg_keep_objects; PrefSpinButton _t_pencil_tolerance;