From 04344c6669f73c2a4c3a684d9bf5743a1ec71bee Mon Sep 17 00:00:00 2001 From: dooglus Date: Wed, 19 Nov 2008 13:43:47 +0000 Subject: [PATCH] Add function LayerTreeStore::queue_rebuild(). Nothing uses it yet. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2220 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-studio/trunk/src/gtkmm/layertreestore.cpp | 17 +++++++++++++++++ synfig-studio/trunk/src/gtkmm/layertreestore.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/synfig-studio/trunk/src/gtkmm/layertreestore.cpp b/synfig-studio/trunk/src/gtkmm/layertreestore.cpp index 959582c..04e5814 100644 --- a/synfig-studio/trunk/src/gtkmm/layertreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/layertreestore.cpp @@ -70,6 +70,7 @@ static LayerTreeStore::Model& ModelHack() LayerTreeStore::LayerTreeStore(etl::loose_handle canvas_interface_): Gtk::TreeStore (ModelHack()), + queued (false), canvas_interface_ (canvas_interface_) { layer_icon=Gtk::Button().render_icon(Gtk::StockID("synfig-layer"),Gtk::ICON_SIZE_SMALL_TOOLBAR); @@ -586,8 +587,24 @@ LayerTreeStore::drag_data_received_vfunc (const TreeModel::Path& dest, const Gtk } void +LayerTreeStore::queue_rebuild() +{ + if (queued) return; + queued = false; + queue_connection.disconnect(); + queue_connection=Glib::signal_timeout().connect( + sigc::bind_return( + sigc::mem_fun(*this,&LayerTreeStore::rebuild), + false + ) + ,150); +} + +void LayerTreeStore::rebuild() { + if (queued) queued = false; + //etl::clock timer;timer.reset(); //synfig::warning("---------rebuilding layer table---------"); diff --git a/synfig-studio/trunk/src/gtkmm/layertreestore.h b/synfig-studio/trunk/src/gtkmm/layertreestore.h index 6dd853c..0875d51 100644 --- a/synfig-studio/trunk/src/gtkmm/layertreestore.h +++ b/synfig-studio/trunk/src/gtkmm/layertreestore.h @@ -103,6 +103,10 @@ public: private: + bool queued; + + sigc::connection queue_connection; + etl::loose_handle canvas_interface_; Glib::RefPtr layer_icon; @@ -184,6 +188,8 @@ public: bool find_prev_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter); + void queue_rebuild(); + void rebuild(); void refresh(); -- 2.7.4