diff options
| author | Nicolas Dufour <nicoduf@yahoo.fr> | 2013-05-12 12:36:06 +0000 |
|---|---|---|
| committer | JazzyNico <nicoduf@yahoo.fr> | 2013-05-12 12:36:06 +0000 |
| commit | bf463fba185a4e67d25efe324a577cf89dcdce5f (patch) | |
| tree | 768949cc7e5dfc2541da7d07455b8cc3fc477a97 /src/selcue.cpp | |
| parent | Fix for Bug #181493 (Locked layers not completely locked) by frenchie4111. (diff) | |
| download | inkscape-bf463fba185a4e67d25efe324a577cf89dcdce5f.tar.gz inkscape-bf463fba185a4e67d25efe324a577cf89dcdce5f.zip | |
Fix for Bug #448872 (Changing the bounding box type in preferences does not update the preview) by Vinipsmaker.
Fixed bugs:
- https://launchpad.net/bugs/448872
(bzr r12329)
Diffstat (limited to 'src/selcue.cpp')
| -rw-r--r-- | src/selcue.cpp | 48 |
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: |
