1
0
mirror of git://projects.qi-hardware.com/openwrt-packages.git synced 2024-07-01 05:06:42 +03:00
openwrt-packages/ase/patches/060-fix-zoom-keys.patch

82 lines
2.8 KiB
Diff

Index: ase-0.8.2/src/widgets/editor/keys.cpp
===================================================================
--- ase-0.8.2.orig/src/widgets/editor/keys.cpp 2011-06-16 21:04:19.000000000 +0200
+++ ase-0.8.2/src/widgets/editor/keys.cpp 2011-06-16 22:05:01.000000000 +0200
@@ -16,6 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#define DEBUGMODE
+#define PREFIX_I "keys INFO: "
+#define PREFIX_W "keys WARNING: "
+#define PREFIX_E "keys ERROR: "
+
#include "config.h"
#include <allegro/keyboard.h>
@@ -36,8 +41,11 @@
#include "widgets/colbar.h"
#include "widgets/editor.h"
-bool Editor::editor_keys_toset_zoom(int scancode)
+bool Editor::editor_keys_toset_zoom(int scancode, int ascii)
{
+ TRACE(PREFIX_I "editor_keys_toset_zoom %i, '%c'; %i, %i; %i.\n", scancode, ascii,
+ (int)!!m_sprite, (int)this->hasMouse(), (int)key_shifts);
+
if ((m_sprite) &&
(this->hasMouse()) &&
!(key_shifts & (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG))) {
@@ -49,17 +57,18 @@
y = 0;
zoom = -1;
- switch (scancode) { // TODO make these keys configurable
- case KEY_1: zoom = 0; break;
- case KEY_2: zoom = 1; break;
- case KEY_3: zoom = 2; break;
- case KEY_4: zoom = 3; break;
- case KEY_5: zoom = 4; break;
- case KEY_6: zoom = 5; break;
+ switch (ascii) { // TODO make these keys configurable
+ case '1': zoom = 0; break;
+ case '2': zoom = 1; break;
+ case '3': zoom = 2; break;
+ case '4': zoom = 3; break;
+ case '5': zoom = 4; break;
+ case '6': zoom = 5; break;
}
// Change zoom
if (zoom >= 0) {
+ TRACE(PREFIX_I "setting zoom to %i.\n", zoom);
editor_set_zoom_and_center_in_mouse(zoom, jmouse_x(0), jmouse_y(0));
return true;
}
Index: ase-0.8.2/src/widgets/editor.h
===================================================================
--- ase-0.8.2.orig/src/widgets/editor.h 2011-06-16 22:06:26.000000000 +0200
+++ ase-0.8.2/src/widgets/editor.h 2011-06-16 22:06:30.000000000 +0200
@@ -180,7 +180,7 @@
// keys.c
- bool editor_keys_toset_zoom(int scancode);
+ bool editor_keys_toset_zoom(int scancode, int ascii);
public:
Index: ase-0.8.2/src/widgets/editor/editor.cpp
===================================================================
--- ase-0.8.2.orig/src/widgets/editor/editor.cpp 2011-06-16 22:03:22.000000000 +0200
+++ ase-0.8.2/src/widgets/editor/editor.cpp 2011-06-16 22:07:35.000000000 +0200
@@ -1318,7 +1318,7 @@
case JM_KEYPRESSED:
if (m_state == EDITOR_STATE_STANDBY ||
m_state == EDITOR_STATE_DRAWING) {
- if (editor_keys_toset_zoom(msg->key.scancode))
+ if (editor_keys_toset_zoom(msg->key.scancode, msg->key.ascii))
return true;
}