diff options
| author | chr <chr> | 2017-05-18 17:58:59 +0000 |
|---|---|---|
| committer | chr <chr> | 2017-05-18 17:58:59 +0000 |
| commit | a3789bc9a1739f158a023ff34d7e647e697f606e (patch) | |
| tree | bd9e4e1daaf607493c113ff2d93eb2dd7a838c29 /src | |
| parent | object manager panel: fix clip/mask icons (diff) | |
| download | inkscape-a3789bc9a1739f158a023ff34d7e647e697f606e.tar.gz inkscape-a3789bc9a1739f158a023ff34d7e647e697f606e.zip | |
ObjectsPanel: Polish collapse/expand behaviour
(bzr r15698.1.5)
Diffstat (limited to 'src')
| -rw-r--r-- | src/ui/dialog/objects.cpp | 12 | ||||
| -rw-r--r-- | src/ui/dialog/objects.h | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 6b28c3b2f..db937a6a8 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -360,6 +360,7 @@ void ObjectsPanel::_addObject(SPObject* obj, Gtk::TreeModel::Row* parentRow) if (SP_IS_GROUP(obj) && SP_GROUP(obj)->expanded()) { _tree.expand_to_path( _store->get_path(iter) ); + _tree.collapse_row( _store->get_path(iter) ); } //Add an object watcher to the item @@ -479,13 +480,13 @@ void ObjectsPanel::_objectsSelected( Selection *sel ) { _setCompositingValues(item); setOpacity = false; } - _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, (*i)==items.back())); + _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, (*i)==items.back(), false)); } if (!item) { if (_desktop->currentLayer() && SP_IS_ITEM(_desktop->currentLayer())) { item = SP_ITEM(_desktop->currentLayer()); _setCompositingValues(item); - _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, true)); + _store->foreach(sigc::bind<SPItem *, bool>( sigc::mem_fun(*this, &ObjectsPanel::_checkForSelected), item, true, true)); } } _selectedConnection.unblock(); @@ -551,7 +552,7 @@ void ObjectsPanel::_setCompositingValues(SPItem *item) * @param scrollto Whether to scroll to the item * @return Whether to continue searching the tree */ -bool ObjectsPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto) +bool ObjectsPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto, bool expand) { bool stopGoing = false; @@ -560,13 +561,16 @@ bool ObjectsPanel::_checkForSelected(const Gtk::TreePath &path, const Gtk::TreeI { //We found the item! Expand to the path and select it in the tree. _tree.expand_to_path( path ); + if (!expand) + // but don't expand itself, just the path + _tree.collapse_row(path); Glib::RefPtr<Gtk::TreeSelection> select = _tree.get_selection(); select->select(iter); if (scrollto) { //Scroll to the item in the tree - _tree.scroll_to_row(path); + _tree.scroll_to_row(path, 0.5); } stopGoing = true; diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index 018f9191f..995f8c37f 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -216,7 +216,7 @@ private: bool _checkForUpdated(const Gtk::TreeIter& iter, SPObject* obj); void _objectsSelected(Selection *sel); - bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto); + bool _checkForSelected(const Gtk::TreePath& path, const Gtk::TreeIter& iter, SPItem* item, bool scrollto, bool expand); void _objectsChanged(SPObject *obj); void _addObject( SPObject* obj, Gtk::TreeModel::Row* parentRow ); |
