Commit b3e369a793087a2651204057c85e5fe8bc82ca33

Authored by Perry Werneck
1 parent c27af356

Incluindo parâmetro para remapear caracteres.

pw3270.cbp
... ... @@ -93,6 +93,10 @@
93 93 <Unit filename="src/include/pw3270/ipcpackets.h" />
94 94 <Unit filename="src/include/pw3270/plugin.h" />
95 95 <Unit filename="src/include/pw3270/trace.h" />
  96 + <Unit filename="src/include/pw3270/v3270.h">
  97 + <Option target="Debug" />
  98 + <Option target="Release" />
  99 + </Unit>
96 100 <Unit filename="src/include/pw3270cpp.h" />
97 101 <Unit filename="src/include/rules.mak.in" />
98 102 <Unit filename="src/java/Makefile.in">
... ... @@ -461,6 +465,11 @@
461 465 <Option compilerVar="CC" />
462 466 </Unit>
463 467 <Unit filename="src/pw3270/v3270/accessible.h" />
  468 + <Unit filename="src/pw3270/v3270/charset.c">
  469 + <Option compilerVar="CC" />
  470 + <Option target="Debug" />
  471 + <Option target="Release" />
  472 + </Unit>
464 473 <Unit filename="src/pw3270/v3270/draw.c">
465 474 <Option compilerVar="CC" />
466 475 </Unit>
... ...
src/include/pw3270.h
... ... @@ -87,6 +87,7 @@
87 87 LIB3270_EXPORT gchar * pw3270_file_chooser(GtkFileChooserAction action, const gchar *name, const gchar *title, const gchar *file);
88 88  
89 89 LIB3270_EXPORT void pw3270_set_host_charset(GtkWidget *widget, const gchar *name);
  90 + LIB3270_EXPORT void pw3270_remap_from_xml(GtkWidget *widget, const gchar *name);
90 91  
91 92 LIB3270_EXPORT void pw3270_set_action_state(GtkAction *action, gboolean on);
92 93  
... ...
src/include/pw3270/v3270.h
... ... @@ -245,6 +245,8 @@
245 245 LIB3270_EXPORT const char * v3270_get_luname(GtkWidget *widget);
246 246 LIB3270_EXPORT GtkWidget * v3270_get_default_widget(void);
247 247  
  248 + LIB3270_EXPORT void v3270_remap_from_xml(GtkWidget *widget, const gchar *path);
  249 +
248 250 // Keyboard & Mouse special actions
249 251 LIB3270_EXPORT gboolean v3270_set_keyboard_action(GtkWidget *widget, const gchar *key_name, GtkAction *action);
250 252 LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action);
... ...
src/pw3270/main.c
... ... @@ -52,16 +52,17 @@
52 52  
53 53 /*--[ Statics ]--------------------------------------------------------------------------------------*/
54 54  
55   - static GtkWidget * toplevel = NULL;
56   - static GtkWidget * trace_window = NULL;
57   - static unsigned int syscolors = 16;
58   - static unsigned int timer = 0;
  55 + static GtkWidget * toplevel = NULL;
  56 + static GtkWidget * trace_window = NULL;
  57 + static unsigned int syscolors = 16;
  58 + static unsigned int timer = 0;
59 59 static const gchar * systype = NULL;
60 60 static const gchar * toggleset = NULL;
61 61 static const gchar * togglereset = NULL;
62   - static const gchar * logfile = NULL;
  62 + static const gchar * logfile = NULL;
63 63 static const gchar * tracefile = NULL;
64 64 static const gchar * charset = NULL;
  65 + static const gchar * remap = NULL;
65 66 static const gchar * model = NULL;
66 67 static const gchar * pluginpath = NULL;
67 68  
... ... @@ -384,6 +385,7 @@ int main(int argc, char *argv[])
384 385 { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL },
385 386 { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL },
386 387 { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL },
  388 + { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL },
387 389 { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL },
388 390 { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 },
389 391 { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL },
... ... @@ -567,10 +569,8 @@ int main(int argc, char *argv[])
567 569 g_strfreev(str);
568 570 }
569 571  
570   - if(charset)
571   - {
572   - pw3270_set_host_charset(toplevel,charset);
573   - }
  572 + pw3270_set_host_charset(toplevel,charset);
  573 + pw3270_remap_from_xml(toplevel,remap);
574 574  
575 575 toplevel_setup(GTK_WINDOW(toplevel));
576 576  
... ...
src/pw3270/tools.c
... ... @@ -280,11 +280,19 @@ LIB3270_EXPORT gchar * pw3270_get_datadir(const gchar *first_element, ...)
280 280 return path;
281 281 }
282 282  
  283 +LIB3270_EXPORT void pw3270_remap_from_xml(GtkWidget *widget, const gchar *name)
  284 +{
  285 + if(name)
  286 + {
  287 + v3270_remap_from_xml(pw3270_get_terminal_widget(widget),name);
  288 + }
  289 +}
  290 +
283 291 LIB3270_EXPORT void pw3270_set_host_charset(GtkWidget *widget, const gchar *name)
284 292 {
285 293 H3270 * hSession = pw3270_get_session(widget);
286 294  
287   - if(!hSession)
  295 + if(!(hSession && name))
288 296 return;
289 297  
290 298 if(!lib3270_set_host_charset(hSession,name))
... ...
src/pw3270/v3270/Makefile.in
... ... @@ -27,7 +27,7 @@
27 27 MODULE_NAME=v3270
28 28  
29 29 SOURCES=marshal.c widget.c oia.c iocallback.c keyboard.c draw.c mouse.c selection.c \
30   - accessible.c security.c macros.c hostselect.c properties.c
  30 + accessible.c security.c macros.c hostselect.c properties.c charset.c
31 31  
32 32 #---[ Configuration values ]-------------------------------------------------------------
33 33  
... ...
src/pw3270/v3270/charset.c 0 → 100644
... ... @@ -0,0 +1,59 @@
  1 +/*
  2 + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
  3 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
  4 + * aplicativos mainframe. Registro no INPI sob o nome G3270.
  5 + *
  6 + * Copyright (C) <2008> <Banco do Brasil S.A.>
  7 + *
  8 + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
  9 + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
  10 + * Free Software Foundation.
  11 + *
  12 + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
  13 + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
  14 + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
  15 + * obter mais detalhes.
  16 + *
  17 + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
  18 + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
  19 + * St, Fifth Floor, Boston, MA 02110-1301 USA
  20 + *
  21 + * Este programa está nomeado como charset.c e possui - linhas de código.
  22 + *
  23 + * Contatos:
  24 + *
  25 + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  26 + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  27 + *
  28 + */
  29 +
  30 + #include <v3270.h>
  31 + #include "private.h"
  32 + #include <lib3270/charset.h>
  33 +
  34 +
  35 + #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME)
  36 +
  37 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  38 +
  39 + struct parse
  40 + {
  41 + char * host;
  42 + char * display;
  43 + unsigned long cgcsgid;
  44 + };
  45 +
  46 + LIB3270_EXPORT void v3270_remap_from_xml(GtkWidget *widget, const gchar *path)
  47 + {
  48 + struct parse cfg;
  49 + v3270 * terminal = GTK_V3270(widget);
  50 +
  51 + memset(&cfg,0,sizeof(cfg));
  52 +
  53 +
  54 +
  55 + g_free(cfg.host);
  56 + g_free(cfg.display);
  57 +
  58 + }
  59 +
... ...