Generate the list of command IDs from en.ini file

This commit is contained in:
David Capello 2017-12-01 15:10:21 -03:00
parent ccee49c02b
commit e0a60b6748
150 changed files with 334 additions and 272 deletions

View File

@ -53,7 +53,7 @@ add_custom_command(
DEPENDS gen)
list(APPEND generated_files ${output_fn})
# Generate strings.h from data/strings/en.ini
# Generate strings.ini.h from data/strings/en.ini
set(strings_en_ini ${CMAKE_SOURCE_DIR}/data/strings/en.ini)
set(output_fn ${CMAKE_CURRENT_BINARY_DIR}/strings.ini.h)
add_custom_command(
@ -65,6 +65,17 @@ add_custom_command(
DEPENDS gen)
list(APPEND generated_files ${output_fn})
# Generate command_ids.ini.h from data/strings/en.ini
set(output_fn ${CMAKE_CURRENT_BINARY_DIR}/command_ids.ini.h)
add_custom_command(
OUTPUT ${output_fn}
COMMAND ${CMAKE_BINARY_DIR}/bin/gen --input ${strings_en_ini} --command-ids > ${output_fn}.tmp
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${output_fn}.tmp ${output_fn}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
MAIN_DEPENDENCY ${strings_en_ini}
DEPENDS gen)
list(APPEND generated_files ${output_fn})
# Check translations
file(GLOB string_files ${CMAKE_SOURCE_DIR}/data/strings/*.ini)
set(output_fn ${CMAKE_CURRENT_BINARY_DIR}/check-translations.txt)

View File

@ -382,7 +382,7 @@ bool AppMenus::rebuildRecentList()
return false;
Command* cmd_open_file =
Commands::instance()->byId(CommandId::OpenFile);
Commands::instance()->byId(CommandId::OpenFile());
Menu* submenu = list_menuitem->getSubmenu();
if (submenu) {
@ -627,21 +627,21 @@ void AppMenus::createNativeMenus()
#ifdef __APPLE__ // Create default macOS app menus (App ... Window)
{
she::MenuItemInfo about("About " PACKAGE);
auto native = get_native_shortcut_for_command(CommandId::About);
auto native = get_native_shortcut_for_command(CommandId::About());
about.shortcut = native.shortcut;
about.execute = [native]{
if (can_call_global_shortcut(&native)) {
Command* cmd = Commands::instance()->byId(CommandId::About);
Command* cmd = Commands::instance()->byId(CommandId::About());
UIContext::instance()->executeCommand(cmd);
}
};
she::MenuItemInfo preferences("Preferences...");
native = get_native_shortcut_for_command(CommandId::Options);
native = get_native_shortcut_for_command(CommandId::Options());
preferences.shortcut = native.shortcut;
preferences.execute = [native]{
if (can_call_global_shortcut(&native)) {
Command* cmd = Commands::instance()->byId(CommandId::Options);
Command* cmd = Commands::instance()->byId(CommandId::Options());
UIContext::instance()->executeCommand(cmd);
}
};

View File

@ -335,7 +335,7 @@ void CliProcessor::process()
}
// --scale <factor>
else if (opt == &m_options.scale()) {
Command* command = Commands::instance()->byId(CommandId::SpriteSize);
Command* command = Commands::instance()->byId(CommandId::SpriteSize());
double scale = strtod(value.value().c_str(), NULL);
static_cast<SpriteSizeCommand*>(command)->setScale(scale, scale);
@ -364,7 +364,7 @@ void CliProcessor::process()
}
// --color-mode <mode>
else if (opt == &m_options.colorMode()) {
Command* command = Commands::instance()->byId(CommandId::ChangePixelFormat);
Command* command = Commands::instance()->byId(CommandId::ChangePixelFormat());
Params params;
if (value.value() == "rgb") {
params.set("format", "rgb");
@ -422,7 +422,7 @@ void CliProcessor::process()
scaleHeight = (doc->height() > maxHeight ? maxHeight / doc->height() : 1.0);
if (scaleWidth < 1.0 || scaleHeight < 1.0) {
scale = MIN(scaleWidth, scaleHeight);
Command* command = Commands::instance()->byId(CommandId::SpriteSize);
Command* command = Commands::instance()->byId(CommandId::SpriteSize());
static_cast<SpriteSizeCommand*>(command)->setScale(scale, scale);
ctx->executeCommand(command);
}
@ -494,7 +494,7 @@ bool CliProcessor::openFile(CliOpenFile& cof)
Context* ctx = UIContext::instance();
app::Document* oldDoc = ctx->activeDocument();
Command* openCommand = Commands::instance()->byId(CommandId::OpenFile);
Command* openCommand = Commands::instance()->byId(CommandId::OpenFile());
Params params;
params.set("filename", cof.filename.c_str());
if (cof.oneFrame)
@ -581,8 +581,8 @@ void CliProcessor::saveFile(const CliOpenFile& cof)
UIContext* ctx = UIContext::instance();
ctx->setActiveDocument(cof.document);
Command* trimCommand = Commands::instance()->byId(CommandId::AutocropSprite);
Command* undoCommand = Commands::instance()->byId(CommandId::Undo);
Command* trimCommand = Commands::instance()->byId(CommandId::AutocropSprite());
Command* undoCommand = Commands::instance()->byId(CommandId::Undo());
app::Document* doc = cof.document;
bool clearUndo = false;
@ -593,7 +593,7 @@ void CliProcessor::saveFile(const CliOpenFile& cof)
cropParams.set("width", base::convert_to<std::string>(cof.crop.w).c_str());
cropParams.set("height", base::convert_to<std::string>(cof.crop.h).c_str());
ctx->executeCommand(
Commands::instance()->byId(CommandId::CropSprite),
Commands::instance()->byId(CommandId::CropSprite()),
cropParams);
}

View File

@ -76,7 +76,7 @@ void DefaultCliDelegate::afterOpenFile(const CliOpenFile& cof)
void DefaultCliDelegate::saveFile(const CliOpenFile& cof)
{
Context* ctx = UIContext::instance();
Command* saveAsCommand = Commands::instance()->byId(CommandId::SaveFileCopyAs);
Command* saveAsCommand = Commands::instance()->byId(CommandId::SaveFileCopyAs());
Params params;
params.set("filename", cof.filename.c_str());
params.set("filename-format", cof.filenameFormat.c_str());
@ -101,7 +101,7 @@ void DefaultCliDelegate::loadPalette(const CliOpenFile& cof,
base::UniquePtr<doc::Palette> palette(load_palette(filename.c_str()));
if (palette) {
Context* ctx = UIContext::instance();
Command* loadPalCommand = Commands::instance()->byId(CommandId::LoadPalette);
Command* loadPalCommand = Commands::instance()->byId(CommandId::LoadPalette());
Params params;
params.set("filename", filename.c_str());

View File

@ -29,7 +29,7 @@ protected:
};
AboutCommand::AboutCommand()
: Command("About", CmdUIOnlyFlag)
: Command(CommandId::About(), CmdUIOnlyFlag)
{
}

View File

@ -45,7 +45,7 @@ protected:
};
AddColorCommand::AddColorCommand()
: Command("AddColor", CmdUIOnlyFlag)
: Command(CommandId::AddColor(), CmdUIOnlyFlag)
, m_source(Source::Fg)
{
}

View File

@ -33,7 +33,7 @@ protected:
};
AdvancedModeCommand::AdvancedModeCommand()
: Command("AdvancedMode", CmdUIOnlyFlag)
: Command(CommandId::AdvancedMode(), CmdUIOnlyFlag)
{
}

View File

@ -30,7 +30,7 @@ protected:
};
BackgroundFromLayerCommand::BackgroundFromLayerCommand()
: Command("BackgroundFromLayer", CmdRecordableFlag)
: Command(CommandId::BackgroundFromLayer(), CmdRecordableFlag)
{
}

View File

@ -38,7 +38,7 @@ private:
};
CancelCommand::CancelCommand()
: Command("Cancel", CmdUIOnlyFlag)
: Command(CommandId::Cancel(), CmdUIOnlyFlag)
, m_type(NoOp)
{
}
@ -62,7 +62,8 @@ void CancelCommand::onExecute(Context* context)
// TODO should the ContextBar be a InputChainElement to intercept onCancel()?
// Discard brush
{
Command* discardBrush = Commands::instance()->byId(CommandId::DiscardBrush);
Command* discardBrush = Commands::instance()->byId(
CommandId::DiscardBrush());
context->executeCommand(discardBrush);
}

View File

@ -13,12 +13,12 @@
#include "app/document_api.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/transaction.h"
#include "app/ui/button_set.h"
#include "app/ui/color_bar.h"
#include "app/ui/editor/editor.h"
#include "app/ui/editor/select_box_state.h"
#include "app/ui/skin/skin_theme.h"
#include "app/transaction.h"
#include "base/bind.h"
#include "base/unique_ptr.h"
#include "doc/image.h"
@ -281,7 +281,7 @@ protected:
};
CanvasSizeCommand::CanvasSizeCommand()
: Command("CanvasSize", CmdRecordableFlag)
: Command(CommandId::CanvasSize(), CmdRecordableFlag)
{
m_left = m_right = m_top = m_bottom = 0;
}

View File

@ -282,7 +282,7 @@ protected:
};
CelPropertiesCommand::CelPropertiesCommand()
: Command("CelProperties", CmdUIOnlyFlag)
: Command(CommandId::CelProperties(), CmdUIOnlyFlag)
{
}

View File

@ -50,7 +50,7 @@ private:
};
ChangeBrushCommand::ChangeBrushCommand()
: Command("ChangeBrush", CmdUIOnlyFlag)
: Command(CommandId::ChangeBrush(), CmdUIOnlyFlag)
{
m_change = None;
m_slot = 0;

View File

@ -47,7 +47,7 @@ protected:
};
ChangeColorCommand::ChangeColorCommand()
: Command("ChangeColor", CmdUIOnlyFlag)
: Command(CommandId::ChangeColor(), CmdUIOnlyFlag)
{
m_background = false;
m_change = None;

View File

@ -351,7 +351,7 @@ private:
};
ChangePixelFormatCommand::ChangePixelFormatCommand()
: Command("ChangePixelFormat", CmdUIOnlyFlag)
: Command(CommandId::ChangePixelFormat(), CmdUIOnlyFlag)
{
m_useUI = true;
m_format = IMAGE_RGB;

View File

@ -25,7 +25,7 @@ protected:
};
ClearCommand::ClearCommand()
: Command("Clear", CmdUIOnlyFlag)
: Command(CommandId::Clear(), CmdUIOnlyFlag)
{
}

View File

@ -32,7 +32,7 @@ protected:
};
ClearCelCommand::ClearCelCommand()
: Command("ClearCel", CmdRecordableFlag)
: Command(CommandId::ClearCel(), CmdRecordableFlag)
{
}

View File

@ -30,7 +30,7 @@ using namespace ui;
class CloseFileCommand : public Command {
public:
CloseFileCommand()
: Command("CloseFile", CmdUIOnlyFlag) {
: Command(CommandId::CloseFile(), CmdUIOnlyFlag) {
}
Command* clone() const override { return new CloseFileCommand(*this); }
@ -54,7 +54,7 @@ protected:
class CloseAllFilesCommand : public Command {
public:
CloseAllFilesCommand()
: Command("CloseAllFiles", CmdRecordableFlag) {
: Command(CommandId::CloseAllFiles(), CmdRecordableFlag) {
m_quitting = false;
}

View File

@ -43,7 +43,7 @@ protected:
};
ColorQuantizationCommand::ColorQuantizationCommand()
: Command("ColorQuantization", CmdRecordableFlag)
: Command(CommandId::ColorQuantization(), CmdRecordableFlag)
{
}

View File

@ -26,7 +26,7 @@ protected:
};
ContiguousFillCommand::ContiguousFillCommand()
: Command("ContiguousFill", CmdUIOnlyFlag)
: Command(CommandId::ContiguousFill(), CmdUIOnlyFlag)
{
}

View File

@ -25,7 +25,7 @@ protected:
};
CopyCommand::CopyCommand()
: Command("Copy", CmdUIOnlyFlag)
: Command(CommandId::Copy(), CmdUIOnlyFlag)
{
}

View File

@ -27,7 +27,7 @@ protected:
};
CopyCelCommand::CopyCelCommand()
: Command("CopyCel", CmdUIOnlyFlag)
: Command(CommandId::CopyCel(), CmdUIOnlyFlag)
{
}

View File

@ -25,7 +25,7 @@ protected:
};
CopyMergedCommand::CopyMergedCommand()
: Command("CopyMerged", CmdUIOnlyFlag)
: Command(CommandId::CopyMerged(), CmdUIOnlyFlag)
{
}

View File

@ -12,8 +12,8 @@
#include "app/context_access.h"
#include "app/document_api.h"
#include "app/modules/gui.h"
#include "app/ui/color_bar.h"
#include "app/transaction.h"
#include "app/ui/color_bar.h"
#include "app/util/autocrop.h"
#include "doc/image.h"
#include "doc/layer.h"
@ -37,7 +37,7 @@ private:
};
CropSpriteCommand::CropSpriteCommand()
: Command("CropSprite", CmdRecordableFlag)
: Command(CommandId::CropSprite(), CmdRecordableFlag)
{
}
@ -90,7 +90,7 @@ protected:
};
AutocropSpriteCommand::AutocropSpriteCommand()
: Command("AutocropSprite", CmdRecordableFlag)
: Command(CommandId::AutocropSprite(), CmdRecordableFlag)
{
}

View File

@ -25,7 +25,7 @@ protected:
};
CutCommand::CutCommand()
: Command("Cut", CmdUIOnlyFlag)
: Command(CommandId::Cut(), CmdUIOnlyFlag)
{
}

View File

@ -29,7 +29,7 @@ protected:
};
DeselectMaskCommand::DeselectMaskCommand()
: Command("DeselectMask", CmdRecordableFlag)
: Command(CommandId::DeselectMask(), CmdRecordableFlag)
{
}

View File

@ -30,7 +30,7 @@ protected:
};
DeveloperConsoleCommand::DeveloperConsoleCommand()
: Command("DeveloperConsole", CmdUIOnlyFlag)
: Command(CommandId::DeveloperConsole(), CmdUIOnlyFlag)
{
}

View File

@ -30,7 +30,7 @@ protected:
};
DiscardBrushCommand::DiscardBrushCommand()
: Command("DiscardBrush", CmdUIOnlyFlag)
: Command(CommandId::DiscardBrush(), CmdUIOnlyFlag)
{
}

View File

@ -16,8 +16,8 @@
#include "app/document_undo.h"
#include "app/modules/editors.h"
#include "app/modules/gui.h"
#include "app/ui/editor/editor.h"
#include "app/transaction.h"
#include "app/ui/editor/editor.h"
#include "doc/layer.h"
#include "doc/sprite.h"
#include "ui/ui.h"
@ -35,7 +35,7 @@ protected:
};
DuplicateLayerCommand::DuplicateLayerCommand()
: Command("DuplicateLayer", CmdRecordableFlag)
: Command(CommandId::DuplicateLayer(), CmdRecordableFlag)
{
}

View File

@ -37,7 +37,7 @@ protected:
};
DuplicateSpriteCommand::DuplicateSpriteCommand()
: Command("DuplicateSprite", CmdUIOnlyFlag)
: Command(CommandId::DuplicateSprite(), CmdUIOnlyFlag)
{
}

View File

@ -8,9 +8,8 @@
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/ui/workspace.h"
#include <cstdio>
@ -30,7 +29,7 @@ protected:
};
DuplicateViewCommand::DuplicateViewCommand()
: Command("DuplicateView", CmdUIOnlyFlag)
: Command(CommandId::DuplicateView(), CmdUIOnlyFlag)
{
}

View File

@ -29,7 +29,7 @@ protected:
};
ExitCommand::ExitCommand()
: Command("Exit", CmdUIOnlyFlag)
: Command(CommandId::Exit(), CmdUIOnlyFlag)
{
}
@ -41,7 +41,7 @@ void ExitCommand::onExecute(Context* ctx)
return;
if (ctx->hasModifiedDocuments()) {
Command* closeAll = Commands::instance()->byId(CommandId::CloseAllFiles);
Command* closeAll = Commands::instance()->byId(CommandId::CloseAllFiles());
Params params;
params.set("quitting", "1");
ctx->executeCommand(closeAll, params);

View File

@ -593,7 +593,7 @@ private:
};
ExportSpriteSheetCommand::ExportSpriteSheetCommand()
: Command("ExportSpriteSheet", CmdRecordableFlag)
: Command(CommandId::ExportSpriteSheet(), CmdRecordableFlag)
, m_useUI(true)
, m_askOverwrite(true)
{

View File

@ -32,7 +32,7 @@ namespace app {
using namespace ui;
EyedropperCommand::EyedropperCommand()
: Command("Eyedropper", CmdUIOnlyFlag)
: Command(CommandId::Eyedropper(), CmdUIOnlyFlag)
{
m_background = false;
}
@ -194,7 +194,7 @@ void EyedropperCommand::onExecute(Context* context)
// Discard current image brush
if (Preferences::instance().eyedropper.discardBrush()) {
Command* discardBrush = Commands::instance()->byId(CommandId::DiscardBrush);
Command* discardBrush = Commands::instance()->byId(CommandId::DiscardBrush());
context->executeCommand(discardBrush);
}

View File

@ -27,7 +27,7 @@ protected:
};
FitScreenCommand::FitScreenCommand()
: Command("FitScreen", CmdUIOnlyFlag)
: Command(CommandId::FitScreen(), CmdUIOnlyFlag)
{
}

View File

@ -29,7 +29,7 @@ protected:
};
FlattenLayersCommand::FlattenLayersCommand()
: Command("FlattenLayers", CmdUIOnlyFlag)
: Command(CommandId::FlattenLayers(), CmdUIOnlyFlag)
{
}

View File

@ -39,7 +39,7 @@
namespace app {
FlipCommand::FlipCommand()
: Command("Flip", CmdRecordableFlag)
: Command(CommandId::Flip(), CmdRecordableFlag)
{
m_flipMask = false;
m_flipType = doc::algorithm::FlipHorizontal;

View File

@ -51,7 +51,7 @@ private:
};
FramePropertiesCommand::FramePropertiesCommand()
: Command("FrameProperties", CmdUIOnlyFlag)
: Command(CommandId::FrameProperties(), CmdUIOnlyFlag)
{
}

View File

@ -44,7 +44,7 @@ private:
};
FrameTagPropertiesCommand::FrameTagPropertiesCommand()
: Command("FrameTagProperties", CmdUIOnlyFlag)
: Command(CommandId::FrameTagProperties(), CmdUIOnlyFlag)
, m_tagId(NullId)
{
}

View File

@ -122,10 +122,10 @@ protected:
// Change frame
if (command != NULL &&
(command->id() == CommandId::GotoFirstFrame ||
command->id() == CommandId::GotoPreviousFrame ||
command->id() == CommandId::GotoNextFrame ||
command->id() == CommandId::GotoLastFrame)) {
(command->id() == CommandId::GotoFirstFrame() ||
command->id() == CommandId::GotoPreviousFrame() ||
command->id() == CommandId::GotoNextFrame() ||
command->id() == CommandId::GotoLastFrame())) {
m_context->executeCommand(command, params);
invalidate();
m_render.reset(NULL); // Re-render
@ -133,7 +133,7 @@ protected:
#if 0
// Play the animation
else if (command != NULL &&
std::strcmp(command->short_name(), CommandId::PlayAnimation) == 0) {
std::strcmp(command->short_name(), CommandId::PlayAnimation()) == 0) {
// TODO
}
#endif
@ -264,7 +264,7 @@ protected:
};
FullscreenPreviewCommand::FullscreenPreviewCommand()
: Command("FullscreenPreview", CmdUIOnlyFlag)
: Command(CommandId::FullscreenPreview(), CmdUIOnlyFlag)
{
}

View File

@ -49,7 +49,7 @@ protected:
class GotoFirstFrameCommand : public GotoCommand {
public:
GotoFirstFrameCommand()
: GotoCommand("GotoFirstFrame") { }
: GotoCommand(CommandId::GotoFirstFrame()) { }
Command* clone() const override { return new GotoFirstFrameCommand(*this); }
protected:
@ -61,7 +61,7 @@ protected:
class GotoPreviousFrameCommand : public GotoCommand {
public:
GotoPreviousFrameCommand()
: GotoCommand("GotoPreviousFrame") { }
: GotoCommand(CommandId::GotoPreviousFrame()) { }
Command* clone() const override { return new GotoPreviousFrameCommand(*this); }
protected:
@ -75,7 +75,7 @@ protected:
class GotoNextFrameCommand : public GotoCommand {
public:
GotoNextFrameCommand() : GotoCommand("GotoNextFrame") { }
GotoNextFrameCommand() : GotoCommand(CommandId::GotoNextFrame()) { }
Command* clone() const override { return new GotoNextFrameCommand(*this); }
protected:
@ -89,7 +89,7 @@ protected:
class GotoNextFrameWithSameTagCommand : public GotoCommand {
public:
GotoNextFrameWithSameTagCommand() : GotoCommand("GotoNextFrameWithSameTag") { }
GotoNextFrameWithSameTagCommand() : GotoCommand(CommandId::GotoNextFrameWithSameTag()) { }
Command* clone() const override { return new GotoNextFrameWithSameTagCommand(*this); }
protected:
@ -108,7 +108,7 @@ protected:
class GotoPreviousFrameWithSameTagCommand : public GotoCommand {
public:
GotoPreviousFrameWithSameTagCommand() : GotoCommand("GotoPreviousFrameWithSameTag") { }
GotoPreviousFrameWithSameTagCommand() : GotoCommand(CommandId::GotoPreviousFrameWithSameTag()) { }
Command* clone() const override { return new GotoPreviousFrameWithSameTagCommand(*this); }
protected:
@ -127,7 +127,7 @@ protected:
class GotoLastFrameCommand : public GotoCommand {
public:
GotoLastFrameCommand() : GotoCommand("GotoLastFrame") { }
GotoLastFrameCommand() : GotoCommand(CommandId::GotoLastFrame()) { }
Command* clone() const override { return new GotoLastFrameCommand(*this); }
protected:
@ -138,7 +138,7 @@ protected:
class GotoFrameCommand : public GotoCommand {
public:
GotoFrameCommand() : GotoCommand("GotoFrame")
GotoFrameCommand() : GotoCommand(CommandId::GotoFrame())
, m_showUI(true) { }
Command* clone() const override { return new GotoFrameCommand(*this); }

View File

@ -8,9 +8,8 @@
#include "config.h"
#endif
#include "app/commands/command.h"
#include "app/app.h"
#include "app/commands/command.h"
#include "app/ui/workspace.h"
namespace app {
@ -26,7 +25,7 @@ protected:
};
GotoNextTabCommand::GotoNextTabCommand()
: Command("GotoNextTab", CmdUIOnlyFlag)
: Command(CommandId::GotoNextTab(), CmdUIOnlyFlag)
{
}
@ -51,7 +50,7 @@ protected:
};
GotoPreviousTabCommand::GotoPreviousTabCommand()
: Command("GotoPreviousTab", CmdRecordableFlag)
: Command(CommandId::GotoPreviousTab(), CmdRecordableFlag)
{
}

View File

@ -31,7 +31,7 @@ using namespace gfx;
class SnapToGridCommand : public Command {
public:
SnapToGridCommand()
: Command("SnapToGrid", CmdUIOnlyFlag) {
: Command(CommandId::SnapToGrid(), CmdUIOnlyFlag) {
}
Command* clone() const override { return new SnapToGridCommand(*this); }
@ -54,7 +54,7 @@ protected:
class SelectionAsGridCommand : public Command {
public:
SelectionAsGridCommand()
: Command("SelectionAsGrid", CmdUIOnlyFlag) {
: Command(CommandId::SelectionAsGrid(), CmdUIOnlyFlag) {
}
Command* clone() const override { return new SelectionAsGridCommand(*this); }
@ -91,7 +91,7 @@ protected:
};
GridSettingsCommand::GridSettingsCommand()
: Command("GridSettings", CmdUIOnlyFlag)
: Command(CommandId::GridSettings(), CmdUIOnlyFlag)
{
}

View File

@ -27,7 +27,7 @@ protected:
};
HomeCommand::HomeCommand()
: Command("Home", CmdUIOnlyFlag)
: Command(CommandId::Home(), CmdUIOnlyFlag)
{
}

View File

@ -120,7 +120,7 @@ protected:
void onSelectFile() {
Document* oldActiveDocument = m_context->activeDocument();
Command* openFile = Commands::instance()->byId(CommandId::OpenFile);
Command* openFile = Commands::instance()->byId(CommandId::OpenFile());
Params params;
params.set("filename", "");
openFile->loadParams(params);
@ -297,7 +297,7 @@ protected:
};
ImportSpriteSheetCommand::ImportSpriteSheetCommand()
: Command("ImportSpriteSheet", CmdRecordableFlag)
: Command(CommandId::ImportSpriteSheet(), CmdRecordableFlag)
{
}

View File

@ -33,7 +33,7 @@ protected:
};
InvertMaskCommand::InvertMaskCommand()
: Command("InvertMask", CmdRecordableFlag)
: Command(CommandId::InvertMask(), CmdRecordableFlag)
{
}
@ -56,7 +56,7 @@ void InvertMaskCommand::onExecute(Context* context)
if (!hasMask) {
// so we select all
Command* mask_all_cmd =
Commands::instance()->byId(CommandId::MaskAll);
Commands::instance()->byId(CommandId::MaskAll());
context->executeCommand(mask_all_cmd);
}
// invert the current mask

View File

@ -749,7 +749,7 @@ private:
};
KeyboardShortcutsCommand::KeyboardShortcutsCommand()
: Command("KeyboardShortcuts", CmdUIOnlyFlag)
: Command(CommandId::KeyboardShortcuts(), CmdUIOnlyFlag)
{
}

View File

@ -32,7 +32,7 @@ private:
};
LaunchCommand::LaunchCommand()
: Command("Launch", CmdUIOnlyFlag)
: Command(CommandId::Launch(), CmdUIOnlyFlag)
, m_type(Url)
, m_path("")
{

View File

@ -30,7 +30,7 @@ protected:
};
LayerFromBackgroundCommand::LayerFromBackgroundCommand()
: Command("LayerFromBackground", CmdRecordableFlag)
: Command(CommandId::LayerFromBackground(), CmdRecordableFlag)
{
}

View File

@ -32,7 +32,7 @@ protected:
};
LayerLockCommand::LayerLockCommand()
: Command("LayerLock", CmdRecordableFlag)
: Command(CommandId::LayerLock(), CmdRecordableFlag)
{
}

View File

@ -41,7 +41,7 @@ private:
};
LayerOpacityCommand::LayerOpacityCommand()
: Command("LayerOpacity", CmdUIOnlyFlag)
: Command(CommandId::LayerOpacity(), CmdUIOnlyFlag)
{
m_opacity = 255;
}

View File

@ -353,7 +353,7 @@ private:
};
LayerPropertiesCommand::LayerPropertiesCommand()
: Command("LayerProperties", CmdRecordableFlag)
: Command(CommandId::LayerProperties(), CmdRecordableFlag)
{
}

View File

@ -32,7 +32,7 @@ protected:
};
LayerVisibilityCommand::LayerVisibilityCommand()
: Command("LayerVisibility", CmdRecordableFlag)
: Command(CommandId::LayerVisibility(), CmdRecordableFlag)
{
}

View File

@ -32,7 +32,7 @@ protected:
};
LinkCelsCommand::LinkCelsCommand()
: Command("LinkCels", CmdRecordableFlag)
: Command(CommandId::LinkCels(), CmdRecordableFlag)
{
}

View File

@ -38,7 +38,7 @@ protected:
};
LoadMaskCommand::LoadMaskCommand()
: Command("LoadMask", CmdRecordableFlag)
: Command(CommandId::LoadMask(), CmdRecordableFlag)
{
m_filename = "";
}

View File

@ -41,7 +41,7 @@ private:
};
LoadPaletteCommand::LoadPaletteCommand()
: Command("LoadPalette", CmdRecordableFlag)
: Command(CommandId::LoadPalette(), CmdRecordableFlag)
{
}
@ -85,7 +85,7 @@ void LoadPaletteCommand::onExecute(Context* context)
}
SetPaletteCommand* cmd = static_cast<SetPaletteCommand*>(
Commands::instance()->byId(CommandId::SetPalette));
Commands::instance()->byId(CommandId::SetPalette()));
cmd->setPalette(palette);
context->executeCommand(cmd);
}

View File

@ -29,7 +29,7 @@ protected:
};
MaskAllCommand::MaskAllCommand()
: Command("MaskAll", CmdRecordableFlag)
: Command(CommandId::MaskAll(), CmdRecordableFlag)
{
}

View File

@ -63,7 +63,7 @@ private:
};
MaskByColorCommand::MaskByColorCommand()
: Command("MaskByColor", CmdUIOnlyFlag)
: Command(CommandId::MaskByColor(), CmdUIOnlyFlag)
{
}

View File

@ -40,7 +40,7 @@ protected:
};
MaskContentCommand::MaskContentCommand()
: Command("MaskContent", CmdRecordableFlag)
: Command(CommandId::MaskContent(), CmdRecordableFlag)
{
}

View File

@ -42,7 +42,7 @@ protected:
};
MergeDownLayerCommand::MergeDownLayerCommand()
: Command("MergeDownLayer", CmdRecordableFlag)
: Command(CommandId::MergeDownLayer(), CmdRecordableFlag)
{
}

View File

@ -59,7 +59,7 @@ private:
};
ModifySelectionCommand::ModifySelectionCommand()
: Command("ModifySelection", CmdRecordableFlag)
: Command(CommandId::ModifySelection(), CmdRecordableFlag)
, m_modifier(Expand)
, m_quantity(0)
, m_brushType(doc::kCircleBrushType)

View File

@ -27,7 +27,7 @@ protected:
};
MoveCelCommand::MoveCelCommand()
: Command("MoveCel", CmdUIOnlyFlag)
: Command(CommandId::MoveCel(), CmdUIOnlyFlag)
{
}

View File

@ -32,7 +32,7 @@
namespace app {
MoveMaskCommand::MoveMaskCommand()
: Command("MoveMask", CmdRecordableFlag)
: Command(CommandId::MoveMask(), CmdRecordableFlag)
{
}

View File

@ -55,7 +55,7 @@ private:
};
NewBrushCommand::NewBrushCommand()
: Command("NewBrush", CmdUIOnlyFlag)
: Command(CommandId::NewBrush(), CmdUIOnlyFlag)
{
}
@ -96,7 +96,7 @@ void NewBrushCommand::onExecute(Context* context)
// Deselect mask
Command* cmd =
Commands::instance()->byId(CommandId::DeselectMask);
Commands::instance()->byId(CommandId::DeselectMask());
UIContext::instance()->executeCommand(cmd);
}
}
@ -166,7 +166,7 @@ void NewBrushCommand::createBrush(const Site& site, const Mask* mask)
params.set("change", "custom");
params.set("slot", base::convert_to<std::string>(slot).c_str());
Key* key = KeyboardShortcuts::instance()->command(
CommandId::ChangeBrush, params);
CommandId::ChangeBrush(), params);
if (key && !key->accels().empty()) {
std::string tooltip;
tooltip += "Shortcut: ";

View File

@ -51,7 +51,7 @@ protected:
static int _sprite_counter = 0;
NewFileCommand::NewFileCommand()
: Command("NewFile", CmdRecordableFlag)
: Command(CommandId::NewFile(), CmdRecordableFlag)
{
}

View File

@ -58,7 +58,7 @@ private:
};
NewFrameCommand::NewFrameCommand()
: Command("NewFrame", CmdRecordableFlag)
: Command(CommandId::NewFrame(), CmdRecordableFlag)
{
}

View File

@ -35,7 +35,7 @@ protected:
};
NewFrameTagCommand::NewFrameTagCommand()
: Command("NewFrameTag", CmdRecordableFlag)
: Command(CommandId::NewFrameTag(), CmdRecordableFlag)
{
}

View File

@ -65,7 +65,7 @@ private:
};
NewLayerCommand::NewLayerCommand()
: Command("NewLayer", CmdRecordableFlag)
: Command(CommandId::NewLayer(), CmdRecordableFlag)
{
m_name = "";
m_type = Type::Layer;
@ -130,7 +130,7 @@ void NewLayerCommand::onExecute(Context* context)
// Select a file to copy its content
if (m_fromFile) {
Document* oldActiveDocument = context->activeDocument();
Command* openFile = Commands::instance()->byId(CommandId::OpenFile);
Command* openFile = Commands::instance()->byId(CommandId::OpenFile());
Params params;
params.set("filename", "");
context->executeCommand(openFile, params);

View File

@ -14,12 +14,12 @@
#include "app/util/new_image_from_mask.h"
#include "base/fs.h"
#include "doc/cel.h"
#include "doc/document.h"
#include "doc/layer.h"
#include "doc/mask.h"
#include "doc/palette.h"
#include "doc/layer.h"
#include "doc/site.h"
#include "doc/sprite.h"
#include "doc/document.h"
#include <cstdio>
@ -38,7 +38,7 @@ protected:
};
NewSpriteFromSelectionCommand::NewSpriteFromSelectionCommand()
: Command("NewSpriteFromSelection", CmdUIOnlyFlag)
: Command(CommandId::NewSpriteFromSelection(), CmdUIOnlyFlag)
{
}

View File

@ -21,7 +21,7 @@ using namespace gfx;
class ShowOnionSkinCommand : public Command {
public:
ShowOnionSkinCommand()
: Command("ShowOnionSkin", CmdUIOnlyFlag)
: Command(CommandId::ShowOnionSkin(), CmdUIOnlyFlag)
{
}

View File

@ -30,7 +30,7 @@ private:
};
OpenBrowserCommand::OpenBrowserCommand()
: Command("OpenBrowser", CmdUIOnlyFlag)
: Command(CommandId::OpenBrowser(), CmdUIOnlyFlag)
{
}

View File

@ -75,7 +75,7 @@ private:
};
OpenFileCommand::OpenFileCommand()
: Command("OpenFile", CmdRecordableFlag)
: Command(CommandId::OpenFile(), CmdRecordableFlag)
, m_repeatCheckbox(false)
, m_oneFrame(false)
, m_seqDecision(SequenceDecision::Ask)

View File

@ -33,7 +33,7 @@ protected:
};
OpenGroupCommand::OpenGroupCommand()
: Command("OpenGroup", CmdRecordableFlag)
: Command(CommandId::OpenGroup(), CmdRecordableFlag)
{
}

View File

@ -27,7 +27,7 @@ protected:
};
OpenInFolderCommand::OpenInFolderCommand()
: Command("OpenInFolder", CmdUIOnlyFlag)
: Command(CommandId::OpenInFolder(), CmdUIOnlyFlag)
{
}

View File

@ -27,7 +27,7 @@ protected:
};
OpenWithAppCommand::OpenWithAppCommand()
: Command("OpenWithApp", CmdUIOnlyFlag)
: Command(CommandId::OpenWithApp(), CmdUIOnlyFlag)
{
}

View File

@ -1037,7 +1037,7 @@ protected:
};
OptionsCommand::OptionsCommand()
: Command("Options", CmdUIOnlyFlag)
: Command(CommandId::Options(), CmdUIOnlyFlag)
{
Preferences& preferences = Preferences::instance();

View File

@ -34,7 +34,7 @@ private:
};
PaletteEditorCommand::PaletteEditorCommand()
: Command("PaletteEditor", CmdRecordableFlag)
: Command(CommandId::PaletteEditor(), CmdRecordableFlag)
{
m_edit = true;
m_popup = false;

View File

@ -37,7 +37,7 @@ private:
};
PaletteSizeCommand::PaletteSizeCommand()
: Command("PaletteSize", CmdRecordableFlag)
: Command(CommandId::PaletteSize(), CmdRecordableFlag)
{
m_size = 0;
}

View File

@ -25,7 +25,7 @@ protected:
};
PasteCommand::PasteCommand()
: Command("Paste", CmdUIOnlyFlag)
: Command(CommandId::Paste(), CmdUIOnlyFlag)
{
}

View File

@ -45,7 +45,7 @@ protected:
};
PasteTextCommand::PasteTextCommand()
: Command("PasteText", CmdUIOnlyFlag)
: Command(CommandId::PasteText(), CmdUIOnlyFlag)
{
}

View File

@ -30,7 +30,7 @@ protected:
};
PixelPerfectModeCommand::PixelPerfectModeCommand()
: Command("PixelPerfectMode", CmdUIOnlyFlag)
: Command(CommandId::PixelPerfectMode(), CmdUIOnlyFlag)
{
}

View File

@ -30,7 +30,7 @@ protected:
};
PlayAnimationCommand::PlayAnimationCommand()
: Command("PlayAnimation", CmdUIOnlyFlag)
: Command(CommandId::PlayAnimation(), CmdUIOnlyFlag)
{
}

View File

@ -33,7 +33,7 @@ protected:
};
RefreshCommand::RefreshCommand()
: Command("Refresh", CmdUIOnlyFlag)
: Command(CommandId::Refresh(), CmdUIOnlyFlag)
{
}

View File

@ -30,7 +30,7 @@ protected:
};
RemoveFrameCommand::RemoveFrameCommand()
: Command("RemoveFrame", CmdRecordableFlag)
: Command(CommandId::RemoveFrame(), CmdRecordableFlag)
{
}

View File

@ -38,7 +38,7 @@ private:
};
RemoveFrameTagCommand::RemoveFrameTagCommand()
: Command("RemoveFrameTag", CmdRecordableFlag)
: Command(CommandId::RemoveFrameTag(), CmdRecordableFlag)
, m_tagId(NullId)
{
}

View File

@ -34,7 +34,7 @@ protected:
};
RemoveLayerCommand::RemoveLayerCommand()
: Command("RemoveLayer", CmdRecordableFlag)
: Command(CommandId::RemoveLayer(), CmdRecordableFlag)
{
}

View File

@ -41,7 +41,7 @@ private:
};
RemoveSliceCommand::RemoveSliceCommand()
: Command("RemoveSlice", CmdRecordableFlag)
: Command(CommandId::RemoveSlice(), CmdRecordableFlag)
{
}

View File

@ -29,7 +29,7 @@ protected:
};
RepeatLastExportCommand::RepeatLastExportCommand()
: Command("RepeatLastExport", CmdRecordableFlag)
: Command(CommandId::RepeatLastExport(), CmdRecordableFlag)
{
}
@ -40,7 +40,7 @@ bool RepeatLastExportCommand::onEnabled(Context* context)
void RepeatLastExportCommand::onExecute(Context* context)
{
Command* cmd = Commands::instance()->byId(CommandId::ExportSpriteSheet);
Command* cmd = Commands::instance()->byId(CommandId::ExportSpriteSheet());
Params params;
{

View File

@ -29,7 +29,7 @@ protected:
};
ReselectMaskCommand::ReselectMaskCommand()
: Command("ReselectMask", CmdRecordableFlag)
: Command(CommandId::ReselectMask(), CmdRecordableFlag)
{
}

View File

@ -28,7 +28,7 @@ protected:
};
ReverseFramesCommand::ReverseFramesCommand()
: Command("ReverseFrames", CmdUIOnlyFlag)
: Command(CommandId::ReverseFrames(), CmdUIOnlyFlag)
{
}

View File

@ -167,7 +167,7 @@ protected:
};
RotateCommand::RotateCommand()
: Command("Rotate", CmdRecordableFlag)
: Command(CommandId::Rotate(), CmdRecordableFlag)
{
m_flipMask = false;
m_angle = 0;

View File

@ -49,7 +49,7 @@ private:
};
RunScriptCommand::RunScriptCommand()
: Command("RunScript", CmdRecordableFlag)
: Command(CommandId::RunScript(), CmdRecordableFlag)
{
}

View File

@ -240,7 +240,7 @@ bool SaveFileBaseCommand::saveAsDialog(
// Apply scale
bool undoResize = false;
if (xscale != 1.0 || yscale != 1.0) {
Command* resizeCmd = Commands::instance()->byId(CommandId::SpriteSize);
Command* resizeCmd = Commands::instance()->byId(CommandId::SpriteSize());
ASSERT(resizeCmd);
if (resizeCmd) {
int width = document->sprite()->width();
@ -287,7 +287,7 @@ bool SaveFileBaseCommand::saveAsDialog(
// Undo resize
if (undoResize) {
Command* undoCmd = Commands::instance()->byId(CommandId::Undo);
Command* undoCmd = Commands::instance()->byId(CommandId::Undo());
if (undoCmd)
context->executeCommand(undoCmd);
}
@ -357,7 +357,7 @@ protected:
};
SaveFileCommand::SaveFileCommand()
: SaveFileBaseCommand("SaveFile", CmdRecordableFlag)
: SaveFileBaseCommand(CommandId::SaveFile(), CmdRecordableFlag)
{
}
@ -393,7 +393,7 @@ protected:
};
SaveFileAsCommand::SaveFileAsCommand()
: SaveFileBaseCommand("SaveFileAs", CmdRecordableFlag)
: SaveFileBaseCommand(CommandId::SaveFileAs(), CmdRecordableFlag)
{
}
@ -412,7 +412,7 @@ protected:
};
SaveFileCopyAsCommand::SaveFileCopyAsCommand()
: SaveFileBaseCommand("SaveFileCopyAs", CmdRecordableFlag)
: SaveFileBaseCommand(CommandId::SaveFileCopyAs(), CmdRecordableFlag)
{
}

View File

@ -32,7 +32,7 @@ protected:
};
SaveMaskCommand::SaveMaskCommand()
: Command("SaveMask", CmdUIOnlyFlag)
: Command(CommandId::SaveMask(), CmdUIOnlyFlag)
{
}

View File

@ -39,7 +39,7 @@ private:
};
SavePaletteCommand::SavePaletteCommand()
: Command("SavePalette", CmdRecordableFlag)
: Command(CommandId::SavePalette(), CmdRecordableFlag)
{
}

View File

@ -39,7 +39,7 @@ private:
};
ScrollCommand::ScrollCommand()
: Command("Scroll", CmdUIOnlyFlag)
: Command(CommandId::Scroll(), CmdUIOnlyFlag)
{
}

View File

@ -27,7 +27,7 @@ protected:
};
ScrollCenterCommand::ScrollCenterCommand()
: Command("ScrollCenter", CmdUIOnlyFlag)
: Command(CommandId::ScrollCenter(), CmdUIOnlyFlag)
{
}

View File

@ -43,7 +43,7 @@ private:
};
SelectTileCommand::SelectTileCommand()
: Command("SelectTile", CmdRecordableFlag)
: Command(CommandId::SelectTile(), CmdRecordableFlag)
, m_mode(gen::SelectionMode::DEFAULT)
{
}

View File

@ -34,7 +34,7 @@ private:
};
SetColorSelectorCommand::SetColorSelectorCommand()
: Command("SetColorSelector", CmdUIOnlyFlag)
: Command(CommandId::SetColorSelector(), CmdUIOnlyFlag)
, m_type(ColorBar::ColorSelector::SPECTRUM)
{
}

View File

@ -36,7 +36,7 @@ private:
};
SetInkTypeCommand::SetInkTypeCommand()
: Command("SetInkType", CmdUIOnlyFlag)
: Command(CommandId::SetInkType(), CmdUIOnlyFlag)
, m_type(tools::InkType::DEFAULT)
{
}

View File

@ -40,7 +40,7 @@ protected:
};
SetLoopSectionCommand::SetLoopSectionCommand()
: Command("SetLoopSection", CmdRecordableFlag)
: Command(CommandId::SetLoopSection(), CmdRecordableFlag)
, m_action(Action::Auto)
, m_begin(0)
, m_end(0)
@ -120,7 +120,7 @@ void SetLoopSectionCommand::onExecute(Context* ctx)
transaction.commit();
}
else {
Command* cmd = Commands::instance()->byId(CommandId::FrameTagProperties);
Command* cmd = Commands::instance()->byId(CommandId::FrameTagProperties());
ctx->executeCommand(cmd);
}
}

Some files were not shown because too many files have changed in this diff Show More