mirror of
https://github.com/aseprite/aseprite.git
synced 2024-10-06 06:50:07 +00:00
Fix duplicate shortcut key configuration items in Keyboard shortcuts Window (fix #4387)
Introduced Key::isSkipListing() and Command::isSkipListing() to skip keyItem creation on Keyboard shortcut List Box. Removed commands: 'Launch' 'OpenBrowser' And removed unnecessary commands: 'Change Color Mode: Indexed' 'Contract Selection' 'Export Sprite Sheet' 'Flip Canvas Horizontally' 'Frame Properties' 'Load Palette' 'Open Sprite' 'Playback Speed 1x' 'Run Script' 'Save Palette' 'Select Used Colors' 'Set Palette Entry Size' 'Tileset Mode: Auto'
This commit is contained in:
parent
064ddef190
commit
84fc105510
@ -482,6 +482,9 @@ protected:
|
||||
bool onChecked(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
std::string onGetFriendlyName() const override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return m_format == IMAGE_INDEXED && params.size() > 1;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_showDlg;
|
||||
|
@ -64,6 +64,9 @@ public:
|
||||
protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return !params.empty();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -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;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return !params.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_flipMask;
|
||||
|
@ -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,10 @@ protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return !params.empty() &&
|
||||
strcmp(params.begin()->second.c_str(), "all") == 0;
|
||||
}
|
||||
|
||||
private:
|
||||
enum Target {
|
||||
|
@ -100,6 +100,10 @@ protected:
|
||||
|
||||
return (frame < last ? frame+1: 0);
|
||||
}
|
||||
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return params.empty();
|
||||
}
|
||||
};
|
||||
|
||||
class GotoNextFrameWithSameTagCommand : public GotoCommand {
|
||||
|
@ -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->isSkipListing()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
@ -20,6 +20,7 @@ namespace app {
|
||||
class LaunchCommand : public Command {
|
||||
public:
|
||||
LaunchCommand();
|
||||
const bool isSkipListing(const Params& params) const override { return true; }
|
||||
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
|
@ -32,6 +32,9 @@ public:
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return !params.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_preset;
|
||||
|
@ -45,6 +45,9 @@ protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
std::string onGetFriendlyName() const override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return m_modifier == doc::algorithm::SelectionModifier::Contract;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string getActionName() const;
|
||||
|
@ -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,7 @@ public:
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override { return true; }
|
||||
|
||||
private:
|
||||
std::string m_filename;
|
||||
|
@ -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,9 @@ namespace app {
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return !params.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
std::string m_filename;
|
||||
|
@ -39,6 +39,7 @@ protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
std::string onGetFriendlyName() const override;
|
||||
const bool isSkipListing(const Params& params) const override { return params.empty(); }
|
||||
|
||||
private:
|
||||
std::string m_filename;
|
||||
|
@ -34,6 +34,7 @@ public:
|
||||
protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override { return !params.empty(); }
|
||||
|
||||
private:
|
||||
std::string m_preset;
|
||||
|
@ -45,6 +45,9 @@ protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
void onExecute(Context* context) override;
|
||||
std::string onGetFriendlyName() const override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return params.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
void selectTiles(const Layer* layer,
|
||||
|
@ -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,9 @@ protected:
|
||||
void onLoadParams(const Params& params) override;
|
||||
bool onChecked(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return !params.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
int m_size;
|
||||
|
@ -26,6 +26,9 @@ protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
bool onChecked(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return params.empty();
|
||||
}
|
||||
|
||||
filters::TiledMode m_mode;
|
||||
};
|
||||
|
@ -37,6 +37,13 @@ namespace app {
|
||||
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 const bool isSkipListing(const Params& params) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual bool onNeedsParams() const;
|
||||
virtual void onLoadParams(const Params& params);
|
||||
|
@ -26,6 +26,9 @@ protected:
|
||||
bool onChecked(Context* ctx) override;
|
||||
void onExecute(Context* ctx) override;
|
||||
std::string onGetFriendlyName() const override;
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return params.empty();
|
||||
}
|
||||
};
|
||||
|
||||
SetPlaybackSpeedCommand::SetPlaybackSpeedCommand()
|
||||
|
@ -54,6 +54,10 @@ protected:
|
||||
return Strings::commands_TilesetMode(mode);
|
||||
}
|
||||
|
||||
const bool isSkipListing(const Params& params) const override {
|
||||
return params.empty();
|
||||
}
|
||||
|
||||
private:
|
||||
TilesetMode m_mode;
|
||||
};
|
||||
|
@ -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 isSkipListing() const;
|
||||
|
||||
bool hasAccel(const ui::Accelerator& accel) const;
|
||||
bool hasUserDefinedAccels() const;
|
||||
|
@ -494,6 +494,11 @@ bool Key::isLooselyPressed() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Key::isSkipListing() const
|
||||
{
|
||||
return type() == KeyType::Command && command()->isSkipListing(params());
|
||||
}
|
||||
|
||||
bool Key::hasAccel(const ui::Accelerator& accel) const
|
||||
{
|
||||
return accels().has(accel);
|
||||
|
Loading…
Reference in New Issue
Block a user