Commit fc6ea015015c0e8908465ae2e27cd1ddfdbc2a12
1 parent
e2199827
Exists in
master
and in
1 other branch
Adding print and save actions in a more standard format.
Showing
5 changed files
with
217 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
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_print_action(GtkWidget *widget, const V3270_ACTION *action) { | ||
38 | + | ||
39 | + debug("%s",__FUNCTION__); | ||
40 | + | ||
41 | + switch( ((int) action->flags) ) | ||
42 | + { | ||
43 | + case -1: // Default action (depends on selection) | ||
44 | + v3270_print(widget,NULL); | ||
45 | + break; | ||
46 | + | ||
47 | + case LIB3270_CONTENT_ALL: // All terminal contents | ||
48 | + v3270_print_all(widget,NULL); | ||
49 | + break; | ||
50 | + | ||
51 | + case LIB3270_CONTENT_SELECTED: // Only selected area. | ||
52 | + v3270_print_selected(widget,NULL); | ||
53 | + break; | ||
54 | + | ||
55 | + case LIB3270_CONTENT_COPY: // Copy buffer. | ||
56 | + v3270_print_copy(widget,NULL); | ||
57 | + break; | ||
58 | + | ||
59 | + default: | ||
60 | + g_warning("Unexpected print flags %u",(unsigned int) action->flags); | ||
61 | + } | ||
62 | + | ||
63 | + return 0; | ||
64 | + } | ||
65 | + | ||
66 | + |
src/terminal/actions/private.h
@@ -35,5 +35,7 @@ | @@ -35,5 +35,7 @@ | ||
35 | G_GNUC_INTERNAL int fire_copy_accelerator(GtkWidget *widget, const V3270_ACTION *action); | 35 | G_GNUC_INTERNAL int fire_copy_accelerator(GtkWidget *widget, const V3270_ACTION *action); |
36 | G_GNUC_INTERNAL int fire_paste_accelerator(GtkWidget *widget, const V3270_ACTION *action); | 36 | G_GNUC_INTERNAL int fire_paste_accelerator(GtkWidget *widget, const V3270_ACTION *action); |
37 | G_GNUC_INTERNAL int fire_zoom_action(GtkWidget *widget, const V3270_ACTION *action); | 37 | G_GNUC_INTERNAL int fire_zoom_action(GtkWidget *widget, const V3270_ACTION *action); |
38 | + G_GNUC_INTERNAL int fire_save_action(GtkWidget *widget, const V3270_ACTION *action); | ||
39 | + G_GNUC_INTERNAL int fire_print_action(GtkWidget *widget, const V3270_ACTION *action); | ||
38 | G_GNUC_INTERNAL int fire_keypad_action(GtkWidget *widget, const V3270_ACTION *action); | 40 | G_GNUC_INTERNAL int fire_keypad_action(GtkWidget *widget, const V3270_ACTION *action); |
39 | 41 |
@@ -0,0 +1,56 @@ | @@ -0,0 +1,56 @@ | ||
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 <terminal.h> | ||
33 | + #include <v3270/dialogs.h> | ||
34 | + #include <lib3270/trace.h> | ||
35 | + #include <lib3270/log.h> | ||
36 | + | ||
37 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
38 | + | ||
39 | + int fire_save_action(GtkWidget *widget, const V3270_ACTION *action) { | ||
40 | + | ||
41 | + LIB3270_CONTENT_OPTION mode = (LIB3270_CONTENT_OPTION) action->flags; | ||
42 | + | ||
43 | + debug("%s(%d)",__FUNCTION__,((int) action->flags)); | ||
44 | + | ||
45 | + if(((int) action->flags) < 0) | ||
46 | + mode = lib3270_has_selection(GTK_V3270(widget)->host) ? LIB3270_CONTENT_SELECTED : LIB3270_CONTENT_ALL; | ||
47 | + | ||
48 | + GtkWidget *dialog = v3270_save_dialog_new(widget,mode,NULL); | ||
49 | + gtk_widget_show_all(dialog); | ||
50 | + v3270_save_dialog_run(dialog); | ||
51 | + gtk_widget_destroy(dialog); | ||
52 | + | ||
53 | + return 0; | ||
54 | + } | ||
55 | + | ||
56 | + |
src/terminal/actions/table.c
@@ -63,6 +63,7 @@ | @@ -63,6 +63,7 @@ | ||
63 | { | 63 | { |
64 | .flags = 0, | 64 | .flags = 0, |
65 | .name = "copy", | 65 | .name = "copy", |
66 | + .icon = "edit-copy", | ||
66 | .summary = N_( "Copy" ), | 67 | .summary = N_( "Copy" ), |
67 | .key = 'c', | 68 | .key = 'c', |
68 | .mods = GDK_CONTROL_MASK, | 69 | .mods = GDK_CONTROL_MASK, |
@@ -81,6 +82,7 @@ | @@ -81,6 +82,7 @@ | ||
81 | { | 82 | { |
82 | .flags = V3270_COPY_TEXT, | 83 | .flags = V3270_COPY_TEXT, |
83 | .name = "copy-text", | 84 | .name = "copy-text", |
85 | + .icon = "edit-copy", | ||
84 | .summary = N_( "Copy as plain text" ), | 86 | .summary = N_( "Copy as plain text" ), |
85 | .key = 'c', | 87 | .key = 'c', |
86 | .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | 88 | .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, |
@@ -90,6 +92,7 @@ | @@ -90,6 +92,7 @@ | ||
90 | { | 92 | { |
91 | .flags = V3270_ACTION_FLAG_CUT|V3270_COPY_DEFAULT, | 93 | .flags = V3270_ACTION_FLAG_CUT|V3270_COPY_DEFAULT, |
92 | .name = "cut", | 94 | .name = "cut", |
95 | + .icon = "edit-cut", | ||
93 | .summary = N_( "Cut" ), | 96 | .summary = N_( "Cut" ), |
94 | .key = 'x', | 97 | .key = 'x', |
95 | .mods = GDK_CONTROL_MASK, | 98 | .mods = GDK_CONTROL_MASK, |
@@ -108,6 +111,7 @@ | @@ -108,6 +111,7 @@ | ||
108 | { | 111 | { |
109 | .flags = V3270_ACTION_FLAG_CUT|V3270_COPY_TEXT, | 112 | .flags = V3270_ACTION_FLAG_CUT|V3270_COPY_TEXT, |
110 | .name = "cut-text", | 113 | .name = "cut-text", |
114 | + .icon = "edit-cut", | ||
111 | .summary = N_( "Cut as plain text" ), | 115 | .summary = N_( "Cut as plain text" ), |
112 | .key = 'x', | 116 | .key = 'x', |
113 | .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | 117 | .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, |
@@ -117,6 +121,7 @@ | @@ -117,6 +121,7 @@ | ||
117 | { | 121 | { |
118 | .flags = 0, | 122 | .flags = 0, |
119 | .name = "paste", | 123 | .name = "paste", |
124 | + .icon = "edit-paste", | ||
120 | .summary = N_("Paste"), | 125 | .summary = N_("Paste"), |
121 | .key = 'v', | 126 | .key = 'v', |
122 | .mods = GDK_CONTROL_MASK, | 127 | .mods = GDK_CONTROL_MASK, |
@@ -126,6 +131,7 @@ | @@ -126,6 +131,7 @@ | ||
126 | { | 131 | { |
127 | .flags = 1, | 132 | .flags = 1, |
128 | .name = "paste-text", | 133 | .name = "paste-text", |
134 | + .icon = "edit-paste", | ||
129 | .summary = N_("Paste as plain text"), | 135 | .summary = N_("Paste as plain text"), |
130 | .key = 'v', | 136 | .key = 'v', |
131 | .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, | 137 | .mods = GDK_SHIFT_MASK|GDK_CONTROL_MASK, |
@@ -144,6 +150,7 @@ | @@ -144,6 +150,7 @@ | ||
144 | { | 150 | { |
145 | .flags = 0, | 151 | .flags = 0, |
146 | .name = "zoom-in", | 152 | .name = "zoom-in", |
153 | + .icon = "zoom-in", | ||
147 | .summary = N_("Zoom in"), | 154 | .summary = N_("Zoom in"), |
148 | .key = GDK_KP_Add, | 155 | .key = GDK_KP_Add, |
149 | .mods = GDK_CONTROL_MASK, | 156 | .mods = GDK_CONTROL_MASK, |
@@ -154,6 +161,7 @@ | @@ -154,6 +161,7 @@ | ||
154 | .flags = 1, | 161 | .flags = 1, |
155 | .name = "zoom-out", | 162 | .name = "zoom-out", |
156 | .summary = N_("Zoom out"), | 163 | .summary = N_("Zoom out"), |
164 | + .icon = "zoom-out", | ||
157 | .key = GDK_KP_Subtract, | 165 | .key = GDK_KP_Subtract, |
158 | .mods = GDK_CONTROL_MASK, | 166 | .mods = GDK_CONTROL_MASK, |
159 | .activate = fire_zoom_action | 167 | .activate = fire_zoom_action |
@@ -163,11 +171,90 @@ | @@ -163,11 +171,90 @@ | ||
163 | .flags = 2, | 171 | .flags = 2, |
164 | .name = "zoom-fit-best", | 172 | .name = "zoom-fit-best", |
165 | .summary = N_("Zoom to best size"), | 173 | .summary = N_("Zoom to best size"), |
174 | + .icon = "zoom-fit-best", | ||
166 | .key = '0', | 175 | .key = '0', |
167 | .mods = GDK_CONTROL_MASK, | 176 | .mods = GDK_CONTROL_MASK, |
168 | .activate = fire_zoom_action | 177 | .activate = fire_zoom_action |
169 | }, | 178 | }, |
170 | 179 | ||
180 | + // | ||
181 | + // Save actions | ||
182 | + // | ||
183 | + { | ||
184 | + .flags = -1, | ||
185 | + .name = "save", | ||
186 | + .icon = "document-save-as", | ||
187 | + .summary = N_("Save screen or selection"), | ||
188 | + .activate = fire_save_action | ||
189 | + | ||
190 | + }, | ||
191 | + | ||
192 | + { | ||
193 | + .flags = LIB3270_CONTENT_ALL, | ||
194 | + .name = "save-all", | ||
195 | + .icon = "document-save-as", | ||
196 | + .summary = N_("Save screen"), | ||
197 | + .activate = fire_save_action | ||
198 | + | ||
199 | + }, | ||
200 | + | ||
201 | + { | ||
202 | + .flags = LIB3270_CONTENT_SELECTED, | ||
203 | + .name = "save-selected", | ||
204 | + .icon = "document-save-as", | ||
205 | + .summary = N_("Save selected area"), | ||
206 | + .activate = fire_save_action | ||
207 | + | ||
208 | + }, | ||
209 | + | ||
210 | + { | ||
211 | + .flags = LIB3270_CONTENT_COPY, | ||
212 | + .name = "save-copy", | ||
213 | + .icon = "document-save-as", | ||
214 | + .summary = N_("Save Copy"), | ||
215 | + .activate = fire_save_action | ||
216 | + | ||
217 | + }, | ||
218 | + | ||
219 | + // | ||
220 | + // Print actions | ||
221 | + // | ||
222 | + { | ||
223 | + .flags = -1, | ||
224 | + .name = "print", | ||
225 | + .icon = "document-print", | ||
226 | + .summary = N_("Print screen or selection"), | ||
227 | + .activate = fire_print_action | ||
228 | + | ||
229 | + }, | ||
230 | + | ||
231 | + { | ||
232 | + .flags = LIB3270_CONTENT_ALL, | ||
233 | + .name = "print-all", | ||
234 | + .icon = "document-print", | ||
235 | + .summary = N_("Print screen"), | ||
236 | + .activate = fire_print_action | ||
237 | + | ||
238 | + }, | ||
239 | + | ||
240 | + { | ||
241 | + .flags = LIB3270_CONTENT_SELECTED, | ||
242 | + .name = "print-selected", | ||
243 | + .icon = "document-print", | ||
244 | + .summary = N_("Print selected area"), | ||
245 | + .activate = fire_print_action | ||
246 | + | ||
247 | + }, | ||
248 | + | ||
249 | + { | ||
250 | + .flags = LIB3270_CONTENT_COPY, | ||
251 | + .name = "print-copy", | ||
252 | + .icon = "document-print", | ||
253 | + .summary = N_("Print Copy"), | ||
254 | + .activate = fire_print_action | ||
255 | + | ||
256 | + }, | ||
257 | + | ||
171 | { | 258 | { |
172 | .name = NULL | 259 | .name = NULL |
173 | } | 260 | } |
v3270.cbp
@@ -231,7 +231,13 @@ | @@ -231,7 +231,13 @@ | ||
231 | <Unit filename="src/terminal/actions/clipboard.c"> | 231 | <Unit filename="src/terminal/actions/clipboard.c"> |
232 | <Option compilerVar="CC" /> | 232 | <Option compilerVar="CC" /> |
233 | </Unit> | 233 | </Unit> |
234 | + <Unit filename="src/terminal/actions/print.c"> | ||
235 | + <Option compilerVar="CC" /> | ||
236 | + </Unit> | ||
234 | <Unit filename="src/terminal/actions/private.h" /> | 237 | <Unit filename="src/terminal/actions/private.h" /> |
238 | + <Unit filename="src/terminal/actions/save.c"> | ||
239 | + <Option compilerVar="CC" /> | ||
240 | + </Unit> | ||
235 | <Unit filename="src/terminal/actions/scroll.c"> | 241 | <Unit filename="src/terminal/actions/scroll.c"> |
236 | <Option compilerVar="CC" /> | 242 | <Option compilerVar="CC" /> |
237 | </Unit> | 243 | </Unit> |