Mercurial > hg > svcore
changeset 17:2fb933f88604
* Update some copyright notice dates
* Add commands for basic editing operations in time-instants and time-value layers
author | Chris Cannam |
---|---|
date | Tue, 31 Jan 2006 15:57:25 +0000 |
parents | cc98d496d52b |
children | 4563a72c1d8b |
files | base/AudioLevel.cpp base/AudioLevel.h base/Command.h base/CommandHistory.cpp base/CommandHistory.h base/MultiViewCommandHistory.cpp base/MultiViewCommandHistory.h base/Profiler.cpp base/Profiler.h base/RealTime.cpp base/RealTime.h base/RingBuffer.h base/Scavenger.h plugin/DSSIPluginFactory.cpp plugin/DSSIPluginFactory.h plugin/DSSIPluginInstance.cpp plugin/DSSIPluginInstance.h plugin/LADSPAPluginFactory.cpp plugin/LADSPAPluginFactory.h plugin/LADSPAPluginInstance.cpp plugin/LADSPAPluginInstance.h plugin/PluginIdentifier.cpp plugin/PluginIdentifier.h plugin/RealTimePluginFactory.cpp plugin/RealTimePluginFactory.h plugin/RealTimePluginInstance.cpp plugin/RealTimePluginInstance.h |
diffstat | 27 files changed, 537 insertions(+), 458 deletions(-) [+] |
line wrap: on
line diff
--- a/base/AudioLevel.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/base/AudioLevel.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #include "base/AudioLevel.h"
--- a/base/AudioLevel.h Mon Jan 30 17:51:56 2006 +0000 +++ b/base/AudioLevel.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _AUDIO_LEVEL_H_
--- a/base/Command.h Mon Jan 30 17:51:56 2006 +0000 +++ b/base/Command.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,12 +10,38 @@ #ifndef _COMMAND_H_ #define _COMMAND_H_ +#include <QString> +#include <vector> + class Command { public: + virtual ~Command() { } + virtual void execute() = 0; virtual void unexecute() = 0; - virtual QString name() const = 0; + virtual QString getName() const = 0; +}; + +class MacroCommand : public Command +{ +public: + MacroCommand(QString name); + virtual ~MacroCommand(); + + virtual void addCommand(Command *command); + virtual void deleteCommand(Command *command); + virtual bool haveCommands() const { return !m_commands.empty(); } + + virtual void execute(); + virtual void unexecute(); + + virtual QString getName() const { return m_name; } + virtual void setName(QString name) { m_name = name; } + +protected: + QString m_name; + std::vector<Command *> m_commands; }; #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/CommandHistory.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -0,0 +1,333 @@ +/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ + +/* + A waveform viewer and audio annotation editor. + Chris Cannam, Queen Mary University of London, 2005-2006 + + This is experimental software. Not for distribution. +*/ + +/* + This is a modified version of a source file from the Rosegarden + MIDI and audio sequencer and notation editor, copyright 2000-2006 + Chris Cannam, distributed under the GNU General Public License. + + This file contains traces of the KCommandHistory class from the KDE + project, copyright 2000 Werner Trobin and David Faure and + distributed under the GNU Lesser General Public License. +*/ + +#include "CommandHistory.h" + +#include "Command.h" + +#include <QRegExp> +#include <QMenu> +#include <QToolBar> +#include <QString> + +#include <iostream> + +CommandHistory *CommandHistory::m_instance = 0; + +CommandHistory::CommandHistory() : + m_undoLimit(50), + m_redoLimit(50), + m_savedAt(0) +{ + m_undoAction = new QAction(QIcon(":/icons/undo.png"), tr("&Undo"), this); + m_undoAction->setShortcut(tr("Ctrl+Z")); + connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo())); + + m_undoMenuAction = new QAction(QIcon(":/icons/undo.png"), tr("&Undo"), this); + connect(m_undoMenuAction, SIGNAL(triggered()), this, SLOT(undo())); + + m_undoMenu = new QMenu(tr("&Undo")); + m_undoMenuAction->setMenu(m_undoMenu); + connect(m_undoMenu, SIGNAL(triggered(QAction *)), + this, SLOT(undoActivated(QAction*))); + + m_redoAction = new QAction(QIcon(":/icons/redo.png"), tr("Re&do"), this); + m_redoAction->setShortcut(tr("Ctrl+Shift+Z")); + connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo())); + + m_redoMenuAction = new QAction(QIcon(":/icons/redo.png"), tr("Re&do"), this); + connect(m_redoMenuAction, SIGNAL(triggered()), this, SLOT(redo())); + + m_redoMenu = new QMenu(tr("Re&do")); + m_redoMenuAction->setMenu(m_redoMenu); + connect(m_redoMenu, SIGNAL(triggered(QAction *)), + this, SLOT(redoActivated(QAction*))); +} + +CommandHistory::~CommandHistory() +{ + m_savedAt = -1; + clearStack(m_undoStack); + clearStack(m_redoStack); + + delete m_undoMenu; + delete m_redoMenu; +} + +CommandHistory * +CommandHistory::getInstance() +{ + if (!m_instance) m_instance = new CommandHistory(); + return m_instance; +} + +void +CommandHistory::clear() +{ + m_savedAt = -1; + clearStack(m_undoStack); + clearStack(m_redoStack); + updateActions(); +} + +void +CommandHistory::registerMenu(QMenu *menu) +{ + menu->addAction(m_undoAction); + menu->addAction(m_redoAction); +} + +void +CommandHistory::registerToolbar(QToolBar *toolbar) +{ + toolbar->addAction(m_undoMenuAction); + toolbar->addAction(m_redoMenuAction); +} + +void +CommandHistory::addCommand(Command *command, bool execute) +{ + if (!command) return; + + std::cerr << "MVCH::addCommand: " << command->getName().toLocal8Bit().data() << std::endl; + + // We can't redo after adding a command + clearStack(m_redoStack); + + // can we reach savedAt? + if ((int)m_undoStack.size() < m_savedAt) m_savedAt = -1; // nope + + m_undoStack.push(command); + clipCommands(); + + if (execute) { + command->execute(); + } + + // Emit even if we aren't executing the command, because + // someone must have executed it for this to make any sense + emit commandExecuted(); + emit commandExecuted(command); + + updateActions(); +} + +void +CommandHistory::addExecutedCommand(Command *command) +{ + addCommand(command, false); +} + +void +CommandHistory::addCommandAndExecute(Command *command) +{ + addCommand(command, true); +} + +void +CommandHistory::undo() +{ + if (m_undoStack.empty()) return; + + Command *command = m_undoStack.top(); + command->unexecute(); + emit commandExecuted(); + emit commandUnexecuted(command); + + m_redoStack.push(command); + m_undoStack.pop(); + + clipCommands(); + updateActions(); + + if ((int)m_undoStack.size() == m_savedAt) emit documentRestored(); +} + +void +CommandHistory::redo() +{ + if (m_redoStack.empty()) return; + + Command *command = m_redoStack.top(); + command->execute(); + emit commandExecuted(); + emit commandExecuted(command); + + m_undoStack.push(command); + m_redoStack.pop(); + // no need to clip + + updateActions(); +} + +void +CommandHistory::setUndoLimit(int limit) +{ + if (limit > 0 && limit != m_undoLimit) { + m_undoLimit = limit; + clipCommands(); + } +} + +void +CommandHistory::setRedoLimit(int limit) +{ + if (limit > 0 && limit != m_redoLimit) { + m_redoLimit = limit; + clipCommands(); + } +} + +void +CommandHistory::documentSaved() +{ + m_savedAt = m_undoStack.size(); +} + +void +CommandHistory::clipCommands() +{ + if ((int)m_undoStack.size() > m_undoLimit) { + m_savedAt -= (m_undoStack.size() - m_undoLimit); + } + + clipStack(m_undoStack, m_undoLimit); + clipStack(m_redoStack, m_redoLimit); +} + +void +CommandHistory::clipStack(CommandStack &stack, int limit) +{ + int i; + + if ((int)stack.size() > limit) { + + CommandStack tempStack; + + for (i = 0; i < limit; ++i) { + Command *command = stack.top(); + std::cerr << "MVCH::clipStack: Saving recent command: " << command->getName().toLocal8Bit().data() << " at " << command << std::endl; + tempStack.push(stack.top()); + stack.pop(); + } + + clearStack(stack); + + for (i = 0; i < m_undoLimit; ++i) { + stack.push(tempStack.top()); + tempStack.pop(); + } + } +} + +void +CommandHistory::clearStack(CommandStack &stack) +{ + while (!stack.empty()) { + Command *command = stack.top(); + std::cerr << "MVCH::clearStack: About to delete command: " << command->getName().toLocal8Bit().data() << " at " << command << std::endl; + delete command; + stack.pop(); + } +} + +void +CommandHistory::undoActivated(QAction *action) +{ + int pos = m_actionCounts[action]; + for (int i = 0; i <= pos; ++i) { + undo(); + } +} + +void +CommandHistory::redoActivated(QAction *action) +{ + int pos = m_actionCounts[action]; + for (int i = 0; i <= pos; ++i) { + redo(); + } +} + +void +CommandHistory::updateActions() +{ + m_actionCounts.clear(); + + for (int undo = 0; undo <= 1; ++undo) { + + QAction *action(undo ? m_undoAction : m_redoAction); + QAction *menuAction(undo ? m_undoMenuAction : m_redoMenuAction); + QMenu *menu(undo ? m_undoMenu : m_redoMenu); + CommandStack &stack(undo ? m_undoStack : m_redoStack); + + if (stack.empty()) { + + QString text(undo ? tr("Nothing to undo") : tr("Nothing to redo")); + + action->setEnabled(false); + action->setText(text); + + menuAction->setEnabled(false); + menuAction->setText(text); + + } else { + + action->setEnabled(true); + menuAction->setEnabled(true); + + QString commandName = stack.top()->getName(); + commandName.replace(QRegExp("&"), ""); + + QString text = (undo ? tr("&Undo %1") : tr("Re&do %1")) + .arg(commandName); + + action->setText(text); + menuAction->setText(text); + } + + menu->clear(); + + CommandStack tempStack; + int j = 0; + + while (j < 10 && !stack.empty()) { + + Command *command = stack.top(); + tempStack.push(command); + stack.pop(); + + QString commandName = command->getName(); + commandName.replace(QRegExp("&"), ""); + + QString text; + if (undo) text = tr("&Undo %1").arg(commandName); + else text = tr("Re&do %1").arg(commandName); + + QAction *action = menu->addAction(text); + m_actionCounts[action] = j++; + } + + while (!tempStack.empty()) { + stack.push(tempStack.top()); + tempStack.pop(); + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/base/CommandHistory.h Tue Jan 31 15:57:25 2006 +0000 @@ -0,0 +1,155 @@ +/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ + +/* + A waveform viewer and audio annotation editor. + Chris Cannam, Queen Mary University of London, 2005-2006 + + This is experimental software. Not for distribution. +*/ + +/* + This is a modified version of a source file from the Rosegarden + MIDI and audio sequencer and notation editor, copyright 2000-2006 + Chris Cannam, distributed under the GNU General Public License. + + This file contains traces of the KCommandHistory class from the KDE + project, copyright 2000 Werner Trobin and David Faure and + distributed under the GNU Lesser General Public License. +*/ + +#ifndef _MULTI_VIEW_COMMAND_HISTORY_H_ +#define _MULTI_VIEW_COMMAND_HISTORY_H_ + +#include <QObject> +#include <QString> + +#include <stack> +#include <set> +#include <map> + +class Command; +class QAction; +class QMenu; +class QToolBar; + +/** + * The CommandHistory class stores a list of executed commands and + * maintains Undo and Redo actions synchronised with those commands. + * + * CommandHistory allows you to associate more than one Undo and Redo + * menu or toolbar with the same command history, and it keeps them + * all up-to-date at once. This makes it effective in systems where + * multiple views may be editing the same data. + */ + +class CommandHistory : public QObject +{ + Q_OBJECT + +public: + virtual ~CommandHistory(); + + static CommandHistory *getInstance(); + + void clear(); + + void registerMenu(QMenu *menu); + void registerToolbar(QToolBar *toolbar); + + void addCommand(Command *command, bool execute = true); + + /// Return the maximum number of items in the undo history. + int undoLimit() { return m_undoLimit; } + + /// Set the maximum number of items in the undo history. + void setUndoLimit(int limit); + + /// Return the maximum number of items in the redo history. + int redoLimit() { return m_redoLimit; } + + /// Set the maximum number of items in the redo history. + void setRedoLimit(int limit); + +public slots: + /** + * Checkpoint function that should be called when the document is + * saved. If the undo/redo stack later returns to the point at + * which the document was saved, the documentRestored signal will + * be emitted. + */ + virtual void documentSaved(); + + /** + * Add a command to the history that has already been executed, + * without executing it again. Equivalent to addCommand(command, false). + */ + void addExecutedCommand(Command *); + + /** + * Add a command to the history and also execute it. Equivalent + * to addCommand(command, true). + */ + void addCommandAndExecute(Command *); + +protected slots: + void undo(); + void redo(); + void undoActivated(QAction *); + void redoActivated(QAction *); + +signals: + /** + * Emitted whenever a command has just been executed or + * unexecuted, whether by addCommand, undo, or redo. + */ + void commandExecuted(); + + /** + * Emitted whenever a command has just been executed, whether by + * addCommand or redo. + */ + void commandExecuted(Command *); + + /** + * Emitted whenever a command has just been unexecuted, whether by + * addCommand or undo. + */ + void commandUnexecuted(Command *); + + /** + * Emitted when the undo/redo stack has reached the same state at + * which the documentSaved slot was last called. + */ + void documentRestored(); + +protected: + CommandHistory(); + static CommandHistory *m_instance; + + QAction *m_undoAction; + QAction *m_redoAction; + QAction *m_undoMenuAction; + QAction *m_redoMenuAction; + QMenu *m_undoMenu; + QMenu *m_redoMenu; + + std::map<QAction *, int> m_actionCounts; + + typedef std::stack<Command *> CommandStack; + CommandStack m_undoStack; + CommandStack m_redoStack; + + int m_undoLimit; + int m_redoLimit; + int m_savedAt; + + void updateActions(); + + void clipCommands(); + + void clipStack(CommandStack &stack, int limit); + void clearStack(CommandStack &stack); +}; + + +#endif
--- a/base/MultiViewCommandHistory.cpp Mon Jan 30 17:51:56 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,299 +0,0 @@ -/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ - -/* - A waveform viewer and audio annotation editor. - Chris Cannam, Queen Mary University of London, 2005-2006 - - This is experimental software. Not for distribution. -*/ - -/* - This is a modified version of a source file from the Rosegarden - MIDI and audio sequencer and notation editor, copyright 2000-2006 - Chris Cannam, distributed under the GNU General Public License. - - This file contains traces of the KCommandHistory class from the KDE - project, copyright 2000 Werner Trobin and David Faure and - distributed under the GNU Lesser General Public License. -*/ - -#include "MultiViewCommandHistory.h" - -#include "Command.h" - -#include <QRegExp> -#include <QMenu> -#include <QToolBar> -#include <QString> - -#include <iostream> - -MultiViewCommandHistory::MultiViewCommandHistory() : - m_undoLimit(50), - m_redoLimit(50), - m_savedAt(0) -{ - m_undoAction = new QAction(QIcon(":/icons/undo.png"), tr("&Undo"), this); - m_undoAction->setShortcut(tr("Ctrl+Z")); - connect(m_undoAction, SIGNAL(triggered()), this, SLOT(undo())); - - m_undoMenu = new QMenu(tr("&Undo")); - m_undoAction->setMenu(m_undoMenu); - connect(m_undoMenu, SIGNAL(triggered(QAction *)), - this, SLOT(undoActivated(QAction*))); - - m_redoAction = new QAction(QIcon(":/icons/redo.png"), tr("&Redo"), this); - m_redoAction->setShortcut(tr("Ctrl+Shift+Z")); - connect(m_redoAction, SIGNAL(triggered()), this, SLOT(redo())); - - m_redoMenu = new QMenu(tr("Re&do")); - m_redoAction->setMenu(m_redoMenu); - connect(m_redoMenu, SIGNAL(triggered(QAction *)), - this, SLOT(redoActivated(QAction*))); -} - -MultiViewCommandHistory::~MultiViewCommandHistory() -{ - m_savedAt = -1; - clearStack(m_undoStack); - clearStack(m_redoStack); - - delete m_undoMenu; - delete m_redoMenu; -} - -void -MultiViewCommandHistory::clear() -{ - m_savedAt = -1; - clearStack(m_undoStack); - clearStack(m_redoStack); - updateActions(); -} - -void -MultiViewCommandHistory::registerMenu(QMenu *menu) -{ - menu->addAction(m_undoAction); - menu->addAction(m_redoAction); -} - -void -MultiViewCommandHistory::registerToolbar(QToolBar *toolbar) -{ - toolbar->addAction(m_undoAction); - toolbar->addAction(m_redoAction); -} - -void -MultiViewCommandHistory::addCommand(Command *command, bool execute) -{ - if (!command) return; - - std::cerr << "MVCH::addCommand: " << command->name().toLocal8Bit().data() << std::endl; - - // We can't redo after adding a command - clearStack(m_redoStack); - - // can we reach savedAt? - if ((int)m_undoStack.size() < m_savedAt) m_savedAt = -1; // nope - - m_undoStack.push(command); - clipCommands(); - - if (execute) { - command->execute(); - emit commandExecuted(); - emit commandExecuted(command); - } - -// updateButtons(); - updateActions(); -} - -void -MultiViewCommandHistory::undo() -{ - if (m_undoStack.empty()) return; - - Command *command = m_undoStack.top(); - command->unexecute(); - emit commandExecuted(); - emit commandExecuted(command); - - m_redoStack.push(command); - m_undoStack.pop(); - - clipCommands(); - updateActions(); - - if ((int)m_undoStack.size() == m_savedAt) emit documentRestored(); -} - -void -MultiViewCommandHistory::redo() -{ - if (m_redoStack.empty()) return; - - Command *command = m_redoStack.top(); - command->execute(); - emit commandExecuted(); - emit commandExecuted(command); - - m_undoStack.push(command); - m_redoStack.pop(); - // no need to clip - - updateActions(); -} - -void -MultiViewCommandHistory::setUndoLimit(int limit) -{ - if (limit > 0 && limit != m_undoLimit) { - m_undoLimit = limit; - clipCommands(); - } -} - -void -MultiViewCommandHistory::setRedoLimit(int limit) -{ - if (limit > 0 && limit != m_redoLimit) { - m_redoLimit = limit; - clipCommands(); - } -} - -void -MultiViewCommandHistory::documentSaved() -{ - m_savedAt = m_undoStack.size(); -} - -void -MultiViewCommandHistory::clipCommands() -{ - if ((int)m_undoStack.size() > m_undoLimit) { - m_savedAt -= (m_undoStack.size() - m_undoLimit); - } - - clipStack(m_undoStack, m_undoLimit); - clipStack(m_redoStack, m_redoLimit); -} - -void -MultiViewCommandHistory::clipStack(CommandStack &stack, int limit) -{ - int i; - - if ((int)stack.size() > limit) { - - CommandStack tempStack; - - for (i = 0; i < limit; ++i) { - Command *command = stack.top(); - std::cerr << "MVCH::clipStack: Saving recent command: " << command->name().toLocal8Bit().data() << " at " << command << std::endl; - tempStack.push(stack.top()); - stack.pop(); - } - - clearStack(stack); - - for (i = 0; i < m_undoLimit; ++i) { - stack.push(tempStack.top()); - tempStack.pop(); - } - } -} - -void -MultiViewCommandHistory::clearStack(CommandStack &stack) -{ - while (!stack.empty()) { - Command *command = stack.top(); - std::cerr << "MVCH::clearStack: About to delete command: " << command->name().toLocal8Bit().data() << " at " << command << std::endl; - delete command; - stack.pop(); - } -} - -void -MultiViewCommandHistory::undoActivated(QAction *action) -{ - int pos = m_actionCounts[action]; - for (int i = 0; i <= pos; ++i) { - undo(); - } -} - -void -MultiViewCommandHistory::redoActivated(QAction *action) -{ - int pos = m_actionCounts[action]; - for (int i = 0; i <= pos; ++i) { - redo(); - } -} - -void -MultiViewCommandHistory::updateActions() -{ - if (m_undoStack.empty()) { - m_undoAction->setEnabled(false); - m_undoAction->setText(tr("Nothing to undo")); - } else { - m_undoAction->setEnabled(true); - QString commandName = m_undoStack.top()->name(); - commandName.replace(QRegExp("&"), ""); - QString text = tr("&Undo %1").arg(commandName); - m_undoAction->setText(text); - } - - if (m_redoStack.empty()) { - m_redoAction->setEnabled(false); - m_redoAction->setText(tr("Nothing to redo")); - } else { - m_redoAction->setEnabled(true); - QString commandName = m_redoStack.top()->name(); - commandName.replace(QRegExp("&"), ""); - QString text = tr("Re&do %1").arg(commandName); - m_redoAction->setText(text); - } - - m_actionCounts.clear(); - - for (int undo = 0; undo <= 1; ++undo) { - - QMenu *menu(undo ? m_undoMenu : m_redoMenu); - CommandStack &stack(undo ? m_undoStack : m_redoStack); - - menu->clear(); - - CommandStack tempStack; - int j = 0; - - while (j < 10 && !stack.empty()) { - - Command *command = stack.top(); - tempStack.push(command); - stack.pop(); - - QString commandName = command->name(); - commandName.replace(QRegExp("&"), ""); - - QString text; - if (undo) text = tr("&Undo %1").arg(commandName); - else text = tr("Re&do %1").arg(commandName); - - QAction *action = menu->addAction(text); - m_actionCounts[action] = j++; - } - - while (!tempStack.empty()) { - stack.push(tempStack.top()); - tempStack.pop(); - } - } -} -
--- a/base/MultiViewCommandHistory.h Mon Jan 30 17:51:56 2006 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,136 +0,0 @@ -/* -*- c-basic-offset: 4 -*- vi:set ts=8 sts=4 sw=4: */ - -/* - A waveform viewer and audio annotation editor. - Chris Cannam, Queen Mary University of London, 2005-2006 - - This is experimental software. Not for distribution. -*/ - -/* - This is a modified version of a source file from the Rosegarden - MIDI and audio sequencer and notation editor, copyright 2000-2006 - Chris Cannam, distributed under the GNU General Public License. - - This file contains traces of the KCommandHistory class from the KDE - project, copyright 2000 Werner Trobin and David Faure and - distributed under the GNU Lesser General Public License. -*/ - -#ifndef _MULTI_VIEW_COMMAND_HISTORY_H_ -#define _MULTI_VIEW_COMMAND_HISTORY_H_ - -#include <QObject> -#include <QString> - -#include <stack> -#include <set> -#include <map> - -class Command; -class QAction; -class QMenu; -class QToolBar; - -/** - * The MultiViewCommandHistory class stores a list of executed - * commands and maintains Undo and Redo actions synchronised with - * those commands. - * - * MultiViewCommandHistory also allows you to associate more than one - * Undo and Redo action with the same command history, and it keeps - * them all up-to-date at once. This makes it effective in systems - * where multiple views may be editing the same data at once. - */ - -class MultiViewCommandHistory : public QObject -{ - Q_OBJECT - -public: - MultiViewCommandHistory(); - virtual ~MultiViewCommandHistory(); - - void clear(); - - void registerMenu(QMenu *menu); - void registerToolbar(QToolBar *toolbar); - - void addCommand(Command *command, bool execute = true); - - /// Return the maximum number of items in the undo history. - int undoLimit() { return m_undoLimit; } - - /// Set the maximum number of items in the undo history. - void setUndoLimit(int limit); - - /// Return the maximum number of items in the redo history. - int redoLimit() { return m_redoLimit; } - - /// Set the maximum number of items in the redo history. - void setRedoLimit(int limit); - -public slots: - /** - * Checkpoint function that should be called when the document is - * saved. If the undo/redo stack later returns to the point at - * which the document was saved, the documentRestored signal will - * be emitted. - */ - virtual void documentSaved(); - -protected slots: - void undo(); - void redo(); - void undoActivated(QAction *); - void redoActivated(QAction *); - -signals: - /** - * Emitted whenever a command has just been executed, whether by - * addCommand, undo, or redo. - */ - void commandExecuted(Command *); - - /** - * Emitted whenever a command has just been executed, whether by - * addCommand, undo, or redo. - */ - void commandExecuted(); - - /** - * Emitted when the undo/redo stack has reached the same state at - * which the documentSaved slot was last called. - */ - void documentRestored(); - -private: - QAction *m_undoAction; - QAction *m_redoAction; - QMenu *m_undoMenu; - QMenu *m_redoMenu; - - std::map<QAction *, int> m_actionCounts; - - typedef std::stack<Command *> CommandStack; - CommandStack m_undoStack; - CommandStack m_redoStack; - - int m_undoLimit; - int m_redoLimit; - int m_savedAt; - - void updateActions(); -// void updateMenus(); - -// void updateButtons(); -// void updateButton(bool undo, const QString &name, CommandStack &stack); -// void updateMenu(bool undo, const QString &name, CommandStack &stack); - void clipCommands(); - - void clipStack(CommandStack &stack, int limit); - void clearStack(CommandStack &stack); -}; - - -#endif
--- a/base/Profiler.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/base/Profiler.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam and Guillaume Laurent. + This file copyright 2000-2006 Chris Cannam and Guillaume Laurent. */ #include <iostream>
--- a/base/Profiler.h Mon Jan 30 17:51:56 2006 +0000 +++ b/base/Profiler.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam and Guillaume Laurent. + This file copyright 2000-2006 Chris Cannam and Guillaume Laurent. */
--- a/base/RealTime.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/base/RealTime.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #include <iostream>
--- a/base/RealTime.h Mon Jan 30 17:51:56 2006 +0000 +++ b/base/RealTime.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _REAL_TIME_H_
--- a/base/RingBuffer.h Mon Jan 30 17:51:56 2006 +0000 +++ b/base/RingBuffer.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _RINGBUFFER_H_
--- a/base/Scavenger.h Mon Jan 30 17:51:56 2006 +0000 +++ b/base/Scavenger.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _SCAVENGER_H_
--- a/plugin/DSSIPluginFactory.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/DSSIPluginFactory.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #include "DSSIPluginFactory.h"
--- a/plugin/DSSIPluginFactory.h Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/DSSIPluginFactory.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _DSSI_PLUGIN_FACTORY_H_
--- a/plugin/DSSIPluginInstance.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/DSSIPluginInstance.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #include <iostream>
--- a/plugin/DSSIPluginInstance.h Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/DSSIPluginInstance.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _DSSIPLUGININSTANCE_H_
--- a/plugin/LADSPAPluginFactory.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/LADSPAPluginFactory.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam and Richard Bown. + This file copyright 2000-2006 Chris Cannam and Richard Bown. */ #include "LADSPAPluginFactory.h"
--- a/plugin/LADSPAPluginFactory.h Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/LADSPAPluginFactory.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam and Richard Bown. + This file copyright 2000-2006 Chris Cannam and Richard Bown. */ #ifndef _LADSPA_PLUGIN_FACTORY_H_
--- a/plugin/LADSPAPluginInstance.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/LADSPAPluginInstance.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam and Richard Bown. + This file copyright 2000-2006 Chris Cannam and Richard Bown. */ #include <iostream>
--- a/plugin/LADSPAPluginInstance.h Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/LADSPAPluginInstance.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam and Richard Bown. + This file copyright 2000-2006 Chris Cannam and Richard Bown. */ #ifndef _LADSPAPLUGININSTANCE_H_
--- a/plugin/PluginIdentifier.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/PluginIdentifier.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #include "PluginIdentifier.h"
--- a/plugin/PluginIdentifier.h Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/PluginIdentifier.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _PLUGIN_IDENTIFIER_H_
--- a/plugin/RealTimePluginFactory.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/RealTimePluginFactory.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -4,7 +4,7 @@ Rosegarden-4 A sequencer and musical notation editor. - This program is Copyright 2000-2005 + This program is Copyright 2000-2006 Guillaume Laurent <glaurent@telegraph-road.org>, Chris Cannam <cannam@all-day-breakfast.com>, Richard Bown <bownie@bownie.com>
--- a/plugin/RealTimePluginFactory.h Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/RealTimePluginFactory.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _REALTIME_PLUGIN_FACTORY_H_
--- a/plugin/RealTimePluginInstance.cpp Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/RealTimePluginInstance.cpp Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #include "RealTimePluginInstance.h"
--- a/plugin/RealTimePluginInstance.h Mon Jan 30 17:51:56 2006 +0000 +++ b/plugin/RealTimePluginInstance.h Tue Jan 31 15:57:25 2006 +0000 @@ -10,7 +10,7 @@ /* This is a modified version of a source file from the Rosegarden MIDI and audio sequencer and notation editor. - This file copyright 2000-2005 Chris Cannam. + This file copyright 2000-2006 Chris Cannam. */ #ifndef _REALTIME_PLUGIN_INSTANCE_H_