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