From: cilix42 Date: Wed, 19 Mar 2008 13:10:47 +0000 (+0000) Subject: Add option to treat grups as single objects when converting to guides. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=9241c6b5cd76d898868e6f865a9192c4c302ec5c;p=inkscape.git Add option to treat grups as single objects when converting to guides. --- diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 501f334a2..81af6512a 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2603,10 +2603,10 @@ void sp_selection_to_marker(bool apply) _("Objects to marker")); } -static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem) { - if (SP_IS_GROUP(item) && !SP_IS_BOX3D(item)) { +static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem, bool wholegroups) { + if (SP_IS_GROUP(item) && !SP_IS_BOX3D(item) && !wholegroups) { 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), deleteitem); + sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem, wholegroups); } } else { sp_item_convert_item_to_guides(item); @@ -2634,9 +2634,10 @@ void sp_selection_to_guides() } bool deleteitem = (prefs_get_int_attribute("tools", "cvg_keep_objects", 0) == 0); + bool wholegroups = (prefs_get_int_attribute("tools", "cvg_convert_whole_groups", 0) != 0); for (GSList const *i = items; i != NULL; i = i->next) { - sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem); + sp_selection_to_guides_recursive(SP_ITEM(i->data), deleteitem, wholegroups); } sp_document_done (doc, SP_VERB_EDIT_SELECTION_2_GUIDES, _("Objects to guides")); diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 453d3812a..7819faf71 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -351,6 +351,9 @@ void InkscapePreferences::initPageTools() _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.")); + _t_cvg_convert_whole_groups.init ( _("Treat groups as a single object"), "tools", "cvg_convert_whole_groups", false); + _page_tools.add_line( true, "", _t_cvg_convert_whole_groups, "", + _("Treat groups as a single object during conversion to guides rather than converting each child separately.")); _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); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index 72afe1b3a..08dbcedf9 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -124,7 +124,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; + PrefCheckButton _t_cvg_keep_objects, _t_cvg_convert_whole_groups; PrefCheckButton _t_node_pathflash_enabled; PrefSpinButton _t_node_pathflash_timeout; PrefColorPicker _t_node_pathoutline_color;