mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-02 11:59:58 +00:00
Deselect timeline range when we modify sprite selection
Fix a problem selecting one cel in the timeline, using Ctrl+A and then Ctrl+C to copy the whole image area. (This indicates that the user want to copy the cel content, not the timeline cel.)
This commit is contained in:
parent
0fc02cf180
commit
ae9e2d173b
@ -36,6 +36,7 @@
|
||||
#include "base/unique_ptr.h"
|
||||
#include "doc/document_event.h"
|
||||
#include "doc/document_observer.h"
|
||||
#include "doc/document_observer.h"
|
||||
#include "raster/cel.h"
|
||||
#include "raster/layer.h"
|
||||
#include "raster/mask.h"
|
||||
@ -139,6 +140,12 @@ void Document::notifyCelCopied(Layer* fromLayer, FrameNumber fromFrame, Layer* t
|
||||
notifyObservers<doc::DocumentEvent&>(&doc::DocumentObserver::onCelCopied, ev);
|
||||
}
|
||||
|
||||
void Document::notifySelectionChanged()
|
||||
{
|
||||
doc::DocumentEvent ev(this);
|
||||
notifyObservers<doc::DocumentEvent&>(&doc::DocumentObserver::onSelectionChanged, ev);
|
||||
}
|
||||
|
||||
bool Document::isModified() const
|
||||
{
|
||||
return !m_undo->isSavedState();
|
||||
@ -210,6 +217,9 @@ void Document::generateMaskBoundaries(Mask* mask)
|
||||
m_bound.seg[c].y2 += mask->bounds().y;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO move this to the exact place where selection is modified.
|
||||
notifySelectionChanged();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -93,6 +93,7 @@ namespace app {
|
||||
void notifyLayerMergedDown(Layer* srcLayer, Layer* targetLayer);
|
||||
void notifyCelMoved(Layer* fromLayer, FrameNumber fromFrame, Layer* toLayer, FrameNumber toFrame);
|
||||
void notifyCelCopied(Layer* fromLayer, FrameNumber fromFrame, Layer* toLayer, FrameNumber toFrame);
|
||||
void notifySelectionChanged();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// File related properties
|
||||
|
@ -968,6 +968,14 @@ void Timeline::onRemoveFrame(doc::DocumentEvent& ev)
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void Timeline::onSelectionChanged(doc::DocumentEvent& ev)
|
||||
{
|
||||
m_range.disableRange();
|
||||
|
||||
clearClipboardRange();
|
||||
invalidate();
|
||||
}
|
||||
|
||||
void Timeline::onAfterFrameChanged(Editor* editor)
|
||||
{
|
||||
setFrame(editor->frame());
|
||||
|
@ -108,6 +108,7 @@ namespace app {
|
||||
void onAfterRemoveLayer(doc::DocumentEvent& ev) override;
|
||||
void onAddFrame(doc::DocumentEvent& ev) override;
|
||||
void onRemoveFrame(doc::DocumentEvent& ev) override;
|
||||
void onSelectionChanged(doc::DocumentEvent& ev) override;
|
||||
|
||||
// app::Context slots.
|
||||
void onAfterCommandExecution(Command* command);
|
||||
|
@ -55,6 +55,9 @@ namespace doc {
|
||||
// When the number of total frames available is modified.
|
||||
virtual void onTotalFramesChanged(DocumentEvent& ev) { }
|
||||
|
||||
// The selection has changed.
|
||||
virtual void onSelectionChanged(DocumentEvent& ev) { }
|
||||
|
||||
// Called to destroy the observable. (Here you could call "delete this".)
|
||||
virtual void dispose() { }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user