[aseprite] 33/250: Update text entries when Abs/Rel mode is changed in Palette Editor (fix #809)

Tobias Hansen thansen at moszumanska.debian.org
Sun Dec 20 15:27:08 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 ab53f3f4d7d09bbff78f9fe8401b6b4774c39dec
Author: David Capello <davidcapello at gmail.com>
Date:   Mon Sep 14 08:53:31 2015 -0300

    Update text entries when Abs/Rel mode is changed in Palette Editor (fix #809)
---
 src/app/commands/cmd_palette_editor.cpp | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/app/commands/cmd_palette_editor.cpp b/src/app/commands/cmd_palette_editor.cpp
index 0899d03..3039f39 100644
--- a/src/app/commands/cmd_palette_editor.cpp
+++ b/src/app/commands/cmd_palette_editor.cpp
@@ -84,6 +84,7 @@ private:
   void setNewPalette(Palette* palette, const char* operationName);
   void updateCurrentSpritePalette(const char* operationName);
   void updateColorBar();
+  void updateWidgetsFromSelectedEntries();
   void onPalChange();
   void resetRelativeInfo();
   void getPicks(PalettePicks& picks);
@@ -469,9 +470,11 @@ void PaletteEntryEditor::onChangeModeClick()
     case REL_MODE:
       m_rgbSliders.setMode(ColorSliders::Relative);
       m_hsvSliders.setMode(ColorSliders::Relative);
-      resetRelativeInfo();
       break;
   }
+
+  // Update sliders, entries, etc.
+  updateWidgetsFromSelectedEntries();
 }
 
 void PaletteEntryEditor::setPaletteEntry(const app::Color& color)
@@ -723,19 +726,23 @@ void PaletteEntryEditor::updateColorBar()
   ColorBar::instance()->invalidate();
 }
 
-void PaletteEntryEditor::onPalChange()
+void PaletteEntryEditor::updateWidgetsFromSelectedEntries()
 {
-  if (!m_selfPalChange) {
-    PaletteView* palette_editor = ColorBar::instance()->getPaletteView();
-    int index = palette_editor->getSelectedEntry();
-    if (index >= 0)
-      setColor(app::Color::fromIndex(index));
+  PaletteView* palette_editor = ColorBar::instance()->getPaletteView();
+  int index = palette_editor->getSelectedEntry();
+  if (index >= 0)
+    setColor(app::Color::fromIndex(index));
 
-    resetRelativeInfo();
+  resetRelativeInfo();
 
-    // Redraw the window
-    invalidate();
-  }
+  // Redraw the window
+  invalidate();
+}
+
+void PaletteEntryEditor::onPalChange()
+{
+  if (!m_selfPalChange)
+    updateWidgetsFromSelectedEntries();
 }
 
 void PaletteEntryEditor::resetRelativeInfo()

-- 
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