Canorus  0.0
Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
CAUndoCommand Class Reference

Internal Undo/Redo command. More...

#include <undocommand.h>

Inheritance diagram for CAUndoCommand:
Inheritance graph
[legend]

Public Member Functions

 CAUndoCommand (CADocument *document, QString text)
 
virtual ~CAUndoCommand ()
 
virtual void undo ()
 
virtual void redo ()
 
CADocumentgetUndoDocument ()
 
void setUndoDocument (CADocument *doc)
 
CADocumentgetRedoDocument ()
 
void setRedoDocument (CADocument *doc)
 

Static Public Member Functions

static void undoDocument (CADocument *current, CADocument *newDocument)
 

Private Attributes

CADocument_undoDocument
 
CADocument_redoDocument
 

Detailed Description

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.

Warning
You should never directly access this class. Use CAUndo instead.
See also
CAUndo

Constructor & Destructor Documentation

◆ CAUndoCommand()

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().

Here is the call graph for this function:

◆ ~CAUndoCommand()

CAUndoCommand::~CAUndoCommand ( )
virtual

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

Here is the call graph for this function:

Member Function Documentation

◆ getRedoDocument()

CADocument* CAUndoCommand::getRedoDocument ( )
inline

References _redoDocument.

Referenced by CAUndo::pushUndoCommand(), redo(), undo(), and ~CAUndoCommand().

Here is the caller graph for this function:

◆ getUndoDocument()

CADocument* CAUndoCommand::getUndoDocument ( )
inline

References _undoDocument.

Referenced by CAUndo::pushUndoCommand(), redo(), undo(), and ~CAUndoCommand().

Here is the caller graph for this function:

◆ redo()

void CAUndoCommand::redo ( )
virtual

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

Here is the call graph for this function:

◆ setRedoDocument()

void CAUndoCommand::setRedoDocument ( CADocument doc)
inline

References _redoDocument.

Referenced by CAUndoCommand(), and CAUndo::pushUndoCommand().

Here is the caller graph for this function:

◆ setUndoDocument()

void CAUndoCommand::setUndoDocument ( CADocument doc)
inline

References _undoDocument.

Referenced by CAUndoCommand().

Here is the caller graph for this function:

◆ undo()

void CAUndoCommand::undo ( )
virtual

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

Here is the call graph for this function:

◆ undoDocument()

void CAUndoCommand::undoDocument ( CADocument current,
CADocument newDocument 
)
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().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _redoDocument

CADocument* CAUndoCommand::_redoDocument
private

Referenced by getRedoDocument(), and setRedoDocument().

◆ _undoDocument

CADocument* CAUndoCommand::_undoDocument
private

Referenced by getUndoDocument(), and setUndoDocument().


The documentation for this class was generated from the following files: