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);
}
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---------");
private:
+ bool queued;
+
+ sigc::connection queue_connection;
+
etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
Glib::RefPtr<Gdk::Pixbuf> layer_icon;
bool find_prev_layer_row(const synfig::Layer::Handle &handle, Gtk::TreeModel::Children::iterator &iter);
+ void queue_rebuild();
+
void rebuild();
void refresh();