mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-27 15:35:21 +00:00
F2 renames the layer if a range of frames is not selected (fix #2326)
In this way we can use F2 to: 1. Set the Loop section if two or more frames are selected 2. Remove the loop section if only one frame is selected 3. Rename the active layer if the layer is selected (or no frames are selected)
This commit is contained in:
parent
24846eae10
commit
7104a1a449
@ -76,6 +76,7 @@
|
||||
<key command="CanvasSize" shortcut="C" />
|
||||
<!-- Layer -->
|
||||
<key command="LayerProperties" shortcut="Shift+P" />
|
||||
<key command="LayerProperties" shortcut="F2" context="Normal" />
|
||||
<key command="LayerVisibility" shortcut="Shift+X" />
|
||||
<key command="OpenGroup" shortcut="Shift+E" />
|
||||
<key command="NewLayer" shortcut="Shift+N" />
|
||||
@ -147,7 +148,7 @@
|
||||
<key command="ShowGrid" shortcut="Ctrl+'" mac="Cmd+'" />
|
||||
<key command="ShowPixelGrid" shortcut="Ctrl+Shift+'" mac="Cmd+Shift+'" />
|
||||
<key command="SnapToGrid" shortcut="Shift+S" />
|
||||
<key command="SetLoopSection" shortcut="F2" />
|
||||
<key command="SetLoopSection" shortcut="F2" context="FramesSelection" />
|
||||
<key command="ShowOnionSkin" shortcut="F3" />
|
||||
<key command="ToggleTimelineThumbnails" shortcut="F6" />
|
||||
<key command="Timeline" shortcut="Tab">
|
||||
|
@ -1080,6 +1080,7 @@ key_context_rotating_selection = Rotating Selection
|
||||
key_context_move_tool = Move Tool
|
||||
key_context_freehand_tool = Freehand Tool
|
||||
key_context_shape_tool = Shape Tool
|
||||
key_context_frames_selection = Frames Selection
|
||||
copy_selection = Copy Selection
|
||||
snap_to_grid = Snap To Grid
|
||||
lock_axis = Lock Axis
|
||||
|
@ -1,4 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2023 Igara Studio S.A.
|
||||
// Copyright (C) 2017 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -21,6 +22,7 @@ namespace app {
|
||||
FreehandTool,
|
||||
ShapeTool,
|
||||
MouseWheel,
|
||||
FramesSelection,
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2018-2022 Igara Studio S.A.
|
||||
// Copyright (C) 2018-2023 Igara Studio S.A.
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
@ -23,6 +23,7 @@
|
||||
#include "app/tools/tool.h"
|
||||
#include "app/tools/tool_box.h"
|
||||
#include "app/ui/key.h"
|
||||
#include "app/ui/timeline/timeline.h"
|
||||
#include "app/ui_context.h"
|
||||
#include "app/xml_document.h"
|
||||
#include "app/xml_exception.h"
|
||||
@ -90,6 +91,7 @@ namespace {
|
||||
{ "MoveTool" , app::KeyContext::MoveTool },
|
||||
{ "FreehandTool" , app::KeyContext::FreehandTool },
|
||||
{ "ShapeTool" , app::KeyContext::ShapeTool },
|
||||
{ "FramesSelection" , app::KeyContext::FramesSelection },
|
||||
{ NULL , app::KeyContext::Any }
|
||||
};
|
||||
|
||||
@ -435,13 +437,15 @@ void Key::add(const ui::Accelerator& accel,
|
||||
const ui::Accelerator* Key::isPressed(const Message* msg,
|
||||
KeyboardShortcuts& globalKeys) const
|
||||
{
|
||||
const KeyContext currentKeyContext = globalKeys.getCurrentKeyContext();
|
||||
|
||||
if (auto keyMsg = dynamic_cast<const KeyMessage*>(msg)) {
|
||||
for (const Accelerator& accel : accels()) {
|
||||
if (accel.isPressed(keyMsg->modifiers(),
|
||||
keyMsg->scancode(),
|
||||
keyMsg->unicodeChar()) &&
|
||||
(m_keycontext == KeyContext::Any ||
|
||||
m_keycontext == globalKeys.getCurrentKeyContext())) {
|
||||
m_keycontext == currentKeyContext)) {
|
||||
return &accel;
|
||||
}
|
||||
}
|
||||
@ -1081,10 +1085,19 @@ KeyContext KeyboardShortcuts::getCurrentKeyContext()
|
||||
// eyedropper, but we want to use alt+left and alt+right in the
|
||||
// original context (the selection tool).
|
||||
App::instance()->activeToolManager()
|
||||
->selectedTool()->getInk(0)->isSelection())
|
||||
->selectedTool()->getInk(0)->isSelection()) {
|
||||
return KeyContext::SelectionTool;
|
||||
else
|
||||
return KeyContext::Normal;
|
||||
}
|
||||
|
||||
auto timeline = App::instance()->timeline();
|
||||
if (doc && timeline &&
|
||||
!timeline->selectedFrames().empty() &&
|
||||
(timeline->range().type() == DocRange::kFrames ||
|
||||
timeline->range().type() == DocRange::kCels)) {
|
||||
return KeyContext::FramesSelection;
|
||||
}
|
||||
|
||||
return KeyContext::Normal;
|
||||
}
|
||||
|
||||
bool KeyboardShortcuts::getCommandFromKeyMessage(const Message* msg, Command** command, Params* params)
|
||||
@ -1338,6 +1351,8 @@ std::string convertKeyContextToUserFriendlyString(KeyContext keyContext)
|
||||
return I18N_KEY(key_context_freehand_tool);
|
||||
case KeyContext::ShapeTool:
|
||||
return I18N_KEY(key_context_shape_tool);
|
||||
case KeyContext::FramesSelection:
|
||||
return I18N_KEY(key_context_frames_selection);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user