#include <Document.h>
Public Member Functions | |
Document (const Track::Theme &theme) | |
Initalise an default document for a given theme. | |
Document (std::istream &source, const Track::Theme &theme) | |
Initalise from a stream. | |
virtual | ~Document () |
void | do_command (boost::shared_ptr< DocumentDelta > delta) |
Perform a command This clears any avaliable redos, and adds it to the stack of undo commands. | |
void | preview_command (boost::shared_ptr< DocumentDelta > delta) |
Show the effect of a command for a preview. | |
void | cancel_preview () |
Undo the last preview_command(). | |
void | undo_command () |
Undo the last command done. | |
void | redo_command () |
Redo a command that was previously undone. | |
sigc::signal< void > | signal_command_run () |
Signal that is emitted whenever a command is run. | |
bool | get_undo_avaliable () const |
Check if there are commands to be undone. | |
bool | get_redo_avaliable () const |
Check if there are commands to be redone. | |
void | save (std::ostream &destination) |
Save the document. | |
bool | is_saved () const |
Is the document in the state it was saved in? | |
unsigned int | get_changes_since_save () const |
Return the number of commands done (or undone) since the last save. | |
const Track::Track & | get_track () const |
Return the track so it can be displayed. | |
Protected Attributes | |
Track::Track | track |
The track in the document in its current state. | |
std::vector< boost::shared_ptr< DocumentDelta > > | done |
Stack of commands that have been done. | |
std::vector< boost::shared_ptr< DocumentDelta > > | undone |
Stack of commands that have been undone. | |
sigc::signal< void > | m_signal_command_run |
Signal to emit when a delta is applied or unapplied. | |
signed int | commands_from_save |
Count undo / redo history to the point where the file is saved. | |
bool | saved_in_history |
True if the state when the document was saved is stored in the undo / redo history. | |
boost::shared_ptr< DocumentDelta > | temporary_command |
Command to preview the effects of. |
Anything that responds to open, save, undo, or redo is in a document. The editor has a single document it works on at once.
Definition at line 34 of file Document.h.
Document::Document::Document | ( | const Track::Theme & | theme | ) |
Initalise an default document for a given theme.
Called when a theme is selected for a new document.
Document::Document::Document | ( | std::istream & | source, | |
const Track::Theme & | theme | |||
) |
Initalise from a stream.
Most likely caused from an open command. This should behave exactly like
Track::Track(source, theme)
source | The stream to extract data from. It is advanced to the end of the document. | |
theme | The theme of the track. |
virtual Document::Document::~Document | ( | ) | [virtual] |
void Document::Document::cancel_preview | ( | ) |
Undo the last preview_command().
This action is also performed when do_command(), undo_command(), redo_command(), preview_command(), or save() are used.
void Document::Document::do_command | ( | boost::shared_ptr< DocumentDelta > | delta | ) |
Perform a command This clears any avaliable redos, and adds it to the stack of undo commands.
delta | The command to perform. If 0, no command is performed, but any previewed command is undone. |
unsigned int Document::Document::get_changes_since_save | ( | ) | const |
Return the number of commands done (or undone) since the last save.
bool Document::Document::get_redo_avaliable | ( | ) | const |
Check if there are commands to be redone.
true
false
const Track::Track& Document::Document::get_track | ( | ) | const |
Return the track so it can be displayed.
bool Document::Document::get_undo_avaliable | ( | ) | const |
Check if there are commands to be undone.
true
false
bool Document::Document::is_saved | ( | ) | const |
Is the document in the state it was saved in?
void Document::Document::preview_command | ( | boost::shared_ptr< DocumentDelta > | delta | ) |
Show the effect of a command for a preview.
This performs a command, but it is automatically undone later. It is useful for showing the effect of a command while varying parameters.
The command is performed immediately, but undone if any of these functions are performed: do_command(), undo_command(), redo_command(), preview_command(), cancel_preview(), and save().
To accept the change, call do_command() with the final delta. To cancel undo it with no other side effects, call cancel_preview().
The redo history is not lost when using preview_command().
delta | The command to perform. If 0, no command is performed, but the previous preview may be undone. |
void Document::Document::redo_command | ( | ) |
Redo a command that was previously undone.
void Document::Document::save | ( | std::ostream & | destination | ) |
Save the document.
sigc::signal<void> Document::Document::signal_command_run | ( | ) |
Signal that is emitted whenever a command is run.
This incudes when a command is undone. Use this to update the display in the editor. The prototype function for the handler is:
void on_command_run();
void Document::Document::undo_command | ( | ) |
Undo the last command done.
signed int Document::Document::commands_from_save [protected] |
Count undo / redo history to the point where the file is saved.
For every action undone, this is decrement, for every action redone, it is incremented. If it is 0 and
is true
Definition at line 145 of file Document.h.
std::vector<boost::shared_ptr<DocumentDelta> > Document::Document::done [protected] |
sigc::signal<void> Document::Document::m_signal_command_run [protected] |
bool Document::Document::saved_in_history [protected] |
True if the state when the document was saved is stored in the undo / redo history.
Definition at line 150 of file Document.h.
boost::shared_ptr<DocumentDelta> Document::Document::temporary_command [protected] |
Command to preview the effects of.
If 0, we are not previewing any command. Otherwise, we should undo the command before doing anything else.
Definition at line 156 of file Document.h.
Track::Track Document::Document::track [protected] |
std::vector<boost::shared_ptr<DocumentDelta> > Document::Document::undone [protected] |
Generated at Mon Sep 6 00:41:16 2010 by Doxygen version 1.4.7 for Racer version svn335.