mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-22 15:39:52 +00:00
Minor change in MaskColor add ConfigSection constant
This commit is contained in:
parent
9609d2c827
commit
78abaf0292
@ -1,5 +1,5 @@
|
|||||||
// Aseprite
|
// Aseprite
|
||||||
// Copyright (C) 2018-2020 Igara Studio S.A.
|
// Copyright (C) 2018-2021 Igara Studio S.A.
|
||||||
// Copyright (C) 2001-2018 David Capello
|
// Copyright (C) 2001-2018 David Capello
|
||||||
//
|
//
|
||||||
// This program is distributed under the terms of
|
// This program is distributed under the terms of
|
||||||
@ -45,6 +45,8 @@ namespace app {
|
|||||||
|
|
||||||
using namespace ui;
|
using namespace ui;
|
||||||
|
|
||||||
|
static const char* ConfigSection = "MaskColor";
|
||||||
|
|
||||||
class MaskByColorCommand : public Command {
|
class MaskByColorCommand : public Command {
|
||||||
public:
|
public:
|
||||||
MaskByColorCommand();
|
MaskByColorCommand();
|
||||||
@ -114,12 +116,12 @@ void MaskByColorCommand::onExecute(Context* context)
|
|||||||
auto box4 = new Box(HORIZONTAL | HOMOGENEOUS);
|
auto box4 = new Box(HORIZONTAL | HOMOGENEOUS);
|
||||||
auto label_color = new Label("Color:");
|
auto label_color = new Label("Color:");
|
||||||
m_buttonColor = new ColorButton
|
m_buttonColor = new ColorButton
|
||||||
(get_config_color("MaskColor", "Color",
|
(get_config_color(ConfigSection, "Color",
|
||||||
ColorBar::instance()->getFgColor()),
|
ColorBar::instance()->getFgColor()),
|
||||||
sprite->pixelFormat(),
|
sprite->pixelFormat(),
|
||||||
ColorButtonOptions());
|
ColorButtonOptions());
|
||||||
auto label_tolerance = new Label("Tolerance:");
|
auto label_tolerance = new Label("Tolerance:");
|
||||||
m_sliderTolerance = new Slider(0, 255, get_config_int("MaskColor", "Tolerance", 0));
|
m_sliderTolerance = new Slider(0, 255, get_config_int(ConfigSection, "Tolerance", 0));
|
||||||
|
|
||||||
m_selMode = new SelModeField;
|
m_selMode = new SelModeField;
|
||||||
m_selMode->setupTooltips(tooltipManager);
|
m_selMode->setupTooltips(tooltipManager);
|
||||||
@ -132,7 +134,7 @@ void MaskByColorCommand::onExecute(Context* context)
|
|||||||
button_ok->processMnemonicFromText();
|
button_ok->processMnemonicFromText();
|
||||||
button_cancel->processMnemonicFromText();
|
button_cancel->processMnemonicFromText();
|
||||||
|
|
||||||
if (get_config_bool("MaskColor", "Preview", true))
|
if (get_config_bool(ConfigSection, "Preview", true))
|
||||||
m_checkPreview->setSelected(true);
|
m_checkPreview->setSelected(true);
|
||||||
|
|
||||||
button_ok->Click.connect([this, button_ok]{ m_window->closeWindow(button_ok); });
|
button_ok->Click.connect([this, button_ok]{ m_window->closeWindow(button_ok); });
|
||||||
@ -169,7 +171,7 @@ void MaskByColorCommand::onExecute(Context* context)
|
|||||||
maskPreview(reader);
|
maskPreview(reader);
|
||||||
|
|
||||||
// Load window configuration
|
// Load window configuration
|
||||||
load_window_pos(m_window, "MaskColor");
|
load_window_pos(m_window, ConfigSection);
|
||||||
|
|
||||||
// Open the window
|
// Open the window
|
||||||
m_window->openWindowInForeground();
|
m_window->openWindowInForeground();
|
||||||
@ -187,9 +189,9 @@ void MaskByColorCommand::onExecute(Context* context)
|
|||||||
tx(new cmd::SetMask(document, mask.get()));
|
tx(new cmd::SetMask(document, mask.get()));
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|
||||||
set_config_color("MaskColor", "Color", m_buttonColor->getColor());
|
set_config_color(ConfigSection, "Color", m_buttonColor->getColor());
|
||||||
set_config_int("MaskColor", "Tolerance", m_sliderTolerance->getValue());
|
set_config_int(ConfigSection, "Tolerance", m_sliderTolerance->getValue());
|
||||||
set_config_bool("MaskColor", "Preview", m_checkPreview->isSelected());
|
set_config_bool(ConfigSection, "Preview", m_checkPreview->isSelected());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
document->generateMaskBoundaries();
|
document->generateMaskBoundaries();
|
||||||
@ -199,7 +201,7 @@ void MaskByColorCommand::onExecute(Context* context)
|
|||||||
update_screen_for_document(document);
|
update_screen_for_document(document);
|
||||||
|
|
||||||
// Save window configuration.
|
// Save window configuration.
|
||||||
save_window_pos(m_window, "MaskColor");
|
save_window_pos(m_window, ConfigSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mask* MaskByColorCommand::generateMask(const Mask& origMask,
|
Mask* MaskByColorCommand::generateMask(const Mask& origMask,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user