Add keyboard shortcuts to change the color selector type (spectrum/color wheel)

This commit is contained in:
David Capello 2016-02-05 14:41:35 -03:00
parent 9c653ef86e
commit a77ae98fd0
2 changed files with 28 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Aseprite -->
<!-- Copyright (C) 2001-2015 by David Capello -->
<!-- Copyright (C) 2001-2016 by David Capello -->
<gui version="1.1.2-dev">
<!-- Keyboard shortcuts -->
<keyboard version="1">
@ -377,6 +377,12 @@
<key command="SetInkType"><param name="type" value="lock-alpha" /></key>
<key command="SetInkType"><param name="type" value="shading" /></key>
<key command="SetSameInk" />
<key command="SetColorSelector">
<param name="type" value="spectrum" />
</key>
<key command="SetColorSelector">
<param name="type" value="wheel" />
</key>
</commands>
<!-- Keyboard shortcuts to select tools -->

View File

@ -1,5 +1,5 @@
// Aseprite
// Copyright (C) 2001-2015 David Capello
// Copyright (C) 2016 David Capello
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
@ -25,6 +25,7 @@ protected:
void onLoadParams(const Params& params) override;
bool onChecked(Context* context) override;
void onExecute(Context* context) override;
std::string onGetFriendlyName() const override;
private:
ColorBar::ColorSelector m_type;
@ -60,6 +61,25 @@ void SetColorSelectorCommand::onExecute(Context* context)
ColorBar::instance()->setColorSelector(m_type);
}
std::string SetColorSelectorCommand::onGetFriendlyName() const
{
std::string result = "Set Color Selector: ";
switch (m_type) {
case ColorBar::ColorSelector::SPECTRUM:
result += "Color Spectrum";
break;
case ColorBar::ColorSelector::WHEEL:
result += "Color Wheel";
break;
default:
result += "Unknown";
break;
}
return result;
}
Command* CommandFactory::createSetColorSelectorCommand()
{
return new SetColorSelectorCommand;