Code

Add global preference for selector tool, chosing between GEOMETRIC_BBOX or VISUAL_BBOX
authordvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 13 Apr 2007 20:41:28 +0000 (20:41 +0000)
committerdvlierop2 <dvlierop2@users.sourceforge.net>
Fri, 13 Apr 2007 20:41:28 +0000 (20:41 +0000)
src/seltrans.cpp
src/ui/dialog/inkscape-preferences.cpp
src/ui/dialog/inkscape-preferences.h

index 21b8a046131aa7115ee12c83fb5a1545d039c115..228b4fec09e68cae07d3eb3d3e269c156ada95c7 100644 (file)
@@ -88,14 +88,13 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) :
     _show(SHOW_CONTENT),
     _grabbed(false),
     _show_handles(true),
+    _snap_bbox_type(SPItem::GEOMETRIC_BBOX),
     _bbox(NR::Nothing()),
     _approximate_bbox(NR::Nothing()),
     _chandle(NULL),
     _stamp_cache(NULL),
     _message_context(desktop->messageStack())
 {
-    //_snap_bbox_type = SPItem::GEOMETRIC_BBOX; //TODO: Get this parameter from UI; hardcoded for the time being
-    _snap_bbox_type = SPItem::APPROXIMATE_BBOX;
     
     g_return_if_fail(desktop != NULL);
 
@@ -112,8 +111,6 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) :
     _updateHandles();
 
     _selection = sp_desktop_selection(desktop);
-    
-    
 
     _norm = sp_canvas_item_new(sp_desktop_controls(desktop),
                                SP_TYPE_CTRL,
@@ -617,10 +614,6 @@ void Inkscape::SelTrans::_updateVolatileState()
     _bbox = selection->bounds(_snap_bbox_type);
     _approximate_bbox = selection->bounds(SPItem::APPROXIMATE_BBOX);
     
-    /*std::cout << "Approximate BBox: " << _approximate_bbox->min() << " - " << _approximate_bbox->max() << std::endl;
-    std::cout << "Geometric BBox: " << selection->bounds(SPItem::GEOMETRIC_BBOX)->min() << " - " << selection->bounds(SPItem::GEOMETRIC_BBOX)->max() << std::endl;
-    */
-    
     if (!_bbox) {
         _empty = true;
         return;
@@ -814,6 +807,10 @@ gboolean Inkscape::SelTrans::handleRequest(SPKnot *knot, NR::Point *position, gu
 void Inkscape::SelTrans::_selChanged(Inkscape::Selection *selection)
 {
     if (!_grabbed) {
+        gchar const *prefs_bbox = prefs_get_string_attribute("tools.select", "bounding_box");
+        _snap_bbox_type = (prefs_bbox == NULL || strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX;
+        //SPItem::APPROXIMATE_BBOX will be replaced by SPItem::VISUAL_BBOX, as soon as the latter is implemented properly
+    
         _updateVolatileState();
         _current.set_identity();
         _center_is_set = false; // center(s) may have changed
index 3a3c4f14fd535b9d4025ae9ffe450b75eb0a6c7d..a182a9305442c8a98088d9e75d64968f89d5fa32 100644 (file)
@@ -337,7 +337,15 @@ void InkscapePreferences::initPageTools()
     _t_sel_cue_box.init ( _("Box"), "options.selcue", "value", Inkscape::SelCue::BBOX, false, &_t_sel_cue_none);
     _page_selector.add_line( true, "", _t_sel_cue_box, "", 
                             _("Each selected object displays its bounding box"));
-    
+
+    _page_selector.add_group_header( _("Bounding box to use:"));
+    _t_sel_bbox_visual.init ( _("Visual bounding box"), "tools.select", "bounding_box", "visual", false, 0);
+    _page_selector.add_line( true, "", _t_sel_bbox_visual, "",
+                            _("This bounding box includes stroke width, markers, filter margins, etc."));
+    _t_sel_bbox_geometric.init ( _("Geometric bounding box"), "tools.select", "bounding_box", "geometric", true, &_t_sel_bbox_visual);
+    _page_selector.add_line( true, "", _t_sel_bbox_geometric, "",
+                            _("This bounding box includes only the bare path"));
+
     //Node
     this->AddPage(_page_node, _("Node"), iter_tools, PREFS_PAGE_TOOLS_NODE);
     AddSelcueCheckbox(_page_node, "tools.nodes", true);
index eacf0a079c18ee455827cf3222e934cef4711a3b..2c815a309beda142456c8d9990a5d35cbb5d928d 100644 (file)
@@ -112,7 +112,7 @@ protected:
     PrefSpinButton  _steps_arrow, _steps_scale, _steps_inset, _steps_zoom;
 
     PrefRadioButton _t_sel_trans_obj, _t_sel_trans_outl, _t_sel_cue_none, _t_sel_cue_mark,
-                    _t_sel_cue_box;
+                    _t_sel_cue_box, _t_sel_bbox_visual, _t_sel_bbox_geometric;
 
     PrefSpinButton  _t_pencil_tolerance;