summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2008-04-17 02:40:23 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2008-04-17 02:40:23 +0000
commit59db065f39b26434907a247e3249058176f6034a (patch)
tree0d968ff42d814b25b813bdf2b49f76acfa939022 /src
parentfix by kur9kin for endless loop from bug 212332 (diff)
downloadinkscape-59db065f39b26434907a247e3249058176f6034a.tar.gz
inkscape-59db065f39b26434907a247e3249058176f6034a.zip
replace text strings by ints for tools/bounding_box
(bzr r5459)
Diffstat (limited to 'src')
-rw-r--r--src/object-snapper.cpp10
-rw-r--r--src/preferences-skeleton.h1
-rw-r--r--src/selcue.cpp5
-rw-r--r--src/seltrans.cpp10
-rw-r--r--src/sp-item.cpp5
-rw-r--r--src/ui/dialog/inkscape-preferences.cpp4
6 files changed, 21 insertions, 14 deletions
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<SPItem*>::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[] =
" </group>\n"
"\n"
" <group id=\"tools\"\n"
+" bounding_box=\"0\"\n"
" style=\"fill:none;stroke:black;stroke-opacity:1;stroke-width:1px;stroke-linejoin:miter;stroke-linecap:butt;\">\n"
" <group id=\"shapes\" style=\"fill-rule:evenodd;\" selcue=\"1\" gradientdrag=\"1\">\n"
" <eventcontext id=\"rect\" style=\"fill:blue;\" usecurrent=\"1\"/>\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<NR::Rect> 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"));