Commit 981c160ceaa4c45227248024223619293b6cff9c

Authored by Perry Werneck
1 parent 1c2b2769
Exists in master and in 1 other branch develop

Adjustments in the print dialog.

src/dialogs/fontselect.c
@@ -89,6 +89,9 @@ @@ -89,6 +89,9 @@
89 GtkTreeModel * model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); 89 GtkTreeModel * model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
90 GtkTreeIter iter; 90 GtkTreeIter iter;
91 91
  92 + if(!fontname)
  93 + fontname = "monospace";
  94 +
92 if(gtk_tree_model_get_iter_first(model,&iter)) 95 if(gtk_tree_model_get_iter_first(model,&iter))
93 { 96 {
94 do 97 do
src/dialogs/print/draw.c
@@ -122,7 +122,7 @@ @@ -122,7 +122,7 @@
122 // Draw character. 122 // Draw character.
123 unsigned short attr = selection->contents[pos].attribute.visual; 123 unsigned short attr = selection->contents[pos].attribute.visual;
124 124
125 - if(!operation->show_selection) 125 + if(!operation->settings.show_selection)
126 attr &= ~LIB3270_ATTR_SELECTED; 126 attr &= ~LIB3270_ATTR_SELECTED;
127 127
128 v3270_draw_element( 128 v3270_draw_element(
src/dialogs/print/print.c
@@ -102,7 +102,7 @@ @@ -102,7 +102,7 @@
102 static GtkWidget * custom_widget_new(GtkPrintOperation *prt) 102 static GtkWidget * custom_widget_new(GtkPrintOperation *prt)
103 { 103 {
104 GtkWidget * widget = gtk_frame_new(""); 104 GtkWidget * widget = gtk_frame_new("");
105 - GtkWidget * settings = V3270_print_settings_new(GTK_WIDGET(GTK_V3270_PRINT_OPERATION(prt)->widget)); 105 + GtkWidget * settings = V3270_print_settings_new_from_operation(prt);
106 106
107 GtkWidget *label = gtk_label_new(NULL); 107 GtkWidget *label = gtk_label_new(NULL);
108 gtk_label_set_markup(GTK_LABEL(label),_("<b>Text options</b>")); 108 gtk_label_set_markup(GTK_LABEL(label),_("<b>Text options</b>"));
@@ -138,8 +138,8 @@ @@ -138,8 +138,8 @@
138 V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); 138 V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt);
139 139
140 // Setup options. 140 // Setup options.
141 - operation->show_selection = v3270_print_settings_get_show_selection(settings);  
142 - operation->font.name = v3270_print_settings_get_font_family(settings); 141 + operation->settings.show_selection = v3270_print_settings_get_show_selection(settings);
  142 + operation->font.name = v3270_print_settings_get_font_family(settings);
143 143
144 v3270_print_settings_get_rgba(settings, operation->settings.colors, V3270_COLOR_COUNT); 144 v3270_print_settings_get_rgba(settings, operation->settings.colors, V3270_COLOR_COUNT);
145 145
@@ -170,9 +170,9 @@ @@ -170,9 +170,9 @@
170 gtk_print_operation_set_default_page_setup(GTK_PRINT_OPERATION(widget),gtk_page_setup_new()); 170 gtk_print_operation_set_default_page_setup(GTK_PRINT_OPERATION(widget),gtk_page_setup_new());
171 171
172 // Setup defaults 172 // Setup defaults
173 - widget->mode = LIB3270_CONTENT_ALL;  
174 - widget->show_selection = FALSE;  
175 - widget->font.name = NULL; // g_strdup(v3270_default_font); 173 + widget->mode = LIB3270_CONTENT_ALL;
  174 + widget->settings.show_selection = FALSE;
  175 + widget->font.name = NULL; // g_strdup(v3270_default_font);
176 176
177 } 177 }
178 178
src/dialogs/print/private.h
@@ -52,7 +52,6 @@ @@ -52,7 +52,6 @@
52 LIB3270_CONTENT_OPTION mode; 52 LIB3270_CONTENT_OPTION mode;
53 v3270 * widget; 53 v3270 * widget;
54 H3270 * session; 54 H3270 * session;
55 - gboolean show_selection; ///< @brief Print selection box?  
56 55
57 size_t lpp; ///< @brief Lines per page (in rows). 56 size_t lpp; ///< @brief Lines per page (in rows).
58 size_t pages; ///< @brief Number of pages. 57 size_t pages; ///< @brief Number of pages.
@@ -60,6 +59,7 @@ @@ -60,6 +59,7 @@
60 struct 59 struct
61 { 60 {
62 GdkRGBA colors[V3270_COLOR_COUNT]; ///< @brief Color scheme for printing. 61 GdkRGBA colors[V3270_COLOR_COUNT]; ///< @brief Color scheme for printing.
  62 + gboolean show_selection; ///< @brief Print selection box?
63 63
64 } settings; 64 } settings;
65 65
src/dialogs/print/settings.c
@@ -120,6 +120,21 @@ LIB3270_EXPORT GtkWidget * V3270_print_settings_new(GtkWidget *widget) @@ -120,6 +120,21 @@ LIB3270_EXPORT GtkWidget * V3270_print_settings_new(GtkWidget *widget)
120 120
121 } 121 }
122 122
  123 +LIB3270_EXPORT GtkWidget * V3270_print_settings_new_from_operation(GtkPrintOperation *operation)
  124 +{
  125 + g_return_val_if_fail(GTK_IS_V3270_PRINT_OPERATION(operation),NULL);
  126 +
  127 + V3270PrintOperation * opr = GTK_V3270_PRINT_OPERATION(operation);
  128 + V3270PrintSettings * settings = GTK_V3270_PRINT_SETTINGS(g_object_new(GTK_TYPE_V3270_PRINT_SETTINGS, NULL));
  129 +
  130 + v3270_font_selection_set_family(settings->font, opr->font.name);
  131 + v3270_color_scheme_set_rgba(settings->color,opr->settings.colors);
  132 + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(settings->selected),opr->settings.show_selection);
  133 +
  134 + return GTK_WIDGET(settings);
  135 +
  136 +}
  137 +
123 LIB3270_EXPORT int v3270_print_settings_get_rgba(GtkWidget *widget, GdkRGBA *colors, size_t num_colors) 138 LIB3270_EXPORT int v3270_print_settings_get_rgba(GtkWidget *widget, GdkRGBA *colors, size_t num_colors)
124 { 139 {
125 V3270PrintSettings * settings = GTK_V3270_PRINT_SETTINGS(widget); 140 V3270PrintSettings * settings = GTK_V3270_PRINT_SETTINGS(widget);
src/include/v3270/print.h
@@ -82,6 +82,8 @@ @@ -82,6 +82,8 @@
82 82
83 LIB3270_EXPORT GType V3270PrintSettings_get_type(void); 83 LIB3270_EXPORT GType V3270PrintSettings_get_type(void);
84 LIB3270_EXPORT GtkWidget * V3270_print_settings_new(GtkWidget *widget); 84 LIB3270_EXPORT GtkWidget * V3270_print_settings_new(GtkWidget *widget);
  85 + LIB3270_EXPORT GtkWidget * V3270_print_settings_new_from_operation(GtkPrintOperation *operation);
  86 +
85 LIB3270_EXPORT gboolean v3270_print_settings_get_show_selection(GtkWidget *widget); 87 LIB3270_EXPORT gboolean v3270_print_settings_get_show_selection(GtkWidget *widget);
86 LIB3270_EXPORT void v3270_print_settings_set_show_selection(GtkWidget *widget, gboolean is_active); 88 LIB3270_EXPORT void v3270_print_settings_set_show_selection(GtkWidget *widget, gboolean is_active);
87 LIB3270_EXPORT gchar * v3270_print_settings_get_color_scheme(GtkWidget *widget); 89 LIB3270_EXPORT gchar * v3270_print_settings_get_color_scheme(GtkWidget *widget);