From ec7b14ef70163fbafa4a839d5ba824cbd839e672 Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Fri, 1 Feb 2019 17:42:22 -0200 Subject: [PATCH] Working on the new v3270 print dialog component. --- Makefile.in | 3 ++- src/dialogs/print/begin.c | 144 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/dialogs/print/print.c | 215 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/dialogs/print/private.h | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/include/v3270/print.h | 4 +++- src/v3270/print.c | 252 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ v3270.cbp | 10 +++++++--- 7 files changed, 442 insertions(+), 257 deletions(-) create mode 100644 src/dialogs/print/begin.c create mode 100644 src/dialogs/print/print.c create mode 100644 src/dialogs/print/private.h delete mode 100644 src/v3270/print.c diff --git a/Makefile.in b/Makefile.in index c5fca63..4c7fa58 100644 --- a/Makefile.in +++ b/Makefile.in @@ -34,7 +34,8 @@ SOURCES= \ $(wildcard src/v3270/@OSNAME@/*.c) \ $(wildcard src/v3270ft/*.c) \ $(wildcard src/trace/*.c) \ - $(wildcard src/dialogs/*.c) + $(wildcard src/dialogs/*.c) \ + $(wildcard src/dialogs/print/*.c) TEST_SOURCES= \ $(wildcard src/testprogram/*.c) diff --git a/src/dialogs/print/begin.c b/src/dialogs/print/begin.c new file mode 100644 index 0000000..3530555 --- /dev/null +++ b/src/dialogs/print/begin.c @@ -0,0 +1,144 @@ +/* + * "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 "private.h" + +/*--[ Implement ]------------------------------------------------------------------------------------*/ + + void V3270PrintOperation_begin_print(GtkPrintOperation *prt, GtkPrintContext *context) + { + cairo_t * cr = gtk_print_context_get_cairo_context(context); + V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); + + trace("%s",__FUNCTION__); + + // Setup FONT + PangoFontDescription * fontDescription = pango_font_description_from_string(operation->font.name); + + cairo_select_font_face( + cr, + pango_font_description_get_family(fontDescription), + CAIRO_FONT_SLANT_NORMAL, + pango_font_description_get_weight(fontDescription) == PANGO_WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL + ); + + // Set font size based on text and context. + + cairo_font_extents_t extents; + double width = gtk_print_context_get_width(context); + double cols = (double) operation->text.width; + double current = width / cols; + double valid = current; + + do + { + valid = current; + current = valid +1.0; + cairo_set_font_size(cr,current); + cairo_font_extents(cr,&extents); + } + while( (cols * extents.max_x_advance) < width ); + + trace("Font size: %d",(int) valid); + cairo_set_font_size(cr,valid); + + + /* + + gchar * font = get_string_from_config("print",FONT_CONFIG,DEFAULT_FONT); + + trace("%s: operation=%p context=%p font=\"%s\"",__FUNCTION__,prt,context,font); + + // Setup font + if(*font) + { + PangoFontDescription * descr = pango_font_description_from_string(font); + if(descr) + { + cairo_select_font_face(cr, pango_font_description_get_family(descr), + CAIRO_FONT_SLANT_NORMAL, + pango_font_description_get_weight(descr) == PANGO_WEIGHT_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL); + +#ifdef AUTO_FONT_SIZE + { + double width = gtk_print_context_get_width(context); +#if GTK_CHECK_VERSION(3,0,0) + double cols = (double) info->cols; +#else + double cols = (double) (info->cols+5); +#endif // GTK(3,0,0) + double current = width / cols; + double valid = current; + + do + { + valid = current; + current = valid +1.0; + cairo_set_font_size(cr,current); + cairo_font_extents(cr,&extents); + } + while( (cols * extents.max_x_advance) < width ); + + trace("Font size: %d",(int) valid); + cairo_set_font_size(cr,valid); + + } +#endif // AUTO_FONT_SIZE + + pango_font_description_free(descr); + } + } + g_free(font); + + info->font.scaled = cairo_get_scaled_font(cr); + cairo_scaled_font_reference(info->font.scaled); + cairo_scaled_font_extents(info->font.scaled,&extents); + + info->font.height = extents.height; + info->font.descent = extents.descent; + info->font.width = extents.max_x_advance; + + info->width = ((double) info->cols) * extents.max_x_advance; + info->height = ((double) info->rows) * (extents.height + extents.descent); + + // Center image + info->left = (gtk_print_context_get_width(context)-info->width)/2; + if(info->left < 2) + info->left = 2; + + // Setup page size + info->lpp = (gtk_print_context_get_height(context) / (extents.height + extents.descent)); + info->pages = (info->rows / info->lpp)+1; + + trace("%d lines per page, %d pages to print",info->lpp,info->pages); + + gtk_print_operation_set_n_pages(prt,info->pages); + */ + } + diff --git a/src/dialogs/print/print.c b/src/dialogs/print/print.c new file mode 100644 index 0000000..a15b167 --- /dev/null +++ b/src/dialogs/print/print.c @@ -0,0 +1,215 @@ +/* + * "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 "private.h" + #include "../../v3270/private.h" // Required for v3270 signal. + #include + #include + + G_DEFINE_TYPE(V3270PrintOperation, V3270PrintOperation, GTK_TYPE_PRINT_OPERATION); + +/*--[ Implement ]------------------------------------------------------------------------------------*/ + + static void done(GtkPrintOperation *prt, GtkPrintOperationResult result) + { + V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); + + debug("%s",__FUNCTION__); + + if(operation->widget) + g_signal_emit(GTK_WIDGET(operation->widget), v3270_widget_signal[SIGNAL_PRINT_DONE], 0, prt, (guint) result); + + } + +#ifndef _WIN32 + static void color_scheme_changed(GtkWidget G_GNUC_UNUSED(*widget), const GdkRGBA *colors, V3270PrintOperation *operation) { + + debug("%s=%p",__FUNCTION__,colors); + + int f; + for(f=0;fcolors[f] = colors[f]; + + } + + void font_name_changed(GtkComboBox *widget, V3270PrintOperation *operation) + { + GValue value = { 0, }; + GtkTreeIter iter; + + if(!gtk_combo_box_get_active_iter(widget,&iter)) + return; + + gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,0,&value); + + g_free(operation->font.name); + operation->font.name = g_value_dup_string(&value); + + debug("%s=%s",__FUNCTION__,operation->font.name); + } + + static GtkWidget * create_custom_widget(GtkPrintOperation *prt) + { + static const gchar * text[] = + { + N_( "_Font:" ), + N_( "C_olor scheme:" ) + }; + + size_t f; + + V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); + + if(operation->widget) + g_signal_emit(operation->widget, v3270_widget_signal[SIGNAL_PRINT_SETUP], 0, prt); + + // Create dialog + + GtkGrid * grid = GTK_GRID(gtk_grid_new()); + GtkWidget * font = v3270_font_selection_new(operation->font.name); + GtkWidget * color = v3270_color_scheme_new(); + + gtk_container_set_border_width(GTK_CONTAINER(grid),10); + gtk_grid_set_row_spacing(grid,5); + gtk_grid_set_column_spacing(grid,5); + + v3270_color_scheme_set_rgba(color,operation->colors); + g_signal_connect(G_OBJECT(color),"update-colors",G_CALLBACK(color_scheme_changed),operation); + g_signal_connect(G_OBJECT(font),"changed",G_CALLBACK(font_name_changed),operation); + + for(f=0;fwidget) + g_signal_emit(operation->widget, v3270_widget_signal[SIGNAL_PRINT_APPLY], 0, prt); + + } +#endif // _WIN32 + + static void dispose(GObject *object) + { + debug("%s",__FUNCTION__); + + V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(object); + + g_free(operation->font.name); + + } + + static void V3270PrintOperation_class_init(V3270PrintOperationClass *klass) + { + GtkPrintOperationClass * operation = GTK_PRINT_OPERATION_CLASS(klass); + + G_OBJECT_CLASS(klass)->dispose = dispose; + operation->done = done; + operation->begin_print = V3270PrintOperation_begin_print; + +#ifndef _WIN32 + operation->create_custom_widget = create_custom_widget; + operation->custom_widget_apply = custom_widget_apply; +#endif // _WIN32 + + } + + static void V3270PrintOperation_init(V3270PrintOperation *widget) + { + // Setup print operation. + gtk_print_operation_set_custom_tab_label(GTK_PRINT_OPERATION(widget), _( "Options" ) ); + gtk_print_operation_set_show_progress(GTK_PRINT_OPERATION(widget),TRUE); + gtk_print_operation_set_print_settings(GTK_PRINT_OPERATION(widget),gtk_print_settings_new()); + gtk_print_operation_set_default_page_setup(GTK_PRINT_OPERATION(widget),gtk_page_setup_new()); + + + // Setup defaults + widget->mode = LIB3270_PRINT_ALL; + widget->show_selection = FALSE; + widget->font.name = g_strdup(v3270_default_font); + + widget->text.width = 80; + + v3270_set_mono_color_table(widget->colors,"#000000","#FFFFFF"); + + } + +V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_PRINT_MODE mode) +{ + g_return_val_if_fail(GTK_IS_V3270(widget),NULL); + + V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(g_object_new(GTK_TYPE_V3270_PRINT_OPERATION, NULL)); + + operation->mode = mode; + operation->widget = GTK_V3270(widget); + operation->session = v3270_get_session(widget); + + return operation; +} + +/*--[ Convenience ]----------------------------------------------------------------------------------*/ + + void v3270_print(GtkWidget *widget, LIB3270_PRINT_MODE mode) + { + g_autoptr(GError) err = NULL; + + V3270PrintOperation * operation = v3270_print_operation_new(widget, mode); + gtk_print_operation_run(GTK_PRINT_OPERATION(operation),GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,GTK_WINDOW(gtk_widget_get_toplevel(widget)),&err); + g_object_unref(operation); + + } + + void v3270_print_all(GtkWidget *widget) + { + v3270_print(widget,LIB3270_PRINT_ALL); + } + + void v3270_print_selected(GtkWidget *widget) + { + v3270_print(widget,LIB3270_PRINT_SELECTED); + } + + void v3270_print_copy(GtkWidget *widget) + { + v3270_print(widget,LIB3270_PRINT_COPY); + } diff --git a/src/dialogs/print/private.h b/src/dialogs/print/private.h new file mode 100644 index 0000000..e2b275b --- /dev/null +++ b/src/dialogs/print/private.h @@ -0,0 +1,71 @@ +/* + * "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 + #include + #include + +/*--[ Widget definition ]----------------------------------------------------------------------------*/ + + struct _V3270PrintOperationClass + { + GtkPrintOperationClass parent_class; + + }; + + struct _V3270PrintOperation + { + GtkPrintOperation parent; + GdkRGBA colors[V3270_COLOR_COUNT]; + LIB3270_PRINT_MODE mode; + v3270 * widget; + H3270 * session; + + struct + { + size_t width; ///< @brief Maximun text width (in characters) + + } text; + + struct { + gchar * name; + v3270FontInfo info; + } font; + + gboolean show_selection; + + + }; + +/*--[ Prototypes ]-----------------------------------------------------------------------------------*/ + + G_GNUC_INTERNAL void V3270PrintOperation_begin_print(GtkPrintOperation *prt, GtkPrintContext *context); + + diff --git a/src/include/v3270/print.h b/src/include/v3270/print.h index 487ba59..2377a0c 100644 --- a/src/include/v3270/print.h +++ b/src/include/v3270/print.h @@ -38,6 +38,7 @@ /*--[ Print Operation ]------------------------------------------------------------------------------*/ + #define GTK_TYPE_V3270_PRINT_OPERATION (V3270PrintOperation_get_type()) #define GTK_V3270_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_PRINT_OPERATION, V3270PrintOperation)) #define GTK_V3270_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_PRINT_OPERATION, V3270PrintOperationClass)) @@ -51,9 +52,10 @@ /*--[ Prototipes ]-----------------------------------------------------------------------------------*/ LIB3270_EXPORT V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_PRINT_MODE mode); - LIB3270_EXPORT GtkWidget * v3270_font_selection_new(const gchar *fontname); + LIB3270_EXPORT GType V3270PrintOperation_get_type(void); + G_END_DECLS #endif // V3270_PRINT_OPERATION_H_INCLUDED diff --git a/src/v3270/print.c b/src/v3270/print.c deleted file mode 100644 index 5d4ab6a..0000000 --- a/src/v3270/print.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * "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) - * - */ - - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - - #include "private.h" - #include - #include - #include - #include - #include - #include - -/*--[ Widget definition ]----------------------------------------------------------------------------*/ - - struct _V3270PrintOperationClass - { - GtkPrintOperationClass parent_class; - - }; - - struct _V3270PrintOperation - { - GtkPrintOperation parent; - GdkRGBA colors[V3270_COLOR_COUNT]; - LIB3270_PRINT_MODE mode; - v3270 * widget; - H3270 * session; - - struct { - gchar * name; - v3270FontInfo info; - } font; - - gboolean show_selection; - - - }; - - G_DEFINE_TYPE(V3270PrintOperation, V3270PrintOperation, GTK_TYPE_PRINT_OPERATION); - -/*--[ Implement ]------------------------------------------------------------------------------------*/ - - static void done(GtkPrintOperation *prt, GtkPrintOperationResult result) - { - V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); - - debug("%s",__FUNCTION__); - - if(operation->widget) - g_signal_emit(GTK_WIDGET(operation->widget), v3270_widget_signal[SIGNAL_PRINT_DONE], 0, prt, (guint) result); - - } - -#ifndef _WIN32 - static void color_scheme_changed(GtkWidget G_GNUC_UNUSED(*widget), const GdkRGBA *colors, V3270PrintOperation *operation) { - - debug("%s=%p",__FUNCTION__,colors); - - int f; - for(f=0;fcolors[f] = colors[f]; - - } - - void font_name_changed(GtkComboBox *widget, V3270PrintOperation *operation) - { - GValue value = { 0, }; - GtkTreeIter iter; - - if(!gtk_combo_box_get_active_iter(widget,&iter)) - return; - - gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,0,&value); - - g_free(operation->font.name); - operation->font.name = g_value_dup_string(&value); - - debug("%s=%s",__FUNCTION__,operation->font.name); - } - - static GtkWidget * create_custom_widget(GtkPrintOperation *prt) - { - static const gchar * text[] = - { - N_( "_Font:" ), - N_( "C_olor scheme:" ) - }; - - size_t f; - - V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); - - if(operation->widget) - g_signal_emit(operation->widget, v3270_widget_signal[SIGNAL_PRINT_SETUP], 0, prt); - - // Create dialog - - GtkGrid * grid = GTK_GRID(gtk_grid_new()); - GtkWidget * font = v3270_font_selection_new(operation->font.name); - GtkWidget * color = v3270_color_scheme_new(); - - gtk_container_set_border_width(GTK_CONTAINER(grid),10); - gtk_grid_set_row_spacing(grid,5); - gtk_grid_set_column_spacing(grid,5); - - v3270_color_scheme_set_rgba(color,operation->colors); - g_signal_connect(G_OBJECT(color),"update-colors",G_CALLBACK(color_scheme_changed),operation); - g_signal_connect(G_OBJECT(font),"changed",G_CALLBACK(font_name_changed),operation); - - for(f=0;fwidget) - g_signal_emit(operation->widget, v3270_widget_signal[SIGNAL_PRINT_APPLY], 0, prt); - - } -#endif // _WIN32 - - static void dispose(GObject *object) - { - debug("%s",__FUNCTION__); - - V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(object); - - g_free(operation->font.name); - - } - - static void V3270PrintOperation_class_init(V3270PrintOperationClass *klass) - { - GtkPrintOperationClass * operation = GTK_PRINT_OPERATION_CLASS(klass); - - G_OBJECT_CLASS(klass)->dispose = dispose; - operation->done = done; - -#ifndef _WIN32 - operation->create_custom_widget = create_custom_widget; - operation->custom_widget_apply = custom_widget_apply; -#endif // _WIN32 - /* - // Common signals - g_signal_connect(print,"done",G_CALLBACK(done),*info); - -#if GTK_CHECK_VERSION(3,0,0) && !defined(WIN32) - g_signal_connect(print,"create-custom-widget",G_CALLBACK(create_custom_widget), *info); - g_signal_connect(print,"custom-widget-apply",G_CALLBACK(custom_widget_apply), *info); -#endif // !WIN32 -*/ - - } - - static void V3270PrintOperation_init(V3270PrintOperation *widget) - { - // Setup print operation. - gtk_print_operation_set_custom_tab_label(GTK_PRINT_OPERATION(widget), _( "Options" ) ); - gtk_print_operation_set_show_progress(GTK_PRINT_OPERATION(widget),TRUE); - gtk_print_operation_set_print_settings(GTK_PRINT_OPERATION(widget),gtk_print_settings_new()); - gtk_print_operation_set_default_page_setup(GTK_PRINT_OPERATION(widget),gtk_page_setup_new()); - - - // Setup defaults - widget->mode = LIB3270_PRINT_ALL; - widget->show_selection = FALSE; - widget->font.name = g_strdup(v3270_default_font); - - v3270_set_mono_color_table(widget->colors,"#000000","#FFFFFF"); - - } - -V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_PRINT_MODE mode) -{ - g_return_val_if_fail(GTK_IS_V3270(widget),NULL); - - V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(g_object_new(GTK_TYPE_V3270_PRINT_OPERATION, NULL)); - - operation->mode = mode; - operation->widget = GTK_V3270(widget); - operation->session = v3270_get_session(widget); - - return operation; -} - -/*--[ Convenience ]----------------------------------------------------------------------------------*/ - - void v3270_print(GtkWidget *widget, LIB3270_PRINT_MODE mode) - { - g_autoptr(GError) err = NULL; - - V3270PrintOperation * operation = v3270_print_operation_new(widget, mode); - gtk_print_operation_run(GTK_PRINT_OPERATION(operation),GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,GTK_WINDOW(gtk_widget_get_toplevel(widget)),&err); - g_object_unref(operation); - - } - - void v3270_print_all(GtkWidget *widget) - { - v3270_print(widget,LIB3270_PRINT_ALL); - } - - void v3270_print_selected(GtkWidget *widget) - { - v3270_print(widget,LIB3270_PRINT_SELECTED); - } - - void v3270_print_copy(GtkWidget *widget) - { - v3270_print(widget,LIB3270_PRINT_COPY); - } diff --git a/v3270.cbp b/v3270.cbp index 5d3aa86..8ec9293 100644 --- a/v3270.cbp +++ b/v3270.cbp @@ -51,6 +51,13 @@ + + + + +