From: dooglus Date: Wed, 19 Nov 2008 13:45:05 +0000 (+0000) Subject: Use the functions from the last two revisions to rebuild the layer tree whenever... X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=5b221c440f2b0e097546d65cd992841a164fa1bc;p=synfig.git Use the functions from the last two revisions to rebuild the layer tree whenever a PasteCanvas layer in the tree has its subcanvas changed. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2222 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/layertreestore.cpp b/synfig-studio/trunk/src/gtkmm/layertreestore.cpp index 04e5814..20e0cf6 100644 --- a/synfig-studio/trunk/src/gtkmm/layertreestore.cpp +++ b/synfig-studio/trunk/src/gtkmm/layertreestore.cpp @@ -38,6 +38,7 @@ #include #include "app.h" #include "instance.h" +#include #include #include @@ -605,6 +606,12 @@ LayerTreeStore::rebuild() { if (queued) queued = false; + // disconnect any subcanvas_changed connections + std::map::iterator iter; + for (iter = subcanvas_changed_connections.begin(); iter != subcanvas_changed_connections.end(); iter++) + iter->second.disconnect(); + subcanvas_changed_connections.clear(); + //etl::clock timer;timer.reset(); //synfig::warning("---------rebuilding layer table---------"); @@ -753,6 +760,12 @@ LayerTreeStore::set_row_layer(Gtk::TreeRow &row,synfig::Layer::Handle &handle) void LayerTreeStore::on_layer_added(synfig::Layer::Handle layer) { + if (etl::handle::cast_dynamic(layer)) + subcanvas_changed_connections[layer] = + (etl::handle::cast_dynamic(layer))->signal_subcanvas_changed().connect( + sigc::mem_fun(*this,&studio::LayerTreeStore::queue_rebuild) + ); + assert(layer); Gtk::TreeRow row; if(canvas_interface()->get_canvas()==layer->get_canvas()) @@ -775,6 +788,11 @@ LayerTreeStore::on_layer_added(synfig::Layer::Handle layer) void LayerTreeStore::on_layer_removed(synfig::Layer::Handle handle) { + if (etl::handle::cast_dynamic(handle)) + { + subcanvas_changed_connections[handle].disconnect(); + subcanvas_changed_connections.erase(handle); + } Gtk::TreeModel::Children::iterator iter; if(find_layer_row(handle,iter)) erase(iter); diff --git a/synfig-studio/trunk/src/gtkmm/layertreestore.h b/synfig-studio/trunk/src/gtkmm/layertreestore.h index 0875d51..5b33309 100644 --- a/synfig-studio/trunk/src/gtkmm/layertreestore.h +++ b/synfig-studio/trunk/src/gtkmm/layertreestore.h @@ -107,6 +107,8 @@ private: sigc::connection queue_connection; + std::map subcanvas_changed_connections; + etl::loose_handle canvas_interface_; Glib::RefPtr layer_icon;