From: dvlierop2 Date: Fri, 13 Apr 2007 20:41:28 +0000 (+0000) Subject: Add global preference for selector tool, chosing between GEOMETRIC_BBOX or VISUAL_BBOX X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=41d5324199363aa6e5edea5ee67b2bb835b5d1f7;p=inkscape.git Add global preference for selector tool, chosing between GEOMETRIC_BBOX or VISUAL_BBOX --- diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 21b8a0461..228b4fec0 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -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 diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 3a3c4f14f..a182a9305 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -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); diff --git a/src/ui/dialog/inkscape-preferences.h b/src/ui/dialog/inkscape-preferences.h index eacf0a079..2c815a309 100644 --- a/src/ui/dialog/inkscape-preferences.h +++ b/src/ui/dialog/inkscape-preferences.h @@ -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;