[aseprite] 31/51: Fix Alt+mouse wheel to navigate color indexes in RGB images/colors (fix #1153)
Tobias Hansen
thansen at moszumanska.debian.org
Mon Jul 11 21:35:17 UTC 2016
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository aseprite.
commit ec15ec7bb20d2845c3f69e85f041096228c19fb3
Author: David Capello <davidcapello at gmail.com>
Date: Fri Jul 1 13:18:33 2016 -0300
Fix Alt+mouse wheel to navigate color indexes in RGB images/colors (fix #1153)
---
src/app/commands/cmd_change_color.cpp | 28 ++++++++++---------------
src/app/ui/editor/state_with_wheel_behavior.cpp | 20 ++++++------------
2 files changed, 17 insertions(+), 31 deletions(-)
diff --git a/src/app/commands/cmd_change_color.cpp b/src/app/commands/cmd_change_color.cpp
index af172ef..9d9ebf8 100644
--- a/src/app/commands/cmd_change_color.cpp
+++ b/src/app/commands/cmd_change_color.cpp
@@ -1,5 +1,5 @@
// Aseprite
-// Copyright (C) 2001-2015 David Capello
+// Copyright (C) 2001-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
@@ -74,24 +74,18 @@ void ChangeColorCommand::onExecute(Context* context)
case None:
// do nothing
break;
- case IncrementIndex:
- if (color.getType() == app::Color::IndexType) {
- int index = color.getIndex();
- if (index < get_current_palette()->size()-1)
- color = app::Color::fromIndex(index+1);
- }
- else
- color = app::Color::fromIndex(0);
+ case IncrementIndex: {
+ int index = color.getIndex();
+ if (index < get_current_palette()->size()-1)
+ color = app::Color::fromIndex(index+1);
break;
- case DecrementIndex:
- if (color.getType() == app::Color::IndexType) {
- int index = color.getIndex();
- if (index > 0)
- color = app::Color::fromIndex(index-1);
- }
- else
- color = app::Color::fromIndex(0);
+ }
+ case DecrementIndex: {
+ int index = color.getIndex();
+ if (index > 0)
+ color = app::Color::fromIndex(index-1);
break;
+ }
}
if (m_background)
diff --git a/src/app/ui/editor/state_with_wheel_behavior.cpp b/src/app/ui/editor/state_with_wheel_behavior.cpp
index a29759a..3d0764c 100644
--- a/src/app/ui/editor/state_with_wheel_behavior.cpp
+++ b/src/app/ui/editor/state_with_wheel_behavior.cpp
@@ -98,26 +98,18 @@ bool StateWithWheelBehavior::onMouseWheel(Editor* editor, MouseMessage* msg)
case WHEEL_FG:
{
- int newIndex = 0;
- if (ColorBar::instance()->getFgColor().getType() == app::Color::IndexType) {
- int lastIndex = get_current_palette()->size()-1;
-
- newIndex = ColorBar::instance()->getFgColor().getIndex() + int(dz);
- newIndex = MID(0, newIndex, lastIndex);
- }
+ int lastIndex = get_current_palette()->size()-1;
+ int newIndex = ColorBar::instance()->getFgColor().getIndex() + int(dz);
+ newIndex = MID(0, newIndex, lastIndex);
ColorBar::instance()->setFgColor(app::Color::fromIndex(newIndex));
}
break;
case WHEEL_BG:
{
- int newIndex = 0;
- if (ColorBar::instance()->getBgColor().getType() == app::Color::IndexType) {
- int lastIndex = get_current_palette()->size()-1;
-
- newIndex = ColorBar::instance()->getBgColor().getIndex() + int(dz);
- newIndex = MID(0, newIndex, lastIndex);
- }
+ int lastIndex = get_current_palette()->size()-1;
+ int newIndex = ColorBar::instance()->getBgColor().getIndex() + int(dz);
+ newIndex = MID(0, newIndex, lastIndex);
ColorBar::instance()->setBgColor(app::Color::fromIndex(newIndex));
}
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