Commit ae2663cf907c2f6dad82b2d352cee914f1d5ff0d
1 parent
aa4ec8e0
Exists in
master
Iniciando ajustes no processo de tela para que a biblioteca passe a enviar para …
…o cliente apenas os campos que foram modificados
Showing
3 changed files
with
69 additions
and
39 deletions
Show diff stats
latest/src/include/lib3270.h
... | ... | @@ -32,6 +32,43 @@ |
32 | 32 | |
33 | 33 | #ifndef LIB3270_H_INCLUDED |
34 | 34 | |
35 | + /** | |
36 | + * Character attributes | |
37 | + */ | |
38 | + typedef enum _lib3270_attr | |
39 | + { | |
40 | + LIB3270_ATTR_COLOR_BACKGROUND = 0x0000, | |
41 | + | |
42 | + LIB3270_ATTR_COLOR_BLUE = 0x0001, | |
43 | + LIB3270_ATTR_COLOR_RED = 0x0002, | |
44 | + LIB3270_ATTR_COLOR_PINK = 0x0003, | |
45 | + LIB3270_ATTR_COLOR_GREEN = 0x0004, | |
46 | + LIB3270_ATTR_COLOR_TURQUOISE = 0x0005, | |
47 | + LIB3270_ATTR_COLOR_YELLOW = 0x0006, | |
48 | + LIB3270_ATTR_COLOR_WHITE = 0x0007, | |
49 | + LIB3270_ATTR_COLOR_BLACK = 0x0008, | |
50 | + LIB3270_ATTR_COLOR_DARK_BLUE = 0x0009, | |
51 | + LIB3270_ATTR_COLOR_ORANGE = 0x000A, | |
52 | + LIB3270_ATTR_COLOR_PURPLE = 0x000B, | |
53 | + LIB3270_ATTR_COLOR_DARK_GREEN = 0x000C, | |
54 | + LIB3270_ATTR_COLOR_DARK_TURQUOISE = 0x000D, | |
55 | + LIB3270_ATTR_COLOR_MUSTARD = 0x000E, | |
56 | + LIB3270_ATTR_COLOR_GRAY = 0x000F, | |
57 | + | |
58 | + LIB3270_ATTR_COLOR = 0x00FF, | |
59 | + | |
60 | + LIB3270_ATTR_FIELD = 0x0100, | |
61 | + LIB3270_ATTR_BLINK = 0x0200, | |
62 | + LIB3270_ATTR_UNDERLINE = 0x0400, | |
63 | + LIB3270_ATTR_INTENSIFY = 0x0800, | |
64 | + | |
65 | + LIB3270_ATTR_CG = 0x1000, | |
66 | + LIB3270_ATTR_MARKER = 0x2000, | |
67 | + LIB3270_ATTR_BACKGROUND_INTENSITY = 0x4000, | |
68 | + | |
69 | + } LIB3270_ATTR; | |
70 | + | |
71 | + | |
35 | 72 | #include <lib3270/api.h> |
36 | 73 | |
37 | 74 | /** | ... | ... |
latest/src/include/lib3270/api.h
... | ... | @@ -441,15 +441,14 @@ |
441 | 441 | |
442 | 442 | #define query_screen_change_counter() query_counter(COUNTER_ID_CTLR_DONE) |
443 | 443 | |
444 | - | |
445 | 444 | #define COLOR_ATTR_NONE 0x0000 |
446 | - #define COLOR_ATTR_FIELD 0x0100 | |
447 | - #define COLOR_ATTR_BLINK 0x0200 | |
448 | - #define COLOR_ATTR_UNDERLINE 0x0400 | |
449 | - #define COLOR_ATTR_INTENSIFY 0x0800 | |
445 | + #define COLOR_ATTR_FIELD LIB3270_ATTR_FIELD | |
446 | + #define COLOR_ATTR_BLINK LIB3270_ATTR_BLINK | |
447 | + #define COLOR_ATTR_UNDERLINE LIB3270_ATTR_UNDERLINE | |
448 | + #define COLOR_ATTR_INTENSIFY LIB3270_ATTR_INTENSIFY | |
450 | 449 | |
451 | - #define CHAR_ATTR_CG 0x1000 | |
452 | - #define CHAR_ATTR_MARKER 0x2000 | |
450 | + #define CHAR_ATTR_CG LIB3270_ATTR_CG | |
451 | + #define CHAR_ATTR_MARKER LIB3270_ATTR_MARKER | |
453 | 452 | |
454 | 453 | #define CHAR_ATTR_UNCONVERTED CHAR_ATTR_CG |
455 | 454 | ... | ... |
latest/src/lib/screen.c
... | ... | @@ -90,7 +90,7 @@ static void screen_update(H3270 *session, int bstart, int bend); |
90 | 90 | static void status_connect(H3270 *session, int ignored, void *dunno); |
91 | 91 | static void status_3270_mode(H3270 *session, int ignored, void *dunno); |
92 | 92 | static void status_printer(H3270 *session, int on, void *dunno); |
93 | -static int color_from_fa(unsigned char fa); | |
93 | +static unsigned short color_from_fa(unsigned char fa); | |
94 | 94 | static void relabel(H3270 *session, int ignored, void *dunno); |
95 | 95 | |
96 | 96 | void set_display_charset(char *dcs) |
... | ... | @@ -165,8 +165,7 @@ int screen_init(H3270 *session) |
165 | 165 | } |
166 | 166 | |
167 | 167 | /* Map a field attribute to its default colors. */ |
168 | -static int | |
169 | -color_from_fa(unsigned char fa) | |
168 | +static unsigned short color_from_fa(unsigned char fa) | |
170 | 169 | { |
171 | 170 | if (appres.m3279) |
172 | 171 | return get_color_pair(DEFCOLOR_MAP(fa),0) | COLOR_ATTR_FIELD; |
... | ... | @@ -175,20 +174,22 @@ color_from_fa(unsigned char fa) |
175 | 174 | return get_color_pair(0,0) | COLOR_ATTR_FIELD | ((FA_IS_HIGH(fa)) ? COLOR_ATTR_INTENSIFY : 0); |
176 | 175 | } |
177 | 176 | |
177 | +/* | |
178 | 178 | static int reverse_colors(int a) |
179 | 179 | { |
180 | 180 | int bg = (a & 0xF0) >> 4; |
181 | 181 | int fg = (a & 0x0F); |
182 | 182 | return get_color_pair(bg,fg) | (a&0xFF00); |
183 | 183 | } |
184 | +*/ | |
184 | 185 | |
185 | 186 | /* |
186 | 187 | * Find the display attributes for a baddr, fa_addr and fa. |
187 | 188 | */ |
188 | -static int | |
189 | -calc_attrs(int baddr, int fa_addr, int fa) | |
189 | +static unsigned short calc_attrs(int baddr, int fa_addr, int fa) | |
190 | 190 | { |
191 | - int fg = 0, bg = 0, gr, a; | |
191 | + unsigned short fg=0, bg=0, a; | |
192 | + int gr; | |
192 | 193 | |
193 | 194 | /* Compute the color. */ |
194 | 195 | |
... | ... | @@ -197,11 +198,12 @@ calc_attrs(int baddr, int fa_addr, int fa) |
197 | 198 | (!ea_buf[baddr].fg && |
198 | 199 | !ea_buf[fa_addr].fg && |
199 | 200 | !ea_buf[baddr].bg && |
200 | - !ea_buf[fa_addr].bg)) { | |
201 | - | |
202 | - a = color_from_fa(fa); | |
203 | - | |
204 | - } else { | |
201 | + !ea_buf[fa_addr].bg)) | |
202 | + { | |
203 | + a = color_from_fa(fa); | |
204 | + } | |
205 | + else | |
206 | + { | |
205 | 207 | |
206 | 208 | /* The current location or the fa specifies the fg or bg. */ |
207 | 209 | if (ea_buf[baddr].fg) |
... | ... | @@ -239,29 +241,20 @@ calc_attrs(int baddr, int fa_addr, int fa) |
239 | 241 | if(!(gr & GR_REVERSE) && !bg) |
240 | 242 | { |
241 | 243 | if(gr & GR_BLINK) |
242 | - a |= COLOR_ATTR_BLINK; | |
244 | + a |= LIB3270_ATTR_BLINK; | |
243 | 245 | |
244 | 246 | if(gr & GR_UNDERLINE) |
245 | - a |= COLOR_ATTR_UNDERLINE; | |
247 | + a |= LIB3270_ATTR_UNDERLINE; | |
246 | 248 | } |
247 | 249 | |
248 | - | |
249 | -/* | |
250 | - if (appres.highlight_underline && | |
251 | - appres.m3279 && | |
252 | - (gr & (GR_BLINK | GR_UNDERLINE)) && | |
253 | - !(gr & GR_REVERSE) && | |
254 | - !bg) { | |
255 | - | |
256 | - a |= BACKGROUND_INTENSITY; | |
257 | - } | |
258 | -*/ | |
250 | + if(appres.m3279 && (gr & (GR_BLINK | GR_UNDERLINE)) && !(gr & GR_REVERSE) && !bg) | |
251 | + a |= LIB3270_ATTR_BACKGROUND_INTENSITY; | |
259 | 252 | |
260 | 253 | if(!appres.m3279 && ((gr & GR_INTENSIFY) || FA_IS_HIGH(fa))) |
261 | - a |= COLOR_ATTR_INTENSIFY; | |
254 | + a |= LIB3270_ATTR_INTENSIFY; | |
262 | 255 | |
263 | 256 | if (gr & GR_REVERSE) |
264 | - a = reverse_colors(a); | |
257 | + a = get_color_pair(((a & 0xF0) >> 4),(a & 0x0F)) | (a&0xFF00); // a = reverse_colors(a); | |
265 | 258 | |
266 | 259 | return a; |
267 | 260 | } |
... | ... | @@ -341,13 +334,13 @@ static void screen_update(H3270 *session, int bstart, int bend) |
341 | 334 | { |
342 | 335 | |
343 | 336 | int baddr, row, col; |
344 | - int a; | |
337 | + unsigned short a; | |
345 | 338 | int attr = COLOR_GREEN; |
346 | 339 | unsigned char fa; |
347 | 340 | int fa_addr; |
348 | 341 | |
349 | - fa = get_field_attribute(bstart); | |
350 | - a = color_from_fa(fa); | |
342 | + fa = get_field_attribute(bstart); | |
343 | + a = color_from_fa(fa); | |
351 | 344 | fa_addr = find_field_attribute(bstart); // may be -1, that's okay |
352 | 345 | |
353 | 346 | row = bstart/session->cols; |
... | ... | @@ -379,13 +372,14 @@ static void screen_update(H3270 *session, int bstart, int bend) |
379 | 372 | } |
380 | 373 | else |
381 | 374 | { |
382 | - int b; | |
383 | - | |
375 | +// unsigned short b; | |
384 | 376 | // |
385 | 377 | // Override some of the field |
386 | 378 | // attributes. |
387 | 379 | // |
388 | - attr = b = calc_attrs(baddr, fa_addr, fa); | |
380 | +// attr = b = calc_attrs(baddr, fa_addr, fa); | |
381 | + | |
382 | + attr = calc_attrs(baddr, fa_addr, fa); | |
389 | 383 | } |
390 | 384 | |
391 | 385 | if (ea_buf[baddr].cs == CS_LINEDRAW) | ... | ... |