mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-01 18:00:26 +00:00
Add SwitchNonactiveLayersOpacity command (fix #1515)
This is a temporal solution but it's good enough for an experimental feature.
This commit is contained in:
parent
b0b3818267
commit
7dcc0072f1
@ -370,6 +370,7 @@ SnapToGrid = Snap to Grid
|
||||
SpriteProperties = Sprite Properties
|
||||
SpriteSize = Sprite Size
|
||||
SwitchColors = Switch Colors
|
||||
SwitchNonactiveLayersOpacity = Switch Nonactive Layers Opacity
|
||||
SymmetryMode = Symmetry Mode
|
||||
TiledMode = Tiled Mode
|
||||
Timeline = Switch Timeline
|
||||
|
@ -16,7 +16,9 @@
|
||||
#include "app/color_utils.h"
|
||||
#include "app/commands/commands.h"
|
||||
#include "app/commands/params.h"
|
||||
#include "app/commands/quick_command.h"
|
||||
#include "app/console.h"
|
||||
#include "app/i18n/strings.h"
|
||||
#include "app/ini_file.h"
|
||||
#include "app/modules/editors.h"
|
||||
#include "app/modules/gfx.h"
|
||||
@ -2485,4 +2487,30 @@ void Editor::updateAutoCelGuides(ui::Message* msg)
|
||||
invalidate();
|
||||
}
|
||||
|
||||
// static
|
||||
void Editor::registerCommands()
|
||||
{
|
||||
Commands::instance()
|
||||
->add(
|
||||
new QuickCommand(
|
||||
CommandId::SwitchNonactiveLayersOpacity(),
|
||||
[]{
|
||||
static int oldValue = -1;
|
||||
auto& option = Preferences::instance().experimental.nonactiveLayersOpacity;
|
||||
if (oldValue == -1) {
|
||||
oldValue = option();
|
||||
if (option() == 255)
|
||||
option(128);
|
||||
else
|
||||
option(255);
|
||||
}
|
||||
else {
|
||||
const int newValue = oldValue;
|
||||
oldValue = option();
|
||||
option(newValue);
|
||||
}
|
||||
app_refresh_screen();
|
||||
}));
|
||||
}
|
||||
|
||||
} // namespace app
|
||||
|
@ -269,6 +269,8 @@ namespace app {
|
||||
// freehand tool is pressed.
|
||||
bool startStraightLineWithFreehandTool(const ui::MouseMessage* msg);
|
||||
|
||||
static void registerCommands();
|
||||
|
||||
protected:
|
||||
bool onProcessMessage(ui::Message* msg) override;
|
||||
void onSizeHint(ui::SizeHintEvent& ev) override;
|
||||
|
@ -101,6 +101,8 @@ MainWindow::MainWindow()
|
||||
m_previewEditor = new PreviewEditorWindow();
|
||||
m_timeline = new Timeline();
|
||||
|
||||
Editor::registerCommands();
|
||||
|
||||
m_workspace->setTabsBar(m_tabsBar);
|
||||
m_workspace->ActiveViewChanged.connect(&MainWindow::onActiveViewChange, this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user