Fix duplicate "Tiled Mode" items in the keyboard shortcuts list (#4387)

This commit is contained in:
Gaspar Capello 2024-05-22 12:30:48 -03:00 committed by David Capello
parent 12e253d1ef
commit aca9bf6bb7
2 changed files with 20 additions and 1 deletions

View File

@ -458,7 +458,11 @@ SwitchColors = Switch Colors
SwapCheckerboardColors = Swap Checkerboard Background Colors
SwitchNonactiveLayersOpacity = Switch Nonactive Layers Opacity
SymmetryMode = Symmetry Mode
TiledMode = Tiled Mode
TiledMode = Tiled Mode: {}
TiledMode_None = None
TiledMode_Both = Both Axes
TiledMode_X = X Axis
TiledMode_Y = Y Axis
Timeline = Switch Timeline
ToggleOtherLayersOpacity = Toggle Other Layers Opacity
ToggleOtherLayersOpacity_PreviewEditor = Toggle Other Layers Opacity in Preview

View File

@ -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
@ -12,6 +13,7 @@
#include "app/commands/command.h"
#include "app/commands/params.h"
#include "app/context.h"
#include "app/i18n/strings.h"
#include "app/pref/preferences.h"
#include "filters/tiled_mode.h"
@ -26,6 +28,7 @@ protected:
bool onEnabled(Context* context) override;
bool onChecked(Context* context) override;
void onExecute(Context* context) override;
std::string onGetFriendlyName() const override;
filters::TiledMode m_mode;
};
@ -64,6 +67,18 @@ void TiledModeCommand::onExecute(Context* ctx)
Preferences::instance().document(doc).tiled.mode(m_mode);
}
std::string TiledModeCommand::onGetFriendlyName() const
{
std::string mode;
switch (m_mode) {
case filters::TiledMode::NONE: mode = Strings::commands_TiledMode_None(); break;
case filters::TiledMode::BOTH: mode = Strings::commands_TiledMode_Both(); break;
case filters::TiledMode::X_AXIS: mode = Strings::commands_TiledMode_X(); break;
case filters::TiledMode::Y_AXIS: mode = Strings::commands_TiledMode_Y(); break;
}
return Strings::commands_TiledMode(mode);
}
Command* CommandFactory::createTiledModeCommand()
{
return new TiledModeCommand;