Root/ase/patches/060-fix-zoom-keys.patch

1Index: ase-0.8.2/src/widgets/editor/keys.cpp
2===================================================================
3--- ase-0.8.2.orig/src/widgets/editor/keys.cpp 2011-06-16 21:04:19.000000000 +0200
4+++ ase-0.8.2/src/widgets/editor/keys.cpp 2011-06-16 22:05:01.000000000 +0200
5@@ -16,6 +16,11 @@
6  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7  */
8 
9+#define DEBUGMODE
10+#define PREFIX_I "keys INFO: "
11+#define PREFIX_W "keys WARNING: "
12+#define PREFIX_E "keys ERROR: "
13+
14 #include "config.h"
15 
16 #include <allegro/keyboard.h>
17@@ -36,8 +41,11 @@
18 #include "widgets/colbar.h"
19 #include "widgets/editor.h"
20 
21-bool Editor::editor_keys_toset_zoom(int scancode)
22+bool Editor::editor_keys_toset_zoom(int scancode, int ascii)
23 {
24+ TRACE(PREFIX_I "editor_keys_toset_zoom %i, '%c'; %i, %i; %i.\n", scancode, ascii,
25+ (int)!!m_sprite, (int)this->hasMouse(), (int)key_shifts);
26+
27   if ((m_sprite) &&
28       (this->hasMouse()) &&
29       !(key_shifts & (KB_SHIFT_FLAG | KB_CTRL_FLAG | KB_ALT_FLAG))) {
30@@ -49,17 +57,18 @@
31     y = 0;
32     zoom = -1;
33 
34- switch (scancode) { // TODO make these keys configurable
35- case KEY_1: zoom = 0; break;
36- case KEY_2: zoom = 1; break;
37- case KEY_3: zoom = 2; break;
38- case KEY_4: zoom = 3; break;
39- case KEY_5: zoom = 4; break;
40- case KEY_6: zoom = 5; break;
41+ switch (ascii) { // TODO make these keys configurable
42+ case '1': zoom = 0; break;
43+ case '2': zoom = 1; break;
44+ case '3': zoom = 2; break;
45+ case '4': zoom = 3; break;
46+ case '5': zoom = 4; break;
47+ case '6': zoom = 5; break;
48     }
49 
50     // Change zoom
51     if (zoom >= 0) {
52+ TRACE(PREFIX_I "setting zoom to %i.\n", zoom);
53       editor_set_zoom_and_center_in_mouse(zoom, jmouse_x(0), jmouse_y(0));
54       return true;
55     }
56Index: ase-0.8.2/src/widgets/editor.h
57===================================================================
58--- ase-0.8.2.orig/src/widgets/editor.h 2011-06-16 22:06:26.000000000 +0200
59+++ ase-0.8.2/src/widgets/editor.h 2011-06-16 22:06:30.000000000 +0200
60@@ -180,7 +180,7 @@
61 
62   // keys.c
63 
64- bool editor_keys_toset_zoom(int scancode);
65+ bool editor_keys_toset_zoom(int scancode, int ascii);
66 
67 public:
68 
69Index: ase-0.8.2/src/widgets/editor/editor.cpp
70===================================================================
71--- ase-0.8.2.orig/src/widgets/editor/editor.cpp 2011-06-16 22:03:22.000000000 +0200
72+++ ase-0.8.2/src/widgets/editor/editor.cpp 2011-06-16 22:07:35.000000000 +0200
73@@ -1318,7 +1318,7 @@
74     case JM_KEYPRESSED:
75       if (m_state == EDITOR_STATE_STANDBY ||
76       m_state == EDITOR_STATE_DRAWING) {
77- if (editor_keys_toset_zoom(msg->key.scancode))
78+ if (editor_keys_toset_zoom(msg->key.scancode, msg->key.ascii))
79       return true;
80       }
81 
82

Archive Download this file



interactive