Commit 5c0206d3665413be914bab73c814909b812cb47b

Authored by perry.werneck@gmail.com
1 parent 7c9366e0
Exists in master

Mais um lote de ajustes nos toggles para uso da estrutura de sessão

latest/src/include/lib3270/api.h
... ... @@ -267,12 +267,14 @@
267 267 void (*configure)(H3270 *session, unsigned short rows, unsigned short cols);
268 268 void (*update)(H3270 *session, int baddr, unsigned char c, unsigned short attr, unsigned char cursor);
269 269 void (*changed)(H3270 *session, int bstart, int bend);
  270 +
270 271 void (*update_cursor)(H3270 *session, unsigned short row, unsigned short col);
271 272 void (*update_oia)(H3270 *session, OIA_FLAG id, unsigned char on);
272   -
273   - void (*set_timer)(H3270 *session, unsigned char on);
  273 + void (*update_toggle)(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason, const char *name);
274 274 void (*update_luname)(H3270 *session, const char *name);
275 275 void (*update_status)(H3270 *session, LIB3270_STATUS id);
  276 +
  277 + void (*set_timer)(H3270 *session, unsigned char on);
276 278 void (*erase)(H3270 *session);
277 279 void (*cursor)(H3270 *session, LIB3270_CURSOR id);
278 280  
... ...
latest/src/lib/actions.c
... ... @@ -54,7 +54,7 @@
54 54 #endif /*]*/
55 55 #if defined(X3270_DISPLAY) /*[*/
56 56 #include "keypadc.h"
57   -#include "menubarc.h"
  57 +// #include "menubarc.h"
58 58 #endif /*]*/
59 59 #if defined(X3270_DISPLAY) || defined(C3270) || defined(WC3270) /*[*/
60 60 #include "screenc.h"
... ...
latest/src/lib/ansi.c
... ... @@ -1825,7 +1825,7 @@ ansi_send_pa(int nn)
1825 1825 net_sends(fn_buf);
1826 1826 }
1827 1827  
1828   -void toggle_lineWrap(struct toggle *t unused, LIB3270_TOGGLE_TYPE type unused)
  1828 +void toggle_lineWrap(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_TYPE type unused)
1829 1829 {
1830 1830 if (toggled(LINE_WRAP))
1831 1831 wraparound_mode = 1;
... ...
latest/src/lib/ansic.h
... ... @@ -29,7 +29,7 @@ LIB3270_INTERNAL void ansi_send_pa(int nn);
29 29 LIB3270_INTERNAL void ansi_send_pf(int nn);
30 30 LIB3270_INTERNAL void ansi_send_right(void);
31 31 LIB3270_INTERNAL void ansi_send_up(void);
32   -LIB3270_INTERNAL void toggle_lineWrap(struct toggle *t, LIB3270_TOGGLE_TYPE type);
  32 +LIB3270_INTERNAL void toggle_lineWrap(H3270 *session, struct toggle *t, LIB3270_TOGGLE_TYPE type);
33 33  
34 34 #else /*][*/
35 35  
... ...
latest/src/lib/glue.c
... ... @@ -63,7 +63,7 @@
63 63 // #include "keymapc.h"
64 64 #include "kybdc.h"
65 65 //#include "macrosc.h"
66   -#include "menubarc.h"
  66 +// #include "menubarc.h"
67 67 #include "popupsc.h"
68 68 #include "screenc.h"
69 69 // #include "selectc.h"
... ...
latest/src/lib/host.c
... ... @@ -45,7 +45,7 @@
45 45 #include "actionsc.h"
46 46 #include "hostc.h"
47 47 // #include "macrosc.h"
48   -#include "menubarc.h"
  48 +// #include "menubarc.h"
49 49 #include "popupsc.h"
50 50 #include "telnetc.h"
51 51 #include "trace_dsc.h"
... ...
latest/src/lib/menubarc.h
... ... @@ -17,30 +17,33 @@
17 17 * Global declarations for menubar.c.
18 18 */
19 19  
20   -#if defined(X3270_MENUS) /*[*/
21   -
22   -LIB3270_INTERNAL void HandleMenu_action(Widget w, XEvent *event, String *params,
23   - Cardinal *num_params);
24   -#if defined(X3270_SCRIPT) /*[*/
25   -LIB3270_INTERNAL void menubar_as_set(Boolean sensitive);
26   -#else /*][*/
27   -#define menubar_as_set(n)
28   -#endif /*]*/
29   -LIB3270_INTERNAL void menubar_init(Widget container, Dimension overall_width,
30   - Dimension current_width);
31   -LIB3270_INTERNAL void menubar_keypad_changed(void);
32   -LIB3270_INTERNAL Dimension menubar_qheight(Dimension container_width);
33   -LIB3270_INTERNAL void menubar_resize(Dimension width);
34   -LIB3270_INTERNAL void menubar_retoggle(struct toggle *t);
35   -
36   -#else /*][*/
37   -
38   -#define menubar_as_set(n)
39   -#define menubar_init(a, b, c)
40   -#define menubar_keypad_changed()
41   -#define menubar_qheight(n) 0
42   -#define menubar_resize(n)
43   -#define menubar_retoggle(t)
44   -#define HandleMenu_action ignore_action
45   -
46   -#endif /*]*/
  20 +#warning menubarc.h is deprecated
  21 +
  22 +/*
  23 +#if defined(X3270_MENUS)
  24 +
  25 +// LIB3270_INTERNAL void HandleMenu_action(Widget w, XEvent *event, String *params,Cardinal *num_params);
  26 +// #if defined(X3270_SCRIPT)
  27 +// LIB3270_INTERNAL void menubar_as_set(Boolean sensitive);
  28 +// #else
  29 +// #define menubar_as_set(n)
  30 +// #endif
  31 +
  32 +// LIB3270_INTERNAL void menubar_init(Widget container, Dimension overall_width,Dimension current_width);
  33 +// LIB3270_INTERNAL void menubar_keypad_changed(void);
  34 +// LIB3270_INTERNAL Dimension menubar_qheight(Dimension container_width);
  35 +// LIB3270_INTERNAL void menubar_resize(Dimension width);
  36 +// LIB3270_INTERNAL void menubar_retoggle(struct toggle *t);
  37 +
  38 +#else
  39 +
  40 +// #define menubar_as_set(n)
  41 +// #define menubar_init(a, b, c)
  42 +// #define menubar_keypad_changed()
  43 +// #define menubar_qheight(n) 0
  44 +// #define menubar_resize(n)
  45 +// #define menubar_retoggle(t)
  46 +// #define HandleMenu_action ignore_action
  47 +
  48 +#endif
  49 +*/
... ...
latest/src/lib/printer.c
... ... @@ -59,7 +59,7 @@
59 59 #include "charsetc.h"
60 60 #include "ctlrc.h"
61 61 #include "hostc.h"
62   -#include "menubarc.h"
  62 +// #include "menubarc.h"
63 63 #include "popupsc.h"
64 64 #include "printerc.h"
65 65 #include "printc.h"
... ...
latest/src/lib/screen.c
... ... @@ -150,6 +150,9 @@ int screen_init(H3270 *session)
150 150 if(callbacks->cursor)
151 151 session->cursor = callbacks->cursor;
152 152  
  153 + if(callbacks->toggle_changed)
  154 + session->update_toggle = callbacks->toggle_changed;
  155 +
153 156 if(callbacks->init())
154 157 {
155 158 popup_an_error("Can't initialize terminal.");
... ... @@ -793,11 +796,13 @@ void Error(const char *fmt, ...)
793 796  
794 797 }
795 798  
  799 +/*
796 800 void notify_toggle_changed(H3270 *session, LIB3270_TOGGLE ix, unsigned char value, LIB3270_TOGGLE_TYPE reason)
797 801 {
798 802 if(callbacks && callbacks->toggle_changed)
799 803 callbacks->toggle_changed(session,ix,value,reason,toggle_names[ix]);
800 804 }
  805 +*/
801 806  
802 807 LIB3270_EXPORT void update_toggle_actions(void)
803 808 {
... ...
latest/src/lib/toggles.c
... ... @@ -44,7 +44,7 @@
44 44 #include "ansic.h"
45 45 #include "actionsc.h"
46 46 #include "ctlrc.h"
47   -#include "menubarc.h"
  47 +// #include "menubarc.h"
48 48 #include "popupsc.h"
49 49 #include "screenc.h"
50 50 #include "trace_dsc.h"
... ... @@ -106,10 +106,12 @@ static void do_toggle_reason(H3270 *session, LIB3270_TOGGLE ix, LIB3270_TOGGLE_T
106 106 */
107 107 toggle_toggle(t);
108 108 t->upcall(session, t, reason);
109   -
110 109 t->callback(session,t->value, (int) reason);
111 110  
112   - notify_toggle_changed(session, ix, t->value, reason);
  111 + if(session->update_toggle)
  112 + session->update_toggle(session,ix,t->value,reason,toggle_names[ix]);
  113 +
  114 +// notify_toggle_changed(session, ix, t->value, reason);
113 115  
114 116 }
115 117  
... ...
latest/src/lib/trace_ds.c
... ... @@ -61,7 +61,7 @@
61 61 #include "charsetc.h"
62 62 #include "childc.h"
63 63 #include "ctlrc.h"
64   -#include "menubarc.h"
  64 +// #include "menubarc.h"
65 65 #include "popupsc.h"
66 66 #include "printc.h"
67 67 #include "savec.h"
... ... @@ -270,8 +270,7 @@ wtrace(const char *fmt, ...)
270 270 }
271 271 }
272 272  
273   -static void
274   -stop_tracing(void)
  273 +static void stop_tracing(void)
275 274 {
276 275 if (tracef != NULL && tracef != stdout)
277 276 (void) fclose(tracef);
... ... @@ -280,14 +279,20 @@ stop_tracing(void)
280 279 (void) fclose(tracef_pipe);
281 280 tracef_pipe = NULL;
282 281 }
  282 +
  283 + lib3270_set_toggle(&h3270,DS_TRACE,0);
  284 + lib3270_set_toggle(&h3270,EVENT_TRACE,0);
  285 +
  286 +/*
283 287 if (toggled(DS_TRACE)) {
284 288 toggle_toggle(&appres.toggle[DS_TRACE]);
285   - menubar_retoggle(&appres.toggle[DS_TRACE]);
  289 +// menubar_retoggle(&appres.toggle[DS_TRACE]);
286 290 }
287 291 if (toggled(EVENT_TRACE)) {
288 292 toggle_toggle(&appres.toggle[EVENT_TRACE]);
289   - menubar_retoggle(&appres.toggle[EVENT_TRACE]);
  293 +// menubar_retoggle(&appres.toggle[EVENT_TRACE]);
290 294 }
  295 +*/
291 296 }
292 297  
293 298 /* Check for a trace file rollover event. */
... ... @@ -623,7 +628,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d
623 628 /* We're really tracing, turn the flag on. */
624 629 appres.toggle[trace_reason].value = True;
625 630 // appres.toggle[trace_reason].changed = True;
626   - menubar_retoggle(&appres.toggle[trace_reason]);
  631 +// menubar_retoggle(&appres.toggle[trace_reason]);
627 632  
628 633 /* Display current status. */
629 634 buf = create_tracefile_header("started");
... ... @@ -857,7 +862,7 @@ screentrace_cb(char *tfn)
857 862 /* We're really tracing, turn the flag on. */
858 863 appres.toggle[SCREEN_TRACE].value = True;
859 864 // appres.toggle[SCREEN_TRACE].changed = True;
860   - menubar_retoggle(&appres.toggle[SCREEN_TRACE]);
  865 +// menubar_retoggle(&appres.toggle[SCREEN_TRACE]);
861 866 return True;
862 867 }
863 868  
... ...