Commit 981c160ceaa4c45227248024223619293b6cff9c
1 parent
1c2b2769
Exists in
master
and in
1 other branch
Adjustments in the print dialog.
Showing
6 changed files
with
28 additions
and
8 deletions
Show diff stats
src/dialogs/fontselect.c
src/dialogs/print/draw.c
... | ... | @@ -122,7 +122,7 @@ |
122 | 122 | // Draw character. |
123 | 123 | unsigned short attr = selection->contents[pos].attribute.visual; |
124 | 124 | |
125 | - if(!operation->show_selection) | |
125 | + if(!operation->settings.show_selection) | |
126 | 126 | attr &= ~LIB3270_ATTR_SELECTED; |
127 | 127 | |
128 | 128 | v3270_draw_element( | ... | ... |
src/dialogs/print/print.c
... | ... | @@ -102,7 +102,7 @@ |
102 | 102 | static GtkWidget * custom_widget_new(GtkPrintOperation *prt) |
103 | 103 | { |
104 | 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 | 107 | GtkWidget *label = gtk_label_new(NULL); |
108 | 108 | gtk_label_set_markup(GTK_LABEL(label),_("<b>Text options</b>")); |
... | ... | @@ -138,8 +138,8 @@ |
138 | 138 | V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt); |
139 | 139 | |
140 | 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 | 144 | v3270_print_settings_get_rgba(settings, operation->settings.colors, V3270_COLOR_COUNT); |
145 | 145 | |
... | ... | @@ -170,9 +170,9 @@ |
170 | 170 | gtk_print_operation_set_default_page_setup(GTK_PRINT_OPERATION(widget),gtk_page_setup_new()); |
171 | 171 | |
172 | 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 | 52 | LIB3270_CONTENT_OPTION mode; |
53 | 53 | v3270 * widget; |
54 | 54 | H3270 * session; |
55 | - gboolean show_selection; ///< @brief Print selection box? | |
56 | 55 | |
57 | 56 | size_t lpp; ///< @brief Lines per page (in rows). |
58 | 57 | size_t pages; ///< @brief Number of pages. |
... | ... | @@ -60,6 +59,7 @@ |
60 | 59 | struct |
61 | 60 | { |
62 | 61 | GdkRGBA colors[V3270_COLOR_COUNT]; ///< @brief Color scheme for printing. |
62 | + gboolean show_selection; ///< @brief Print selection box? | |
63 | 63 | |
64 | 64 | } settings; |
65 | 65 | ... | ... |
src/dialogs/print/settings.c
... | ... | @@ -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 | 138 | LIB3270_EXPORT int v3270_print_settings_get_rgba(GtkWidget *widget, GdkRGBA *colors, size_t num_colors) |
124 | 139 | { |
125 | 140 | V3270PrintSettings * settings = GTK_V3270_PRINT_SETTINGS(widget); | ... | ... |
src/include/v3270/print.h
... | ... | @@ -82,6 +82,8 @@ |
82 | 82 | |
83 | 83 | LIB3270_EXPORT GType V3270PrintSettings_get_type(void); |
84 | 84 | LIB3270_EXPORT GtkWidget * V3270_print_settings_new(GtkWidget *widget); |
85 | + LIB3270_EXPORT GtkWidget * V3270_print_settings_new_from_operation(GtkPrintOperation *operation); | |
86 | + | |
85 | 87 | LIB3270_EXPORT gboolean v3270_print_settings_get_show_selection(GtkWidget *widget); |
86 | 88 | LIB3270_EXPORT void v3270_print_settings_set_show_selection(GtkWidget *widget, gboolean is_active); |
87 | 89 | LIB3270_EXPORT gchar * v3270_print_settings_get_color_scheme(GtkWidget *widget); | ... | ... |