From bf463fba185a4e67d25efe324a577cf89dcdce5f Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sun, 12 May 2013 14:36:06 +0200 Subject: 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) --- src/seltrans.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/seltrans.cpp') diff --git a/src/seltrans.cpp b/src/seltrans.cpp index b6c6baaf7..84c73e452 100644 --- a/src/seltrans.cpp +++ b/src/seltrans.cpp @@ -86,6 +86,17 @@ static gboolean sp_seltrans_handle_event(SPKnot *knot, GdkEvent *event, gpointer return FALSE; } +Inkscape::SelTrans::BoundingBoxPrefsObserver::BoundingBoxPrefsObserver(SelTrans &sel_trans) : + Observer("/tools/bounding_box"), + _sel_trans(sel_trans) +{ +} + +void Inkscape::SelTrans::BoundingBoxPrefsObserver::notify(Preferences::Entry const &val) +{ + _sel_trans._boundingBoxPrefsChanged(static_cast(val.getBool())); +} + Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _desktop(desktop), _selcue(desktop), @@ -103,7 +114,8 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : _origin_for_bboxpoints(Geom::Point(0,0)), _chandle(NULL), _stamp_cache(NULL), - _message_context(desktop->messageStack()) + _message_context(desktop->messageStack()), + _bounding_box_prefs_observer(*this) { Inkscape::Preferences *prefs = Inkscape::Preferences::get(); int prefs_bbox = prefs->getBool("/tools/bounding_box"); @@ -169,6 +181,8 @@ Inkscape::SelTrans::SelTrans(SPDesktop *desktop) : ); _all_snap_sources_iter = _all_snap_sources_sorted.end(); + + prefs->addObserver(_bounding_box_prefs_observer); } Inkscape::SelTrans::~SelTrans() @@ -873,6 +887,15 @@ void Inkscape::SelTrans::_selModified(Inkscape::Selection */*selection*/, guint } } +void Inkscape::SelTrans::_boundingBoxPrefsChanged(int prefs_bbox) +{ + _snap_bbox_type = !prefs_bbox ? + SPItem::VISUAL_BBOX : SPItem::GEOMETRIC_BBOX; + + _updateVolatileState(); + _updateHandles(); +} + /* * handlers for handle move-request */ -- cgit v1.2.3