mirror of https://github.com/aseprite/aseprite.git
Merge branch 'main' into beta
This commit is contained in:
commit
f5bff8ae4b
|
@ -28,7 +28,7 @@ jobs:
|
||||||
sudo apt-get update -qq
|
sudo apt-get update -qq
|
||||||
sudo apt-get install -y \
|
sudo apt-get install -y \
|
||||||
libpixman-1-dev libfreetype6-dev libharfbuzz-dev zlib1g-dev \
|
libpixman-1-dev libfreetype6-dev libharfbuzz-dev zlib1g-dev \
|
||||||
libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev
|
libx11-dev libxcursor-dev libxi-dev libgl1-mesa-dev libfontconfig1-dev
|
||||||
- name: Install Skia
|
- name: Install Skia
|
||||||
if: ${{ matrix.ui == 'gui' }}
|
if: ${{ matrix.ui == 'gui' }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
2
laf
2
laf
|
@ -1 +1 @@
|
||||||
Subproject commit 2647cc0a948176aa85ae3f75f425a4a2554ac15e
|
Subproject commit d3e6a2c58d37e5e3f249c1f04eded5f80e633c42
|
|
@ -578,10 +578,11 @@ private:
|
||||||
fillWheelActionsList();
|
fillWheelActionsList();
|
||||||
fillDragActionsList();
|
fillDragActionsList();
|
||||||
|
|
||||||
|
// Fill the 'Commands' and 'Action Modifier' lists
|
||||||
for (const KeyPtr& key : m_keys) {
|
for (const KeyPtr& key : m_keys) {
|
||||||
if (key->type() == KeyType::Tool || key->type() == KeyType::Quicktool ||
|
// If it's not a listed Command or Action key, we go to the next key...
|
||||||
key->type() == KeyType::WheelAction || key->type() == KeyType::DragAction ||
|
if (!((key->type() == KeyType::Command && key->isCommandListed()) ||
|
||||||
key->isListed()) {
|
(key->type() == KeyType::Action))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2023 Igara Studio S.A.
|
// Copyright (C) 2023-2024 Igara Studio S.A.
|
||||||
// Copyright (C) 2017 David Capello
|
// Copyright (C) 2017 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
|
@ -64,6 +64,7 @@ bool LayerLockCommand::onChecked(Context* context)
|
||||||
void LayerLockCommand::onExecute(Context* context)
|
void LayerLockCommand::onExecute(Context* context)
|
||||||
{
|
{
|
||||||
ContextWriter writer(context);
|
ContextWriter writer(context);
|
||||||
|
Doc* doc = writer.document();
|
||||||
SelectedLayers selLayers;
|
SelectedLayers selLayers;
|
||||||
auto range = context->range();
|
auto range = context->range();
|
||||||
if (range.enabled()) {
|
if (range.enabled()) {
|
||||||
|
@ -77,9 +78,8 @@ void LayerLockCommand::onExecute(Context* context)
|
||||||
if (!layer->isEditable())
|
if (!layer->isEditable())
|
||||||
anyLock = true;
|
anyLock = true;
|
||||||
}
|
}
|
||||||
for (auto layer : selLayers) {
|
for (auto* layer : selLayers)
|
||||||
layer->setEditable(anyLock);
|
doc->setLayerEditableWithNotifications(layer, anyLock);
|
||||||
}
|
|
||||||
|
|
||||||
update_screen_for_document(writer.document());
|
update_screen_for_document(writer.document());
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,6 +201,12 @@ void Doc::setLayerVisibilityWithNotifications(Layer* layer, const bool visible)
|
||||||
notifyAfterLayerVisibilityChange(layer);
|
notifyAfterLayerVisibilityChange(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Doc::setLayerEditableWithNotifications(Layer* layer, const bool editable)
|
||||||
|
{
|
||||||
|
notifyBeforeLayerEditableChange(layer, editable);
|
||||||
|
layer->setEditable(editable);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Notifications
|
// Notifications
|
||||||
|
|
||||||
|
@ -266,6 +272,13 @@ void Doc::notifyAfterLayerVisibilityChange(Layer* layer)
|
||||||
notify_observers<DocEvent&>(&DocObserver::onAfterLayerVisibilityChange, ev);
|
notify_observers<DocEvent&>(&DocObserver::onAfterLayerVisibilityChange, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Doc::notifyBeforeLayerEditableChange(Layer* layer, bool newState)
|
||||||
|
{
|
||||||
|
DocEvent ev(this);
|
||||||
|
ev.layer(layer);
|
||||||
|
notify_observers<DocEvent&, bool>(&DocObserver::onBeforeLayerEditableChange, ev, newState);
|
||||||
|
}
|
||||||
|
|
||||||
void Doc::notifyCelMoved(Layer* fromLayer, frame_t fromFrame, Layer* toLayer, frame_t toFrame)
|
void Doc::notifyCelMoved(Layer* fromLayer, frame_t fromFrame, Layer* toLayer, frame_t toFrame)
|
||||||
{
|
{
|
||||||
DocEvent ev(this);
|
DocEvent ev(this);
|
||||||
|
|
|
@ -116,6 +116,12 @@ public:
|
||||||
// invalidated/redrawn, MovingPixelsState can drop pixels, etc.)
|
// invalidated/redrawn, MovingPixelsState can drop pixels, etc.)
|
||||||
void setLayerVisibilityWithNotifications(Layer* layer, const bool visible);
|
void setLayerVisibilityWithNotifications(Layer* layer, const bool visible);
|
||||||
|
|
||||||
|
// Use this function to change the layer editable flag and
|
||||||
|
// notify all DocObservers about this change (e.g. so the Editor
|
||||||
|
// can be invalidated/redrawn, MovingPixelsState can drop pixels,
|
||||||
|
// etc.)
|
||||||
|
void setLayerEditableWithNotifications(Layer* layer, const bool editable);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Notifications
|
// Notifications
|
||||||
|
|
||||||
|
@ -127,6 +133,7 @@ public:
|
||||||
void notifyLayerMergedDown(Layer* srcLayer, Layer* targetLayer);
|
void notifyLayerMergedDown(Layer* srcLayer, Layer* targetLayer);
|
||||||
void notifyBeforeLayerVisibilityChange(Layer* layer, bool newState);
|
void notifyBeforeLayerVisibilityChange(Layer* layer, bool newState);
|
||||||
void notifyAfterLayerVisibilityChange(Layer* layer);
|
void notifyAfterLayerVisibilityChange(Layer* layer);
|
||||||
|
void notifyBeforeLayerEditableChange(Layer* layer, bool newState);
|
||||||
void notifyCelMoved(Layer* fromLayer, frame_t fromFrame, Layer* toLayer, frame_t toFrame);
|
void notifyCelMoved(Layer* fromLayer, frame_t fromFrame, Layer* toLayer, frame_t toFrame);
|
||||||
void notifyCelCopied(Layer* fromLayer, frame_t fromFrame, Layer* toLayer, frame_t toFrame);
|
void notifyCelCopied(Layer* fromLayer, frame_t fromFrame, Layer* toLayer, frame_t toFrame);
|
||||||
void notifySelectionChanged();
|
void notifySelectionChanged();
|
||||||
|
|
|
@ -101,6 +101,9 @@ public:
|
||||||
virtual void onBeforeLayerVisibilityChange(DocEvent& ev, bool newState) {}
|
virtual void onBeforeLayerVisibilityChange(DocEvent& ev, bool newState) {}
|
||||||
virtual void onAfterLayerVisibilityChange(DocEvent& ev) {}
|
virtual void onAfterLayerVisibilityChange(DocEvent& ev) {}
|
||||||
|
|
||||||
|
// The editable flag of a specific layer is going to change/changed.
|
||||||
|
virtual void onBeforeLayerEditableChange(DocEvent& ev, bool newState) {}
|
||||||
|
|
||||||
// The tileset was remapped (e.g. when tiles are re-ordered).
|
// The tileset was remapped (e.g. when tiles are re-ordered).
|
||||||
virtual void onRemapTileset(DocEvent& ev, const doc::Remap& remap) {}
|
virtual void onRemapTileset(DocEvent& ev, const doc::Remap& remap) {}
|
||||||
|
|
||||||
|
|
|
@ -2262,7 +2262,7 @@ bool Editor::onProcessMessage(Message* msg)
|
||||||
if (m_brushPreview.onScreen()) {
|
if (m_brushPreview.onScreen()) {
|
||||||
m_brushPreview.hide();
|
m_brushPreview.hide();
|
||||||
|
|
||||||
// Destroy the extra cel explicitly (it could happend
|
// Destroy the extra cel explicitly (it could happen
|
||||||
// automatically by the m_brushPreview.show()) just in case
|
// automatically by the m_brushPreview.show()) just in case
|
||||||
// that the brush preview will not use the extra cel
|
// that the brush preview will not use the extra cel
|
||||||
// (e.g. in the case of the Eraser tool).
|
// (e.g. in the case of the Eraser tool).
|
||||||
|
@ -2523,6 +2523,12 @@ void Editor::onBeforeLayerVisibilityChange(DocEvent& ev, bool newState)
|
||||||
m_state->onBeforeLayerVisibilityChange(this, ev.layer(), newState);
|
m_state->onBeforeLayerVisibilityChange(this, ev.layer(), newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Editor::onBeforeLayerEditableChange(DocEvent& ev, bool newState)
|
||||||
|
{
|
||||||
|
if (m_state)
|
||||||
|
m_state->onBeforeLayerEditableChange(this, ev.layer(), newState);
|
||||||
|
}
|
||||||
|
|
||||||
void Editor::setCursor(const gfx::Point& mouseDisplayPos)
|
void Editor::setCursor(const gfx::Point& mouseDisplayPos)
|
||||||
{
|
{
|
||||||
Rect vp = View::getView(this)->viewportBounds();
|
Rect vp = View::getView(this)->viewportBounds();
|
||||||
|
|
|
@ -342,6 +342,7 @@ protected:
|
||||||
void onRemoveTag(DocEvent& ev) override;
|
void onRemoveTag(DocEvent& ev) override;
|
||||||
void onRemoveSlice(DocEvent& ev) override;
|
void onRemoveSlice(DocEvent& ev) override;
|
||||||
void onBeforeLayerVisibilityChange(DocEvent& ev, bool newState) override;
|
void onBeforeLayerVisibilityChange(DocEvent& ev, bool newState) override;
|
||||||
|
void onBeforeLayerEditableChange(DocEvent& ev, bool newState) override;
|
||||||
|
|
||||||
// ActiveToolObserver impl
|
// ActiveToolObserver impl
|
||||||
void onActiveToolChange(tools::Tool* tool) override;
|
void onActiveToolChange(tools::Tool* tool) override;
|
||||||
|
@ -442,7 +443,7 @@ private:
|
||||||
obs::scoped_connection m_contextBarBrushChangeConn;
|
obs::scoped_connection m_contextBarBrushChangeConn;
|
||||||
obs::scoped_connection m_showExtrasConn;
|
obs::scoped_connection m_showExtrasConn;
|
||||||
|
|
||||||
// Slots listeing document preferences.
|
// Slots listening document preferences.
|
||||||
obs::scoped_connection m_tiledConnBefore;
|
obs::scoped_connection m_tiledConnBefore;
|
||||||
obs::scoped_connection m_tiledConn;
|
obs::scoped_connection m_tiledConn;
|
||||||
obs::scoped_connection m_gridConn;
|
obs::scoped_connection m_gridConn;
|
||||||
|
|
|
@ -149,6 +149,9 @@ public:
|
||||||
// Called when the visibility of a specific layer is changed.
|
// Called when the visibility of a specific layer is changed.
|
||||||
virtual void onBeforeLayerVisibilityChange(Editor* editor, doc::Layer* layer, bool newState) {}
|
virtual void onBeforeLayerVisibilityChange(Editor* editor, doc::Layer* layer, bool newState) {}
|
||||||
|
|
||||||
|
// Called when the editable flag of a specific layer is changed.
|
||||||
|
virtual void onBeforeLayerEditableChange(Editor* editor, doc::Layer* layer, bool newState) {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DISABLE_COPYING(EditorState);
|
DISABLE_COPYING(EditorState);
|
||||||
};
|
};
|
||||||
|
|
|
@ -559,16 +559,11 @@ bool MovingPixelsState::acceptQuickTool(tools::Tool* tool)
|
||||||
tool->getInk(0)->isScrollMovement() || tool->getInk(0)->isZoom());
|
tool->getInk(0)->isScrollMovement() || tool->getInk(0)->isZoom());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovingPixelsState::onBeforeLayerVisibilityChange(Editor* editor,
|
void MovingPixelsState::dropPixelsIfLayerIsSelected(doc::Layer* layer)
|
||||||
doc::Layer* layer,
|
|
||||||
bool newState)
|
|
||||||
{
|
{
|
||||||
if (!isActiveDocument())
|
if (!isActiveDocument())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// If the layer visibility of any selected layer changes, we just
|
|
||||||
// drop the pixels (it's the easiest way to avoid modifying hidden
|
|
||||||
// pixels).
|
|
||||||
if (m_pixelsMovement) {
|
if (m_pixelsMovement) {
|
||||||
const Site& site = m_pixelsMovement->site();
|
const Site& site = m_pixelsMovement->site();
|
||||||
if (site.layer() == layer || site.range().contains(layer)) {
|
if (site.layer() == layer || site.range().contains(layer)) {
|
||||||
|
@ -577,6 +572,30 @@ void MovingPixelsState::onBeforeLayerVisibilityChange(Editor* editor,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MovingPixelsState::onBeforeLayerVisibilityChange(Editor* editor,
|
||||||
|
doc::Layer* layer,
|
||||||
|
bool newState)
|
||||||
|
{
|
||||||
|
// If the layer visibility of any selected layer changes, we just
|
||||||
|
// drop the pixels (it's the easiest way to avoid modifying hidden
|
||||||
|
// pixels).
|
||||||
|
dropPixelsIfLayerIsSelected(layer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MovingPixelsState::onBeforeLayerEditableChange(Editor* editor,
|
||||||
|
doc::Layer* layer,
|
||||||
|
bool newState)
|
||||||
|
{
|
||||||
|
// If the layer 'editable' flag of any selected layer changes,
|
||||||
|
// we just drop the pixels (it's the easiest way to avoid modifying
|
||||||
|
// hidden pixels and it's the simplest treatment when
|
||||||
|
// locking the layer)
|
||||||
|
// TODO: It would be more convenient not to drop the selected
|
||||||
|
// image if the 'lock' then 'unlock' actions are performed without
|
||||||
|
// any transformation taking place.
|
||||||
|
dropPixelsIfLayerIsSelected(layer);
|
||||||
|
}
|
||||||
|
|
||||||
// Before executing any command, we drop the pixels (go back to standby).
|
// Before executing any command, we drop the pixels (go back to standby).
|
||||||
void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
|
void MovingPixelsState::onBeforeCommandExecution(CommandExecutionEvent& ev)
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,6 +65,7 @@ public:
|
||||||
bool acceptQuickTool(tools::Tool* tool) override;
|
bool acceptQuickTool(tools::Tool* tool) override;
|
||||||
bool requireBrushPreview() override { return false; }
|
bool requireBrushPreview() override { return false; }
|
||||||
void onBeforeLayerVisibilityChange(Editor* editor, doc::Layer* layer, bool newState) override;
|
void onBeforeLayerVisibilityChange(Editor* editor, doc::Layer* layer, bool newState) override;
|
||||||
|
void onBeforeLayerEditableChange(Editor* editor, doc::Layer* layer, bool newState) override;
|
||||||
|
|
||||||
// EditorObserver
|
// EditorObserver
|
||||||
void onDestroyEditor(Editor* editor) override;
|
void onDestroyEditor(Editor* editor) override;
|
||||||
|
@ -103,6 +104,9 @@ private:
|
||||||
|
|
||||||
KeyAction getCurrentKeyAction() const;
|
KeyAction getCurrentKeyAction() const;
|
||||||
|
|
||||||
|
// Used on 'onBeforeLayerVisibilityChange' and 'onBeforeLayerEditableChange' functions.
|
||||||
|
void dropPixelsIfLayerIsSelected(doc::Layer* layer);
|
||||||
|
|
||||||
// Helper member to move/translate selection and pixels.
|
// Helper member to move/translate selection and pixels.
|
||||||
PixelsMovementPtr m_pixelsMovement;
|
PixelsMovementPtr m_pixelsMovement;
|
||||||
DelayedMouseMove m_delayedMouseMove;
|
DelayedMouseMove m_delayedMouseMove;
|
||||||
|
|
|
@ -131,7 +131,7 @@ public:
|
||||||
const KeyboardShortcuts& globalKeys) const;
|
const KeyboardShortcuts& globalKeys) const;
|
||||||
bool isPressed() const;
|
bool isPressed() const;
|
||||||
bool isLooselyPressed() const;
|
bool isLooselyPressed() const;
|
||||||
bool isListed() const;
|
bool isCommandListed() const;
|
||||||
|
|
||||||
bool hasAccel(const ui::Accelerator& accel) const;
|
bool hasAccel(const ui::Accelerator& accel) const;
|
||||||
bool hasUserDefinedAccels() const;
|
bool hasUserDefinedAccels() const;
|
||||||
|
|
|
@ -536,9 +536,9 @@ bool Key::isLooselyPressed() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Key::isListed() const
|
bool Key::isCommandListed() const
|
||||||
{
|
{
|
||||||
return type() != KeyType::Command || !command()->isListed(params());
|
return type() == KeyType::Command && command()->isListed(params());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Key::hasAccel(const ui::Accelerator& accel) const
|
bool Key::hasAccel(const ui::Accelerator& accel) const
|
||||||
|
|
|
@ -4345,7 +4345,7 @@ int Timeline::topHeight() const
|
||||||
|
|
||||||
void Timeline::onNewInputPriority(InputChainElement* element, const ui::Message* msg)
|
void Timeline::onNewInputPriority(InputChainElement* element, const ui::Message* msg)
|
||||||
{
|
{
|
||||||
// It looks like the user wants to execute commands targetting the
|
// It looks like the user wants to execute commands targeting the
|
||||||
// ColorBar instead of the Timeline. Here we disable the selected
|
// ColorBar instead of the Timeline. Here we disable the selected
|
||||||
// range, so commands like Clear, Copy, Cut, etc. don't target the
|
// range, so commands like Clear, Copy, Cut, etc. don't target the
|
||||||
// Timeline and they are sent to the active sprite editor.
|
// Timeline and they are sent to the active sprite editor.
|
||||||
|
@ -4656,7 +4656,7 @@ void Timeline::setLayerEditableFlag(const layer_t l, const bool state)
|
||||||
bool regenRows = false;
|
bool regenRows = false;
|
||||||
|
|
||||||
if (layer->isEditable() != state) {
|
if (layer->isEditable() != state) {
|
||||||
layer->setEditable(state);
|
m_document->setLayerEditableWithNotifications(layer, state);
|
||||||
|
|
||||||
if (layer->isGroup() && layer->isExpanded())
|
if (layer->isGroup() && layer->isExpanded())
|
||||||
regenRows = true;
|
regenRows = true;
|
||||||
|
@ -4666,7 +4666,7 @@ void Timeline::setLayerEditableFlag(const layer_t l, const bool state)
|
||||||
layer = layer->parent();
|
layer = layer->parent();
|
||||||
while (layer) {
|
while (layer) {
|
||||||
if (!layer->isEditable()) {
|
if (!layer->isEditable()) {
|
||||||
layer->setEditable(true);
|
m_document->setLayerEditableWithNotifications(layer, true);
|
||||||
regenRows = true;
|
regenRows = true;
|
||||||
}
|
}
|
||||||
layer = layer->parent();
|
layer = layer->parent();
|
||||||
|
|
Loading…
Reference in New Issue