|
Canorus
0.0
|
Internal Undo/Redo command. More...
#include <undocommand.h>

Public Member Functions | |
| CAUndoCommand (CADocument *document, QString text) | |
| virtual | ~CAUndoCommand () |
| virtual void | undo () |
| virtual void | redo () |
| CADocument * | getUndoDocument () |
| void | setUndoDocument (CADocument *doc) |
| CADocument * | getRedoDocument () |
| void | setRedoDocument (CADocument *doc) |
Static Public Member Functions | |
| static void | undoDocument (CADocument *current, CADocument *newDocument) |
Private Attributes | |
| CADocument * | _undoDocument |
| CADocument * | _redoDocument |
Internal Undo/Redo command.
Copyright (c) 2007, Matevž Jekovec, Canorus development team All Rights Reserved. See AUTHORS for a complete list of authors.
Licensed under the GNU GENERAL PUBLIC LICENSE. See LICENSE.GPL for details.
This class implements undo and redo action.
It inherits QUndoCommand and is usually stored inside QUndoStack or a list.
Create this object by passing it a pointer to a document which the state should be saved for the future use. When called undo() or redo() (usually called by CAUndo class) all the documents and sheets currently opened are updated pointing to the previous (undone) or next (redone) states of the structures.
| CAUndoCommand::CAUndoCommand | ( | CADocument * | document, |
| QString | text | ||
| ) |
Creates a new undo command. Internally, it clones the given document and sets it as an undo document. The redo document is directly the passed document. When having multiple undo commands, you should take care of relinking the previous undo commmand's redo document to next command's undo document. This is usually done when pushing the command onto the stack.
References CADocument::clone(), setRedoDocument(), and setUndoDocument().

|
virtual |
References getRedoDocument(), getUndoDocument(), CACanorus::mainWinCount(), and CACanorus::undo().

|
inline |
References _redoDocument.
Referenced by CAUndo::pushUndoCommand(), redo(), undo(), and ~CAUndoCommand().

|
inline |
References _undoDocument.
Referenced by CAUndo::pushUndoCommand(), redo(), undo(), and ~CAUndoCommand().

|
virtual |
References getRedoDocument(), getUndoDocument(), CADocument::setFileName(), CADocument::setTimeEdited(), and undoDocument().

|
inline |
References _redoDocument.
Referenced by CAUndoCommand(), and CAUndo::pushUndoCommand().

|
inline |
References _undoDocument.
Referenced by CAUndoCommand().

|
virtual |
References getRedoDocument(), getUndoDocument(), CADocument::setFileName(), CADocument::setTimeEdited(), and undoDocument().

|
static |
Creates the actual undo (switches the pointers of the document) and updates the GUI. The updating GUI part is quite complicated as it has to update all views showing the right structure and sub-structure (eg. voice with the same index in the new document).
References CASourceView::document(), CACanorus::findMainWin(), CAContext::LyricsContext, CASourceView::lyricsContext(), CACanorus::rebuildUI(), CADocument::resourceList(), CAView::ScoreView, CASourceView::setDocument(), CASourceView::setLyricsContext(), CAScoreView::setSheet(), CASourceView::setVoice(), CAScoreView::sheet(), CADocument::sheetList(), CAView::SourceView, and CASourceView::voice().
Referenced by redo(), and undo().


|
private |
Referenced by getRedoDocument(), and setRedoDocument().
|
private |
Referenced by getUndoDocument(), and setUndoDocument().