Commit 1ba70be989a5ad0b5c85942beb1be7ab63cc9968
1 parent
10dc406f
Exists in
master
and in
5 other branches
Incluindo tratamento das teclas +/- do teclado numérico na versão 5
Showing
3 changed files
with
59 additions
and
0 deletions
Show diff stats
src/gtk/actions.c
| ... | ... | @@ -156,6 +156,28 @@ static void paste_next_action(GtkAction *action, GtkWidget *widget) |
| 156 | 156 | lib3270_pastenext(v3270_get_session(widget)); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | +static void kp_subtract_action(GtkAction *action, GtkWidget *widget) | |
| 160 | +{ | |
| 161 | + trace_action(action,widget); | |
| 162 | + | |
| 163 | + if(v3270_get_toggle(widget,LIB3270_TOGGLE_KP_ALTERNATIVE)) | |
| 164 | + v3270_backtab(widget); | |
| 165 | + else | |
| 166 | + v3270_set_string(widget,"-"); | |
| 167 | + | |
| 168 | +} | |
| 169 | + | |
| 170 | +static void kp_add_action(GtkAction *action, GtkWidget *widget) | |
| 171 | +{ | |
| 172 | + trace_action(action,widget); | |
| 173 | + | |
| 174 | + if(v3270_get_toggle(widget,LIB3270_TOGGLE_KP_ALTERNATIVE)) | |
| 175 | + v3270_tab(widget); | |
| 176 | + else | |
| 177 | + v3270_set_string(widget,"+"); | |
| 178 | + | |
| 179 | +} | |
| 180 | + | |
| 159 | 181 | static void connect_standard_action(GtkAction *action, GtkWidget *widget, const gchar *name) |
| 160 | 182 | { |
| 161 | 183 | #undef DECLARE_LIB3270_ACTION |
| ... | ... | @@ -193,6 +215,8 @@ static void connect_standard_action(GtkAction *action, GtkWidget *widget, const |
| 193 | 215 | { "hostname", hostname_action }, |
| 194 | 216 | { "editcolors", editcolors_action }, |
| 195 | 217 | { "about", about_dialog_action }, |
| 218 | + { "kpsubtract", kp_subtract_action }, | |
| 219 | + { "kpadd", kp_add_action }, | |
| 196 | 220 | }; |
| 197 | 221 | |
| 198 | 222 | int f; | ... | ... |
src/gtk/v3270/keyboard.c
| ... | ... | @@ -192,6 +192,37 @@ |
| 192 | 192 | |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | + void v3270_tab(GtkWidget *widget) | |
| 196 | + { | |
| 197 | + g_return_if_fail(GTK_IS_V3270(widget)); | |
| 198 | + lib3270_tab(GTK_V3270(widget)->host); | |
| 199 | + } | |
| 200 | + | |
| 201 | + void v3270_backtab(GtkWidget *widget) | |
| 202 | + { | |
| 203 | + g_return_if_fail(GTK_IS_V3270(widget)); | |
| 204 | + lib3270_backtab(GTK_V3270(widget)->host); | |
| 205 | + } | |
| 206 | + | |
| 207 | + void v3270_set_string(GtkWidget *widget, const gchar *str) | |
| 208 | + { | |
| 209 | + H3270 *host; | |
| 210 | + gchar *utf; | |
| 211 | + | |
| 212 | + g_return_if_fail(GTK_IS_V3270(widget)); | |
| 213 | + | |
| 214 | + host = GTK_V3270(widget)->host; | |
| 215 | + | |
| 216 | + utf = g_convert((char *) str, -1, lib3270_get_charset(host), "UTF-8", NULL, NULL, NULL); | |
| 217 | + | |
| 218 | + if(utf) | |
| 219 | + { | |
| 220 | + lib3270_set_string(host, (const unsigned char *) utf); | |
| 221 | + g_free(utf); | |
| 222 | + } | |
| 223 | + | |
| 224 | + } | |
| 225 | + | |
| 195 | 226 | void v3270_key_commit(GtkIMContext *imcontext, gchar *str, v3270 *widget) |
| 196 | 227 | { |
| 197 | 228 | gchar *utf = g_convert((char *) str, -1, lib3270_get_charset(widget->host), "UTF-8", NULL, NULL, NULL); | ... | ... |
src/gtk/v3270/v3270.h
| ... | ... | @@ -158,6 +158,10 @@ |
| 158 | 158 | gchar * v3270_get_text(GtkWidget *widget,int offset, int len); |
| 159 | 159 | gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboolean all); |
| 160 | 160 | |
| 161 | + void v3270_set_string(GtkWidget *widget, const gchar *str); | |
| 162 | + void v3270_tab(GtkWidget *widget); | |
| 163 | + void v3270_backtab(GtkWidget *widget); | |
| 164 | + | |
| 161 | 165 | // Cut & Paste |
| 162 | 166 | gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end); |
| 163 | 167 | void v3270_unselect(GtkWidget *widget); | ... | ... |