comparison data/model/SparseModel.h @ 387:7aa1de571880

* juggle some files around in order to free audioio, base, and system libraries from dependency on QtGui
author Chris Cannam
date Wed, 12 Mar 2008 17:42:56 +0000
parents 700cd3350391
children a1b6d2e33cab
comparison
equal deleted inserted replaced
386:e6d11871e4c9 387:7aa1de571880
16 #ifndef _SPARSE_MODEL_H_ 16 #ifndef _SPARSE_MODEL_H_
17 #define _SPARSE_MODEL_H_ 17 #define _SPARSE_MODEL_H_
18 18
19 #include "Model.h" 19 #include "Model.h"
20 #include "base/Command.h" 20 #include "base/Command.h"
21 #include "base/CommandHistory.h"
22 21
23 #include <iostream> 22 #include <iostream>
24 23
25 #include <set> 24 #include <set>
26 #include <QMutex> 25 #include <QMutex>
213 * Stack an arbitrary other command in the same sequence. 212 * Stack an arbitrary other command in the same sequence.
214 */ 213 */
215 virtual void addCommand(Command *command) { addCommand(command, true); } 214 virtual void addCommand(Command *command) { addCommand(command, true); }
216 215
217 /** 216 /**
218 * If any points have been added or deleted, add this command 217 * If any points have been added or deleted, return this
219 * to the command history. Otherwise delete the command. 218 * command (so the caller can add it to the command history).
219 * Otherwise delete the command.
220 */ 220 */
221 virtual void finish(); 221 virtual Command *finish();
222 222
223 protected: 223 protected:
224 virtual void addCommand(Command *command, bool executeFirst); 224 virtual void addCommand(Command *command, bool executeFirst);
225 225
226 SparseModel<PointType> *m_model; 226 SparseModel<PointType> *m_model;
598 { 598 {
599 addCommand(new DeletePointCommand(m_model, point), true); 599 addCommand(new DeletePointCommand(m_model, point), true);
600 } 600 }
601 601
602 template <typename PointType> 602 template <typename PointType>
603 void 603 Command *
604 SparseModel<PointType>::EditCommand::finish() 604 SparseModel<PointType>::EditCommand::finish()
605 { 605 {
606 if (!m_commands.empty()) { 606 if (!m_commands.empty()) {
607 CommandHistory::getInstance()->addCommand(this, false); 607 return this;
608 } else { 608 } else {
609 delete this; 609 delete this;
610 } 610 }
611 } 611 }
612 612