Mercurial > hg > svgui
comparison 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 |
comparison
equal
deleted
inserted
replaced
376:e1a9e478b7f2 | 377:0bcb449d15f4 |
---|---|
19 #include "view/View.h" | 19 #include "view/View.h" |
20 #include "layer/Layer.h" | 20 #include "layer/Layer.h" |
21 #include "layer/LayerFactory.h" | 21 #include "layer/LayerFactory.h" |
22 #include "widgets/NotifyingTabBar.h" | 22 #include "widgets/NotifyingTabBar.h" |
23 #include "widgets/IconLoader.h" | 23 #include "widgets/IconLoader.h" |
24 #include "base/Command.h" | |
25 #include "widgets/CommandHistory.h" | |
24 | 26 |
25 #include <QIcon> | 27 #include <QIcon> |
26 #include <QTabWidget> | 28 #include <QTabWidget> |
27 | 29 |
28 #include <iostream> | 30 #include <iostream> |
196 { | 198 { |
197 if (sender() != m_client) return; | 199 if (sender() != m_client) return; |
198 repopulate(); | 200 repopulate(); |
199 } | 201 } |
200 | 202 |
203 class ShowLayerCommand : public QObject, public Command | |
204 { | |
205 public: | |
206 ShowLayerCommand(View *view, Layer *layer, bool show) : | |
207 m_view(view), m_layer(layer), m_show(show) { } | |
208 void execute() { | |
209 m_layer->showLayer(m_view, m_show); | |
210 } | |
211 void unexecute() { | |
212 m_layer->showLayer(m_view, !m_show); | |
213 } | |
214 QString getName() const { | |
215 return tr("Change Layer Visibility"); | |
216 } | |
217 protected: | |
218 View *m_view; | |
219 Layer *m_layer; | |
220 bool m_show; | |
221 }; | |
222 | |
201 void | 223 void |
202 PropertyStack::showLayer(bool show) | 224 PropertyStack::showLayer(bool show) |
203 { | 225 { |
204 QObject *obj = sender(); | 226 QObject *obj = sender(); |
205 | 227 |
206 for (unsigned int i = 0; i < m_boxes.size(); ++i) { | 228 for (unsigned int i = 0; i < m_boxes.size(); ++i) { |
207 if (obj == m_boxes[i]) { | 229 if (obj == m_boxes[i]) { |
208 Layer *layer = dynamic_cast<Layer *>(m_boxes[i]->getContainer()); | 230 Layer *layer = dynamic_cast<Layer *>(m_boxes[i]->getContainer()); |
209 if (layer) { | 231 if (layer) { |
210 layer->showLayer(m_client, show); | 232 CommandHistory::getInstance()->addCommand |
233 (new ShowLayerCommand(m_client, layer, show)); | |
211 return; | 234 return; |
212 } | 235 } |
213 } | 236 } |
214 } | 237 } |
215 } | 238 } |