From 8f62ea81ada93c7109114ac2d4f6a67520dd8a89 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Fri, 21 Dec 2012 14:13:40 +0000 Subject: [PATCH] Melhorando diálogo de configuração de servidor --- options.c | 38 +++++++++++++++++++++++++++++++------- sf.c | 10 +++++----- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/options.c b/options.c index 9dd5389..6288c77 100644 --- a/options.c +++ b/options.c @@ -39,13 +39,6 @@ static const const LIB3270_OPTION_ENTRY options[LIB3270_OPTION_COUNT+1] = { { - LIB3270_OPTION_COLOR8, - "color8", - N_( "_8 colors" ), - N_( "If active, pw3270 will respond to a Query(Color) with a list of 8 supported colors." ) - }, - - { LIB3270_OPTION_KYBD_AS400, "as400", N_( "Host is AS/400" ), @@ -84,6 +77,37 @@ LIB3270_EXPORT void lib3270_set_options(H3270 *hSession, LIB3270_OPTION opt) hSession->options = opt; } +LIB3270_EXPORT int lib3270_set_color_type(H3270 *hSession, unsigned short colortype) +{ + CHECK_SESSION_HANDLE(hSession); + + switch(colortype) + { + case 0: + case 16: + hSession->colors = 16; + hSession->mono = 0; + break; + + case 8: + hSession->colors = 8; + hSession->mono = 0; + break; + + case 2: + hSession->colors = 16; + hSession->mono = 1; + break; + + default: + return EINVAL; + } + + + return 0; +} + + LIB3270_EXPORT const LIB3270_OPTION_ENTRY * lib3270_get_option_list(void) { return options; diff --git a/sf.c b/sf.c index 48cf776..2d1fcc0 100644 --- a/sf.c +++ b/sf.c @@ -820,13 +820,13 @@ static void do_qr_color(H3270 *hSession) trace_ds(hSession,"> QueryReply(Color)\n"); - color_max = (hSession->options & LIB3270_OPTION_COLOR8) ? 8: 16; /* report on 8 or 16 colors */ + color_max = (hSession->colors == 8) ? 8: 16; /* report on 8 or 16 colors */ space3270out(hSession,4 + 2*15); - *hSession->obptr++ = 0x00; /* no options */ - *hSession->obptr++ = color_max; /* report on 8 or 16 colors */ - *hSession->obptr++ = 0x00; /* default color: */ - *hSession->obptr++ = 0xf0 + COLOR_GREEN; /* green */ + *hSession->obptr++ = 0x00; /* no options */ + *hSession->obptr++ = color_max; /* report on 8 or 16 colors */ + *hSession->obptr++ = 0x00; /* default color: */ + *hSession->obptr++ = 0xf0 + COLOR_GREEN; /* green */ for (i = 0xf1; i < 0xf1 + color_max - 1; i++) { *hSession->obptr++ = i; -- libgit2 0.21.2