X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Ftrunk%2Fsrc%2Fgtkmm%2Flayertreestore.cpp;h=38896f05a1b11ede4f5b2f64d1f7cccb8a1b857b;hb=fac9dc0a044a6529e474a325332ba17502d6e7b2;hp=04e581450938884d946816a61136061dcc35ad96;hpb=04344c6669f73c2a4c3a684d9bf5743a1ec71bee;p=synfig.git diff --git a/synfig-studio/trunk/src/gtkmm/layertreestore.cpp b/synfig-studio/trunk/src/gtkmm/layertreestore.cpp index 04e5814..38896f0 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 @@ -350,7 +351,7 @@ LayerTreeStore::set_value_impl(const Gtk::TreeModel::iterator& iter, int column, } catch(std::exception x) { - g_warning(x.what()); + g_warning("%s", x.what()); } } @@ -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);