mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-16 05:42:32 +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
|
SpriteProperties = Sprite Properties
|
||||||
SpriteSize = Sprite Size
|
SpriteSize = Sprite Size
|
||||||
SwitchColors = Switch Colors
|
SwitchColors = Switch Colors
|
||||||
|
SwitchNonactiveLayersOpacity = Switch Nonactive Layers Opacity
|
||||||
SymmetryMode = Symmetry Mode
|
SymmetryMode = Symmetry Mode
|
||||||
TiledMode = Tiled Mode
|
TiledMode = Tiled Mode
|
||||||
Timeline = Switch Timeline
|
Timeline = Switch Timeline
|
||||||
|
@ -16,7 +16,9 @@
|
|||||||
#include "app/color_utils.h"
|
#include "app/color_utils.h"
|
||||||
#include "app/commands/commands.h"
|
#include "app/commands/commands.h"
|
||||||
#include "app/commands/params.h"
|
#include "app/commands/params.h"
|
||||||
|
#include "app/commands/quick_command.h"
|
||||||
#include "app/console.h"
|
#include "app/console.h"
|
||||||
|
#include "app/i18n/strings.h"
|
||||||
#include "app/ini_file.h"
|
#include "app/ini_file.h"
|
||||||
#include "app/modules/editors.h"
|
#include "app/modules/editors.h"
|
||||||
#include "app/modules/gfx.h"
|
#include "app/modules/gfx.h"
|
||||||
@ -2485,4 +2487,30 @@ void Editor::updateAutoCelGuides(ui::Message* msg)
|
|||||||
invalidate();
|
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
|
} // namespace app
|
||||||
|
@ -269,6 +269,8 @@ namespace app {
|
|||||||
// freehand tool is pressed.
|
// freehand tool is pressed.
|
||||||
bool startStraightLineWithFreehandTool(const ui::MouseMessage* msg);
|
bool startStraightLineWithFreehandTool(const ui::MouseMessage* msg);
|
||||||
|
|
||||||
|
static void registerCommands();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool onProcessMessage(ui::Message* msg) override;
|
bool onProcessMessage(ui::Message* msg) override;
|
||||||
void onSizeHint(ui::SizeHintEvent& ev) override;
|
void onSizeHint(ui::SizeHintEvent& ev) override;
|
||||||
|
@ -101,6 +101,8 @@ MainWindow::MainWindow()
|
|||||||
m_previewEditor = new PreviewEditorWindow();
|
m_previewEditor = new PreviewEditorWindow();
|
||||||
m_timeline = new Timeline();
|
m_timeline = new Timeline();
|
||||||
|
|
||||||
|
Editor::registerCommands();
|
||||||
|
|
||||||
m_workspace->setTabsBar(m_tabsBar);
|
m_workspace->setTabsBar(m_tabsBar);
|
||||||
m_workspace->ActiveViewChanged.connect(&MainWindow::onActiveViewChange, this);
|
m_workspace->ActiveViewChanged.connect(&MainWindow::onActiveViewChange, this);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user