TimeLine: disable the selected range when a sprite editor is clicked

With this we can avoid confusion in the execution of commands like
Clear, that depending on the enable/disable state of the timeline range
it affects the timeline (clearing the whole range) or the sprite editor
(clearing the selected area). So now, when a sprite editor is clicked
we disable the range in the timeline, it's a way to say "as you clicked
this editor, commands will affect the editor, if you click the timeline
again, commands will affect the timeline".
This commit is contained in:
David Capello 2014-03-30 01:43:33 -03:00
parent 896fb27fd5
commit 875301cb82

View File

@ -165,6 +165,14 @@ Timeline::~Timeline()
void Timeline::updateUsingEditor(Editor* editor)
{
// As a sprite editor was selected, it looks like the user wants to
// execute commands targetting the editor instead of the
// timeline. Here we disable the selected range, so commands like
// Clear, Copy, Cut, etc. don't target the Timeline and they are
// sent to the active sprite editor.
m_range.disableRange();
invalidate();
detachDocument();
// We always update the editor. In this way the timeline keeps in
@ -740,6 +748,11 @@ bool Timeline::onProcessMessage(Message* msg)
}
}
// Disable range if we selected only one cel.
if (m_range.layerBegin() == m_range.layerEnd() &&
m_range.frameBegin() == m_range.frameEnd())
m_range.disableRange();
// Clean the clicked-part & redraw the hot-part.
cleanClk();