+2006-01-19 Jim Evins <evins@snaught.com>
+
+ * src/merge-evolution.c: (gl_merge_evolution_get_key_list):
+ Initialize key_list to NULL.
+ * data/glade/object-editor.glade:
+ * src/Makefile.am:
+ * src/color.c:
+ * src/color.h:
+ * src/label-object.c:
+ * src/label-object.h:
+ * src/object-editor-fill-page.c:
+ * src/object-editor-private.h:
+ * src/object-editor.c:
+ * src/object-editor.h:
+ * src/xml-label.c:
+ Created infrastructure for shadow support.
+ * src/view-box.c:
+ * src/print.c:
+ Initial shadow support in box object only.
+
2006-01-05 Jim Evins <evins@snaught.com>
* src/merge-properties-dialog.c: (src_changed_cb):
<property name="type">tab</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkVBox" id="shadow_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="shadow_enable_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Enable shadow</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkTable" id="shadow_controls_table">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">12</property>
+ <property name="column_spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label40">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">X Offset:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label41">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Y Offset:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label46">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Opacity:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox55">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="shadow_y_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.00999999977648</property>
+ <property name="digits">2</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 100 0.00999999977648 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="shadow_y_units_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">inches</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox56">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="shadow_opacity_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label47">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">%</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label45">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.140000000596</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox57">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="shadow_color_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes"></property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox58">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="Custom" id="shadow_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="int1">2</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 16 Nov 2003 06:52:23 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox59">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="shadow_key_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Key:</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">shadow_color_radio</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox60">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkComboBox" id="shadow_key_combo">
+ <property name="visible">True</property>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox54">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkSpinButton" id="shadow_x_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.00999999977648</property>
+ <property name="digits">2</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 100 0.00999999977648 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="shadow_x_units_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">inches</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="shadow_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Shadow</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
object-editor-edit-page.c \
object-editor-bc-page.c \
object-editor-data-page.c \
+ object-editor-shadow-page.c \
print.c \
print.h \
print-dialog.c \
return color;
}
+/*****************************************************************************/
+/* Resolve actual shadow color by adjusting opacity. */
+/*****************************************************************************/
+guint
+gl_color_shadow (guint base_color,
+ gdouble opacity,
+ guint object_color)
+{
+ guint color;
+
+ color = gl_color_set_opacity (base_color,
+ opacity * GL_COLOR_F_ALPHA (object_color));
+
+ return color;
+}
+
/****************************************************************************/
/* Create a single color node with default color. */
/****************************************************************************/
#define GL_COLOR(r,g,b) GNOME_CANVAS_COLOR(r,g,b)
#define GL_COLOR_A(r,g,b,a) GNOME_CANVAS_COLOR_A(r,g,b,a)
-#define GL_COLOR_NONE GL_COLOR_A(0,0,0,0)
-#define GL_COLOR_FILL_MERGE_DEFAULT GL_COLOR_A(255,255,255,128)
-#define GL_COLOR_MERGE_DEFAULT GL_COLOR_A(0,0,0,128)
+#define GL_COLOR_NONE GL_COLOR_A(0,0,0,0)
+#define GL_COLOR_FILL_MERGE_DEFAULT GL_COLOR_A(255,255,255,128)
+#define GL_COLOR_MERGE_DEFAULT GL_COLOR_A(0,0,0,128)
+#define GL_COLOR_SHADOW_MERGE_DEFAULT GL_COLOR_A(0,0,0,255)
#define GL_COLOR_I_RED(x) (((x)>>24) & 0xff)
#define GL_COLOR_I_GREEN(x) (((x)>>16) & 0xff)
GdkColor *gl_color_to_gdk_color (guint color);
guint gl_color_from_gdk_color (GdkColor *gdk_color);
+guint gl_color_shadow (guint base_color,
+ gdouble opacity,
+ guint object_color);
+
glColorNode *gl_color_node_new_default ();
glColorNode *gl_color_node_dup (glColorNode *color_node);
#include "debug.h"
+
+/*========================================================*/
+/* Private defines. */
+/*========================================================*/
+
+#define DEFAULT_SHADOW_X_OFFSET (5.0)
+#define DEFAULT_SHADOW_Y_OFFSET (5.0)
+#define DEFAULT_SHADOW_OPACITY (0.5)
+
/*========================================================*/
/* Private types. */
/*========================================================*/
gdouble affine[6];
gdouble aspect_ratio;
+
+ gboolean shadow_state;
+ gdouble shadow_x;
+ gdouble shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
};
enum {
art_affine_identity (object->private->affine);
+ object->private->shadow_state = FALSE;
+ object->private->shadow_x = DEFAULT_SHADOW_X_OFFSET;
+ object->private->shadow_y = DEFAULT_SHADOW_Y_OFFSET;
+ object->private->shadow_color_node = gl_color_node_new_default ();
+ object->private->shadow_opacity = DEFAULT_SHADOW_OPACITY;
+
gl_debug (DEBUG_LABEL, "END");
}
glLabelObject *dst_object;
gdouble x, y, w, h;
gdouble affine[6];
+ gboolean shadow_state;
+ gdouble shadow_x, shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
gl_debug (DEBUG_LABEL, "START");
gl_label_object_set_parent (dst_object, label);
- gl_label_object_get_position (src_object, &x, &y);
- gl_label_object_get_size (src_object, &w, &h);
- gl_label_object_get_affine (src_object, affine);
+ gl_label_object_get_position (src_object, &x, &y);
+ gl_label_object_get_size (src_object, &w, &h);
+ gl_label_object_get_affine (src_object, affine);
+ gl_label_object_get_shadow_offset (src_object, &shadow_x, &shadow_y);
+ shadow_color_node = gl_label_object_get_shadow_color (src_object);
+ shadow_opacity = gl_label_object_get_shadow_opacity (src_object);
+ shadow_state = gl_label_object_get_shadow_state (src_object);
gl_label_object_set_position (dst_object, x, y);
gl_label_object_set_size (dst_object, w, h);
gl_label_object_set_affine (dst_object, affine);
+ gl_label_object_set_shadow_offset (dst_object, shadow_x, shadow_y);
+ gl_label_object_set_shadow_color (dst_object, shadow_color_node);
+ gl_label_object_set_shadow_opacity (dst_object, shadow_opacity);
+ gl_label_object_set_shadow_state (dst_object, shadow_state);
+
+ gl_color_node_free (&shadow_color_node);
if ( GL_LABEL_OBJECT_GET_CLASS(src_object)->copy != NULL ) {
return ret;
}
+/****************************************************************************/
+/* Set shadow state of object. */
+/****************************************************************************/
+void
+gl_label_object_set_shadow_state (glLabelObject *object,
+ gboolean state)
+{
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
+
+ if (object->private->shadow_state != state)
+ {
+ object->private->shadow_state = state;
+ gl_label_object_emit_changed (object);
+ }
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+/****************************************************************************/
+/* Get shadow state of object. */
+/****************************************************************************/
+gboolean
+gl_label_object_get_shadow_state (glLabelObject *object)
+{
+ gl_debug (DEBUG_LABEL, "");
+
+ g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), FALSE);
+
+ return object->private->shadow_state;
+}
+
+/****************************************************************************/
+/* Set offset of object's shadow. */
+/****************************************************************************/
+void
+gl_label_object_set_shadow_offset (glLabelObject *object,
+ gdouble x,
+ gdouble y)
+{
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
+
+ if ( (x != object->private->shadow_x) || (y != object->private->shadow_y) )
+ {
+ object->private->shadow_x = x;
+ object->private->shadow_y = y;
+
+ gl_label_object_emit_changed (object);
+ }
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+/****************************************************************************/
+/* Get offset of object's shadow. */
+/****************************************************************************/
+void
+gl_label_object_get_shadow_offset (glLabelObject *object,
+ gdouble *x,
+ gdouble *y)
+{
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
+
+ *x = object->private->shadow_x;
+ *y = object->private->shadow_y;
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+/****************************************************************************/
+/* Set color of object's shadow. */
+/****************************************************************************/
+void
+gl_label_object_set_shadow_color (glLabelObject *object,
+ glColorNode *color_node)
+{
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
+
+ if ( !gl_color_node_equal (object->private->shadow_color_node, color_node ))
+ {
+ gl_color_node_free (&(object->private->shadow_color_node));
+ object->private->shadow_color_node = gl_color_node_dup (color_node);
+ gl_label_object_emit_changed (GL_LABEL_OBJECT(object));
+ }
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+/****************************************************************************/
+/* Get color of object's shadow. */
+/****************************************************************************/
+glColorNode*
+gl_label_object_get_shadow_color (glLabelObject *object)
+{
+ gl_debug (DEBUG_LABEL, "");
+
+ g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), NULL);
+
+ return gl_color_node_dup (object->private->shadow_color_node);
+}
+
+/****************************************************************************/
+/* Set opacity of object's shadow. */
+/****************************************************************************/
+void
+gl_label_object_set_shadow_opacity (glLabelObject *object,
+ gdouble alpha)
+{
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
+
+ if (object->private->shadow_opacity != alpha)
+ {
+ object->private->shadow_opacity = alpha;
+ gl_label_object_emit_changed (object);
+ }
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+/****************************************************************************/
+/* Get opacity of object's shadow. */
+/****************************************************************************/
+gdouble
+gl_label_object_get_shadow_opacity (glLabelObject *object)
+{
+ gl_debug (DEBUG_LABEL, "");
+
+ g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), FALSE);
+
+ return object->private->shadow_opacity;
+}
+
/****************************************************************************/
/* Flip object horizontally. */
/****************************************************************************/
void gl_label_object_get_w2i_affine (glLabelObject *object,
gdouble affine[6]);
+void gl_label_object_set_shadow_state (glLabelObject *object,
+ gboolean state);
+
+void gl_label_object_set_shadow_offset (glLabelObject *object,
+ gdouble x,
+ gdouble y);
+
+void gl_label_object_set_shadow_color (glLabelObject *object,
+ glColorNode *color_node);
+
+void gl_label_object_set_shadow_opacity (glLabelObject *object,
+ gdouble alpha);
+
+gboolean gl_label_object_get_shadow_state (glLabelObject *object);
+
+void gl_label_object_get_shadow_offset (glLabelObject *object,
+ gdouble *x,
+ gdouble *y);
+
+glColorNode* gl_label_object_get_shadow_color (glLabelObject *object);
+
+gdouble gl_label_object_get_shadow_opacity (glLabelObject *object);
+
+
G_END_DECLS
#endif /* __LABEL_OBJECT_H__ */
gl_merge_evolution_get_key_list (glMerge *merge)
{
glMergeEvolution *merge_evolution;
- GList *key_list, *iter;
+ GList *key_list = NULL;
+ GList *iter;
gl_debug (DEBUG_MERGE, "BEGIN");
/* Modify widgets based on configuration */
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->fill_color_radio), TRUE);
gtk_widget_set_sensitive (editor->priv->fill_color_combo, TRUE);
- gtk_widget_set_sensitive (editor->priv->fill_key_combo, FALSE);
+ gtk_widget_set_sensitive (editor->priv->fill_key_combo, FALSE);
gdk_color = gl_color_to_gdk_color (gl_prefs->default_fill_color);
color_combo_set_color (COLOR_COMBO(editor->priv->fill_color_combo), gdk_color);
g_free (gdk_color);
GtkWidget *data_digits_label;
GtkWidget *data_digits_spin;
gboolean data_format_fixed_flag;
+
+ GtkWidget *shadow_page_vbox;
+ GtkWidget *shadow_enable_check;
+ GtkWidget *shadow_controls_table;
+ GtkWidget *shadow_x_spin;
+ GtkWidget *shadow_y_spin;
+ GtkWidget *shadow_x_units_label;
+ GtkWidget *shadow_y_units_label;
+ GtkWidget *shadow_color_radio;
+ GtkWidget *shadow_key_radio;
+ GtkWidget *shadow_color_combo;
+ GtkWidget *shadow_key_combo;
+ GtkWidget *shadow_opacity_spin;
+ gdouble shadow_x;
+ gdouble shadow_y;
+ gdouble shadow_x_max;
+ gdouble shadow_y_max;
+
};
enum {
pages++;
break;
+ case GL_OBJECT_EDITOR_SHADOW_PAGE:
+ gl_object_editor_prepare_shadow_page (editor);
+ pages++;
+ break;
+
default:
g_message ("option = %d", option);
g_assert_not_reached ();
GList *keys;
GtkWidget *combo;
gboolean fixed_flag;
+ gboolean state;
gl_debug (DEBUG_EDITOR, "START");
merge != NULL);
}
- if (editor->priv->text_color_key_combo) {
- gtk_widget_set_sensitive (editor->priv->text_color_key_combo, merge != NULL);
- }
-
- if (editor->priv->text_color_key_radio) {
+ if (editor->priv->text_page_vbox) {
gtk_widget_set_sensitive (editor->priv->text_color_key_radio, merge != NULL);
if (merge == NULL) {
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON(editor->priv->text_color_radio), TRUE);
+ gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE);
+ gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE);
+ } else {
+ state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->priv->text_color_key_radio));
+ gtk_widget_set_sensitive (editor->priv->text_color_combo, !state);
+ gtk_widget_set_sensitive (editor->priv->text_color_key_combo, state);
+
}
- }
-
+ }
+
if (editor->priv->edit_insert_field_button) {
gtk_widget_set_sensitive (editor->priv->edit_insert_field_button,
merge != NULL);
(merge != NULL) && !fixed_flag);
}
- if (editor->priv->fill_key_combo) {
- gtk_widget_set_sensitive (editor->priv->fill_key_combo, merge != NULL);
- }
-
- if (editor->priv->fill_key_radio) {
+ if (editor->priv->fill_page_vbox) {
gtk_widget_set_sensitive (editor->priv->fill_key_radio, merge != NULL);
if (merge == NULL) {
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON(editor->priv->fill_color_radio), TRUE);
+ gtk_widget_set_sensitive (editor->priv->fill_color_combo, TRUE);
+ gtk_widget_set_sensitive (editor->priv->fill_key_combo, FALSE);
+ } else {
+ state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->priv->fill_key_radio));
+ gtk_widget_set_sensitive (editor->priv->fill_color_combo, !state);
+ gtk_widget_set_sensitive (editor->priv->fill_key_combo, state);
+
}
}
-
- if (editor->priv->line_key_combo) {
- gtk_widget_set_sensitive (editor->priv->line_key_combo, merge != NULL);
- }
-
- if (editor->priv->line_key_radio) {
+
+ if (editor->priv->line_page_vbox) {
gtk_widget_set_sensitive (editor->priv->line_key_radio, merge != NULL);
if (merge == NULL) {
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON(editor->priv->line_color_radio), TRUE);
+ gtk_widget_set_sensitive (editor->priv->line_color_combo, TRUE);
+ gtk_widget_set_sensitive (editor->priv->line_key_combo, FALSE);
+ } else {
+ state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->priv->line_key_radio));
+ gtk_widget_set_sensitive (editor->priv->line_color_combo, !state);
+ gtk_widget_set_sensitive (editor->priv->line_key_combo, state);
+
}
}
-
- if (editor->priv->bc_key_combo) {
- gtk_widget_set_sensitive (editor->priv->bc_key_combo, merge != NULL);
- }
-
- if (editor->priv->bc_key_radio) {
+
+ if (editor->priv->bc_page_vbox) {
gtk_widget_set_sensitive (editor->priv->bc_key_radio, merge != NULL);
if (merge == NULL) {
gtk_toggle_button_set_active (
GTK_TOGGLE_BUTTON(editor->priv->bc_color_radio), TRUE);
+ gtk_widget_set_sensitive (editor->priv->bc_color_combo, TRUE);
+ gtk_widget_set_sensitive (editor->priv->bc_key_combo, FALSE);
+ } else {
+ state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->priv->bc_key_radio));
+ gtk_widget_set_sensitive (editor->priv->bc_color_combo, !state);
+ gtk_widget_set_sensitive (editor->priv->bc_key_combo, state);
+
}
- }
-
- keys = gl_merge_get_key_list (merge);
- if ( keys != NULL ) {
+ }
- combo = editor->priv->img_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ if (editor->priv->shadow_page_vbox) {
+ gtk_widget_set_sensitive (editor->priv->shadow_key_radio, merge != NULL);
+ if (merge == NULL) {
+ 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 {
+ state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(editor->priv->shadow_key_radio));
+ gtk_widget_set_sensitive (editor->priv->shadow_color_combo, !state);
+ gtk_widget_set_sensitive (editor->priv->shadow_key_combo, state);
+
}
+ }
- combo = editor->priv->edit_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ keys = gl_merge_get_key_list (merge);
+ if ( keys == NULL ) {
+ keys = g_list_append (keys, "");
+ }
- combo = editor->priv->data_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
-
- combo = editor->priv->fill_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ combo = editor->priv->img_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- combo = editor->priv->text_color_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ combo = editor->priv->edit_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- combo = editor->priv->line_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
-
- combo = editor->priv->bc_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ combo = editor->priv->data_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- gl_merge_free_key_list (&keys);
- } else {
-
- keys = g_list_append (keys, "");
+ combo = editor->priv->fill_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- combo = editor->priv->img_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ combo = editor->priv->text_color_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- combo = editor->priv->edit_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
-
- combo = editor->priv->data_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ combo = editor->priv->line_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- combo = editor->priv->fill_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ combo = editor->priv->bc_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- combo = editor->priv->text_color_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
+ combo = editor->priv->shadow_key_combo;
+ if (combo) {
+ gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
+ }
- combo = editor->priv->line_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
-
- combo = editor->priv->bc_key_combo;
- if (combo) {
- gl_util_combo_box_set_strings (GTK_COMBO_BOX (combo), keys);
- }
-
- g_list_free (keys);
- }
+ gl_merge_free_key_list (&keys);
gl_debug (DEBUG_EDITOR, "END");
}
position_prefs_changed_cb (editor);
}
+ if (editor->priv->shadow_x_spin) {
+ shadow_prefs_changed_cb (editor);
+ }
+
gl_debug (DEBUG_EDITOR, "END");
}
GL_OBJECT_EDITOR_EDIT_PAGE,
GL_OBJECT_EDITOR_BC_PAGE,
GL_OBJECT_EDITOR_DATA_PAGE,
+ GL_OBJECT_EDITOR_SHADOW_PAGE,
} glObjectEditorOption;
#define GL_TYPE_OBJECT_EDITOR (gl_object_editor_get_type ())
glTextNode *gl_object_editor_get_data (glObjectEditor *editor);
+/*
+ * Shadow Page
+ */
+void gl_object_editor_set_shadow_state (glObjectEditor *editor,
+ gboolean state);
+
+void gl_object_editor_set_shadow_offset (glObjectEditor *editor,
+ gdouble x,
+ gdouble y);
+
+void gl_object_editor_set_shadow_color (glObjectEditor *editor,
+ gboolean merge_flag,
+ glColorNode *color_node);
+
+void gl_object_editor_set_shadow_opacity (glObjectEditor *editor,
+ gdouble alpha);
+
+void gl_object_editor_set_max_shadow_offset(glObjectEditor *editor,
+ gdouble x_max,
+ gdouble y_max);
+
+
+gboolean gl_object_editor_get_shadow_state (glObjectEditor *editor);
+
+void gl_object_editor_get_shadow_offset (glObjectEditor *editor,
+ gdouble *x,
+ gdouble *y);
+
+glColorNode* gl_object_editor_get_shadow_color (glObjectEditor *editor);
+
+gdouble gl_object_editor_get_shadow_opacity (glObjectEditor *editor);
+
+
G_END_DECLS
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
/*
* (GLABELS) Label and Business Card Creation program for GNOME
*
static void draw_box_object (PrintInfo *pi,
glLabelBox *object,
- glMergeRecord *record);
+ glMergeRecord *record);
static void draw_line_object (PrintInfo *pi,
glLabelLine *object,
- glMergeRecord *record);
+ glMergeRecord *record);
static void draw_ellipse_object (PrintInfo *pi,
glLabelEllipse *object,
- glMergeRecord *record);
+ glMergeRecord *record);
static void draw_image_object (PrintInfo *pi,
glLabelImage *object,
glColorNode *line_color_node;
glColorNode *fill_color_node;
guint fill_color;
+ gboolean shadow_state;
+ gdouble shadow_x, shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
+ guint shadow_line_color;
+ guint shadow_fill_color;
gl_debug (DEBUG_PRINT, "START");
fill_color = gl_color_node_expand (fill_color_node, record);
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
+
+ shadow_state = gl_label_object_get_shadow_state (GL_LABEL_OBJECT (object));
+ gl_label_object_get_shadow_offset (GL_LABEL_OBJECT (object), &shadow_x, &shadow_y);
+ shadow_color_node = gl_label_object_get_shadow_color (GL_LABEL_OBJECT (object));
+ if (shadow_color_node->field_flag)
+ {
+ 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);
+ shadow_fill_color = gl_color_shadow (shadow_color_node->color, shadow_opacity, fill_color);
+ gl_color_node_free (&shadow_color_node);
+ if (shadow_state)
+ {
+ /* Draw fill shadow */
+ create_rectangle_path (pi->pc, shadow_x, shadow_y, w, h);
+ gnome_print_setrgbcolor (pi->pc,
+ GL_COLOR_F_RED (shadow_fill_color),
+ GL_COLOR_F_GREEN (shadow_fill_color),
+ GL_COLOR_F_BLUE (shadow_fill_color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (shadow_fill_color));
+ gnome_print_fill (pi->pc);
+
+ /* Draw outline shadow */
+ create_rectangle_path (pi->pc, shadow_x, shadow_y, w, h);
+ gnome_print_setrgbcolor (pi->pc,
+ GL_COLOR_F_RED (shadow_line_color),
+ GL_COLOR_F_GREEN (shadow_line_color),
+ GL_COLOR_F_BLUE (shadow_line_color));
+ gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (shadow_line_color));
+ gnome_print_setlinewidth (pi->pc, line_width);
+ gnome_print_stroke (pi->pc);
+ }
+
/* Paint fill color */
create_rectangle_path (pi->pc, 0.0, 0.0, w, h);
gnome_print_setrgbcolor (pi->pc,
/*========================================================*/
struct _glViewBoxPrivate {
- GnomeCanvasItem *item;
+ GnomeCanvasItem *object_item;
+ GnomeCanvasItem *shadow_item;
};
/*========================================================*/
glColorNode *line_color_node;
gdouble w, h;
glColorNode *fill_color_node;
+ gboolean shadow_state;
+ gdouble shadow_x, shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
+ guint shadow_line_color;
+ guint shadow_fill_color;
gl_debug (DEBUG_VIEW, "START");
g_return_if_fail (object && GL_IS_LABEL_BOX (object));
{
fill_color_node->color = GL_COLOR_FILL_MERGE_DEFAULT;
}
+ shadow_state = gl_label_object_get_shadow_state (GL_LABEL_OBJECT (object));
+ gl_label_object_get_shadow_offset (GL_LABEL_OBJECT (object), &shadow_x, &shadow_y);
+ shadow_color_node = gl_label_object_get_shadow_color (GL_LABEL_OBJECT (object));
+ if (shadow_color_node->field_flag)
+ {
+ 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);
+
+ /* Create analogous canvas items. */
+ view_box->private->shadow_item =
+ gl_view_object_item_new (GL_VIEW_OBJECT(view_box),
+ gnome_canvas_rect_get_type (),
+ "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);
- /* Create analogous canvas item. */
- view_box->private->item =
+ if (!shadow_state)
+ {
+ gnome_canvas_item_hide (view_box->private->shadow_item);
+ }
+
+ view_box->private->object_item =
gl_view_object_item_new (GL_VIEW_OBJECT(view_box),
gnome_canvas_rect_get_type (),
"x1", 0.0,
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
+ gl_color_node_free (&shadow_color_node);
g_signal_connect (G_OBJECT (object), "changed",
G_CALLBACK (update_canvas_item_from_object_cb), view_box);
GL_OBJECT_EDITOR_SIZE_PAGE,
GL_OBJECT_EDITOR_FILL_PAGE,
GL_OBJECT_EDITOR_LINE_PAGE,
+ GL_OBJECT_EDITOR_SHADOW_PAGE,
0);
/* Update */
glColorNode *line_color_node;
gdouble w, h;
glColorNode *fill_color_node;
+ gboolean shadow_state;
+ gdouble shadow_x, shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
+ guint shadow_line_color;
+ guint shadow_fill_color;
gl_debug (DEBUG_VIEW, "START");
{
fill_color_node->color = GL_COLOR_FILL_MERGE_DEFAULT;
}
+ shadow_state = gl_label_object_get_shadow_state (GL_LABEL_OBJECT (object));
+ gl_label_object_get_shadow_offset (GL_LABEL_OBJECT (object), &shadow_x, &shadow_y);
+ shadow_color_node = gl_label_object_get_shadow_color (GL_LABEL_OBJECT (object));
+ if (shadow_color_node->field_flag)
+ {
+ 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);
+
+ /* 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);
- /* Adjust appearance of analogous canvas item. */
- gnome_canvas_item_set (view_box->private->item,
+ if (shadow_state)
+ {
+ gnome_canvas_item_show (view_box->private->shadow_item);
+ }
+ else
+ {
+ gnome_canvas_item_hide (view_box->private->shadow_item);
+ }
+
+ gnome_canvas_item_set (view_box->private->object_item,
"x2", w + DELTA,
"y2", h + DELTA,
"width_units", line_width,
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
+ gl_color_node_free (&shadow_color_node);
gl_debug (DEBUG_VIEW, "END");
}
glColorNode *line_color_node;
gdouble line_width;
glColorNode *fill_color_node;
+ gboolean shadow_state;
+ gdouble shadow_x, shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
+
gl_debug (DEBUG_VIEW, "START");
line_width = gl_object_editor_get_line_width (editor);
gl_label_object_set_line_width (object, line_width);
+ shadow_state = gl_object_editor_get_shadow_state (editor);
+ gl_label_object_set_shadow_state (object, shadow_state);
+
+ gl_object_editor_get_shadow_offset (editor, &shadow_x, &shadow_y);
+ gl_label_object_set_shadow_offset (object, shadow_x, shadow_y);
+
+ shadow_color_node = gl_object_editor_get_shadow_color (editor);
+ gl_label_object_set_shadow_color (object, shadow_color_node);
+ gl_color_node_free (&shadow_color_node);
+
+ shadow_opacity = gl_object_editor_get_shadow_opacity (editor);
+ gl_label_object_set_shadow_opacity (object, shadow_opacity);
g_signal_handlers_unblock_by_func (G_OBJECT(object),
update_editor_from_object_cb,
glColorNode *line_color_node;
gdouble line_width;
glColorNode *fill_color_node;
+ gboolean shadow_state;
+ gdouble shadow_x, shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
glMerge *merge;
gl_debug (DEBUG_VIEW, "START");
line_width = gl_label_object_get_line_width (GL_LABEL_OBJECT(object));
gl_object_editor_set_line_width (editor, line_width);
+ shadow_state = gl_label_object_get_shadow_state (object);
+ gl_object_editor_set_shadow_state (editor, shadow_state);
+
+ gl_label_object_get_shadow_offset (object, &shadow_x, &shadow_y);
+ gl_object_editor_set_shadow_offset (editor, shadow_x, shadow_y);
+
+ shadow_color_node = gl_label_object_get_shadow_color (object);
+ gl_object_editor_set_shadow_color (editor, (merge != NULL), shadow_color_node);
+ gl_color_node_free (&shadow_color_node);
+
+ shadow_opacity = gl_label_object_get_shadow_opacity (object);
+ gl_object_editor_set_shadow_opacity (editor, shadow_opacity);
+
gl_debug (DEBUG_VIEW, "END");
}
static void xml_parse_toplevel_span (xmlNodePtr node,
glLabelObject *object);
+static void xml_parse_affine_attrs (xmlNodePtr node,
+ glLabelObject *object);
+
+static void xml_parse_shadow_attrs (xmlNodePtr node,
+ glLabelObject *object);
static xmlDocPtr xml_label_to_doc (glLabel *label,
glXMLLabelStatus *status);
xmlNsPtr ns,
glLabelText *object_text);
+static void xml_create_affine_attrs (xmlNodePtr node,
+ glLabelObject *object);
+
+static void xml_create_shadow_attrs (xmlNodePtr node,
+ glLabelObject *object);
+
/****************************************************************************/
/* Open and read label from xml file. */
gchar *string;
GtkJustification just;
gboolean auto_shrink;
- gdouble affine[6];
xmlNodePtr child;
gl_debug (DEBUG_XML, "START");
gl_label_text_set_auto_shrink (GL_LABEL_TEXT(object), auto_shrink);
/* affine attrs */
- affine[0] = gl_xml_get_prop_double (node, "a0", 0.0);
- affine[1] = gl_xml_get_prop_double (node, "a1", 0.0);
- affine[2] = gl_xml_get_prop_double (node, "a2", 0.0);
- affine[3] = gl_xml_get_prop_double (node, "a3", 0.0);
- affine[4] = gl_xml_get_prop_double (node, "a4", 0.0);
- affine[5] = gl_xml_get_prop_double (node, "a5", 0.0);
- gl_label_object_set_affine (GL_LABEL_OBJECT(object), affine);
+ xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
+
+ /* shadow attrs */
+ xml_parse_shadow_attrs (node, GL_LABEL_OBJECT(object));
/* Process children */
for (child = node->xmlChildrenNode; child != NULL; child = child->next) {
gdouble w, h;
gdouble line_width;
glColorNode *line_color_node;
- gdouble affine[6];
gchar *string;
glColorNode *fill_color_node;
gl_color_node_free (&fill_color_node);
/* affine attrs */
- affine[0] = gl_xml_get_prop_double (node, "a0", 0.0);
- affine[1] = gl_xml_get_prop_double (node, "a1", 0.0);
- affine[2] = gl_xml_get_prop_double (node, "a2", 0.0);
- affine[3] = gl_xml_get_prop_double (node, "a3", 0.0);
- affine[4] = gl_xml_get_prop_double (node, "a4", 0.0);
- affine[5] = gl_xml_get_prop_double (node, "a5", 0.0);
- gl_label_object_set_affine (GL_LABEL_OBJECT(object), affine);
+ xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
+
+ /* shadow attrs */
+ xml_parse_shadow_attrs (node, GL_LABEL_OBJECT(object));
gl_debug (DEBUG_XML, "END");
}
gdouble w, h;
gdouble line_width;
glColorNode *line_color_node;
- gdouble affine[6];
gchar *string;
glColorNode *fill_color_node;
gl_color_node_free (&fill_color_node);
/* affine attrs */
- affine[0] = gl_xml_get_prop_double (node, "a0", 0.0);
- affine[1] = gl_xml_get_prop_double (node, "a1", 0.0);
- affine[2] = gl_xml_get_prop_double (node, "a2", 0.0);
- affine[3] = gl_xml_get_prop_double (node, "a3", 0.0);
- affine[4] = gl_xml_get_prop_double (node, "a4", 0.0);
- affine[5] = gl_xml_get_prop_double (node, "a5", 0.0);
- gl_label_object_set_affine (GL_LABEL_OBJECT(object), affine);
+ xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
+
+ /* shadow attrs */
+ xml_parse_shadow_attrs (node, GL_LABEL_OBJECT(object));
gl_debug (DEBUG_XML, "END");
}
gdouble dx, dy;
gdouble line_width;
glColorNode *line_color_node;
- gdouble affine[6];
gchar *string;
gl_debug (DEBUG_XML, "START");
gl_color_node_free (&line_color_node);
/* affine attrs */
- affine[0] = gl_xml_get_prop_double (node, "a0", 0.0);
- affine[1] = gl_xml_get_prop_double (node, "a1", 0.0);
- affine[2] = gl_xml_get_prop_double (node, "a2", 0.0);
- affine[3] = gl_xml_get_prop_double (node, "a3", 0.0);
- affine[4] = gl_xml_get_prop_double (node, "a4", 0.0);
- affine[5] = gl_xml_get_prop_double (node, "a5", 0.0);
- gl_label_object_set_affine (GL_LABEL_OBJECT(object), affine);
+ xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
+
+ /* shadow attrs */
+ xml_parse_shadow_attrs (node, GL_LABEL_OBJECT(object));
gl_debug (DEBUG_XML, "END");
}
gdouble w, h;
gchar *string;
glTextNode *filename;
- gdouble affine[6];
gl_debug (DEBUG_XML, "START");
gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
/* affine attrs */
- affine[0] = gl_xml_get_prop_double (node, "a0", 0.0);
- affine[1] = gl_xml_get_prop_double (node, "a1", 0.0);
- affine[2] = gl_xml_get_prop_double (node, "a2", 0.0);
- affine[3] = gl_xml_get_prop_double (node, "a3", 0.0);
- affine[4] = gl_xml_get_prop_double (node, "a4", 0.0);
- affine[5] = gl_xml_get_prop_double (node, "a5", 0.0);
- gl_label_object_set_affine (GL_LABEL_OBJECT(object), affine);
+ xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
+
+ /* shadow attrs */
+ xml_parse_shadow_attrs (node, GL_LABEL_OBJECT(object));
gl_debug (DEBUG_XML, "END");
}
gboolean checksum_flag;
glColorNode *color_node;
guint format_digits;
- gdouble affine[6];
gl_debug (DEBUG_XML, "START");
}
/* affine attrs */
- affine[0] = gl_xml_get_prop_double (node, "a0", 0.0);
- affine[1] = gl_xml_get_prop_double (node, "a1", 0.0);
- affine[2] = gl_xml_get_prop_double (node, "a2", 0.0);
- affine[3] = gl_xml_get_prop_double (node, "a3", 0.0);
- affine[4] = gl_xml_get_prop_double (node, "a4", 0.0);
- affine[5] = gl_xml_get_prop_double (node, "a5", 0.0);
- gl_label_object_set_affine (GL_LABEL_OBJECT(object), affine);
+ xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
+
+ /* shadow attrs */
+ xml_parse_shadow_attrs (node, GL_LABEL_OBJECT(object));
gl_debug (DEBUG_XML, "END");
}
gl_debug (DEBUG_XML, "END");
}
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Parse affine attributes. */
+/*--------------------------------------------------------------------------*/
+static void
+xml_parse_affine_attrs (xmlNodePtr node,
+ glLabelObject *object)
+{
+ gdouble affine[6];
+
+ affine[0] = gl_xml_get_prop_double (node, "a0", 0.0);
+ affine[1] = gl_xml_get_prop_double (node, "a1", 0.0);
+ affine[2] = gl_xml_get_prop_double (node, "a2", 0.0);
+ affine[3] = gl_xml_get_prop_double (node, "a3", 0.0);
+ affine[4] = gl_xml_get_prop_double (node, "a4", 0.0);
+ affine[5] = gl_xml_get_prop_double (node, "a5", 0.0);
+
+ gl_label_object_set_affine (object, affine);
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Parse shadow attributes. */
+/*--------------------------------------------------------------------------*/
+static void
+xml_parse_shadow_attrs (xmlNodePtr node,
+ glLabelObject *object)
+{
+ gboolean shadow_state;
+ gdouble shadow_x;
+ gdouble shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
+ gchar *string;
+
+ shadow_state = gl_xml_get_prop_boolean (node, "shadow", FALSE);
+ gl_label_object_set_shadow_state (object, shadow_state);
+
+ if (shadow_state)
+ {
+ shadow_x = gl_xml_get_prop_length (node, "shadow_x", 0.0);
+ shadow_y = gl_xml_get_prop_length (node, "shadow_y", 0.0);
+ gl_label_object_set_shadow_offset (object, shadow_x, shadow_y);
+
+ shadow_color_node = gl_color_node_new_default ();
+ string = gl_xml_get_prop_string (node, "shadow_color_field", NULL);
+ if ( string ) {
+ shadow_color_node->field_flag = TRUE;
+ shadow_color_node->key = string;
+ } else {
+ shadow_color_node->color = gl_xml_get_prop_uint (node, "shadow_color", 0);
+ }
+ gl_label_object_set_shadow_color (object, shadow_color_node);
+ gl_color_node_free (&shadow_color_node);
+
+ shadow_opacity = gl_xml_get_prop_double (node, "shadow_opacity", 1.0);
+ gl_label_object_set_shadow_opacity (object, shadow_opacity);
+ }
+}
+
/****************************************************************************/
/* Save label to xml label file. */
/****************************************************************************/
gdouble w, h;
GtkJustification just;
gboolean auto_shrink;
- gdouble affine[6];
gl_debug (DEBUG_XML, "START");
gl_xml_set_prop_boolean (node, "auto_shrink", auto_shrink);
/* affine attrs */
- gl_label_object_get_affine (object, affine);
- gl_xml_set_prop_double (node, "a0", affine[0]);
- gl_xml_set_prop_double (node, "a1", affine[1]);
- gl_xml_set_prop_double (node, "a2", affine[2]);
- gl_xml_set_prop_double (node, "a3", affine[3]);
- gl_xml_set_prop_double (node, "a4", affine[4]);
- gl_xml_set_prop_double (node, "a5", affine[5]);
+ xml_create_affine_attrs (node, object);
+
+ /* shadow attrs */
+ xml_create_shadow_attrs (node, object);
/* Add children */
xml_create_toplevel_span (node, ns, GL_LABEL_TEXT(object));
gdouble w, h;
gdouble line_width;
glColorNode *line_color_node;
- gdouble affine[6];
glColorNode *fill_color_node;
gl_debug (DEBUG_XML, "START");
gl_color_node_free (&fill_color_node);
/* affine attrs */
- gl_label_object_get_affine (object, affine);
- gl_xml_set_prop_double (node, "a0", affine[0]);
- gl_xml_set_prop_double (node, "a1", affine[1]);
- gl_xml_set_prop_double (node, "a2", affine[2]);
- gl_xml_set_prop_double (node, "a3", affine[3]);
- gl_xml_set_prop_double (node, "a4", affine[4]);
- gl_xml_set_prop_double (node, "a5", affine[5]);
+ xml_create_affine_attrs (node, object);
+
+ /* shadow attrs */
+ xml_create_shadow_attrs (node, object);
gl_debug (DEBUG_XML, "END");
}
gdouble w, h;
gdouble line_width;
glColorNode *line_color_node;
- gdouble affine[6];
glColorNode *fill_color_node;
gl_debug (DEBUG_XML, "START");
gl_color_node_free (&fill_color_node);
/* affine attrs */
- gl_label_object_get_affine (object, affine);
- gl_xml_set_prop_double (node, "a0", affine[0]);
- gl_xml_set_prop_double (node, "a1", affine[1]);
- gl_xml_set_prop_double (node, "a2", affine[2]);
- gl_xml_set_prop_double (node, "a3", affine[3]);
- gl_xml_set_prop_double (node, "a4", affine[4]);
- gl_xml_set_prop_double (node, "a5", affine[5]);
+ xml_create_affine_attrs (node, object);
+
+ /* shadow attrs */
+ xml_create_shadow_attrs (node, object);
gl_debug (DEBUG_XML, "END");
}
gdouble dx, dy;
gdouble line_width;
glColorNode *line_color_node;
- gdouble affine[6];
gl_debug (DEBUG_XML, "START");
/* affine attrs */
- gl_label_object_get_affine (object, affine);
- gl_xml_set_prop_double (node, "a0", affine[0]);
- gl_xml_set_prop_double (node, "a1", affine[1]);
- gl_xml_set_prop_double (node, "a2", affine[2]);
- gl_xml_set_prop_double (node, "a3", affine[3]);
- gl_xml_set_prop_double (node, "a4", affine[4]);
- gl_xml_set_prop_double (node, "a5", affine[5]);
+ xml_create_affine_attrs (node, object);
+
+ /* shadow attrs */
+ xml_create_shadow_attrs (node, object);
gl_debug (DEBUG_XML, "END");
}
gdouble x, y;
gdouble w, h;
glTextNode *filename;
- gdouble affine[6];
gl_debug (DEBUG_XML, "START");
gl_text_node_free (&filename);
/* affine attrs */
- gl_label_object_get_affine (object, affine);
- gl_xml_set_prop_double (node, "a0", affine[0]);
- gl_xml_set_prop_double (node, "a1", affine[1]);
- gl_xml_set_prop_double (node, "a2", affine[2]);
- gl_xml_set_prop_double (node, "a3", affine[3]);
- gl_xml_set_prop_double (node, "a4", affine[4]);
- gl_xml_set_prop_double (node, "a5", affine[5]);
+ xml_create_affine_attrs (node, object);
+
+ /* shadow attrs */
+ xml_create_shadow_attrs (node, object);
gl_debug (DEBUG_XML, "END");
}
gboolean checksum_flag;
glColorNode *color_node;
guint format_digits;
- gdouble affine[6];
gl_debug (DEBUG_XML, "START");
gl_text_node_free (&text_node);
/* affine attrs */
- gl_label_object_get_affine (object, affine);
- gl_xml_set_prop_double (node, "a0", affine[0]);
- gl_xml_set_prop_double (node, "a1", affine[1]);
- gl_xml_set_prop_double (node, "a2", affine[2]);
- gl_xml_set_prop_double (node, "a3", affine[3]);
- gl_xml_set_prop_double (node, "a4", affine[4]);
- gl_xml_set_prop_double (node, "a5", affine[5]);
+ xml_create_affine_attrs (node, object);
+
+ /* shadow attrs */
+ xml_create_shadow_attrs (node, object);
gl_debug (DEBUG_XML, "END");
}
g_free (font_family);
}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Create affine attributes. */
+/*--------------------------------------------------------------------------*/
+static void
+xml_create_affine_attrs (xmlNodePtr node,
+ glLabelObject *object)
+{
+ gdouble affine[6];
+
+ gl_label_object_get_affine (object, affine);
+
+ gl_xml_set_prop_double (node, "a0", affine[0]);
+ gl_xml_set_prop_double (node, "a1", affine[1]);
+ gl_xml_set_prop_double (node, "a2", affine[2]);
+ gl_xml_set_prop_double (node, "a3", affine[3]);
+ gl_xml_set_prop_double (node, "a4", affine[4]);
+ gl_xml_set_prop_double (node, "a5", affine[5]);
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Create shadow attributes. */
+/*--------------------------------------------------------------------------*/
+static void
+xml_create_shadow_attrs (xmlNodePtr node,
+ glLabelObject *object)
+{
+ gboolean shadow_state;
+ gdouble shadow_x;
+ gdouble shadow_y;
+ glColorNode *shadow_color_node;
+ gdouble shadow_opacity;
+
+ shadow_state = gl_label_object_get_shadow_state (object);
+
+ if (shadow_state)
+ {
+ gl_xml_set_prop_boolean (node, "shadow", shadow_state);
+
+ gl_label_object_get_shadow_offset (object, &shadow_x, &shadow_y);
+ gl_xml_set_prop_length (node, "shadow_x", shadow_x);
+ gl_xml_set_prop_length (node, "shadow_y", shadow_y);
+
+ shadow_color_node = gl_label_object_get_shadow_color (object);
+ if (shadow_color_node->field_flag)
+ {
+ gl_xml_set_prop_string (node, "shadow_color_field", shadow_color_node->key);
+ }
+ else
+ {
+ gl_xml_set_prop_uint_hex (node, "shadow_color", shadow_color_node->color);
+ }
+ gl_color_node_free (&shadow_color_node);
+
+ shadow_opacity = gl_label_object_get_shadow_opacity (object);
+ gl_xml_set_prop_double (node, "shadow_opacity", shadow_opacity);
+ }
+}
+
+