Commit 58ce49591e8780d3e48cb9117b024c98d1081397
1 parent
452df2c7
Exists in
master
and in
5 other branches
Implementando aviso de script ativo
Showing
25 changed files
with
421 additions
and
270 deletions
Show diff stats
pw3270.cbp
| ... | ... | @@ -72,8 +72,8 @@ |
| 72 | 72 | <Unit filename="src\include\pw3270.h" /> |
| 73 | 73 | <Unit filename="src\include\pw3270\hllapi.h" /> |
| 74 | 74 | <Unit filename="src\include\pw3270\plugin.h" /> |
| 75 | + <Unit filename="src\include\pw3270\v3270.h" /> | |
| 75 | 76 | <Unit filename="src\include\rules.mak.in" /> |
| 76 | - <Unit filename="src\include\v3270.h" /> | |
| 77 | 77 | <Unit filename="src\lib3270\3270ds.h" /> |
| 78 | 78 | <Unit filename="src\lib3270\Makefile.in" /> |
| 79 | 79 | <Unit filename="src\lib3270\X11keysym.h" /> | ... | ... |
src/include/lib3270/config.h.in
src/include/pw3270.h
| ... | ... | @@ -57,6 +57,8 @@ |
| 57 | 57 | LIB3270_EXPORT H3270 * pw3270_get_session(GtkWidget *widget); |
| 58 | 58 | LIB3270_EXPORT GtkWidget * pw3270_get_terminal_widget(GtkWidget *widget); |
| 59 | 59 | |
| 60 | + LIB3270_EXPORT GtkWidget * pw3270_get_toplevel(void); | |
| 61 | + | |
| 60 | 62 | LIB3270_EXPORT gchar * pw3270_build_filename(GtkWidget *widget, const gchar *first_element, ...); |
| 61 | 63 | LIB3270_EXPORT void pw3270_save_window_size(GtkWidget *widget, const gchar *name); |
| 62 | 64 | LIB3270_EXPORT void pw3270_restore_window(GtkWidget *widget, const gchar *name); | ... | ... |
src/include/pw3270/hllapi.h
| ... | ... | @@ -61,8 +61,7 @@ extern "C" { |
| 61 | 61 | } HLLAPI_DATA; |
| 62 | 62 | #pragma pack() |
| 63 | 63 | |
| 64 | - #warning Remover comentario | |
| 65 | -// LIB3270_EXPORT int hllapi(unsigned long func, char *str, unsigned short length, unsigned short *rc); | |
| 64 | + LIB3270_EXPORT int hllapi(const unsigned long *func, char *str, unsigned short *length, unsigned short *rc); | |
| 66 | 65 | |
| 67 | 66 | #ifdef __cplusplus |
| 68 | 67 | } /* end of extern "C" */ | ... | ... |
| ... | ... | @@ -0,0 +1,198 @@ |
| 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 v3270.h 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 | + * licinio@bb.com.br (Licínio Luis Branco) | |
| 28 | + * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
| 29 | + * | |
| 30 | + */ | |
| 31 | + | |
| 32 | +#ifndef V3270_H_INCLUDED | |
| 33 | + | |
| 34 | + #include <gtk/gtk.h> | |
| 35 | + #include <lib3270/config.h> | |
| 36 | + #include <lib3270.h> | |
| 37 | + | |
| 38 | + #define V3270_H_INCLUDED 1 | |
| 39 | + | |
| 40 | + G_BEGIN_DECLS | |
| 41 | + | |
| 42 | + #define GTK_TYPE_V3270 (v3270_get_type ()) | |
| 43 | + #define GTK_V3270(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270, v3270)) | |
| 44 | + #define GTK_V3270_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270, v3270Class)) | |
| 45 | + #define GTK_IS_V3270(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270)) | |
| 46 | + #define GTK_IS_V3270_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270)) | |
| 47 | + #define GTK_V3270_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270, v3270Class)) | |
| 48 | + | |
| 49 | + | |
| 50 | + typedef struct _v3270 v3270; | |
| 51 | + typedef struct _v3270Class v3270Class; | |
| 52 | + | |
| 53 | + enum V3270_COLOR | |
| 54 | + { | |
| 55 | + V3270_COLOR_BACKGROUND, | |
| 56 | + V3270_COLOR_BLUE, | |
| 57 | + V3270_COLOR_RED, | |
| 58 | + V3270_COLOR_PINK, | |
| 59 | + V3270_COLOR_GREEN, | |
| 60 | + V3270_COLOR_TURQUOISE, | |
| 61 | + V3270_COLOR_YELLOW, | |
| 62 | + V3270_COLOR_WHITE, | |
| 63 | + V3270_COLOR_BLACK, | |
| 64 | + V3270_COLOR_DARK_BLUE, | |
| 65 | + V3270_COLOR_ORANGE, | |
| 66 | + V3270_COLOR_PURPLE, | |
| 67 | + V3270_COLOR_DARK_GREEN, | |
| 68 | + V3270_COLOR_DARK_TURQUOISE, | |
| 69 | + V3270_COLOR_MUSTARD, | |
| 70 | + V3270_COLOR_GRAY, | |
| 71 | + | |
| 72 | + V3270_COLOR_FIELD, | |
| 73 | + V3270_COLOR_FIELD_INTENSIFIED, | |
| 74 | + V3270_COLOR_FIELD_PROTECTED, | |
| 75 | + V3270_COLOR_FIELD_PROTECTED_INTENSIFIED, | |
| 76 | + | |
| 77 | + V3270_COLOR_SELECTED_BG, | |
| 78 | + V3270_COLOR_SELECTED_FG, | |
| 79 | + | |
| 80 | + V3270_COLOR_CROSS_HAIR, | |
| 81 | + | |
| 82 | + // Oia Colors (Must be the last block) | |
| 83 | + V3270_COLOR_OIA_BACKGROUND, | |
| 84 | + V3270_COLOR_OIA_FOREGROUND, | |
| 85 | + V3270_COLOR_OIA_SEPARATOR, | |
| 86 | + V3270_COLOR_OIA_STATUS_OK, | |
| 87 | + V3270_COLOR_OIA_STATUS_INVALID, | |
| 88 | + | |
| 89 | + V3270_COLOR_COUNT | |
| 90 | + }; | |
| 91 | + | |
| 92 | + #define V3270_COLOR_OIA_STATUS_WARNING V3270_COLOR_OIA_STATUS_OK | |
| 93 | + | |
| 94 | + typedef enum _v3270_oia_field | |
| 95 | + { | |
| 96 | + V3270_OIA_UNDERA, /**< "A" underlined */ | |
| 97 | + V3270_OIA_CONNECTION, /**< solid box if connected, "?" in a box if not */ | |
| 98 | + V3270_OIA_MESSAGE, /**< message area */ | |
| 99 | + V3270_OIA_SSL, /**< SSL Status */ | |
| 100 | + /**< Meta indication ("M" or blank) */ | |
| 101 | + V3270_OIA_ALT, /**< Alt indication ("A" or blank) */ | |
| 102 | + /**< Compose indication ("C" or blank) */ | |
| 103 | + /**< Compose first character */ | |
| 104 | + V3270_OIA_SHIFT, /**< Shift Status */ | |
| 105 | + V3270_OIA_TYPEAHEAD, /**< Typeahead indication ("T" or blank) */ | |
| 106 | + V3270_OIA_INSERT, /**< Insert mode indication (Special symbol/"I" or blank) */ | |
| 107 | + V3270_OIA_SCRIPT, /**< Script indication ("S" or blank) */ | |
| 108 | + V3270_OIA_LUNAME, /**< LU Name */ | |
| 109 | + V3270_OIA_SPINNER, /**< command timing spinner */ | |
| 110 | + V3270_OIA_TIMER, /**< command timing (mmm:ss, or blank) */ | |
| 111 | + V3270_OIA_CURSOR_POSITION, /**< cursor position (rrr/ccc or blank) */ | |
| 112 | + | |
| 113 | +// V3270_OIA_CAPS, /**< Caps indication ("A" or blank) */ | |
| 114 | + | |
| 115 | +#ifdef HAVE_PRINTER | |
| 116 | + V3270_OIA_PRINTER, /**< Printer indication ("P" or blank) */ | |
| 117 | +#endif // HAVE_PRINTER | |
| 118 | + | |
| 119 | + V3270_OIA_FIELD_COUNT | |
| 120 | + | |
| 121 | + } V3270_OIA_FIELD; | |
| 122 | + | |
| 123 | + | |
| 124 | + #define V3270_COLOR_OIA_SPINNER V3270_COLOR_OIA_FOREGROUND | |
| 125 | + #define V3270_COLOR_OIA_LUNAME V3270_COLOR_OIA_FOREGROUND | |
| 126 | + #define V3270_COLOR_OIA_INSERT V3270_COLOR_OIA_FOREGROUND | |
| 127 | + | |
| 128 | + #ifndef v3270char | |
| 129 | + #define v3270char void | |
| 130 | + #endif // v3270_char | |
| 131 | + | |
| 132 | + LIB3270_EXPORT GtkWidget * v3270_new(void); | |
| 133 | + LIB3270_EXPORT GType v3270_get_type(void); | |
| 134 | + | |
| 135 | + LIB3270_EXPORT void v3270_reload(GtkWidget * widget); | |
| 136 | + | |
| 137 | + LIB3270_EXPORT void v3270_set_font_family(GtkWidget *widget, const gchar *name); | |
| 138 | + LIB3270_EXPORT const gchar * v3270_get_font_family(GtkWidget *widget); | |
| 139 | + | |
| 140 | + LIB3270_EXPORT H3270 * v3270_get_session(GtkWidget *widget); | |
| 141 | + | |
| 142 | + LIB3270_EXPORT int v3270_connect(GtkWidget *widget, const gchar *host); | |
| 143 | + LIB3270_EXPORT void v3270_disconnect(GtkWidget *widget); | |
| 144 | + | |
| 145 | + // Clipboard | |
| 146 | + typedef enum _v3270_select_format | |
| 147 | + { | |
| 148 | + V3270_SELECT_TEXT, | |
| 149 | + V3270_SELECT_TABLE, | |
| 150 | + | |
| 151 | + V3270_SELECT_MAX | |
| 152 | + } V3270_SELECT_FORMAT; | |
| 153 | + | |
| 154 | + LIB3270_EXPORT const gchar * v3270_copy(GtkWidget *widget, V3270_SELECT_FORMAT mode, gboolean cut); | |
| 155 | + LIB3270_EXPORT const gchar * v3270_copy_append(GtkWidget *widget); | |
| 156 | + | |
| 157 | + LIB3270_EXPORT const gchar * v3270_get_selected_text(GtkWidget *widget, gboolean cut); | |
| 158 | + LIB3270_EXPORT const gchar * v3270_get_copy(GtkWidget *widget); | |
| 159 | + LIB3270_EXPORT gchar * v3270_get_text(GtkWidget *widget,int offset, int len); | |
| 160 | + LIB3270_EXPORT gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboolean all); | |
| 161 | + | |
| 162 | + LIB3270_EXPORT void v3270_set_string(GtkWidget *widget, const gchar *str); | |
| 163 | + LIB3270_EXPORT void v3270_tab(GtkWidget *widget); | |
| 164 | + LIB3270_EXPORT void v3270_backtab(GtkWidget *widget); | |
| 165 | + | |
| 166 | + // Cut & Paste | |
| 167 | + LIB3270_EXPORT gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end); | |
| 168 | + LIB3270_EXPORT void v3270_unselect(GtkWidget *widget); | |
| 169 | + LIB3270_EXPORT void v3270_paste(GtkWidget *widget); | |
| 170 | + LIB3270_EXPORT void v3270_paste_string(GtkWidget *widget, const gchar *text, const gchar *encoding); | |
| 171 | + LIB3270_EXPORT void v3270_select_region(GtkWidget *widget, gint start, gint end); | |
| 172 | + | |
| 173 | + // Colors | |
| 174 | + LIB3270_EXPORT void v3270_set_colors(GtkWidget *widget, const gchar *); | |
| 175 | + LIB3270_EXPORT void v3270_set_color_table(GdkColor *table, const gchar *colors); | |
| 176 | + LIB3270_EXPORT const GdkColor * v3270_get_color_table(GtkWidget *widget); | |
| 177 | + LIB3270_EXPORT void v3270_set_mono_color_table(GdkColor *table, const gchar *fg, const gchar *bg); | |
| 178 | + LIB3270_EXPORT void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 *session, guint height, GdkRectangle *rect, GdkColor *color); | |
| 179 | + LIB3270_EXPORT void v3270_set_color(GtkWidget *widget, enum V3270_COLOR id, GdkColor *color); | |
| 180 | + LIB3270_EXPORT GdkColor * v3270_get_color(GtkWidget *widget, enum V3270_COLOR id); | |
| 181 | + | |
| 182 | + // Misc | |
| 183 | + LIB3270_EXPORT GtkIMContext * v3270_get_im_context(GtkWidget *widget); | |
| 184 | + LIB3270_EXPORT gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); | |
| 185 | + LIB3270_EXPORT void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type, const gchar *title, const gchar *message, const gchar *text); | |
| 186 | + LIB3270_EXPORT const gchar * v3270_get_session_name(GtkWidget *widget); | |
| 187 | + LIB3270_EXPORT void v3270_set_session_name(GtkWidget *widget, const gchar *name); | |
| 188 | + LIB3270_EXPORT int v3270_set_script(GtkWidget *widget, const gchar id, unsigned char on); | |
| 189 | + | |
| 190 | + LIB3270_EXPORT void v3270_set_host(GtkWidget *widget, const gchar *uri); | |
| 191 | + | |
| 192 | + // Keyboard & Mouse special actions | |
| 193 | + LIB3270_EXPORT gboolean v3270_set_keyboard_action(GtkWidget *widget, const gchar *key_name, GtkAction *action); | |
| 194 | + LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action); | |
| 195 | + | |
| 196 | +G_END_DECLS | |
| 197 | + | |
| 198 | +#endif // V3270_H_INCLUDED | ... | ... |
src/include/v3270.h
| ... | ... | @@ -1,199 +0,0 @@ |
| 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 v3270.h 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 | - * licinio@bb.com.br (Licínio Luis Branco) | |
| 28 | - * kraucer@bb.com.br (Kraucer Fernandes Mazuco) | |
| 29 | - * | |
| 30 | - */ | |
| 31 | - | |
| 32 | -#ifndef V3270_H_INCLUDED | |
| 33 | - | |
| 34 | - #include <gtk/gtk.h> | |
| 35 | - #include <lib3270/config.h> | |
| 36 | - #include <lib3270.h> | |
| 37 | - | |
| 38 | - #define V3270_H_INCLUDED 1 | |
| 39 | - | |
| 40 | - G_BEGIN_DECLS | |
| 41 | - | |
| 42 | - #define GTK_TYPE_V3270 (v3270_get_type ()) | |
| 43 | - #define GTK_V3270(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270, v3270)) | |
| 44 | - #define GTK_V3270_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270, v3270Class)) | |
| 45 | - #define GTK_IS_V3270(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270)) | |
| 46 | - #define GTK_IS_V3270_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270)) | |
| 47 | - #define GTK_V3270_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270, v3270Class)) | |
| 48 | - | |
| 49 | - | |
| 50 | - typedef struct _v3270 v3270; | |
| 51 | - typedef struct _v3270Class v3270Class; | |
| 52 | - | |
| 53 | - enum V3270_COLOR | |
| 54 | - { | |
| 55 | - V3270_COLOR_BACKGROUND, | |
| 56 | - V3270_COLOR_BLUE, | |
| 57 | - V3270_COLOR_RED, | |
| 58 | - V3270_COLOR_PINK, | |
| 59 | - V3270_COLOR_GREEN, | |
| 60 | - V3270_COLOR_TURQUOISE, | |
| 61 | - V3270_COLOR_YELLOW, | |
| 62 | - V3270_COLOR_WHITE, | |
| 63 | - V3270_COLOR_BLACK, | |
| 64 | - V3270_COLOR_DARK_BLUE, | |
| 65 | - V3270_COLOR_ORANGE, | |
| 66 | - V3270_COLOR_PURPLE, | |
| 67 | - V3270_COLOR_DARK_GREEN, | |
| 68 | - V3270_COLOR_DARK_TURQUOISE, | |
| 69 | - V3270_COLOR_MUSTARD, | |
| 70 | - V3270_COLOR_GRAY, | |
| 71 | - | |
| 72 | - V3270_COLOR_FIELD, | |
| 73 | - V3270_COLOR_FIELD_INTENSIFIED, | |
| 74 | - V3270_COLOR_FIELD_PROTECTED, | |
| 75 | - V3270_COLOR_FIELD_PROTECTED_INTENSIFIED, | |
| 76 | - | |
| 77 | - V3270_COLOR_SELECTED_BG, | |
| 78 | - V3270_COLOR_SELECTED_FG, | |
| 79 | - | |
| 80 | - V3270_COLOR_CROSS_HAIR, | |
| 81 | - | |
| 82 | - // Oia Colors (Must be the last block) | |
| 83 | - V3270_COLOR_OIA_BACKGROUND, | |
| 84 | - V3270_COLOR_OIA_FOREGROUND, | |
| 85 | - V3270_COLOR_OIA_SEPARATOR, | |
| 86 | - V3270_COLOR_OIA_STATUS_OK, | |
| 87 | - V3270_COLOR_OIA_STATUS_INVALID, | |
| 88 | - | |
| 89 | - V3270_COLOR_COUNT | |
| 90 | - }; | |
| 91 | - | |
| 92 | - #define V3270_COLOR_OIA_STATUS_WARNING V3270_COLOR_OIA_STATUS_OK | |
| 93 | - | |
| 94 | - typedef enum _v3270_oia_field | |
| 95 | - { | |
| 96 | - V3270_OIA_UNDERA, /**< "A" underlined */ | |
| 97 | - V3270_OIA_CONNECTION, /**< solid box if connected, "?" in a box if not */ | |
| 98 | - V3270_OIA_MESSAGE, /**< message area */ | |
| 99 | - V3270_OIA_SSL, /**< SSL Status */ | |
| 100 | - /**< Meta indication ("M" or blank) */ | |
| 101 | - V3270_OIA_ALT, /**< Alt indication ("A" or blank) */ | |
| 102 | - /**< Compose indication ("C" or blank) */ | |
| 103 | - /**< Compose first character */ | |
| 104 | - V3270_OIA_SHIFT, /**< Shift Status */ | |
| 105 | - V3270_OIA_TYPEAHEAD, /**< Typeahead indication ("T" or blank) */ | |
| 106 | - V3270_OIA_INSERT, /**< Insert mode indication (Special symbol/"I" or blank) */ | |
| 107 | -#ifdef HAVE_SCRIPT | |
| 108 | - V3270_OIA_SCRIPT, /**< Script indication ("S" or blank) */ | |
| 109 | -#endif // HAVE_SCRIPT | |
| 110 | - V3270_OIA_LUNAME, /**< LU Name */ | |
| 111 | - V3270_OIA_SPINNER, /**< command timing spinner */ | |
| 112 | - V3270_OIA_TIMER, /**< command timing (mmm:ss, or blank) */ | |
| 113 | - V3270_OIA_CURSOR_POSITION, /**< cursor position (rrr/ccc or blank) */ | |
| 114 | - | |
| 115 | -// V3270_OIA_CAPS, /**< Caps indication ("A" or blank) */ | |
| 116 | - | |
| 117 | -#ifdef HAVE_PRINTER | |
| 118 | - V3270_OIA_PRINTER, /**< Printer indication ("P" or blank) */ | |
| 119 | -#endif // HAVE_PRINTER | |
| 120 | - | |
| 121 | - V3270_OIA_FIELD_COUNT | |
| 122 | - | |
| 123 | - } V3270_OIA_FIELD; | |
| 124 | - | |
| 125 | - | |
| 126 | - #define V3270_COLOR_OIA_SPINNER V3270_COLOR_OIA_FOREGROUND | |
| 127 | - #define V3270_COLOR_OIA_LUNAME V3270_COLOR_OIA_FOREGROUND | |
| 128 | - #define V3270_COLOR_OIA_INSERT V3270_COLOR_OIA_FOREGROUND | |
| 129 | - | |
| 130 | - #ifndef v3270char | |
| 131 | - #define v3270char void | |
| 132 | - #endif // v3270_char | |
| 133 | - | |
| 134 | - LIB3270_EXPORT GtkWidget * v3270_new(void); | |
| 135 | - LIB3270_EXPORT GType v3270_get_type(void); | |
| 136 | - | |
| 137 | - LIB3270_EXPORT void v3270_reload(GtkWidget * widget); | |
| 138 | - | |
| 139 | - LIB3270_EXPORT void v3270_set_font_family(GtkWidget *widget, const gchar *name); | |
| 140 | - LIB3270_EXPORT const gchar * v3270_get_font_family(GtkWidget *widget); | |
| 141 | - | |
| 142 | - LIB3270_EXPORT H3270 * v3270_get_session(GtkWidget *widget); | |
| 143 | - | |
| 144 | - LIB3270_EXPORT int v3270_connect(GtkWidget *widget, const gchar *host); | |
| 145 | - LIB3270_EXPORT void v3270_disconnect(GtkWidget *widget); | |
| 146 | - | |
| 147 | - // Clipboard | |
| 148 | - typedef enum _v3270_select_format | |
| 149 | - { | |
| 150 | - V3270_SELECT_TEXT, | |
| 151 | - V3270_SELECT_TABLE, | |
| 152 | - | |
| 153 | - V3270_SELECT_MAX | |
| 154 | - } V3270_SELECT_FORMAT; | |
| 155 | - | |
| 156 | - LIB3270_EXPORT const gchar * v3270_copy(GtkWidget *widget, V3270_SELECT_FORMAT mode, gboolean cut); | |
| 157 | - LIB3270_EXPORT const gchar * v3270_copy_append(GtkWidget *widget); | |
| 158 | - | |
| 159 | - LIB3270_EXPORT const gchar * v3270_get_selected_text(GtkWidget *widget, gboolean cut); | |
| 160 | - LIB3270_EXPORT const gchar * v3270_get_copy(GtkWidget *widget); | |
| 161 | - LIB3270_EXPORT gchar * v3270_get_text(GtkWidget *widget,int offset, int len); | |
| 162 | - LIB3270_EXPORT gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboolean all); | |
| 163 | - | |
| 164 | - LIB3270_EXPORT void v3270_set_string(GtkWidget *widget, const gchar *str); | |
| 165 | - LIB3270_EXPORT void v3270_tab(GtkWidget *widget); | |
| 166 | - LIB3270_EXPORT void v3270_backtab(GtkWidget *widget); | |
| 167 | - | |
| 168 | - // Cut & Paste | |
| 169 | - LIB3270_EXPORT gboolean v3270_get_selection_bounds(GtkWidget *widget, gint *start, gint *end); | |
| 170 | - LIB3270_EXPORT void v3270_unselect(GtkWidget *widget); | |
| 171 | - LIB3270_EXPORT void v3270_paste(GtkWidget *widget); | |
| 172 | - LIB3270_EXPORT void v3270_paste_string(GtkWidget *widget, const gchar *text, const gchar *encoding); | |
| 173 | - LIB3270_EXPORT void v3270_select_region(GtkWidget *widget, gint start, gint end); | |
| 174 | - | |
| 175 | - // Colors | |
| 176 | - LIB3270_EXPORT void v3270_set_colors(GtkWidget *widget, const gchar *); | |
| 177 | - LIB3270_EXPORT void v3270_set_color_table(GdkColor *table, const gchar *colors); | |
| 178 | - LIB3270_EXPORT const GdkColor * v3270_get_color_table(GtkWidget *widget); | |
| 179 | - LIB3270_EXPORT void v3270_set_mono_color_table(GdkColor *table, const gchar *fg, const gchar *bg); | |
| 180 | - LIB3270_EXPORT void v3270_draw_element(cairo_t *cr, unsigned char chr, unsigned short attr, H3270 *session, guint height, GdkRectangle *rect, GdkColor *color); | |
| 181 | - LIB3270_EXPORT void v3270_set_color(GtkWidget *widget, enum V3270_COLOR id, GdkColor *color); | |
| 182 | - LIB3270_EXPORT GdkColor * v3270_get_color(GtkWidget *widget, enum V3270_COLOR id); | |
| 183 | - | |
| 184 | - // Misc | |
| 185 | - LIB3270_EXPORT GtkIMContext * v3270_get_im_context(GtkWidget *widget); | |
| 186 | - LIB3270_EXPORT gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix); | |
| 187 | - LIB3270_EXPORT void v3270_popup_message(GtkWidget *widget, LIB3270_NOTIFY type, const gchar *title, const gchar *message, const gchar *text); | |
| 188 | - LIB3270_EXPORT const gchar * v3270_get_session_name(GtkWidget *widget); | |
| 189 | - LIB3270_EXPORT void v3270_set_session_name(GtkWidget *widget, const gchar *name); | |
| 190 | - | |
| 191 | - LIB3270_EXPORT void v3270_set_host(GtkWidget *widget, const gchar *uri); | |
| 192 | - | |
| 193 | - // Keyboard & Mouse special actions | |
| 194 | - LIB3270_EXPORT gboolean v3270_set_keyboard_action(GtkWidget *widget, const gchar *key_name, GtkAction *action); | |
| 195 | - LIB3270_EXPORT void v3270_set_scroll_action(GtkWidget *widget, GdkScrollDirection direction, GtkAction *action); | |
| 196 | - | |
| 197 | -G_END_DECLS | |
| 198 | - | |
| 199 | -#endif // V3270_H_INCLUDED |
src/plugins/remotectl/hllapi.c
| ... | ... | @@ -37,28 +37,59 @@ |
| 37 | 37 | |
| 38 | 38 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ |
| 39 | 39 | |
| 40 | - static char *session_name = NULL; | |
| 40 | +#ifdef WIN32 | |
| 41 | + | |
| 42 | + static HANDLE hPipe = INVALID_HANDLE_VALUE; | |
| 43 | + | |
| 44 | +#endif // WIN32 | |
| 41 | 45 | |
| 42 | 46 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 43 | 47 | |
| 48 | + static int cmd_connect_ps(const char *name) | |
| 49 | + { | |
| 50 | +#ifdef WIN32 | |
| 51 | + | |
| 52 | + static DWORD dwMode = PIPE_READMODE_MESSAGE; | |
| 53 | + char PipeName[4096]; | |
| 54 | + | |
| 55 | + if(hPipe != INVALID_HANDLE_VALUE) | |
| 56 | + return EBUSY; | |
| 57 | + | |
| 58 | + snprintf(PipeName,4095,"\\\\.\\pipe\\%s",name); | |
| 59 | + | |
| 60 | + if(!WaitNamedPipe(PipeName,NMPWAIT_USE_DEFAULT_WAIT)) | |
| 61 | + return ETIMEDOUT; | |
| 62 | + | |
| 63 | + hPipe = CreateFile(PipeName,GENERIC_WRITE|GENERIC_READ,0,NULL,OPEN_EXISTING,0,NULL); | |
| 64 | + | |
| 65 | + if(hPipe == INVALID_HANDLE_VALUE) | |
| 66 | + return GetLastError(); | |
| 67 | + | |
| 68 | + if(!SetNamedPipeHandleState(hPipe,&dwMode,NULL,NULL)) | |
| 69 | + return GetLastError(); | |
| 70 | + | |
| 71 | +#else | |
| 72 | + | |
| 73 | + #error Not implemented | |
| 74 | + | |
| 75 | +#endif // WIN32 | |
| 76 | + | |
| 77 | + return 0; | |
| 78 | + } | |
| 79 | + | |
| 80 | + | |
| 44 | 81 | static int run_query(unsigned long func, const char *arg, char *string, unsigned short length, unsigned short *rc) |
| 45 | 82 | { |
| 46 | 83 | int result = -1; |
| 47 | 84 | |
| 48 | 85 | #ifdef WIN32 |
| 49 | - char PipeName[4096]; | |
| 50 | 86 | |
| 51 | 87 | if(length < 0 && string) |
| 52 | 88 | length = strlen(string); |
| 53 | 89 | |
| 54 | - if(!session_name) | |
| 55 | - session_name = strdup("pw3270A"); | |
| 56 | - | |
| 57 | - snprintf(PipeName,4095,"\\\\.\\pipe\\%s",session_name); | |
| 58 | - | |
| 59 | - if(!WaitNamedPipe(PipeName,NMPWAIT_USE_DEFAULT_WAIT)) | |
| 90 | + if(hPipe == INVALID_HANDLE_VALUE) | |
| 60 | 91 | { |
| 61 | - result = ETIMEDOUT; | |
| 92 | + result = EPERM; | |
| 62 | 93 | } |
| 63 | 94 | else |
| 64 | 95 | { |
| ... | ... | @@ -81,7 +112,7 @@ |
| 81 | 112 | } |
| 82 | 113 | |
| 83 | 114 | memset(buffer,0,HLLAPI_MAXLENGTH); |
| 84 | - if(!CallNamedPipe(PipeName,(LPVOID)data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NMPWAIT_USE_DEFAULT_WAIT)) | |
| 115 | + if(!TransactNamedPipe(hPipe,(LPVOID) data,cbSize,buffer,HLLAPI_MAXLENGTH,&cbSize,NULL)) | |
| 85 | 116 | { |
| 86 | 117 | result = GetLastError(); |
| 87 | 118 | } |
| ... | ... | @@ -112,15 +143,7 @@ |
| 112 | 143 | return result; |
| 113 | 144 | } |
| 114 | 145 | |
| 115 | - static int set_session_name(const char *name) | |
| 116 | - { | |
| 117 | - if(!session_name) | |
| 118 | - free(session_name); | |
| 119 | - session_name = strdup(name); | |
| 120 | - return 0; | |
| 121 | - } | |
| 122 | - | |
| 123 | - LIB3270_EXPORT int hllapi(unsigned long *func, char *str, unsigned short *length, unsigned short *rc) | |
| 146 | + LIB3270_EXPORT int hllapi(const unsigned long *func, char *str, unsigned short *length, unsigned short *rc) | |
| 124 | 147 | { |
| 125 | 148 | int result = 1; |
| 126 | 149 | char * arg; |
| ... | ... | @@ -149,18 +172,31 @@ |
| 149 | 172 | switch(*func) |
| 150 | 173 | { |
| 151 | 174 | case HLLAPI_CMD_CONNECTPS: |
| 152 | - result = set_session_name(arg); | |
| 175 | + result = cmd_connect_ps(arg); | |
| 153 | 176 | if(!result) |
| 177 | + { | |
| 154 | 178 | result = run_query(*func, arg, str, *length, rc); |
| 179 | + if(result || rc) | |
| 180 | + { | |
| 181 | + CloseHandle(hPipe); | |
| 182 | + hPipe = INVALID_HANDLE_VALUE; | |
| 183 | + } | |
| 184 | + } | |
| 155 | 185 | break; |
| 156 | 186 | |
| 157 | 187 | case HLLAPI_CMD_DISCONNECTPS: |
| 158 | - if(session_name) | |
| 188 | +#ifdef WIN32 | |
| 189 | + if(hPipe == INVALID_HANDLE_VALUE) | |
| 190 | + { | |
| 191 | + result = EINVAL; | |
| 192 | + } | |
| 193 | + else | |
| 159 | 194 | { |
| 160 | 195 | result = run_query(*func, arg, str, *length, rc); |
| 161 | - free(session_name); | |
| 162 | - session_name = NULL; | |
| 196 | + CloseHandle(hPipe); | |
| 197 | + hPipe = INVALID_HANDLE_VALUE; | |
| 163 | 198 | } |
| 199 | +#endif // WIN32 | |
| 164 | 200 | break; |
| 165 | 201 | |
| 166 | 202 | default: | ... | ... |
src/plugins/remotectl/pipesource.c
| ... | ... | @@ -26,10 +26,12 @@ |
| 26 | 26 | * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) |
| 27 | 27 | * licinio@bb.com.br (Licínio Luis Branco) |
| 28 | 28 | * kraucer@bb.com.br (Kraucer Fernandes Mazuco) |
| 29 | - * macmiranda@bb.com.br (Marco Aurélio Caldas Miranda) | |
| 30 | 29 | * |
| 31 | 30 | */ |
| 32 | 31 | |
| 32 | + #include <pw3270.h> | |
| 33 | + #include <pw3270/v3270.h> | |
| 34 | + | |
| 33 | 35 | #ifdef WIN32 |
| 34 | 36 | |
| 35 | 37 | #include <windows.h> |
| ... | ... | @@ -64,6 +66,7 @@ |
| 64 | 66 | |
| 65 | 67 | static void wait_for_client(pipe_source *source) |
| 66 | 68 | { |
| 69 | + v3270_set_script(pw3270_get_terminal_widget(NULL),'H',0); | |
| 67 | 70 | if(ConnectNamedPipe(source->hPipe,&source->overlap)) |
| 68 | 71 | { |
| 69 | 72 | popup_lasterror("%s",_( "Error in ConnectNamedPipe" )); |
| ... | ... | @@ -80,7 +83,8 @@ static void wait_for_client(pipe_source *source) |
| 80 | 83 | |
| 81 | 84 | // Client is already connected, so signal an event. |
| 82 | 85 | case ERROR_PIPE_CONNECTED: |
| 83 | - // trace("%s: ERROR_PIPE_CONNECTED",__FUNCTION__); | |
| 86 | + trace("%s: ERROR_PIPE_CONNECTED",__FUNCTION__); | |
| 87 | + v3270_set_script(pw3270_get_terminal_widget(NULL),'H',1); | |
| 84 | 88 | if(SetEvent(source->overlap.hEvent)) |
| 85 | 89 | break; |
| 86 | 90 | |
| ... | ... | @@ -174,15 +178,21 @@ static void wait_for_client(pipe_source *source) |
| 174 | 178 | break; |
| 175 | 179 | |
| 176 | 180 | case ERROR_BROKEN_PIPE: |
| 177 | - // trace("%s: ERROR_BROKEN_PIPE",__FUNCTION__); | |
| 181 | + trace("%s: ERROR_BROKEN_PIPE",__FUNCTION__); | |
| 178 | 182 | if(!DisconnectNamedPipe(source->hPipe)) |
| 183 | + { | |
| 184 | + v3270_set_script(pw3270_get_terminal_widget(NULL),'H',0); | |
| 179 | 185 | popup_lasterror("%s",_( "Error in DisconnectNamedPipe" )); |
| 186 | + } | |
| 180 | 187 | else |
| 188 | + { | |
| 181 | 189 | wait_for_client(source); |
| 190 | + } | |
| 182 | 191 | break; |
| 183 | 192 | |
| 184 | 193 | case ERROR_PIPE_NOT_CONNECTED: |
| 185 | - // trace("%s: ERROR_PIPE_NOT_CONNECTED",__FUNCTION__); | |
| 194 | + trace("%s: ERROR_PIPE_NOT_CONNECTED",__FUNCTION__); | |
| 195 | + v3270_set_script(pw3270_get_terminal_widget(NULL),'H',0); | |
| 186 | 196 | break; |
| 187 | 197 | |
| 188 | 198 | default: |
| ... | ... | @@ -216,7 +226,8 @@ static void wait_for_client(pipe_source *source) |
| 216 | 226 | case PIPE_STATE_WAITING: |
| 217 | 227 | if(fSuccess) |
| 218 | 228 | { |
| 219 | - // trace("Pipe connected (cbRet=%d)",(int) cbRead); | |
| 229 | + trace("Pipe connected (cbRet=%d)",(int) cbRead); | |
| 230 | + v3270_set_script(pw3270_get_terminal_widget(NULL),'H',1); | |
| 220 | 231 | ((pipe_source *) source)->state = PIPE_STATE_READ; |
| 221 | 232 | } |
| 222 | 233 | else | ... | ... |
src/plugins/remotectl/remotectl.c
| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 | #include "remotectl.h" |
| 35 | 35 | #include <pw3270.h> |
| 36 | 36 | #include <pw3270/plugin.h> |
| 37 | + #include <pw3270/v3270.h> | |
| 37 | 38 | #include <errno.h> |
| 38 | 39 | #include <string.h> |
| 39 | 40 | |
| ... | ... | @@ -95,6 +96,7 @@ |
| 95 | 96 | 0, // client time-out |
| 96 | 97 | NULL); // default security attributes |
| 97 | 98 | |
| 99 | + trace("%s = %p",pipename,hPipe); | |
| 98 | 100 | g_free(pipename); |
| 99 | 101 | |
| 100 | 102 | if(hPipe != INVALID_HANDLE_VALUE) |
| ... | ... | @@ -136,7 +138,7 @@ |
| 136 | 138 | static int cmd_connectps(H3270 *hSession, unsigned short rc, char *string, unsigned short length) |
| 137 | 139 | { |
| 138 | 140 | g_message("%s","HLLAPI ConnectPS request received"); |
| 139 | - return 0; | |
| 141 | + return v3270_set_script(pw3270_get_terminal_widget(NULL),'H',1); | |
| 140 | 142 | } |
| 141 | 143 | |
| 142 | 144 | static int cmd_disconnectps(H3270 *hSession, unsigned short rc, char *string, unsigned short length) | ... | ... |
src/plugins/remotectl/testprogram.c
| ... | ... | @@ -38,19 +38,33 @@ |
| 38 | 38 | char buffer[1024]; |
| 39 | 39 | unsigned short rc; |
| 40 | 40 | |
| 41 | - // Set session name | |
| 42 | - strcpy(buffer,"pw3270A"); | |
| 43 | - printf("ConnectPS exits with %d\n[%s]\n",hllapi(HLLAPI_CMD_CONNECTPS,buffer,1024,&rc),buffer); | |
| 44 | - | |
| 45 | - // Test for GetRevision call | |
| 46 | - *buffer = 0; | |
| 47 | - printf("GetRevision exits with %d\n[%s]\n",hllapi(HLLAPI_CMD_GETREVISION,buffer,1024,&rc),buffer); | |
| 48 | - printf("query rc=%d\n\n",rc); | |
| 49 | - | |
| 50 | - // Test for string input | |
| 51 | - strcpy(buffer,"test"); | |
| 52 | - printf("InputString exits with %d\n[%s]\n",hllapi(HLLAPI_CMD_INPUTSTRING,buffer,1024,&rc),buffer); | |
| 53 | - printf("query rc=%d\n\n",rc); | |
| 41 | + static const struct _cmd | |
| 42 | + { | |
| 43 | + const char * name; | |
| 44 | + unsigned long fn; | |
| 45 | + const char * arg; | |
| 46 | + } cmd[] = | |
| 47 | + { | |
| 48 | + { "ConnectPS", HLLAPI_CMD_CONNECTPS, "pw3270A" }, | |
| 49 | + { "GetRevision", HLLAPI_CMD_GETREVISION, "" }, | |
| 50 | + { "InputString", HLLAPI_CMD_INPUTSTRING, "test" }, | |
| 51 | + | |
| 52 | + { "DisconnectPS", HLLAPI_CMD_DISCONNECTPS, "" }, | |
| 53 | + }; | |
| 54 | + | |
| 55 | + int f; | |
| 56 | + | |
| 57 | + | |
| 58 | + for(f=0;f< (sizeof(cmd)/sizeof(struct _cmd)); f++) | |
| 59 | + { | |
| 60 | + unsigned short len = 1024; | |
| 61 | + int result; | |
| 62 | + | |
| 63 | + strcpy(buffer,cmd[f].arg); | |
| 64 | + result = hllapi(&cmd[f].fn,buffer,&len,&rc); | |
| 65 | + printf("%s exits with %d\n[%s]\n",cmd[f].name,result,buffer); | |
| 66 | + | |
| 67 | + } | |
| 54 | 68 | |
| 55 | 69 | return 0; |
| 56 | 70 | } | ... | ... |
src/pw3270/actions.c
src/pw3270/dialog.c
src/pw3270/globals.h
src/pw3270/main.c
src/pw3270/print.c
src/pw3270/uiparser/parser.c
src/pw3270/v3270/accessible.c
src/pw3270/v3270/draw.c
| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | #include <pw3270.h> |
| 33 | 33 | #include <lib3270.h> |
| 34 | 34 | #include <lib3270/session.h> |
| 35 | - #include <v3270.h> | |
| 35 | + #include <pw3270/v3270.h> | |
| 36 | 36 | #include "private.h" |
| 37 | 37 | |
| 38 | 38 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | ... | ... |
src/pw3270/v3270/keyboard.c
src/pw3270/v3270/mouse.c
src/pw3270/v3270/oia.c
| ... | ... | @@ -40,7 +40,7 @@ |
| 40 | 40 | #include <math.h> |
| 41 | 41 | #endif // HAVE_LIBM |
| 42 | 42 | |
| 43 | - #include <v3270.h> | |
| 43 | + #include <pw3270/v3270.h> | |
| 44 | 44 | #include "private.h" |
| 45 | 45 | #include "accessible.h" |
| 46 | 46 | |
| ... | ... | @@ -505,9 +505,7 @@ void v3270_draw_oia(cairo_t *cr, H3270 *host, int row, int cols, struct v3270_me |
| 505 | 505 | #ifdef HAVE_PRINTER |
| 506 | 506 | { V3270_OIA_PRINTER, setup_single_char_right }, |
| 507 | 507 | #endif // HAVE_PRINTER |
| 508 | -#ifdef HAVE_SCRIPT | |
| 509 | 508 | { V3270_OIA_SCRIPT, setup_single_char_right }, |
| 510 | -#endif // HAVE_SCRIPT | |
| 511 | 509 | { V3270_OIA_INSERT, setup_insert_position }, |
| 512 | 510 | { V3270_OIA_TYPEAHEAD, setup_single_char_right }, |
| 513 | 511 | { V3270_OIA_SHIFT, setup_double_char_position }, |
| ... | ... | @@ -858,10 +856,11 @@ void v3270_draw_shift_status(v3270 *terminal) |
| 858 | 856 | |
| 859 | 857 | } |
| 860 | 858 | |
| 861 | -static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id, const gchar *text) | |
| 859 | +static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id, const gchar chr) | |
| 862 | 860 | { |
| 863 | - GdkRectangle *r; | |
| 864 | - cairo_t *cr; | |
| 861 | + GdkRectangle * r; | |
| 862 | + cairo_t * cr; | |
| 863 | + gchar text[] = { chr, 0 }; | |
| 865 | 864 | |
| 866 | 865 | if(!terminal->surface) |
| 867 | 866 | return; |
| ... | ... | @@ -882,7 +881,7 @@ static void update_text_field(v3270 *terminal, gboolean flag, V3270_OIA_FIELD id |
| 882 | 881 | |
| 883 | 882 | void v3270_draw_alt_status(v3270 *terminal) |
| 884 | 883 | { |
| 885 | - update_text_field(terminal,terminal->keyflags & KEY_FLAG_ALT,V3270_OIA_ALT,"A"); | |
| 884 | + update_text_field(terminal,terminal->keyflags & KEY_FLAG_ALT,V3270_OIA_ALT,'A'); | |
| 886 | 885 | } |
| 887 | 886 | |
| 888 | 887 | void v3270_draw_ins_status(v3270 *terminal) |
| ... | ... | @@ -1050,23 +1049,76 @@ void v3270_update_oia(H3270 *session, LIB3270_FLAG id, unsigned char on) |
| 1050 | 1049 | break; |
| 1051 | 1050 | |
| 1052 | 1051 | case LIB3270_FLAG_TYPEAHEAD: |
| 1053 | - update_text_field(terminal,on,V3270_OIA_TYPEAHEAD,"T"); | |
| 1052 | + update_text_field(terminal,on,V3270_OIA_TYPEAHEAD,'T'); | |
| 1054 | 1053 | break; |
| 1055 | 1054 | |
| 1056 | 1055 | #ifdef HAVE_PRINTER |
| 1057 | 1056 | case LIB3270_FLAG_PRINTER: |
| 1058 | - update_text_field(terminal,on,V3270_OIA_PRINTER,"P"); | |
| 1057 | + update_text_field(terminal,on,V3270_OIA_PRINTER,'P'); | |
| 1059 | 1058 | break; |
| 1060 | 1059 | #endif // HAVE_PRINTER |
| 1061 | 1060 | |
| 1062 | -#ifdef HAVE_SCRIPT | |
| 1061 | +/* | |
| 1063 | 1062 | case LIB3270_FLAG_SCRIPT: |
| 1064 | - update_text_field(terminal,on,V3270_OIA_SCRIPT,"S"); | |
| 1063 | + update_text_field(terminal,on,V3270_OIA_SCRIPT,terminal->script_id); | |
| 1065 | 1064 | break; |
| 1066 | -#endif // HAVE_SCRIPT | |
| 1065 | +*/ | |
| 1067 | 1066 | |
| 1068 | 1067 | default: |
| 1069 | 1068 | return; |
| 1070 | 1069 | } |
| 1071 | 1070 | |
| 1072 | 1071 | } |
| 1072 | + | |
| 1073 | +static gboolean blink_script(v3270 *widget) | |
| 1074 | +{ | |
| 1075 | + if(!widget->script.id) | |
| 1076 | + return FALSE; | |
| 1077 | + | |
| 1078 | + update_text_field(widget,1,V3270_OIA_SCRIPT,widget->script.blink ? 'S' : ' '); | |
| 1079 | + widget->script.blink = !widget->script.blink; | |
| 1080 | + | |
| 1081 | + return TRUE; | |
| 1082 | +} | |
| 1083 | + | |
| 1084 | +static void release_script(v3270 *widget) | |
| 1085 | +{ | |
| 1086 | + widget->script.timer = NULL; | |
| 1087 | + widget->script.id = 0; | |
| 1088 | +} | |
| 1089 | + | |
| 1090 | +LIB3270_EXPORT int v3270_set_script(GtkWidget *widget, const gchar id, unsigned char on) | |
| 1091 | +{ | |
| 1092 | + v3270 *terminal; | |
| 1093 | + g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); | |
| 1094 | + | |
| 1095 | + terminal = GTK_V3270(widget); | |
| 1096 | + | |
| 1097 | + if(terminal->script.id && id != terminal->script.id) | |
| 1098 | + return EBUSY; | |
| 1099 | + | |
| 1100 | + terminal->script.id = on ? id : 0; | |
| 1101 | + update_text_field(terminal,on,V3270_OIA_SCRIPT,'S'); | |
| 1102 | + | |
| 1103 | + if(on) | |
| 1104 | + { | |
| 1105 | + if(!terminal->script.timer) | |
| 1106 | + { | |
| 1107 | + terminal->script.timer = g_timeout_source_new(500); | |
| 1108 | + g_source_set_callback(terminal->script.timer,(GSourceFunc) blink_script, terminal, (GDestroyNotify) release_script); | |
| 1109 | + | |
| 1110 | + g_source_attach(terminal->script.timer, NULL); | |
| 1111 | + g_source_unref(terminal->script.timer); | |
| 1112 | + } | |
| 1113 | + } | |
| 1114 | + else if(terminal->script.timer) | |
| 1115 | + { | |
| 1116 | + if(terminal->script.timer->ref_count < 2) | |
| 1117 | + g_source_destroy(terminal->script.timer); | |
| 1118 | + | |
| 1119 | + if(terminal->timer) | |
| 1120 | + g_source_unref(terminal->script.timer); | |
| 1121 | + } | |
| 1122 | + | |
| 1123 | + return 0; | |
| 1124 | +} | ... | ... |
src/pw3270/v3270/private.h
| ... | ... | @@ -180,6 +180,14 @@ G_BEGIN_DECLS |
| 180 | 180 | H3270 * host; /**< Related 3270 session */ |
| 181 | 181 | gchar * session_name; /**< Session name (for window title) */ |
| 182 | 182 | |
| 183 | + // Scripting | |
| 184 | + struct | |
| 185 | + { | |
| 186 | + int blink : 1; | |
| 187 | + gchar id; /**< Script indicator */ | |
| 188 | + GSource * timer; | |
| 189 | + } script; | |
| 190 | + | |
| 183 | 191 | }; |
| 184 | 192 | |
| 185 | 193 | /*--[ Globals ]--------------------------------------------------------------------------------------*/ | ... | ... |
src/pw3270/v3270/selection.c
src/pw3270/v3270/widget.c
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | #include <malloc.h> |
| 40 | 40 | #endif // HAVE_MALLOC_H |
| 41 | 41 | |
| 42 | - #include <v3270.h> | |
| 42 | + #include <pw3270/v3270.h> | |
| 43 | 43 | #include "private.h" |
| 44 | 44 | #include "accessible.h" |
| 45 | 45 | #include "marshal.h" |
| ... | ... | @@ -892,6 +892,13 @@ static void v3270_destroy(GtkObject *widget) |
| 892 | 892 | g_source_unref(terminal->timer); |
| 893 | 893 | } |
| 894 | 894 | |
| 895 | + if(terminal->script.timer) | |
| 896 | + { | |
| 897 | + g_source_destroy(terminal->script.timer); | |
| 898 | + while(terminal->script.timer) | |
| 899 | + g_source_unref(terminal->script.timer); | |
| 900 | + } | |
| 901 | + | |
| 895 | 902 | if(terminal->cursor.timer) |
| 896 | 903 | { |
| 897 | 904 | g_source_destroy(terminal->cursor.timer); | ... | ... |
src/pw3270/window.c
| ... | ... | @@ -230,8 +230,30 @@ |
| 230 | 230 | gtk_window_set_title(GTK_WINDOW(widget),name); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - GtkWidget * pw3270_get_terminal_widget(GtkWidget *widget) | |
| 233 | + static void chktoplevel(GtkWidget *window, GtkWidget **widget) | |
| 234 | 234 | { |
| 235 | + if(*widget) | |
| 236 | + return; | |
| 237 | + | |
| 238 | + if(GTK_IS_PW3270(window)) | |
| 239 | + *widget = window; | |
| 240 | + } | |
| 241 | + | |
| 242 | + LIB3270_EXPORT GtkWidget * pw3270_get_toplevel(void) | |
| 243 | + { | |
| 244 | + GtkWidget * widget = NULL; | |
| 245 | + GList * lst = gtk_window_list_toplevels(); | |
| 246 | + | |
| 247 | + g_list_foreach(lst, (GFunc) chktoplevel, &widget); | |
| 248 | + | |
| 249 | + g_list_free(lst); | |
| 250 | + return widget; | |
| 251 | + } | |
| 252 | + | |
| 253 | + LIB3270_EXPORT GtkWidget * pw3270_get_terminal_widget(GtkWidget *widget) | |
| 254 | + { | |
| 255 | + if(!widget) | |
| 256 | + widget = pw3270_get_toplevel(); | |
| 235 | 257 | g_return_val_if_fail(GTK_IS_PW3270(widget),NULL); |
| 236 | 258 | return GTK_PW3270(widget)->terminal; |
| 237 | 259 | } | ... | ... |