From 9ad60a5be0dd7c4e6c041a870f84374b8814027e Mon Sep 17 00:00:00 2001 From: Perry Werneck Date: Wed, 31 Jul 2019 13:40:32 -0300 Subject: [PATCH] Updating print dialog. --- src/dialogs/print/begin.c | 7 +++++++ src/dialogs/print/print.c | 22 ++++++++++++++++++---- src/include/v3270/print.h | 2 ++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/dialogs/print/begin.c b/src/dialogs/print/begin.c index 46d00ff..95d00a9 100644 --- a/src/dialogs/print/begin.c +++ b/src/dialogs/print/begin.c @@ -39,6 +39,13 @@ trace("%s",__FUNCTION__); // Setup FONT + if(!operation->font.name) + { + operation->font.name = g_strdup("monospace"); + debug("No font, assuming %s !!!!!!!!!!!!!!!!!!!!!!!!!!",operation->font.name); + g_warning("No font, assuming %s",operation->font.name); + } + PangoFontDescription * fontDescription = pango_font_description_from_string(operation->font.name); cairo_select_font_face( diff --git a/src/dialogs/print/print.c b/src/dialogs/print/print.c index 04e5449..68a78b1 100644 --- a/src/dialogs/print/print.c +++ b/src/dialogs/print/print.c @@ -125,8 +125,17 @@ static void custom_widget_apply(GtkPrintOperation *prt, GtkWidget *widget) { + v3270_print_operation_apply_settings(prt,gtk_bin_get_child(GTK_BIN(widget))); + } + +#endif // !_WIN32 + + void v3270_print_operation_apply_settings(GtkPrintOperation *prt, GtkWidget *settings) + { + g_return_if_fail(GTK_IS_V3270_PRINT_OPERATION(prt)); + g_return_if_fail(GTK_IS_V3270_PRINT_SETTINGS(settings)); + V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); - GtkWidget * settings = gtk_bin_get_child(GTK_BIN(widget)); // Setup options. operation->show_selection = v3270_print_settings_get_show_selection(settings); @@ -135,7 +144,6 @@ v3270_print_settings_get_rgba(settings, operation->settings.colors, V3270_COLOR_COUNT); } -#endif // !_WIN32 static void V3270PrintOperation_class_init(V3270PrintOperationClass *klass) { @@ -163,11 +171,17 @@ // Setup defaults widget->mode = LIB3270_CONTENT_ALL; -// widget->show_selection = FALSE; -// widget->font.name = NULL; // g_strdup(v3270_default_font); + widget->show_selection = FALSE; + widget->font.name = NULL; // g_strdup(v3270_default_font); } + GtkWidget * v3270_print_operation_get_terminal(GtkPrintOperation *operation) + { + g_return_val_if_fail(GTK_IS_V3270_PRINT_OPERATION(operation),NULL); + return GTK_WIDGET(GTK_V3270_PRINT_OPERATION(operation)->widget); + } + GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode) { g_return_val_if_fail(GTK_IS_V3270(widget),NULL); diff --git a/src/include/v3270/print.h b/src/include/v3270/print.h index f8b0a38..d5b07b5 100644 --- a/src/include/v3270/print.h +++ b/src/include/v3270/print.h @@ -64,6 +64,8 @@ LIB3270_EXPORT GType V3270PrintOperation_get_type(void); LIB3270_EXPORT GtkPrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode); + LIB3270_EXPORT GtkWidget * v3270_print_operation_get_terminal(GtkPrintOperation *operation); + LIB3270_EXPORT void v3270_print_operation_apply_settings(GtkPrintOperation *operation, GtkWidget *settings); LIB3270_EXPORT GtkTreeModel * v3270_font_family_model_new(GtkWidget *widget, const gchar *selected, GtkTreeIter * active); -- libgit2 0.21.2