19 m_strokesFacade(strokesFacade),
189 if (!other || other->
id() !=
id() ||
id() < 0 || other->
id() < 0)
return false;
210 if (
m_d->
commands.size() != otherCommands.size())
return false;
215 auto otherIt = otherCommands.constBegin();
216 auto otherEnd = otherCommands.constEnd();
218 bool sameCommands =
true;
219 while (it != end && otherIt != otherEnd) {
223 if (!iface1 || !iface1->
canMergeWith(otherIt->command.data()) ||
224 it->command->id() < 0 || otherIt->command->id() < 0 ||
225 it->command->id() != otherIt->command->id() ||
226 it->sequentiality != otherIt->sequentiality ||
227 it->exclusivity != otherIt->exclusivity) {
229 sameCommands =
false;
236 if (!sameCommands)
return false;
239 otherIt = otherCommands.constBegin();
241 while (it != end && otherIt != otherEnd) {
242 if (it->command->id() != -1) {
243 bool result = it->command->mergeWith(otherIt->command.data());
264 if (!other || other->
id() !=
id() ||
id() < 0 || other->
id() < 0)
return false;
269 if (
m_d->
commands.size() != otherCommands.size())
return false;
274 auto otherIt = otherCommands.constBegin();
275 auto otherEnd = otherCommands.constEnd();
277 bool sameCommands =
true;
278 while (it != end && otherIt != otherEnd) {
280 if (!it->command->canAnnihilateWith(otherIt->command.data()) ||
281 it->command->id() < 0 || otherIt->command->id() < 0 ||
282 it->command->id() != otherIt->command->id() ||
283 it->sequentiality != otherIt->sequentiality ||
284 it->exclusivity != otherIt->exclusivity) {
286 sameCommands =
false;
293 if (!sameCommands)
return false;
316 *jobs <<
new KisStrokeStrategyUndoCommandBased::
328 *jobs <<
new KisStrokeStrategyUndoCommandBased::
float value(const T *src, size_t ch)
virtual KUndo2CommandExtraData * clone() const =0
KUndo2MagicString text() const
KUndo2CommandExtraData * extraData() const
void setExtraData(KUndo2CommandExtraData *data)
virtual bool canMergeWith(const KUndo2Command *command) const =0
KisStrokesFacade * m_strokesFacade
~KisSavedCommandBase() override
virtual void addCommands(KisStrokeId id, bool undo)=0
KisStrokesFacade * strokesFacade()
void runStroke(bool undo)
KisSavedCommandBase(const KUndo2MagicString &name, KisStrokesFacade *strokesFacade)
static auto unwrap(Command *cmd, Func &&func) -> decltype(func(static_cast< Command * >(nullptr)))
QTime endTime() const override
void addCommands(KisStrokeId id, bool undo) override
bool mergeWith(const KUndo2Command *command) override
KisSavedCommand(KUndo2CommandSP command, KisStrokesFacade *strokesFacade)
bool canAnnihilateWith(const KUndo2Command *command) const override
int timedId() const override
bool timedMergeWith(KUndo2Command *other) override
QVector< KUndo2Command * > mergeCommandsVector() const override
QTime time() const override
void setTimedID(int timedID) override
bool isMerged() const override
KUndo2CommandSP m_command
void getCommandExecutionJobs(QVector< KisStrokeJobData * > *jobs, bool undo, bool shouldGoToHistory=true) const
~KisSavedMacroCommand() override
void addCommand(KUndo2CommandSP command, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
bool mergeWith(const KUndo2Command *command) override
void addCommands(KisStrokeId id, bool undo) override
bool canAnnihilateWith(const KUndo2Command *command) const override
KisSavedMacroCommand(const KUndo2MagicString &name, KisStrokesFacade *strokesFacade)
void setMacroId(int value)
void setOverrideInfo(const KisSavedMacroCommand *overriddenCommand, const QVector< const KUndo2Command * > &skipWhileOverride)
void setUsedWhileUndoRedo(bool value)
virtual KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy)=0
virtual void endStroke(KisStrokeId id)=0
virtual void addJob(KisStrokeId id, KisStrokeJobData *data)=0
#define KIS_ASSERT_RECOVER(cond)
KisStrokeJobData::Exclusivity exclusivity
KisStrokeJobData::Sequentiality sequentiality
QVector< const KUndo2Command * > skipWhenOverride
const KisSavedMacroCommand * overriddenCommand
QVector< SavedCommand > commands