diff options
| author | Diederik van Lierop <mail@diedenrezi.nl> | 2019-10-30 11:27:27 +0000 |
|---|---|---|
| committer | Diederik van Lierop <mail@diedenrezi.nl> | 2019-10-30 11:32:11 +0000 |
| commit | 75baf74e08c3d39cd27360251a7cb7664c5f3d71 (patch) | |
| tree | afabb22dc1ab1d3ecd2d6ded54c2cea51714aea3 /src/ui/dialog/objects.h | |
| parent | Remove _drawbox deps pointed by Thomas (diff) | |
| download | inkscape-75baf74e08c3d39cd27360251a7cb7664c5f3d71.tar.gz inkscape-75baf74e08c3d39cd27360251a7cb7664c5f3d71.zip | |
Update the treeview in the objects-panel asynchronously, such that Inkscape stays responsive with documents having a large number of objects
Diffstat (limited to 'src/ui/dialog/objects.h')
| -rw-r--r-- | src/ui/dialog/objects.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index 21e6c6ce3..5c8de59dd 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -90,6 +90,9 @@ private: sigc::connection _blendConnection; sigc::connection _blurConnection; + sigc::connection _processQueue_sig; + sigc::connection _executeUpdate_sig; + //Desktop tracker for grabbing the desktop changed connection DesktopTracker _deskTrack; @@ -109,7 +112,6 @@ private: // InternalUIBounce* _pending; - bool _pendingUpdateTree; //Whether the drag & drop was dragged into an item gboolean _dnd_into; @@ -133,6 +135,13 @@ private: Gtk::TreeModel::Path _defer_target; Glib::RefPtr<Gtk::TreeStore> _store; + std::list<std::tuple<SPItem*, Gtk::TreeModel::iterator, bool> > _tree_update_queue; + //When the user selects an item in the document, we need to find that item in the tree view + //and highlight it. When looking up a specific item in the tree though, we don't want to have + //to iterate through the whole list, as this would take too long if the list is very long. So + //we will use a std::map for this instead, which is much faster (and call it _tree_cache). It + //would have been cleaner to create our own custom tree model, as described here + //https://en.wikibooks.org/wiki/GTK%2B_By_Example/Tree_View/Tree_Models std::map<SPItem*, Gtk::TreeModel::iterator> _tree_cache; std::vector<Gtk::Widget*> _watching; @@ -217,7 +226,9 @@ private: void _removeWatchers(); void _objectsChangedWrapper(SPObject *obj); void _objectsChanged(SPObject *obj); - void _addObject( SPObject* obj, Gtk::TreeModel::Row* parentRow ); + bool _processQueue(); + void _queueObject(SPObject* obj, Gtk::TreeModel::Row* parentRow); + void _addObject(SPItem* item, const Gtk::TreeModel::Row &parentRow, bool expanded); void _isolationChangedIter(const Gtk::TreeIter &iter); void _isolationValueChanged(); |
