//while(correct_canvas->is_inline())correct_canvas=correct_canvas->parent();
Layer::LooseHandle loose_layer(x);
- x->signal_added_to_group().connect(
- sigc::bind(
- sigc::mem_fun(
- *correct_canvas,
- &Canvas::add_group_pair
- ),
- loose_layer
- )
- );
- x->signal_removed_from_group().connect(
- sigc::bind(
- sigc::mem_fun(
- *correct_canvas,
- &Canvas::remove_group_pair
- ),
- loose_layer
- )
- );
+ add_connection(x,
+ sigc::connection::connection(
+ x->signal_added_to_group().connect(
+ sigc::bind(
+ sigc::mem_fun(
+ *correct_canvas,
+ &Canvas::add_group_pair),
+ loose_layer))));
+ add_connection(x,
+ sigc::connection::connection(
+ x->signal_removed_from_group().connect(
+ sigc::bind(
+ sigc::mem_fun(
+ *correct_canvas,
+ &Canvas::remove_group_pair),
+ loose_layer))));
if(!x->get_group().empty())
// is using these signals, so I'll just
// leave these next two lines like they
// are for now - darco 07-30-2004
- (*iter)->signal_added_to_group().clear();
- (*iter)->signal_removed_from_group().clear();
+
+ // so don't wipe them out entirely
+ // - dooglus 09-21-2007
+ disconnect_connections(*iter);
if(!op_flag_)remove_child(iter->get());
}
void
+Canvas::add_connection(etl::handle<Layer> layer, sigc::connection connection)
+{
+ connections_[layer].push_back(connection);
+}
+
+void
+Canvas::disconnect_connections(etl::handle<Layer> layer)
+{
+ std::vector<sigc::connection>::iterator iter;
+ for(iter=connections_[layer].begin();iter!=connections_[layer].end();++iter)
+ iter->disconnect();
+ connections_[layer].clear();
+}
+
+void
Canvas::rename_group(const String&old_name,const String&new_name)
{
if(is_inline() && parent_)
#include <list>
#include <ETL/handle>
#include <sigc++/signal.h>
+#include <sigc++/connection.h>
#include "vector.h"
#include "string.h"
//! Layer Group database
std::map<String,std::set<etl::handle<Layer> > > group_db_;
+ //! Layer Connection database
+ std::map<etl::handle<Layer>,std::vector<sigc::connection> > connections_;
+
/*
-- ** -- S I G N A L S -------------------------------------------------------
*/
private:
void add_group_pair(String group, etl::handle<Layer> layer);
void remove_group_pair(String group, etl::handle<Layer> layer);
+ void add_connection(etl::handle<Layer> layer, sigc::connection connection);
+ void disconnect_connections(etl::handle<Layer> layer);
protected:
virtual void on_changed();