From: buliabyak Date: Thu, 17 Apr 2008 02:40:23 +0000 (+0000) Subject: replace text strings by ints for tools/bounding_box X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=4f79c421fc7c86689cdb502c0651c2e0fc840750;p=inkscape.git replace text strings by ints for tools/bounding_box --- diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index f05422770..a91014158 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -156,8 +156,9 @@ void Inkscape::ObjectSnapper::_collectNodes(Inkscape::Snapper::PointType const & g_assert(!(p_is_a_node && p_is_a_bbox || p_is_a_bbox && p_is_a_guide || p_is_a_node && p_is_a_guide)); if (_snap_to_bboxnode) { - gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box"); - bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX; + int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); + bbox_type = (prefs_bbox ==0)? + SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; } for (std::vector::const_iterator i = _candidates->begin(); i != _candidates->end(); i++) { @@ -265,8 +266,9 @@ void Inkscape::ObjectSnapper::_collectPaths(Inkscape::Snapper::PointType const & bool p_is_a_node = t & Inkscape::Snapper::SNAPPOINT_NODE; if (_snap_to_bboxpath) { - gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box"); - bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX; + int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); + bbox_type = (prefs_bbox ==0)? + SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; } // Consider the page border for snapping diff --git a/src/preferences-skeleton.h b/src/preferences-skeleton.h index 03e3dc487..0bf035c1f 100644 --- a/src/preferences-skeleton.h +++ b/src/preferences-skeleton.h @@ -48,6 +48,7 @@ static char const preferences_skeleton[] = " \n" "\n" " \n" " \n" " \n" diff --git a/src/selcue.cpp b/src/selcue.cpp index 4eba1f756..48df1cf8a 100644 --- a/src/selcue.cpp +++ b/src/selcue.cpp @@ -77,8 +77,9 @@ void Inkscape::SelCue::_updateItemBboxes() g_return_if_fail(_selection != NULL); - gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box"); - SPItem::BBoxType bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX; + int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); + SPItem::BBoxType bbox_type = (prefs_bbox ==0)? + SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; for (GSList const *l = _selection->itemList(); l != NULL; l = l->next) { SPItem *item = (SPItem *) l->data; diff --git a/src/seltrans.cpp b/src/seltrans.cpp index 154e828c4..c90ac31cf 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -107,8 +107,9 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _stamp_cache(NULL), _message_context(desktop->messageStack()) { - gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box"); - _snap_bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX; + int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); + _snap_bbox_type = (prefs_bbox ==0)? + SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; g_return_if_fail(desktop != NULL); @@ -820,8 +821,9 @@ void Inkscape::SelTrans::_selChanged(Inkscape::Selection */*selection*/) { if (!_grabbed) { // reread in case it changed on the fly: - gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box"); - _snap_bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::APPROXIMATE_BBOX; + int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); + _snap_bbox_type = (prefs_bbox ==0)? + SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; //SPItem::APPROXIMATE_BBOX will be replaced by SPItem::VISUAL_BBOX, as soon as the latter is implemented properly _updateVolatileState(); diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 263671d47..0ab8566eb 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -1663,8 +1663,9 @@ sp_item_convert_to_guides(SPItem *item) { SPNamedView *nv = sp_desktop_namedview(dt); (void)nv; - gchar const *prefs_bbox = prefs_get_string_attribute("tools", "bounding_box"); - SPItem::BBoxType bbox_type = (prefs_bbox != NULL && strcmp(prefs_bbox, "geometric")==0)? SPItem::GEOMETRIC_BBOX : SPItem::RENDERING_BBOX; + int prefs_bbox = prefs_get_int_attribute("tools", "bounding_box", 0); + SPItem::BBoxType bbox_type = (prefs_bbox ==0)? + SPItem::APPROXIMATE_BBOX : SPItem::GEOMETRIC_BBOX; NR::Maybe bbox = sp_item_bbox_desktop(item, bbox_type); if (!bbox) { diff --git a/src/ui/dialog/inkscape-preferences.cpp b/src/ui/dialog/inkscape-preferences.cpp index 5c451e005..6b9cafcc9 100644 --- a/src/ui/dialog/inkscape-preferences.cpp +++ b/src/ui/dialog/inkscape-preferences.cpp @@ -340,10 +340,10 @@ void InkscapePreferences::initPageTools() _path_tools = _page_list.get_model()->get_path(iter_tools); _page_tools.add_group_header( _("Bounding box to use:")); - _t_bbox_visual.init ( _("Visual bounding box"), "tools", "bounding_box", "visual", false, 0); + _t_bbox_visual.init ( _("Visual bounding box"), "tools", "bounding_box", "0", false, 0); // 0 means visual _page_tools.add_line( true, "", _t_bbox_visual, "", _("This bounding box includes stroke width, markers, filter margins, etc.")); - _t_bbox_geometric.init ( _("Geometric bounding box"), "tools", "bounding_box", "geometric", true, &_t_bbox_visual); + _t_bbox_geometric.init ( _("Geometric bounding box"), "tools", "bounding_box", "1", true, &_t_bbox_visual); // 1 means geometric _page_tools.add_line( true, "", _t_bbox_geometric, "", _("This bounding box includes only the bare path"));