Add function LayerTreeStore::queue_rebuild(). Nothing uses it yet.
authordooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 19 Nov 2008 13:43:47 +0000 (13:43 +0000)
committerdooglus <dooglus@1f10aa63-cdf2-0310-b900-c93c546f37ac>
Wed, 19 Nov 2008 13:43:47 +0000 (13:43 +0000)
git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2220 1f10aa63-cdf2-0310-b900-c93c546f37ac

synfig-studio/trunk/src/gtkmm/layertreestore.cpp
synfig-studio/trunk/src/gtkmm/layertreestore.h

index 959582c..04e5814 100644 (file)
@@ -70,6 +70,7 @@ static LayerTreeStore::Model& ModelHack()
 
 LayerTreeStore::LayerTreeStore(etl::loose_handle<synfigapp::CanvasInterface> 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---------");
index 6dd853c..0875d51 100644 (file)
@@ -103,6 +103,10 @@ public:
 
 private:
 
+       bool queued;
+
+       sigc::connection queue_connection;
+
        etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
 
        Glib::RefPtr<Gdk::Pixbuf> 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();