Commit db1076542ff133001a60c85fede549dfc0a949aa
1 parent
dcfeb0d2
Exists in
master
and in
1 other branch
Save screen action has the same bug of the print dialog, fixing it.
Showing
6 changed files
with
77 additions
and
10 deletions
Show diff stats
src/dialogs/print/print.c
| @@ -218,7 +218,7 @@ | @@ -218,7 +218,7 @@ | ||
| 218 | return GTK_WIDGET(GTK_V3270_PRINT_OPERATION(operation)->widget); | 218 | return GTK_WIDGET(GTK_V3270_PRINT_OPERATION(operation)->widget); |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | - | 221 | +/* |
| 222 | static GList * get_selection(GList *list, H3270 *hSession, int all) | 222 | static GList * get_selection(GList *list, H3270 *hSession, int all) |
| 223 | { | 223 | { |
| 224 | lib3270_selection * selection = lib3270_get_selection(hSession,0,all); | 224 | lib3270_selection * selection = lib3270_get_selection(hSession,0,all); |
| @@ -248,6 +248,7 @@ static GList * get_selection(GList *list, H3270 *hSession, int all) | @@ -248,6 +248,7 @@ static GList * get_selection(GList *list, H3270 *hSession, int all) | ||
| 248 | g_warning("Error getting selection"); | 248 | g_warning("Error getting selection"); |
| 249 | return NULL; | 249 | return NULL; |
| 250 | } | 250 | } |
| 251 | +*/ | ||
| 251 | 252 | ||
| 252 | GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode) | 253 | GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode) |
| 253 | { | 254 | { |
| @@ -275,7 +276,7 @@ GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT | @@ -275,7 +276,7 @@ GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT | ||
| 275 | { | 276 | { |
| 276 | case LIB3270_CONTENT_ALL: | 277 | case LIB3270_CONTENT_ALL: |
| 277 | debug("%s","LIB3270_CONTENT_ALL"); | 278 | debug("%s","LIB3270_CONTENT_ALL"); |
| 278 | - operation->contents.dynamic = get_selection(operation->contents.dynamic, operation->session,1); | 279 | + operation->contents.dynamic = g_list_append_lib3270_selection(operation->contents.dynamic, operation->session,TRUE); |
| 279 | operation->contents.selection = operation->contents.dynamic; | 280 | operation->contents.selection = operation->contents.dynamic; |
| 280 | break; | 281 | break; |
| 281 | 282 | ||
| @@ -286,7 +287,7 @@ GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT | @@ -286,7 +287,7 @@ GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT | ||
| 286 | 287 | ||
| 287 | case LIB3270_CONTENT_SELECTED: | 288 | case LIB3270_CONTENT_SELECTED: |
| 288 | debug("%s","LIB3270_CONTENT_SELECTED"); | 289 | debug("%s","LIB3270_CONTENT_SELECTED"); |
| 289 | - operation->contents.dynamic = get_selection(operation->contents.dynamic, operation->session,0); | 290 | + operation->contents.dynamic = g_list_append_lib3270_selection(operation->contents.dynamic, operation->session,FALSE); |
| 290 | operation->contents.selection = operation->contents.dynamic; | 291 | operation->contents.selection = operation->contents.dynamic; |
| 291 | break; | 292 | break; |
| 292 | } | 293 | } |
src/dialogs/save/save.c
| @@ -346,9 +346,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ | @@ -346,9 +346,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ | ||
| 346 | { | 346 | { |
| 347 | case LIB3270_CONTENT_ALL: | 347 | case LIB3270_CONTENT_ALL: |
| 348 | debug("%s","LIB3270_CONTENT_ALL"); | 348 | debug("%s","LIB3270_CONTENT_ALL"); |
| 349 | - dynamic = g_new0(GList,1); | ||
| 350 | - dynamic->data = (gpointer) lib3270_get_selection(v3270_get_session(dialog->terminal),0,1); | ||
| 351 | - selection = dynamic; | 349 | + selection = dynamic = g_list_append_lib3270_selection(dynamic, v3270_get_session(dialog->terminal),TRUE); |
| 352 | break; | 350 | break; |
| 353 | 351 | ||
| 354 | case LIB3270_CONTENT_COPY: | 352 | case LIB3270_CONTENT_COPY: |
| @@ -358,9 +356,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ | @@ -358,9 +356,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ | ||
| 358 | 356 | ||
| 359 | case LIB3270_CONTENT_SELECTED: | 357 | case LIB3270_CONTENT_SELECTED: |
| 360 | debug("%s","LIB3270_CONTENT_SELECTED"); | 358 | debug("%s","LIB3270_CONTENT_SELECTED"); |
| 361 | - dynamic = g_new0(GList,1); | ||
| 362 | - dynamic->data = (gpointer) lib3270_get_selection(v3270_get_session(dialog->terminal),0,0); | ||
| 363 | - selection = dynamic; | 359 | + selection = dynamic = g_list_append_lib3270_selection(dynamic, v3270_get_session(dialog->terminal),FALSE); |
| 364 | break; | 360 | break; |
| 365 | 361 | ||
| 366 | default: | 362 | default: |
src/include/internals.h
| @@ -139,6 +139,8 @@ | @@ -139,6 +139,8 @@ | ||
| 139 | 139 | ||
| 140 | G_GNUC_INTERNAL gchar * v3270_convert_to_3270_charset(GtkWidget *widget, const gchar *text, const gchar *encoding, GError **error); | 140 | G_GNUC_INTERNAL gchar * v3270_convert_to_3270_charset(GtkWidget *widget, const gchar *text, const gchar *encoding, GError **error); |
| 141 | 141 | ||
| 142 | + /// @brief Add current lib3270 selection to a list | ||
| 143 | + G_GNUC_INTERNAL GList * g_list_append_lib3270_selection(GList *list, H3270 *hSession, gboolean all); | ||
| 142 | 144 | ||
| 143 | /*--[ Internal Widgets & Tools ]---------------------------------------------------------------------*/ | 145 | /*--[ Internal Widgets & Tools ]---------------------------------------------------------------------*/ |
| 144 | 146 |
| @@ -0,0 +1,66 @@ | @@ -0,0 +1,66 @@ | ||
| 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 - 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 <clipboard.h> | ||
| 31 | + #include <ctype.h> | ||
| 32 | + #include <lib3270/selection.h> | ||
| 33 | + | ||
| 34 | +/*--[ Implement ]------------------------------------------------------------------------------------*/ | ||
| 35 | + | ||
| 36 | + GList * g_list_append_lib3270_selection(GList *list, H3270 *hSession, gboolean all) | ||
| 37 | + { | ||
| 38 | + lib3270_selection * selection = lib3270_get_selection(hSession,0,all); | ||
| 39 | + | ||
| 40 | + if(selection) | ||
| 41 | + { | ||
| 42 | + size_t sz = sizeof(lib3270_selection) + (sizeof(lib3270_selection_element) * ((selection->bounds.width * selection->bounds.height)+1)); | ||
| 43 | + | ||
| 44 | + debug( | ||
| 45 | + "width=%u height=%u length=%u (sz=%u, szHeader=%u, szElement=%u)", | ||
| 46 | + selection->bounds.width, | ||
| 47 | + selection->bounds.height, | ||
| 48 | + (selection->bounds.width * selection->bounds.height), | ||
| 49 | + sz, | ||
| 50 | + sizeof(lib3270_selection), | ||
| 51 | + sizeof(lib3270_selection_element) | ||
| 52 | + ); | ||
| 53 | + | ||
| 54 | + gpointer data = g_malloc0(sz); | ||
| 55 | + memcpy(data,selection,sz); | ||
| 56 | + | ||
| 57 | + lib3270_free(selection); | ||
| 58 | + | ||
| 59 | + return g_list_append(list,data); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + g_warning("Can't get TN3270 active selection"); | ||
| 63 | + | ||
| 64 | + return NULL; | ||
| 65 | + | ||
| 66 | + } |
src/terminal/properties/get.c
| @@ -28,7 +28,6 @@ | @@ -28,7 +28,6 @@ | ||
| 28 | */ | 28 | */ |
| 29 | 29 | ||
| 30 | #include "private.h" | 30 | #include "private.h" |
| 31 | - #include <v3270/trace.h> | ||
| 32 | 31 | ||
| 33 | /*--[ Implement ]------------------------------------------------------------------------------------*/ | 32 | /*--[ Implement ]------------------------------------------------------------------------------------*/ |
| 34 | 33 |
v3270.cbp
| @@ -188,6 +188,9 @@ | @@ -188,6 +188,9 @@ | ||
| 188 | <Unit filename="src/selection/datablock.c"> | 188 | <Unit filename="src/selection/datablock.c"> |
| 189 | <Option compilerVar="CC" /> | 189 | <Option compilerVar="CC" /> |
| 190 | </Unit> | 190 | </Unit> |
| 191 | + <Unit filename="src/selection/get.c"> | ||
| 192 | + <Option compilerVar="CC" /> | ||
| 193 | + </Unit> | ||
| 191 | <Unit filename="src/selection/html.c"> | 194 | <Unit filename="src/selection/html.c"> |
| 192 | <Option compilerVar="CC" /> | 195 | <Option compilerVar="CC" /> |
| 193 | </Unit> | 196 | </Unit> |