]> git.sur5r.net Git - glabels/blob - src/ui-property-bar.c
Imported Upstream version 2.2.8
[glabels] / src / ui-property-bar.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
2
3 /**
4  *  (GLABELS) Label and Business Card Creation program for GNOME
5  *
6  *  property-bar.c:  gLabels property bar
7  *
8  *  Copyright (C) 2003  Jim Evins <evins@snaught.com>.
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 2 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, write to the Free Software
22  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
23  */
24
25 #include <config.h>
26
27 #include "ui-property-bar.h"
28
29 #include <glib/gi18n.h>
30 #include <glade/glade-xml.h>
31 #include <gtk/gtkcombobox.h>
32 #include <gtk/gtkspinbutton.h>
33 #include <gtk/gtktoolbar.h>
34 #include <gtk/gtktoggletoolbutton.h>
35 #include <gtk/gtktooltips.h>
36 #include <string.h>
37
38 #include "util.h"
39 #include "mygal/widget-color-combo.h"
40 #include "stock-pixmaps/stockpixbufs.h"
41 #include "prefs.h"
42 #include "color.h"
43
44 #include "debug.h"
45
46 /*===========================================================================*/
47 /* Private macros and constants.                                             */
48 /*===========================================================================*/
49
50 /*===========================================================================*/
51 /* Private data types                                                        */
52 /*===========================================================================*/
53
54 struct _glUIPropertyBarPrivate {
55
56         glView     *view;
57
58         GladeXML   *gui;
59
60         GtkWidget  *tool_bar;
61
62         /* Font selection */
63         GtkWidget  *font_family_combo;
64         GtkWidget  *font_size_spin;
65         GtkWidget  *font_bold_toggle;
66         GtkWidget  *font_italic_toggle;
67
68         /* Text alignemnt radios */
69         GtkWidget  *text_align_left_radio;
70         GtkWidget  *text_align_center_radio;
71         GtkWidget  *text_align_right_radio;
72
73         /* Color combos */
74         GtkWidget  *text_color_combo;
75         GtkWidget  *fill_color_combo;
76         GtkWidget  *line_color_combo;
77
78         /* Line width */
79         GtkWidget  *line_width_spin;
80
81         /* Prevent recursion */
82         gboolean    stop_signals;
83 };
84
85
86 /*===========================================================================*/
87 /* Private globals                                                           */
88 /*===========================================================================*/
89
90 /*===========================================================================*/
91 /* Local function prototypes                                                 */
92 /*===========================================================================*/
93
94 static void     gl_ui_property_bar_finalize      (GObject              *object);
95
96 static void     gl_ui_property_bar_construct     (glUIPropertyBar      *property_bar);
97
98 static void     selection_changed_cb             (glUIPropertyBar      *property_bar);
99
100 static void     font_family_changed_cb           (GtkComboBox          *combo,
101                                                   glUIPropertyBar      *property_bar);
102
103 static void     font_size_changed_cb             (GtkSpinButton        *spin,
104                                                   glUIPropertyBar      *property_bar);
105
106 static void     text_color_changed_cb            (ColorCombo           *cc,
107                                                   GdkColor             *gdk_color,
108                                                   gboolean              custom,
109                                                   gboolean              by_user,
110                                                   gboolean              is_default,
111                                                   glUIPropertyBar      *property_bar);
112
113 static void     fill_color_changed_cb            (ColorCombo           *cc,
114                                                   GdkColor             *gdk_color,
115                                                   gboolean              custom,
116                                                   gboolean              by_user,
117                                                   gboolean              is_default,
118                                                   glUIPropertyBar      *property_bar);
119
120 static void     line_color_changed_cb            (ColorCombo           *cc,
121                                                   GdkColor             *gdk_color,
122                                                   gboolean              custom,
123                                                   gboolean              by_user,
124                                                   gboolean              is_default,
125                                                   glUIPropertyBar      *property_bar);
126
127 static void     line_width_changed_cb            (GtkSpinButton        *spin,
128                                                   glUIPropertyBar      *property_bar);
129
130 static void     font_bold_toggled_cb             (GtkToggleToolButton  *toggle,
131                                                   glUIPropertyBar      *property_bar);
132                                                   
133 static void     font_italic_toggled_cb           (GtkToggleToolButton  *toggle,
134                                                   glUIPropertyBar      *property_bar);
135                                                   
136 static void     text_align_toggled_cb            (GtkToggleToolButton  *toggle,
137                                                   glUIPropertyBar      *property_bar);
138                                                   
139 static void     set_doc_items_sensitive          (glUIPropertyBar      *property_bar,
140                                                   gboolean              state);
141
142 static void     set_text_items_sensitive         (glUIPropertyBar      *property_bar,
143                                                   gboolean              state);
144
145 static void     set_fill_items_sensitive         (glUIPropertyBar      *property_bar,
146                                                   gboolean              state);
147
148 static void     set_line_color_items_sensitive   (glUIPropertyBar      *property_bar,
149                                                   gboolean              state);
150
151 static void     set_line_width_items_sensitive   (glUIPropertyBar      *property_bar,
152                                                   gboolean              state);
153
154 \f
155 /****************************************************************************/
156 /* Boilerplate Object stuff.                                                */
157 /****************************************************************************/
158 G_DEFINE_TYPE (glUIPropertyBar, gl_ui_property_bar, GTK_TYPE_HBOX);
159
160 static void
161 gl_ui_property_bar_class_init (glUIPropertyBarClass *class)
162 {
163         GObjectClass   *object_class     = G_OBJECT_CLASS (class);
164
165         gl_debug (DEBUG_PROPERTY_BAR, "START");
166
167         gl_ui_property_bar_parent_class = g_type_class_peek_parent (class);
168
169         object_class->finalize = gl_ui_property_bar_finalize;
170
171         gl_debug (DEBUG_PROPERTY_BAR, "END");
172 }
173
174 static void
175 gl_ui_property_bar_init (glUIPropertyBar *property_bar)
176 {
177         gl_debug (DEBUG_PROPERTY_BAR, "START");
178
179         property_bar->priv = g_new0 (glUIPropertyBarPrivate, 1);
180
181         gl_debug (DEBUG_PROPERTY_BAR, "END");
182 }
183
184 static void
185 gl_ui_property_bar_finalize (GObject *object)
186 {
187         glUIPropertyBar *property_bar = GL_UI_PROPERTY_BAR (object);
188
189         gl_debug (DEBUG_PROPERTY_BAR, "START");
190
191         g_return_if_fail (object != NULL);
192         g_return_if_fail (GL_IS_UI_PROPERTY_BAR (object));
193
194         if (property_bar->priv->view)
195         {
196                 g_object_unref (G_OBJECT(property_bar->priv->view));
197         }
198         if (property_bar->priv->gui)
199         {
200                 g_object_unref (G_OBJECT(property_bar->priv->gui));
201         }
202         g_free (property_bar->priv);
203
204         G_OBJECT_CLASS (gl_ui_property_bar_parent_class)->finalize (object);
205
206         gl_debug (DEBUG_PROPERTY_BAR, "END");
207 }
208
209 /****************************************************************************/
210 /* Create a NEW property_bar.                                               */
211 /****************************************************************************/
212 GtkWidget *
213 gl_ui_property_bar_new (void)
214 {
215         glUIPropertyBar *property_bar;
216
217         gl_debug (DEBUG_PROPERTY_BAR, "START");
218
219         property_bar = g_object_new (GL_TYPE_UI_PROPERTY_BAR, NULL);
220
221         gl_ui_property_bar_construct (property_bar);
222
223         gl_debug (DEBUG_PROPERTY_BAR, "END");
224
225         return GTK_WIDGET (property_bar);
226 }
227
228 /******************************************************************************/
229 /* Initialize property toolbar.                                               */
230 /******************************************************************************/
231 static void
232 gl_ui_property_bar_construct (glUIPropertyBar   *property_bar)
233 {
234         GladeXML   *gui;
235         GList      *family_names = NULL;
236         GList      *family_node;
237         GdkColor   *gdk_color;
238
239         gl_debug (DEBUG_PROPERTY_BAR, "START");
240
241         property_bar->priv->stop_signals = TRUE;
242
243         gui = glade_xml_new (GLABELS_GLADE_DIR "property-bar.glade",
244                              "property_toolbar", NULL);
245
246         if (!gui)
247         {
248                 g_critical ("Could not open property-bar.glade. gLabels may not be installed correctly!");
249                 return;
250         }
251
252         property_bar->priv->tool_bar = glade_xml_get_widget (gui, "property_toolbar");
253         gtk_container_add (GTK_CONTAINER (property_bar), property_bar->priv->tool_bar);
254
255         property_bar->priv->font_family_combo =
256                 glade_xml_get_widget (gui, "font_family_combo");
257         property_bar->priv->font_size_spin =
258                 glade_xml_get_widget (gui, "font_size_spin");
259         property_bar->priv->font_bold_toggle =
260                 glade_xml_get_widget (gui, "font_bold_toggle");
261         property_bar->priv->font_italic_toggle =
262                 glade_xml_get_widget (gui, "font_italic_toggle");
263         property_bar->priv->text_align_left_radio =
264                 glade_xml_get_widget (gui, "text_align_left_radio");
265         property_bar->priv->text_align_center_radio =
266                 glade_xml_get_widget (gui, "text_align_center_radio");
267         property_bar->priv->text_align_right_radio =
268                 glade_xml_get_widget (gui, "text_align_right_radio");
269         property_bar->priv->text_color_combo =
270                 glade_xml_get_widget (gui, "text_color_combo");
271         property_bar->priv->fill_color_combo =
272                 glade_xml_get_widget (gui, "fill_color_combo");
273         property_bar->priv->line_color_combo =
274                 glade_xml_get_widget (gui, "line_color_combo");
275         property_bar->priv->line_width_spin =
276                 glade_xml_get_widget (gui, "line_width_spin");
277
278         /* Save reference to gui tree so we don't lose tooltips */
279         property_bar->priv->gui = gui;
280
281         set_doc_items_sensitive (property_bar, FALSE);
282
283         /* Font family entry widget */
284         gl_util_combo_box_add_text_model (GTK_COMBO_BOX (property_bar->priv->font_family_combo));
285         family_names = gl_util_get_font_family_list ();
286         gl_util_combo_box_set_strings (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
287                                        family_names);
288         gtk_widget_set_size_request (property_bar->priv->font_family_combo, 200, -1);
289
290         /* Make sure we have a valid font.  if not provide a good default. */
291         family_node = g_list_find_custom (family_names,
292                                           gl_prefs->default_font_family,
293                                           (GCompareFunc)g_utf8_collate);
294         if (family_node)
295         {
296                 gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
297                                           g_list_position (family_names,
298                                                            family_node));
299         }
300         else
301         {
302                 gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo), 0);
303         }
304
305         g_signal_connect (G_OBJECT (property_bar->priv->font_family_combo),
306                           "changed", G_CALLBACK (font_family_changed_cb), property_bar);
307
308         /* Font size entry widget */
309         gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->font_size_spin),
310                                    gl_prefs->default_font_size);
311
312         g_signal_connect (G_OBJECT (property_bar->priv->font_size_spin),
313                           "changed", G_CALLBACK (font_size_changed_cb), property_bar);
314
315
316         /* Bold and Italic toggles */
317         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
318                                            (gl_prefs->default_font_weight == PANGO_WEIGHT_BOLD));
319         g_signal_connect (G_OBJECT (property_bar->priv->font_bold_toggle),
320                           "toggled", G_CALLBACK (font_bold_toggled_cb), property_bar);
321         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
322                                            gl_prefs->default_font_italic_flag);
323         g_signal_connect (G_OBJECT (property_bar->priv->font_italic_toggle),
324                           "toggled", G_CALLBACK (font_italic_toggled_cb), property_bar);
325
326
327         /* Text alignment radio group */
328         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
329                                            (gl_prefs->default_text_alignment == PANGO_ALIGN_LEFT));
330         g_signal_connect (G_OBJECT (property_bar->priv->text_align_left_radio),
331                           "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
332         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
333                                            (gl_prefs->default_text_alignment == PANGO_ALIGN_CENTER));
334         g_signal_connect (G_OBJECT (property_bar->priv->text_align_center_radio),
335                           "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
336         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
337                                            (gl_prefs->default_text_alignment == PANGO_ALIGN_RIGHT));
338         g_signal_connect (G_OBJECT (property_bar->priv->text_align_right_radio),
339                           "toggled", G_CALLBACK (text_align_toggled_cb), property_bar);
340
341         /* Text color widget */
342         gdk_color = gl_color_to_gdk_color (gl_prefs->default_text_color);
343         color_combo_set_color (COLOR_COMBO (property_bar->priv->text_color_combo), gdk_color);
344         g_free (gdk_color);
345         g_signal_connect (G_OBJECT (property_bar->priv->text_color_combo),
346                           "color_changed",
347                           G_CALLBACK (text_color_changed_cb), property_bar);
348
349         /* Fill color widget */
350         gdk_color = gl_color_to_gdk_color (gl_prefs->default_fill_color);
351         color_combo_set_color (COLOR_COMBO (property_bar->priv->fill_color_combo), gdk_color);
352         g_free (gdk_color);
353         g_signal_connect (G_OBJECT (property_bar->priv->fill_color_combo),
354                           "color_changed",
355                           G_CALLBACK (fill_color_changed_cb), property_bar);
356
357         /* Line color widget */
358         gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
359         color_combo_set_color (COLOR_COMBO (property_bar->priv->line_color_combo), gdk_color);
360         g_free (gdk_color);
361         g_signal_connect (G_OBJECT (property_bar->priv->line_color_combo),
362                           "color_changed",
363                           G_CALLBACK (line_color_changed_cb), property_bar);
364
365         /* Line width entry widget */
366         g_signal_connect (G_OBJECT (property_bar->priv->line_width_spin),
367                           "changed",
368                           G_CALLBACK (line_width_changed_cb), property_bar);
369
370         property_bar->priv->stop_signals = FALSE;
371
372         gl_debug (DEBUG_PROPERTY_BAR, "END");
373 }
374
375 /****************************************************************************/
376 /* Fill widgets with default values.                                        */
377 /****************************************************************************/
378 static void
379 reset_to_default_properties (glView *view,
380                              glUIPropertyBar *property_bar)
381 {
382         GList     *family_names;
383         gchar     *good_font_family;
384         GdkColor  *gdk_color;
385
386         /* Make sure we have a valid font.  if not provide a good default. */
387         family_names = gl_util_get_font_family_list ();
388         if (g_list_find_custom (family_names,
389                                 view->default_font_family,
390                                 (GCompareFunc)g_utf8_collate))
391         {
392                 good_font_family = g_strdup (view->default_font_family);
393         }
394         else
395         {
396                 if (family_names != NULL)
397                 {
398                         good_font_family = g_strdup (family_names->data); /* 1st entry */
399                 }
400                 else
401                 {
402                         good_font_family = NULL;
403                 }
404         }
405         gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
406                                            good_font_family);
407         g_free (good_font_family);
408
409         gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->font_size_spin),
410                                    view->default_font_size);
411
412         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
413                                            (view->default_font_weight == PANGO_WEIGHT_BOLD));
414         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
415                                            view->default_font_italic_flag);
416
417         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
418                                            (view->default_text_alignment == PANGO_ALIGN_LEFT));
419         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
420                                            (view->default_text_alignment == PANGO_ALIGN_CENTER));
421         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
422                                            (view->default_text_alignment == PANGO_ALIGN_RIGHT));
423
424         gdk_color = gl_color_to_gdk_color (view->default_text_color);
425         color_combo_set_color (COLOR_COMBO(property_bar->priv->text_color_combo), gdk_color);
426         g_free (gdk_color);
427
428         gdk_color = gl_color_to_gdk_color (view->default_fill_color);
429         color_combo_set_color (COLOR_COMBO(property_bar->priv->fill_color_combo), gdk_color);
430         g_free (gdk_color);
431
432         gdk_color = gl_color_to_gdk_color (view->default_line_color);
433         color_combo_set_color (COLOR_COMBO(property_bar->priv->line_color_combo), gdk_color);
434         g_free (gdk_color);
435
436         gtk_spin_button_set_value (GTK_SPIN_BUTTON(property_bar->priv->line_width_spin),
437                                    view->default_line_width);
438 }
439
440 /****************************************************************************/
441 /* Set view associated with property_bar.                                   */
442 /****************************************************************************/
443 void
444 gl_ui_property_bar_set_view (glUIPropertyBar *property_bar,
445                              glView          *view)
446 {
447         glLabel   *label;
448
449         gl_debug (DEBUG_PROPERTY_BAR, "START");
450
451         g_return_if_fail (view && GL_IS_VIEW (view));
452         label = view->label;
453         g_return_if_fail (label && GL_IS_LABEL (label));
454
455         set_doc_items_sensitive (property_bar, TRUE);
456
457         property_bar->priv->view = GL_VIEW (g_object_ref (G_OBJECT (view)));
458
459         reset_to_default_properties (view, property_bar);
460
461         g_signal_connect_swapped (G_OBJECT(view), "selection_changed",
462                                   G_CALLBACK(selection_changed_cb), property_bar);
463
464         g_signal_connect_swapped (G_OBJECT(view->label), "changed",
465                                   G_CALLBACK(selection_changed_cb), property_bar);
466
467         gl_debug (DEBUG_PROPERTY_BAR, "END");
468 }
469
470 /****************************************************************************/
471 /** Set visiblity of property bar's tooltips.                               */
472 /****************************************************************************/
473 void
474 gl_ui_property_bar_set_tooltips (glUIPropertyBar *property_bar,
475                                  gboolean         state)
476 {
477         GtkTooltipsData *data;
478
479         gl_debug (DEBUG_PROPERTY_BAR, "START");
480
481         g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR(property_bar));
482
483         /* HACK: peek into one of our widgets to get the tooltips group created by libglade. */
484         data = gtk_tooltips_data_get (property_bar->priv->font_size_spin);
485         g_return_if_fail (data);
486
487         if (state)
488         {
489                 gtk_tooltips_enable (data->tooltips);
490         }
491         else
492         {
493                 gtk_tooltips_disable (data->tooltips);
494         }
495
496         gl_debug (DEBUG_PROPERTY_BAR, "END");
497 }
498
499 /*---------------------------------------------------------------------------*/
500 /* PRIVATE.  View "selection state changed" callback.                        */
501 /*---------------------------------------------------------------------------*/
502 static void
503 update_text_properties (glView *view,
504                         glUIPropertyBar *property_bar)
505 {
506         gboolean        can_text, is_first_object;
507         gboolean        is_same_font_family, is_same_font_size;
508         gboolean        is_same_text_color, is_same_is_italic;
509         gboolean        is_same_is_bold, is_same_align;
510         GList          *p;
511         glLabelObject  *object;
512         gchar          *selection_font_family, *font_family;
513         gdouble         selection_font_size, font_size;
514         guint           selection_text_color, text_color;
515         glColorNode    *text_color_node;
516         gboolean        selection_is_italic, is_italic;
517         gboolean        selection_is_bold, is_bold;
518         PangoAlignment  selection_align, align;
519         GdkColor       *gdk_color;
520
521         can_text = gl_view_can_selection_text (view);
522         set_text_items_sensitive (property_bar, can_text);
523
524         if (!can_text) 
525                 return;
526
527         is_same_is_italic =
528         is_same_is_bold =
529         is_same_align =
530         is_same_text_color =
531         is_same_font_size =
532         is_same_font_family = TRUE;
533         selection_font_family = NULL;
534         selection_font_size = -1;
535         selection_align = PANGO_ALIGN_LEFT;
536         selection_is_italic = TRUE;
537         selection_is_bold = TRUE;
538         selection_text_color = 0;
539         
540         is_first_object = TRUE;
541         
542         for (p = view->selected_object_list; p != NULL; p = p->next)
543         {
544
545                 object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data));
546                 if (!gl_label_object_can_text (object)) 
547                         continue;
548
549                 font_family = gl_label_object_get_font_family (object);
550                 if (font_family != NULL)
551                 {
552                         if (selection_font_family == NULL)
553                         {
554                                 selection_font_family = g_strdup (font_family);
555                         }
556                         else 
557                         {
558                                 if (strcmp (font_family, selection_font_family) != 0)
559                                 {
560                                         is_same_font_family = FALSE;
561                                 }
562                         }
563                         g_free (font_family);
564                 }       
565
566                 font_size = gl_label_object_get_font_size (object);
567                 
568                 text_color_node = gl_label_object_get_text_color (object);
569                 if (text_color_node->field_flag)
570                 {
571                         /* If a merge field is set we use the default color for merged color*/
572                         text_color = GL_COLOR_MERGE_DEFAULT;
573                         
574                 }
575                 else
576                 {
577                         text_color = text_color_node->color;
578                 }
579                 gl_color_node_free (&text_color_node);
580                 
581                 is_italic = gl_label_object_get_font_italic_flag (object);
582                 is_bold = gl_label_object_get_font_weight (object) == PANGO_WEIGHT_BOLD;
583                 align = gl_label_object_get_text_alignment (object);
584
585                 if (is_first_object)
586                 {
587                         selection_font_size = font_size;
588                         selection_text_color = text_color;
589                         selection_is_italic = is_italic;
590                         selection_is_bold = is_bold;
591                         selection_align = align;
592                 }
593                 else
594                 {
595                         if (font_size != selection_font_size) 
596                                 is_same_font_size = FALSE;
597                         if (text_color != selection_text_color)
598                                 is_same_text_color = FALSE;
599                         if (is_italic != selection_is_italic)
600                                 is_same_is_italic = FALSE;
601                         if (is_bold != selection_is_bold)
602                                 is_same_is_bold = FALSE;
603                         if (align != selection_align)
604                                 is_same_align = FALSE;
605                 }
606                 is_first_object = FALSE;
607         }
608
609         if (is_same_font_family && (selection_font_family != NULL)) 
610                 gl_debug (DEBUG_PROPERTY_BAR, "same font family = %s", 
611                           selection_font_family);
612         gl_util_combo_box_set_active_text (GTK_COMBO_BOX (property_bar->priv->font_family_combo),
613                                            is_same_font_family?selection_font_family:"");
614         g_free (selection_font_family);
615
616         if (is_same_font_size)
617         {
618                 gl_debug (DEBUG_PROPERTY_BAR, "same font size = %g", 
619                           selection_font_size);
620                 gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->font_size_spin),
621                                            selection_font_size);
622         }
623         else
624         {
625                 gtk_entry_set_text (GTK_ENTRY (property_bar->priv->font_size_spin), "");
626         }
627
628         if (is_same_text_color)
629         {
630                 gl_debug (DEBUG_PROPERTY_BAR, "same text color = %08x", selection_text_color);
631                 gdk_color = gl_color_to_gdk_color (selection_text_color);
632                 color_combo_set_color (COLOR_COMBO (property_bar->priv->text_color_combo),
633                                        gdk_color);
634                 g_free (gdk_color);
635         }
636
637         if (is_same_is_italic)
638         {
639                 gl_debug (DEBUG_PROPERTY_BAR, "same italic flag = %d", 
640                           selection_is_italic);
641         }
642         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle),
643                                            selection_is_italic && is_same_is_italic);
644
645         if (is_same_is_bold)
646         {
647                 gl_debug (DEBUG_PROPERTY_BAR, "same bold flag = %d",
648                           selection_is_bold);
649         }
650         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle),
651                                            selection_is_bold && is_same_is_bold);
652
653         if (is_same_align) 
654                 gl_debug (DEBUG_PROPERTY_BAR, "same align");
655         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio),
656                                            (selection_align == PANGO_ALIGN_LEFT) &&
657                                            is_same_align);
658         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio),
659                                            (selection_align == PANGO_ALIGN_CENTER) &&
660                                            is_same_align);
661         gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio),
662                                            (selection_align == PANGO_ALIGN_RIGHT) &&
663                                            is_same_align);
664 }
665
666 static void
667 update_fill_color (glView *view,
668                    glUIPropertyBar *property_bar)
669 {
670         gboolean can, is_first_object;
671         gboolean is_same_fill_color;
672         GList *p;
673         glLabelObject *object;
674         guint selection_fill_color, fill_color;
675         GdkColor *gdk_color;
676         glColorNode *fill_color_node;
677
678         can = gl_view_can_selection_fill (view);
679         set_fill_items_sensitive (property_bar, can);
680
681         if (!can) 
682                 return;
683
684         is_same_fill_color = TRUE;
685         is_first_object = TRUE;
686         selection_fill_color = 0;
687         
688         for (p = view->selected_object_list; p != NULL; p = p->next)
689         {
690
691                 object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data));
692                 if (!gl_label_object_can_fill (object)) 
693                         continue;
694
695                 fill_color_node = gl_label_object_get_fill_color (object);
696                 if (fill_color_node->field_flag)
697                 {
698                         /* If a merge field is set we use the default color for merged color*/
699                         fill_color = GL_COLOR_FILL_MERGE_DEFAULT;
700                         
701                 }
702                 else
703                 {
704                         fill_color = fill_color_node->color;
705                 }
706                 gl_color_node_free (&fill_color_node);
707
708                 if (is_first_object)
709                 {
710                         selection_fill_color = fill_color;
711                 }
712                 else
713                 {
714                         if (fill_color != selection_fill_color)
715                         {
716                                 is_same_fill_color = FALSE;
717                         }
718                 }
719                 is_first_object = FALSE;
720         }
721
722         if (is_same_fill_color)
723         {
724                 gl_debug (DEBUG_PROPERTY_BAR, "same fill color = %08x", selection_fill_color);
725                 gdk_color = gl_color_to_gdk_color (selection_fill_color);
726                 color_combo_set_color (COLOR_COMBO (property_bar->priv->fill_color_combo),
727                                        gdk_color);
728                 g_free (gdk_color);
729         }
730 }
731
732 static void
733 update_line_color (glView *view,
734                    glUIPropertyBar *property_bar)
735 {
736         gboolean can, is_first_object;
737         gboolean is_same_line_color;
738         GList *p;
739         glLabelObject *object;
740         guint selection_line_color, line_color;
741         glColorNode *line_color_node;
742         GdkColor *gdk_color;
743
744         can = gl_view_can_selection_line_color (view);
745         set_line_color_items_sensitive (property_bar, can);
746
747         if (!can) 
748                 return;
749
750         is_same_line_color = TRUE;
751         is_first_object = TRUE;
752         selection_line_color = 0;
753         
754         for (p = view->selected_object_list; p != NULL; p = p->next)
755         {
756
757                 object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data));
758                 if (!gl_label_object_can_line_color (object)) 
759                         continue;
760
761                 line_color_node = gl_label_object_get_line_color (object);
762                 if (line_color_node->field_flag)
763                 {
764                         /* If a merge field is set we use the default color for merged color*/
765                         line_color = GL_COLOR_MERGE_DEFAULT;
766                         
767                 }
768                 else
769                 {
770                         line_color = line_color_node->color;
771                 }
772                 gl_color_node_free (&line_color_node);
773
774                 if (is_first_object)
775                 {
776                         selection_line_color = line_color;
777                 }
778                 else
779                 {
780                         if (line_color != selection_line_color)
781                         {
782                                 is_same_line_color = FALSE;
783                         }
784                 }
785                 is_first_object = FALSE;
786         }
787
788         if (is_same_line_color)
789         {
790                 gl_debug (DEBUG_PROPERTY_BAR, "same line color = %08x", selection_line_color);
791                 gdk_color = gl_color_to_gdk_color (selection_line_color);
792                 color_combo_set_color (COLOR_COMBO (property_bar->priv->line_color_combo),
793                                        gdk_color);
794                 g_free (gdk_color);
795         }
796 }
797
798 static void
799 update_line_width (glView *view,
800                    glUIPropertyBar *property_bar)
801 {
802         gboolean can, is_first_object;
803         gboolean is_same_line_width;
804         GList *p;
805         glLabelObject *object;
806         gdouble selection_line_width, line_width;
807
808         can = gl_view_can_selection_line_width (view);
809         set_line_width_items_sensitive (property_bar, can);
810
811         if (!can) 
812                 return;
813
814         is_same_line_width = TRUE;
815         is_first_object = TRUE;
816         selection_line_width = 0;
817         
818         for (p = view->selected_object_list; p != NULL; p = p->next)
819         {
820
821                 object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data));
822                 if (!gl_label_object_can_line_width (object)) 
823                         continue;
824
825                 line_width = gl_label_object_get_line_width (object);
826
827                 if (is_first_object)
828                 {
829                         selection_line_width = line_width;
830                 }
831                 else
832                 {
833                         if (line_width != selection_line_width)
834                         {
835                                 is_same_line_width = FALSE;
836                         }
837                 }
838                 is_first_object = FALSE;
839         }
840
841         if (is_same_line_width)
842         {
843                 gl_debug (DEBUG_PROPERTY_BAR, "same line width = %g", selection_line_width);
844                 gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->line_width_spin),
845                                            selection_line_width);
846         }
847         else
848         {
849                 gtk_entry_set_text (GTK_ENTRY (property_bar->priv->line_width_spin), "");
850         }
851 }
852
853 static void 
854 selection_changed_cb (glUIPropertyBar *property_bar)
855 {
856         glView *view = property_bar->priv->view;
857         
858         g_return_if_fail (view && GL_IS_VIEW (view));
859         g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
860
861         if (property_bar->priv->stop_signals) return;
862         property_bar->priv->stop_signals = TRUE;
863
864         gl_debug (DEBUG_PROPERTY_BAR, "START");
865
866         if (gl_view_is_selection_empty (view))
867         {
868                 /* No selection: make all controls active. */
869                 reset_to_default_properties (view, property_bar);
870                 set_doc_items_sensitive (property_bar, TRUE);
871         }
872         else
873         {
874                 update_text_properties (view, property_bar);
875                 update_fill_color (view, property_bar);
876                 update_line_color (view, property_bar);
877                 update_line_width (view, property_bar);
878         }
879
880         gl_debug (DEBUG_PROPERTY_BAR, "END");
881
882         property_bar->priv->stop_signals = FALSE;
883 }
884
885 /*--------------------------------------------------------------------------*/
886 /* PRIVATE.  Font family entry changed.                                     */
887 /*--------------------------------------------------------------------------*/
888 static void
889 font_family_changed_cb (GtkComboBox     *combo,
890                         glUIPropertyBar *property_bar)
891 {
892         gchar *font_family;
893
894         if (property_bar->priv->stop_signals) return;
895         property_bar->priv->stop_signals = TRUE;
896
897         gl_debug (DEBUG_PROPERTY_BAR, "START");
898
899         font_family = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo));
900         if ( strlen(font_family) )
901         {
902                 gl_view_set_selection_font_family (property_bar->priv->view,
903                                                    font_family);
904                 gl_view_set_default_font_family   (property_bar->priv->view,
905                                                    font_family);
906         }
907         g_free (font_family);
908
909         gl_debug (DEBUG_PROPERTY_BAR, "END");
910
911         property_bar->priv->stop_signals = FALSE;
912 }
913
914 /*--------------------------------------------------------------------------*/
915 /* PRIVATE.  Font size spin button changed.                                 */
916 /*--------------------------------------------------------------------------*/
917 static void
918 font_size_changed_cb (GtkSpinButton        *spin,
919                       glUIPropertyBar      *property_bar)
920 {
921         gdouble font_size;
922
923         if (property_bar->priv->stop_signals) return;
924         property_bar->priv->stop_signals = TRUE;
925
926         gl_debug (DEBUG_PROPERTY_BAR, "START");
927
928         font_size = gtk_spin_button_get_value (spin);
929
930         gl_view_set_selection_font_size (property_bar->priv->view,
931                                          font_size);
932         gl_view_set_default_font_size   (property_bar->priv->view,
933                                          font_size);
934
935         gl_debug (DEBUG_PROPERTY_BAR, "END");
936
937         property_bar->priv->stop_signals = FALSE;
938 }
939
940 /*--------------------------------------------------------------------------*/
941 /* PRIVATE.  Text color combo changed.                                      */
942 /*--------------------------------------------------------------------------*/
943 static void
944 text_color_changed_cb (ColorCombo           *cc,
945                        GdkColor             *gdk_color,
946                        gboolean              custom,
947                        gboolean              by_user,
948                        gboolean              is_default,
949                        glUIPropertyBar      *property_bar)
950 {
951         glColorNode *text_color_node;
952
953         g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
954
955         if (property_bar->priv->stop_signals) return;
956         property_bar->priv->stop_signals = TRUE;
957
958         gl_debug (DEBUG_PROPERTY_BAR, "START");
959
960         text_color_node = gl_color_node_new_default ();
961         text_color_node->color = gl_color_from_gdk_color (gdk_color);
962         
963         gl_debug (DEBUG_PROPERTY_BAR, "Color=%08x, Custom=%d, By_User=%d, Is_default=%d",
964                   text_color_node->color, custom, by_user, is_default);
965
966         if (is_default)
967         {
968                 text_color_node->color = gl_prefs->default_text_color;
969                 gl_view_set_selection_text_color (property_bar->priv->view,
970                                                   text_color_node);
971                 gl_view_set_default_text_color   (property_bar->priv->view,
972                                                   gl_prefs->default_text_color);
973         }
974         else
975         {
976                 gl_view_set_selection_text_color (property_bar->priv->view,
977                                                   text_color_node);
978                 gl_view_set_default_text_color   (property_bar->priv->view,
979                                                   text_color_node->color);
980         }
981
982         gl_color_node_free (&text_color_node);
983         
984         gl_debug (DEBUG_PROPERTY_BAR, "END");
985
986         property_bar->priv->stop_signals = FALSE;
987 }
988
989 /*--------------------------------------------------------------------------*/
990 /* PRIVATE.  Fill color combo changed.                                      */
991 /*--------------------------------------------------------------------------*/
992 static void
993 fill_color_changed_cb (ColorCombo           *cc,
994                        GdkColor             *gdk_color,
995                        gboolean              custom,
996                        gboolean              by_user,
997                        gboolean              is_default,
998                        glUIPropertyBar      *property_bar)
999 {
1000         glColorNode *fill_color_node;
1001
1002         g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
1003
1004         if (property_bar->priv->stop_signals) return;
1005         property_bar->priv->stop_signals = TRUE;
1006
1007         gl_debug (DEBUG_PROPERTY_BAR, "START");
1008
1009         fill_color_node = gl_color_node_new_default ();
1010
1011         fill_color_node->color = gl_color_from_gdk_color (gdk_color);
1012
1013         gl_debug (DEBUG_PROPERTY_BAR, "Color=%08x, Custom=%d, By_User=%d, Is_default=%d",
1014                   fill_color_node->color, custom, by_user, is_default);
1015
1016         if (is_default)
1017         {
1018
1019                 fill_color_node->color = GL_COLOR_NONE;
1020                 gl_view_set_selection_fill_color (property_bar->priv->view,
1021                                                   fill_color_node);
1022                 gl_view_set_default_fill_color   (property_bar->priv->view,
1023                                                   fill_color_node->color);
1024         }
1025         else
1026         {
1027                 gl_view_set_selection_fill_color (property_bar->priv->view,
1028                                                   fill_color_node);
1029                 gl_view_set_default_fill_color   (property_bar->priv->view,
1030                                                   fill_color_node->color);
1031         }
1032         gl_color_node_free (&fill_color_node);
1033         
1034         gl_debug (DEBUG_PROPERTY_BAR, "END");
1035
1036         property_bar->priv->stop_signals = FALSE;
1037 }
1038
1039 /*--------------------------------------------------------------------------*/
1040 /* PRIVATE.  Line color combo changed.                                      */
1041 /*--------------------------------------------------------------------------*/
1042 static void
1043 line_color_changed_cb (ColorCombo           *cc,
1044                        GdkColor             *gdk_color,
1045                        gboolean              custom,
1046                        gboolean              by_user,
1047                        gboolean              is_default,
1048                        glUIPropertyBar      *property_bar)
1049 {
1050         glColorNode *line_color_node;
1051
1052         g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar));
1053
1054         if (property_bar->priv->stop_signals) return;
1055         property_bar->priv->stop_signals = TRUE;
1056
1057         gl_debug (DEBUG_PROPERTY_BAR, "START");
1058
1059         line_color_node = gl_color_node_new_default ();
1060         line_color_node->color = gl_color_from_gdk_color (gdk_color);
1061
1062         gl_debug (DEBUG_PROPERTY_BAR, "Color=%08x, Custom=%d, By_User=%d, Is_default=%d",
1063                   line_color_node->color, custom, by_user, is_default);
1064
1065         if (is_default)
1066         {
1067                 line_color_node->color = GL_COLOR_NONE;
1068                 gl_view_set_selection_line_color (property_bar->priv->view,
1069                                                   line_color_node);
1070                 gl_view_set_default_line_color   (property_bar->priv->view,
1071                                                   line_color_node->color);
1072         }
1073         else
1074         {
1075                 gl_view_set_selection_line_color (property_bar->priv->view,
1076                                                   line_color_node);
1077                 gl_view_set_default_line_color   (property_bar->priv->view,
1078                                                   line_color_node->color);
1079         }
1080         gl_color_node_free (&line_color_node);
1081
1082         gl_debug (DEBUG_PROPERTY_BAR, "END");
1083
1084         property_bar->priv->stop_signals = FALSE;
1085 }
1086
1087 /*--------------------------------------------------------------------------*/
1088 /* PRIVATE.  Line width spin button changed.                                */
1089 /*--------------------------------------------------------------------------*/
1090 static void
1091 line_width_changed_cb (GtkSpinButton        *spin,
1092                        glUIPropertyBar      *property_bar)
1093 {
1094         gdouble line_width;
1095
1096         if (property_bar->priv->stop_signals) return;
1097         property_bar->priv->stop_signals = TRUE;
1098
1099         gl_debug (DEBUG_PROPERTY_BAR, "START");
1100
1101         if (property_bar->priv->view)
1102         {
1103                 line_width = gtk_spin_button_get_value (spin);
1104
1105                 gl_view_set_selection_line_width (property_bar->priv->view,
1106                                                   line_width);
1107                 gl_view_set_default_line_width   (property_bar->priv->view,
1108                                                   line_width);
1109         }
1110
1111         gl_debug (DEBUG_PROPERTY_BAR, "END");
1112
1113         property_bar->priv->stop_signals = FALSE;
1114 }
1115
1116 /*---------------------------------------------------------------------------*/
1117 /* PRIVATE.  Font bold toggled callback.                                     */
1118 /*---------------------------------------------------------------------------*/
1119 static void
1120 font_bold_toggled_cb (GtkToggleToolButton  *toggle,
1121                       glUIPropertyBar      *property_bar)
1122 {
1123         gboolean        state;
1124         PangoWeight     weight;
1125
1126
1127         if (property_bar->priv->stop_signals) return;
1128         property_bar->priv->stop_signals = TRUE;
1129
1130         gl_debug (DEBUG_PROPERTY_BAR, "START");
1131
1132         state = gtk_toggle_tool_button_get_active (toggle);
1133
1134         weight = state ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL;
1135
1136         gl_view_set_selection_font_weight (property_bar->priv->view, weight);
1137         gl_view_set_default_font_weight   (property_bar->priv->view, weight);
1138
1139         gl_debug (DEBUG_PROPERTY_BAR, "END");
1140
1141         property_bar->priv->stop_signals = FALSE;
1142 }
1143                                                   
1144 /*---------------------------------------------------------------------------*/
1145 /* PRIVATE.  Font italic toggled callback.                                   */
1146 /*---------------------------------------------------------------------------*/
1147 static void
1148 font_italic_toggled_cb (GtkToggleToolButton  *toggle,
1149                         glUIPropertyBar      *property_bar)
1150 {
1151         gboolean state;
1152
1153         if (property_bar->priv->stop_signals) return;
1154         property_bar->priv->stop_signals = TRUE;
1155
1156         gl_debug (DEBUG_PROPERTY_BAR, "START");
1157
1158         state = gtk_toggle_tool_button_get_active (toggle);
1159
1160         gl_view_set_selection_font_italic_flag (property_bar->priv->view, state);
1161         gl_view_set_default_font_italic_flag   (property_bar->priv->view, state);
1162
1163         gl_debug (DEBUG_PROPERTY_BAR, "END");
1164
1165         property_bar->priv->stop_signals = FALSE;
1166 }
1167                                                   
1168 /*---------------------------------------------------------------------------*/
1169 /* PRIVATE.  Text align toggled callback.                                    */
1170 /*---------------------------------------------------------------------------*/
1171 static void
1172 text_align_toggled_cb (GtkToggleToolButton  *toggle,
1173                        glUIPropertyBar      *property_bar)
1174 {
1175         if (property_bar->priv->stop_signals) return;
1176         property_bar->priv->stop_signals = TRUE;
1177
1178         gl_debug (DEBUG_PROPERTY_BAR, "START");
1179
1180         if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio)))
1181         {               
1182                 gl_view_set_selection_text_alignment (property_bar->priv->view,
1183                                                       PANGO_ALIGN_LEFT);
1184                 gl_view_set_default_text_alignment   (property_bar->priv->view,
1185                                                       PANGO_ALIGN_LEFT);
1186         }
1187
1188         if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_center_radio)))
1189         {               
1190                 gl_view_set_selection_text_alignment (property_bar->priv->view,
1191                                                       PANGO_ALIGN_CENTER);
1192                 gl_view_set_default_text_alignment   (property_bar->priv->view,
1193                                                       PANGO_ALIGN_CENTER);
1194         }
1195
1196         if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_right_radio)))
1197         {
1198                 gl_view_set_selection_text_alignment (property_bar->priv->view,
1199                                                       PANGO_ALIGN_RIGHT);
1200                 gl_view_set_default_text_alignment   (property_bar->priv->view,
1201                                                       PANGO_ALIGN_RIGHT);
1202         }
1203
1204         gl_debug (DEBUG_PROPERTY_BAR, "END");
1205
1206         property_bar->priv->stop_signals = FALSE;
1207 }
1208
1209
1210 /*****************************************************************************/
1211 /* Construct color combo "Custom widget".                                    */
1212 /*****************************************************************************/
1213 GtkWidget *
1214 gl_ui_property_bar_construct_color_combo (gchar *name,
1215                                           gchar *string1,
1216                                           gchar *string2,
1217                                           gint   int1,
1218                                           gint   int2)
1219 {
1220         GtkWidget  *color_combo;
1221         ColorGroup *cg;
1222         gchar      *cg_name;
1223         GdkColor   *gdk_color;
1224         gchar      *no_color;
1225         GdkPixbuf  *pixbuf = NULL;
1226
1227         switch (int1) {
1228
1229         case 0:
1230                 cg_name  = "text_color_group";
1231                 gdk_color = gl_color_to_gdk_color (gl_prefs->default_text_color);
1232                 no_color = _("Default");
1233                 pixbuf = gdk_pixbuf_new_from_inline (-1, stock_text_24, FALSE, NULL);
1234                 break;
1235
1236         case 2:
1237                 cg_name  = "line_color_group";
1238                 gdk_color = NULL;
1239                 no_color = _("No line");
1240                 pixbuf = gdk_pixbuf_new_from_inline (-1, stock_pencil_24, FALSE, NULL);
1241                 break;
1242
1243         case 1:
1244         default:
1245                 cg_name  = "fill_color_group";
1246                 gdk_color = NULL;
1247                 no_color = _("No fill");
1248                 pixbuf = gdk_pixbuf_new_from_inline (-1, stock_bucket_fill_24, FALSE, NULL);
1249                 break;
1250
1251         }
1252
1253         cg = color_group_fetch (cg_name, NULL);
1254         color_combo = color_combo_new (pixbuf, no_color, gdk_color, cg);
1255         g_free (gdk_color);
1256
1257         color_combo_box_set_preview_relief (COLOR_COMBO(color_combo), GTK_RELIEF_NORMAL);
1258
1259         g_object_unref (G_OBJECT (pixbuf));
1260
1261         return color_combo;
1262 }
1263
1264 /*---------------------------------------------------------------------------*/
1265 /* PRIVATE.  Set sensitivity of doc controls.                                */
1266 /*---------------------------------------------------------------------------*/
1267 static void
1268 set_doc_items_sensitive (glUIPropertyBar      *property_bar,
1269                          gboolean              state)
1270 {
1271         gtk_widget_set_sensitive (property_bar->priv->font_family_combo,       state);
1272         gtk_widget_set_sensitive (property_bar->priv->font_size_spin,          state);
1273         gtk_widget_set_sensitive (property_bar->priv->font_bold_toggle,        state);
1274         gtk_widget_set_sensitive (property_bar->priv->font_italic_toggle,      state);
1275         gtk_widget_set_sensitive (property_bar->priv->text_align_left_radio,   state);
1276         gtk_widget_set_sensitive (property_bar->priv->text_align_center_radio, state);
1277         gtk_widget_set_sensitive (property_bar->priv->text_align_right_radio,  state);
1278         gtk_widget_set_sensitive (property_bar->priv->text_color_combo,        state);
1279         gtk_widget_set_sensitive (property_bar->priv->fill_color_combo,        state);
1280         gtk_widget_set_sensitive (property_bar->priv->line_color_combo,        state);
1281         gtk_widget_set_sensitive (property_bar->priv->line_width_spin,         state);
1282 }
1283
1284 /*---------------------------------------------------------------------------*/
1285 /* PRIVATE.  Set sensitivity of text related controls.                       */
1286 /*---------------------------------------------------------------------------*/
1287 static void
1288 set_text_items_sensitive (glUIPropertyBar      *property_bar,
1289                           gboolean              state)
1290 {
1291         gtk_widget_set_sensitive (property_bar->priv->font_family_combo,       state);
1292         gtk_widget_set_sensitive (property_bar->priv->font_size_spin,          state);
1293         gtk_widget_set_sensitive (property_bar->priv->font_bold_toggle,        state);
1294         gtk_widget_set_sensitive (property_bar->priv->font_italic_toggle,      state);
1295         gtk_widget_set_sensitive (property_bar->priv->text_align_left_radio,   state);
1296         gtk_widget_set_sensitive (property_bar->priv->text_align_center_radio, state);
1297         gtk_widget_set_sensitive (property_bar->priv->text_align_right_radio,  state);
1298         gtk_widget_set_sensitive (property_bar->priv->text_color_combo,        state);
1299 }
1300
1301 /*---------------------------------------------------------------------------*/
1302 /* PRIVATE.  Set sensitivity of fill related controls.                       */
1303 /*---------------------------------------------------------------------------*/
1304 static void
1305 set_fill_items_sensitive (glUIPropertyBar      *property_bar,
1306                           gboolean              state)
1307 {
1308         gtk_widget_set_sensitive (property_bar->priv->fill_color_combo,        state);
1309 }
1310
1311 /*---------------------------------------------------------------------------*/
1312 /* PRIVATE.  Set sensitivity of line color related controls.                 */
1313 /*---------------------------------------------------------------------------*/
1314 static void
1315 set_line_color_items_sensitive (glUIPropertyBar      *property_bar,
1316                                 gboolean              state)
1317 {
1318         gtk_widget_set_sensitive (property_bar->priv->line_color_combo,        state);
1319 }
1320
1321 /*---------------------------------------------------------------------------*/
1322 /* PRIVATE.  Set sensitivity of line width related controls.                 */
1323 /*---------------------------------------------------------------------------*/
1324 static void
1325 set_line_width_items_sensitive (glUIPropertyBar      *property_bar,
1326                                 gboolean              state)
1327 {
1328         gtk_widget_set_sensitive (property_bar->priv->line_width_spin,         state);
1329 }
1330
1331