summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/pbd')
-rw-r--r--libs/pbd/pbd/abstract_ui.cc1
-rw-r--r--libs/pbd/pbd/command.h2
-rw-r--r--libs/pbd/pbd/memento_command.h2
-rw-r--r--libs/pbd/pbd/pthread_utils.h7
-rw-r--r--libs/pbd/pbd/shiva.h21
-rw-r--r--libs/pbd/pbd/undo.h22
6 files changed, 36 insertions, 19 deletions
diff --git a/libs/pbd/pbd/abstract_ui.cc b/libs/pbd/pbd/abstract_ui.cc
index 97f19e1fe5..8e5b9ceb07 100644
--- a/libs/pbd/pbd/abstract_ui.cc
+++ b/libs/pbd/pbd/abstract_ui.cc
@@ -17,7 +17,6 @@ AbstractUI<RequestObject>::AbstractUI (string name, bool with_signal_pipes)
throw failed_constructor();
}
- PBD::ThreadCreated.connect (mem_fun (*this, &AbstractUI<RequestObject>::register_thread));
PBD::ThreadCreatedWithRequestSize.connect (mem_fun (*this, &AbstractUI<RequestObject>::register_thread_with_request_count));
}
diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h
index a66485bc0d..3fac531591 100644
--- a/libs/pbd/pbd/command.h
+++ b/libs/pbd/pbd/command.h
@@ -26,7 +26,7 @@
class Command : public PBD::StatefulDestructible
{
public:
- virtual ~Command() {}
+ virtual ~Command() { /* NOTE: derived classes must call drop_references() */ }
virtual void operator() () = 0;
diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h
index fdc7527dc6..660e5875d5 100644
--- a/libs/pbd/pbd/memento_command.h
+++ b/libs/pbd/pbd/memento_command.h
@@ -43,7 +43,7 @@ public:
: obj(object), before(before), after(after)
{
/* catch destruction of the object */
- new PBD::Shiva<obj_T,MementoCommand<obj_T> > (object, *this);
+ new PBD::PairedShiva<obj_T,MementoCommand<obj_T> > (object, *this);
}
~MementoCommand ()
diff --git a/libs/pbd/pbd/pthread_utils.h b/libs/pbd/pbd/pthread_utils.h
index 9fa6ba4ce4..dd91e0a2b1 100644
--- a/libs/pbd/pbd/pthread_utils.h
+++ b/libs/pbd/pbd/pthread_utils.h
@@ -35,8 +35,11 @@ void pthread_exit_pbd (void* status);
std::string pthread_name ();
namespace PBD {
- extern sigc::signal<void,pthread_t,std::string> ThreadCreated;
- extern sigc::signal<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
+ extern void notify_gui_about_thread_creation (pthread_t, std::string, int requests = 256);
+ extern void notify_gui_about_thread_exit (pthread_t);
+
+ extern sigc::signal<void,pthread_t> ThreadLeaving;
+ extern sigc::signal<void,pthread_t,std::string,uint32_t> ThreadCreatedWithRequestSize;
}
#endif /* __pbd_pthread_utils__ */
diff --git a/libs/pbd/pbd/shiva.h b/libs/pbd/pbd/shiva.h
index 2e53ff65f5..90adad6250 100644
--- a/libs/pbd/pbd/shiva.h
+++ b/libs/pbd/pbd/shiva.h
@@ -27,7 +27,8 @@ namespace PBD {
/* named after the Hindu god Shiva, The Destroyer */
template<typename ObjectWithGoingAway, typename ObjectToBeDestroyed>
-class Shiva {
+class Shiva : public sigc::trackable
+{
public:
Shiva (ObjectWithGoingAway& emitter, ObjectToBeDestroyed& receiver) {
@@ -58,15 +59,15 @@ class Shiva {
};
template<typename ObjectWithGoingAway, typename ObjectToBeDestroyed>
-class ProxyShiva {
+class ProxyShiva : public sigc::trackable
+{
public:
ProxyShiva (ObjectWithGoingAway& emitter, ObjectToBeDestroyed& receiver, void (*callback)(ObjectToBeDestroyed*, ObjectWithGoingAway*)) {
-
+
/* if the emitter goes away, destroy the receiver */
_callback = callback;
- _callback_argument1 = &receiver;
- _callback_argument2 = &emitter;
+ _callback_argument = &emitter;
_connection = emitter.GoingAway.connect
(sigc::bind (sigc::mem_fun
@@ -74,19 +75,18 @@ class ProxyShiva {
&receiver));
}
- ~ProxyShiva() {
+ ~ProxyShiva () {
forget ();
}
private:
sigc::connection _connection;
void (*_callback) (ObjectToBeDestroyed*, ObjectWithGoingAway*);
- ObjectToBeDestroyed* _callback_argument1;
- ObjectWithGoingAway* _callback_argument2;
+ ObjectWithGoingAway* _callback_argument;
void destroy (ObjectToBeDestroyed* obj) {
/* callback must destroy obj if appropriate, not done here */
- _callback (obj, _callback_argument2);
+ _callback (obj, _callback_argument);
forget ();
}
@@ -96,7 +96,8 @@ class ProxyShiva {
};
template<typename ObjectWithGoingAway, typename ObjectToBeDestroyed>
-class PairedShiva {
+class PairedShiva : public sigc::trackable
+{
public:
PairedShiva (ObjectWithGoingAway& emitter, ObjectToBeDestroyed& receiver) {
diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h
index 8f1716d09f..cf1f6f3470 100644
--- a/libs/pbd/pbd/undo.h
+++ b/libs/pbd/pbd/undo.h
@@ -27,6 +27,7 @@
#include <sigc++/bind.h>
#include <sys/time.h>
#include <pbd/command.h>
+#include <pbd/shiva.h>
typedef sigc::slot<void> UndoAction;
@@ -36,7 +37,6 @@ class UndoTransaction : public Command
UndoTransaction ();
UndoTransaction (const UndoTransaction&);
UndoTransaction& operator= (const UndoTransaction&);
- ~UndoTransaction ();
void clear ();
bool empty() const;
@@ -61,10 +61,17 @@ class UndoTransaction : public Command
private:
std::list<Command*> actions;
+ std::list<PBD::ProxyShiva<Command,UndoTransaction>*> shivas;
struct timeval _timestamp;
bool _clearing;
friend void command_death (UndoTransaction*, Command *);
+
+ friend class UndoHistory;
+
+ ~UndoTransaction ();
+ void about_to_explicitly_delete ();
+
};
class UndoHistory : public sigc::trackable
@@ -87,17 +94,24 @@ class UndoHistory : public sigc::trackable
void clear_undo ();
void clear_redo ();
+ /* returns all or part of the history.
+ If depth==0 it returns just the top
+ node. If depth<0, it returns everything.
+ If depth>0, it returns state for that
+ many elements of the history, or
+ the full history, whichever is smaller.
+ */
+
XMLNode &get_state(int32_t depth = 0);
void save_state();
- void set_depth (int32_t);
- int32_t get_depth() const { return _depth; }
+ void set_depth (uint32_t);
sigc::signal<void> Changed;
private:
bool _clearing;
- int32_t _depth;
+ uint32_t _depth;
std::list<UndoTransaction*> UndoList;
std::list<UndoTransaction*> RedoList;