Commit 8f62ea81ada93c7109114ac2d4f6a67520dd8a89

Authored by perry.werneck@gmail.com
1 parent 09ff5fa1

Melhorando diálogo de configuração de servidor

Showing 2 changed files with 36 additions and 12 deletions   Show diff stats
options.c
... ... @@ -39,13 +39,6 @@
39 39 static const const LIB3270_OPTION_ENTRY options[LIB3270_OPTION_COUNT+1] =
40 40 {
41 41 {
42   - LIB3270_OPTION_COLOR8,
43   - "color8",
44   - N_( "_8 colors" ),
45   - N_( "If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors." )
46   - },
47   -
48   - {
49 42 LIB3270_OPTION_KYBD_AS400,
50 43 "as400",
51 44 N_( "Host is AS/400" ),
... ... @@ -84,6 +77,37 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt)
84 77 hSession->options = opt;
85 78 }
86 79  
  80 +LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype)
  81 +{
  82 + CHECK_SESSION_HANDLE(hSession);
  83 +
  84 + switch(colortype)
  85 + {
  86 + case 0:
  87 + case 16:
  88 + hSession->colors = 16;
  89 + hSession->mono = 0;
  90 + break;
  91 +
  92 + case 8:
  93 + hSession->colors = 8;
  94 + hSession->mono = 0;
  95 + break;
  96 +
  97 + case 2:
  98 + hSession->colors = 16;
  99 + hSession->mono = 1;
  100 + break;
  101 +
  102 + default:
  103 + return EINVAL;
  104 + }
  105 +
  106 +
  107 + return 0;
  108 +}
  109 +
  110 +
87 111 LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void)
88 112 {
89 113 return options;
... ...
sf.c
... ... @@ -820,13 +820,13 @@ static void do_qr_color(H3270 *hSession)
820 820  
821 821 trace_ds(hSession,"> QueryReply(Color)\n");
822 822  
823   - color_max = (hSession->options & LIB3270_OPTION_COLOR8) ? 8: 16; /* report on 8 or 16 colors */
  823 + color_max = (hSession->colors == 8) ? 8: 16; /* report on 8 or 16 colors */
824 824  
825 825 space3270out(hSession,4 + 2*15);
826   - *hSession->obptr++ = 0x00; /* no options */
827   - *hSession->obptr++ = color_max; /* report on 8 or 16 colors */
828   - *hSession->obptr++ = 0x00; /* default color: */
829   - *hSession->obptr++ = 0xf0 + COLOR_GREEN; /* green */
  826 + *hSession->obptr++ = 0x00; /* no options */
  827 + *hSession->obptr++ = color_max; /* report on 8 or 16 colors */
  828 + *hSession->obptr++ = 0x00; /* default color: */
  829 + *hSession->obptr++ = 0xf0 + COLOR_GREEN; /* green */
830 830 for (i = 0xf1; i < 0xf1 + color_max - 1; i++)
831 831 {
832 832 *hSession->obptr++ = i;
... ...