diff options
Diffstat (limited to 'libs/pbd/pbd')
-rw-r--r-- | libs/pbd/pbd/command.h | 1 | ||||
-rw-r--r-- | libs/pbd/pbd/controllable.h | 23 | ||||
-rw-r--r-- | libs/pbd/pbd/destructible.h | 22 | ||||
-rw-r--r-- | libs/pbd/pbd/memento_command.h | 12 | ||||
-rw-r--r-- | libs/pbd/pbd/statefuldestructible.h | 10 | ||||
-rw-r--r-- | libs/pbd/pbd/undo.h | 11 |
6 files changed, 33 insertions, 46 deletions
diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h index 7af7f7bb98..5a7290bc89 100644 --- a/libs/pbd/pbd/command.h +++ b/libs/pbd/pbd/command.h @@ -1,3 +1,4 @@ + /* Copyright (C) 2006 Paul Davis Author: Hans Fugal diff --git a/libs/pbd/pbd/controllable.h b/libs/pbd/pbd/controllable.h index 9750ebe56e..dbec03b396 100644 --- a/libs/pbd/pbd/controllable.h +++ b/libs/pbd/pbd/controllable.h @@ -24,8 +24,7 @@ v it under the terms of the GNU General Public License as published by #include <set> #include <map> -#include <sigc++/trackable.h> -#include <sigc++/signal.h> +#include <boost/signals2.hpp> #include <glibmm/thread.h> #include "pbd/statefuldestructible.h" @@ -45,16 +44,16 @@ class Controllable : public PBD::StatefulDestructible { virtual void set_value (float) = 0; virtual float get_value (void) const = 0; - sigc::signal<void> LearningFinished; - static sigc::signal<void,PBD::Controllable*,int,int> CreateBinding; - static sigc::signal<void,PBD::Controllable*> DeleteBinding; + boost::signals2::signal<void()> LearningFinished; + static boost::signals2::signal<void(PBD::Controllable*,int,int)> CreateBinding; + static boost::signals2::signal<void(PBD::Controllable*)> DeleteBinding; - static sigc::signal<bool,PBD::Controllable*> StartLearning; - static sigc::signal<void,PBD::Controllable*> StopLearning; + static boost::signals2::signal<bool(PBD::Controllable*)> StartLearning; + static boost::signals2::signal<void(PBD::Controllable*)> StopLearning; - static sigc::signal<void,Controllable*> Destroyed; - - sigc::signal<void> Changed; + static boost::signals2::signal<void(Controllable*)> Destroyed; + + boost::signals2::signal<void()> Changed; int set_state (const XMLNode&, int version); XMLNode& get_state (); @@ -73,8 +72,8 @@ class Controllable : public PBD::StatefulDestructible { std::string _uri; bool _touching; - void add (); - void remove (); + static void add (Controllable&); + static void remove (Controllable&); typedef std::set<PBD::Controllable*> Controllables; typedef std::map<std::string,PBD::Controllable*> ControllablesByURI; diff --git a/libs/pbd/pbd/destructible.h b/libs/pbd/pbd/destructible.h index 827feb8fe5..241d847aff 100644 --- a/libs/pbd/pbd/destructible.h +++ b/libs/pbd/pbd/destructible.h @@ -20,26 +20,20 @@ #ifndef __pbd_destructible_h__ #define __pbd_destructible_h__ -#include <sigc++/signal.h> +#include <boost/signals2.hpp> namespace PBD { -/* be very very careful using this class. it does not inherit from sigc::trackable and thus - should only be used in multiple-inheritance situations involving another type - that does inherit from sigc::trackable (or sigc::trackable itself) -*/ - -class ThingWithGoingAway { - public: - virtual ~ThingWithGoingAway () {} - sigc::signal<void> GoingAway; -}; - -class Destructible : public sigc::trackable, public ThingWithGoingAway { +class Destructible { public: + Destructible() : refs_dropped (false){} virtual ~Destructible () {} - void drop_references () const { GoingAway(); } + + boost::signals2::signal<void ()> GoingAway; + void drop_references () { if (!refs_dropped) { GoingAway(); } refs_dropped = true; } + private: + bool refs_dropped; }; } diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index c1e5d75f9c..c5e8b19272 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -26,7 +26,6 @@ #include "pbd/command.h" #include "pbd/stacktrace.h" #include "pbd/xml++.h" -#include "pbd/shiva.h" #include <sigc++/slot.h> #include <typeinfo> @@ -42,16 +41,20 @@ public: MementoCommand(obj_T& a_object, XMLNode* a_before, XMLNode* a_after) : obj(a_object), before(a_before), after(a_after) { - /* catch destruction of the object */ - new PBD::PairedShiva< obj_T,MementoCommand<obj_T> > (obj, *this); + /* if the object dies, make sure that we die and that everyone knows about it */ + obj_death_connection = obj.GoingAway.connect (boost::bind (&MementoCommand::object_died, this)); } ~MementoCommand () { - GoingAway(); /* EMIT SIGNAL */ + drop_references (); delete before; delete after; } + void object_died () { + delete this; + } + void operator() () { if (after) { obj.set_state(*after, Stateful::current_state_version); @@ -94,6 +97,7 @@ protected: obj_T& obj; XMLNode* before; XMLNode* after; + boost::signals2::scoped_connection obj_death_connection; }; #endif // __lib_pbd_memento_h__ diff --git a/libs/pbd/pbd/statefuldestructible.h b/libs/pbd/pbd/statefuldestructible.h index 49a33ff438..36eb43147c 100644 --- a/libs/pbd/pbd/statefuldestructible.h +++ b/libs/pbd/pbd/statefuldestructible.h @@ -29,16 +29,6 @@ class StatefulDestructible : public Stateful, public Destructible { }; -/* be very very careful using this class. it does not inherit from sigc::trackable and thus - should only be used in multiple-inheritance situations involving another type - that does inherit from sigc::trackable (or sigc::trackable itself) -*/ - -class StatefulThingWithGoingAway : public Stateful, public ThingWithGoingAway -{ -}; - } - #endif /* __pbd_stateful_destructible_h__ */ diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 0e48bea962..6340ef04b9 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -26,12 +26,13 @@ #include <sigc++/slot.h> #include <sigc++/bind.h> #include <sys/time.h> + +#include "pbd/scoped_connections.h" #include "pbd/command.h" -#include "pbd/shiva.h" typedef sigc::slot<void> UndoAction; -class UndoTransaction : public Command +class UndoTransaction : public Command, public PBD::ScopedConnectionList { public: UndoTransaction (); @@ -61,7 +62,6 @@ class UndoTransaction : public Command private: std::list<Command*> actions; - std::list<PBD::ProxyShiva<Command,UndoTransaction>*> shivas; struct timeval _timestamp; bool _clearing; @@ -71,10 +71,9 @@ class UndoTransaction : public Command ~UndoTransaction (); void about_to_explicitly_delete (); - }; -class UndoHistory : public sigc::trackable +class UndoHistory : public PBD::ScopedConnectionList { public: UndoHistory(); @@ -107,7 +106,7 @@ class UndoHistory : public sigc::trackable void set_depth (uint32_t); - sigc::signal<void> Changed; + boost::signals2::signal<void()> Changed; private: bool _clearing; |