Code

Add option in Preferences to keep objects after conversion to guides
authorcilix42 <cilix42@users.sourceforge.net>
Wed, 16 Jan 2008 09:36:32 +0000 (09:36 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Wed, 16 Jan 2008 09:36:32 +0000 (09:36 +0000)
src/box3d.cpp
src/selection-chemistry.cpp
src/sp-item.cpp
src/sp-path.cpp
src/sp-rect.cpp
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h

index 4aca24c4260add33cda3e4d6c69508cabac91b9a..9faf47c7c0d2895f04d9ddc671b3bae700f0f974 100644 (file)
@@ -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);
 }
 
 /*
index 4cf34e2c565e8f84297ae574995e3797486486b2..381f45e0ddb736ad5053d1fbbb76c8cd73c504c3 100644 (file)
@@ -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"));
index 63d20d32075ccbbbf1ad36c8ecdae4d05965f012..6b61e3246ebb1d6af7a800b443171a1ac7eca3c2 100644 (file)
@@ -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);
 }
 
 /*
index a8e3ad6eebf74db53a4a0aacee145a22c2e186d0..4b897158b3074f36d0306fd08622e19a94fb5ab1 100644 (file)
@@ -165,8 +165,6 @@ sp_path_convert_to_guides(SPItem *item)
     }
 
     sp_guide_pt_pairs_to_guides(doc, pts);
-
-    SP_OBJECT(path)->deleteObject(true);
 }
 
 /**
index a26d415995d92911e917bc50f3fe2e583dac86b8..cf399d3241159e3d8daa6fc68f31f9c9fdedd67e 100644 (file)
@@ -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);
 }
 
 /*
index ca25ad1270fec9d8c1cbab395936e6cc43aa8be2..b0c8bcb85fedda751d74d478977b364eef534472 100644 (file)
@@ -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);
index 02f2c2da4ceae6f631a7463c1dc86be8aaafed18..15d6ee54e7eb661276337835b027ed94a81dab6d 100644 (file)
@@ -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;