Mercurial > hg > svcore
comparison base/Command.cpp @ 19:a7ed14263fe4
* Add Chromagram plugin, and make a number of fixes to the dense 3d model
and colour 3d plot class to accommodate it
* Add pitch-conversion methods in base/Pitch
* Commit previously overlooked Command.cpp
author | Chris Cannam |
---|---|
date | Wed, 01 Feb 2006 14:49:49 +0000 |
parents | |
children | bac8b14ab355 |
comparison
equal
deleted
inserted
replaced
18:4563a72c1d8b | 19:a7ed14263fe4 |
---|---|
1 /* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 A waveform viewer and audio annotation editor. | |
5 Chris Cannam, Queen Mary University of London, 2005-2006 | |
6 | |
7 This is experimental software. Not for distribution. | |
8 */ | |
9 | |
10 #include "Command.h" | |
11 | |
12 MacroCommand::MacroCommand(QString name) : | |
13 m_name(name) | |
14 { | |
15 } | |
16 | |
17 MacroCommand::~MacroCommand() | |
18 { | |
19 for (size_t i = 0; i < m_commands.size(); ++i) { | |
20 delete m_commands[i]; | |
21 } | |
22 } | |
23 | |
24 void | |
25 MacroCommand::addCommand(Command *command) | |
26 { | |
27 m_commands.push_back(command); | |
28 } | |
29 | |
30 void | |
31 MacroCommand::deleteCommand(Command *command) | |
32 { | |
33 for (std::vector<Command *>::iterator i = m_commands.begin(); | |
34 i != m_commands.end(); ++i) { | |
35 | |
36 if (*i == command) { | |
37 m_commands.erase(i); | |
38 delete command; | |
39 return; | |
40 } | |
41 } | |
42 } | |
43 | |
44 void | |
45 MacroCommand::execute() | |
46 { | |
47 for (size_t i = 0; i < m_commands.size(); ++i) { | |
48 m_commands[i]->execute(); | |
49 } | |
50 } | |
51 | |
52 void | |
53 MacroCommand::unexecute() | |
54 { | |
55 for (size_t i = 0; i < m_commands.size(); ++i) { | |
56 m_commands[m_commands.size() - i - 1]->unexecute(); | |
57 } | |
58 } | |
59 |