From b3e369a793087a2651204057c85e5fe8bc82ca33 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Thu, 11 Jan 2018 11:27:31 -0200 Subject: [PATCH] Incluindo parâmetro para remapear caracteres. --- pw3270.cbp | 9 +++++++++ src/include/pw3270.h | 1 + src/include/pw3270/v3270.h | 2 ++ src/pw3270/main.c | 18 +++++++++--------- src/pw3270/tools.c | 10 +++++++++- src/pw3270/v3270/Makefile.in | 2 +- src/pw3270/v3270/charset.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 90 insertions(+), 11 deletions(-) create mode 100644 src/pw3270/v3270/charset.c diff --git a/pw3270.cbp b/pw3270.cbp index e1d3575..e386b88 100644 --- a/pw3270.cbp +++ b/pw3270.cbp @@ -93,6 +93,10 @@ + + @@ -461,6 +465,11 @@ + + diff --git a/src/include/pw3270.h b/src/include/pw3270.h index 834ba14..17d6a37 100644 --- a/src/include/pw3270.h +++ b/src/include/pw3270.h @@ -87,6 +87,7 @@ LIB3270_EXPORT gchar * pw3270_file_chooser(GtkFileChooserAction action, const gchar *name, const gchar *title, const gchar *file); LIB3270_EXPORT void pw3270_set_host_charset(GtkWidget *widget, const gchar *name); + LIB3270_EXPORT void pw3270_remap_from_xml(GtkWidget *widget, const gchar *name); LIB3270_EXPORT void pw3270_set_action_state(GtkAction *action, gboolean on); diff --git a/src/include/pw3270/v3270.h b/src/include/pw3270/v3270.h index 2694c3c..4f63ae8 100644 --- a/src/include/pw3270/v3270.h +++ b/src/include/pw3270/v3270.h @@ -245,6 +245,8 @@ LIB3270_EXPORT const char * v3270_get_luname(GtkWidget *widget); LIB3270_EXPORT GtkWidget * v3270_get_default_widget(void); + LIB3270_EXPORT void v3270_remap_from_xml(GtkWidget *widget, const gchar *path); + // Keyboard & Mouse special actions LIB3270_EXPORT gboolean v3270_set_keyboard_action(GtkWidget *widget, const gchar *key_name, GtkAction *action); LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action); diff --git a/src/pw3270/main.c b/src/pw3270/main.c index 1fb2730..10c281a 100644 --- a/src/pw3270/main.c +++ b/src/pw3270/main.c @@ -52,16 +52,17 @@ /*--[ Statics ]--------------------------------------------------------------------------------------*/ - static GtkWidget * toplevel = NULL; - static GtkWidget * trace_window = NULL; - static unsigned int syscolors = 16; - static unsigned int timer = 0; + static GtkWidget * toplevel = NULL; + static GtkWidget * trace_window = NULL; + static unsigned int syscolors = 16; + static unsigned int timer = 0; static const gchar * systype = NULL; static const gchar * toggleset = NULL; static const gchar * togglereset = NULL; - static const gchar * logfile = NULL; + static const gchar * logfile = NULL; static const gchar * tracefile = NULL; static const gchar * charset = NULL; + static const gchar * remap = NULL; static const gchar * model = NULL; static const gchar * pluginpath = NULL; @@ -384,6 +385,7 @@ int main(int argc, char *argv[]) { "toggleset", 'S', 0, G_OPTION_ARG_STRING, &toggleset, N_( "Set toggles ON" ), NULL }, { "togglereset", 'R', 0, G_OPTION_ARG_STRING, &togglereset, N_( "Set toggles OFF" ), NULL }, { "charset", 'C', 0, G_OPTION_ARG_STRING, &charset, N_( "Set host charset" ), NULL }, + { "remap", 'm', 0, G_OPTION_ARG_FILENAME, &remap, N_( "Remap charset from xml file" ), NULL }, { "model", 'M', 0, G_OPTION_ARG_STRING, &model, N_( "The model of 3270 display to be emulated" ), NULL }, { "autodisconnect", 'D', 0, G_OPTION_ARG_INT, &timer, N_( "Minutes for auto-disconnect" ), 0 }, { "pluginpath", 'P', 0, G_OPTION_ARG_STRING, &pluginpath, N_( "Path for plugin files" ), NULL }, @@ -567,10 +569,8 @@ int main(int argc, char *argv[]) g_strfreev(str); } - if(charset) - { - pw3270_set_host_charset(toplevel,charset); - } + pw3270_set_host_charset(toplevel,charset); + pw3270_remap_from_xml(toplevel,remap); toplevel_setup(GTK_WINDOW(toplevel)); diff --git a/src/pw3270/tools.c b/src/pw3270/tools.c index ea82129..21248c3 100644 --- a/src/pw3270/tools.c +++ b/src/pw3270/tools.c @@ -280,11 +280,19 @@ LIB3270_EXPORT gchar * pw3270_get_datadir(const gchar *first_element, ...) return path; } +LIB3270_EXPORT void pw3270_remap_from_xml(GtkWidget *widget, const gchar *name) +{ + if(name) + { + v3270_remap_from_xml(pw3270_get_terminal_widget(widget),name); + } +} + LIB3270_EXPORT void pw3270_set_host_charset(GtkWidget *widget, const gchar *name) { H3270 * hSession = pw3270_get_session(widget); - if(!hSession) + if(!(hSession && name)) return; if(!lib3270_set_host_charset(hSession,name)) diff --git a/src/pw3270/v3270/Makefile.in b/src/pw3270/v3270/Makefile.in index 3795338..50da130 100644 --- a/src/pw3270/v3270/Makefile.in +++ b/src/pw3270/v3270/Makefile.in @@ -27,7 +27,7 @@ MODULE_NAME=v3270 SOURCES=marshal.c widget.c oia.c iocallback.c keyboard.c draw.c mouse.c selection.c \ - accessible.c security.c macros.c hostselect.c properties.c + accessible.c security.c macros.c hostselect.c properties.c charset.c #---[ Configuration values ]------------------------------------------------------------- diff --git a/src/pw3270/v3270/charset.c b/src/pw3270/v3270/charset.c new file mode 100644 index 0000000..a94aad2 --- /dev/null +++ b/src/pw3270/v3270/charset.c @@ -0,0 +1,59 @@ +/* + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a + * aplicativos mainframe. Registro no INPI sob o nome G3270. + * + * Copyright (C) <2008> + * + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela + * Free Software Foundation. + * + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para + * obter mais detalhes. + * + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin + * St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Este programa está nomeado como charset.c e possui - linhas de código. + * + * Contatos: + * + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) + * + */ + + #include + #include "private.h" + #include + + + #define ERROR_DOMAIN g_quark_from_static_string(PACKAGE_NAME) + +/*--[ Implement ]------------------------------------------------------------------------------------*/ + + struct parse + { + char * host; + char * display; + unsigned long cgcsgid; + }; + + LIB3270_EXPORT void v3270_remap_from_xml(GtkWidget *widget, const gchar *path) + { + struct parse cfg; + v3270 * terminal = GTK_V3270(widget); + + memset(&cfg,0,sizeof(cfg)); + + + + g_free(cfg.host); + g_free(cfg.display); + + } + -- libgit2 0.21.2