summaryrefslogtreecommitdiffstats
path: root/src/selcue.cpp
diff options
context:
space:
mode:
authorsu_v <suv-sf@users.sourceforge.net>2013-05-16 16:00:19 +0000
committer~suv <suv-sf@users.sourceforge.net>2013-05-16 16:00:19 +0000
commit58f7c54bdd82261552c308b672e8d5f079bf5c6d (patch)
treec62c20759bfdea3c52cd2805289957731ab38305 /src/selcue.cpp
parentmerge from trunk (r12322) (diff)
parentWin32. More include fixes for glibmm 2.36 (file dialog). (diff)
downloadinkscape-58f7c54bdd82261552c308b672e8d5f079bf5c6d.tar.gz
inkscape-58f7c54bdd82261552c308b672e8d5f079bf5c6d.zip
merge from trunk (r12337)
(bzr r11668.1.70)
Diffstat (limited to 'src/selcue.cpp')
-rw-r--r--src/selcue.cpp48
1 files changed, 43 insertions, 5 deletions
diff --git a/src/selcue.cpp b/src/selcue.cpp
index 4c35307f7..3f8a93e21 100644
--- a/src/selcue.cpp
+++ b/src/selcue.cpp
@@ -25,8 +25,20 @@
#include "preferences.h"
#include "selcue.h"
+Inkscape::SelCue::BoundingBoxPrefsObserver::BoundingBoxPrefsObserver(SelCue &sel_cue) :
+ Observer("/tools/bounding_box"),
+ _sel_cue(sel_cue)
+{
+}
+
+void Inkscape::SelCue::BoundingBoxPrefsObserver::notify(Preferences::Entry const &val)
+{
+ _sel_cue._boundingBoxPrefsChanged(static_cast<int>(val.getBool()));
+}
+
Inkscape::SelCue::SelCue(SPDesktop *desktop)
- : _desktop(desktop)
+ : _desktop(desktop),
+ _bounding_box_prefs_observer(*this)
{
_selection = sp_desktop_selection(_desktop);
@@ -34,11 +46,16 @@ Inkscape::SelCue::SelCue(SPDesktop *desktop)
sigc::hide(sigc::mem_fun(*this, &Inkscape::SelCue::_newItemBboxes))
);
- _sel_modified_connection = _selection->connectModified(
- sigc::hide(sigc::hide(sigc::mem_fun(*this, &Inkscape::SelCue::_updateItemBboxes)))
+ {
+ void(SelCue::*modifiedSignal)() = &SelCue::_updateItemBboxes;
+ _sel_modified_connection = _selection->connectModified(
+ sigc::hide(sigc::hide(sigc::mem_fun(*this, modifiedSignal)))
);
+ }
- _updateItemBboxes();
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ _updateItemBboxes(prefs);
+ prefs->addObserver(_bounding_box_prefs_observer);
}
Inkscape::SelCue::~SelCue()
@@ -59,7 +76,11 @@ Inkscape::SelCue::~SelCue()
void Inkscape::SelCue::_updateItemBboxes()
{
- Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ _updateItemBboxes(Inkscape::Preferences::get());
+}
+
+void Inkscape::SelCue::_updateItemBboxes(Inkscape::Preferences *prefs)
+{
gint mode = prefs->getInt("/options/selcue/value", MARK);
if (mode == NONE) {
return;
@@ -69,6 +90,11 @@ void Inkscape::SelCue::_updateItemBboxes()
int prefs_bbox = prefs->getBool("/tools/bounding_box");
+ _updateItemBboxes(mode, prefs_bbox);
+}
+
+void Inkscape::SelCue::_updateItemBboxes(gint mode, int prefs_bbox)
+{
GSList const *items = _selection->itemList();
if (_item_bboxes.size() != g_slist_length((GSList *) items)) {
_newItemBboxes();
@@ -201,6 +227,18 @@ void Inkscape::SelCue::_newTextBaselines()
}
}
+void Inkscape::SelCue::_boundingBoxPrefsChanged(int prefs_bbox)
+{
+ Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+ gint mode = prefs->getInt("/options/selcue/value", MARK);
+ if (mode == NONE) {
+ return;
+ }
+
+ g_return_if_fail(_selection != NULL);
+
+ _updateItemBboxes(mode, prefs_bbox);
+}
/*
Local Variables: