|
Krita Source Code Documentation
|
#include <kis_saved_commands.h>
Inheritance diagram for KisSavedCommand:Public Member Functions | |
| bool | canAnnihilateWith (const KUndo2Command *command) const override |
| QTime | endTime () const override |
| int | id () const override |
| bool | isMerged () const override |
| KisSavedCommand (KUndo2CommandSP command, KisStrokesFacade *strokesFacade) | |
| QVector< KUndo2Command * > | mergeCommandsVector () const override |
| bool | mergeWith (const KUndo2Command *command) override |
| void | setEndTime (const QTime &time) override |
| void | setTime (const QTime &time) override |
| void | setTimedID (int timedID) override |
| QTime | time () const override |
| int | timedId () const override |
| bool | timedMergeWith (KUndo2Command *other) override |
Public Member Functions inherited from KisSavedCommandBase | |
| KisSavedCommandBase (const KUndo2MagicString &name, KisStrokesFacade *strokesFacade) | |
| void | redo () override |
| void | undo () override |
| ~KisSavedCommandBase () override | |
Public Member Functions inherited from KUndo2Command | |
| QString | actionText () const |
| const KUndo2Command * | child (int index) const |
| int | childCount () const |
| KUndo2CommandExtraData * | extraData () const |
| bool | hasParent () const |
| KUndo2Command (const KUndo2MagicString &text, KUndo2Command *parent=0) | |
| KUndo2Command (KUndo2Command *parent=0) | |
| virtual void | redoMergedCommands () |
| void | setEndTime () |
| void | setExtraData (KUndo2CommandExtraData *data) |
| void | setText (const KUndo2MagicString &text) |
| void | setTime () |
| KUndo2MagicString | text () const |
| virtual void | undoMergedCommands () |
| virtual | ~KUndo2Command () |
Static Public Member Functions | |
| template<typename Command , typename Func > | |
| static auto | unwrap (Command *cmd, Func &&func) -> decltype(func(static_cast< Command * >(nullptr))) |
Protected Member Functions | |
| void | addCommands (KisStrokeId id, bool undo) override |
Protected Member Functions inherited from KisSavedCommandBase | |
| KisStrokesFacade * | strokesFacade () |
Private Attributes | |
| KUndo2CommandSP | m_command |
Definition at line 40 of file kis_saved_commands.h.
| KisSavedCommand::KisSavedCommand | ( | KUndo2CommandSP | command, |
| KisStrokesFacade * | strokesFacade ) |
Definition at line 69 of file kis_saved_commands.cpp.
|
overrideprotectedvirtual |
Implements KisSavedCommandBase.
Definition at line 95 of file kis_saved_commands.cpp.
References m_command, KisSavedCommandBase::strokesFacade(), and KisSavedCommandBase::undo().
|
overridevirtual |
Attempts to merge this command with command and checks if the two commands compensate each other. If the function returns true, both commands are removed from the stack.
If this function returns true, calling this command's redo() followed by other redo() must have no effect.
The function itself shouldn't do any changes to the command, because after returning true, the command will be deleted as a "noop"
KUndo2QStack will only try to merge two commands if they have the same id, and the id is not -1.
The default implementation returns false.
Reimplemented from KUndo2Command.
Definition at line 88 of file kis_saved_commands.cpp.
|
overridevirtual |
Reimplemented from KUndo2Command.
Definition at line 136 of file kis_saved_commands.cpp.
References m_command.
|
overridevirtual |
Returns the ID of this command.
A command ID is used in command compression. It must be an integer unique to this command's class, or -1 if the command doesn't support compression.
If the command supports compression this function must be overridden in the derived class to return the correct ID. The base implementation returns -1.
KUndo2QStack::push() will only try to merge two commands if they have the same ID, and the ID is not -1.
Reimplemented from KUndo2Command.
Definition at line 76 of file kis_saved_commands.cpp.
References m_command.
|
overridevirtual |
Reimplemented from KUndo2Command.
Definition at line 140 of file kis_saved_commands.cpp.
References m_command.
|
overridevirtual |
Reimplemented from KUndo2Command.
Definition at line 118 of file kis_saved_commands.cpp.
References m_command.
|
overridevirtual |
Attempts to merge this command with command. Returns true on success; otherwise returns false.
If this function returns true, calling this command's redo() must have the same effect as redoing both this command and command. Similarly, calling this command's undo() must have the same effect as undoing command and this command.
KUndo2QStack will only try to merge two commands if they have the same id, and the id is not -1.
The default implementation returns false.
Reimplemented from KUndo2Command.
Definition at line 81 of file kis_saved_commands.cpp.
|
overridevirtual |
|
overridevirtual |
Reimplemented from KUndo2Command.
Definition at line 122 of file kis_saved_commands.cpp.
|
overridevirtual |
Reimplemented from KUndo2Command.
Definition at line 104 of file kis_saved_commands.cpp.
References m_command.
|
overridevirtual |
Reimplemented from KUndo2Command.
Definition at line 127 of file kis_saved_commands.cpp.
References m_command.
|
overridevirtual |
Reimplemented from KUndo2Command.
Definition at line 100 of file kis_saved_commands.cpp.
References m_command.
|
overridevirtual |
Since we are saving the actual command inside another command, so we cannot unwrap the command here. Otherwise the shared pointer in other will destroy the merged command some time later.
Reimplemented from KUndo2Command.
Definition at line 109 of file kis_saved_commands.cpp.
References m_command.
|
inlinestatic |
The function lazily unwraps a saved command cmd and passes the internal command to the the function func. If passed cmd command is not a saved command, then it is passed to the function directly.
Definition at line 67 of file kis_saved_commands.h.
|
private |
Definition at line 84 of file kis_saved_commands.h.