edbee - Qt Editor Library
|
A special mergable group textchange. Used by the editor to merge editing operation together.. I hate the name, but currently don't know a better name of this class :) More...
#include <mergablechangegroup.h>
Public Member Functions | |
MergableChangeGroup (TextEditorController *controller) | |
The default complex textchange constructor. More... | |
virtual | ~MergableChangeGroup () |
The default destructor. More... | |
virtual bool | isDiscardable () |
default not discardable More... | |
virtual void | groupClosed () |
the group is closed, we must 'store' the selection More... | |
virtual void | execute (TextDocument *document) |
Executes this textchange. More... | |
virtual void | revert (TextDocument *document) |
this method is called to revert the operation reverts the given operation More... | |
void | giveSingleTextChange (TextDocument *doc, TextChange *change) |
Gives a single textchange. More... | |
void | giveLineDataListTextChange (TextDocument *doc, LineDataListChange *change) |
gives a line data list text change More... | |
virtual void | giveChange (TextDocument *doc, Change *change) |
Gives the change. More... | |
virtual Change * | at (int idx) |
returns the textchange at the given index More... | |
virtual Change * | take (int idx) |
Takes the given item. More... | |
virtual int | size () |
returns the number of elements More... | |
virtual void | clear (bool performDelete=true) |
clears all items More... | |
virtual bool | giveAndMerge (TextDocument *document, Change *textChange) |
This method tries to merge the given change with the other change The textChange supplied with this method should NOT have been executed yet. It's the choice of this merge operation if the execution is required. More... | |
virtual QString | toString () |
Converts this textchange to a textual representation. More... | |
QString | toSingleTextChangeTestString () |
Converts the textchangeList as as string The format is the following: <offset>:<length>:<str>,... More... | |
void | moveChangesFromGroup (TextDocument *doc, ChangeGroup *group) |
Moves all textchanges from the given group to this group. More... | |
Public Member Functions inherited from edbee::ChangeGroup | |
ChangeGroup (TextEditorController *controller) | |
default contructor More... | |
virtual | ~ChangeGroup () |
The destructor deletes all added textchanges. More... | |
virtual bool | isGroup () |
A group change is a group change, so this method returns true :) More... | |
virtual void | flatten () |
This method flattens the undo-group by expanding all subgroups to local groups. More... | |
Change * | last () |
This method returns the last change in the change group. More... | |
Change * | takeLast () |
Takes the ownership of the last element and removes it from the stack. More... | |
int | recursiveSize () |
The total number of items in the list (excluding the group items) More... | |
virtual TextEditorController * | controllerContext () |
if this commandgroup only contains commands for a single controller context Then this context is returned else 0 is returned More... | |
Public Member Functions inherited from edbee::ControllerChange | |
ControllerChange (TextEditorController *controller) | |
A controller specific textcommand. Warning you should NOT modify the textdocument! More... | |
virtual TextEditorController * | controller () |
returns the controller More... | |
Public Member Functions inherited from edbee::Change | |
virtual | ~Change () |
a virtual empty destructor More... | |
virtual bool | canUndo () |
This method should return true if the change can be reverted. More... | |
virtual bool | isPersistenceRequired () |
This flag is used to mark this stack item as non-persistence requirable The default behaviour is that every textchange requires persistence. It is also possible to have certain changes that do not require persitence but should be placed on the undo stack. More... | |
bool | isDocumentChange () |
this method can be used to check if the given change is a document change More... | |
Protected Member Functions | |
bool | mergeAsGroup (TextDocument *document, Change *textChange) |
merges the given textchange as a group. More... | |
bool | mergeAsSelection (TextDocument *document, Change *textChange) |
void | compressTextChanges (TextDocument *document) |
Compresses the textchanges. More... | |
void | compressChanges (TextDocument *document) |
This is going to be the magic method that's going to merge all changes. More... | |
A special mergable group textchange. Used by the editor to merge editing operation together.. I hate the name, but currently don't know a better name of this class :)
This is a complete rewrite of the earlier implementation. This implemenation simply adds all changes to a group. It tries to compress the changes that are compressable This group has 1 previous selection and 1 next selection. All selection changes are 'removed' and only the last and first state is stored.
edbee::MergableChangeGroup::MergableChangeGroup | ( | TextEditorController * | controller | ) |
The default complex textchange constructor.
|
virtual |
The default destructor.
|
virtual |
returns the textchange at the given index
Implements edbee::ChangeGroup.
|
virtual |
clears all items
Implements edbee::ChangeGroup.
|
protected |
This is going to be the magic method that's going to merge all changes.
document | the document to merge the changes for |
|
protected |
Compresses the textchanges.
document | the document to merge the changes for |
|
virtual |
Executes this textchange.
document | the document to execute this operation for |
Reimplemented from edbee::ChangeGroup.
|
virtual |
This method tries to merge the given change with the other change The textChange supplied with this method should NOT have been executed yet. It's the choice of this merge operation if the execution is required.
this method tries to merge the textchange with this text change
textChange | the textchange to merge |
Implements edbee::ChangeGroup.
|
virtual |
Gives the change.
we can simply delete the change, the ComplexTextChange automaticly records the last change selection on the undoGroupEnd
Implements edbee::ChangeGroup.
void edbee::MergableChangeGroup::giveLineDataListTextChange | ( | TextDocument * | doc, |
LineDataListChange * | change | ||
) |
gives a line data list text change
void edbee::MergableChangeGroup::giveSingleTextChange | ( | TextDocument * | doc, |
TextChange * | change | ||
) |
Gives a single textchange.
|
virtual |
the group is closed, we must 'store' the selection
Reimplemented from edbee::ChangeGroup.
|
virtual |
default not discardable
Reimplemented from edbee::ChangeGroup.
|
protected |
merges the given textchange as a group.
document | the document this merge is for |
textChange | the textchange to merge |
|
protected |
document | the document this merge is for |
textChange | the textchange to merge |
void edbee::MergableChangeGroup::moveChangesFromGroup | ( | TextDocument * | doc, |
ChangeGroup * | group | ||
) |
Moves all textchanges from the given group to this group.
group | the group to move the selection from |
|
virtual |
this method is called to revert the operation reverts the given operation
Reimplemented from edbee::ChangeGroup.
|
virtual |
returns the number of elements
Implements edbee::ChangeGroup.
|
virtual |
Takes the given item.
Implements edbee::ChangeGroup.
QString edbee::MergableChangeGroup::toSingleTextChangeTestString | ( | ) |
Converts the textchangeList as as string The format is the following: <offset>:<length>:<str>,...
sample: 0:2:ABC,1:2:QW
|
virtual |
Converts this textchange to a textual representation.
Reimplemented from edbee::ChangeGroup.