|
Krita Source Code Documentation
|
Classes | |
| struct | AggregateCommand |
| The AggregateCommand struct is a command with delayed initialization. On first redo() populateChildCommands() is called and the descendants add the desired commands to the internal list. After that, the added commands are executed on every undo()/redo(). More... | |
| struct | CompositeCommand |
| struct | FlipFlopCommand |
| struct | LambdaCommand |
| The LambdaCommand struct is a shorthand for creation of AggregateCommand commands using C++ lambda feature. Just pass a lambda object into a command and it will be called from within the context of the strokes thread to populate the command content. More... | |
| struct | SkipFirstRedoBase |
| struct | SkipFirstRedoWrapper |
Functions | |
| KUndo2Command * | composeCommands (KUndo2Command *parent, KUndo2Command *cmd) |
| void | redoAndMergeIntoAccumulatingCommand (KUndo2Command *cmd, QScopedPointer< KUndo2Command > &accumulatingCommand) |
Definition at line 11 of file kis_command_ids.h.
| KRITACOMMAND_EXPORT KUndo2Command * KisCommandUtils::composeCommands | ( | KUndo2Command * | parent, |
| KUndo2Command * | cmd ) |
A simple helper function for monadic composition of undo commands
parent and cmd commands are composed into a single CompositeCommand command. The name of the new command is inherited from parent.
If parent is already a CompositeCommand, then cmd is just appended to the end of of it.
If parent is nullptr, then a mere cmd is returned
WARNIGN: neither of the commands should have a parent! We simply cannot compose a command with a parent!
Usage:
\code{.cpp}
KUndo2Command *cmd = nullptr;
if (propertyXChanged) {
cmd = composeCommands(cmd, new ChangePropertyXCommand(...));
}
if (propertyYChanged) {
cmd = composeCommands(cmd, new ChangePropertyYCommand(...));
}
if (propertyZChanged) {
cmd = composeCommands(cmd, new ChangePropertyZCommand(...));
}
if (cmd) {
m_view->undoAdapter()->addCommand(cmd);
}
\endcode
Definition at line 201 of file kis_command_utils.cpp.
References KisCommandUtils::CompositeCommand::addCommand(), KUndo2Command::hasParent(), KIS_SAFE_ASSERT_RECOVER, KIS_SAFE_ASSERT_RECOVER_NOOP, kundo2_noi18n(), and KUndo2Command::setText().
| KRITACOMMAND_EXPORT void KisCommandUtils::redoAndMergeIntoAccumulatingCommand | ( | KUndo2Command * | cmd, |
| QScopedPointer< KUndo2Command > & | accumulatingCommand ) |
A simple function to merge down commands in iterative actions, like the ones we use in shape manipulations. The function takes ownership of cmd and either merges it into accumulatingCommand (if exists) or just sets the accumulating command to that command
Definition at line 224 of file kis_command_utils.cpp.
References KIS_SAFE_ASSERT_RECOVER_NOOP, and KUndo2Command::redo().