Commit 18eb35eb4d378e36e2b0a9791b55d3a8bf3d8f7a

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

Working on the font chooser dialog.

Makefile.in
... ... @@ -45,7 +45,8 @@ SOURCES= \
45 45 $(wildcard src/dialogs/*.c) \
46 46 $(wildcard src/dialogs/@OSNAME@/*.c) \
47 47 $(wildcard src/dialogs/print/*.c) \
48   - $(wildcard src/dialogs/save/*.c)
  48 + $(wildcard src/dialogs/save/*.c) \
  49 + $(wildcard src/dialogs/font/*.c)
49 50  
50 51 TEST_SOURCES= \
51 52 $(wildcard src/testprogram/*.c)
... ...
src/dialogs/colors.c
... ... @@ -284,7 +284,6 @@ static void load(GtkWidget G_GNUC_UNUSED(*w), GtkWidget *terminal)
284 284 g_value_unset(&value);
285 285 }
286 286  
287   -
288 287 static void V3270ColorSelection_init(V3270ColorSelection *widget)
289 288 {
290 289 {
... ...
src/dialogs/font/chooser.c 0 → 100644
... ... @@ -0,0 +1,188 @@
  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 + /**
  31 + * @brief Implements the V3270 Font Chooser widget.
  32 + *
  33 + * Reference:
  34 + *
  35 + */
  36 +
  37 + #include "../private.h"
  38 + #include <v3270/dialogs.h>
  39 + #include <v3270/settings.h>
  40 + #include <lib3270/log.h>
  41 +
  42 +/*--[ Widget definition ]----------------------------------------------------------------------------*/
  43 +
  44 + #define GTK_TYPE_V3270_FONT_CHOOSER (V3270FontChooserWidget_get_type ())
  45 + #define GTK_V3270_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_V3270_FONT_CHOOSER, V3270FontChooserWidget))
  46 + #define GTK_V3270_FONT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_V3270_FONT_CHOOSER, V3270FontChooserWidgetClass))
  47 + #define GTK_IS_V3270_FONT_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_V3270_FONT_CHOOSER))
  48 + #define GTK_IS_V3270_FONT_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_V3270_FONT_CHOOSER))
  49 + #define GTK_V3270_FONT_CHOOSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_V3270_FONT_CHOOSER, V3270FontChooserWidgetClass))
  50 +
  51 + typedef struct _V3270FontChooserWidget
  52 + {
  53 + V3270Settings parent;
  54 +
  55 + GtkWidget * font_list;
  56 + GtkWidget * preview;
  57 +
  58 + } V3270FontChooserWidget;
  59 +
  60 + typedef struct _V3270HostSelectWidgetClass
  61 + {
  62 + V3270SettingsClass parent_class;
  63 + } V3270FontChooserWidgetClass;
  64 +
  65 +
  66 + G_DEFINE_TYPE(V3270FontChooserWidget, V3270FontChooserWidget, GTK_TYPE_V3270_SETTINGS);
  67 +
  68 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  69 +
  70 +static void apply(GtkWidget *widget, GtkWidget *terminal)
  71 +{
  72 +
  73 + debug("V3270FontChooserWidget::%s",__FUNCTION__);
  74 +
  75 +}
  76 +
  77 +static void load(GtkWidget *widget, GtkWidget *terminal)
  78 +{
  79 + V3270FontChooserWidget *chooser = GTK_V3270_FONT_CHOOSER(widget);
  80 +
  81 + debug("V3270FontChooserWidget::%s",__FUNCTION__);
  82 +
  83 + GtkTreeIter active;
  84 + gtk_tree_view_set_model(
  85 + GTK_TREE_VIEW(chooser->font_list),
  86 + v3270_font_family_model_new(
  87 + chooser->font_list,
  88 + v3270_get_font_family(terminal),
  89 + &active
  90 + )
  91 + );
  92 +
  93 + gtk_tree_selection_select_iter(
  94 + gtk_tree_view_get_selection(GTK_TREE_VIEW(chooser->font_list)),
  95 + &active
  96 + );
  97 +
  98 +}
  99 +
  100 +static void V3270FontChooserWidget_class_init(V3270FontChooserWidgetClass *klass)
  101 +{
  102 + V3270SettingsClass * widget = GTK_V3270_SETTINGS_CLASS(klass);
  103 +
  104 + widget->apply = apply;
  105 + widget->load = load;
  106 +
  107 +}
  108 +
  109 + static void font_selected(GtkTreeSelection *selection, V3270FontChooserWidget *widget)
  110 + {
  111 + GValue value = { 0, };
  112 + GtkTreeModel * model;
  113 + GtkTreeIter iter;
  114 +
  115 + if(!gtk_tree_selection_get_selected(selection,&model,&iter))
  116 + return;
  117 +
  118 + gtk_tree_model_get_value(model,&iter,0,&value);
  119 +
  120 + debug("Font-family: %s",g_value_get_string(&value));
  121 +
  122 + // Update terminal widget
  123 + GtkWidget * terminal = v3270_settings_get_terminal_widget(GTK_WIDGET(widget));
  124 + if(terminal)
  125 + v3270_set_font_family(terminal,g_value_get_string(&value));
  126 +
  127 + g_value_unset(&value);
  128 + }
  129 +
  130 +static void V3270FontChooserWidget_init(V3270FontChooserWidget *widget)
  131 +{
  132 + gtk_widget_set_size_request(GTK_WIDGET(widget),-1,136);
  133 + gtk_grid_set_row_homogeneous(GTK_GRID(widget),FALSE);
  134 +
  135 + // Create font list view
  136 + {
  137 + widget->font_list = gtk_tree_view_new();
  138 +
  139 + gtk_widget_set_tooltip_markup(widget->font_list,_("Available fonts"));
  140 +
  141 + gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(widget->font_list),FALSE);
  142 + gtk_tree_view_insert_column_with_attributes( GTK_TREE_VIEW(widget->font_list),
  143 + -1,
  144 + "text",gtk_cell_renderer_text_new(),"text",
  145 + 0, NULL
  146 + );
  147 +
  148 + // Setup selection mode.
  149 + GtkTreeSelection * select = gtk_tree_view_get_selection(GTK_TREE_VIEW(widget->font_list));
  150 + gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);
  151 + g_signal_connect(G_OBJECT(select),"changed",G_CALLBACK(font_selected),widget);
  152 +
  153 + // Put the view inside a scrolled window.
  154 + GtkWidget * box = gtk_scrolled_window_new(NULL,NULL);
  155 + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(box),GTK_POLICY_NEVER,GTK_POLICY_ALWAYS);
  156 + gtk_container_add(GTK_CONTAINER(box),widget->font_list);
  157 +
  158 + gtk_widget_set_vexpand(box,TRUE);
  159 + gtk_widget_set_hexpand(box,FALSE);
  160 +
  161 + gtk_grid_attach(GTK_GRID(widget),box,0,0,1,5);
  162 + }
  163 +
  164 + // Add preview widgets
  165 + {
  166 + widget->preview = gtk_entry_new();
  167 + gtk_entry_set_text(GTK_ENTRY(widget->preview),pango_language_get_sample_string(NULL));
  168 +
  169 + gtk_widget_set_can_default(widget->preview,FALSE);
  170 + gtk_widget_set_can_focus(widget->preview,FALSE);
  171 + gtk_editable_set_editable(GTK_EDITABLE(widget->preview),FALSE);
  172 +
  173 + gtk_widget_set_vexpand(widget->preview,FALSE);
  174 + gtk_widget_set_hexpand(widget->preview,TRUE);
  175 +
  176 + gtk_grid_attach(GTK_GRID(widget),widget->preview,1,0,5,1);
  177 + }
  178 +
  179 +}
  180 +
  181 +GtkWidget * v3270_font_chooser_widget_new()
  182 +{
  183 + V3270FontChooserWidget * font_chooser = (V3270FontChooserWidget *) g_object_new(GTK_TYPE_V3270_FONT_CHOOSER, NULL);
  184 +
  185 +
  186 + return GTK_WIDGET(font_chooser);
  187 +}
  188 +
... ...
src/dialogs/font/model.c 0 → 100644
... ... @@ -0,0 +1,68 @@
  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 <string.h>
  31 + #include <v3270.h>
  32 + #include <lib3270/log.h>
  33 +
  34 +/*--[ Widget definition ]----------------------------------------------------------------------------*/
  35 +
  36 + LIB3270_EXPORT GtkTreeModel * v3270_font_family_model_new(GtkWidget *widget, const gchar *selected, GtkTreeIter * active)
  37 + {
  38 + GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(1,G_TYPE_STRING);
  39 +
  40 + gint n_families, i;
  41 + PangoFontFamily **families;
  42 + pango_context_list_families(gtk_widget_get_pango_context(widget),&families, &n_families);
  43 +
  44 + if(!(selected && *selected))
  45 + selected = v3270_get_default_font_name();
  46 +
  47 + memset(active,0,sizeof(GtkTreeIter));
  48 +
  49 + for(i=0; i < n_families; i++)
  50 + {
  51 + if(!pango_font_family_is_monospace(families[i]))
  52 + continue;
  53 +
  54 + const gchar *name = pango_font_family_get_name (families[i]);
  55 + GtkTreeIter iter;
  56 +
  57 + gtk_list_store_append((GtkListStore *) model,&iter);
  58 + gtk_list_store_set((GtkListStore *) model, &iter,0, name, -1);
  59 +
  60 + if(!g_ascii_strcasecmp(name,selected))
  61 + *active = iter;
  62 +
  63 + }
  64 +
  65 + g_free(families);
  66 +
  67 + return model;
  68 + }
... ...
src/dialogs/font/select.c 0 → 100644
... ... @@ -0,0 +1,107 @@
  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 <string.h>
  31 + #include <v3270.h>
  32 + #include <v3270/print.h>
  33 + #include <v3270/dialogs.h>
  34 + #include <lib3270/log.h>
  35 +
  36 +/*--[ Widget definition ]----------------------------------------------------------------------------*/
  37 +
  38 + LIB3270_EXPORT GtkWidget * v3270_font_selection_new(const gchar *selected)
  39 + {
  40 + GtkWidget * widget = gtk_combo_box_new();
  41 + GtkTreeIter active;
  42 + GtkTreeModel * model = v3270_font_family_model_new(widget,selected,&active);
  43 +
  44 + GtkCellRenderer * renderer = gtk_cell_renderer_text_new();
  45 + gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
  46 + gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget), renderer, "text", 0, NULL);
  47 +
  48 + gtk_combo_box_set_model(GTK_COMBO_BOX(widget),model);
  49 + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&active);
  50 +
  51 + return widget;
  52 + }
  53 +
  54 + LIB3270_EXPORT gboolean v3270_font_selection_set_family(GtkWidget *widget, const gchar *fontname)
  55 + {
  56 + GtkTreeModel * model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
  57 + GtkTreeIter iter;
  58 +
  59 + if(!fontname)
  60 + fontname = "monospace";
  61 +
  62 + if(gtk_tree_model_get_iter_first(model,&iter))
  63 + {
  64 + do
  65 + {
  66 + GValue value = { 0, };
  67 +
  68 + gtk_tree_model_get_value(model,&iter,0,&value);
  69 +
  70 + if(!g_ascii_strcasecmp(fontname,g_value_get_string(&value)))
  71 + {
  72 + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&iter);
  73 + g_value_unset(&value);
  74 + return TRUE;
  75 + }
  76 +
  77 + g_value_unset(&value);
  78 +
  79 + } while(gtk_tree_model_iter_next(model,&iter));
  80 + }
  81 +
  82 + return FALSE;
  83 +
  84 + }
  85 +
  86 + LIB3270_EXPORT gchar * v3270_font_selection_get_family(GtkWidget *widget)
  87 + {
  88 + GtkTreeIter iter;
  89 +
  90 + if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget),&iter))
  91 + {
  92 + GValue value = { 0, };
  93 +
  94 + gtk_tree_model_get_value(gtk_combo_box_get_model(GTK_COMBO_BOX(widget)),&iter,0,&value);
  95 +
  96 + gchar * rc = g_value_dup_string(&value);
  97 +
  98 + g_value_unset(&value);
  99 +
  100 + return rc;
  101 +
  102 + }
  103 +
  104 + return "monospace";
  105 +
  106 + }
  107 +
... ...
src/dialogs/fontselect.c
... ... @@ -1,140 +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 <string.h>
31   - #include <v3270.h>
32   - #include <v3270/print.h>
33   - #include <lib3270/log.h>
34   -
35   -/*--[ Widget definition ]----------------------------------------------------------------------------*/
36   -
37   - LIB3270_EXPORT GtkTreeModel * v3270_font_family_model_new(GtkWidget *widget, const gchar *selected, GtkTreeIter * active)
38   - {
39   - GtkTreeModel * model = (GtkTreeModel *) gtk_list_store_new(1,G_TYPE_STRING);
40   -
41   - GtkCellRenderer * renderer = gtk_cell_renderer_text_new();
42   - gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
43   - gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(widget), renderer, "text", 0, NULL);
44   -
45   - gint n_families, i;
46   - PangoFontFamily **families;
47   - pango_context_list_families(gtk_widget_get_pango_context(widget),&families, &n_families);
48   -
49   - if(!(selected && *selected))
50   - selected = v3270_get_default_font_name();
51   -
52   - memset(active,0,sizeof(GtkTreeIter));
53   -
54   - for(i=0; i < n_families; i++)
55   - {
56   - if(!pango_font_family_is_monospace(families[i]))
57   - continue;
58   -
59   - const gchar *name = pango_font_family_get_name (families[i]);
60   - GtkTreeIter iter;
61   -
62   - gtk_list_store_append((GtkListStore *) model,&iter);
63   - gtk_list_store_set((GtkListStore *) model, &iter,0, name, -1);
64   -
65   - if(!g_ascii_strcasecmp(name,selected))
66   - *active = iter;
67   -
68   - }
69   -
70   - g_free(families);
71   -
72   - return model;
73   - }
74   -
75   - LIB3270_EXPORT GtkWidget * v3270_font_selection_new(const gchar *selected)
76   - {
77   - GtkWidget * widget = gtk_combo_box_new();
78   - GtkTreeIter active;
79   - GtkTreeModel * model = v3270_font_family_model_new(widget,selected,&active);
80   -
81   - gtk_combo_box_set_model(GTK_COMBO_BOX(widget),model);
82   - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&active);
83   -
84   - return widget;
85   - }
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(!fontname)
93   - fontname = "monospace";
94   -
95   - if(gtk_tree_model_get_iter_first(model,&iter))
96   - {
97   - do
98   - {
99   - GValue value = { 0, };
100   -
101   - gtk_tree_model_get_value(model,&iter,0,&value);
102   -
103   - if(!g_ascii_strcasecmp(fontname,g_value_get_string(&value)))
104   - {
105   - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(widget),&iter);
106   - g_value_unset(&value);
107   - return TRUE;
108   - }
109   -
110   - g_value_unset(&value);
111   -
112   - } while(gtk_tree_model_iter_next(model,&iter));
113   - }
114   -
115   - return FALSE;
116   -
117   - }
118   -
119   - LIB3270_EXPORT gchar * v3270_font_selection_get_family(GtkWidget *widget)
120   - {
121   - GtkTreeIter iter;
122   -
123   - if(gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget),&iter))
124   - {
125   - GValue value = { 0, };
126   -
127   - gtk_tree_model_get_value(gtk_combo_box_get_model(GTK_COMBO_BOX(widget)),&iter,0,&value);
128   -
129   - gchar * rc = g_value_dup_string(&value);
130   -
131   - g_value_unset(&value);
132   -
133   - return rc;
134   -
135   - }
136   -
137   - return "monospace";
138   -
139   - }
140   -
src/include/v3270.h
... ... @@ -278,6 +278,7 @@
278 278  
279 279 // Auxiliary widgets
280 280 LIB3270_EXPORT void v3270_select_host(GtkWidget *widget);
  281 + LIB3270_EXPORT GtkWidget * v3270_font_chooser_widget_new();
281 282  
282 283 // Print
283 284 LIB3270_EXPORT int v3270_print(GtkWidget *widget, GError **error);
... ...
src/include/v3270/dialogs.h
... ... @@ -48,6 +48,8 @@
48 48  
49 49 LIB3270_EXPORT void v3270_popup_gerror(GtkWidget *widget, GError *error, const gchar *title, const gchar *fmt, ...) G_GNUC_PRINTF(4,5);
50 50  
  51 + LIB3270_EXPORT GtkTreeModel * v3270_font_family_model_new(GtkWidget *widget, const gchar *selected, GtkTreeIter * active);
  52 +
51 53  
52 54 G_END_DECLS
53 55  
... ...
src/include/v3270/print.h
... ... @@ -74,8 +74,6 @@
74 74 LIB3270_EXPORT void v3270_print_operation_set_color_scheme(GtkPrintOperation *operation, const gchar *colors);
75 75 LIB3270_EXPORT gchar * v3270_print_operation_get_color_scheme(GtkPrintOperation *operation);
76 76  
77   - LIB3270_EXPORT GtkTreeModel * v3270_font_family_model_new(GtkWidget *widget, const gchar *selected, GtkTreeIter * active);
78   -
79 77 LIB3270_EXPORT GtkWidget * v3270_font_selection_new(const gchar *fontname);
80 78 LIB3270_EXPORT gboolean v3270_font_selection_set_family(GtkWidget *widget, const gchar *fontname);
81 79 LIB3270_EXPORT gchar * v3270_font_selection_get_family(GtkWidget *widget);
... ...
src/testprogram/testprogram.c
... ... @@ -37,6 +37,7 @@
37 37 #include <v3270/filetransfer.h>
38 38 #include <v3270/ftprogress.h>
39 39 #include <v3270/colorscheme.h>
  40 + #include <v3270/settings.h>
40 41 #include <v3270/trace.h>
41 42 #include <lib3270/log.h>
42 43 #include <stdlib.h>
... ...
src/testprogram/toolbar.c
... ... @@ -33,6 +33,7 @@
33 33 #include <v3270/ftprogress.h>
34 34 #include <v3270/colorscheme.h>
35 35 #include <v3270/dialogs.h>
  36 + #include <v3270/settings.h>
36 37 #include <v3270/trace.h>
37 38 #include <lib3270/log.h>
38 39 #include <stdlib.h>
... ... @@ -51,6 +52,18 @@
51 52 v3270_select_host(terminal);
52 53 }
53 54  
  55 + static void font_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal)
  56 + {
  57 + GtkWidget * dialog = v3270_settings_dialog_new(terminal, v3270_font_chooser_widget_new());
  58 +
  59 + v3270_dialog_setup(dialog,_("Font setup"),_("_Save"));
  60 +
  61 + gtk_widget_show_all(dialog);
  62 + gtk_dialog_run(GTK_DIALOG(dialog));
  63 + gtk_widget_destroy(dialog);
  64 +
  65 + }
  66 +
54 67 static void connect_clicked(GtkButton G_GNUC_UNUSED(*button), GtkWidget *terminal)
55 68 {
56 69 lib3270_reconnect(v3270_get_session(terminal),0);
... ... @@ -205,20 +218,22 @@
205 218 GCallback callback;
206 219 const gchar * tooltip;
207 220 } buttons[] = {
208   - { "gtk-connect", G_CALLBACK(connect_clicked), "Connect to host" },
209   - { "gtk-disconnect", G_CALLBACK(disconnect_clicked), "Disconnect from host" },
210   - { "gtk-select-color", G_CALLBACK(color_clicked), "Edit or change color scheme" },
211   - { "network-server", G_CALLBACK(host_clicked), "Configure host" },
212   - { "gtk-print", G_CALLBACK(print_clicked), "Print screen contents" },
213   - { "gtk-harddisk", G_CALLBACK(ft_clicked), "Open file transfer dialog" },
214   - { "gtk-copy", G_CALLBACK(copy_clicked), "Copy data" },
215   - { "gtk-paste", G_CALLBACK(paste_clicked), "Paste data" },
216   - { "document-save", G_CALLBACK(save_all_clicked), "Save screen" },
217   - { "document-open", G_CALLBACK(load_clicked), "Paste file" },
218   -
219   - { "zoom-in", G_CALLBACK(zoom_in_clicked), "Zoom in" },
220   - { "zoom-out", G_CALLBACK(zoom_out_clicked), "Zoom out" },
221   - { "zoom-fit-best", G_CALLBACK(zoom_best_clicked), "Zoom best" },
  221 + { "gtk-connect", G_CALLBACK(connect_clicked), "Connect to host" },
  222 + { "gtk-disconnect", G_CALLBACK(disconnect_clicked), "Disconnect from host" },
  223 + { "gtk-select-color", G_CALLBACK(color_clicked), "Edit or change color scheme" },
  224 + { "network-server", G_CALLBACK(host_clicked), "Configure host" },
  225 + { "gtk-print", G_CALLBACK(print_clicked), "Print screen contents" },
  226 + { "gtk-harddisk", G_CALLBACK(ft_clicked), "Open file transfer dialog" },
  227 + { "gtk-copy", G_CALLBACK(copy_clicked), "Copy data" },
  228 + { "gtk-paste", G_CALLBACK(paste_clicked), "Paste data" },
  229 + { "document-save", G_CALLBACK(save_all_clicked), "Save screen" },
  230 + { "document-open", G_CALLBACK(load_clicked), "Paste file" },
  231 +
  232 + { "preferences-desktop-font", G_CALLBACK(font_clicked), "Select font" },
  233 +
  234 + { "zoom-in", G_CALLBACK(zoom_in_clicked), "Zoom in" },
  235 + { "zoom-out", G_CALLBACK(zoom_out_clicked), "Zoom out" },
  236 + { "zoom-fit-best", G_CALLBACK(zoom_best_clicked), "Zoom best" },
222 237 };
223 238  
224 239 GtkWidget * toolbar = gtk_toolbar_new();
... ...
v3270.cbp
... ... @@ -51,7 +51,13 @@
51 51 <Unit filename="src/dialogs/commondialog.c">
52 52 <Option compilerVar="CC" />
53 53 </Unit>
54   - <Unit filename="src/dialogs/fontselect.c">
  54 + <Unit filename="src/dialogs/font/chooser.c">
  55 + <Option compilerVar="CC" />
  56 + </Unit>
  57 + <Unit filename="src/dialogs/font/model.c">
  58 + <Option compilerVar="CC" />
  59 + </Unit>
  60 + <Unit filename="src/dialogs/font/select.c">
55 61 <Option compilerVar="CC" />
56 62 </Unit>
57 63 <Unit filename="src/dialogs/hostselect.c">
... ...