]> git.sur5r.net Git - glabels/commitdiff
2006-02-06 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Tue, 7 Feb 2006 02:21:17 +0000 (02:21 +0000)
committerJim Evins <evins@snaught.com>
Tue, 7 Feb 2006 02:21:17 +0000 (02:21 +0000)
* src/object-editor-shadow-page.c:
Forgot to add this file.
* src/view-box.c: (gl_view_box_new),
(update_canvas_item_from_object_cb), (update_editor_from_label_cb):
Update limits on shadow offset spinbuttons.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@582 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/ChangeLog
glabels2/src/object-editor-shadow-page.c [new file with mode: 0644]
glabels2/src/view-box.c

index a8f2997c6806eaa5da6999b13a20507a8132b118..35507d13b0b41ae154c35993138cc9e7247eabaa 100644 (file)
@@ -1,3 +1,11 @@
+2006-02-06  Jim Evins  <evins@snaught.com>
+
+       * src/object-editor-shadow-page.c:
+               Forgot to add this file.
+       * src/view-box.c: (gl_view_box_new),
+       (update_canvas_item_from_object_cb), (update_editor_from_label_cb):
+               Update limits on shadow offset spinbuttons.
+
 2006-01-19  Jim Evins  <evins@snaught.com>
 
        * src/merge-evolution.c: (gl_merge_evolution_get_key_list):
diff --git a/glabels2/src/object-editor-shadow-page.c b/glabels2/src/object-editor-shadow-page.c
new file mode 100644 (file)
index 0000000..338ca0b
--- /dev/null
@@ -0,0 +1,532 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
+/*
+ *  (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ *  object-editor.c:  object properties editor module
+ *
+ *  Copyright (C) 2006  Jim Evins <evins@snaught.com>.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+ */
+#include <config.h>
+
+#include "object-editor.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkspinbutton.h>
+#include <gtk/gtkcombobox.h>
+#include <math.h>
+
+#include "prefs.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros                            */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types                        */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals                           */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes                 */
+/*===========================================*/
+
+static void shadow_enable_check_toggled_cb (glObjectEditor        *editor);
+static void shadow_color_radio_toggled_cb  (glObjectEditor        *editor);
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  Prepare shadow page.                                         */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_shadow_page (glObjectEditor *editor)
+{
+       const gchar  *units_string;
+       gdouble       climb_rate;
+       gint          digits;
+
+       gl_debug (DEBUG_EDITOR, "START");
+
+       /* Extract widgets from XML tree. */
+       editor->priv->shadow_page_vbox
+               = glade_xml_get_widget (editor->priv->gui, "shadow_page_vbox");
+       editor->priv->shadow_enable_check
+               = glade_xml_get_widget (editor->priv->gui, "shadow_enable_check");
+       editor->priv->shadow_controls_table
+               = glade_xml_get_widget (editor->priv->gui, "shadow_controls_table");
+       editor->priv->shadow_x_spin
+               = glade_xml_get_widget (editor->priv->gui, "shadow_x_spin");
+       editor->priv->shadow_y_spin
+               = glade_xml_get_widget (editor->priv->gui, "shadow_y_spin");
+       editor->priv->shadow_x_units_label
+               = glade_xml_get_widget (editor->priv->gui, "shadow_x_units_label");
+       editor->priv->shadow_y_units_label
+               = glade_xml_get_widget (editor->priv->gui, "shadow_y_units_label");
+       editor->priv->shadow_color_radio
+               = glade_xml_get_widget (editor->priv->gui, "shadow_color_radio");       
+       editor->priv->shadow_key_radio
+               = glade_xml_get_widget (editor->priv->gui, "shadow_key_radio"); 
+       editor->priv->shadow_color_combo
+               = glade_xml_get_widget (editor->priv->gui, "shadow_color_combo");
+       editor->priv->shadow_key_combo
+               = glade_xml_get_widget (editor->priv->gui, "shadow_key_combo"); 
+       editor->priv->shadow_opacity_spin
+               = glade_xml_get_widget (editor->priv->gui, "shadow_opacity_spin");
+
+       gl_util_combo_box_add_text_model ( GTK_COMBO_BOX(editor->priv->shadow_key_combo));
+
+       /* Get configuration information */
+       units_string = gl_prefs_get_units_string ();
+       editor->priv->units_per_point = gl_prefs_get_units_per_point ();
+       climb_rate = gl_prefs_get_units_step_size ();
+       digits = gl_prefs_get_units_precision ();
+
+       /* Modify widgets based on configuration */
+       gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->shadow_x_spin), digits);
+       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->shadow_x_spin),
+                                       climb_rate, 10.0*climb_rate);
+       gtk_label_set_text (GTK_LABEL(editor->priv->shadow_x_units_label), units_string);
+       gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->shadow_y_spin), digits);
+       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->shadow_y_spin),
+                                       climb_rate, 10.0*climb_rate);
+       gtk_label_set_text (GTK_LABEL(editor->priv->shadow_y_units_label), units_string);
+
+       /* Un-hide */
+       gtk_widget_show_all (editor->priv->shadow_page_vbox);
+
+       /* Connect signals */
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_enable_check),
+                                 "toggled",
+                                 G_CALLBACK (shadow_enable_check_toggled_cb),
+                                 G_OBJECT (editor));                             
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_x_spin),
+                                 "changed",
+                                 G_CALLBACK (gl_object_editor_changed_cb),
+                                 G_OBJECT (editor));
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_y_spin),
+                                 "changed",
+                                 G_CALLBACK (gl_object_editor_changed_cb),
+                                 G_OBJECT (editor));
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_color_combo),
+                                 "color_changed",
+                                 G_CALLBACK (gl_object_editor_changed_cb),
+                                 G_OBJECT (editor));
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_key_combo),
+                                 "changed",
+                                 G_CALLBACK (gl_object_editor_changed_cb),
+                                 G_OBJECT (editor));
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_color_radio),
+                                 "toggled",
+                                 G_CALLBACK (shadow_color_radio_toggled_cb),
+                                 G_OBJECT (editor));                             
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_key_radio),
+                                 "toggled",
+                                 G_CALLBACK (shadow_color_radio_toggled_cb),
+                                 G_OBJECT (editor));                             
+       g_signal_connect_swapped (G_OBJECT (editor->priv->shadow_opacity_spin),
+                                 "changed",
+                                 G_CALLBACK (gl_object_editor_changed_cb),
+                                 G_OBJECT (editor));
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set shadow parameters.                                                    */
+/*****************************************************************************/
+void
+gl_object_editor_set_shadow_state (glObjectEditor      *editor,
+                                  gboolean             state)
+{
+       gl_debug (DEBUG_EDITOR, "START");
+
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_enable_check),
+                                        shadow_enable_check_toggled_cb,
+                                        editor);
+
+       gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (editor->priv->shadow_enable_check),
+                                    state);
+        gtk_widget_set_sensitive (editor->priv->shadow_controls_table, state);
+
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_enable_check),
+                                          shadow_enable_check_toggled_cb,
+                                          editor);
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+void
+gl_object_editor_set_shadow_offset (glObjectEditor      *editor,
+                                   gdouble              x,
+                                   gdouble              y)
+{
+       gl_debug (DEBUG_EDITOR, "START");
+
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_x_spin),
+                                        gl_object_editor_changed_cb,
+                                        editor);
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_y_spin),
+                                        gl_object_editor_changed_cb,
+                                        editor);
+
+       /* save a copy in internal units */
+       editor->priv->shadow_x = x;
+       editor->priv->shadow_y = y;
+
+       /* convert internal units to displayed units */
+       gl_debug (DEBUG_EDITOR, "internal x,y = %g, %g", x, y);
+       x *= editor->priv->units_per_point;
+       y *= editor->priv->units_per_point;
+       gl_debug (DEBUG_EDITOR, "display x,y = %g, %g", x, y);
+
+       /* Set widget values */
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin), x);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin), y);
+
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_x_spin),
+                                          gl_object_editor_changed_cb,
+                                          editor);
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_y_spin),
+                                          gl_object_editor_changed_cb,
+                                          editor);
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+void
+gl_object_editor_set_shadow_color (glObjectEditor      *editor,
+                                  gboolean             merge_flag,
+                                  glColorNode         *color_node)
+{
+       GdkColor *gdk_color;
+
+       gl_debug (DEBUG_EDITOR, "START");
+
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_color_combo),
+                                        G_CALLBACK (gl_object_editor_changed_cb),
+                                        editor);
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_key_combo),
+                                        G_CALLBACK (gl_object_editor_changed_cb),
+                                        editor);
+
+       gtk_widget_set_sensitive (editor->priv->shadow_key_radio, merge_flag);
+
+       if ( color_node->color == GL_COLOR_NONE ) {
+
+               color_combo_set_color_to_default (COLOR_COMBO(editor->priv->shadow_color_combo));
+
+       } else {
+
+               gdk_color = gl_color_to_gdk_color (color_node->color);
+               color_combo_set_color (COLOR_COMBO(editor->priv->shadow_color_combo),
+                                          gdk_color);
+               g_free (gdk_color);
+
+       }
+       
+       if (!color_node->field_flag) {
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+                                                 (editor->priv->shadow_color_radio), TRUE); 
+               gtk_widget_set_sensitive (editor->priv->shadow_color_combo, TRUE);
+               gtk_widget_set_sensitive (editor->priv->shadow_key_combo, FALSE);
+               
+       } else {
+               gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+                                                 (editor->priv->shadow_key_radio), TRUE); 
+               gtk_widget_set_sensitive (editor->priv->shadow_color_combo, FALSE);
+               gtk_widget_set_sensitive (editor->priv->shadow_key_combo, TRUE);
+               
+               gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->shadow_key_combo),
+                                                  color_node->key);
+       }
+       
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_color_combo),
+                                          G_CALLBACK (gl_object_editor_changed_cb),
+                                          editor);
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_key_combo),
+                                          G_CALLBACK (gl_object_editor_changed_cb),
+                                          editor);
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+void
+gl_object_editor_set_shadow_opacity (glObjectEditor      *editor,
+                                    gdouble              alpha)
+{
+       gl_debug (DEBUG_EDITOR, "START");
+
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_opacity_spin),
+                                        gl_object_editor_changed_cb,
+                                        editor);
+
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_opacity_spin),
+                                  alpha * 100.0);
+
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_opacity_spin),
+                                          gl_object_editor_changed_cb,
+                                          editor);
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+
+/*****************************************************************************/
+/* Set maximum shadow offset.                                                */
+/*****************************************************************************/
+void
+gl_object_editor_set_max_shadow_offset (glObjectEditor      *editor,
+                                       gdouble              x_max,
+                                       gdouble              y_max)
+{
+       gdouble tmp;
+
+       gl_debug (DEBUG_EDITOR, "START");
+
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_x_spin),
+                                        gl_object_editor_changed_cb,
+                                        editor);
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_y_spin),
+                                        gl_object_editor_changed_cb,
+                                        editor);
+
+       /* save a copy in internal units */
+       editor->priv->shadow_x_max = x_max;
+       editor->priv->shadow_y_max = y_max;
+
+       /* convert internal units to displayed units */
+       gl_debug (DEBUG_EDITOR, "internal x_max,y_max = %g, %g", x_max, y_max);
+       x_max *= editor->priv->units_per_point;
+       y_max *= editor->priv->units_per_point;
+       gl_debug (DEBUG_EDITOR, "display x_max,y_max = %g, %g", x_max, y_max);
+
+       /* Set widget values */
+       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin));
+       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin),
+                                  -x_max, x_max);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin), tmp);
+       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin));
+       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin),
+                                  -y_max, y_max);
+       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin), tmp);
+
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_x_spin),
+                                          gl_object_editor_changed_cb,
+                                          editor);
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_y_spin),
+                                          gl_object_editor_changed_cb,
+                                          editor);
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query shadow parameters.                                                  */
+/*****************************************************************************/
+gboolean
+gl_object_editor_get_shadow_state (glObjectEditor      *editor)
+{
+       gboolean state;
+
+       gl_debug (DEBUG_EDITOR, "START");
+
+       state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_enable_check));
+
+       gl_debug (DEBUG_EDITOR, "END");
+
+       return state;
+}
+
+void
+gl_object_editor_get_shadow_offset (glObjectEditor      *editor,
+                                   gdouble             *x,
+                                   gdouble             *y)
+{
+       gl_debug (DEBUG_EDITOR, "START");
+
+       /* Get values from widgets */
+       *x = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin));
+       *y = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin));
+
+       /* convert everything back to our internal units (points) */
+       *x /= editor->priv->units_per_point;
+       *y /= editor->priv->units_per_point;
+
+       /* save a copy in internal units */
+       editor->priv->shadow_x = *x;
+       editor->priv->shadow_y = *y;
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+glColorNode*
+gl_object_editor_get_shadow_color (glObjectEditor      *editor)
+{
+        GdkColor    *gdk_color;
+        gboolean     is_default;
+       glColorNode *color_node;
+       gl_debug (DEBUG_EDITOR, "START");
+
+       color_node = gl_color_node_new_default ();
+       
+       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_key_radio))) {
+               color_node->field_flag = TRUE;
+               color_node->key = 
+                       gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->shadow_key_combo));
+    } else {
+               color_node->field_flag = FALSE;
+               color_node->key = NULL;
+               gdk_color = color_combo_get_color (COLOR_COMBO(editor->priv->shadow_color_combo),
+                                           &is_default);
+
+               if (!is_default) {
+               color_node->color = gl_color_from_gdk_color (gdk_color);
+        }
+       }
+
+       gl_debug (DEBUG_EDITOR, "END");
+
+       return color_node;
+}
+
+gdouble
+gl_object_editor_get_shadow_opacity (glObjectEditor      *editor)
+{
+       gdouble alpha;
+
+       gl_debug (DEBUG_EDITOR, "START");
+
+       alpha = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->shadow_opacity_spin));
+
+       gl_debug (DEBUG_EDITOR, "END");
+
+       return alpha / 100.0;
+}
+
+
+/*****************************************************************************/
+/* PRIVATE. Prefs changed callback.  Update units related items.            */
+/*****************************************************************************/
+void
+shadow_prefs_changed_cb (glObjectEditor *editor)
+{
+       const gchar  *units_string;
+       gdouble       climb_rate;
+       gint          digits;
+
+       gl_debug (DEBUG_EDITOR, "START");
+
+        /* Get new configuration information */
+        units_string = gl_prefs_get_units_string ();
+        editor->priv->units_per_point = gl_prefs_get_units_per_point ();
+        climb_rate = gl_prefs_get_units_step_size ();
+        digits = gl_prefs_get_units_precision ();
+
+       /* Update characteristics of x_spin/y_spin */
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_x_spin),
+                                        gl_object_editor_changed_cb,
+                                        editor);
+       g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_y_spin),
+                                        gl_object_editor_changed_cb,
+                                        editor);
+       gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->shadow_x_spin),
+                                   digits);
+       gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->shadow_y_spin),
+                                   digits);
+       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->shadow_x_spin),
+                                       climb_rate, 10.0*climb_rate);
+       gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->shadow_y_spin),
+                                       climb_rate, 10.0*climb_rate);
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_x_spin),
+                                          gl_object_editor_changed_cb,
+                                          editor);
+       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_y_spin),
+                                          gl_object_editor_changed_cb,
+                                          editor);
+
+       /* Update units_labels */
+       gtk_label_set_text (GTK_LABEL(editor->priv->shadow_x_units_label),
+                           units_string);
+       gtk_label_set_text (GTK_LABEL(editor->priv->shadow_y_units_label),
+                           units_string);
+
+       /* Update values of x_spin/y_spin */
+       gl_object_editor_set_shadow_offset (editor,
+                                           editor->priv->shadow_x,
+                                           editor->priv->shadow_y);
+       gl_object_editor_set_max_shadow_offset (editor,
+                                               editor->priv->shadow_x_max,
+                                               editor->priv->shadow_y_max);
+
+       gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  shadow enable check callback.                                  */
+/*--------------------------------------------------------------------------*/
+static void
+shadow_enable_check_toggled_cb (glObjectEditor *editor)
+{
+       gboolean state;
+
+        gl_debug (DEBUG_EDITOR, "START");
+
+       state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_enable_check));
+
+        gtk_widget_set_sensitive (editor->priv->shadow_controls_table, state);
+
+        /* Emit our "changed" signal */
+        g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+
+        gl_debug (DEBUG_EDITOR, "END");
+}
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE.  shadow color radio callback.                                   */
+/*--------------------------------------------------------------------------*/
+static void
+shadow_color_radio_toggled_cb (glObjectEditor *editor)
+{
+    gl_debug (DEBUG_EDITOR, "START");
+       
+       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_color_radio))) {
+                gtk_widget_set_sensitive (editor->priv->shadow_color_combo, TRUE);
+                gtk_widget_set_sensitive (editor->priv->shadow_key_combo, FALSE);
+    } else {
+                gtk_widget_set_sensitive (editor->priv->shadow_color_combo, FALSE);
+                gtk_widget_set_sensitive (editor->priv->shadow_key_combo, TRUE);
+               
+       }
+        /* Emit our "changed" signal */
+        g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+        gl_debug (DEBUG_EDITOR, "END");
+}
index ebab30d9a16dc3624d12602ccd1de42885bbb2d6..846ee2de7cc96be3d27af72c74b1de91e331ef37 100644 (file)
@@ -208,8 +208,12 @@ gl_view_box_new (glLabelBox *object,
                shadow_color_node->color = GL_COLOR_SHADOW_MERGE_DEFAULT;
        }
        shadow_opacity = gl_label_object_get_shadow_opacity (GL_LABEL_OBJECT (object));
-       shadow_line_color = gl_color_shadow (shadow_color_node->color, shadow_opacity, line_color_node->color);
-       shadow_fill_color = gl_color_shadow (shadow_color_node->color, shadow_opacity, fill_color_node->color);
+       shadow_line_color = gl_color_shadow (shadow_color_node->color,
+                                            shadow_opacity,
+                                            line_color_node->color);
+       shadow_fill_color = gl_color_shadow (shadow_color_node->color,
+                                            shadow_opacity,
+                                            fill_color_node->color);
 
        /* Create analogous canvas items. */
        view_box->private->shadow_item =
@@ -339,19 +343,23 @@ update_canvas_item_from_object_cb (glLabelObject *object,
                shadow_color_node->color = GL_COLOR_SHADOW_MERGE_DEFAULT;
        }
        shadow_opacity = gl_label_object_get_shadow_opacity (GL_LABEL_OBJECT (object));
-       shadow_line_color = gl_color_shadow (shadow_color_node->color, shadow_opacity, line_color_node->color);
-       shadow_fill_color = gl_color_shadow (shadow_color_node->color, shadow_opacity, fill_color_node->color);
+       shadow_line_color = gl_color_shadow (shadow_color_node->color,
+                                            shadow_opacity,
+                                            line_color_node->color);
+       shadow_fill_color = gl_color_shadow (shadow_color_node->color,
+                                            shadow_opacity,
+                                            fill_color_node->color);
 
        /* Adjust appearance of analogous canvas items. */
        gnome_canvas_item_set (view_box->private->shadow_item,
-                                        "x1", shadow_x,
-                                        "y1", shadow_y,
-                                        "x2", shadow_x + w + DELTA,
-                                        "y2", shadow_y + h + DELTA,
-                                        "width_units", line_width,
-                                        "outline_color_rgba", shadow_line_color,
-                                        "fill_color_rgba", shadow_fill_color,
-                                        NULL);
+                              "x1", shadow_x,
+                              "y1", shadow_y,
+                              "x2", shadow_x + w + DELTA,
+                              "y2", shadow_y + h + DELTA,
+                              "width_units", line_width,
+                              "outline_color_rgba", shadow_line_color,
+                              "fill_color_rgba", shadow_fill_color,
+                              NULL);
 
        if (shadow_state)
        {
@@ -529,6 +537,8 @@ update_editor_from_label_cb (glLabel        *label,
                                           label_width, label_height);
        gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
                                       label_width, label_height);
+       gl_object_editor_set_max_shadow_offset (GL_OBJECT_EDITOR (editor),
+                                               label_width, label_height);
        
        merge = gl_label_get_merge (label);
        gl_object_editor_set_key_names (editor, merge);