mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-16 04:13:50 +00:00
Merge branch 'swap-bg-colors' (fix #1812)
This commit is contained in:
commit
e4b224a0bd
@ -439,6 +439,7 @@ SpriteProperties = Sprite Properties
|
||||
SpriteSize = Sprite Size
|
||||
Stroke = Stroke Selection Borders with Foreground Color
|
||||
SwitchColors = Switch Colors
|
||||
SwapCheckerboardColors = Swap Checkerboard Background Colors
|
||||
SwitchNonactiveLayersOpacity = Switch Nonactive Layers Opacity
|
||||
SymmetryMode = Symmetry Mode
|
||||
TiledMode = Tiled Mode
|
||||
|
@ -283,6 +283,7 @@ if(ENABLE_UI)
|
||||
commands/cmd_show.cpp
|
||||
commands/cmd_slice_properties.cpp
|
||||
commands/cmd_sprite_properties.cpp
|
||||
commands/cmd_swap_checkerboard_colors.cpp
|
||||
commands/cmd_switch_colors.cpp
|
||||
commands/cmd_symmetry_mode.cpp
|
||||
commands/cmd_tiled_mode.cpp
|
||||
|
53
src/app/commands/cmd_swap_checkerboard_colors.cpp
Normal file
53
src/app/commands/cmd_swap_checkerboard_colors.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/commands/command.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/ui/editor/editor.h"
|
||||
#include "ui/base.h"
|
||||
#include "app/context.h"
|
||||
|
||||
namespace app {
|
||||
|
||||
class SwapCheckerboardColorsCommand : public Command {
|
||||
public:
|
||||
SwapCheckerboardColorsCommand();
|
||||
|
||||
protected:
|
||||
bool onEnabled(Context* context) override;
|
||||
void onExecute(Context* context) override;
|
||||
};
|
||||
|
||||
SwapCheckerboardColorsCommand::SwapCheckerboardColorsCommand()
|
||||
: Command(CommandId::SwapCheckerboardColors(), CmdUIOnlyFlag)
|
||||
{
|
||||
}
|
||||
|
||||
bool SwapCheckerboardColorsCommand::onEnabled(Context* context)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void SwapCheckerboardColorsCommand::onExecute(Context* context)
|
||||
{
|
||||
DocumentPreferences& docPref = Preferences::instance().document(context->activeDocument());
|
||||
app::Color c1 = docPref.bg.color1();
|
||||
app::Color c2 = docPref.bg.color2();
|
||||
|
||||
docPref.bg.color1(c2);
|
||||
docPref.bg.color2(c1);
|
||||
}
|
||||
Command* CommandFactory::createSwapCheckerboardColorsCommand()
|
||||
{
|
||||
return new SwapCheckerboardColorsCommand;
|
||||
}
|
||||
|
||||
} // namespace app
|
@ -151,6 +151,7 @@ FOR_EACH_COMMAND(SliceProperties)
|
||||
FOR_EACH_COMMAND(SnapToGrid)
|
||||
FOR_EACH_COMMAND(SpriteProperties)
|
||||
FOR_EACH_COMMAND(Stroke)
|
||||
FOR_EACH_COMMAND(SwapCheckerboardColors)
|
||||
FOR_EACH_COMMAND(SwitchColors)
|
||||
FOR_EACH_COMMAND(SymmetryMode)
|
||||
FOR_EACH_COMMAND(TiledMode)
|
||||
|
Loading…
Reference in New Issue
Block a user