diff --git a/data/gui.xml b/data/gui.xml
index b6dacdc49..11fc45f67 100644
--- a/data/gui.xml
+++ b/data/gui.xml
@@ -538,7 +538,7 @@
-
+
diff --git a/data/strings/en.ini b/data/strings/en.ini
index d997d465d..4e7049cdc 100644
--- a/data/strings/en.ini
+++ b/data/strings/en.ini
@@ -280,6 +280,8 @@ Flip_Canvas = Canvas
Flip_Horizontally = Horizontally
Flip_Selection = Selection
Flip_Vertically = Vertically
+FrameProperties_All = Frame Properties of all frames
+FrameProperties_Current = Frame Properties of the current range
FrameProperties = Frame Properties
FrameTagProperties = Tag Properties
FullscreenMode = Toggle Fullscreen Mode
@@ -313,6 +315,7 @@ LayerVisibility = Layer Visibility
LinkCels = Links Cels
LoadMask = Load Selection
LoadPalette = Load Palette
+LoadDefaultPalette = Load Default Palette
MaskAll = Mask All
MaskByColor = Mask By Color
MaskContent = Mask Content
@@ -404,6 +407,8 @@ SaveFileAs = Save File As
SaveFileCopyAs = Export
SaveMask = Save Selection
SavePalette = Save Palette
+SavePaletteAsDefault = Save Palette as Default
+SavePaletteAsPreset = Save Palette as Preset
Screenshot = Screenshot
Screenshot_Open = Take & Open Screenshot
Screenshot_Save = Take & Save Screenshot
diff --git a/src/app/commands/cmd_export_sprite_sheet.h b/src/app/commands/cmd_export_sprite_sheet.h
index 13f3681a1..2e8566d55 100644
--- a/src/app/commands/cmd_export_sprite_sheet.h
+++ b/src/app/commands/cmd_export_sprite_sheet.h
@@ -64,6 +64,9 @@ public:
protected:
bool onEnabled(Context* context) override;
void onExecute(Context* context) override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return params.empty();
+ }
};
} // namespace app
diff --git a/src/app/commands/cmd_flip.h b/src/app/commands/cmd_flip.h
index c4dc6a1ed..710f9f02f 100644
--- a/src/app/commands/cmd_flip.h
+++ b/src/app/commands/cmd_flip.h
@@ -1,4 +1,5 @@
// Aseprite
+// Copyright (C) 2024 Igara Studio S.A.
// Copyright (C) 2001-2015 David Capello
//
// This program is distributed under the terms of
@@ -9,6 +10,7 @@
#pragma once
#include "app/commands/command.h"
+#include "app/commands/params.h"
#include "doc/algorithm/flip_type.h"
namespace app {
@@ -24,6 +26,9 @@ namespace app {
bool onEnabled(Context* context) override;
void onExecute(Context* context) override;
std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return !params.empty();
+ }
private:
bool m_flipMask;
diff --git a/src/app/commands/cmd_frame_properties.cpp b/src/app/commands/cmd_frame_properties.cpp
index b8a483395..530092eb2 100644
--- a/src/app/commands/cmd_frame_properties.cpp
+++ b/src/app/commands/cmd_frame_properties.cpp
@@ -1,4 +1,5 @@
// Aseprite
+// Copyright (C) 2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@@ -14,6 +15,7 @@
#include "app/context.h"
#include "app/context_access.h"
#include "app/doc_api.h"
+#include "app/i18n/strings.h"
#include "app/pref/preferences.h"
#include "app/tx.h"
#include "base/convert_to.h"
@@ -35,6 +37,7 @@ protected:
void onLoadParams(const Params& params) override;
bool onEnabled(Context* context) override;
void onExecute(Context* context) override;
+ std::string onGetFriendlyName() const override;
private:
enum Target {
@@ -137,6 +140,17 @@ void FramePropertiesCommand::onExecute(Context* context)
}
}
+std::string FramePropertiesCommand::onGetFriendlyName() const
+{
+ switch (m_target) {
+ case CURRENT_RANGE:
+ return Strings::commands_FrameProperties_Current() ;
+ case ALL_FRAMES:
+ return Strings::commands_FrameProperties_All();
+ }
+ return Command::onGetFriendlyName();
+}
+
Command* CommandFactory::createFramePropertiesCommand()
{
return new FramePropertiesCommand;
diff --git a/src/app/commands/cmd_goto_frame.cpp b/src/app/commands/cmd_goto_frame.cpp
index c00d48768..e7e4a8a1a 100644
--- a/src/app/commands/cmd_goto_frame.cpp
+++ b/src/app/commands/cmd_goto_frame.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2019-2022 Igara Studio S.A.
+// Copyright (C) 2019-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@@ -87,6 +87,9 @@ protected:
return (frame > 0 ? frame-1: last);
}
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return context == KeyContext::Normal;
+ }
};
class GotoNextFrameCommand : public GotoCommand {
@@ -100,6 +103,9 @@ protected:
return (frame < last ? frame+1: 0);
}
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return context == KeyContext::Normal;
+ }
};
class GotoNextFrameWithSameTagCommand : public GotoCommand {
diff --git a/src/app/commands/cmd_keyboard_shortcuts.cpp b/src/app/commands/cmd_keyboard_shortcuts.cpp
index 5f12092f7..f47fbcef3 100644
--- a/src/app/commands/cmd_keyboard_shortcuts.cpp
+++ b/src/app/commands/cmd_keyboard_shortcuts.cpp
@@ -606,7 +606,8 @@ private:
if (key->type() == KeyType::Tool ||
key->type() == KeyType::Quicktool ||
key->type() == KeyType::WheelAction ||
- key->type() == KeyType::DragAction) {
+ key->type() == KeyType::DragAction ||
+ key->isListed()) {
continue;
}
diff --git a/src/app/commands/cmd_launch.cpp b/src/app/commands/cmd_launch.cpp
index 7ddb429e7..3217ef815 100644
--- a/src/app/commands/cmd_launch.cpp
+++ b/src/app/commands/cmd_launch.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2020 Igara Studio S.A.
+// Copyright (C) 2020-2024 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@@ -24,6 +24,10 @@ public:
protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
+ std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return params.get("path") != "";
+ }
private:
enum Type { Url };
@@ -59,6 +63,11 @@ void LaunchCommand::onExecute(Context* context)
}
}
+std::string LaunchCommand::onGetFriendlyName() const
+{
+ return Command::onGetFriendlyName() + ": " + m_path;
+}
+
Command* CommandFactory::createLaunchCommand()
{
return new LaunchCommand;
diff --git a/src/app/commands/cmd_layer_properties.cpp b/src/app/commands/cmd_layer_properties.cpp
index d37a9341c..20a43485d 100644
--- a/src/app/commands/cmd_layer_properties.cpp
+++ b/src/app/commands/cmd_layer_properties.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2020-2023 Igara Studio S.A.
+// Copyright (C) 2020-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@@ -56,6 +56,9 @@ public:
protected:
bool onEnabled(Context* context) override;
void onExecute(Context* context) override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return context == KeyContext::Normal;
+ }
};
class LayerPropertiesWindow;
diff --git a/src/app/commands/cmd_load_palette.cpp b/src/app/commands/cmd_load_palette.cpp
index 27daeb014..b889f0871 100644
--- a/src/app/commands/cmd_load_palette.cpp
+++ b/src/app/commands/cmd_load_palette.cpp
@@ -32,6 +32,7 @@ public:
protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
+ std::string onGetFriendlyName() const override;
private:
std::string m_preset;
@@ -88,6 +89,14 @@ void LoadPaletteCommand::onExecute(Context* context)
context->executeCommand(cmd);
}
+std::string LoadPaletteCommand::onGetFriendlyName() const
+{
+ std::string name = Command::onGetFriendlyName();
+ if (m_preset == "default")
+ name = Strings::commands_LoadDefaultPalette();
+ return name;
+}
+
Command* CommandFactory::createLoadPaletteCommand()
{
return new LoadPaletteCommand;
diff --git a/src/app/commands/cmd_modify_selection.cpp b/src/app/commands/cmd_modify_selection.cpp
index 5cc911d1c..ec94a4e92 100644
--- a/src/app/commands/cmd_modify_selection.cpp
+++ b/src/app/commands/cmd_modify_selection.cpp
@@ -45,6 +45,9 @@ protected:
bool onEnabled(Context* context) override;
void onExecute(Context* context) override;
std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return !params.empty();
+ }
private:
std::string getActionName() const;
diff --git a/src/app/commands/cmd_open_browser.cpp b/src/app/commands/cmd_open_browser.cpp
index 106de4d55..5e5bc4d74 100644
--- a/src/app/commands/cmd_open_browser.cpp
+++ b/src/app/commands/cmd_open_browser.cpp
@@ -1,4 +1,5 @@
// Aseprite
+// Copyright (C) 2024 Igara Studio S.A.
// Copyright (C) 2016-2017 David Capello
//
// This program is distributed under the terms of
@@ -23,6 +24,10 @@ public:
protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
+ std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return !params.empty();
+ }
private:
std::string m_filename;
@@ -43,6 +48,11 @@ void OpenBrowserCommand::onExecute(Context* context)
App::instance()->mainWindow()->showBrowser(m_filename);
}
+std::string OpenBrowserCommand::onGetFriendlyName() const
+{
+ return Command::onGetFriendlyName() + ": " + m_filename;
+}
+
Command* CommandFactory::createOpenBrowserCommand()
{
return new OpenBrowserCommand;
diff --git a/src/app/commands/cmd_open_file.cpp b/src/app/commands/cmd_open_file.cpp
index a6b68e73a..139830c0e 100644
--- a/src/app/commands/cmd_open_file.cpp
+++ b/src/app/commands/cmd_open_file.cpp
@@ -269,6 +269,21 @@ void OpenFileCommand::onExecute(Context* context)
}
}
+std::string OpenFileCommand::onGetFriendlyName() const
+{
+ // TO DO: would be better to show the last part of the path
+ // via text size hint instead of a fixed number of chars.
+ auto uiScale = Preferences::instance().general.uiScale();
+ auto scScale = Preferences::instance().general.screenScale();
+ int pos(68.0 / double(uiScale) / double(scScale));
+ return Command::onGetFriendlyName().append(
+ (m_filename.empty() ?
+ "" :
+ (": " + (m_filename.size() >= pos ?
+ m_filename.substr(m_filename.size() - pos, pos) :
+ m_filename))));
+}
+
Command* CommandFactory::createOpenFileCommand()
{
return new OpenFileCommand;
diff --git a/src/app/commands/cmd_open_file.h b/src/app/commands/cmd_open_file.h
index 056c04c09..7994bff40 100644
--- a/src/app/commands/cmd_open_file.h
+++ b/src/app/commands/cmd_open_file.h
@@ -10,6 +10,7 @@
#pragma once
#include "app/commands/command.h"
+#include "app/commands/params.h"
#include "app/pref/preferences.h"
#include "base/paths.h"
@@ -32,6 +33,7 @@ namespace app {
protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
+ std::string onGetFriendlyName() const override;
private:
std::string m_filename;
diff --git a/src/app/commands/cmd_run_script.cpp b/src/app/commands/cmd_run_script.cpp
index c6fadc28e..ce21620f6 100644
--- a/src/app/commands/cmd_run_script.cpp
+++ b/src/app/commands/cmd_run_script.cpp
@@ -39,6 +39,10 @@ protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override
+ {
+ return !params.empty();
+ }
private:
std::string m_filename;
diff --git a/src/app/commands/cmd_save_palette.cpp b/src/app/commands/cmd_save_palette.cpp
index dc8055aef..435f99421 100644
--- a/src/app/commands/cmd_save_palette.cpp
+++ b/src/app/commands/cmd_save_palette.cpp
@@ -34,6 +34,7 @@ public:
protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
+ std::string onGetFriendlyName() const override;
private:
std::string m_preset;
@@ -101,6 +102,15 @@ void SavePaletteCommand::onExecute(Context* ctx)
}
}
+std::string SavePaletteCommand::onGetFriendlyName() const
+{
+ if (m_preset == "default")
+ return Strings::commands_SavePaletteAsDefault();
+ else if (m_saveAsPreset)
+ return Strings::commands_SavePaletteAsPreset();
+ return Command::onGetFriendlyName();
+}
+
Command* CommandFactory::createSavePaletteCommand()
{
return new SavePaletteCommand;
diff --git a/src/app/commands/cmd_select_palette.cpp b/src/app/commands/cmd_select_palette.cpp
index c743c10be..398dc6db4 100644
--- a/src/app/commands/cmd_select_palette.cpp
+++ b/src/app/commands/cmd_select_palette.cpp
@@ -45,6 +45,10 @@ protected:
void onLoadParams(const Params& params) override;
void onExecute(Context* context) override;
std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override
+ {
+ return !params.empty();
+ }
private:
void selectTiles(const Layer* layer,
diff --git a/src/app/commands/cmd_set_loop_section.cpp b/src/app/commands/cmd_set_loop_section.cpp
index cc3dfdd2d..5d84fced7 100644
--- a/src/app/commands/cmd_set_loop_section.cpp
+++ b/src/app/commands/cmd_set_loop_section.cpp
@@ -1,4 +1,5 @@
// Aseprite
+// Copyright (C) 2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@@ -33,6 +34,9 @@ protected:
void onLoadParams(const Params& params) override;
bool onEnabled(Context* context) override;
void onExecute(Context* context) override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return context == KeyContext::FramesSelection;
+ }
Action m_action;
doc::frame_t m_begin, m_end;
diff --git a/src/app/commands/cmd_set_palette_entry_size.cpp b/src/app/commands/cmd_set_palette_entry_size.cpp
index e62b546fd..2d18865f2 100644
--- a/src/app/commands/cmd_set_palette_entry_size.cpp
+++ b/src/app/commands/cmd_set_palette_entry_size.cpp
@@ -1,4 +1,5 @@
// Aseprite
+// Copyright (c) 2024 Igara Studio S.A.
// Copyright (C) 2001-2017 David Capello
//
// This program is distributed under the terms of
@@ -23,6 +24,11 @@ protected:
void onLoadParams(const Params& params) override;
bool onChecked(Context* context) override;
void onExecute(Context* context) override;
+ std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override
+ {
+ return !params.empty();
+ }
private:
int m_size;
@@ -50,6 +56,11 @@ void SetPaletteEntrySizeCommand::onExecute(Context* context)
ColorBar::instance()->getPaletteView()->setBoxSize(m_size);
}
+std::string SetPaletteEntrySizeCommand::onGetFriendlyName() const
+{
+ return Command::onGetFriendlyName() + " " + std::to_string(m_size);
+}
+
Command* CommandFactory::createSetPaletteEntrySizeCommand()
{
return new SetPaletteEntrySizeCommand;
diff --git a/src/app/commands/cmd_tiled_mode.cpp b/src/app/commands/cmd_tiled_mode.cpp
index 8488ce98b..96dd856d0 100644
--- a/src/app/commands/cmd_tiled_mode.cpp
+++ b/src/app/commands/cmd_tiled_mode.cpp
@@ -29,6 +29,10 @@ protected:
bool onChecked(Context* context) override;
void onExecute(Context* context) override;
std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override
+ {
+ return !params.empty();
+ }
filters::TiledMode m_mode;
};
diff --git a/src/app/commands/command.h b/src/app/commands/command.h
index d67e986be..180df6d95 100644
--- a/src/app/commands/command.h
+++ b/src/app/commands/command.h
@@ -11,6 +11,7 @@
#include "app/commands/command_factory.h"
#include "app/commands/command_ids.h"
+#include "app/ui/key_context.h"
#include
@@ -36,6 +37,13 @@ namespace app {
void loadParams(const Params& params);
bool isEnabled(Context* context);
bool isChecked(Context* context);
+ // Not all Commands must be listed on KeyBoard Shortcut list, so
+ // this function returns if a key command should be listed or not.
+ // Used on 'cmd_keyboard_shorcuts.cpp'.
+ virtual bool isListed(const Params& params, const KeyContext& context) const
+ {
+ return true;
+ }
protected:
virtual bool onNeedsParams() const;
diff --git a/src/app/commands/screenshot.cpp b/src/app/commands/screenshot.cpp
index a0df48399..ff143501e 100644
--- a/src/app/commands/screenshot.cpp
+++ b/src/app/commands/screenshot.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2019-2021 Igara Studio S.A.
+// Copyright (C) 2019-2024 Igara Studio S.A.
//
// This program is distributed under the terms of
// the End-User License Agreement for Aseprite.
@@ -54,6 +54,9 @@ public:
protected:
void onExecute(Context* ctx) override;
std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return !params.empty();
+ }
};
ScreenshotCommand::ScreenshotCommand()
diff --git a/src/app/commands/set_playback_speed.cpp b/src/app/commands/set_playback_speed.cpp
index 9e89bb8ce..e112bc1f0 100644
--- a/src/app/commands/set_playback_speed.cpp
+++ b/src/app/commands/set_playback_speed.cpp
@@ -26,6 +26,10 @@ protected:
bool onChecked(Context* ctx) override;
void onExecute(Context* ctx) override;
std::string onGetFriendlyName() const override;
+ bool isListed(const Params& params, const KeyContext& context) const override
+ {
+ return !params.empty();
+ }
};
SetPlaybackSpeedCommand::SetPlaybackSpeedCommand()
diff --git a/src/app/commands/tileset_mode.cpp b/src/app/commands/tileset_mode.cpp
index 309eb3698..1b383ba6f 100644
--- a/src/app/commands/tileset_mode.cpp
+++ b/src/app/commands/tileset_mode.cpp
@@ -54,6 +54,10 @@ protected:
return Strings::commands_TilesetMode(mode);
}
+ bool isListed(const Params& params, const KeyContext& context) const override {
+ return !params.empty();
+ }
+
private:
TilesetMode m_mode;
};
diff --git a/src/app/ui/key.h b/src/app/ui/key.h
index 814aefe60..d168dc436 100644
--- a/src/app/ui/key.h
+++ b/src/app/ui/key.h
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2018-2023 Igara Studio S.A.
+// Copyright (C) 2018-2024 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This program is distributed under the terms of
@@ -138,6 +138,7 @@ namespace app {
const KeyboardShortcuts& globalKeys) const;
bool isPressed() const;
bool isLooselyPressed() const;
+ bool isListed() const;
bool hasAccel(const ui::Accelerator& accel) const;
bool hasUserDefinedAccels() const;
diff --git a/src/app/ui/keyboard_shortcuts.cpp b/src/app/ui/keyboard_shortcuts.cpp
index 2991b983b..f80fa95ef 100644
--- a/src/app/ui/keyboard_shortcuts.cpp
+++ b/src/app/ui/keyboard_shortcuts.cpp
@@ -494,6 +494,11 @@ bool Key::isLooselyPressed() const
return false;
}
+bool Key::isListed() const
+{
+ return type() != KeyType::Command || !command()->isListed(params(), keycontext());
+}
+
bool Key::hasAccel(const ui::Accelerator& accel) const
{
return accels().has(accel);