Canorus  0.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Attributes
CAUndoCommand Class Reference

Internal Undo/Redo command. More...

#include <undocommand.h>

Inheritance diagram for CAUndoCommand:
Inheritance graph
[legend]

List of all members.

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.

    \sa CAUndo

Constructor & Destructor Documentation

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:

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

Here is the call graph for this function:


Member Function Documentation

References _redoDocument.

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

Here is the caller graph for this function:

References _undoDocument.

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

Here is the caller graph for this function:

void CAUndoCommand::redo ( ) [virtual]

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

Here is the call graph for this function:

void CAUndoCommand::setRedoDocument ( CADocument doc) [inline]

References _redoDocument.

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

Here is the caller graph for this function:

void CAUndoCommand::setUndoDocument ( CADocument doc) [inline]

References _undoDocument.

Referenced by CAUndoCommand().

Here is the caller graph for this function:

void CAUndoCommand::undo ( ) [virtual]

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

Here is the call graph for this function:

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 viewports showing the right structure and sub-structure (eg. voice with the same index in the new document).

References CASheet::contextAt(), CASheet::contextCount(), CASourceViewPort::document(), CACanorus::findMainWin(), CAContext::LyricsContext, CASourceViewPort::lyricsContext(), CACanorus::rebuildUI(), CADocument::resourceList(), CAViewPort::ScoreViewPort, CASourceViewPort::setDocument(), CASourceViewPort::setLyricsContext(), CAScoreViewPort::setSheet(), CASourceViewPort::setVoice(), CAScoreViewPort::sheet(), CADocument::sheetAt(), CADocument::sheetCount(), CAViewPort::SourceViewPort, CASourceViewPort::voice(), CASheet::voiceAt(), and CASheet::voiceCount().

Referenced by redo(), and undo().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Referenced by getRedoDocument(), and setRedoDocument().

Referenced by getUndoDocument(), and setUndoDocument().


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