2 * object-editor-text-page.c
3 * Copyright (C) 2003-2009 Jim Evins <evins@snaught.com>.
5 * This file is part of gLabels.
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.
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.
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/>.
23 #include "object-editor.h"
25 #include <glib/gi18n.h>
30 #include "color-combo.h"
32 #include "font-combo.h"
33 #include "font-util.h"
34 #include "field-button.h"
35 #include "builder-util.h"
37 #include "object-editor-private.h"
42 /*===========================================*/
44 /*===========================================*/
47 /*===========================================*/
48 /* Private data types */
49 /*===========================================*/
52 /*===========================================*/
54 /*===========================================*/
57 /*===========================================*/
58 /* Local function prototypes */
59 /*===========================================*/
61 static void align_toggle_cb (GtkToggleButton *toggle,
62 glObjectEditor *editor);
63 static void valign_toggle_cb (GtkToggleButton *toggle,
64 glObjectEditor *editor);
65 static void text_radio_toggled_cb (glObjectEditor *editor);
68 /*--------------------------------------------------------------------------*/
69 /* PRIVATE. Prepare size page. */
70 /*--------------------------------------------------------------------------*/
72 gl_object_editor_prepare_text_page (glObjectEditor *editor)
74 gl_debug (DEBUG_EDITOR, "START");
76 /* Extract widgets from XML tree. */
77 gl_builder_util_get_widgets (editor->priv->builder,
78 "text_page_vbox", &editor->priv->text_page_vbox,
79 "text_family_hbox", &editor->priv->text_family_hbox,
80 "text_size_spin", &editor->priv->text_size_spin,
81 "text_bold_toggle", &editor->priv->text_bold_toggle,
82 "text_italic_toggle", &editor->priv->text_italic_toggle,
83 "text_color_hbox", &editor->priv->text_color_hbox,
84 "text_color_radio", &editor->priv->text_color_radio,
85 "text_color_key_radio", &editor->priv->text_color_key_radio,
86 "text_color_key_hbox", &editor->priv->text_color_key_hbox,
87 "text_left_toggle", &editor->priv->text_left_toggle,
88 "text_center_toggle", &editor->priv->text_center_toggle,
89 "text_right_toggle", &editor->priv->text_right_toggle,
90 "text_top_toggle", &editor->priv->text_top_toggle,
91 "text_vcenter_toggle", &editor->priv->text_vcenter_toggle,
92 "text_bottom_toggle", &editor->priv->text_bottom_toggle,
93 "text_line_spacing_spin", &editor->priv->text_line_spacing_spin,
94 "text_auto_shrink_check", &editor->priv->text_auto_shrink_check,
97 editor->priv->text_family_combo = gl_font_combo_new ("Sans");
98 gtk_box_pack_start (GTK_BOX (editor->priv->text_family_hbox),
99 editor->priv->text_family_combo,
102 editor->priv->text_color_combo = gl_color_combo_new (_("Default"),
103 GL_COLOR_TEXT_DEFAULT,
104 gl_prefs_model_get_default_text_color (gl_prefs));
105 gtk_box_pack_start (GTK_BOX (editor->priv->text_color_hbox),
106 editor->priv->text_color_combo,
109 editor->priv->text_color_key_combo = gl_field_button_new (NULL);
110 gtk_box_pack_start (GTK_BOX (editor->priv->text_color_key_hbox),
111 editor->priv->text_color_key_combo,
116 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE);
117 gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE);
118 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE);
121 gtk_widget_show_all (editor->priv->text_page_vbox);
123 /* Connect signals */
124 g_signal_connect_swapped (G_OBJECT (editor->priv->text_family_combo),
126 G_CALLBACK (gl_object_editor_changed_cb),
128 g_signal_connect_swapped (G_OBJECT (editor->priv->text_size_spin),
130 G_CALLBACK (gl_object_editor_changed_cb),
132 g_signal_connect_swapped (G_OBJECT (editor->priv->text_bold_toggle),
134 G_CALLBACK (gl_object_editor_changed_cb),
136 g_signal_connect_swapped (G_OBJECT (editor->priv->text_italic_toggle),
138 G_CALLBACK (gl_object_editor_changed_cb),
140 g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_combo),
142 G_CALLBACK (gl_object_editor_changed_cb),
144 g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_key_combo),
146 G_CALLBACK (gl_object_editor_changed_cb),
148 g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_radio),
150 G_CALLBACK (text_radio_toggled_cb),
152 g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_key_radio),
154 G_CALLBACK (text_radio_toggled_cb),
157 g_signal_connect (G_OBJECT (editor->priv->text_left_toggle),
159 G_CALLBACK (align_toggle_cb),
161 g_signal_connect (G_OBJECT (editor->priv->text_center_toggle),
163 G_CALLBACK (align_toggle_cb),
165 g_signal_connect (G_OBJECT (editor->priv->text_right_toggle),
167 G_CALLBACK (align_toggle_cb),
170 g_signal_connect (G_OBJECT (editor->priv->text_top_toggle),
172 G_CALLBACK (valign_toggle_cb),
174 g_signal_connect (G_OBJECT (editor->priv->text_vcenter_toggle),
176 G_CALLBACK (valign_toggle_cb),
178 g_signal_connect (G_OBJECT (editor->priv->text_bottom_toggle),
180 G_CALLBACK (valign_toggle_cb),
183 g_signal_connect_swapped (G_OBJECT (editor->priv->text_line_spacing_spin),
185 G_CALLBACK (gl_object_editor_changed_cb),
188 g_signal_connect_swapped (G_OBJECT (editor->priv->text_auto_shrink_check),
190 G_CALLBACK (gl_object_editor_changed_cb),
193 gl_debug (DEBUG_EDITOR, "END");
197 /*--------------------------------------------------------------------------*/
198 /* PRIVATE. Alignment togglebutton callback. */
199 /*--------------------------------------------------------------------------*/
201 align_toggle_cb (GtkToggleButton *toggle,
202 glObjectEditor *editor)
204 if (gtk_toggle_button_get_active (toggle)) {
206 if (GTK_WIDGET (toggle) == GTK_WIDGET (editor->priv->text_left_toggle)) {
207 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
208 (editor->priv->text_center_toggle),
210 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
211 (editor->priv->text_right_toggle),
213 } else if (GTK_WIDGET (toggle) ==
214 GTK_WIDGET (editor->priv->text_center_toggle)) {
215 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
216 (editor->priv->text_left_toggle),
218 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
219 (editor->priv->text_right_toggle),
221 } else if (GTK_WIDGET (toggle) ==
222 GTK_WIDGET (editor->priv->text_right_toggle)) {
223 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
224 (editor->priv->text_left_toggle),
226 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
227 (editor->priv->text_center_toggle),
231 gl_object_editor_changed_cb (editor);
237 /*--------------------------------------------------------------------------*/
238 /* PRIVATE. Vertical alignment togglebutton callback. */
239 /*--------------------------------------------------------------------------*/
241 valign_toggle_cb (GtkToggleButton *toggle,
242 glObjectEditor *editor)
244 if (gtk_toggle_button_get_active (toggle)) {
246 if (GTK_WIDGET (toggle) == GTK_WIDGET (editor->priv->text_top_toggle)) {
247 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
248 (editor->priv->text_vcenter_toggle),
250 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
251 (editor->priv->text_bottom_toggle),
253 } else if (GTK_WIDGET (toggle) ==
254 GTK_WIDGET (editor->priv->text_vcenter_toggle)) {
255 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
256 (editor->priv->text_top_toggle),
258 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
259 (editor->priv->text_bottom_toggle),
261 } else if (GTK_WIDGET (toggle) ==
262 GTK_WIDGET (editor->priv->text_bottom_toggle)) {
263 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
264 (editor->priv->text_top_toggle),
266 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
267 (editor->priv->text_vcenter_toggle),
271 gl_object_editor_changed_cb (editor);
277 /*****************************************************************************/
278 /* Set font family. */
279 /*****************************************************************************/
281 gl_object_editor_set_font_family (glObjectEditor *editor,
282 const gchar *font_family)
284 gchar *old_font_family;
286 if (font_family == NULL)
291 gl_debug (DEBUG_EDITOR, "START");
294 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_family_combo),
295 gl_object_editor_changed_cb, editor);
298 old_font_family = gl_font_combo_get_family (GL_FONT_COMBO (editor->priv->text_family_combo));
300 if ( !old_font_family || g_utf8_collate( old_font_family, font_family ) )
302 gl_font_combo_set_family (GL_FONT_COMBO (editor->priv->text_family_combo),
306 g_free (old_font_family);
309 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_family_combo),
310 gl_object_editor_changed_cb, editor);
313 gl_debug (DEBUG_EDITOR, "END");
317 /*****************************************************************************/
318 /* Query font family. */
319 /*****************************************************************************/
321 gl_object_editor_get_font_family (glObjectEditor *editor)
325 gl_debug (DEBUG_EDITOR, "START");
327 font_family = gl_font_combo_get_family (GL_FONT_COMBO (editor->priv->text_family_combo));
329 gl_debug (DEBUG_EDITOR, "END");
335 /*****************************************************************************/
337 /*****************************************************************************/
339 gl_object_editor_set_font_size (glObjectEditor *editor,
342 gl_debug (DEBUG_EDITOR, "START");
345 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_size_spin),
346 gl_object_editor_changed_cb, editor);
349 gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->text_size_spin),
353 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_size_spin),
354 gl_object_editor_changed_cb, editor);
357 gl_debug (DEBUG_EDITOR, "END");
361 /*****************************************************************************/
362 /* Query font size. */
363 /*****************************************************************************/
365 gl_object_editor_get_font_size (glObjectEditor *editor)
369 gl_debug (DEBUG_EDITOR, "START");
372 gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->text_size_spin));
374 gl_debug (DEBUG_EDITOR, "END");
380 /*****************************************************************************/
381 /* Set font weight. */
382 /*****************************************************************************/
384 gl_object_editor_set_font_weight (glObjectEditor *editor,
385 PangoWeight font_weight)
387 gl_debug (DEBUG_EDITOR, "START");
390 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_bold_toggle),
391 gl_object_editor_changed_cb, editor);
394 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle),
395 (font_weight == PANGO_WEIGHT_BOLD));
398 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_bold_toggle),
399 gl_object_editor_changed_cb, editor);
402 gl_debug (DEBUG_EDITOR, "END");
406 /*****************************************************************************/
407 /* Query font weight. */
408 /*****************************************************************************/
410 gl_object_editor_get_font_weight (glObjectEditor *editor)
412 PangoWeight font_weight;
414 gl_debug (DEBUG_EDITOR, "START");
416 if (gtk_toggle_button_get_active
417 (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle))) {
418 font_weight = PANGO_WEIGHT_BOLD;
420 font_weight = PANGO_WEIGHT_NORMAL;
423 gl_debug (DEBUG_EDITOR, "END");
429 /*****************************************************************************/
430 /* Set font italic flag. */
431 /*****************************************************************************/
433 gl_object_editor_set_font_italic_flag (glObjectEditor *editor,
434 gboolean font_italic_flag)
436 gl_debug (DEBUG_EDITOR, "START");
439 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_italic_toggle),
440 gl_object_editor_changed_cb, editor);
443 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_italic_toggle),
447 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_italic_toggle),
448 gl_object_editor_changed_cb, editor);
451 gl_debug (DEBUG_EDITOR, "END");
455 /*****************************************************************************/
456 /* Query font italic flag. */
457 /*****************************************************************************/
459 gl_object_editor_get_font_italic_flag (glObjectEditor *editor)
461 gboolean italic_flag;
463 gl_debug (DEBUG_EDITOR, "START");
466 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
467 (editor->priv->text_italic_toggle));
469 gl_debug (DEBUG_EDITOR, "END");
475 /*****************************************************************************/
476 /* Set text alignment. */
477 /*****************************************************************************/
479 gl_object_editor_set_text_alignment (glObjectEditor *editor,
480 PangoAlignment align)
482 gl_debug (DEBUG_EDITOR, "START");
485 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_left_toggle), align_toggle_cb, editor);
486 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_center_toggle), align_toggle_cb, editor);
487 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_right_toggle), align_toggle_cb, editor);
490 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle),
491 (align == PANGO_ALIGN_LEFT));
492 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle),
493 (align == PANGO_ALIGN_CENTER));
494 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle),
495 (align == PANGO_ALIGN_RIGHT));
498 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_left_toggle), align_toggle_cb, editor);
499 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_center_toggle), align_toggle_cb, editor);
500 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_right_toggle), align_toggle_cb, editor);
503 gl_debug (DEBUG_EDITOR, "END");
507 /*****************************************************************************/
508 /* Query text alignment. */
509 /*****************************************************************************/
511 gl_object_editor_get_text_alignment (glObjectEditor *editor)
513 PangoAlignment align;
515 gl_debug (DEBUG_EDITOR, "START");
517 if (gtk_toggle_button_get_active
518 (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle))) {
519 align = PANGO_ALIGN_LEFT;
521 if (gtk_toggle_button_get_active
522 (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle))) {
523 align = PANGO_ALIGN_RIGHT;
525 if (gtk_toggle_button_get_active
526 (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle))) {
527 align = PANGO_ALIGN_CENTER;
529 align = PANGO_ALIGN_LEFT; /* Should not happen. */
532 gl_debug (DEBUG_EDITOR, "END");
538 /*****************************************************************************/
539 /* Set vertical text alignment. */
540 /*****************************************************************************/
542 gl_object_editor_set_text_valignment (glObjectEditor *editor,
545 gl_debug (DEBUG_EDITOR, "START");
548 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_top_toggle), valign_toggle_cb, editor);
549 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_vcenter_toggle), valign_toggle_cb, editor);
550 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_bottom_toggle), valign_toggle_cb, editor);
553 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_top_toggle),
554 (valign == GL_VALIGN_TOP));
555 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_vcenter_toggle),
556 (valign == GL_VALIGN_VCENTER));
557 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_bottom_toggle),
558 (valign == GL_VALIGN_BOTTOM));
561 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_top_toggle), valign_toggle_cb, editor);
562 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_vcenter_toggle), valign_toggle_cb, editor);
563 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_bottom_toggle), valign_toggle_cb, editor);
566 gl_debug (DEBUG_EDITOR, "END");
570 /*****************************************************************************/
571 /* Query vertical text alignment. */
572 /*****************************************************************************/
574 gl_object_editor_get_text_valignment (glObjectEditor *editor)
578 gl_debug (DEBUG_EDITOR, "START");
580 if (gtk_toggle_button_get_active
581 (GTK_TOGGLE_BUTTON (editor->priv->text_top_toggle))) {
582 valign = GL_VALIGN_TOP;
584 if (gtk_toggle_button_get_active
585 (GTK_TOGGLE_BUTTON (editor->priv->text_bottom_toggle))) {
586 valign = GL_VALIGN_BOTTOM;
588 if (gtk_toggle_button_get_active
589 (GTK_TOGGLE_BUTTON (editor->priv->text_vcenter_toggle))) {
590 valign = GL_VALIGN_VCENTER;
592 valign = GL_VALIGN_TOP; /* Should not happen. */
595 gl_debug (DEBUG_EDITOR, "END");
601 /*****************************************************************************/
602 /* Set text color. */
603 /*****************************************************************************/
605 gl_object_editor_set_text_color (glObjectEditor *editor,
607 glColorNode *text_color_node)
609 gl_debug (DEBUG_EDITOR, "START");
611 if (text_color_node == NULL)
617 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_combo),
618 gl_object_editor_changed_cb, editor);
619 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_radio),
620 text_radio_toggled_cb, editor);
621 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_key_radio),
622 text_radio_toggled_cb, editor);
623 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_color_key_combo),
624 gl_object_editor_changed_cb, editor);
627 gl_debug (DEBUG_EDITOR, "color field %s(%d) / %X",
628 text_color_node->key, text_color_node->field_flag, text_color_node->color);
630 gtk_widget_set_sensitive (editor->priv->text_color_key_radio, merge_flag);
632 if ( text_color_node->color == GL_COLOR_NONE ) {
634 gl_color_combo_set_to_default (GL_COLOR_COMBO(editor->priv->text_color_combo));
638 gl_color_combo_set_color (GL_COLOR_COMBO(editor->priv->text_color_combo),
639 text_color_node->color);
642 if (!text_color_node->field_flag || !merge_flag)
644 gl_debug (DEBUG_EDITOR, "color field false");
645 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE);
646 gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE);
647 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE);
652 gl_debug (DEBUG_EDITOR, "color field true");
653 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_key_radio), TRUE);
654 gtk_widget_set_sensitive (editor->priv->text_color_combo, FALSE);
655 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, TRUE);
657 gl_field_button_set_key (GL_FIELD_BUTTON (editor->priv->text_color_key_combo), "");
661 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_combo),
662 gl_object_editor_changed_cb, editor);
663 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_radio),
664 text_radio_toggled_cb, editor);
665 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_key_radio),
666 text_radio_toggled_cb, editor);
667 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_color_key_combo),
668 gl_object_editor_changed_cb, editor);
671 gl_debug (DEBUG_EDITOR, "END");
675 /*****************************************************************************/
676 /* Query text color. */
677 /*****************************************************************************/
679 gl_object_editor_get_text_color (glObjectEditor *editor)
682 glColorNode *color_node;
685 gl_debug (DEBUG_EDITOR, "START");
687 color_node = gl_color_node_new_default ();
689 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_key_radio))) {
690 color_node->field_flag = TRUE;
691 color_node->color = gl_prefs_model_get_default_text_color (gl_prefs);
693 gl_field_button_get_key (GL_FIELD_BUTTON (editor->priv->text_color_key_combo));
695 color_node->field_flag = FALSE;
696 color_node->key = NULL;
697 color = gl_color_combo_get_color (GL_COLOR_COMBO(editor->priv->text_color_combo),
701 color_node->color = gl_prefs_model_get_default_text_color (gl_prefs);
703 color_node->color = color;
707 gl_debug (DEBUG_EDITOR, "END");
713 /*****************************************************************************/
714 /* Set text line spacing. */
715 /*****************************************************************************/
717 gl_object_editor_set_text_line_spacing (glObjectEditor *editor,
718 gdouble text_line_spacing)
720 gl_debug (DEBUG_EDITOR, "START");
723 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_line_spacing_spin),
724 gl_object_editor_changed_cb, editor);
727 gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->text_line_spacing_spin),
731 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_line_spacing_spin),
732 gl_object_editor_changed_cb, editor);
735 gl_debug (DEBUG_EDITOR, "END");
739 /*****************************************************************************/
740 /* Query text line spacing. */
741 /*****************************************************************************/
743 gl_object_editor_get_text_line_spacing (glObjectEditor *editor)
745 gdouble text_line_spacing;
747 gl_debug (DEBUG_EDITOR, "START");
750 gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->text_line_spacing_spin));
752 gl_debug (DEBUG_EDITOR, "END");
754 return text_line_spacing;
758 /*****************************************************************************/
759 /* Set auto shrink checkbox. */
760 /*****************************************************************************/
762 gl_object_editor_set_text_auto_shrink (glObjectEditor *editor,
763 gboolean auto_shrink)
765 gl_debug (DEBUG_EDITOR, "START");
768 g_signal_handlers_block_by_func (G_OBJECT (editor->priv->text_auto_shrink_check),
769 gl_object_editor_changed_cb, editor);
772 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_auto_shrink_check),
776 g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->text_auto_shrink_check),
777 gl_object_editor_changed_cb, editor);
780 gl_debug (DEBUG_EDITOR, "END");
784 /*****************************************************************************/
785 /* Query auto shrink checkbox. */
786 /*****************************************************************************/
787 gboolean gl_object_editor_get_text_auto_shrink (glObjectEditor *editor)
789 gboolean auto_shrink;
791 gl_debug (DEBUG_EDITOR, "START");
794 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->text_auto_shrink_check));
796 gl_debug (DEBUG_EDITOR, "END");
802 /*--------------------------------------------------------------------------*/
803 /* PRIVATE. color radio callback. */
804 /*--------------------------------------------------------------------------*/
806 text_radio_toggled_cb (glObjectEditor *editor)
808 gl_debug (DEBUG_EDITOR, "START");
810 if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio))) {
811 gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE);
812 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE);
814 gtk_widget_set_sensitive (editor->priv->text_color_combo, FALSE);
815 gtk_widget_set_sensitive (editor->priv->text_color_key_combo, TRUE);
819 gl_object_editor_changed_cb (editor);
821 gl_debug (DEBUG_EDITOR, "END");
827 * Local Variables: -- emacs
829 * c-basic-offset: 8 -- emacs
830 * tab-width: 8 -- emacs
831 * indent-tabs-mode: nil -- emacs