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