diff base/PropertyContainer.h @ 46:5364a9d338a2

* Add Insert Instant function in main window * Ensure selections and window geometry are saved in session file * Add wait cursor on session file save * Various improvements to display of texts in pane (clearer readability) * Use commands for setting properties on layers and panes (still need to batch up multiple sets on the same property) * Fix failure of spectrogram to refresh when initial part became visible * Some fixes & paint optimisations in View &c * Make curve mode for time value layers work properly when resolution == 1 * Some vague improvements for time value layer vertical scale
author Chris Cannam
date Thu, 16 Mar 2006 18:46:00 +0000
parents 8460b3bf8f04
children 39ae3dee27b9
line wrap: on
line diff
--- a/base/PropertyContainer.h	Wed Mar 15 18:11:23 2006 +0000
+++ b/base/PropertyContainer.h	Thu Mar 16 18:46:00 2006 +0000
@@ -10,6 +10,8 @@
 #ifndef _PROPERTY_CONTAINER_H_
 #define _PROPERTY_CONTAINER_H_
 
+#include "Command.h"
+
 #include <QString>
 #include <QObject>
 #include <vector>
@@ -89,6 +91,30 @@
      * colours, the integer value should be treated as a qRgb.
      */
     virtual void setProperty(const PropertyName &, int value);
+
+    /**
+     * Set a property using a command, supporting undo and redo.
+     */
+    virtual void setPropertyWithCommand(const PropertyName &, int value);
+
+protected:
+
+    class SetPropertyCommand : public Command
+    {
+    public:
+	SetPropertyCommand(PropertyContainer *pc, const PropertyName &pn, int);
+	virtual ~SetPropertyCommand() { }
+
+	virtual void execute();
+	virtual void unexecute();
+	virtual QString getName() const;
+
+    protected:
+	PropertyContainer *m_pc;
+	PropertyName m_pn;
+	int m_value;
+	int m_oldValue;
+    };
 };
 
 #endif