diff options
| author | Martin Owens <doctormo@gmail.com> | 2014-03-27 01:33:44 +0000 |
|---|---|---|
| committer | Martin Owens <doctormo@gmail.com> | 2014-03-27 01:33:44 +0000 |
| commit | 5a4fb2325f60d292b47330f540b26a3279341c90 (patch) | |
| tree | d2aa7967be25450b83e625025366c618101ae49f /src/selcue.cpp | |
| parent | The Polar Arrange Tab of the Arrange Dialog now hides the parametric (diff) | |
| parent | Remove Snap menu item and improve grid menu item text (diff) | |
| download | inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.tar.gz inkscape-5a4fb2325f60d292b47330f540b26a3279341c90.zip | |
Commit a merge to trunk, with probabal errors
(bzr r11073.1.36)
Diffstat (limited to 'src/selcue.cpp')
| -rw-r--r-- | src/selcue.cpp | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/src/selcue.cpp b/src/selcue.cpp index 9a2d105ae..805629636 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() @@ -47,19 +64,23 @@ Inkscape::SelCue::~SelCue() _sel_modified_connection.disconnect(); for (std::vector<SPCanvasItem*>::iterator i = _item_bboxes.begin(); i != _item_bboxes.end(); ++i) { - gtk_object_destroy(*i); + sp_canvas_item_destroy(*i); } _item_bboxes.clear(); for (std::vector<SPCanvasItem*>::iterator i = _text_baselines.begin(); i != _text_baselines.end(); ++i) { - gtk_object_destroy(*i); + sp_canvas_item_destroy(*i); } _text_baselines.clear(); } 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(); @@ -104,7 +130,7 @@ void Inkscape::SelCue::_updateItemBboxes() void Inkscape::SelCue::_newItemBboxes() { for (std::vector<SPCanvasItem*>::iterator i = _item_bboxes.begin(); i != _item_bboxes.end(); ++i) { - gtk_object_destroy(*i); + sp_canvas_item_destroy(*i); } _item_bboxes.clear(); @@ -151,6 +177,7 @@ void Inkscape::SelCue::_newItemBboxes() SP_CTRLRECT(box)->setRectangle(*b); SP_CTRLRECT(box)->setColor(0x000000a0, 0, 0); SP_CTRLRECT(box)->setDashed(true); + SP_CTRLRECT(box)->setShadow(1, 0xffffffff); sp_canvas_item_move_to_z(box, 0); } @@ -167,7 +194,7 @@ void Inkscape::SelCue::_newItemBboxes() void Inkscape::SelCue::_newTextBaselines() { for (std::vector<SPCanvasItem*>::iterator i = _text_baselines.begin(); i != _text_baselines.end(); ++i) { - gtk_object_destroy(*i); + sp_canvas_item_destroy(*i); } _text_baselines.clear(); @@ -201,6 +228,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: |
