[aseprite] 08/250: Avoid selecting all RGBA+Index buttons in FilterTargetButtons
Tobias Hansen
thansen at moszumanska.debian.org
Sun Dec 20 15:27:00 UTC 2015
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit 984059e1bce15395b257effddd77746dd20a46ec
Author: David Capello <davidcapello at gmail.com>
Date: Fri Aug 28 15:41:02 2015 -0300
Avoid selecting all RGBA+Index buttons in FilterTargetButtons
---
src/app/commands/cmd_palette_editor.cpp | 4 ++--
src/app/commands/filters/filter_target_buttons.cpp | 19 ++++++++++++++--
src/app/commands/filters/filter_target_buttons.h | 2 +-
src/app/ui/brush_popup.cpp | 3 ++-
src/app/ui/button_set.cpp | 10 ++++-----
src/app/ui/button_set.h | 4 ++--
src/app/ui/color_selector.cpp | 2 +-
src/app/ui/context_bar.cpp | 25 +++++++++++-----------
8 files changed, 42 insertions(+), 27 deletions(-)
diff --git a/src/app/commands/cmd_palette_editor.cpp b/src/app/commands/cmd_palette_editor.cpp
index 3ea5348..0899d03 100644
--- a/src/app/commands/cmd_palette_editor.cpp
+++ b/src/app/commands/cmd_palette_editor.cpp
@@ -277,8 +277,8 @@ PaletteEntryEditor::PaletteEntryEditor()
m_vbox.addChild(&m_bottomBox);
addChild(&m_vbox);
- m_colorType.ItemChange.connect(&PaletteEntryEditor::onColorTypeClick, this);
- m_changeMode.ItemChange.connect(&PaletteEntryEditor::onChangeModeClick, this);
+ m_colorType.ItemChange.connect(Bind<void>(&PaletteEntryEditor::onColorTypeClick, this));
+ m_changeMode.ItemChange.connect(Bind<void>(&PaletteEntryEditor::onChangeModeClick, this));
m_rgbSliders.ColorChange.connect(&PaletteEntryEditor::onColorSlidersChange, this);
m_hsvSliders.ColorChange.connect(&PaletteEntryEditor::onColorSlidersChange, this);
diff --git a/src/app/commands/filters/filter_target_buttons.cpp b/src/app/commands/filters/filter_target_buttons.cpp
index 0060b30..50fbe2d 100644
--- a/src/app/commands/filters/filter_target_buttons.cpp
+++ b/src/app/commands/filters/filter_target_buttons.cpp
@@ -132,11 +132,26 @@ void FilterTargetButtons::updateComponentTooltip(Item* item, const char* channel
}
}
-void FilterTargetButtons::onItemChange()
+void FilterTargetButtons::onItemChange(Item* item)
{
- ButtonSet::onItemChange();
+ ButtonSet::onItemChange(item);
Target flags = (m_target & (TARGET_ALL_FRAMES | TARGET_ALL_LAYERS));
+ if (m_index && item && item->isSelected()) {
+ if (item == m_index) {
+ m_red->setSelected(false);
+ m_green->setSelected(false);
+ m_blue->setSelected(false);
+ m_alpha->setSelected(false);
+ }
+ else if (item == m_red ||
+ item == m_green ||
+ item == m_blue ||
+ item == m_alpha) {
+ m_index->setSelected(false);
+ }
+ }
+
if (m_red && m_red->isSelected()) flags |= TARGET_RED_CHANNEL;
if (m_green && m_green->isSelected()) flags |= TARGET_GREEN_CHANNEL;
if (m_blue && m_blue->isSelected()) flags |= TARGET_BLUE_CHANNEL;
diff --git a/src/app/commands/filters/filter_target_buttons.h b/src/app/commands/filters/filter_target_buttons.h
index ee2e98e..51f1fea 100644
--- a/src/app/commands/filters/filter_target_buttons.h
+++ b/src/app/commands/filters/filter_target_buttons.h
@@ -34,7 +34,7 @@ namespace app {
Signal0<void> TargetChange;
protected:
- void onItemChange() override;
+ void onItemChange(Item* item) override;
void onChannelChange(ui::ButtonBase* button);
void onImagesChange(ui::ButtonBase* button);
diff --git a/src/app/ui/brush_popup.cpp b/src/app/ui/brush_popup.cpp
index 09c7191..61cf54c 100644
--- a/src/app/ui/brush_popup.cpp
+++ b/src/app/ui/brush_popup.cpp
@@ -17,6 +17,7 @@
#include "app/ui/button_set.h"
#include "app/ui/keyboard_shortcuts.h"
#include "app/ui/skin/skin_theme.h"
+#include "base/bind.h"
#include "base/convert_to.h"
#include "doc/brush.h"
#include "doc/conversion_she.h"
@@ -179,7 +180,7 @@ void BrushPopup::regenerate(const gfx::Rect& box, const Brushes& brushes)
while (((slot-1) % columns) > 0)
m_buttons->addItem(new Item(this, m_delegate, BrushRef(nullptr), slot++));
- m_buttons->ItemChange.connect(&BrushPopup::onButtonChange, this);
+ m_buttons->ItemChange.connect(Bind<void>(&BrushPopup::onButtonChange, this));
m_buttons->setTransparent(true);
m_buttons->setBgColor(gfx::ColorNone);
addChild(m_buttons.get());
diff --git a/src/app/ui/button_set.cpp b/src/app/ui/button_set.cpp
index a378b03..d47d0f8 100644
--- a/src/app/ui/button_set.cpp
+++ b/src/app/ui/button_set.cpp
@@ -155,7 +155,7 @@ bool ButtonSet::Item::onProcessMessage(ui::Message* msg)
if (mnemonicPressed ||
(hasFocus() && keymsg->scancode() == kKeySpace)) {
buttonSet()->setSelectedItem(this);
- buttonSet()->onItemChange();
+ buttonSet()->onItemChange(this);
}
}
break;
@@ -167,7 +167,7 @@ bool ButtonSet::Item::onProcessMessage(ui::Message* msg)
if (static_cast<MouseMessage*>(msg)->left() &&
!buttonSet()->m_triggerOnMouseUp) {
- buttonSet()->onItemChange();
+ buttonSet()->onItemChange(this);
}
break;
@@ -178,7 +178,7 @@ bool ButtonSet::Item::onProcessMessage(ui::Message* msg)
if (static_cast<MouseMessage*>(msg)->left()) {
if (buttonSet()->m_triggerOnMouseUp)
- buttonSet()->onItemChange();
+ buttonSet()->onItemChange(this);
}
else if (static_cast<MouseMessage*>(msg)->right()) {
buttonSet()->onRightClick(this);
@@ -321,9 +321,9 @@ void ButtonSet::setMultipleSelection(bool state)
m_multipleSelection = state;
}
-void ButtonSet::onItemChange()
+void ButtonSet::onItemChange(Item* item)
{
- ItemChange();
+ ItemChange(item);
}
void ButtonSet::onRightClick(Item* item)
diff --git a/src/app/ui/button_set.h b/src/app/ui/button_set.h
index d69f27d..cc03251 100644
--- a/src/app/ui/button_set.h
+++ b/src/app/ui/button_set.h
@@ -49,11 +49,11 @@ namespace app {
void setTriggerOnMouseUp(bool state);
void setMultipleSelection(bool state);
- Signal0<void> ItemChange;
+ Signal1<void, Item*> ItemChange;
Signal1<void, Item*> RightClick;
protected:
- virtual void onItemChange();
+ virtual void onItemChange(Item* item);
virtual void onRightClick(Item* item);
private:
diff --git a/src/app/ui/color_selector.cpp b/src/app/ui/color_selector.cpp
index 152ec92..c2cd859 100644
--- a/src/app/ui/color_selector.cpp
+++ b/src/app/ui/color_selector.cpp
@@ -89,7 +89,7 @@ ColorSelector::ColorSelector()
m_vbox.addChild(&m_maskLabel);
addChild(&m_vbox);
- m_colorType.ItemChange.connect(&ColorSelector::onColorTypeClick, this);
+ m_colorType.ItemChange.connect(Bind<void>(&ColorSelector::onColorTypeClick, this));
m_rgbSliders.ColorChange.connect(&ColorSelector::onColorSlidersChange, this);
m_hsvSliders.ColorChange.connect(&ColorSelector::onColorSlidersChange, this);
diff --git a/src/app/ui/context_bar.cpp b/src/app/ui/context_bar.cpp
index b6e7d94..eee24b7 100644
--- a/src/app/ui/context_bar.cpp
+++ b/src/app/ui/context_bar.cpp
@@ -95,8 +95,8 @@ public:
}
protected:
- void onItemChange() override {
- ButtonSet::onItemChange();
+ void onItemChange(Item* item) override {
+ ButtonSet::onItemChange(item);
if (!m_popupWindow.isVisible())
openPopup();
@@ -348,8 +348,8 @@ public:
}
protected:
- void onItemChange() override {
- ButtonSet::onItemChange();
+ void onItemChange(Item* item) override {
+ ButtonSet::onItemChange(item);
gfx::Rect bounds = getBounds();
@@ -691,8 +691,6 @@ public:
: ButtonSet(1) {
addItem(SkinTheme::instance()->parts.pivotCenter());
- ItemChange.connect(Bind<void>(&PivotField::onPopup, this));
-
Preferences::instance().selection.pivotPosition.AfterChange.connect(
Bind<void>(&PivotField::onPivotChange, this));
@@ -701,9 +699,10 @@ public:
private:
- void onPopup() {
- SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
+ void onItemChange(Item* item) override {
+ ButtonSet::onItemChange(item);
+ SkinTheme* theme = static_cast<SkinTheme*>(getTheme());
gfx::Rect bounds = getBounds();
Menu menu;
@@ -737,7 +736,7 @@ private:
});
buttonset.ItemChange.connect(
- [&buttonset](){
+ [&buttonset](ButtonSet::Item* item){
Preferences::instance().selection.pivotPosition(
app::gen::PivotPosition(buttonset.selectedItem()));
});
@@ -1016,8 +1015,8 @@ public:
}
protected:
- void onItemChange() override {
- ButtonSet::onItemChange();
+ void onItemChange(Item* item) override {
+ ButtonSet::onItemChange(item);
Preferences::instance().selection.mode(
(tools::SelectionMode)selectedItem());
@@ -1043,8 +1042,8 @@ public:
Signal1<void, ContextBarObserver::DropAction> DropPixels;
protected:
- void onItemChange() override {
- ButtonSet::onItemChange();
+ void onItemChange(Item* item) override {
+ ButtonSet::onItemChange(item);
switch (selectedItem()) {
case 0: DropPixels(ContextBarObserver::DropPixels); break;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/aseprite.git
More information about the Pkg-games-commits
mailing list