Commit bccf6df4a9e7cfaa1f0c3e3bff6b802d85187d46

Authored by perry.werneck@gmail.com
1 parent 9799eeb1

Limpando um pouco mais os fontes

src/gtk/actions.c
... ... @@ -163,6 +163,8 @@ void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name,
163 163  
164 164 if(toggle != -1)
165 165 {
  166 + GtkAction **list = (GtkAction **) g_object_get_data(G_OBJECT(widget),"toggle_actions");
  167 + list[toggle] = action;
166 168 g_object_set_data(G_OBJECT(action),"toggle_id",(gpointer) toggle);
167 169 gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(action),(lib3270_get_toggle(GTK_V3270(widget)->host,toggle) != 0));
168 170 g_signal_connect(action,"toggled",G_CALLBACK(lib3270_toggle_action),widget);
... ... @@ -175,6 +177,11 @@ void ui_connect_toggle(GtkAction *action, GtkWidget *widget, const gchar *name,
175 177 gtk_action_set_sensitive(action,FALSE);
176 178 }
177 179  
  180 +void ui_connect_target_action(GtkAction *action, GtkWidget *widget, const gchar *target, const gchar *direction, GError **error)
  181 +{
  182 + #warning TODO: Implementar
  183 +}
  184 +
178 185 static void action_pfkey(GtkAction *action, GtkWidget *widget)
179 186 {
180 187 trace("Action %s activated on widget %p key=%d",gtk_action_get_name(action),widget,g_object_get_data(G_OBJECT(action),"pfkey"));
... ... @@ -208,6 +215,11 @@ static void action_unfullscreen(GtkAction *action, GtkWidget *widget)
208 215 lib3270_set_toggle(GTK_V3270(widget)->host,LIB3270_TOGGLE_FULL_SCREEN,0);
209 216 }
210 217  
  218 +static void action_pastnext(GtkAction *action, GtkWidget *widget)
  219 +{
  220 + lib3270_pastenext(GTK_V3270(widget)->host);
  221 +}
  222 +
211 223 void ui_connect_pakey(GtkAction *action, GtkWidget *widget, const gchar *name, const gchar *id)
212 224 {
213 225 g_object_set_data(G_OBJECT(action),"pakey",(gpointer) atoi(id));
... ... @@ -221,6 +233,7 @@ void ui_connect_index_action(GtkAction *action, GtkWidget *widget, int ix, GtkAc
221 233 switch(ix)
222 234 {
223 235 case ACTION_PASTENEXT:
  236 + g_signal_connect(action,"activate",G_CALLBACK(action_pastnext),widget);
224 237 break;
225 238  
226 239 case ACTION_FULLSCREEN:
... ...
src/gtk/mainwindow.c
... ... @@ -83,6 +83,7 @@
83 83  
84 84 static void toggle_changed(GtkWidget *widget, LIB3270_TOGGLE id, gboolean toggled, const gchar *name, GtkWindow *toplevel)
85 85 {
  86 + GtkAction **list = (GtkAction **) g_object_get_data(G_OBJECT(widget),"toggle_actions");
86 87 gchar *nm = g_ascii_strdown(name,-1);
87 88 set_boolean_to_config("toggle",nm,toggled);
88 89 g_free(nm);
... ... @@ -95,7 +96,8 @@
95 96 gtk_window_unfullscreen(GTK_WINDOW(toplevel));
96 97 }
97 98  
98   - #warning TODO: Update toggle actions.
  99 + if(list[id])
  100 + gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(list[id]),toggled);
99 101  
100 102 }
101 103  
... ... @@ -286,6 +288,7 @@
286 288 GtkWidget **popup;
287 289 int f;
288 290  
  291 + g_object_set_data_full(G_OBJECT(terminal),"toggle_actions",g_new0(GtkAction *,LIB3270_TOGGLE_COUNT),g_free);
289 292 // Initialize terminal config
290 293 for(f=0;f<G_N_ELEMENTS(widget_config);f++)
291 294 {
... ...
src/include/lib3270.h
... ... @@ -105,6 +105,13 @@
105 105  
106 106 } LIB3270_TOGGLE;
107 107  
  108 + typedef enum _lib3270_direction
  109 + {
  110 + LIB3270_DIR_UP,
  111 + LIB3270_DIR_DOWN,
  112 + LIB3270_DIR_LEFT,
  113 + LIB3270_DIR_RIGHT
  114 + } LIB3270_DIRECTION;
108 115  
109 116 /**
110 117 * Toggle types.
... ...
src/include/lib3270/selection.h
... ... @@ -51,17 +51,27 @@
51 51 */
52 52 LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str);
53 53  
54   - /**
55   - * Paste remaining string.
56   - *
57   - * @param h Session handle.
58   - *
59   - * @see lib3270_paste.
60   - *
61   - * @return Non 0 if there's more to paste.
62   - *
63   - */
64   - LIB3270_EXPORT int lib3270_pastenext(H3270 *h);
  54 + /**
  55 + * Paste remaining string.
  56 + *
  57 + * @param h Session handle.
  58 + *
  59 + * @see lib3270_paste.
  60 + *
  61 + * @return Non 0 if there's more to paste.
  62 + *
  63 + */
  64 + LIB3270_EXPORT int lib3270_pastenext(H3270 *h);
  65 +
  66 + /**
  67 + * Move selected box 1 char in the selected direction.
  68 + *
  69 + * @param h Session handle.
  70 + * @param dir Direction to move
  71 + *
  72 + * @return 0 if the movement can be done, non zero if failed.
  73 + */
  74 + LIB3270_EXPORT int lib3270_move_selection(H3270 *h, LIB3270_DIRECTION dir);
65 75  
66 76  
67 77 #endif // LIB3270_SELECTION_H_INCLUDED
... ...
src/lib3270/actions.c
... ... @@ -52,9 +52,9 @@
52 52 #if defined(X3270_FT) /*[*/
53 53 #include "ftc.h"
54 54 #endif /*]*/
55   -#if defined(X3270_DISPLAY) /*[*/
56   -#include "keypadc.h"
57   -#endif /*]*/
  55 +// #if defined(X3270_DISPLAY)
  56 +// #include "keypadc.h"
  57 +//#endif
58 58 #if defined(X3270_DISPLAY) || defined(C3270) || defined(WC3270) /*[*/
59 59 #include "screenc.h"
60 60 #endif /*]*/
... ...
src/lib3270/ansi.c
... ... @@ -44,7 +44,7 @@
44 44 #endif /*]*/
45 45  
46 46 #include "appres.h"
47   -#include "ctlr.h"
  47 +// #include "ctlr.h"
48 48 #if defined(X3270_DBCS) /*[*/
49 49 #include "3270ds.h"
50 50 #endif /*]*/
... ... @@ -714,8 +714,7 @@ ansi_erase_in_display(int nn, int ig2 unused)
714 714 ctlr_aclear(0, h3270.cursor_addr + 1, 1);
715 715 break;
716 716 case 2: /* all (without moving cursor) */
717   - if (h3270.cursor_addr == 0 && !h3270.is_altbuffer)
718   - scroll_save(h3270.rows, True);
  717 +// if (h3270.cursor_addr == 0 && !h3270.is_altbuffer) scroll_save(h3270.rows, True);
719 718 ctlr_aclear(0, h3270.rows * h3270.cols, 1);
720 719 break;
721 720 }
... ... @@ -1663,9 +1662,10 @@ ansi_scroll(void)
1663 1662 held_wrap = False;
1664 1663  
1665 1664 /* Save the top line */
1666   - if (scroll_top == 1 && scroll_bottom == h3270.rows) {
1667   - if (!h3270.is_altbuffer)
1668   - scroll_save(1, False);
  1665 + if (scroll_top == 1 && scroll_bottom == h3270.rows)
  1666 + {
  1667 +// if (!h3270.is_altbuffer)
  1668 +// scroll_save(1, False);
1669 1669 ctlr_scroll();
1670 1670 return;
1671 1671 }
... ... @@ -1720,7 +1720,7 @@ ansi_process(unsigned int c)
1720 1720 c &= 0xff;
1721 1721 ansi_ch = c;
1722 1722  
1723   - scroll_to_bottom();
  1723 +// scroll_to_bottom();
1724 1724  
1725 1725 #if defined(X3270_TRACE) /*[*/
1726 1726 if (toggled(SCREEN_TRACE))
... ...
src/lib3270/childc.h
... ... @@ -17,10 +17,12 @@
17 17 * Global declarations for child.c.
18 18 */
19 19  
20   -#if defined(X3270_DISPLAY) || defined(C3270) /*[*/
  20 +/*
  21 +#if defined(X3270_DISPLAY) || defined(C3270)
21 22 LIB3270_INTERNAL int fork_child(void);
22 23 LIB3270_INTERNAL void child_ignore_output(void);
23   -#else /*][*/
  24 +#else
24 25 #define fork_child() fork()
25 26 #define child_ignore_output()
26   -#endif /*]*/
  27 +#endif
  28 +*/
... ...
src/lib3270/ctlr.c
... ... @@ -42,7 +42,7 @@
42 42 #include <errno.h>
43 43 #include "3270ds.h"
44 44 #include "appres.h"
45   -#include "ctlr.h"
  45 +// #include "ctlr.h"
46 46 #include "screen.h"
47 47 #include "resources.h"
48 48  
... ... @@ -503,7 +503,7 @@ process_ds(unsigned char *buf, int buflen)
503 503 if (!buflen)
504 504 return PDS_OKAY_NO_OUTPUT;
505 505  
506   - scroll_to_bottom();
  506 +// scroll_to_bottom();
507 507  
508 508 trace_ds("< ");
509 509  
... ... @@ -2329,7 +2329,7 @@ ctlr_clear(H3270 *session, Boolean can_snap)
2329 2329 if (can_snap && !trace_skipping && toggled(SCREEN_TRACE))
2330 2330 trace_screen();
2331 2331 #endif /*]*/
2332   - scroll_save(session->maxROWS, ever_3270 ? False : True);
  2332 +// scroll_save(session->maxROWS, ever_3270 ? False : True);
2333 2333 }
2334 2334 #if defined(X3270_TRACE) /*[*/
2335 2335 trace_skipping = False;
... ... @@ -2389,7 +2389,7 @@ ctlr_add(int baddr, unsigned char c, unsigned char cs)
2389 2389 if (toggled(SCREEN_TRACE))
2390 2390 trace_screen();
2391 2391 #endif /*]*/
2392   - scroll_save(session->maxROWS, False);
  2392 +// scroll_save(session->maxROWS, False);
2393 2393 trace_primed = False;
2394 2394 }
2395 2395 /*
... ...
src/lib3270/ctlr.h
... ... @@ -17,5 +17,7 @@
17 17 * External declarations for ctlr.c data structures.
18 18 */
19 19  
  20 + #warning Deprecated ctlr.h, please remove it
  21 +
20 22 // extern int buffer_addr; /**< buffer address */
21 23 // extern struct ea *ea_buf; /**< 3270 device buffer */
... ...
src/lib3270/dialogc.h
... ... @@ -16,3 +16,5 @@
16 16 * dialogc.h
17 17 * Empty definitions for dialog.c.
18 18 */
  19 +
  20 +#warning deprecated dialogc.h
... ...
src/lib3270/ft.c
... ... @@ -43,7 +43,7 @@
43 43 #include "ft_cutc.h"
44 44 #include "ft_dftc.h"
45 45 #include "ftc.h"
46   -#include "dialogc.h"
  46 +// #include "dialogc.h"
47 47 #include "hostc.h"
48 48 #if defined(C3270) || defined(WC3270)
49 49 #include "icmdc.h"
... ...
src/lib3270/ft_cut.c
... ... @@ -44,7 +44,7 @@
44 44 // #include <lib3270/api.h>
45 45  
46 46 #include "appres.h"
47   -#include "ctlr.h"
  47 +// #include "ctlr.h"
48 48 #include "3270ds.h"
49 49  
50 50 #include "actionsc.h"
... ...
src/lib3270/keypadc.h
... ... @@ -17,17 +17,14 @@
17 17 * Global declarations for keypad.c.
18 18 */
19 19  
20   -LIB3270_INTERNAL Boolean keypad_changed;
21   -
22   -#if defined(X3270_KEYPAD) /*[*/
  20 +// LIB3270_INTERNAL Boolean keypad_changed;
  21 +/*
  22 +#if defined(X3270_KEYPAD)
23 23  
24   -LIB3270_INTERNAL enum kp_placement {
25   - kp_right, kp_left, kp_bottom, kp_integral, kp_inside_right
26   -} kp_placement;
  24 +LIB3270_INTERNAL enum kp_placement { kp_right, kp_left, kp_bottom, kp_integral, kp_inside_right } kp_placement;
27 25  
28 26 LIB3270_INTERNAL void keypad_first_up(void);
29   -LIB3270_INTERNAL Widget keypad_init(Widget container, Dimension voffset,
30   - Dimension screen_width, Boolean floating, Boolean vert);
  27 +LIB3270_INTERNAL Widget keypad_init(Widget container, Dimension voffset, Dimension screen_width, Boolean floating, Boolean vert);
31 28 LIB3270_INTERNAL void keypad_move(void);
32 29 LIB3270_INTERNAL void keypad_placement_init(void);
33 30 LIB3270_INTERNAL void keypad_popup_init(void);
... ... @@ -37,7 +34,7 @@ LIB3270_INTERNAL void keypad_set_temp_keymap(XtTranslations trans);
37 34 LIB3270_INTERNAL void keypad_shift(void);
38 35 LIB3270_INTERNAL Dimension min_keypad_width(void);
39 36  
40   -#else /*][*/
  37 +#else
41 38  
42 39 #define keypad_qheight() 0
43 40 #define min_keypad_width() 0
... ... @@ -50,4 +47,5 @@ LIB3270_INTERNAL Dimension min_keypad_width(void);
50 47 #define keypad_set_temp_keymap(n)
51 48 #define keypad_shift()
52 49  
53   -#endif /*]*/
  50 +#endif
  51 +*/
... ...
src/lib3270/kybd.c
... ... @@ -49,7 +49,7 @@
49 49 #include <fcntl.h>
50 50 #include "3270ds.h"
51 51 #include "appres.h"
52   -#include "ctlr.h"
  52 +// #include "ctlr.h"
53 53 #include "resources.h"
54 54  
55 55 #include "actionsc.h"
... ... @@ -58,7 +58,7 @@
58 58 #include "ctlrc.h"
59 59 #include "ftc.h"
60 60 #include "hostc.h"
61   -#include "keypadc.h"
  61 +// #include "keypadc.h"
62 62 #include "kybdc.h"
63 63 #include "popupsc.h"
64 64 #include "printc.h"
... ... @@ -232,7 +232,7 @@ static int enq_chk(void)
232 232 else
233 233 {
234 234 ta_head = ta;
235   - status_typeahead(True);
  235 + status_typeahead(&h3270,True);
236 236 }
237 237 ta_tail = ta;
238 238  
... ... @@ -263,7 +263,7 @@ static void enq_ta(XtActionProc fn, char *parm1, char *parm2)
263 263 ta_tail->next = ta;
264 264 else {
265 265 ta_head = ta;
266   - status_typeahead(True);
  266 + status_typeahead(&h3270,True);
267 267 }
268 268 ta_tail = ta;
269 269  
... ... @@ -282,7 +282,7 @@ Boolean run_ta(void)
282 282  
283 283 if ((ta_head = ta->next) == (struct ta *)NULL) {
284 284 ta_tail = (struct ta *)NULL;
285   - status_typeahead(False);
  285 + status_typeahead(&h3270,False);
286 286 }
287 287  
288 288 switch(ta->type)
... ... @@ -337,7 +337,7 @@ flush_ta(void)
337 337 any = True;
338 338 }
339 339 ta_head = ta_tail = (struct ta *) NULL;
340   - status_typeahead(False);
  340 + status_typeahead(&h3270,False);
341 341 return any;
342 342 }
343 343  
... ...
src/lib3270/objects.h
... ... @@ -17,10 +17,10 @@
17 17 * x3270 object names.
18 18 */
19 19  
20   -#define ObjConfirmButton "confirmButton"
21   -#define ObjConfirm2Button "confirm2Button"
22   -#define ObjCancelButton "cancelButton"
  20 +// #define ObjConfirmButton "confirmButton"
  21 +// #define ObjConfirm2Button "confirm2Button"
  22 +// #define ObjCancelButton "cancelButton"
23 23 #define ObjDialog "dialog"
24   -#define ObjSmallLabel "smallLabel"
  24 +// #define ObjSmallLabel "smallLabel"
25 25 #define ObjNameLabel "nameLabel"
26 26 #define ObjDataLabel "dataLabel"
... ...
src/lib3270/paste.c
... ... @@ -47,7 +47,7 @@
47 47 #include <fcntl.h>
48 48 #include "3270ds.h"
49 49 #include "appres.h"
50   -#include "ctlr.h"
  50 +// #include "ctlr.h"
51 51 #include "resources.h"
52 52  
53 53 #include "actionsc.h"
... ... @@ -56,7 +56,7 @@
56 56 #include "ctlrc.h"
57 57 #include "ftc.h"
58 58 #include "hostc.h"
59   -#include "keypadc.h"
  59 +// #include "keypadc.h"
60 60 #include "kybdc.h"
61 61 #include "popupsc.h"
62 62 #include "printc.h"
... ...
src/lib3270/print.c
... ... @@ -39,7 +39,7 @@
39 39  
40 40 #include "appres.h"
41 41 #include "3270ds.h"
42   -#include "ctlr.h"
  42 +// #include "ctlr.h"
43 43  
44 44 #include "ctlrc.h"
45 45 #include "tablesc.h"
... ...
src/lib3270/printer.c
... ... @@ -54,7 +54,7 @@
54 54 #include "appres.h"
55 55 #include "objects.h"
56 56 #include "resources.h"
57   -#include "ctlr.h"
  57 +// #include "ctlr.h"
58 58  
59 59 #include "charsetc.h"
60 60 #include "ctlrc.h"
... ...
src/lib3270/savec.h
... ... @@ -14,6 +14,9 @@
14 14  
15 15 /* Non-display version of savec.h */
16 16  
  17 +/*
  18 +
17 19 #define save_yourself()
18 20  
19 21 LIB3270_INTERNAL char *command_string;
  22 +*/
... ...
src/lib3270/screen.c
... ... @@ -40,7 +40,7 @@
40 40 #include "appres.h"
41 41 #include "3270ds.h"
42 42 #include "resources.h"
43   -#include "ctlr.h"
  43 +// #include "ctlr.h"
44 44  
45 45 #include "actionsc.h"
46 46 #include "ctlrc.h"
... ... @@ -708,7 +708,7 @@ LIB3270_EXPORT void lib3270_set_popup_handler(int (*handler)(H3270 *, LIB3270_NO
708 708 popup_handler = handler ? handler : logpopup;
709 709 }
710 710  
711   -LIB3270_EXPORT lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...)
  711 +LIB3270_EXPORT void lib3270_popup_dialog(H3270 *session, LIB3270_NOTIFY id , const char *title, const char *message, const char *fmt, ...)
712 712 {
713 713 va_list args;
714 714  
... ...
src/lib3270/screen.h
... ... @@ -14,9 +14,9 @@
14 14  
15 15 /* Non-display version of screen.h */
16 16  
17   -#define SELECTED(baddr) False
  17 +// #define SELECTED(baddr) False
18 18 LIB3270_INTERNAL int *char_width, *char_height;
19   -LIB3270_INTERNAL Boolean screen_has_changes;
  19 +// LIB3270_INTERNAL Boolean screen_has_changes;
20 20  
21 21 // LIB3270_INTERNAL void screen_update(H3270 *session, int bstart, int bend);
22 22  
... ...
src/lib3270/scrollc.h
... ... @@ -14,5 +14,5 @@
14 14  
15 15 /* Non-display version of scrollc.h */
16 16  
17   -#define scroll_save(n, trim_blanks)
18   -#define scroll_to_bottom()
  17 +// #define scroll_save(n, trim_blanks)
  18 +// #define scroll_to_bottom()
... ...
src/lib3270/selection.c
... ... @@ -28,7 +28,7 @@
28 28 */
29 29  
30 30 #include "globals.h"
31   - #include "ctlr.h"
  31 +// #include "ctlr.h"
32 32 #include "appres.h"
33 33 #include <lib3270.h>
34 34 #include <lib3270/session.h>
... ... @@ -347,3 +347,45 @@ LIB3270_EXPORT char * lib3270_get_selected(H3270 *hSession)
347 347 return realloc(ret,sz+1);
348 348 }
349 349  
  350 +LIB3270_EXPORT int lib3270_move_selection(H3270 *hSession, LIB3270_DIRECTION dir)
  351 +{
  352 + if(!hSession->selected || hSession->select.begin == hSession->select.end)
  353 + return ENOENT;
  354 +
  355 + switch(dir)
  356 + {
  357 + case LIB3270_DIR_UP:
  358 + if(hSession->select.begin <= hSession->cols)
  359 + return EINVAL;
  360 + hSession->select.begin -= hSession->cols;
  361 + hSession->select.end -= hSession->cols;
  362 + break;
  363 +
  364 + case LIB3270_DIR_DOWN:
  365 + if(hSession->select.end >= (hSession->cols * (hSession->rows-1)))
  366 + return EINVAL;
  367 + hSession->select.begin += hSession->cols;
  368 + hSession->select.end += hSession->cols;
  369 + break;
  370 +
  371 + case LIB3270_DIR_LEFT:
  372 + if( (hSession->select.begin % hSession->cols) < 1)
  373 + return EINVAL;
  374 + hSession->select.begin--;
  375 + hSession->select.end--;
  376 + break;
  377 +
  378 + case LIB3270_DIR_RIGHT:
  379 + if( (hSession->select.end % hSession->cols) >= hSession->cols)
  380 + return EINVAL;
  381 + hSession->select.begin++;
  382 + hSession->select.end++;
  383 + break;
  384 +
  385 + default:
  386 + return -1;
  387 + }
  388 +
  389 + update_selection(hSession);
  390 + return 0;
  391 +}
... ...
src/lib3270/sf.c
... ... @@ -45,7 +45,7 @@
45 45 #include "3270ds.h"
46 46 #include "appres.h"
47 47 #include "screen.h"
48   -#include "ctlr.h"
  48 +// #include "ctlr.h"
49 49 #include "resources.h"
50 50  
51 51 #include "charsetc.h"
... ...
src/lib3270/statusc.h
... ... @@ -34,7 +34,7 @@ LIB3270_INTERNAL void status_changed(H3270 *session, LIB3270_STATUS id);
34 34 LIB3270_INTERNAL void set_status(H3270 *session, OIA_FLAG id, Boolean on);
35 35  
36 36  
37   -#define status_typeahead(on) set_status(NULL,OIA_FLAG_TYPEAHEAD,on)
  37 +#define status_typeahead(h,on) set_status(h,OIA_FLAG_TYPEAHEAD,on)
38 38 #define status_kybdlock() status_changed(NULL,LIB3270_STATUS_KYBDLOCK)
39 39 #define status_syswait() status_changed(NULL,LIB3270_STATUS_SYSWAIT)
40 40 #define status_minus() status_changed(NULL,LIB3270_STATUS_MINUS)
... ...
src/lib3270/trace_ds.c
... ... @@ -56,7 +56,7 @@
56 56 #include "appres.h"
57 57 #include "objects.h"
58 58 #include "resources.h"
59   -#include "ctlr.h"
  59 +// #include "ctlr.h"
60 60  
61 61 #include "charsetc.h"
62 62 #include "childc.h"
... ... @@ -422,7 +422,7 @@ create_tracefile_header(const char *mode)
422 422 clk = time((time_t *)0);
423 423 wtrace("Trace %s %s", mode, ctime(&clk));
424 424 wtrace(" Version: %s\n", build);
425   - save_yourself();
  425 +// save_yourself();
426 426 // wtrace(" Command: %s\n", command_string);
427 427 wtrace(" Model %s", h3270.model_name);
428 428 wtrace(", %s display", appres.mono ? "monochrome" : "color");
... ...