mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-16 22:18:30 +00:00
Set appropriate default parameters values
Take the default values for the command parameters from the UI when the UI is available and ui=false
This commit is contained in:
parent
8d7e6e3f5b
commit
ad0d30b2df
@ -65,15 +65,6 @@ public:
|
|||||||
// ADD/SUBTRACT/INTERSECT Selection Mode
|
// ADD/SUBTRACT/INTERSECT Selection Mode
|
||||||
, m_isOrigMaskVisible(reader.document()->isMaskVisible()) {
|
, m_isOrigMaskVisible(reader.document()->isMaskVisible()) {
|
||||||
|
|
||||||
if (!params.color.isSet())
|
|
||||||
params.color(ColorBar::instance()->getFgColor());
|
|
||||||
|
|
||||||
if (!params.tolerance.isSet())
|
|
||||||
params.tolerance(get_config_int(ConfigSection, "Tolerance", 0));
|
|
||||||
|
|
||||||
if (!params.mode.isSet())
|
|
||||||
params.mode(Preferences::instance().selection.mode());
|
|
||||||
|
|
||||||
TooltipManager* tooltipManager = new TooltipManager();
|
TooltipManager* tooltipManager = new TooltipManager();
|
||||||
addChild(tooltipManager);
|
addChild(tooltipManager);
|
||||||
auto box1 = new Box(VERTICAL);
|
auto box1 = new Box(VERTICAL);
|
||||||
@ -237,7 +228,7 @@ void MaskByColorCommand::onExecute(Context* context)
|
|||||||
const ContextReader reader(context);
|
const ContextReader reader(context);
|
||||||
const Sprite* sprite = reader.sprite();
|
const Sprite* sprite = reader.sprite();
|
||||||
|
|
||||||
if (!App::instance()->isGui() || !sprite)
|
if (!sprite)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
@ -251,6 +242,19 @@ void MaskByColorCommand::onExecute(Context* context)
|
|||||||
|
|
||||||
bool apply = true;
|
bool apply = true;
|
||||||
auto& params = this->params();
|
auto& params = this->params();
|
||||||
|
|
||||||
|
// If UI is available, set parameters default values from the UI/configuration
|
||||||
|
if (context->isUIAvailable()) {
|
||||||
|
if (!params.color.isSet())
|
||||||
|
params.color(ColorBar::instance()->getFgColor());
|
||||||
|
|
||||||
|
if (!params.tolerance.isSet())
|
||||||
|
params.tolerance(get_config_int(ConfigSection, "Tolerance", 0));
|
||||||
|
|
||||||
|
if (!params.mode.isSet())
|
||||||
|
params.mode(Preferences::instance().selection.mode());
|
||||||
|
}
|
||||||
|
|
||||||
if (ui) {
|
if (ui) {
|
||||||
MaskByColorWindow window(params, reader);
|
MaskByColorWindow window(params, reader);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user