Commit adfa0d9ec9d2d55009a44bf21b4996738ffca41a
1 parent
88a19835
Exists in
master
and in
1 other branch
Publishing action table.
Showing
11 changed files
with
391 additions
and
212 deletions
Show diff stats
Makefile.in
... | ... | @@ -39,6 +39,7 @@ SOURCES= \ |
39 | 39 | $(wildcard src/terminal/drawing/*.c) \ |
40 | 40 | $(wildcard src/terminal/font/*.c) \ |
41 | 41 | $(wildcard src/terminal/keyboard/*.c) \ |
42 | + $(wildcard src/terminal/actions/*.c) \ | |
42 | 43 | $(wildcard src/filetransfer/*.c) \ |
43 | 44 | $(wildcard src/selection/*.c) \ |
44 | 45 | $(wildcard src/selection/@OSNAME@/*.c) \ | ... | ... |
src/include/v3270/actions.h
... | ... | @@ -37,7 +37,30 @@ |
37 | 37 | |
38 | 38 | typedef struct _V3270Accelerator V3270Accelerator; |
39 | 39 | |
40 | + typedef enum _v3270_action_flag | |
41 | + { | |
42 | + V3270_ACTION_FLAG_DEFAULT = 0x00000000, | |
43 | + V3270_ACTION_FLAG_CUT = 0x10000000, | |
44 | + } V3270_ACTION_FLAGS; | |
40 | 45 | |
46 | + typedef struct _v3270_action | |
47 | + { | |
48 | + LIB3270_PROPERTY_HEAD | |
49 | + | |
50 | + V3270_ACTION_FLAGS flags; ///< @brief (The flags for activation. | |
51 | + | |
52 | + guint key; | |
53 | + GdkModifierType mods; | |
54 | + | |
55 | + int (*activate)(GtkWidget *widget, const struct _v3270_action *action); | |
56 | + | |
57 | + } V3270_ACTION; | |
58 | + | |
59 | + | |
60 | + /// | |
61 | + /// @brief Get internal V3270 action table. | |
62 | + /// | |
63 | + LIB3270_EXPORT const V3270_ACTION * v3270_get_actions(); | |
41 | 64 | |
42 | 65 | // |
43 | 66 | // Actions | ... | ... |
... | ... | @@ -0,0 +1,74 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como properties.c e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | + #include "private.h" | |
31 | + #include <v3270.h> | |
32 | + #include <lib3270/trace.h> | |
33 | + #include <lib3270/log.h> | |
34 | + | |
35 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
36 | + | |
37 | + int fire_copy_accelerator(GtkWidget *widget, const V3270_ACTION * action) { | |
38 | + | |
39 | + debug("%s",__FUNCTION__); | |
40 | + | |
41 | + v3270_clipboard_set( | |
42 | + widget, | |
43 | + (action->flags & 0x0F), | |
44 | + (action->flags & V3270_ACTION_FLAG_CUT) != 0 | |
45 | + ); | |
46 | + | |
47 | + return EINVAL; | |
48 | + } | |
49 | + | |
50 | + int fire_paste_accelerator(GtkWidget *widget, const V3270_ACTION * action) { | |
51 | + | |
52 | + | |
53 | + switch((int) action->flags) | |
54 | + { | |
55 | + case 0: // Default paste. | |
56 | + v3270_clipboard_get_from_url(widget,NULL); | |
57 | + break; | |
58 | + | |
59 | + case 1: // Text paste. | |
60 | + v3270_clipboard_get_from_url(widget,"text://"); | |
61 | + break; | |
62 | + | |
63 | + case 2: // File paste. | |
64 | + v3270_clipboard_get_from_url(widget,"file://"); | |
65 | + break; | |
66 | + | |
67 | + default: | |
68 | + g_warning("Unexpected paste flags %u",(unsigned int) action->flags); | |
69 | + } | |
70 | + | |
71 | + return 0; | |
72 | + } | |
73 | + | |
74 | + | ... | ... |
... | ... | @@ -0,0 +1,39 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como - e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | + #include <config.h> | |
31 | + #include <v3270.h> | |
32 | + #include <v3270/actions.h> | |
33 | + #include <internals.h> | |
34 | + | |
35 | + G_GNUC_INTERNAL int fire_copy_accelerator(GtkWidget *widget, const struct _v3270_action * action); | |
36 | + G_GNUC_INTERNAL int fire_paste_accelerator(GtkWidget *widget, const struct _v3270_action * action); | |
37 | + G_GNUC_INTERNAL int fire_zoom_action(GtkWidget *widget, const struct _v3270_action * action); | |
38 | + G_GNUC_INTERNAL int fire_keypad_action(GtkWidget *widget, const struct _v3270_action * action); | |
39 | + | ... | ... |
... | ... | @@ -0,0 +1,169 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como properties.c e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | + #include "private.h" | |
31 | + #include <internals.h> | |
32 | + #include <terminal.h> | |
33 | + #include <lib3270/actions.h> | |
34 | + #include <gdk/gdkkeysyms-compat.h> | |
35 | + #include <v3270/actions.h> | |
36 | + | |
37 | + #ifndef GDK_NUMLOCK_MASK | |
38 | + #define GDK_NUMLOCK_MASK GDK_MOD2_MASK | |
39 | + #endif | |
40 | + | |
41 | + #ifndef GDK_ALT_MASK | |
42 | + #define GDK_ALT_MASK GDK_MOD1_MASK | |
43 | + #endif | |
44 | + | |
45 | +/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
46 | + | |
47 | + static const V3270_ACTION actions[] = | |
48 | + { | |
49 | + { | |
50 | + .name = "keypad-add", | |
51 | + .key = GDK_KP_Add, | |
52 | + .mods = GDK_NUMLOCK_MASK, | |
53 | + .activate = fire_keypad_action | |
54 | + }, | |
55 | + { | |
56 | + .name = "keypad-subtract", | |
57 | + .key = GDK_KP_Subtract, | |
58 | + .mods = GDK_NUMLOCK_MASK, | |
59 | + .activate = fire_keypad_action | |
60 | + }, | |
61 | + | |
62 | + // Standard Clipboard actions | |
63 | + { | |
64 | + .flags = 0, | |
65 | + .name = "copy", | |
66 | + .key = 'c', | |
67 | + .mods = GDK_CONTROL_MASK, | |
68 | + .activate = fire_copy_accelerator | |
69 | + }, | |
70 | + | |
71 | + { | |
72 | + .flags = V3270_COPY_APPEND, | |
73 | + .name = "copy-append", | |
74 | + .key = 'c', | |
75 | + .mods = GDK_ALT_MASK, | |
76 | + .activate = fire_copy_accelerator | |
77 | + }, | |
78 | + | |
79 | + { | |
80 | + .flags = V3270_COPY_TEXT, | |
81 | + .name = "copy-text", | |
82 | + .key = 'c', | |
83 | + .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | |
84 | + .activate = fire_copy_accelerator | |
85 | + }, | |
86 | + | |
87 | + { | |
88 | + .flags = V3270_ACTION_FLAG_CUT|V3270_COPY_DEFAULT, | |
89 | + .name = "cut", | |
90 | + .key = 'x', | |
91 | + .mods = GDK_CONTROL_MASK, | |
92 | + .activate = fire_copy_accelerator | |
93 | + }, | |
94 | + | |
95 | + { | |
96 | + .flags = V3270_ACTION_FLAG_CUT|V3270_COPY_APPEND, | |
97 | + .name = "cut-append", | |
98 | + .key = 'x', | |
99 | + .mods = GDK_ALT_MASK, | |
100 | + .activate = fire_copy_accelerator | |
101 | + }, | |
102 | + | |
103 | + { | |
104 | + .flags = V3270_ACTION_FLAG_CUT|V3270_COPY_TEXT, | |
105 | + .name = "cut-text", | |
106 | + .key = 'x', | |
107 | + .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | |
108 | + .activate = fire_copy_accelerator | |
109 | + }, | |
110 | + | |
111 | + { | |
112 | + .flags = 0, | |
113 | + .name = "paste", | |
114 | + .key = 'v', | |
115 | + .mods = GDK_CONTROL_MASK, | |
116 | + .activate = fire_paste_accelerator | |
117 | + }, | |
118 | + | |
119 | + { | |
120 | + .flags = 1, | |
121 | + .name = "paste-text", | |
122 | + .key = 'v', | |
123 | + .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | |
124 | + .activate = fire_paste_accelerator | |
125 | + }, | |
126 | + | |
127 | + { | |
128 | + .flags = 2, | |
129 | + .name = "paste-file", | |
130 | + .key = 'v', | |
131 | + .mods = GDK_ALT_MASK, | |
132 | + .activate = fire_paste_accelerator | |
133 | + }, | |
134 | + | |
135 | + { | |
136 | + .flags = 0, | |
137 | + .name = "zoom-in", | |
138 | + .key = GDK_KP_Add, | |
139 | + .mods = GDK_CONTROL_MASK, | |
140 | + .activate = fire_zoom_action | |
141 | + }, | |
142 | + | |
143 | + { | |
144 | + .flags = 1, | |
145 | + .name = "zoom-out", | |
146 | + .key = GDK_KP_Subtract, | |
147 | + .mods = GDK_CONTROL_MASK, | |
148 | + .activate = fire_zoom_action | |
149 | + }, | |
150 | + | |
151 | + { | |
152 | + .flags = 2, | |
153 | + .name = "zoom-fit-best", | |
154 | + .key = '0', | |
155 | + .mods = GDK_CONTROL_MASK, | |
156 | + .activate = fire_zoom_action | |
157 | + }, | |
158 | + | |
159 | + { | |
160 | + .name = NULL | |
161 | + } | |
162 | + }; | |
163 | + | |
164 | + LIB3270_EXPORT const V3270_ACTION * v3270_get_actions() | |
165 | + { | |
166 | + return actions; | |
167 | + } | |
168 | + | |
169 | + | ... | ... |
... | ... | @@ -0,0 +1,62 @@ |
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como properties.c e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
29 | + | |
30 | + #include "private.h" | |
31 | + #include <v3270.h> | |
32 | + #include <lib3270/trace.h> | |
33 | + #include <lib3270/log.h> | |
34 | + | |
35 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
36 | + | |
37 | + int fire_zoom_action(GtkWidget *widget, const V3270_ACTION * action) { | |
38 | + | |
39 | + debug("%s",__FUNCTION__); | |
40 | + | |
41 | + switch(action->flags) | |
42 | + { | |
43 | + case 0: // Zoom in | |
44 | + v3270_zoom_in(widget); | |
45 | + break; | |
46 | + | |
47 | + case 1: // Zoom out | |
48 | + v3270_zoom_out(widget); | |
49 | + break; | |
50 | + | |
51 | + case 2: // Zoom fit best | |
52 | + v3270_zoom_best(widget); | |
53 | + break; | |
54 | + | |
55 | + default: | |
56 | + g_warning("Unexpected zoom flags %u",(unsigned int) action->flags); | |
57 | + } | |
58 | + | |
59 | + return 0; | |
60 | + } | |
61 | + | |
62 | + | ... | ... |
src/terminal/keyboard/accelerator.c
... | ... | @@ -32,6 +32,7 @@ |
32 | 32 | #include <internals.h> |
33 | 33 | #include <terminal.h> |
34 | 34 | #include <lib3270/actions.h> |
35 | + #include <v3270/actions.h> | |
35 | 36 | |
36 | 37 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
37 | 38 | |
... | ... | @@ -98,8 +99,11 @@ |
98 | 99 | case V3270_ACCELERATOR_TYPE_LIB3270_ACTION: |
99 | 100 | return gettext(((LIB3270_ACTION *) accel->arg)->summary); |
100 | 101 | |
101 | - // case V3270_ACCELERATOR_TYPE_INTERNAL: | |
102 | - // case V3270_ACCELERATOR_TYPE_GTK_ACTION: | |
102 | + case V3270_ACCELERATOR_TYPE_INTERNAL: | |
103 | + return ((V3270_ACTION *) accel->arg)->summary; | |
104 | + | |
105 | + case V3270_ACCELERATOR_TYPE_LIB3270_TOGGLE: | |
106 | + return ((LIB3270_TOGGLE *) accel->arg)->summary; | |
103 | 107 | |
104 | 108 | } |
105 | 109 | |
... | ... | @@ -117,7 +121,7 @@ |
117 | 121 | return ((LIB3270_TOGGLE *) accel->arg)->name; |
118 | 122 | |
119 | 123 | case V3270_ACCELERATOR_TYPE_INTERNAL: |
120 | - return ((struct InternalAction *) accel->arg)->name; | |
124 | + return ((V3270_ACTION *) accel->arg)->name; | |
121 | 125 | |
122 | 126 | case V3270_ACCELERATOR_TYPE_CUSTOM: |
123 | 127 | return ((V3270CustomAccelerator *) accel)->name; | ... | ... |
src/terminal/keyboard/clipboard.c
... | ... | @@ -1,74 +0,0 @@ |
1 | -/* | |
2 | - * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | - * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | - * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | - * | |
6 | - * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | - * | |
8 | - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | - * Free Software Foundation. | |
11 | - * | |
12 | - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | - * obter mais detalhes. | |
16 | - * | |
17 | - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | - * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | - * | |
21 | - * Este programa está nomeado como properties.c e possui - linhas de código. | |
22 | - * | |
23 | - * Contatos: | |
24 | - * | |
25 | - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | - * | |
28 | - */ | |
29 | - | |
30 | - #include "private.h" | |
31 | - #include <v3270.h> | |
32 | - #include <lib3270/trace.h> | |
33 | - #include <lib3270/log.h> | |
34 | - | |
35 | -/*--[ Implement ]------------------------------------------------------------------------------------*/ | |
36 | - | |
37 | - int fire_copy_accelerator(GtkWidget *widget, const struct InternalAction * action) { | |
38 | - | |
39 | - debug("%s",__FUNCTION__); | |
40 | - | |
41 | - v3270_clipboard_set( | |
42 | - widget, | |
43 | - (action->operation & 0x0F), | |
44 | - (action->operation & ACCEL_OPERATION_CUT) != 0 | |
45 | - ); | |
46 | - | |
47 | - return EINVAL; | |
48 | - } | |
49 | - | |
50 | - int fire_paste_accelerator(GtkWidget *widget, const struct InternalAction * action) { | |
51 | - | |
52 | - | |
53 | - switch(action->operation) | |
54 | - { | |
55 | - case 0: // Default paste. | |
56 | - v3270_clipboard_get_from_url(widget,NULL); | |
57 | - break; | |
58 | - | |
59 | - case 1: // Text paste. | |
60 | - v3270_clipboard_get_from_url(widget,"text://"); | |
61 | - break; | |
62 | - | |
63 | - case 2: // File paste. | |
64 | - v3270_clipboard_get_from_url(widget,"file://"); | |
65 | - break; | |
66 | - | |
67 | - default: | |
68 | - g_warning("Unexpected paste operation %u",(unsigned int) action->operation); | |
69 | - } | |
70 | - | |
71 | - return 0; | |
72 | - } | |
73 | - | |
74 | - |
src/terminal/keyboard/init.c
... | ... | @@ -44,109 +44,6 @@ |
44 | 44 | #define GDK_ALT_MASK GDK_MOD1_MASK |
45 | 45 | #endif |
46 | 46 | |
47 | -/*--[ Globals ]--------------------------------------------------------------------------------------*/ | |
48 | - | |
49 | - static int fire_keypad_action(GtkWidget *widget, const struct InternalAction * action); | |
50 | - static int fire_zoom_action(GtkWidget *widget, const struct InternalAction * action); | |
51 | - | |
52 | - static const struct InternalAction InternalActions[] = | |
53 | - { | |
54 | - { | |
55 | - .name = "keypad-add", | |
56 | - .key = GDK_KP_Add, | |
57 | - .mods = GDK_NUMLOCK_MASK, | |
58 | - .activate = G_CALLBACK(fire_keypad_action) | |
59 | - }, | |
60 | - { | |
61 | - .name = "keypad-subtract", | |
62 | - .key = GDK_KP_Subtract, | |
63 | - .mods = GDK_NUMLOCK_MASK, | |
64 | - .activate = G_CALLBACK(fire_keypad_action) | |
65 | - }, | |
66 | - | |
67 | - // Standard Clipboard actions | |
68 | - { | |
69 | - .operation = V3270_COPY_DEFAULT, | |
70 | - .name = "copy", | |
71 | - .key = 'c', | |
72 | - .mods = GDK_CONTROL_MASK, | |
73 | - .activate = G_CALLBACK(fire_copy_accelerator) | |
74 | - }, | |
75 | - | |
76 | - { | |
77 | - .operation = V3270_COPY_APPEND, | |
78 | - .name = "copy-append", | |
79 | - .key = 'c', | |
80 | - .mods = GDK_ALT_MASK, | |
81 | - .activate = G_CALLBACK(fire_copy_accelerator) | |
82 | - }, | |
83 | - | |
84 | - { | |
85 | - .operation = V3270_COPY_TEXT, | |
86 | - .name = "copy-text", | |
87 | - .key = 'c', | |
88 | - .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | |
89 | - .activate = G_CALLBACK(fire_copy_accelerator) | |
90 | - }, | |
91 | - | |
92 | - { | |
93 | - .operation = ACCEL_OPERATION_CUT|V3270_COPY_DEFAULT, | |
94 | - .name = "cut", | |
95 | - .key = 'x', | |
96 | - .mods = GDK_CONTROL_MASK, | |
97 | - .activate = G_CALLBACK(fire_copy_accelerator) | |
98 | - }, | |
99 | - | |
100 | - { | |
101 | - .operation = ACCEL_OPERATION_CUT|V3270_COPY_APPEND, | |
102 | - .name = "cut-append", | |
103 | - .key = 'x', | |
104 | - .mods = GDK_ALT_MASK, | |
105 | - .activate = G_CALLBACK(fire_copy_accelerator) | |
106 | - }, | |
107 | - | |
108 | - { | |
109 | - .operation = ACCEL_OPERATION_CUT|V3270_COPY_TEXT, | |
110 | - .name = "cut-text", | |
111 | - .key = 'x', | |
112 | - .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | |
113 | - .activate = G_CALLBACK(fire_copy_accelerator) | |
114 | - }, | |
115 | - | |
116 | - { | |
117 | - .operation = ACCEL_OPERATION_DEFAULT, | |
118 | - .name = "paste", | |
119 | - .key = 'v', | |
120 | - .mods = GDK_CONTROL_MASK, | |
121 | - .activate = G_CALLBACK(fire_paste_accelerator) | |
122 | - }, | |
123 | - | |
124 | - { | |
125 | - .operation = 0, | |
126 | - .name = "zoom-in", | |
127 | - .key = GDK_KP_Add, | |
128 | - .mods = GDK_CONTROL_MASK, | |
129 | - .activate = G_CALLBACK(fire_zoom_action) | |
130 | - }, | |
131 | - | |
132 | - { | |
133 | - .operation = 1, | |
134 | - .name = "zoom-out", | |
135 | - .key = GDK_KP_Subtract, | |
136 | - .mods = GDK_CONTROL_MASK, | |
137 | - .activate = G_CALLBACK(fire_zoom_action) | |
138 | - }, | |
139 | - | |
140 | - { | |
141 | - .operation = 2, | |
142 | - .name = "zoom-fit-best", | |
143 | - .key = '0', | |
144 | - .mods = GDK_CONTROL_MASK, | |
145 | - .activate = G_CALLBACK(fire_zoom_action) | |
146 | - }, | |
147 | - | |
148 | - }; | |
149 | - | |
150 | 47 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
151 | 48 | |
152 | 49 | static int fire_lib3270_action(GtkWidget *widget, const LIB3270_ACTION * action) |
... | ... | @@ -171,7 +68,7 @@ |
171 | 68 | return lib3270_toggle(v3270_get_session(widget),action->id); |
172 | 69 | } |
173 | 70 | |
174 | - static int fire_keypad_action(GtkWidget *widget, const struct InternalAction * action) | |
71 | + int fire_keypad_action(GtkWidget *widget, const struct _v3270_action * action) | |
175 | 72 | { |
176 | 73 | int rc = 0; |
177 | 74 | debug("%s",__FUNCTION__); |
... | ... | @@ -192,12 +89,6 @@ |
192 | 89 | |
193 | 90 | } |
194 | 91 | |
195 | - static int fire_zoom_action(GtkWidget *widget, const struct InternalAction * action) | |
196 | - { | |
197 | - debug("%s",__FUNCTION__); | |
198 | - return 0; | |
199 | - } | |
200 | - | |
201 | 92 | void v3270_init_accelerators(v3270 *widget) |
202 | 93 | { |
203 | 94 | size_t ix; |
... | ... | @@ -267,15 +158,17 @@ |
267 | 158 | { |
268 | 159 | size_t ix; |
269 | 160 | |
270 | - for(ix = 0 ; ix < G_N_ELEMENTS(InternalActions); ix++) | |
161 | + const V3270_ACTION * actions = v3270_get_actions(); | |
162 | + | |
163 | + for(ix = 0 ; actions[ix].name; ix++) | |
271 | 164 | { |
272 | 165 | V3270Accelerator * accelerator = g_new0(V3270Accelerator,1); |
273 | 166 | |
274 | 167 | accelerator->type = V3270_ACCELERATOR_TYPE_INTERNAL; |
275 | - accelerator->arg = (gconstpointer) &InternalActions[ix]; | |
276 | - accelerator->activate = InternalActions[ix].activate; | |
277 | - accelerator->key = InternalActions[ix].key; | |
278 | - accelerator->mods = InternalActions[ix].mods; | |
168 | + accelerator->arg = (gconstpointer) &actions[ix]; | |
169 | + accelerator->activate = G_CALLBACK(actions[ix].activate); | |
170 | + accelerator->key = actions[ix].key; | |
171 | + accelerator->mods = actions[ix].mods; | |
279 | 172 | |
280 | 173 | widget->accelerators = g_slist_prepend(widget->accelerators,accelerator); |
281 | 174 | ... | ... |
src/terminal/keyboard/private.h
... | ... | @@ -32,25 +32,6 @@ |
32 | 32 | #include <v3270/actions.h> |
33 | 33 | #include <internals.h> |
34 | 34 | |
35 | - enum | |
36 | - { | |
37 | - ACCEL_OPERATION_DEFAULT = 0x00000000, | |
38 | - ACCEL_OPERATION_CUT = 0x10000000, | |
39 | - }; | |
35 | + G_GNUC_INTERNAL void v3270_accelerator_map_sort(v3270 *widget); | |
40 | 36 | |
41 | - #define ACCEL_OPERATION_MASK (ACCEL_OPERATION_CUT|ACCEL_OPERATION_APPEND) | |
42 | - | |
43 | - struct InternalAction | |
44 | - { | |
45 | - unsigned int operation; | |
46 | - const gchar * name; | |
47 | - guint key; | |
48 | - GdkModifierType mods; | |
49 | - GCallback activate; | |
50 | - }; | |
51 | - | |
52 | - G_GNUC_INTERNAL void v3270_accelerator_map_sort(v3270 *widget); | |
53 | - | |
54 | - G_GNUC_INTERNAL int fire_copy_accelerator(GtkWidget *widget, const struct InternalAction * action); | |
55 | - G_GNUC_INTERNAL int fire_paste_accelerator(GtkWidget *widget, const struct InternalAction * action); | |
56 | 37 | ... | ... |
v3270.cbp
... | ... | @@ -222,6 +222,10 @@ |
222 | 222 | <Unit filename="src/terminal/actions.c"> |
223 | 223 | <Option compilerVar="CC" /> |
224 | 224 | </Unit> |
225 | + <Unit filename="src/terminal/actions/private.h" /> | |
226 | + <Unit filename="src/terminal/actions/table.c"> | |
227 | + <Option compilerVar="CC" /> | |
228 | + </Unit> | |
225 | 229 | <Unit filename="src/terminal/blink.c"> |
226 | 230 | <Option compilerVar="CC" /> |
227 | 231 | </Unit> |
... | ... | @@ -281,6 +285,9 @@ |
281 | 285 | <Option compilerVar="CC" /> |
282 | 286 | </Unit> |
283 | 287 | <Unit filename="src/terminal/keyboard/private.h" /> |
288 | + <Unit filename="src/terminal/keyboard/zoom.c"> | |
289 | + <Option compilerVar="CC" /> | |
290 | + </Unit> | |
284 | 291 | <Unit filename="src/terminal/keyfile.c"> |
285 | 292 | <Option compilerVar="CC" /> |
286 | 293 | </Unit> | ... | ... |