Commit ec856af7de54330f806d5f8eebaa21352c0d5aa1

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

Refactoring print settings dialog.

src/dialogs/fontselect.c
... ... @@ -84,3 +84,46 @@
84 84 return widget;
85 85 }
86 86  
  87 + LIB3270_EXPORT gboolean v3270_font_selection_set_family(GtkWidget *widget, const gchar *fontname)
  88 + {
  89 + GtkTreeModel * model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
  90 + GtkTreeIter iter;
  91 +
  92 + if(gtk_tree_model_get_iter_first(model,&iter))
  93 + {
  94 + do
  95 + {
  96 + GValue value = { 0, };
  97 +
  98 + gtk_tree_model_get_value(model,&iter,0,&value);
  99 +
  100 + if(!g_ascii_strcasecmp(fontname,g_value_get_string(&value)))
  101 + {
  102 + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&iter);
  103 + return TRUE;
  104 + }
  105 +
  106 + } while(gtk_tree_model_iter_next(model,&iter));
  107 + }
  108 +
  109 + return FALSE;
  110 +
  111 + }
  112 +
  113 + LIB3270_EXPORT const gchar * v3270_font_selection_get_family(GtkWidget *widget)
  114 + {
  115 + GtkTreeIter iter;
  116 +
  117 + if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget),&iter))
  118 + {
  119 + GValue value = { 0, };
  120 +
  121 + gtk_tree_model_get_value(gtk_combo_box_get_model(GTK_COMBO_BOX(widget)),&iter,0,&value);
  122 + return g_value_get_string(&value);
  123 +
  124 + }
  125 +
  126 + return "monospace";
  127 +
  128 + }
  129 +
... ...
src/dialogs/print/begin.c
... ... @@ -38,8 +38,11 @@
38 38  
39 39 trace("%s",__FUNCTION__);
40 40  
  41 + // Setup options.
  42 + operation->show_selection = v3270_print_settings_get_show_selection(GTK_WIDGET(operation->settings));
  43 +
41 44 // Setup FONT
42   - PangoFontDescription * fontDescription = pango_font_description_from_string(operation->font.name);
  45 + PangoFontDescription * fontDescription = pango_font_description_from_string(v3270_font_selection_get_family(operation->settings->font));
43 46  
44 47 cairo_select_font_face(
45 48 cr,
... ...
src/dialogs/print/custom.c
... ... @@ -1,144 +0,0 @@
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 "private.h"
31   - #include <sys/param.h>
32   - #include <terminal.h>
33   - #include <v3270/colorscheme.h>
34   - #include <lib3270/selection.h>
35   -
36   -/*--[ Implement ]------------------------------------------------------------------------------------*/
37   -
38   -#ifndef _WIN32
39   - static void color_scheme_changed(GtkWidget G_GNUC_UNUSED(*widget), const GdkRGBA *colors, V3270PrintOperation *operation) {
40   -
41   - debug("%s=%p",__FUNCTION__,colors);
42   -
43   - int f;
44   - for(f=0;f<V3270_COLOR_COUNT;f++)
45   - operation->colors[f] = colors[f];
46   -
47   - }
48   -
49   - static void font_name_changed(GtkComboBox *widget, V3270PrintOperation *operation)
50   - {
51   - GValue value = { 0, };
52   - GtkTreeIter iter;
53   -
54   - if(!gtk_combo_box_get_active_iter(widget,&iter))
55   - return;
56   -
57   - gtk_tree_model_get_value(gtk_combo_box_get_model(widget),&iter,0,&value);
58   -
59   - g_free(operation->font.name);
60   - operation->font.name = g_value_dup_string(&value);
61   -
62   - debug("%s=%s",__FUNCTION__,operation->font.name);
63   - }
64   -
65   - static void toggle_show_selection(GtkToggleButton *widget, V3270PrintOperation *operation)
66   - {
67   - operation->show_selection = gtk_toggle_button_get_active(widget);
68   - }
69   -
70   - GtkWidget * V3270PrintOperation_custom_widget_new(GtkPrintOperation *prt)
71   - {
72   - static const gchar * text[] =
73   - {
74   - N_( "_Font:" ),
75   - N_( "C_olor scheme:" )
76   - };
77   -
78   - size_t f;
79   -
80   - V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt);
81   -
82   - if(operation->widget)
83   - g_signal_emit(operation->widget, v3270_widget_signal[V3270_SIGNAL_PRINT_SETUP], 0, prt);
84   -
85   - // Create dialog
86   -
87   - GtkWidget * frame = gtk_frame_new("");
88   - GtkGrid * grid = GTK_GRID(gtk_grid_new());
89   - GtkWidget * font = v3270_font_selection_new(operation->font.name);
90   - GtkWidget * color = v3270_color_scheme_new();
91   - GtkWidget * selected = gtk_check_button_new_with_label( _("Print selection box") );
92   -
93   - // The print dialog doesn't follow the guidelines from https://developer.gnome.org/hig/stable/visual-layout.html.en )-:
94   -
95   - gtk_frame_set_shadow_type(GTK_FRAME(frame),GTK_SHADOW_NONE);
96   -
97   - GtkWidget *label = gtk_label_new(NULL);
98   -
99   - gtk_label_set_markup(GTK_LABEL(label),_("<b>Text options</b>"));
100   - gtk_frame_set_label_widget(GTK_FRAME(frame),label);
101   -
102   - gtk_container_set_border_width(GTK_CONTAINER(frame),12);
103   -
104   - gtk_container_set_border_width(GTK_CONTAINER(grid),6);
105   -
106   - g_object_set(G_OBJECT(grid),"margin-start",8,NULL);
107   -
108   - gtk_grid_set_row_spacing(grid,6);
109   - gtk_grid_set_column_spacing(grid,12);
110   -
111   - v3270_color_scheme_set_rgba(color,operation->colors);
112   - g_signal_connect(G_OBJECT(color),"update-colors",G_CALLBACK(color_scheme_changed),operation);
113   - g_signal_connect(G_OBJECT(font),"changed",G_CALLBACK(font_name_changed),operation);
114   - g_signal_connect(G_OBJECT(selected),"toggled",G_CALLBACK(toggle_show_selection),operation);
115   -
116   - for(f=0;f<G_N_ELEMENTS(text);f++)
117   - {
118   - GtkWidget *label = gtk_label_new_with_mnemonic(gettext(text[f]));
119   - gtk_widget_set_halign(label,GTK_ALIGN_START);
120   - gtk_grid_attach(grid,label,0,f,1,1);
121   - }
122   -
123   - gtk_grid_attach(grid,font,1,0,1,1);
124   - gtk_grid_attach(grid,color,1,1,1,1);
125   - gtk_grid_attach(grid,selected,1,2,1,1);
126   -
127   - gtk_container_add(GTK_CONTAINER(frame),GTK_WIDGET(grid));
128   -
129   - gtk_widget_show_all(GTK_WIDGET(frame));
130   - return frame;
131   - }
132   -
133   - void V3270PrintOperation_custom_widget_apply(GtkPrintOperation *prt, GtkWidget G_GNUC_UNUSED(*widget))
134   - {
135   - V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt);
136   -
137   - debug("%s",__FUNCTION__);
138   -
139   - if(operation->widget)
140   - g_signal_emit(operation->widget, v3270_widget_signal[V3270_SIGNAL_PRINT_APPLY], 0, prt);
141   -
142   - }
143   -
144   -#endif // _WIN32
src/dialogs/print/draw.c
... ... @@ -83,7 +83,7 @@
83 83 rect.width = operation->font.info.width;
84 84  
85 85 // Clear drawing area.
86   - gdk_cairo_set_source_rgba(cr,operation->colors + V3270_COLOR_BACKGROUND);
  86 + gdk_cairo_set_source_rgba(cr,operation->settings->colors + V3270_COLOR_BACKGROUND);
87 87 cairo_rectangle(
88 88 cr,
89 89 operation->font.info.left-1,0,
... ... @@ -132,7 +132,7 @@
132 132 operation->session,
133 133 &operation->font.info,
134 134 &rect,
135   - operation->colors
  135 + operation->settings->colors
136 136 );
137 137  
138 138 }
... ...
src/dialogs/print/print.c
... ... @@ -36,12 +36,39 @@
36 36  
37 37 /*--[ Implement ]------------------------------------------------------------------------------------*/
38 38  
  39 +
39 40 static void done(GtkPrintOperation *prt, GtkPrintOperationResult result)
40 41 {
41 42 V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(prt);
42 43  
43 44 debug("%s",__FUNCTION__);
44 45  
  46 + if(result == GTK_PRINT_OPERATION_RESULT_ERROR)
  47 + {
  48 + GError * err = NULL;
  49 +
  50 + gtk_print_operation_get_error(prt,&err);
  51 +
  52 + GtkWidget *dialog = gtk_message_dialog_new_with_markup(
  53 + GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(operation->widget))),
  54 + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
  55 + GTK_MESSAGE_ERROR,GTK_BUTTONS_CLOSE,
  56 + "%s",_( "Print operation failed" )
  57 + );
  58 +
  59 + g_warning("%s",err->message);
  60 +
  61 + gtk_window_set_title(GTK_WINDOW(dialog),_("Error"));
  62 +
  63 + gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog),"%s",err->message);
  64 +
  65 + gtk_dialog_run(GTK_DIALOG(dialog));
  66 + gtk_widget_destroy(dialog);
  67 +
  68 + g_error_free(err);
  69 +
  70 + }
  71 +
45 72 if(operation->widget)
46 73 g_signal_emit(GTK_WIDGET(operation->widget), v3270_widget_signal[V3270_SIGNAL_PRINT_DONE], 0, prt, (guint) result);
47 74  
... ... @@ -53,10 +80,18 @@
53 80  
54 81 V3270PrintOperation * operation = GTK_V3270_PRINT_OPERATION(object);
55 82  
  83 + /*
  84 + if(operation->settings)
  85 + {
  86 + gtk_widget_destroy(GTK_WIDGET(operation->settings));
  87 + operation->settings = NULL;
  88 + }
  89 + */
  90 +
56 91 if(operation->font.info.scaled)
57 92 cairo_scaled_font_destroy(operation->font.info.scaled);
58 93  
59   - g_free(operation->font.name);
  94 +// g_free(operation->font.name);
60 95  
61 96 if(operation->contents.dynamic)
62 97 {
... ... @@ -67,20 +102,33 @@
67 102  
68 103 G_OBJECT_CLASS(V3270PrintOperation_parent_class)->dispose(object);
69 104  
  105 +
  106 + }
  107 +
  108 +#ifndef _WIN32
  109 + static GtkWidget * custom_widget_new(GtkPrintOperation *prt)
  110 + {
  111 + return GTK_WIDGET(GTK_V3270_PRINT_OPERATION(prt)->settings);
70 112 }
71 113  
  114 + static void custom_widget_apply(GtkPrintOperation *prt, GtkWidget *widget)
  115 + {
  116 +
  117 + }
  118 +#endif // _WIN32
  119 +
72 120 static void V3270PrintOperation_class_init(V3270PrintOperationClass *klass)
73 121 {
74 122 GtkPrintOperationClass * operation = GTK_PRINT_OPERATION_CLASS(klass);
75 123  
76 124 G_OBJECT_CLASS(klass)->dispose = dispose;
77   - operation->done = done;
78   - operation->begin_print = V3270PrintOperation_begin_print;
79   - operation->draw_page = V3270PrintOperation_draw_page;
  125 + operation->done = done;
  126 + operation->begin_print = V3270PrintOperation_begin_print;
  127 + operation->draw_page = V3270PrintOperation_draw_page;
80 128  
81 129 #ifndef _WIN32
82   - operation->create_custom_widget = V3270PrintOperation_custom_widget_new;
83   - operation->custom_widget_apply = V3270PrintOperation_custom_widget_apply;
  130 + operation->create_custom_widget = custom_widget_new;
  131 + operation->custom_widget_apply = custom_widget_apply;
84 132 #endif // _WIN32
85 133  
86 134 }
... ... @@ -95,9 +143,8 @@
95 143  
96 144 // Setup defaults
97 145 widget->mode = LIB3270_CONTENT_ALL;
98   - widget->show_selection = FALSE;
99   - widget->font.name = NULL; // g_strdup(v3270_default_font);
100   - v3270_set_mono_color_table(widget->colors,"#000000","#FFFFFF");
  146 +// widget->show_selection = FALSE;
  147 +// widget->font.name = NULL; // g_strdup(v3270_default_font);
101 148  
102 149 }
103 150  
... ... @@ -110,7 +157,7 @@ V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTE
110 157 operation->mode = mode;
111 158 operation->widget = GTK_V3270(widget);
112 159 operation->session = v3270_get_session(widget);
113   - operation->font.name = g_strdup(v3270_get_font_family(widget));
  160 + operation->settings = V3270_print_settings_new(widget);
114 161  
115 162 // Get contents.
116 163 switch(operation->mode)
... ... @@ -141,6 +188,9 @@ V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTE
141 188 {
142 189 const lib3270_selection * selection = (const lib3270_selection *) element->data;
143 190  
  191 + if(!selection)
  192 + break;
  193 +
144 194 if(selection->bounds.width > operation->contents.width)
145 195 operation->contents.width = selection->bounds.width;
146 196  
... ...
src/dialogs/print/private.h
... ... @@ -49,14 +49,15 @@
49 49 struct _V3270PrintOperation
50 50 {
51 51 GtkPrintOperation parent;
52   - GdkRGBA colors[V3270_COLOR_COUNT];
53 52 LIB3270_CONTENT_OPTION mode;
54 53 v3270 * widget;
55 54 H3270 * session;
  55 + gboolean show_selection; ///< @brief Print selection box?
  56 +
  57 + V3270PrintSettings * settings; ///< @brief Custom configuration.
56 58  
57 59 size_t lpp; ///< @brief Lines per page (in rows).
58 60 size_t pages; ///< @brief Number of pages.
59   - gboolean show_selection; ///< @brief Print selection box?
60 61  
61 62 struct
62 63 {
... ... @@ -68,17 +69,32 @@
68 69  
69 70 struct
70 71 {
71   - gchar * name;
72 72 v3270FontInfo info;
73 73 } font;
74 74  
75 75 };
76 76  
  77 + struct _V3270PrintSettingsClass
  78 + {
  79 + GtkFrameClass parent_class;
  80 +
  81 + };
  82 +
  83 +struct _V3270PrintSettings
  84 + {
  85 + GtkFrame parent;
  86 + GdkRGBA colors[V3270_COLOR_COUNT]; ///< @brief Color scheme for printing.
  87 +
  88 + GtkWidget * font; ///< @brief Font selection widget.
  89 + GtkWidget * color; ///< @brief Color scheme selecting widget.
  90 + GtkWidget * selected; ///< @brief Checkbox.
  91 +
  92 + };
  93 +
  94 +
77 95 /*--[ Prototypes ]-----------------------------------------------------------------------------------*/
78 96  
79 97 G_GNUC_INTERNAL void V3270PrintOperation_begin_print(GtkPrintOperation *prt, GtkPrintContext *context);
80 98 G_GNUC_INTERNAL void V3270PrintOperation_draw_page(GtkPrintOperation *prt, GtkPrintContext *context, gint page);
81   - G_GNUC_INTERNAL GtkWidget * V3270PrintOperation_custom_widget_new(GtkPrintOperation *prt);
82   - G_GNUC_INTERNAL void V3270PrintOperation_custom_widget_apply(GtkPrintOperation *prt, GtkWidget *widget);
83 99  
84 100  
... ...
src/dialogs/print/settings.c 0 → 100644
... ... @@ -0,0 +1,154 @@
  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 "private.h"
  31 + #include <sys/param.h>
  32 + #include <terminal.h>
  33 + #include <v3270/colorscheme.h>
  34 + #include <lib3270/selection.h>
  35 +
  36 +/*--[ Widget definition ]----------------------------------------------------------------------------*/
  37 +
  38 + G_DEFINE_TYPE(V3270PrintSettings, V3270PrintSettings, GTK_TYPE_FRAME);
  39 +
  40 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  41 +
  42 +static void finalize(GObject *object)
  43 + {
  44 +
  45 +// V3270PrintSettings * settings = GTK_V3270_PRINT_SETTINGS(object);
  46 +
  47 +
  48 + G_OBJECT_CLASS(V3270PrintSettings_parent_class)->finalize(object);
  49 + }
  50 +
  51 +static void V3270PrintSettings_class_init(V3270PrintSettingsClass *klass)
  52 +{
  53 + GObjectClass * gobject_class = G_OBJECT_CLASS(klass);
  54 +
  55 + // Object methods
  56 + gobject_class->finalize = finalize;
  57 +
  58 +}
  59 +
  60 +static void color_scheme_changed(GtkWidget G_GNUC_UNUSED(*widget), const GdkRGBA *colors, V3270PrintSettings *settings)
  61 +{
  62 +
  63 + debug("%s=%p",__FUNCTION__,colors);
  64 +
  65 + int f;
  66 + for(f=0;f<V3270_COLOR_COUNT;f++)
  67 + settings->colors[f] = colors[f];
  68 +
  69 +}
  70 +
  71 +static void V3270PrintSettings_init(V3270PrintSettings *widget)
  72 +{
  73 + static const gchar * text[] =
  74 + {
  75 + N_( "_Font:" ),
  76 + N_( "C_olor scheme:" )
  77 + };
  78 +
  79 + size_t f;
  80 + GtkGrid * grid = GTK_GRID(gtk_grid_new());
  81 +
  82 + widget->font = v3270_font_selection_new("monospace");
  83 + widget->color = v3270_color_scheme_new();
  84 + widget->selected = gtk_check_button_new_with_label( _("Print selection box") );
  85 +
  86 + // The print dialog doesn't follow the guidelines from https://developer.gnome.org/hig/stable/visual-layout.html.en )-:
  87 + gtk_frame_set_shadow_type(GTK_FRAME(widget),GTK_SHADOW_NONE);
  88 +
  89 + GtkWidget *label = gtk_label_new(NULL);
  90 +
  91 + gtk_label_set_markup(GTK_LABEL(label),_("<b>Text options</b>"));
  92 + gtk_frame_set_label_widget(GTK_FRAME(widget),label);
  93 +
  94 + gtk_container_set_border_width(GTK_CONTAINER(widget),12);
  95 + gtk_container_set_border_width(GTK_CONTAINER(grid),6);
  96 +
  97 + g_object_set(G_OBJECT(grid),"margin-start",8,NULL);
  98 +
  99 + gtk_grid_set_row_spacing(grid,6);
  100 + gtk_grid_set_column_spacing(grid,12);
  101 +
  102 + g_signal_connect(G_OBJECT(widget->color),"update-colors",G_CALLBACK(color_scheme_changed),widget);
  103 + // g_signal_connect(G_OBJECT(widget->selected),"toggled",G_CALLBACK(toggle_show_selection),widget);
  104 +
  105 + for(f=0;f<G_N_ELEMENTS(text);f++)
  106 + {
  107 + GtkWidget *label = gtk_label_new_with_mnemonic(gettext(text[f]));
  108 + gtk_widget_set_halign(label,GTK_ALIGN_START);
  109 + gtk_grid_attach(grid,label,0,f,1,1);
  110 + }
  111 +
  112 + gtk_grid_attach(grid,widget->font,1,0,1,1);
  113 + gtk_grid_attach(grid,widget->color,1,1,1,1);
  114 + gtk_grid_attach(grid,widget->selected,1,2,1,1);
  115 +
  116 + gtk_container_add(GTK_CONTAINER(widget),GTK_WIDGET(grid));
  117 +
  118 + v3270_set_mono_color_table(widget->colors,"#000000","#FFFFFF");
  119 + v3270_color_scheme_set_rgba(widget->color,widget->colors);
  120 +
  121 + gtk_widget_show_all(GTK_WIDGET(widget));
  122 +
  123 +}
  124 +
  125 +LIB3270_EXPORT GtkWidget * V3270_print_settings_new(GtkWidget *widget)
  126 +{
  127 + V3270PrintSettings * settings = GTK_V3270_PRINT_SETTINGS(g_object_new(GTK_TYPE_V3270_PRINT_SETTINGS, NULL));
  128 +
  129 + v3270_font_selection_set_family(settings->font, v3270_get_font_family(widget));
  130 +
  131 + return GTK_WIDGET(settings);
  132 +
  133 +}
  134 +
  135 +LIB3270_EXPORT gboolean v3270_print_settings_get_show_selection(GtkWidget *widget)
  136 +{
  137 + return gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(GTK_V3270_PRINT_SETTINGS(widget)->selected));
  138 +}
  139 +
  140 +LIB3270_EXPORT void v3270_print_settings_set_show_selection(GtkWidget *widget, gboolean is_active)
  141 +{
  142 + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(GTK_V3270_PRINT_SETTINGS(widget)->selected),is_active);
  143 +}
  144 +
  145 +LIB3270_EXPORT gchar * v3270_print_settings_get_color_scheme(GtkWidget *widget)
  146 +{
  147 + return v3270_color_scheme_get_text(GTK_V3270_COLOR_SCHEME(GTK_V3270_PRINT_SETTINGS(widget)->color));
  148 +}
  149 +
  150 +LIB3270_EXPORT void v3270_print_settings_set_color_scheme(GtkWidget *widget, const gchar *colors)
  151 +{
  152 + v3270_color_scheme_set_text(GTK_V3270_COLOR_SCHEME(GTK_V3270_PRINT_SETTINGS(widget)->color), colors);
  153 +}
  154 +
... ...
src/include/v3270/print.h
... ... @@ -38,7 +38,6 @@
38 38  
39 39 /*--[ Print Operation ]------------------------------------------------------------------------------*/
40 40  
41   -
42 41 #define GTK_TYPE_V3270_PRINT_OPERATION (V3270PrintOperation_get_type())
43 42 #define GTK_V3270_PRINT_OPERATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_PRINT_OPERATION, V3270PrintOperation))
44 43 #define GTK_V3270_PRINT_OPERATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_PRINT_OPERATION, V3270PrintOperationClass))
... ... @@ -49,12 +48,36 @@
49 48 typedef struct _V3270PrintOperation V3270PrintOperation;
50 49 typedef struct _V3270PrintOperationClass V3270PrintOperationClass;
51 50  
  51 +/*--[ Print Settings ]-------------------------------------------------------------------------------*/
  52 +
  53 + #define GTK_TYPE_V3270_PRINT_SETTINGS (V3270PrintSettings_get_type())
  54 + #define GTK_V3270_PRINT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_PRINT_SETTINGS, V3270PrintSettings))
  55 + #define GTK_V3270_PRINT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_PRINT_SETTINGS, V3270PrintSettingsClass))
  56 + #define GTK_IS_V3270_PRINT_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270_PRINT_SETTINGS))
  57 + #define GTK_IS_V3270_PRINT_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270_PRINT_SETTINGS))
  58 + #define GTK_V3270_PRINT_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270_PRINT_SETTINGS, V3270V3270SettingsClass))
  59 +
  60 + typedef struct _V3270PrintSettings V3270PrintSettings;
  61 + typedef struct _V3270PrintSettingsClass V3270PrintSettingsClass;
  62 +
52 63 /*--[ Prototipes ]-----------------------------------------------------------------------------------*/
53 64  
  65 + LIB3270_EXPORT GType V3270PrintOperation_get_type(void);
54 66 LIB3270_EXPORT V3270PrintOperation * v3270_print_operation_new(GtkWidget *widget, LIB3270_CONTENT_OPTION mode);
  67 +
55 68 LIB3270_EXPORT GtkTreeModel * v3270_font_family_model_new(GtkWidget *widget, const gchar *selected, GtkTreeIter * active);
  69 +
56 70 LIB3270_EXPORT GtkWidget * v3270_font_selection_new(const gchar *fontname);
57   - LIB3270_EXPORT GType V3270PrintOperation_get_type(void);
  71 + LIB3270_EXPORT gboolean v3270_font_selection_set_family(GtkWidget *widget, const gchar *fontname);
  72 + LIB3270_EXPORT const gchar * v3270_font_selection_get_family(GtkWidget *widget);
  73 +
  74 + LIB3270_EXPORT GType V3270PrintSettings_get_type(void);
  75 + LIB3270_EXPORT GtkWidget * V3270_print_settings_new(GtkWidget *widget);
  76 + LIB3270_EXPORT gboolean v3270_print_settings_get_show_selection(GtkWidget *widget);
  77 + LIB3270_EXPORT void v3270_print_settings_set_show_selection(GtkWidget *widget, gboolean is_active);
  78 + LIB3270_EXPORT gchar * v3270_print_settings_get_color_scheme(GtkWidget *widget);
  79 + LIB3270_EXPORT void v3270_print_settings_set_color_scheme(GtkWidget *widget, const gchar *colors);
  80 +
58 81  
59 82 G_END_DECLS
60 83  
... ...
v3270.cbp
... ... @@ -66,9 +66,6 @@
66 66 <Unit filename="src/dialogs/print/convenience.c">
67 67 <Option compilerVar="CC" />
68 68 </Unit>
69   - <Unit filename="src/dialogs/print/custom.c">
70   - <Option compilerVar="CC" />
71   - </Unit>
72 69 <Unit filename="src/dialogs/print/draw.c">
73 70 <Option compilerVar="CC" />
74 71 </Unit>
... ... @@ -76,6 +73,9 @@
76 73 <Option compilerVar="CC" />
77 74 </Unit>
78 75 <Unit filename="src/dialogs/print/private.h" />
  76 + <Unit filename="src/dialogs/print/settings.c">
  77 + <Option compilerVar="CC" />
  78 + </Unit>
79 79 <Unit filename="src/dialogs/private.h" />
80 80 <Unit filename="src/dialogs/save/convenience.c">
81 81 <Option compilerVar="CC" />
... ...