16 class TextEditorController;
147 void clearHistoryLists();
152 QList<Change*> changeList_;
154 QMap<TextEditorController*,int> controllerIndexMap_;
157 QStack<ChangeGroup*> undoGroupStack_;
158 QStack<int> lastCoalesceIdStack_;
162 bool collectionEnabled_;
void dumpStackInternal()
Dumps the internal stack.
Definition: textundostack.cpp:532
void setLastCoalesceIdAtCurrentLevel(int id)
Sets the last coalesceId at the current level.
Definition: textundostack.cpp:184
This is the base and abstract class of a text document A TextDocument is the model part of the editor...
Definition: textdocument.h:40
An undoable-command-group.
Definition: change.h:84
int size()
returns the number of changes on the stack
Definition: textundostack.cpp:350
TextUndoStack(TextDocument *doc, QObject *parent=0)
Constructs the main undostack.
Definition: textundostack.cpp:20
int findRedoIndex(int index, TextEditorController *controller=0)
This method finds the next redo-item.
Definition: textundostack.cpp:544
void setPersisted(bool enabled)
Marks the current documentIndex as persisted.
Definition: textundostack.cpp:445
int currentIndex(TextEditorController *controller=0)
This method return the index that's active for the given controller The currentIndex points directly ...
Definition: textundostack.cpp:365
void clear()
clears both stacks
Definition: textundostack.cpp:58
bool isCollectionEnabled()
Definition: textundostack.h:91
void undoExecuted(edbee::Change *change)
Definition: moc_textundostack.cpp:210
bool canRedo(TextEditorController *controller=0)
Should check if a redo operation can be performed. When no controller is given a document-redo is che...
Definition: textundostack.cpp:296
int findUndoIndex(int index, TextEditorController *controller=0)
This method finds the index of the given stackitem from the given index.
Definition: textundostack.cpp:562
bool isRedoRunning()
Definition: textundostack.h:95
bool undoControllerChange(TextEditorController *controller)
This method undos the given controller change. This method does NOT undo document changes...
Definition: textundostack.cpp:616
The group has been ungrouped, the single change has been added to the stack.
Definition: textundostack.h:58
Change * findRedoChange(TextEditorController *controller=0)
This method returns the current redo change. This maybe the change for the given context or the docum...
Definition: textundostack.cpp:381
virtual ~TextUndoStack()
the undo stack items
Definition: textundostack.cpp:38
TextDocument * document()
Definition: textundostack.h:113
EndUndoGroupAction
This enumeration is signaled to the listeners to notify what happend when ending an undo group...
Definition: textundostack.h:57
Change * at(int idx)
returns the change at the given index
Definition: textundostack.cpp:357
bool isUndoRunning()
Definition: textundostack.h:94
void unregisterController(TextEditorController *controller)
Unregisters the given controller.
Definition: textundostack.cpp:82
bool isControllerRegistered(TextEditorController *controller)
Checks if the given controller is registered.
Definition: textundostack.cpp:89
void undoGroupEnded(int coalesceId, bool merged, int action)
This signal is fired when the group is ended. Warning, when the group is merged the group pointer wil...
Definition: moc_textundostack.cpp:196
Copyright 2011-2013 - Reliable Bits Software by Blommers IT.
Definition: commentcommand.cpp:22
void undo(TextEditorController *controller=0, bool controllerOnly=false)
performs an undo operation
Definition: textundostack.cpp:304
void redo(TextEditorController *controller=0, bool controllerOnly=false)
performs the redo operation for the given controller
Definition: textundostack.cpp:329
void setCollectionEnabled(bool enabled)
Definition: textundostack.h:92
void persistedChanged(bool persisted)
This signal is emitted if the persisted state is changed.
Definition: moc_textundostack.cpp:224
void undoGroupStarted(edbee::ChangeGroup *group)
Definition: moc_textundostack.cpp:189
void setPersistedIndex(int index)
Sets the persisted in dex and fires a signal.
Definition: textundostack.cpp:707
Change * giveChange(Change *change, int coalesceId)
This method gives the command and tries to coalesce the command if possible Warning when a change is ...
Definition: textundostack.cpp:209
void resetAllLastCoalesceIds()
Resets all coalsceIds.
Definition: textundostack.cpp:191
void undoDocumentChange()
Performs an document-change undo.
Definition: textundostack.cpp:634
Change * last(TextEditorController *controller=0)
Returns last textchange on the undo stack.
Definition: textundostack.cpp:403
void clearRedo(TextEditorController *controller)
Clears all redo's for the given controller.
Definition: textundostack.cpp:576
ChangeGroup * currentGroup()
This method returns the current active group.
Definition: textundostack.cpp:107
A basic change.
Definition: change.h:18
int undoGroupLevel()
returns the number of stacked undo-groups
Definition: textundostack.cpp:170
int lastIndex(TextEditorController *controller=0)
This method returns the last index for a given controller The lastIndex points to the index on the st...
Definition: textundostack.cpp:394
void beginUndoGroup(ChangeGroup *group)
Starts an undo group (or increase nest-level-counter)
Definition: textundostack.cpp:96
The texteditor works via the controller. The controller is the central point/mediater which maps/cont...
Definition: texteditorcontroller.h:37
int persistedIndex()
This method returns the current persisted index.
Definition: textundostack.cpp:477
void endUndoGroupAndDiscard()
Ends the undo-group and discards all content.
Definition: textundostack.cpp:154
int sizeInDocChanges()
The number of doc-'undo' items on the stack.
Definition: textundostack.cpp:412
int lastCoalesceIdAtCurrentLevel()
returns the last coalesceId at the given level
Definition: textundostack.cpp:177
void redoExecuted(edbee::Change *change)
Definition: moc_textundostack.cpp:217
void changeAdded(edbee::Change *change)
Definition: moc_textundostack.cpp:203
This is the undo stack for the texteditor. This stack is SHARED by all views of the document The stac...
Definition: textundostack.h:50
bool redoControllerChange(TextEditorController *controller)
undo's the given controller change
Definition: textundostack.cpp:664
Change * findUndoChange(TextEditorController *controller=0)
This method returns the last change (TOS) for the given controller.
Definition: textundostack.cpp:434
void setChangeIndex(int index)
When setting the change-index we sometimes must emit a persisted change.
Definition: textundostack.cpp:719
bool canUndo(TextEditorController *controller=0)
Should check if a undo operation can be performed. When no controller is given a document-undo is che...
Definition: textundostack.cpp:287
int currentIndexInDocChanges()
This method returns the current doc change index.
Definition: textundostack.cpp:423
bool isPersisted()
returns true if the undo-stack is on a persisted index
Definition: textundostack.cpp:452
A normal group end.
Definition: textundostack.h:60
void endUndoGroup(int coalesceId, bool flatten)
Ends the undogroup.
Definition: textundostack.cpp:117
QString dumpStack()
makes a dump of the current stack
Definition: textundostack.cpp:484
void redoDocumentChange()
redo a document change
Definition: textundostack.cpp:682
void registerContoller(TextEditorController *controller)
Registers acontroller for it's own view pointer.
Definition: textundostack.cpp:75
The group contained nothing usefull, nothing is added to the stack.
Definition: textundostack.h:59