Commit 011f253c8ee884831189ac8585dc0eb0f5de87c6

Authored by perry.werneck@gmail.com
1 parent 827dae93

Melhorando tela de charset

Showing 1 changed file with 49 additions and 24 deletions   Show diff stats
src/lib3270/charset.c
@@ -315,12 +315,14 @@ LIB3270_EXPORT const char * lib3270_get_host_charset(H3270 *hSession) @@ -315,12 +315,14 @@ LIB3270_EXPORT const char * lib3270_get_host_charset(H3270 *hSession)
315 LIB3270_ACTION( charsettable ) 315 LIB3270_ACTION( charsettable )
316 { 316 {
317 static const char * hChars = "0123456789ABCDEF"; 317 static const char * hChars = "0123456789ABCDEF";
  318 + static const char * label = "Name:";
318 319
319 int f; 320 int f;
320 int margin_left = 5; 321 int margin_left = 5;
321 - int row; 322 + int baddr;
322 int chr; 323 int chr;
323 - int r; 324 + int s,r;
  325 + const char *ptr;
324 326
325 CHECK_SESSION_HANDLE(hSession); 327 CHECK_SESSION_HANDLE(hSession);
326 328
@@ -328,45 +330,68 @@ LIB3270_ACTION( charsettable ) @@ -328,45 +330,68 @@ LIB3270_ACTION( charsettable )
328 330
329 (void) memset((char *) hSession->ea_buf, 0, hSession->rows*hSession->cols*sizeof(struct lib3270_ea)); 331 (void) memset((char *) hSession->ea_buf, 0, hSession->rows*hSession->cols*sizeof(struct lib3270_ea));
330 332
331 - int col = margin_left; 333 + baddr = margin_left+hSession->maxCOLS;
  334 + s = (hSession->maxCOLS * 0x11);
332 for(f=4;f<=0x0f;f++) 335 for(f=4;f<=0x0f;f++)
333 { 336 {
334 - col += 2;  
335 - hSession->ea_buf[col].fg = LIB3270_ATTR_COLOR_BLUE;  
336 - hSession->ea_buf[col].bg = LIB3270_ATTR_COLOR_BLACK;  
337 - hSession->ea_buf[col].cs = 0;  
338 - hSession->ea_buf[col].cc = hSession->charset.asc2ebc[(int) hChars[f]];  
339 - hSession->ea_buf[col].gr = 0; 337 + baddr += 2;
  338 + hSession->ea_buf[baddr+s].fg = hSession->ea_buf[baddr].fg = LIB3270_ATTR_COLOR_GRAY;
  339 + hSession->ea_buf[baddr+s].bg = hSession->ea_buf[baddr].bg = LIB3270_ATTR_COLOR_BLACK;
  340 + hSession->ea_buf[baddr+s].cs = hSession->ea_buf[baddr].cs = 0;
  341 + hSession->ea_buf[baddr+s].cc = hSession->ea_buf[baddr].cc = hSession->charset.asc2ebc[(int) hChars[f]];
  342 + hSession->ea_buf[baddr+s].gr = hSession->ea_buf[baddr].gr = 0;
340 } 343 }
341 344
342 - row = margin_left+hSession->maxCOLS; 345 + baddr = margin_left+(hSession->maxCOLS*2);
  346 + s = 0x1a;
343 for(f=0;f<=0x0f;f++) 347 for(f=0;f<=0x0f;f++)
344 { 348 {
345 - hSession->ea_buf[row].fg = LIB3270_ATTR_COLOR_BLUE;  
346 - hSession->ea_buf[row].bg = LIB3270_ATTR_COLOR_BLACK;  
347 - hSession->ea_buf[row].cs = 0;  
348 - hSession->ea_buf[row].cc = hSession->charset.asc2ebc[(int) hChars[f]];  
349 - hSession->ea_buf[row].gr = 0;  
350 -  
351 - row += hSession->maxCOLS; 349 + hSession->ea_buf[baddr+s].fg = hSession->ea_buf[baddr].fg = LIB3270_ATTR_COLOR_GRAY;
  350 + hSession->ea_buf[baddr+s].bg = hSession->ea_buf[baddr].bg = LIB3270_ATTR_COLOR_BLACK;
  351 + hSession->ea_buf[baddr+s].cs = hSession->ea_buf[baddr].cs = 0;
  352 + hSession->ea_buf[baddr+s].cc = hSession->ea_buf[baddr].cc = hSession->charset.asc2ebc[(int) hChars[f]];
  353 + hSession->ea_buf[baddr+s].gr = hSession->ea_buf[baddr].gr = 0;
  354 + baddr += hSession->maxCOLS;
352 } 355 }
353 356
354 chr = 0x40; 357 chr = 0x40;
355 358
356 for(f=0;f<0x0c;f++) 359 for(f=0;f<0x0c;f++)
357 { 360 {
358 - row = (margin_left+hSession->maxCOLS)+(f*2)+2; 361 + baddr = (margin_left+(hSession->maxCOLS*2))+(f*2)+2;
359 for(r=0;r<=0x0f;r++) 362 for(r=0;r<=0x0f;r++)
360 { 363 {
361 - hSession->ea_buf[row].fg = LIB3270_ATTR_COLOR_WHITE;  
362 - hSession->ea_buf[row].bg = LIB3270_ATTR_COLOR_BLACK;  
363 - hSession->ea_buf[row].cs = 0;  
364 - hSession->ea_buf[row].cc = chr++;  
365 - hSession->ea_buf[row].gr = 0;  
366 - row += hSession->maxCOLS; 364 + hSession->ea_buf[baddr].fg = LIB3270_ATTR_COLOR_YELLOW;
  365 + hSession->ea_buf[baddr].bg = LIB3270_ATTR_COLOR_BLACK;
  366 + hSession->ea_buf[baddr].cs = 0;
  367 + hSession->ea_buf[baddr].cc = chr++;
  368 + hSession->ea_buf[baddr].gr = 0;
  369 + baddr += hSession->maxCOLS;
367 } 370 }
368 } 371 }
369 372
  373 + baddr = margin_left+0x1d+(hSession->maxCOLS*2);
  374 + for(ptr=label;*ptr;ptr++)
  375 + {
  376 + hSession->ea_buf[baddr].fg = LIB3270_ATTR_COLOR_WHITE;
  377 + hSession->ea_buf[baddr].bg = LIB3270_ATTR_COLOR_BLACK;
  378 + hSession->ea_buf[baddr].cs = 0;
  379 + hSession->ea_buf[baddr].cc = hSession->charset.asc2ebc[(int) *ptr];
  380 + hSession->ea_buf[baddr].gr = 0;
  381 + baddr++;
  382 + }
  383 + baddr++;
  384 +
  385 + for(ptr=hSession->charset.host;*ptr;ptr++)
  386 + {
  387 + hSession->ea_buf[baddr].fg = LIB3270_ATTR_COLOR_YELLOW;
  388 + hSession->ea_buf[baddr].bg = LIB3270_ATTR_COLOR_BLACK;
  389 + hSession->ea_buf[baddr].cs = 0;
  390 + hSession->ea_buf[baddr].cc = hSession->charset.asc2ebc[(int) *ptr];
  391 + hSession->ea_buf[baddr].gr = 0;
  392 + baddr++;
  393 + }
  394 +
370 hSession->display(hSession); 395 hSession->display(hSession);
371 396
372 return 0; 397 return 0;