Fix triggering Editor's onCut() without mask when ColorBar's onCanCut() enables it

Asking for onCanCut/Copy/Paste/Clear just before onCut/Copy/Paste/Clear
in the same InputChainElement we ensure that the command for that specific
element can be used (and we aren't mixing onCans result of one input chain
element with the execution of the first input chain element command).
This commit is contained in:
David Capello 2015-05-11 09:37:39 -03:00
parent 525e473fb5
commit 442d8c624a

View File

@ -71,7 +71,7 @@ bool InputChain::canClear(Context* ctx)
void InputChain::cut(Context* ctx)
{
for (auto e : m_elements) {
if (e->onCut(ctx))
if (e->onCanCut(ctx) && e->onCut(ctx))
break;
}
}
@ -79,7 +79,7 @@ void InputChain::cut(Context* ctx)
void InputChain::copy(Context* ctx)
{
for (auto e : m_elements) {
if (e->onCopy(ctx))
if (e->onCanCopy(ctx) && e->onCopy(ctx))
break;
}
}
@ -87,7 +87,7 @@ void InputChain::copy(Context* ctx)
void InputChain::paste(Context* ctx)
{
for (auto e : m_elements) {
if (e->onPaste(ctx))
if (e->onCanPaste(ctx) && e->onPaste(ctx))
break;
}
}
@ -95,7 +95,7 @@ void InputChain::paste(Context* ctx)
void InputChain::clear(Context* ctx)
{
for (auto e : m_elements) {
if (e->onClear(ctx))
if (e->onCanClear(ctx) && e->onClear(ctx))
break;
}
}