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