diff --git a/src/include/internals.h b/src/include/internals.h index 6d9e5a3..d4bebf9 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -142,6 +142,8 @@ /// @brief Add current lib3270 selection to a list G_GNUC_INTERNAL GList * g_list_append_lib3270_selection(GList *list, H3270 *hSession, gboolean all); + G_GNUC_INTERNAL const gchar * v3270_translate_cg_to_utf(unsigned char chr); + /*--[ Internal Widgets & Tools ]---------------------------------------------------------------------*/ enum diff --git a/src/include/v3270/actions.h b/src/include/v3270/actions.h index 43bc8dc..c3be7e2 100644 --- a/src/include/v3270/actions.h +++ b/src/include/v3270/actions.h @@ -43,18 +43,20 @@ V3270_ACTION_FLAG_CUT = 0x10000000, } V3270_ACTION_FLAGS; - typedef struct _v3270_action + typedef struct _v3270_action V3270_ACTION; + + struct _v3270_action { LIB3270_PROPERTY_HEAD - V3270_ACTION_FLAGS flags; ///< @brief (The flags for activation. + V3270_ACTION_FLAGS flags; ///< @brief (The flags for activation). guint key; GdkModifierType mods; - int (*activate)(const struct _v3270_action *action, GtkWidget *widget); + int (*activate)(GtkWidget *widget, const V3270_ACTION *action); - } V3270_ACTION; + }; /// diff --git a/src/terminal/actions/scroll.c b/src/terminal/actions/scroll.c index 68e2397..2e2c999 100644 --- a/src/terminal/actions/scroll.c +++ b/src/terminal/actions/scroll.c @@ -34,6 +34,7 @@ #include #include #include + #include /*--[ Implement ]------------------------------------------------------------------------------------*/ @@ -92,6 +93,9 @@ gboolean v3270_scroll_event(GtkWidget *widget, GdkEventScroll *event) case GDK_SCROLL_RIGHT: lib3270_move_selection(terminal->host,LIB3270_DIR_RIGHT); return TRUE; + + case GDK_SCROLL_SMOOTH: + return FALSE; } } diff --git a/src/terminal/drawing/draw.c b/src/terminal/drawing/draw.c index 4f35c07..f95c815 100644 --- a/src/terminal/drawing/draw.c +++ b/src/terminal/drawing/draw.c @@ -257,8 +257,6 @@ static void draw_small_text(cairo_t *cr, const GdkRectangle *rect, v3270FontInfo static gboolean draw_cg(cairo_t *cr, unsigned char chr, v3270FontInfo *font, GdkRectangle *rect) { - size_t ix; - // 0x00 is always blank. if(!chr) return TRUE; @@ -277,6 +275,7 @@ static gboolean draw_cg(cairo_t *cr, unsigned char chr, v3270FontInfo *font, Gdk return TRUE; } + /* // Check for UTF-8 CG - https://unicode.org/charts/PDF/U2300.pdf static const struct CharList { @@ -292,15 +291,14 @@ static gboolean draw_cg(cairo_t *cr, unsigned char chr, v3270FontInfo *font, Gdk { 0xb8, "÷" }, // Division Sign ÷ { 0x90, "⎕" }, // APL FUNCTIONAL SYMBOL QUAD }; + */ + const gchar * utf = v3270_translate_cg_to_utf(chr); - for(ix = 0; ix < G_N_ELEMENTS(charlist); ix++) + if(utf) { - if(chr == charlist[ix].chr) - { - v3270_draw_text(cr,rect,font,charlist[ix].utf); - return TRUE; - } + v3270_draw_text(cr,rect,font,utf); + return TRUE; } debug("%s: Unknown char 0x%02x",__FUNCTION__,(int) chr); @@ -410,10 +408,18 @@ void v3270_draw_char(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 cairo_rel_line_to(cr,rect->width,0); break; + case 0x90: // APL FUNCTIONAL SYMBOL QUAD + cairo_rectangle(cr, rect->x+1, rect->y+1, rect->width-2, rect->height-2); + break; + default: if(!draw_cg(cr, chr, font, rect)) + { lib3270_write_screen_trace(session,"I don't known how to draw CG character %02x\n",(int) chr); + cairo_rectangle(cr, rect->x+1, rect->y+1, rect->width-2, rect->height-2); + + } } } diff --git a/src/terminal/font/translate.c b/src/terminal/font/translate.c new file mode 100644 index 0000000..f65da76 --- /dev/null +++ b/src/terminal/font/translate.c @@ -0,0 +1,65 @@ +/* + * "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 - 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" + +/*--[ Implement ]------------------------------------------------------------------------------------*/ + +static const struct +{ + unsigned char chr; + const gchar * utf; +} cg_to_utf[] = +{ + { 0x8c, "≤" }, // CG 0xf7, less or equal "≤" + { 0xae, "≥" }, // CG 0xd9, greater or equal "≥" + { 0xbe, "≠" }, // CG 0xbe, not equal "≠" + { 0xad, "[" }, // "[" + { 0xbd, "]" }, // "]" + { 0xb8, "÷" }, // Division Sign ÷ + { 0x90, "⎕" }, // APL FUNCTIONAL SYMBOL QUAD +}; + +const gchar * v3270_translate_cg_to_utf(unsigned char chr) +{ + size_t ix; + + if(!chr) + return " "; + + for(ix = 0; ix < G_N_ELEMENTS(cg_to_utf); ix++) + { + if(chr == cg_to_utf[ix].chr) + return cg_to_utf[ix].utf; + + } + + return NULL; +} diff --git a/v3270.cbp b/v3270.cbp index 5f3f532..fefcddd 100644 --- a/v3270.cbp +++ b/v3270.cbp @@ -272,6 +272,9 @@ + + -- libgit2 0.21.2