diff widgets/PropertyStack.cpp @ 377:0bcb449d15f4

* Fix #1628781 changes to layer visibility and mute should use a command * Also use a command for changes to layer playback pan, gain, plugin settings * Refactor PlayParameterRepository to remove dependency on audioio from base * Fix failure to save play parameters for main model in session file
author Chris Cannam
date Thu, 13 Mar 2008 14:06:03 +0000
parents d58701996fae
children 2c59b0cd176b
line wrap: on
line diff
--- a/widgets/PropertyStack.cpp	Wed Mar 12 17:42:56 2008 +0000
+++ b/widgets/PropertyStack.cpp	Thu Mar 13 14:06:03 2008 +0000
@@ -21,6 +21,8 @@
 #include "layer/LayerFactory.h"
 #include "widgets/NotifyingTabBar.h"
 #include "widgets/IconLoader.h"
+#include "base/Command.h"
+#include "widgets/CommandHistory.h"
 
 #include <QIcon>
 #include <QTabWidget>
@@ -198,6 +200,26 @@
     repopulate();
 }
 
+class ShowLayerCommand : public QObject, public Command
+{
+public:
+    ShowLayerCommand(View *view, Layer *layer, bool show) :
+        m_view(view), m_layer(layer), m_show(show) { }
+    void execute() {
+        m_layer->showLayer(m_view, m_show);
+    }
+    void unexecute() {
+        m_layer->showLayer(m_view, !m_show);
+    }
+    QString getName() const {
+        return tr("Change Layer Visibility");
+    }
+protected:
+    View *m_view;
+    Layer *m_layer;
+    bool m_show;
+};
+
 void
 PropertyStack::showLayer(bool show)
 {
@@ -207,7 +229,8 @@
 	if (obj == m_boxes[i]) {
 	    Layer *layer = dynamic_cast<Layer *>(m_boxes[i]->getContainer());
 	    if (layer) {
-		layer->showLayer(m_client, show);
+                CommandHistory::getInstance()->addCommand
+                    (new ShowLayerCommand(m_client, layer, show));
 		return;
 	    }
 	}