]> git.sur5r.net Git - glabels/blob - src/object-editor-text-page.c
[l10n] Updated German translation
[glabels] / src / object-editor-text-page.c
1 /*
2  *  object-editor-text-page.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 "object-editor.h"
24
25 #include <glib/gi18n.h>
26 #include <gtk/gtk.h>
27 #include <math.h>
28
29 #include "prefs.h"
30 #include "color-combo.h"
31 #include "color.h"
32 #include "font-combo.h"
33 #include "font-util.h"
34 #include "field-button.h"
35 #include "builder-util.h"
36
37 #include "object-editor-private.h"
38
39 #include "debug.h"
40
41
42 /*===========================================*/
43 /* Private macros                            */
44 /*===========================================*/
45
46
47 /*===========================================*/
48 /* Private data types                        */
49 /*===========================================*/
50
51
52 /*===========================================*/
53 /* Private globals                           */
54 /*===========================================*/
55
56
57 /*===========================================*/
58 /* Local function prototypes                 */
59 /*===========================================*/
60
61 static void align_toggle_cb (GtkToggleButton *toggle,
62                              glObjectEditor  *editor);
63 static void text_radio_toggled_cb              (glObjectEditor        *editor);
64
65
66 /*--------------------------------------------------------------------------*/
67 /* PRIVATE.  Prepare size page.                                             */
68 /*--------------------------------------------------------------------------*/
69 void
70 gl_object_editor_prepare_text_page (glObjectEditor       *editor)
71 {
72         gl_debug (DEBUG_EDITOR, "START");
73
74         /* Extract widgets from XML tree. */
75         gl_builder_util_get_widgets (editor->priv->builder,
76                                      "text_page_vbox",         &editor->priv->text_page_vbox,
77                                      "text_family_hbox",       &editor->priv->text_family_hbox,
78                                      "text_size_spin",         &editor->priv->text_size_spin,
79                                      "text_bold_toggle",       &editor->priv->text_bold_toggle,
80                                      "text_italic_toggle",     &editor->priv->text_italic_toggle,
81                                      "text_color_hbox",        &editor->priv->text_color_hbox,
82                                      "text_color_radio",       &editor->priv->text_color_radio,
83                                      "text_color_key_radio",   &editor->priv->text_color_key_radio,
84                                      "text_color_key_hbox",    &editor->priv->text_color_key_hbox,
85                                      "text_left_toggle",       &editor->priv->text_left_toggle,
86                                      "text_center_toggle",     &editor->priv->text_center_toggle,
87                                      "text_right_toggle",      &editor->priv->text_right_toggle,
88                                      "text_line_spacing_spin", &editor->priv->text_line_spacing_spin,
89                                      "text_auto_shrink_check", &editor->priv->text_auto_shrink_check,
90                                      NULL);
91
92         editor->priv->text_family_combo = gl_font_combo_new ("Sans");
93         gtk_box_pack_start (GTK_BOX (editor->priv->text_family_hbox),
94                             editor->priv->text_family_combo,
95                             TRUE, TRUE, 0);
96
97         editor->priv->text_color_combo = gl_color_combo_new (_("Default"),
98                                                              GL_COLOR_TEXT_DEFAULT,
99                                                              gl_prefs_model_get_default_text_color (gl_prefs));
100         gtk_box_pack_start (GTK_BOX (editor->priv->text_color_hbox),
101                             editor->priv->text_color_combo,
102                             FALSE, FALSE, 0);
103
104         editor->priv->text_color_key_combo = gl_field_button_new (NULL);
105         gtk_box_pack_start (GTK_BOX (editor->priv->text_color_key_hbox),
106                             editor->priv->text_color_key_combo,
107                             TRUE, TRUE, 0);
108
109
110         /* Modify widgets */
111         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE);
112         gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE);
113         gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE);
114
115         /* Un-hide */
116         gtk_widget_show_all (editor->priv->text_page_vbox);
117
118         /* Connect signals */
119         g_signal_connect_swapped (G_OBJECT (editor->priv->text_family_combo),
120                                   "changed",
121                                   G_CALLBACK (gl_object_editor_changed_cb),
122                                   G_OBJECT (editor));
123         g_signal_connect_swapped (G_OBJECT (editor->priv->text_size_spin),
124                                   "value-changed",
125                                   G_CALLBACK (gl_object_editor_changed_cb),
126                                   G_OBJECT (editor));
127         g_signal_connect_swapped (G_OBJECT (editor->priv->text_bold_toggle),
128                                   "toggled",
129                                   G_CALLBACK (gl_object_editor_changed_cb),
130                                   G_OBJECT (editor));
131         g_signal_connect_swapped (G_OBJECT (editor->priv->text_italic_toggle),
132                                   "toggled",
133                                   G_CALLBACK (gl_object_editor_changed_cb),
134                                   G_OBJECT (editor));
135         g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_combo),
136                                   "color_changed",
137                                   G_CALLBACK (gl_object_editor_changed_cb),
138                                   G_OBJECT (editor));
139         g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_key_combo),
140                                   "changed",
141                                   G_CALLBACK (gl_object_editor_changed_cb),
142                                   G_OBJECT (editor));
143         g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_radio),
144                                   "toggled",
145                                   G_CALLBACK (text_radio_toggled_cb),
146                                   G_OBJECT (editor));                             
147         g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_key_radio),
148                                   "toggled",
149                                   G_CALLBACK (text_radio_toggled_cb),
150                                   G_OBJECT (editor));
151
152         g_signal_connect (G_OBJECT (editor->priv->text_left_toggle),
153                           "toggled",
154                           G_CALLBACK (align_toggle_cb),
155                           G_OBJECT (editor));
156         g_signal_connect (G_OBJECT (editor->priv->text_center_toggle),
157                           "toggled",
158                           G_CALLBACK (align_toggle_cb),
159                           G_OBJECT (editor));
160         g_signal_connect (G_OBJECT (editor->priv->text_right_toggle),
161                           "toggled",
162                           G_CALLBACK (align_toggle_cb),
163                           G_OBJECT (editor));
164
165         g_signal_connect_swapped (G_OBJECT (editor->priv->text_line_spacing_spin),
166                                   "value-changed",
167                                   G_CALLBACK (gl_object_editor_changed_cb),
168                                   G_OBJECT (editor));
169
170         g_signal_connect_swapped (G_OBJECT (editor->priv->text_auto_shrink_check),
171                                   "toggled",
172                                   G_CALLBACK (gl_object_editor_changed_cb),
173                                   G_OBJECT (editor));
174
175         gl_debug (DEBUG_EDITOR, "END");
176 }
177
178
179 /*--------------------------------------------------------------------------*/
180 /* PRIVATE.  Alignment togglebutton callback.                               */
181 /*--------------------------------------------------------------------------*/
182 static void
183 align_toggle_cb (GtkToggleButton *toggle,
184                  glObjectEditor  *editor)
185 {
186         if (gtk_toggle_button_get_active (toggle)) {
187  
188                 if (GTK_WIDGET (toggle) == GTK_WIDGET (editor->priv->text_left_toggle)) {
189                         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
190                                                       (editor->priv->text_center_toggle),
191                                                       FALSE);
192                         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
193                                                       (editor->priv->text_right_toggle),
194                                                       FALSE);
195                 } else if (GTK_WIDGET (toggle) ==
196                            GTK_WIDGET (editor->priv->text_center_toggle)) {
197                         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
198                                                       (editor->priv->text_left_toggle),
199                                                       FALSE);
200                         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
201                                                       (editor->priv->text_right_toggle),
202                                                       FALSE);
203                 } else if (GTK_WIDGET (toggle) ==
204                            GTK_WIDGET (editor->priv->text_right_toggle)) {
205                         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
206                                                       (editor->priv->text_left_toggle),
207                                                       FALSE);
208                         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
209                                                       (editor->priv->text_center_toggle),
210                                                       FALSE);
211                 }
212
213                 gl_object_editor_changed_cb (editor);
214         }
215
216 }
217
218
219 /*****************************************************************************/
220 /* Set font family.                                                          */
221 /*****************************************************************************/
222 void
223 gl_object_editor_set_font_family (glObjectEditor      *editor,
224                                   const gchar         *font_family)
225 {
226         gchar    *old_font_family;
227
228         if (font_family == NULL)
229         {
230                 return;
231         }
232
233         gl_debug (DEBUG_EDITOR, "START");
234
235
236         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_family_combo),
237                                          gl_object_editor_changed_cb, editor);
238
239
240         old_font_family = gl_font_combo_get_family (GL_FONT_COMBO (editor->priv->text_family_combo));
241
242         if ( !old_font_family || g_utf8_collate( old_font_family, font_family ) )
243         {
244                 gl_font_combo_set_family (GL_FONT_COMBO (editor->priv->text_family_combo),
245                                           font_family);
246         }
247
248         g_free (old_font_family);
249
250
251         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_family_combo),
252                                            gl_object_editor_changed_cb, editor);
253
254
255         gl_debug (DEBUG_EDITOR, "END");
256 }
257
258
259 /*****************************************************************************/
260 /* Query font family.                                                        */
261 /*****************************************************************************/
262 gchar *
263 gl_object_editor_get_font_family (glObjectEditor      *editor)
264 {
265         gchar *font_family;
266
267         gl_debug (DEBUG_EDITOR, "START");
268
269         font_family = gl_font_combo_get_family (GL_FONT_COMBO (editor->priv->text_family_combo));
270
271         gl_debug (DEBUG_EDITOR, "END");
272
273         return font_family;
274 }
275
276
277 /*****************************************************************************/
278 /* Set font size.                                                            */
279 /*****************************************************************************/
280 void
281 gl_object_editor_set_font_size (glObjectEditor      *editor,
282                                 gdouble              font_size)
283 {
284         gl_debug (DEBUG_EDITOR, "START");
285
286
287         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_size_spin),
288                                          gl_object_editor_changed_cb, editor);
289
290
291         gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->text_size_spin),
292                                    font_size);
293
294
295         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_size_spin),
296                                            gl_object_editor_changed_cb, editor);
297
298
299         gl_debug (DEBUG_EDITOR, "END");
300 }
301
302
303 /*****************************************************************************/
304 /* Query font size.                                                          */
305 /*****************************************************************************/
306 gdouble
307 gl_object_editor_get_font_size (glObjectEditor      *editor)
308 {
309         gdouble font_size;
310
311         gl_debug (DEBUG_EDITOR, "START");
312
313         font_size =
314                 gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->text_size_spin));
315
316         gl_debug (DEBUG_EDITOR, "END");
317
318         return font_size;
319 }
320
321
322 /*****************************************************************************/
323 /* Set font weight.                                                          */
324 /*****************************************************************************/
325 void
326 gl_object_editor_set_font_weight (glObjectEditor      *editor,
327                                   PangoWeight          font_weight)
328 {
329         gl_debug (DEBUG_EDITOR, "START");
330
331
332         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_bold_toggle),
333                                          gl_object_editor_changed_cb, editor);
334
335
336         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle),
337                                       (font_weight == PANGO_WEIGHT_BOLD));
338
339
340         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_bold_toggle),
341                                            gl_object_editor_changed_cb, editor);
342
343
344         gl_debug (DEBUG_EDITOR, "END");
345 }
346
347
348 /*****************************************************************************/
349 /* Query font weight.                                                        */
350 /*****************************************************************************/
351 PangoWeight
352 gl_object_editor_get_font_weight (glObjectEditor      *editor)
353 {
354         PangoWeight font_weight;
355
356         gl_debug (DEBUG_EDITOR, "START");
357
358         if (gtk_toggle_button_get_active
359             (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle))) {
360                 font_weight = PANGO_WEIGHT_BOLD;
361         } else {
362                 font_weight = PANGO_WEIGHT_NORMAL;
363         }
364
365         gl_debug (DEBUG_EDITOR, "END");
366
367         return font_weight;
368 }
369
370
371 /*****************************************************************************/
372 /* Set font italic flag.                                                     */
373 /*****************************************************************************/
374 void
375 gl_object_editor_set_font_italic_flag (glObjectEditor      *editor,
376                                        gboolean             font_italic_flag)
377 {
378         gl_debug (DEBUG_EDITOR, "START");
379
380
381         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_italic_toggle),
382                                          gl_object_editor_changed_cb, editor);
383
384
385         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_italic_toggle),
386                                       font_italic_flag);
387
388
389         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_italic_toggle),
390                                            gl_object_editor_changed_cb, editor);
391
392
393         gl_debug (DEBUG_EDITOR, "END");
394 }
395
396
397 /*****************************************************************************/
398 /* Query font italic flag.                                                   */
399 /*****************************************************************************/
400 gboolean
401 gl_object_editor_get_font_italic_flag (glObjectEditor      *editor)
402 {
403         gboolean italic_flag;
404
405         gl_debug (DEBUG_EDITOR, "START");
406
407         italic_flag =
408                 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
409                                               (editor->priv->text_italic_toggle));
410
411         gl_debug (DEBUG_EDITOR, "END");
412
413         return italic_flag;
414 }
415
416
417 /*****************************************************************************/
418 /* Set text alignment.                                                       */
419 /*****************************************************************************/
420 void
421 gl_object_editor_set_text_alignment (glObjectEditor      *editor,
422                                      PangoAlignment       align)
423 {
424         gl_debug (DEBUG_EDITOR, "START");
425
426
427         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_left_toggle), align_toggle_cb, editor);
428         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_center_toggle), align_toggle_cb, editor);
429         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_right_toggle), align_toggle_cb, editor);
430
431
432         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle),
433                                       (align == PANGO_ALIGN_LEFT));
434         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle),
435                                       (align == PANGO_ALIGN_CENTER));
436         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle),
437                                       (align == PANGO_ALIGN_RIGHT));
438
439
440         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_left_toggle), align_toggle_cb, editor);
441         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_center_toggle), align_toggle_cb, editor);
442         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_right_toggle), align_toggle_cb, editor);
443
444
445         gl_debug (DEBUG_EDITOR, "END");
446 }
447
448
449 /*****************************************************************************/
450 /* Query text alignment.                                                     */
451 /*****************************************************************************/
452 PangoAlignment
453 gl_object_editor_get_text_alignment (glObjectEditor      *editor)
454 {
455         PangoAlignment align;
456
457         gl_debug (DEBUG_EDITOR, "START");
458
459         if (gtk_toggle_button_get_active
460             (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle))) {
461                 align = PANGO_ALIGN_LEFT;
462         } else
463             if (gtk_toggle_button_get_active
464                 (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle))) {
465                 align = PANGO_ALIGN_RIGHT;
466         } else
467             if (gtk_toggle_button_get_active
468                 (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle))) {
469                 align = PANGO_ALIGN_CENTER;
470         } else {
471                 align = PANGO_ALIGN_LEFT;       /* Should not happen. */
472         }
473
474         gl_debug (DEBUG_EDITOR, "END");
475
476         return align;
477 }
478
479
480 /*****************************************************************************/
481 /* Set text color.                                                           */
482 /*****************************************************************************/
483 void
484 gl_object_editor_set_text_color (glObjectEditor      *editor,
485                                  gboolean             merge_flag,
486                                  glColorNode         *text_color_node)
487 {
488         gl_debug (DEBUG_EDITOR, "START");
489
490         if (text_color_node == NULL)
491         {
492                 return;
493         }
494
495
496         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_combo),
497                                          gl_object_editor_changed_cb, editor);
498         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_radio),
499                                          text_radio_toggled_cb, editor);
500         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_key_radio),
501                                          text_radio_toggled_cb, editor);
502         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_key_combo),
503                                          gl_object_editor_changed_cb, editor);
504
505
506         gl_debug (DEBUG_EDITOR, "color field %s(%d) / %X",
507                   text_color_node->key, text_color_node->field_flag, text_color_node->color);
508         
509         gtk_widget_set_sensitive (editor->priv->text_color_key_radio, merge_flag);
510
511         if ( text_color_node->color == GL_COLOR_NONE ) {
512
513                 gl_color_combo_set_to_default (GL_COLOR_COMBO(editor->priv->text_color_combo));
514
515         } else {
516                 
517                 gl_color_combo_set_color (GL_COLOR_COMBO(editor->priv->text_color_combo),
518                                           text_color_node->color);
519         }
520         
521         if (!text_color_node->field_flag || !merge_flag)
522         {
523                 gl_debug (DEBUG_EDITOR, "color field false");
524                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE); 
525                 gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE);
526                 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE);
527                 
528         }
529         else
530         {
531                 gl_debug (DEBUG_EDITOR, "color field true");
532                 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_key_radio), TRUE); 
533                 gtk_widget_set_sensitive (editor->priv->text_color_combo, FALSE);
534                 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, TRUE);
535                 
536                 gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->text_color_key_combo), "");
537         }
538
539
540         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_combo),
541                                            gl_object_editor_changed_cb, editor);
542         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_radio),
543                                            text_radio_toggled_cb, editor);
544         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_key_radio),
545                                            text_radio_toggled_cb, editor);
546         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_key_combo),
547                                            gl_object_editor_changed_cb, editor);
548
549
550         gl_debug (DEBUG_EDITOR, "END");
551 }
552
553
554 /*****************************************************************************/
555 /* Query text color.                                                         */
556 /*****************************************************************************/
557 glColorNode*
558 gl_object_editor_get_text_color (glObjectEditor      *editor)
559 {
560         guint        color;
561         glColorNode *color_node;
562         gboolean     is_default;
563
564         gl_debug (DEBUG_EDITOR, "START");
565
566         color_node = gl_color_node_new_default ();
567         
568         if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_key_radio))) {
569                 color_node->field_flag = TRUE;
570                 color_node->color = gl_prefs_model_get_default_text_color (gl_prefs);
571                 color_node->key = 
572                         gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->text_color_key_combo));
573         } else {
574                 color_node->field_flag = FALSE;
575                 color_node->key = NULL;
576                 color = gl_color_combo_get_color (GL_COLOR_COMBO(editor->priv->text_color_combo),
577                                                   &is_default);
578
579                 if (is_default) {
580                         color_node->color = gl_prefs_model_get_default_text_color (gl_prefs);
581                 } else {
582                         color_node->color = color;
583                 }
584         }      
585
586         gl_debug (DEBUG_EDITOR, "END");
587
588         return color_node;
589 }
590
591
592 /*****************************************************************************/
593 /* Set text line spacing.                                                    */
594 /*****************************************************************************/
595 void
596 gl_object_editor_set_text_line_spacing (glObjectEditor      *editor,
597                                         gdouble              text_line_spacing)
598 {
599         gl_debug (DEBUG_EDITOR, "START");
600
601
602         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_line_spacing_spin),
603                                          gl_object_editor_changed_cb, editor);
604
605
606         gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->text_line_spacing_spin),
607                                    text_line_spacing);
608
609
610         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_line_spacing_spin),
611                                            gl_object_editor_changed_cb, editor);
612
613
614         gl_debug (DEBUG_EDITOR, "END");
615 }
616
617
618 /*****************************************************************************/
619 /* Query text line spacing.                                                  */
620 /*****************************************************************************/
621 gdouble
622 gl_object_editor_get_text_line_spacing (glObjectEditor      *editor)
623 {
624         gdouble text_line_spacing;
625
626         gl_debug (DEBUG_EDITOR, "START");
627
628         text_line_spacing = 
629                 gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->text_line_spacing_spin));
630
631         gl_debug (DEBUG_EDITOR, "END");
632
633         return text_line_spacing;
634 }
635
636
637 /*****************************************************************************/
638 /* Set auto shrink checkbox.                                                 */
639 /*****************************************************************************/
640 void
641 gl_object_editor_set_text_auto_shrink (glObjectEditor      *editor,
642                                        gboolean             auto_shrink)
643 {
644         gl_debug (DEBUG_EDITOR, "START");
645
646
647         g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_auto_shrink_check),
648                                          gl_object_editor_changed_cb, editor);
649
650
651         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_auto_shrink_check),
652                                       auto_shrink);
653
654
655         g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_auto_shrink_check),
656                                            gl_object_editor_changed_cb, editor);
657
658
659         gl_debug (DEBUG_EDITOR, "END");
660 }
661
662
663 /*****************************************************************************/
664 /* Query auto shrink checkbox.                                               */
665 /*****************************************************************************/
666 gboolean    gl_object_editor_get_text_auto_shrink (glObjectEditor      *editor)
667 {
668         gboolean auto_shrink;
669
670         gl_debug (DEBUG_EDITOR, "START");
671
672         auto_shrink = 
673                 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->text_auto_shrink_check));
674
675         gl_debug (DEBUG_EDITOR, "END");
676
677         return auto_shrink;
678 }
679
680
681 /*--------------------------------------------------------------------------*/
682 /* PRIVATE.  color radio callback.                                           */
683 /*--------------------------------------------------------------------------*/
684 static void
685 text_radio_toggled_cb (glObjectEditor *editor)
686 {
687         gl_debug (DEBUG_EDITOR, "START");
688         
689         if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio))) {
690                 gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE);
691                 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE);
692         } else {
693                 gtk_widget_set_sensitive (editor->priv->text_color_combo, FALSE);
694                 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, TRUE);
695                 
696         }
697  
698         gl_object_editor_changed_cb (editor);
699  
700         gl_debug (DEBUG_EDITOR, "END");
701 }
702
703
704
705 /*
706  * Local Variables:       -- emacs
707  * mode: C                -- emacs
708  * c-basic-offset: 8      -- emacs
709  * tab-width: 8           -- emacs
710  * indent-tabs-mode: nil  -- emacs
711  * End:                   -- emacs
712  */