mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-06 21:39:57 +00:00
Show pin only in fg/bg color selector dialogs
This commit is contained in:
parent
76fefe64f2
commit
92db283cbc
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -103,7 +103,8 @@ void MaskByColorCommand::onExecute(Context* context)
|
||||
m_buttonColor = new ColorButton
|
||||
(get_config_color("MaskColor", "Color",
|
||||
ColorBar::instance()->getFgColor()),
|
||||
sprite->pixelFormat());
|
||||
sprite->pixelFormat(),
|
||||
false);
|
||||
label_tolerance = new Label("Tolerance:");
|
||||
m_sliderTolerance = new Slider(0, 255, get_config_int("MaskColor", "Tolerance", 0));
|
||||
m_checkPreview = new CheckBox("&Preview");
|
||||
|
@ -68,11 +68,11 @@ public:
|
||||
, m_globPref(m_pref.document(nullptr))
|
||||
, m_docPref(m_pref.document(context->activeDocument()))
|
||||
, m_curPref(&m_docPref)
|
||||
, m_checked_bg_color1(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
||||
, m_checked_bg_color2(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
||||
, m_pixelGridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
||||
, m_gridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB))
|
||||
, m_cursorColor(new ColorButton(m_pref.cursor.cursorColor(), IMAGE_RGB))
|
||||
, m_checked_bg_color1(new ColorButton(app::Color::fromMask(), IMAGE_RGB, false))
|
||||
, m_checked_bg_color2(new ColorButton(app::Color::fromMask(), IMAGE_RGB, false))
|
||||
, m_pixelGridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB, false))
|
||||
, m_gridColor(new ColorButton(app::Color::fromMask(), IMAGE_RGB, false))
|
||||
, m_cursorColor(new ColorButton(m_pref.cursor.cursorColor(), IMAGE_RGB, false))
|
||||
, m_curSection(curSection)
|
||||
{
|
||||
sectionListbox()->Change.connect(base::Bind<void>(&OptionsWindow::onChangeSection, this));
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -104,7 +104,8 @@ void SpritePropertiesCommand::onExecute(Context* context)
|
||||
|
||||
if (sprite->pixelFormat() == IMAGE_INDEXED) {
|
||||
color_button = new ColorButton(app::Color::fromIndex(sprite->transparentColor()),
|
||||
IMAGE_INDEXED);
|
||||
IMAGE_INDEXED,
|
||||
false);
|
||||
|
||||
window.transparentColorPlaceholder()->addChild(color_button);
|
||||
}
|
||||
|
@ -139,8 +139,8 @@ ColorBar::ColorBar(int align)
|
||||
, m_tintShadeTone(nullptr)
|
||||
, m_spectrum(nullptr)
|
||||
, m_wheel(nullptr)
|
||||
, m_fgColor(app::Color::fromRgb(255, 255, 255), IMAGE_RGB)
|
||||
, m_bgColor(app::Color::fromRgb(0, 0, 0), IMAGE_RGB)
|
||||
, m_fgColor(app::Color::fromRgb(255, 255, 255), IMAGE_RGB, true)
|
||||
, m_bgColor(app::Color::fromRgb(0, 0, 0), IMAGE_RGB, true)
|
||||
, m_fgWarningIcon(new WarningIcon)
|
||||
, m_bgWarningIcon(new WarningIcon)
|
||||
, m_lock(false)
|
||||
|
@ -41,12 +41,15 @@ static WidgetType colorbutton_type()
|
||||
return type;
|
||||
}
|
||||
|
||||
ColorButton::ColorButton(const app::Color& color, PixelFormat pixelFormat)
|
||||
ColorButton::ColorButton(const app::Color& color,
|
||||
PixelFormat pixelFormat,
|
||||
bool canPinSelector)
|
||||
: ButtonBase("", colorbutton_type(), kButtonWidget, kButtonWidget)
|
||||
, m_color(color)
|
||||
, m_pixelFormat(pixelFormat)
|
||||
, m_window(NULL)
|
||||
, m_dependOnLayer(false)
|
||||
, m_canPinSelector(canPinSelector)
|
||||
{
|
||||
this->setFocusStop(true);
|
||||
|
||||
@ -238,7 +241,7 @@ void ColorButton::openSelectorDialog()
|
||||
int x, y;
|
||||
|
||||
if (m_window == NULL) {
|
||||
m_window = new ColorPopup();
|
||||
m_window = new ColorPopup(m_canPinSelector);
|
||||
m_window->ColorChange.connect(&ColorButton::onWindowColorChange, this);
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,9 @@ namespace app {
|
||||
, public doc::ContextObserver
|
||||
, public IColorSource {
|
||||
public:
|
||||
ColorButton(const app::Color& color, PixelFormat pixelFormat);
|
||||
ColorButton(const app::Color& color,
|
||||
PixelFormat pixelFormat,
|
||||
bool canPinSelector);
|
||||
~ColorButton();
|
||||
|
||||
PixelFormat pixelFormat() const;
|
||||
@ -54,6 +56,7 @@ namespace app {
|
||||
PixelFormat m_pixelFormat;
|
||||
ColorPopup* m_window;
|
||||
bool m_dependOnLayer;
|
||||
bool m_canPinSelector;
|
||||
};
|
||||
|
||||
} // namespace app
|
||||
|
@ -47,7 +47,7 @@ enum {
|
||||
MASK_MODE
|
||||
};
|
||||
|
||||
ColorPopup::ColorPopup()
|
||||
ColorPopup::ColorPopup(bool canPin)
|
||||
: PopupWindowPin("Color Selector", ClickBehavior::CloseOnClickInOtherWindow)
|
||||
, m_vbox(VERTICAL)
|
||||
, m_topBox(HORIZONTAL)
|
||||
@ -94,6 +94,9 @@ ColorPopup::ColorPopup()
|
||||
m_graySlider.ColorChange.connect(&ColorPopup::onColorSlidersChange, this);
|
||||
m_hexColorEntry.ColorChange.connect(&ColorPopup::onColorHexEntryChange, this);
|
||||
|
||||
if (!canPin)
|
||||
showPin(false);
|
||||
|
||||
selectColorType(app::Color::RgbType);
|
||||
setSizeHint(gfx::Size(300*guiscale(), sizeHint().h));
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace app {
|
||||
DoNotChangeType
|
||||
};
|
||||
|
||||
ColorPopup();
|
||||
ColorPopup(bool canPin);
|
||||
~ColorPopup();
|
||||
|
||||
void setColor(const app::Color& color, SetColorOptions options);
|
||||
|
@ -886,7 +886,7 @@ class ContextBar::TransparentColorField : public HBox {
|
||||
public:
|
||||
TransparentColorField(ContextBar* owner)
|
||||
: m_icon(1)
|
||||
, m_maskColor(app::Color::fromMask(), IMAGE_RGB)
|
||||
, m_maskColor(app::Color::fromMask(), IMAGE_RGB, false)
|
||||
, m_owner(owner) {
|
||||
SkinTheme* theme = SkinTheme::instance();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite
|
||||
// Copyright (C) 2001-2015 David Capello
|
||||
// Copyright (C) 2001-2016 David Capello
|
||||
//
|
||||
// This program is distributed under the terms of
|
||||
// the End-User License Agreement for Aseprite.
|
||||
@ -40,6 +40,11 @@ PopupWindowPin::PopupWindowPin(const std::string& text, ClickBehavior clickBehav
|
||||
CENTER | MIDDLE));
|
||||
}
|
||||
|
||||
bool PopupWindowPin::showPin(bool state)
|
||||
{
|
||||
m_pin.setVisible(state);
|
||||
}
|
||||
|
||||
void PopupWindowPin::onPinClick(Event& ev)
|
||||
{
|
||||
if (m_pin.isSelected()) {
|
||||
|
@ -17,6 +17,8 @@ namespace app {
|
||||
public:
|
||||
PopupWindowPin(const std::string& text, ClickBehavior clickBehavior);
|
||||
|
||||
bool showPin(bool state);
|
||||
|
||||
protected:
|
||||
virtual bool onProcessMessage(ui::Message* msg) override;
|
||||
virtual void onHitTest(ui::HitTestEvent& ev) override;
|
||||
|
@ -420,7 +420,7 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget
|
||||
}
|
||||
else if (elem_name == "colorpicker") {
|
||||
if (!widget)
|
||||
widget = new ColorButton(Color::fromMask(), app_get_current_pixel_format());
|
||||
widget = new ColorButton(Color::fromMask(), app_get_current_pixel_format(), false);
|
||||
}
|
||||
else if (elem_name == "dropdownbutton") {
|
||||
if (!widget) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user