template = lgl_db_lookup_template_from_name (sheet_name);
label = GL_LABEL(gl_label_new ());
- gl_label_set_template (label, template);
- gl_label_set_rotate_flag (label, rotate_flag);
+ gl_label_set_template (label, template, FALSE);
+ gl_label_set_rotate_flag (label, rotate_flag, FALSE);
lgl_template_free (template);
template = lgl_db_lookup_template_from_name (sheet_name);
label = GL_LABEL(g_object_get_data (G_OBJECT (dialog), "label"));
- gl_label_set_template (label, template);
- gl_label_set_rotate_flag (label, rotate_flag);
+
+ gl_label_set_template (label, template, TRUE);
+ gl_label_set_rotate_flag (label, rotate_flag, TRUE);
break;
#include <libglabels/libglabels.h>
#include "merge-init.h"
+#include "template-history.h"
#include "xml-label.h"
#include "print.h"
#include "print-op.h"
if (input != NULL) {
if (merge != NULL) {
gl_merge_set_src(merge, input);
- gl_label_set_merge(label, merge);
+ gl_label_set_merge(label, merge, FALSE);
} else {
fprintf ( stderr,
_("cannot perform document merge with glabels file %s\n"),
gdouble *h);
static void set_line_color (glLabelObject *object,
- glColorNode *line_color);
+ glColorNode *line_color,
+ gboolean checkpoint);
static glColorNode *get_line_color (glLabelObject *object);
/* NEW label "barcode" object. */
/*****************************************************************************/
GObject *
-gl_label_barcode_new (glLabel *label)
+gl_label_barcode_new (glLabel *label,
+ gboolean checkpoint)
{
glLabelBarcode *lbc;
glColorNode *line_color_node;
if (label != NULL)
{
- gl_label_object_set_parent (GL_LABEL_OBJECT(lbc), label);
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Create barcode object"));
+ }
line_color_node = gl_color_node_new_default ();
line_color_node->color = gl_label_get_default_line_color(label);
lbc->priv->color_node = line_color_node;
+
+ gl_label_add_object (label, GL_LABEL_OBJECT (lbc));
+ gl_label_object_set_parent (GL_LABEL_OBJECT (lbc), label);
}
return G_OBJECT (lbc);
gl_label_barcode_get_props (lbc, &id, &text_flag, &checksum_flag, &format_digits);
color_node = get_line_color (src_object);
- gl_label_barcode_set_data (new_lbc, text_node);
- gl_label_barcode_set_props (new_lbc, id, text_flag, checksum_flag, format_digits);
- set_line_color (dst_object, color_node);
+ gl_label_barcode_set_data (new_lbc, text_node, FALSE);
+ gl_label_barcode_set_props (new_lbc, id, text_flag, checksum_flag, format_digits, FALSE);
+ set_line_color (dst_object, color_node, FALSE);
gl_color_node_free (&color_node);
gl_text_node_free (&text_node);
/*****************************************************************************/
void
gl_label_barcode_set_data (glLabelBarcode *lbc,
- glTextNode *text_node)
+ glTextNode *text_node,
+ gboolean checkpoint)
{
+ glLabel *label;
+
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc));
- if (!gl_text_node_equal (lbc->priv->text_node, text_node)) {
-
+ if (!gl_text_node_equal (lbc->priv->text_node, text_node))
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lbc));
+ gl_label_checkpoint (label, _("Barcode data"));
+ }
+
gl_text_node_free (&lbc->priv->text_node);
lbc->priv->text_node = gl_text_node_dup (text_node);
gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc));
-
}
gl_debug (DEBUG_LABEL, "END");
gchar *id,
gboolean text_flag,
gboolean checksum_flag,
- guint format_digits)
+ guint format_digits,
+ gboolean checkpoint)
{
+ glLabel *label;
+
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc));
|| (g_ascii_strcasecmp (lbc->priv->id, id) != 0)
|| (lbc->priv->text_flag != text_flag)
|| (lbc->priv->checksum_flag != checksum_flag)
- || (lbc->priv->format_digits != format_digits)) {
+ || (lbc->priv->format_digits != format_digits))
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lbc));
+ gl_label_checkpoint (label, _("Barcode property"));
+ }
lbc->priv->id = g_strdup (id);
lbc->priv->text_flag = text_flag;
lbc->priv->format_digits = format_digits;
gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc));
-
}
gl_debug (DEBUG_LABEL, "END");
/*---------------------------------------------------------------------------*/
static void
set_line_color (glLabelObject *object,
- glColorNode *line_color_node)
+ glColorNode *line_color_node,
+ gboolean checkpoint)
{
glLabelBarcode *lbarcode = (glLabelBarcode *)object;
+ glLabel *label;
g_return_if_fail (lbarcode && GL_IS_LABEL_BARCODE (lbarcode));
- if ( !gl_color_node_equal(lbarcode->priv->color_node, line_color_node) ) {
-
+ if ( !gl_color_node_equal(lbarcode->priv->color_node, line_color_node) )
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lbarcode));
+ gl_label_checkpoint (label, _("Barcode data"));
+ }
+
gl_color_node_free (&(lbarcode->priv->color_node));
lbarcode->priv->color_node = gl_color_node_dup (line_color_node);
gl_label_object_emit_changed (GL_LABEL_OBJECT(lbarcode));
GType gl_label_barcode_get_type (void) G_GNUC_CONST;
-GObject *gl_label_barcode_new (glLabel *label);
+GObject *gl_label_barcode_new (glLabel *label,
+ gboolean checkpoint);
void gl_label_barcode_set_data (glLabelBarcode *lbc,
- glTextNode *text_node);
+ glTextNode *text_node,
+ gboolean checkpoint);
+
void gl_label_barcode_set_props (glLabelBarcode *lbc,
gchar *id,
gboolean text_flag,
gboolean checksum_flag,
- guint format_digits);
+ guint format_digits,
+ gboolean checkpoint);
glTextNode *gl_label_barcode_get_data (glLabelBarcode *lbc);
+
void gl_label_barcode_get_props (glLabelBarcode *lbc,
gchar **id,
gboolean *text_flag,
#include "label-box.h"
+#include <glib/gi18n.h>
#include <glib.h>
#include "debug.h"
glLabelObject *src_object);
static void set_fill_color (glLabelObject *object,
- glColorNode *fill_color_node);
+ glColorNode *fill_color_node,
+ gboolean checkpoint);
static void set_line_color (glLabelObject *object,
- glColorNode *line_color_node);
+ glColorNode *line_color_node,
+ gboolean checkpoint);
static void set_line_width (glLabelObject *object,
- gdouble line_width);
+ gdouble line_width,
+ gboolean checkpoint);
static glColorNode* get_fill_color (glLabelObject *object);
/* NEW label "box" object. */
/*****************************************************************************/
GObject *
-gl_label_box_new (glLabel *label)
+gl_label_box_new (glLabel *label,
+ gboolean checkpoint)
{
glLabelBox *lbox;
glColorNode *fill_color_node;
if (label != NULL)
{
- gl_label_object_set_parent (GL_LABEL_OBJECT(lbox), label);
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Create box object"));
+ }
fill_color_node = gl_color_node_new_default ();
line_color_node = gl_color_node_new_default ();
lbox->priv->line_width = gl_label_get_default_line_width(label);
lbox->priv->line_color_node = line_color_node;
lbox->priv->fill_color_node = fill_color_node;
+
+ gl_label_add_object (label, GL_LABEL_OBJECT (lbox));
+ gl_label_object_set_parent (GL_LABEL_OBJECT (lbox), label);
}
return G_OBJECT (lbox);
line_color_node = get_line_color (src_object);
fill_color_node = get_fill_color (src_object);
- set_line_width (dst_object, line_width);
- set_line_color (dst_object, line_color_node);
- set_fill_color (dst_object, fill_color_node);
+ set_line_width (dst_object, line_width, FALSE);
+ set_line_color (dst_object, line_color_node, FALSE);
+ set_fill_color (dst_object, fill_color_node, FALSE);
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
/*---------------------------------------------------------------------------*/
static void
set_fill_color (glLabelObject *object,
- glColorNode *fill_color_node)
+ glColorNode *fill_color_node,
+ gboolean checkpoint)
{
glLabelBox *lbox = (glLabelBox *)object;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox));
- if (!gl_color_node_equal (lbox->priv->fill_color_node, fill_color_node)) {
+ if (!gl_color_node_equal (lbox->priv->fill_color_node, fill_color_node))
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lbox));
+ gl_label_checkpoint (label, _("Fill color"));
+ }
gl_color_node_free (&(lbox->priv->fill_color_node));
lbox->priv->fill_color_node = gl_color_node_dup (fill_color_node);
gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox));
}
+
gl_debug (DEBUG_LABEL, "END");
}
/*---------------------------------------------------------------------------*/
static void
set_line_color (glLabelObject *object,
- glColorNode *line_color_node)
+ glColorNode *line_color_node,
+ gboolean checkpoint)
{
glLabelBox *lbox = (glLabelBox *)object;
+ glLabel *label;
g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox));
- if ( !gl_color_node_equal (lbox->priv->line_color_node, line_color_node )) {
+ if ( !gl_color_node_equal (lbox->priv->line_color_node, line_color_node ))
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lbox));
+ gl_label_checkpoint (label, _("Line color"));
+ }
+
gl_color_node_free (&(lbox->priv->line_color_node));
lbox->priv->line_color_node = gl_color_node_dup (line_color_node);
gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox));
/*---------------------------------------------------------------------------*/
static void
set_line_width (glLabelObject *object,
- gdouble line_width)
+ gdouble line_width,
+ gboolean checkpoint)
{
glLabelBox *lbox = (glLabelBox *)object;
+ glLabel *label;
g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox));
- if ( lbox->priv->line_width != line_width ) {
+ if ( lbox->priv->line_width != line_width )
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lbox));
+ gl_label_checkpoint (label, _("Line width"));
+ }
+
lbox->priv->line_width = line_width;
gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox));
}
GType gl_label_box_get_type (void) G_GNUC_CONST;
-GObject *gl_label_box_new (glLabel *label);
+GObject *gl_label_box_new (glLabel *label,
+ gboolean checkpoint);
G_END_DECLS
#include "label-ellipse.h"
+#include <glib/gi18n.h>
#include <glib.h>
#include <math.h>
glLabelObject *src_object);
static void set_fill_color (glLabelObject *object,
- glColorNode *fill_color_node);
+ glColorNode *fill_color_node,
+ gboolean checkpoint);
static void set_line_color (glLabelObject *object,
- glColorNode *line_color_node);
+ glColorNode *line_color_node,
+ gboolean checkpoint);
static void set_line_width (glLabelObject *object,
- gdouble line_width);
+ gdouble line_width,
+ gboolean checkpoint);
static glColorNode* get_fill_color (glLabelObject *object);
/* NEW label "ellipse" object. */
/*****************************************************************************/
GObject *
-gl_label_ellipse_new (glLabel *label)
+gl_label_ellipse_new (glLabel *label,
+ gboolean checkpoint)
{
glLabelEllipse *lellipse;
glColorNode *fill_color_node;
if (label != NULL)
{
- gl_label_object_set_parent (GL_LABEL_OBJECT(lellipse), label);
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Create ellipse object"));
+ }
fill_color_node = gl_color_node_new_default ();
line_color_node = gl_color_node_new_default ();
lellipse->priv->line_width = gl_label_get_default_line_width(label);
lellipse->priv->line_color_node = line_color_node;
lellipse->priv->fill_color_node = fill_color_node;
+
+ gl_label_add_object (label, GL_LABEL_OBJECT (lellipse));
+ gl_label_object_set_parent (GL_LABEL_OBJECT (lellipse), label);
}
return G_OBJECT (lellipse);
line_color_node = get_line_color (src_object);
fill_color_node = get_fill_color (src_object);
- set_line_width (dst_object, line_width);
- set_line_color (dst_object, line_color_node);
- set_fill_color (dst_object, fill_color_node);
+ set_line_width (dst_object, line_width, FALSE);
+ set_line_color (dst_object, line_color_node, FALSE);
+ set_fill_color (dst_object, fill_color_node, FALSE);
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
/*---------------------------------------------------------------------------*/
static void
set_fill_color (glLabelObject *object,
- glColorNode *fill_color_node)
+ glColorNode *fill_color_node,
+ gboolean checkpoint)
{
glLabelEllipse *lellipse = (glLabelEllipse *)object;
+ glLabel *label;
g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse));
- if (!gl_color_node_equal (lellipse->priv->fill_color_node, fill_color_node)) {
+ if (!gl_color_node_equal (lellipse->priv->fill_color_node, fill_color_node))
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lellipse));
+ gl_label_checkpoint (label, _("Fill color"));
+ }
gl_color_node_free (&(lellipse->priv->fill_color_node));
lellipse->priv->fill_color_node = gl_color_node_dup (fill_color_node);
/*---------------------------------------------------------------------------*/
static void
set_line_color (glLabelObject *object,
- glColorNode *line_color_node)
+ glColorNode *line_color_node,
+ gboolean checkpoint)
{
glLabelEllipse *lellipse = (glLabelEllipse *)object;
+ glLabel *label;
g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse));
- if ( !gl_color_node_equal (lellipse->priv->line_color_node, line_color_node) ) {
-
+ if ( !gl_color_node_equal (lellipse->priv->line_color_node, line_color_node) )
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lellipse));
+ gl_label_checkpoint (label, _("Line color"));
+ }
+
gl_color_node_free (&(lellipse->priv->line_color_node));
lellipse->priv->line_color_node = gl_color_node_dup (line_color_node);
/*---------------------------------------------------------------------------*/
static void
set_line_width (glLabelObject *object,
- gdouble line_width)
+ gdouble line_width,
+ gboolean checkpoint)
{
glLabelEllipse *lellipse = (glLabelEllipse *)object;
+ glLabel *label;
g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse));
- if ( lellipse->priv->line_width != line_width ) {
+ if ( lellipse->priv->line_width != line_width )
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lellipse));
+ gl_label_checkpoint (label, _("Line width"));
+ }
+
lellipse->priv->line_width = line_width;
gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse));
}
GType gl_label_ellipse_get_type (void) G_GNUC_CONST;
-GObject *gl_label_ellipse_new (glLabel *label);
+GObject *gl_label_ellipse_new (glLabel *label,
+ gboolean checkpoint);
G_END_DECLS
#include "label-image.h"
+#include <glib/gi18n.h>
#include <glib.h>
#include <gdk/gdk.h>
static void set_size (glLabelObject *object,
gdouble w,
- gdouble h);
+ gdouble h,
+ gboolean checkpoint);
static void draw_object (glLabelObject *object,
cairo_t *cr,
gl_label_image_finalize (GObject *object)
{
glLabelObject *lobject = GL_LABEL_OBJECT (object);
- glLabelImage *limage = GL_LABEL_IMAGE (object);;
+ glLabelImage *limage = GL_LABEL_IMAGE (object);
+ glLabel *label;
GHashTable *pixbuf_cache;
g_return_if_fail (object && GL_IS_LABEL_IMAGE (object));
if (!limage->priv->filename->field_flag) {
- pixbuf_cache = gl_label_get_pixbuf_cache (lobject->parent);
+ label = gl_label_object_get_parent (lobject);
+ pixbuf_cache = gl_label_get_pixbuf_cache (label);
gl_pixbuf_cache_remove_pixbuf (pixbuf_cache,
limage->priv->filename->data);
}
/* NEW label "image" object. */
/*****************************************************************************/
GObject *
-gl_label_image_new (glLabel *label)
+gl_label_image_new (glLabel *label,
+ gboolean checkpoint)
{
glLabelImage *limage;
limage = g_object_new (gl_label_image_get_type(), NULL);
- gl_label_object_set_parent (GL_LABEL_OBJECT(limage), label);
+ if (label != NULL)
+ {
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Create image object"));
+ }
+
+ gl_label_add_object (label, GL_LABEL_OBJECT (limage));
+ gl_label_object_set_parent (GL_LABEL_OBJECT (limage), label);
+ }
return G_OBJECT (limage);
}
glLabelImage *new_limage = (glLabelImage *)dst_object;
glTextNode *filename;
GdkPixbuf *pixbuf;
+ glLabel *label;
GHashTable *pixbuf_cache;
gl_debug (DEBUG_LABEL, "START");
if ( !filename->field_flag && (filename->data != NULL) ) {
pixbuf = limage->priv->pixbuf;
if ( pixbuf != default_pixbuf ) {
- pixbuf_cache = gl_label_get_pixbuf_cache (dst_object->parent);
+ label = gl_label_object_get_parent (dst_object);
+ pixbuf_cache = gl_label_get_pixbuf_cache (label);
gl_pixbuf_cache_add_pixbuf (pixbuf_cache, filename->data, pixbuf);
}
}
- gl_label_image_set_filename (new_limage, filename);
+ gl_label_image_set_filename (new_limage, filename, FALSE);
gl_text_node_free (&filename);
gl_debug (DEBUG_LABEL, "END");
static void
set_size (glLabelObject *object,
gdouble w,
- gdouble h)
+ gdouble h,
+ gboolean checkpoint)
{
g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
h = MIN_IMAGE_SIZE;
}
- GL_LABEL_OBJECT_CLASS (gl_label_image_parent_class)->set_size (object, w, h);
+ GL_LABEL_OBJECT_CLASS (gl_label_image_parent_class)->set_size (object, w, h, checkpoint);
}
/*****************************************************************************/
void
gl_label_image_set_filename (glLabelImage *limage,
- glTextNode *filename)
+ glTextNode *filename,
+ gboolean checkpoint)
{
glTextNode *old_filename;
+ glLabel *label;
GHashTable *pixbuf_cache;
GdkPixbuf *pixbuf;
gdouble image_w, image_h, aspect_ratio, w, h;
return;
}
- pixbuf_cache = gl_label_get_pixbuf_cache (GL_LABEL_OBJECT(limage)->parent);
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (limage));
+
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Set image"));
+ }
+
+ pixbuf_cache = gl_label_get_pixbuf_cache (label);
/* Remove reference to previous pixbuf from cache, if needed. */
if ( !old_filename->field_flag && (old_filename->data != NULL) ) {
} else {
w = h / aspect_ratio;
}
- gl_label_object_set_size (GL_LABEL_OBJECT(limage), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(limage), w, h, FALSE);
gl_label_object_emit_changed (GL_LABEL_OBJECT(limage));
void
gl_label_image_set_pixbuf (glLabelImage *limage,
- GdkPixbuf *pixbuf)
+ GdkPixbuf *pixbuf,
+ gboolean checkpoint)
{
glTextNode *old_filename;
+ glLabel *label;
GHashTable *pixbuf_cache;
gchar *name;
gdouble image_w, image_h;
old_filename = limage->priv->filename;
- pixbuf_cache = gl_label_get_pixbuf_cache (GL_LABEL_OBJECT(limage)->parent);
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (limage));
+
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Set image"));
+ }
+
+ pixbuf_cache = gl_label_get_pixbuf_cache (label);
/* Remove reference to previous pixbuf from cache, if needed. */
if ( !old_filename->field_flag && (old_filename->data != NULL) ) {
image_w = gdk_pixbuf_get_width (limage->priv->pixbuf);
image_h = gdk_pixbuf_get_height (limage->priv->pixbuf);
- gl_label_object_set_size (GL_LABEL_OBJECT(limage), image_w, image_h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(limage), image_w, image_h, FALSE);
gl_label_object_emit_changed (GL_LABEL_OBJECT(limage));
GType gl_label_image_get_type (void) G_GNUC_CONST;
-GObject *gl_label_image_new (glLabel *label);
+GObject *gl_label_image_new (glLabel *label,
+ gboolean checkpoint);
void gl_label_image_set_filename (glLabelImage *limage,
- glTextNode *filename);
+ glTextNode *filename,
+ gboolean checkpoint);
void gl_label_image_set_pixbuf (glLabelImage *limage,
- GdkPixbuf *pixbuf);
+ GdkPixbuf *pixbuf,
+ gboolean checkpoint);
glTextNode *gl_label_image_get_filename (glLabelImage *limage);
#include "label-line.h"
+#include <glib/gi18n.h>
#include <glib.h>
#include "debug.h"
glLabelObject *src_object);
static void set_line_color (glLabelObject *object,
- glColorNode *line_color_node);
+ glColorNode *line_color_node,
+ gboolean checkpoint);
static void set_line_width (glLabelObject *object,
- gdouble line_width);
+ gdouble line_width,
+ gboolean checkpoint);
static glColorNode *get_line_color (glLabelObject *object);
/* NEW label "line" object. */
/*****************************************************************************/
GObject *
-gl_label_line_new (glLabel *label)
+gl_label_line_new (glLabel *label,
+ gboolean checkpoint)
{
glLabelLine *lline;
glColorNode *line_color_node;
if (label != NULL)
{
- gl_label_object_set_parent (GL_LABEL_OBJECT(lline), label);
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Create line object"));
+ }
line_color_node = gl_color_node_new_default ();
lline->priv->line_width = gl_label_get_default_line_width(label);
lline->priv->line_color_node = line_color_node;
+
+ gl_label_add_object (label, GL_LABEL_OBJECT (lline));
+ gl_label_object_set_parent (GL_LABEL_OBJECT (lline), label);
}
return G_OBJECT (lline);
line_width = get_line_width (src_object);
line_color_node = get_line_color (src_object);
- set_line_width (dst_object, line_width);
- set_line_color (dst_object, line_color_node);
+ set_line_width (dst_object, line_width, FALSE);
+ set_line_color (dst_object, line_color_node, FALSE);
gl_color_node_free (&line_color_node);
/*---------------------------------------------------------------------------*/
static void
set_line_color (glLabelObject *object,
- glColorNode *line_color_node)
+ glColorNode *line_color_node,
+ gboolean checkpoint)
{
glLabelLine *lline = (glLabelLine *)object;
+ glLabel *label;
g_return_if_fail (lline && GL_IS_LABEL_LINE (lline));
- if ( !gl_color_node_equal (lline->priv->line_color_node, line_color_node)) {
-
+ if ( !gl_color_node_equal (lline->priv->line_color_node, line_color_node))
+ {
+ if ( checkpoint )
+ {
+ gl_label_object_get_parent (GL_LABEL_OBJECT (lline));
+ gl_label_checkpoint (label, _("Line color"));
+ }
+
gl_color_node_free (&(lline->priv->line_color_node ));
lline->priv->line_color_node = gl_color_node_dup (line_color_node);
/*---------------------------------------------------------------------------*/
static void
set_line_width (glLabelObject *object,
- gdouble line_width)
+ gdouble line_width,
+ gboolean checkpoint)
{
glLabelLine *lline = (glLabelLine *)object;
+ glLabel *label;
g_return_if_fail (lline && GL_IS_LABEL_LINE (lline));
- if ( lline->priv->line_width != line_width ) {
+ if ( lline->priv->line_width != line_width )
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (lline));
+ gl_label_checkpoint (label, _("Line width"));
+ }
+
lline->priv->line_width = line_width;
gl_label_object_emit_changed (GL_LABEL_OBJECT(lline));
}
GType gl_label_line_get_type (void) G_GNUC_CONST;
-GObject *gl_label_line_new (glLabel *label);
+GObject *gl_label_line_new (glLabel *label,
+ gboolean checkpoint);
G_END_DECLS
#include "label-object.h"
+#include <glib/gi18n.h>
#include <glib.h>
#include <math.h>
#define DEFAULT_SHADOW_X_OFFSET (3.6)
#define DEFAULT_SHADOW_Y_OFFSET (3.6)
+#define DEFAULT_SHADOW_COLOR GL_COLOR_BLACK
#define DEFAULT_SHADOW_OPACITY (0.5)
#define HANDLE_FILL_RGBA_ARGS 0.0, 0.75, 0.0, 0.4
gchar *name;
gboolean selected_flag;
+ glLabel *parent;
gdouble x, y;
gdouble w, h;
static void set_size (glLabelObject *object,
gdouble w,
- gdouble h);
+ gdouble h,
+ gboolean checkpoint);
/*****************************************************************************/
object->priv->shadow_x = DEFAULT_SHADOW_X_OFFSET;
object->priv->shadow_y = DEFAULT_SHADOW_Y_OFFSET;
object->priv->shadow_color_node = gl_color_node_new_default ();
+ object->priv->shadow_color_node->color = DEFAULT_SHADOW_COLOR;
object->priv->shadow_opacity = DEFAULT_SHADOW_OPACITY;
gl_debug (DEBUG_LABEL, "END");
object = g_object_new (gl_label_object_get_type(), NULL);
- gl_label_object_set_parent (object, label);
+ gl_label_object_set_parent (object, label);
gl_debug (DEBUG_LABEL, "END");
dst_object = g_object_new (G_OBJECT_TYPE(src_object), NULL);
- gl_label_object_set_parent (dst_object, label);
+ gl_label_object_set_parent (dst_object, label);
+ dst_object->priv->selected_flag = src_object->priv->selected_flag;
gl_label_object_get_position (src_object, &x, &y);
- gl_label_object_get_size (src_object, &w, &h);
+ gl_label_object_get_raw_size (src_object, &w, &h);
gl_label_object_get_matrix (src_object, &matrix);
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_position (dst_object, x, y, FALSE);
+ gl_label_object_set_size (dst_object, w, h, FALSE);
gl_label_object_set_matrix (dst_object, &matrix);
- 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_label_object_set_shadow_offset (dst_object, shadow_x, shadow_y, FALSE);
+ gl_label_object_set_shadow_color (dst_object, shadow_color_node, FALSE);
+ gl_label_object_set_shadow_opacity (dst_object, shadow_opacity, FALSE);
+ gl_label_object_set_shadow_state (dst_object, shadow_state, FALSE);
gl_color_node_free (&shadow_color_node);
/*****************************************************************************/
void
gl_label_object_set_parent (glLabelObject *object,
- glLabel *label)
+ glLabel *label)
{
- glLabel *old_parent;
-
- gl_debug (DEBUG_LABEL, "START");
-
- g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
- g_return_if_fail (label && GL_IS_LABEL (label));
+ gl_debug (DEBUG_LABEL, "START");
- old_parent = object->parent;
- if ( old_parent != NULL )
- {
- g_object_ref (object);
- gl_label_delete_object( old_parent, object );
- }
- object->parent = label;
- gl_label_add_object (label, object);
+ g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
+ g_return_if_fail (label && GL_IS_LABEL (label));
- gl_label_object_emit_changed (object);
+ object->priv->parent = label;
}
glLabel *
gl_label_object_get_parent (glLabelObject *object)
{
- gl_debug (DEBUG_LABEL, "START");
+ gl_debug (DEBUG_LABEL, "START");
- g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), NULL);
+ g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), NULL);
- gl_debug (DEBUG_LABEL, "END");
+ gl_debug (DEBUG_LABEL, "END");
- return object->parent;
+ return object->priv->parent;
}
void
gl_label_object_set_position (glLabelObject *object,
gdouble x,
- gdouble y)
+ gdouble y,
+ gboolean checkpoint)
{
gdouble dx, dy;
if ( (x != object->priv->x) || (y != object->priv->y) )
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (object->priv->parent, _("Move"));
+ }
+
dx = x - object->priv->x;
dy = y - object->priv->y;
void
gl_label_object_set_position_relative (glLabelObject *object,
gdouble dx,
- gdouble dy)
+ gdouble dy,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( (dx != 0.0) || (dy != 0.0) )
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (object->priv->parent, _("Move"));
+ }
+
object->priv->x += dx;
object->priv->y += dy;
static void
set_size (glLabelObject *object,
gdouble w,
- gdouble h)
+ gdouble h,
+ gboolean checkpoint)
{
g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
if ( (object->priv->w != w) || (object->priv->h != h) )
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (object->priv->parent, _("Resize"));
+ }
+
object->priv->w = w;
object->priv->h = h;
void
gl_label_object_set_size (glLabelObject *object,
gdouble w,
- gdouble h)
+ gdouble h,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_size != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h, checkpoint);
object->priv->aspect_ratio = h / w;
}
void
gl_label_object_set_size_honor_aspect (glLabelObject *object,
gdouble w,
- gdouble h)
+ gdouble h,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_size != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/*****************************************************************************/
void
gl_label_object_set_font_family (glLabelObject *object,
- const gchar *font_family)
+ const gchar *font_family,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_font_family != NULL )
{
-
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_font_family (object, font_family);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_font_family (object, font_family, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_font_size (glLabelObject *object,
- gdouble font_size)
+ gdouble font_size,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_font_size != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_font_size (object, font_size);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_font_size (object, font_size, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_font_weight (glLabelObject *object,
- PangoWeight font_weight)
+ PangoWeight font_weight,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_font_weight != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_font_weight (object, font_weight);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_font_weight (object, font_weight, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_font_italic_flag (glLabelObject *object,
- gboolean font_italic_flag)
+ gboolean font_italic_flag,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_font_italic_flag != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_font_italic_flag (object, font_italic_flag);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_font_italic_flag (object, font_italic_flag, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_text_alignment (glLabelObject *object,
- PangoAlignment text_alignment)
+ PangoAlignment text_alignment,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_text_alignment != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_text_alignment (object, text_alignment);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_text_alignment (object, text_alignment, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_text_line_spacing (glLabelObject *object,
- gdouble text_line_spacing)
+ gdouble text_line_spacing,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_text_line_spacing != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_text_line_spacing (object, text_line_spacing);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_text_line_spacing (object, text_line_spacing, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_text_color (glLabelObject *object,
- glColorNode *text_color_node)
+ glColorNode *text_color_node,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_text_color != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_text_color (object, text_color_node);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_text_color (object, text_color_node, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_fill_color (glLabelObject *object,
- glColorNode *fill_color_node)
+ glColorNode *fill_color_node,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_fill_color != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_fill_color (object, fill_color_node);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_fill_color (object, fill_color_node, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_line_color (glLabelObject *object,
- glColorNode *line_color_node)
+ glColorNode *line_color_node,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_line_color != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_line_color (object, line_color_node);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_line_color (object, line_color_node, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_line_width (glLabelObject *object,
- gdouble line_width)
+ gdouble line_width,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( GL_LABEL_OBJECT_GET_CLASS(object)->set_line_width != NULL )
{
/* We have an object specific method, use it */
- GL_LABEL_OBJECT_GET_CLASS(object)->set_line_width (object, line_width);
+ GL_LABEL_OBJECT_GET_CLASS(object)->set_line_width (object, line_width, checkpoint);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_shadow_state (glLabelObject *object,
- gboolean state)
+ gboolean state,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if (object->priv->shadow_state != state)
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (object->priv->parent, _("Shadow state"));
+ }
+
object->priv->shadow_state = state;
+
+ gl_label_object_emit_changed (object);
}
gl_debug (DEBUG_LABEL, "END");
void
gl_label_object_set_shadow_offset (glLabelObject *object,
gdouble x,
- gdouble y)
+ gdouble y,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( (x != object->priv->shadow_x) || (y != object->priv->shadow_y) )
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (object->priv->parent, _("Shadow offset"));
+ }
+
object->priv->shadow_x = x;
object->priv->shadow_y = y;
+
+ gl_label_object_emit_changed (object);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_shadow_color (glLabelObject *object,
- glColorNode *color_node)
+ glColorNode *color_node,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if ( !gl_color_node_equal (object->priv->shadow_color_node, color_node ))
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (object->priv->parent, _("Shadow color"));
+ }
+
gl_color_node_free (&(object->priv->shadow_color_node));
object->priv->shadow_color_node = gl_color_node_dup (color_node);
+
+ gl_label_object_emit_changed (object);
}
gl_debug (DEBUG_LABEL, "END");
/****************************************************************************/
void
gl_label_object_set_shadow_opacity (glLabelObject *object,
- gdouble alpha)
+ gdouble alpha,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if (object->priv->shadow_opacity != alpha)
{
- object->priv->shadow_opacity = alpha;
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (object->priv->parent, _("Shadow opacity"));
+ }
+
+ object->priv->shadow_opacity = alpha;
+
+ gl_label_object_emit_changed (object);
}
gl_debug (DEBUG_LABEL, "END");
struct _glLabelObject {
GObject object;
- glLabel *parent;
-
glLabelObjectPrivate *priv;
};
void (*set_size) (glLabelObject *object,
gdouble w,
- gdouble h);
+ gdouble h,
+ gboolean checkpoint);
void (*set_font_family) (glLabelObject *object,
- const gchar *font_family);
+ const gchar *font_family,
+ gboolean checkpoint);
void (*set_font_size) (glLabelObject *object,
- gdouble font_size);
+ gdouble font_size,
+ gboolean checkpoint);
void (*set_font_weight) (glLabelObject *object,
- PangoWeight font_weight);
+ PangoWeight font_weight,
+ gboolean checkpoint);
void (*set_font_italic_flag) (glLabelObject *object,
- gboolean font_italic_flag);
+ gboolean font_italic_flag,
+ gboolean checkpoint);
void (*set_text_alignment) (glLabelObject *object,
- PangoAlignment text_alignment);
+ PangoAlignment text_alignment,
+ gboolean checkpoint);
void (*set_text_line_spacing)(glLabelObject *object,
- gdouble text_line_spacing);
+ gdouble text_line_spacing,
+ gboolean checkpoint);
void (*set_text_color) (glLabelObject *object,
- glColorNode *text_color_node);
+ glColorNode *text_color_node,
+ gboolean checkpoint);
void (*set_fill_color) (glLabelObject *object,
- glColorNode *fill_color_node);
+ glColorNode *fill_color_node,
+ gboolean checkpoint);
void (*set_line_color) (glLabelObject *object,
- glColorNode *line_color_node);
+ glColorNode *line_color_node,
+ gboolean checkpoint);
void (*set_line_width) (glLabelObject *object,
- gdouble line_width);
+ gdouble line_width,
+ gboolean checkpoint);
void (*get_size) (glLabelObject *object,
gdouble *w,
void gl_label_object_set_position (glLabelObject *object,
gdouble x,
- gdouble y);
+ gdouble y,
+ gboolean checkpoint);
void gl_label_object_set_position_relative (glLabelObject *object,
gdouble dx,
- gdouble dy);
+ gdouble dy,
+ gboolean checkpoint);
void gl_label_object_set_size (glLabelObject *object,
gdouble w,
- gdouble h);
+ gdouble h,
+ gboolean checkpoint);
void gl_label_object_set_size_honor_aspect (glLabelObject *object,
gdouble w,
- gdouble h);
+ gdouble h,
+ gboolean checkpoint);
void gl_label_object_set_font_family (glLabelObject *object,
- const gchar *font_family);
+ const gchar *font_family,
+ gboolean checkpoint);
void gl_label_object_set_font_size (glLabelObject *object,
- gdouble font_size);
+ gdouble font_size,
+ gboolean checkpoint);
void gl_label_object_set_font_weight (glLabelObject *object,
- PangoWeight font_weight);
+ PangoWeight font_weight,
+ gboolean checkpoint);
void gl_label_object_set_font_italic_flag (glLabelObject *object,
- gboolean font_italic_flag);
+ gboolean font_italic_flag,
+ gboolean checkpoint);
void gl_label_object_set_text_alignment (glLabelObject *object,
- PangoAlignment text_alignment);
+ PangoAlignment text_alignment,
+ gboolean checkpoint);
void gl_label_object_set_text_color (glLabelObject *object,
- glColorNode *text_color_node);
+ glColorNode *text_color_node,
+ gboolean checkpoint);
void gl_label_object_set_text_line_spacing (glLabelObject *object,
- gdouble text_line_spacing);
+ gdouble text_line_spacing,
+ gboolean checkpoint);
void gl_label_object_set_fill_color (glLabelObject *object,
- glColorNode *fill_color_node);
+ glColorNode *fill_color_node,
+ gboolean checkpoint);
void gl_label_object_set_line_color (glLabelObject *object,
- glColorNode *line_color_node);
+ glColorNode *line_color_node,
+ gboolean checkpoint);
void gl_label_object_set_line_width (glLabelObject *object,
- gdouble line_width);
+ gdouble line_width,
+ gboolean checkpoint);
void gl_label_object_set_shadow_state (glLabelObject *object,
- gboolean state);
+ gboolean state,
+ gboolean checkpoint);
void gl_label_object_set_shadow_offset (glLabelObject *object,
gdouble x,
- gdouble y);
+ gdouble y,
+ gboolean checkpoint);
void gl_label_object_set_shadow_color (glLabelObject *object,
- glColorNode *color_node);
+ glColorNode *color_node,
+ gboolean checkpoint);
void gl_label_object_set_shadow_opacity (glLabelObject *object,
- gdouble alpha);
+ gdouble alpha,
+ gboolean checkpoint);
void gl_label_object_flip_horiz (glLabelObject *object);
#include "label-text.h"
+#include <glib/gi18n.h>
#include <glib.h>
#include <pango/pango.h>
#include <math.h>
gboolean size_changed;
gdouble w;
gdouble h;
+
+ gboolean checkpoint_flag;
};
static void copy (glLabelObject *dst_object,
glLabelObject *src_object);
+static void buffer_begin_user_action_cb (GtkTextBuffer *textbuffer,
+ glLabelText *ltext);
+
static void buffer_changed_cb (GtkTextBuffer *textbuffer,
glLabelText *ltext);
gdouble *h);
static void set_font_family (glLabelObject *object,
- const gchar *font_family);
+ const gchar *font_family,
+ gboolean checkpoint);
static void set_font_size (glLabelObject *object,
- gdouble font_size);
+ gdouble font_size,
+ gboolean checkpoint);
static void set_font_weight (glLabelObject *object,
- PangoWeight font_weight);
+ PangoWeight font_weight,
+ gboolean checkpoint);
static void set_font_italic_flag (glLabelObject *object,
- gboolean font_italic_flag);
+ gboolean font_italic_flag,
+ gboolean checkpoint);
static void set_text_alignment (glLabelObject *object,
- PangoAlignment text_alignment);
+ PangoAlignment text_alignment,
+ gboolean checkpoint);
static void set_text_line_spacing (glLabelObject *object,
- gdouble text_line_spacing);
+ gdouble text_line_spacing,
+ gboolean checkpoint);
static void set_text_color (glLabelObject *object,
- glColorNode *text_color_node);
+ glColorNode *text_color_node,
+ gboolean checkpoint);
static gchar *get_font_family (glLabelObject *object);
ltext->priv->size_changed = TRUE;
+ ltext->priv->checkpoint_flag = TRUE;
+
+ g_signal_connect (G_OBJECT(ltext->priv->buffer), "begin-user-action",
+ G_CALLBACK(buffer_begin_user_action_cb), ltext);
g_signal_connect (G_OBJECT(ltext->priv->buffer), "changed",
G_CALLBACK(buffer_changed_cb), ltext);
}
/** New Object Generator. */
/*****************************************************************************/
GObject *
-gl_label_text_new (glLabel *label)
+gl_label_text_new (glLabel *label,
+ gboolean checkpoint)
{
glLabelText *ltext;
glColorNode *color_node;
if (label != NULL)
{
- gl_label_object_set_parent (GL_LABEL_OBJECT(ltext), label);
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Create text object"));
+ }
color_node = gl_color_node_new_default ();
ltext->priv->align = gl_label_get_default_text_alignment (label);
ltext->priv->color_node = color_node;
ltext->priv->line_spacing = gl_label_get_default_text_line_spacing (label);
+
+ gl_label_add_object (label, GL_LABEL_OBJECT (ltext));
+ gl_label_object_set_parent (GL_LABEL_OBJECT (ltext), label);
}
return G_OBJECT (ltext);
lines = gl_label_text_get_lines (ltext);
text_color_node = get_text_color (src_object);
- gl_label_text_set_lines (new_ltext, lines);
+ gl_label_text_set_lines (new_ltext, lines, FALSE);
new_ltext->priv->font_family = g_strdup (ltext->priv->font_family);
new_ltext->priv->font_size = ltext->priv->font_size;
new_ltext->priv->font_weight = ltext->priv->font_weight;
new_ltext->priv->font_italic_flag = ltext->priv->font_italic_flag;
- set_text_color (dst_object, text_color_node);
+ set_text_color (dst_object, text_color_node, FALSE);
new_ltext->priv->align = ltext->priv->align;
new_ltext->priv->line_spacing = ltext->priv->line_spacing;
new_ltext->priv->auto_shrink = ltext->priv->auto_shrink;
/*****************************************************************************/
void
gl_label_text_set_lines (glLabelText *ltext,
- GList *lines)
+ GList *lines,
+ gboolean checkpoint)
{
gchar *text;
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
+ ltext->priv->checkpoint_flag = checkpoint;
+
text = gl_text_node_lines_expand (lines, NULL);
gtk_text_buffer_set_text (ltext->priv->buffer, text, -1);
g_free (text);
ltext->priv->size_changed = TRUE;
+ ltext->priv->checkpoint_flag = TRUE;
+
gl_debug (DEBUG_LABEL, "END");
}
void
gl_label_text_set_text (glLabelText *ltext,
- const gchar *text)
+ const gchar *text,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
+ ltext->priv->checkpoint_flag = checkpoint;
+
gtk_text_buffer_set_text (ltext->priv->buffer, text, -1);
ltext->priv->size_changed = TRUE;
+ ltext->priv->checkpoint_flag = TRUE;
+
gl_debug (DEBUG_LABEL, "END");
}
}
+/*****************************************************************************/
+/* Text buffer "changed" callback. */
+/*****************************************************************************/
+static void
+buffer_begin_user_action_cb (GtkTextBuffer *textbuffer,
+ glLabelText *ltext)
+{
+ glLabel *label;
+
+ if ( ltext->priv->checkpoint_flag )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Typing"));
+ }
+}
+
+
/*****************************************************************************/
/* Text buffer "changed" callback. */
/*****************************************************************************/
buffer_changed_cb (GtkTextBuffer *textbuffer,
glLabelText *ltext)
{
+ glLabel *label;
+
ltext->priv->size_changed = TRUE;
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
/*****************************************************************************/
static void
set_font_family (glLabelObject *object,
- const gchar *font_family)
+ const gchar *font_family,
+ gboolean checkpoint)
{
glLabelText *ltext = (glLabelText *)object;
gchar *good_font_family;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
}
g_free (ltext->priv->font_family);
}
+
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Font family"));
+ }
+
ltext->priv->font_family = g_strdup (good_font_family);
g_free (good_font_family);
/*****************************************************************************/
static void
set_font_size (glLabelObject *object,
- gdouble font_size)
+ gdouble font_size,
+ gboolean checkpoint)
{
glLabelText *ltext = (glLabelText *)object;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
- if (ltext->priv->font_size != font_size) {
+ if (ltext->priv->font_size != font_size)
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Font size"));
+ }
ltext->priv->size_changed = TRUE;
ltext->priv->font_size = font_size;
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
-
}
gl_debug (DEBUG_LABEL, "END");
/*****************************************************************************/
static void
set_font_weight (glLabelObject *object,
- PangoWeight font_weight)
+ PangoWeight font_weight,
+ gboolean checkpoint)
{
glLabelText *ltext = (glLabelText *)object;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
- if (ltext->priv->font_weight != font_weight) {
+ if (ltext->priv->font_weight != font_weight)
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Font weight"));
+ }
ltext->priv->size_changed = TRUE;
ltext->priv->font_weight = font_weight;
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
-
}
gl_debug (DEBUG_LABEL, "END");
/*****************************************************************************/
static void
set_font_italic_flag (glLabelObject *object,
- gboolean font_italic_flag)
+ gboolean font_italic_flag,
+ gboolean checkpoint)
{
glLabelText *ltext = (glLabelText *)object;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
- if (ltext->priv->font_italic_flag != font_italic_flag) {
+ if (ltext->priv->font_italic_flag != font_italic_flag)
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Italic"));
+ }
ltext->priv->size_changed = TRUE;
ltext->priv->font_italic_flag = font_italic_flag;
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
-
}
gl_debug (DEBUG_LABEL, "END");
/*****************************************************************************/
static void
set_text_alignment (glLabelObject *object,
- PangoAlignment text_alignment)
+ PangoAlignment text_alignment,
+ gboolean checkpoint)
{
glLabelText *ltext = (glLabelText *)object;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
- if (ltext->priv->align != text_alignment) {
+ if (ltext->priv->align != text_alignment)
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Align text"));
+ }
ltext->priv->size_changed = TRUE;
ltext->priv->align = text_alignment;
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
-
}
gl_debug (DEBUG_LABEL, "END");
/*****************************************************************************/
static void
set_text_line_spacing (glLabelObject *object,
- gdouble line_spacing)
+ gdouble line_spacing,
+ gboolean checkpoint)
{
glLabelText *ltext = (glLabelText *)object;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
- if (ltext->priv->line_spacing != line_spacing) {
+ if (ltext->priv->line_spacing != line_spacing)
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Line spacing"));
+ }
ltext->priv->size_changed = TRUE;
ltext->priv->line_spacing = line_spacing;
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
-
}
gl_debug (DEBUG_LABEL, "END");
/*****************************************************************************/
static void
set_text_color (glLabelObject *object,
- glColorNode *text_color_node)
+ glColorNode *text_color_node,
+ gboolean checkpoint)
{
glLabelText *ltext = (glLabelText *)object;
+ glLabel *label;
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
- if (!gl_color_node_equal (ltext->priv->color_node, text_color_node)) {
+ if (!gl_color_node_equal (ltext->priv->color_node, text_color_node))
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Text color"));
+ }
gl_color_node_free (&(ltext->priv->color_node));
ltext->priv->color_node = gl_color_node_dup (text_color_node);
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
-
}
gl_debug (DEBUG_LABEL, "END");
/*****************************************************************************/
void
gl_label_text_set_auto_shrink (glLabelText *ltext,
- gboolean auto_shrink)
+ gboolean auto_shrink,
+ gboolean checkpoint)
{
+ glLabel *label;
+
gl_debug (DEBUG_LABEL, "BEGIN");
g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext));
- if (ltext->priv->auto_shrink != auto_shrink) {
+ if (ltext->priv->auto_shrink != auto_shrink)
+ {
+ if ( checkpoint )
+ {
+ label = gl_label_object_get_parent (GL_LABEL_OBJECT (ltext));
+ gl_label_checkpoint (label, _("Auto shrink"));
+ }
ltext->priv->auto_shrink = auto_shrink;
gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext));
-
}
gl_debug (DEBUG_LABEL, "END");
GType gl_label_text_get_type (void) G_GNUC_CONST;
-GObject *gl_label_text_new (glLabel *label);
+GObject *gl_label_text_new (glLabel *label,
+ gboolean checkpoint);
void gl_label_text_set_lines (glLabelText *ltext,
- GList *lines);
+ GList *lines,
+ gboolean checkpoint);
void gl_label_text_set_text (glLabelText *ltext,
- const gchar *text);
+ const gchar *text,
+ gboolean checkpoint);
GtkTextBuffer *gl_label_text_get_buffer (glLabelText *ltext);
GList *gl_label_text_get_lines (glLabelText *ltext);
void gl_label_text_set_auto_shrink (glLabelText *ltext,
- gboolean auto_shrink);
+ gboolean auto_shrink,
+ gboolean checkpoint);
gboolean gl_label_text_get_auto_shrink (glLabelText *ltext);
gchar *filename;
gint compression;
- gboolean modified_flag;
gint untitled_instance;
+ gboolean modified_flag;
+ GTimeVal time_stamp;
+
lglTemplate *template;
gboolean rotate_flag;
/* Default object fill properties */
guint default_fill_color;
+
+ /* Undo/Redo state */
+ GQueue *undo_stack;
+ GQueue *redo_stack;
+ gboolean cp_cleared_flag;
+ gchar *cp_desc;
};
typedef struct {
LAST_SIGNAL
};
+typedef struct {
+ gchar *description;
+
+ gboolean modified_flag;
+ GTimeVal time_stamp;
+
+ lglTemplate *template;
+ gboolean rotate_flag;
+
+ GList *object_list;
+
+ glMerge *merge;
+
+} State;
+
/*========================================================*/
/* Private globals. */
GdkPixbuf *pixbuf,
glLabel *label);
+static void stack_clear (GQueue *stack);
+static void stack_push_state (GQueue *stack,
+ State *state);
+static State *stack_pop_state (GQueue *stack);
+
+static State *state_new (glLabel *this,
+ const gchar *description);
+static void state_free (State *state);
+static void state_restore (State *state,
+ glLabel *this);
+
/*****************************************************************************/
/* Boilerplate object stuff. */
label->priv = g_new0 (glLabelPrivate, 1);
- label->priv->template = NULL;
- label->priv->rotate_flag = FALSE;
- label->priv->object_list = NULL;
+ label->priv->template = NULL;
+ label->priv->rotate_flag = FALSE;
+ label->priv->object_list = NULL;
label->priv->filename = NULL;
label->priv->modified_flag = FALSE;
label->priv->compression = 9;
- label->priv->merge = NULL;
- label->priv->pixbuf_cache = gl_pixbuf_cache_new ();
+ label->priv->merge = NULL;
+ label->priv->pixbuf_cache = gl_pixbuf_cache_new ();
+
+ label->priv->undo_stack = g_queue_new ();
+ label->priv->redo_stack = g_queue_new ();
/*
* Defaults from preferences
gl_pixbuf_cache_free (label->priv->pixbuf_cache);
g_free (label->priv->default_font_family);
+ stack_clear (label->priv->undo_stack);
+ stack_clear (label->priv->redo_stack);
+
+ g_queue_free (label->priv->undo_stack);
+ g_queue_free (label->priv->redo_stack);
+
g_free (label->priv);
G_OBJECT_CLASS (gl_label_parent_class)->finalize (object);
if ( label->priv->modified_flag )
{
+
+ g_get_current_time (&label->priv->time_stamp);
label->priv->modified_flag = FALSE;
g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0);
/****************************************************************************/
void
gl_label_set_template (glLabel *label,
- const lglTemplate *template)
+ const lglTemplate *template,
+ gboolean checkpoint)
{
gchar *name;
!lgl_template_do_templates_match (template, label->priv->template))
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Label properties"));
+ }
+
lgl_template_free (label->priv->template);
label->priv->template = lgl_template_dup (template);
/****************************************************************************/
void
gl_label_set_rotate_flag (glLabel *label,
- gboolean rotate_flag)
+ gboolean rotate_flag,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
if (rotate_flag != label->priv->rotate_flag)
{
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Label properties"));
+ }
+
label->priv->rotate_flag = rotate_flag;
do_modify (label);
/****************************************************************************/
void
gl_label_set_merge (glLabel *label,
- glMerge *merge)
+ glMerge *merge,
+ gboolean checkpoint)
{
gl_debug (DEBUG_LABEL, "START");
g_return_if_fail (label && GL_IS_LABEL (label));
+ if ( checkpoint )
+ {
+ gl_label_checkpoint (label, _("Merge properties"));
+ }
+
if ( label->priv->merge != NULL )
{
g_object_unref (G_OBJECT(label->priv->merge));
g_return_if_fail (label && GL_IS_LABEL (label));
g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
- object->parent = label;
+ gl_label_object_set_parent (object, label);
label->priv->object_list = g_list_append (label->priv->object_list, object);
g_signal_connect (G_OBJECT (object), "changed",
gl_label_object_select (object);
+ label->priv->cp_cleared_flag = TRUE;
g_signal_emit (G_OBJECT(label), signals[SELECTION_CHANGED], 0);
gl_debug (DEBUG_LABEL, "END");
gl_label_object_unselect (object);
+ label->priv->cp_cleared_flag = TRUE;
g_signal_emit (G_OBJECT(label), signals[SELECTION_CHANGED], 0);
gl_debug (DEBUG_LABEL, "END");
gl_label_object_select (object);
}
+ label->priv->cp_cleared_flag = TRUE;
g_signal_emit (G_OBJECT(label), signals[SELECTION_CHANGED], 0);
gl_debug (DEBUG_LABEL, "END");
gl_label_object_unselect (object);
}
+ label->priv->cp_cleared_flag = TRUE;
g_signal_emit (G_OBJECT(label), signals[SELECTION_CHANGED], 0);
gl_debug (DEBUG_LABEL, "END");
}
}
+ label->priv->cp_cleared_flag = TRUE;
g_signal_emit (G_OBJECT(label), signals[SELECTION_CHANGED], 0);
gl_debug (DEBUG_LABEL, "END");
g_return_if_fail (label && GL_IS_LABEL (label));
+ gl_label_checkpoint (label, _("Delete"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
gl_debug (DEBUG_LABEL, "START");
+ gl_label_checkpoint (label, _("Bring to front"));
+
+ begin_selection_op (label);
+
selection_list = gl_label_get_selection_list (label);
for ( p = selection_list; p != NULL; p = p->next )
do_modify (label);
+ end_selection_op (label);
+
gl_debug (DEBUG_LABEL, "END");
}
gl_debug (DEBUG_LABEL, "START");
+ gl_label_checkpoint (label, _("Send to back"));
+
+ begin_selection_op (label);
+
selection_list = gl_label_get_selection_list (label);
for ( p = selection_list; p != NULL; p = p->next )
do_modify (label);
+ end_selection_op (label);
+
gl_debug (DEBUG_LABEL, "END");
}
begin_selection_op (label);
+ gl_label_checkpoint (label, _("Rotate"));
+
selection_list = gl_label_get_selection_list (label);
for ( p = selection_list; p != NULL; p = p->next )
begin_selection_op (label);
+ gl_label_checkpoint (label, _("Rotate left"));
+
selection_list = gl_label_get_selection_list (label);
for ( p = selection_list; p != NULL; p = p->next )
g_return_if_fail (label && GL_IS_LABEL (label));
+ gl_label_checkpoint (label, _("Rotate right"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
g_return_if_fail (label && GL_IS_LABEL (label));
+ gl_label_checkpoint (label, _("Flip horizontally"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
g_return_if_fail (label && GL_IS_LABEL (label));
+ gl_label_checkpoint (label, _("Flip verically"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
g_return_if_fail (!gl_label_is_selection_empty (label) &&
!gl_label_is_selection_atomic (label));
+ gl_label_checkpoint (label, _("Align left"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
gl_label_object_get_extent (object, &obj_extent);
dx = x1_min - obj_extent.x1;
- gl_label_object_set_position_relative (object, dx, 0.0);
+ gl_label_object_set_position_relative (object, dx, 0.0, FALSE);
}
g_list_free (selection_list);
g_return_if_fail (!gl_label_is_selection_empty (label) &&
!gl_label_is_selection_atomic (label));
+ gl_label_checkpoint (label, _("Align right"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
gl_label_object_get_extent (object, &obj_extent);
dx = x2_max - obj_extent.x2;
- gl_label_object_set_position_relative (object, dx, 0.0);
+ gl_label_object_set_position_relative (object, dx, 0.0, FALSE);
}
g_list_free (selection_list);
g_return_if_fail (!gl_label_is_selection_empty (label) &&
!gl_label_is_selection_atomic (label));
+ gl_label_checkpoint (label, _("Align horizontal center"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
gl_label_object_get_extent (object, &obj_extent);
dx = xcenter - (obj_extent.x1 + obj_extent.x2)/2.0;
- gl_label_object_set_position_relative (object, dx, 0.0);
+ gl_label_object_set_position_relative (object, dx, 0.0, FALSE);
}
g_list_free (selection_list);
g_return_if_fail (!gl_label_is_selection_empty (label) &&
!gl_label_is_selection_atomic (label));
+ gl_label_checkpoint (label, _("Align tops"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
gl_label_object_get_extent (object, &obj_extent);
dy = y1_min - obj_extent.y1;
- gl_label_object_set_position_relative (object, 0.0, dy);
+ gl_label_object_set_position_relative (object, 0.0, dy, FALSE);
}
g_list_free (selection_list);
g_return_if_fail (!gl_label_is_selection_empty (label) &&
!gl_label_is_selection_atomic (label));
+ gl_label_checkpoint (label, _("Align bottoms"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
gl_label_object_get_extent (object, &obj_extent);
dy = y2_max - obj_extent.y2;
- gl_label_object_set_position_relative (object, 0.0, dy);
+ gl_label_object_set_position_relative (object, 0.0, dy, FALSE);
}
g_list_free (selection_list);
g_return_if_fail (!gl_label_is_selection_empty (label) &&
!gl_label_is_selection_atomic (label));
+ gl_label_checkpoint (label, _("Align vertical center"));
+
begin_selection_op (label);
selection_list = gl_label_get_selection_list (label);
gl_label_object_get_extent (object, &obj_extent);
dy = ycenter - (obj_extent.y1 + obj_extent.y2)/2.0;
- gl_label_object_set_position_relative (object, 0.0, dy);
+ gl_label_object_set_position_relative (object, 0.0, dy, FALSE);
}
g_list_free (selection_list);
g_return_if_fail (!gl_label_is_selection_empty (label));
+ gl_label_checkpoint (label, _("Center horizontally"));
+
begin_selection_op (label);
gl_label_get_size (label, &w, &h);
gl_label_object_get_extent (object, &obj_extent);
x_obj_center = (obj_extent.x1 + obj_extent.x2) / 2.0;
dx = x_label_center - x_obj_center;
- gl_label_object_set_position_relative (object, dx, 0.0);
+ gl_label_object_set_position_relative (object, dx, 0.0, FALSE);
}
g_list_free (selection_list);
g_return_if_fail (!gl_label_is_selection_empty (label));
+ gl_label_checkpoint (label, _("Center vertically"));
+
begin_selection_op (label);
gl_label_get_size (label, &w, &h);
gl_label_object_get_extent (object, &obj_extent);
y_obj_center = (obj_extent.y1 + obj_extent.y2) / 2.0;
dy = y_label_center - y_obj_center;
- gl_label_object_set_position_relative (object, 0.0, dy);
+ gl_label_object_set_position_relative (object, 0.0, dy, FALSE);
}
g_list_free (selection_list);
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_position_relative (object, dx, dy);
+ gl_label_object_set_position_relative (object, dx, dy, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_font_family (object, font_family);
+ gl_label_object_set_font_family (object, font_family, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_font_size (object, font_size);
+ gl_label_object_set_font_size (object, font_size, TRUE);
}
g_list_free (selection_list);
g_return_if_fail (label && GL_IS_LABEL (label));
+ begin_selection_op (label);
+
selection_list = gl_label_get_selection_list (label);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_font_weight (object, font_weight);
+ gl_label_object_set_font_weight (object, font_weight, TRUE);
}
g_list_free (selection_list);
+ end_selection_op (label);
gl_debug (DEBUG_LABEL, "END");
}
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_font_italic_flag (object, font_italic_flag);
+ gl_label_object_set_font_italic_flag (object, font_italic_flag, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_text_alignment (object, text_alignment);
+ gl_label_object_set_text_alignment (object, text_alignment, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_text_line_spacing (object, text_line_spacing);
+ gl_label_object_set_text_line_spacing (object, text_line_spacing, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_text_color (object, text_color_node);
+ gl_label_object_set_text_color (object, text_color_node, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_fill_color (object, fill_color_node);
+ gl_label_object_set_fill_color (object, fill_color_node, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_line_color (object, line_color_node);
+ gl_label_object_set_line_color (object, line_color_node, TRUE);
}
g_list_free (selection_list);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_set_line_width (object, line_width);
+ gl_label_object_set_line_width (object, line_width, TRUE);
}
g_list_free (selection_list);
*/
label_copy = GL_LABEL(gl_label_new ());
- gl_label_set_template (label_copy, label->priv->template);
- gl_label_set_rotate_flag (label_copy, label->priv->rotate_flag);
+ gl_label_set_template (label_copy, label->priv->template, FALSE);
+ gl_label_set_rotate_flag (label_copy, label->priv->rotate_flag, FALSE);
for (p = selection_list; p != NULL; p = p->next)
{
object = GL_LABEL_OBJECT (p->data);
- gl_label_object_dup (object, label_copy);
+ gl_label_add_object (label_copy, gl_label_object_dup (object, label_copy));
}
data->xml_buffer = gl_xml_label_save_buffer (label_copy, &status);
gl_debug (DEBUG_LABEL, "START");
+ gl_label_checkpoint (label, _("Paste"));
+
xml_buffer = (gchar *)gtk_selection_data_get_data (selection_data);
/*
{
object = (glLabelObject *) p->data;
newobject = gl_label_object_dup (object, label);
+ gl_label_add_object( label, newobject );
gl_label_select_object (label, newobject);
gl_debug (DEBUG_LABEL, "START");
+ gl_label_checkpoint (label, _("Paste"));
+
gl_label_unselect_all (label);
- object = GL_LABEL_OBJECT (gl_label_text_new (label));
- gl_label_text_set_text (GL_LABEL_TEXT (object), text);
- gl_label_object_set_position (object, 18, 18);
+ object = GL_LABEL_OBJECT (gl_label_text_new (label, FALSE));
+ gl_label_text_set_text (GL_LABEL_TEXT (object), text, FALSE);
+ gl_label_object_set_position (object, 18, 18, FALSE);
gl_label_select_object (label, object);
gl_debug (DEBUG_LABEL, "START");
+ gl_label_checkpoint (label, _("Paste"));
+
gl_label_unselect_all (label);
- object = GL_LABEL_OBJECT (gl_label_image_new (label));
- gl_label_image_set_pixbuf (GL_LABEL_IMAGE (object), pixbuf);
- gl_label_object_set_position (object, 18, 18);
+ object = GL_LABEL_OBJECT (gl_label_image_new (label, FALSE));
+ gl_label_image_set_pixbuf (GL_LABEL_IMAGE (object), pixbuf, FALSE);
+ gl_label_object_set_position (object, 18, 18, FALSE);
gl_label_select_object (label, object);
}
+/****************************************************************************/
+/* Checkpoint state. */
+/****************************************************************************/
+void
+gl_label_checkpoint (glLabel *this,
+ const gchar *description)
+{
+ State *state;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ /*
+ * Do not perform consecutive checkpoints that are identical.
+ * E.g. moving an object by dragging, would produce a large number
+ * of incremental checkpoints -- what we really want is a single
+ * checkpoint so that we can undo the entire dragging effort with
+ * one "undo"
+ */
+ if ( this->priv->cp_cleared_flag
+ || (this->priv->cp_desc == NULL)
+ || (strcmp (description, this->priv->cp_desc) != 0) )
+ {
+
+ /* Sever old redo "thread" */
+ stack_clear (this->priv->redo_stack);
+
+ /* Save state onto undo stack. */
+ state = state_new (this, description);
+ stack_push_state (this->priv->undo_stack, state);
+
+ /* Track consecutive checkpoints. */
+ this->priv->cp_cleared_flag = FALSE;
+ this->priv->cp_desc = g_strdup (description);
+ }
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+
+/****************************************************************************/
+/* Undo. */
+/****************************************************************************/
+void
+gl_label_undo (glLabel *this)
+{
+ State *state_old;
+ State *state_now;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ state_old = stack_pop_state (this->priv->undo_stack);
+ state_now = state_new (this, state_old->description);
+
+ stack_push_state (this->priv->redo_stack, state_now);
+
+ state_restore (state_old, this);
+ state_free (state_old);
+
+ this->priv->cp_cleared_flag = TRUE;
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+
+/****************************************************************************/
+/* Redo. */
+/****************************************************************************/
+void
+gl_label_redo (glLabel *this)
+{
+ State *state_old;
+ State *state_now;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ state_old = stack_pop_state (this->priv->redo_stack);
+ state_now = state_new (this, state_old->description);
+
+ stack_push_state (this->priv->undo_stack, state_now);
+
+ state_restore (state_old, this);
+ state_free (state_old);
+
+ this->priv->cp_cleared_flag = TRUE;
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+
/****************************************************************************/
/* Can undo? */
/****************************************************************************/
gboolean
-gl_label_can_undo (glLabel *label)
+gl_label_can_undo (glLabel *this)
{
- return FALSE;
+ return (!g_queue_is_empty (this->priv->undo_stack));
}
/* Can redo? */
/****************************************************************************/
gboolean
-gl_label_can_redo (glLabel *label)
+gl_label_can_redo (glLabel *this)
{
- return FALSE;
+ return (!g_queue_is_empty (this->priv->redo_stack));
+}
+
+
+/****************************************************************************/
+/* Get undo description string. */
+/****************************************************************************/
+gchar *
+gl_label_get_undo_description (glLabel *this)
+{
+ State *state;
+ gchar *description;
+
+ state = g_queue_peek_head (this->priv->undo_stack);
+ if ( state )
+ {
+ description = g_strdup (state->description);
+ }
+ else
+ {
+ description = g_strdup ("");
+ }
+
+ return description;
+}
+
+
+/****************************************************************************/
+/* Get redo description string. */
+/****************************************************************************/
+gchar *
+gl_label_get_redo_description (glLabel *this)
+{
+ State *state;
+ gchar *description;
+
+ state = g_queue_peek_head (this->priv->redo_stack);
+ if ( state )
+ {
+ description = g_strdup (state->description);
+ }
+ else
+ {
+ description = g_strdup ("");
+ }
+
+ return description;
+}
+
+
+/****************************************************************************/
+/* Clear undo or redo stack. */
+/****************************************************************************/
+static void
+stack_clear (GQueue *stack)
+{
+ State *state;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ while ( (state = g_queue_pop_head (stack)) != NULL )
+ {
+ state_free (state);
+ }
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+
+/****************************************************************************/
+/* Push state onto stack. */
+/****************************************************************************/
+static void
+stack_push_state (GQueue *stack,
+ State *state)
+{
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_queue_push_head( stack, state );
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+
+/****************************************************************************/
+/* Pop state from stack. */
+/****************************************************************************/
+static State *
+stack_pop_state (GQueue *stack)
+{
+ State *state;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ state = g_queue_pop_head (stack);
+
+ gl_debug (DEBUG_LABEL, "END");
+ return state;
+}
+
+
+/****************************************************************************/
+/* New state from label. */
+/****************************************************************************/
+static State *
+state_new (glLabel *this,
+ const gchar *description)
+{
+ State *state;
+ GList *p_obj;
+ glLabelObject *object;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ state = g_new0 (State, 1);
+
+ state->description = g_strdup (description);
+
+ state->template = lgl_template_dup (this->priv->template);
+ state->rotate_flag = this->priv->rotate_flag;
+
+ for ( p_obj = this->priv->object_list; p_obj != NULL; p_obj = p_obj->next )
+ {
+ object = GL_LABEL_OBJECT (p_obj->data);
+
+ state->object_list = g_list_append (state->object_list,
+ gl_label_object_dup (object, this));
+ }
+
+ state->merge = gl_merge_dup (this->priv->merge);
+
+ state->modified_flag = this->priv->modified_flag;
+ state->time_stamp = this->priv->time_stamp;
+
+
+ gl_debug (DEBUG_LABEL, "END");
+ return state;
+}
+
+
+/****************************************************************************/
+/* Restore label from saved state. */
+/****************************************************************************/
+static void
+state_free (State *state)
+{
+ GList *p_obj;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ g_free (state->description);
+
+ lgl_template_free (state->template);
+ if ( state->merge )
+ {
+ g_object_unref (G_OBJECT (state->merge));
+ }
+
+ for ( p_obj = state->object_list; p_obj != NULL; p_obj = p_obj->next )
+ {
+ g_object_unref (G_OBJECT (p_obj->data));
+ }
+ g_list_free (state->object_list);
+
+ g_free (state);
+
+ gl_debug (DEBUG_LABEL, "END");
+}
+
+
+/****************************************************************************/
+/* Restore label from saved state. */
+/****************************************************************************/
+static void
+state_restore (State *state,
+ glLabel *this)
+
+{
+ GList *p_obj, *p_next;
+ glLabelObject *object;
+
+ gl_debug (DEBUG_LABEL, "START");
+
+ gl_label_set_rotate_flag (this, state->rotate_flag, FALSE);
+ gl_label_set_template (this, state->template, FALSE);
+
+ for ( p_obj = this->priv->object_list; p_obj != NULL; p_obj = p_next )
+ {
+ p_next = p_obj->next; /* Hold on to next; delete is destructive */
+ object = GL_LABEL_OBJECT (p_obj->data);
+
+ gl_label_delete_object (this, object);
+ }
+
+ for ( p_obj = state->object_list; p_obj != NULL; p_obj = p_obj->next )
+ {
+ object = GL_LABEL_OBJECT (p_obj->data);
+
+ gl_label_add_object (this, gl_label_object_dup (object, this));
+ }
+ g_signal_emit (G_OBJECT(this), signals[SELECTION_CHANGED], 0);
+
+ gl_label_set_merge (this, state->merge, FALSE);
+
+
+ if ( !state->modified_flag &&
+ (state->time_stamp.tv_sec == this->priv->time_stamp.tv_sec) &&
+ (state->time_stamp.tv_usec == this->priv->time_stamp.tv_usec) )
+ {
+ gl_label_clear_modified (this);
+ }
+
+ gl_debug (DEBUG_LABEL, "END");
}
gboolean gl_label_is_modified (glLabel *label);
-void gl_label_set_template (glLabel *label,
- const lglTemplate *template);
+void gl_label_set_template (glLabel *label,
+ const lglTemplate *template,
+ gboolean checkpoint);
const lglTemplate *gl_label_get_template (glLabel *label);
void gl_label_set_rotate_flag (glLabel *label,
- gboolean rotate_flag);
+ gboolean rotate_flag,
+ gboolean checkpoint);
gboolean gl_label_get_rotate_flag (glLabel *label);
void gl_label_set_merge (glLabel *label,
- glMerge *merge);
+ glMerge *merge,
+ gboolean checkpoint);
glMerge *gl_label_get_merge (glLabel *label);
glLabelObjectHandle *handle);
-
-
-
/*
* Undo/Redo methods
*/
-gboolean gl_label_can_undo (glLabel *label);
+void gl_label_checkpoint (glLabel *label,
+ const gchar *description);
+gboolean gl_label_can_undo (glLabel *label);
gboolean gl_label_can_redo (glLabel *label);
+gchar *gl_label_get_undo_description (glLabel *label);
+gchar *gl_label_get_redo_description (glLabel *label);
+
+void gl_label_undo (glLabel *label);
+void gl_label_redo (glLabel *label);
+
G_END_DECLS
switch (response) {
case GTK_RESPONSE_OK:
- gl_label_set_merge (dialog->priv->label, dialog->priv->merge);
+ gl_label_set_merge (dialog->priv->label, dialog->priv->merge, TRUE);
gtk_widget_hide (GTK_WIDGET (dialog));
break;
case GTK_RESPONSE_CANCEL:
gdouble shadow_x, shadow_y;
glColorNode *shadow_color_node;
gdouble shadow_opacity;
+ glLabel *label;
glMerge *merge;
gl_debug (DEBUG_EDITOR, "BEGIN");
gl_label_object_get_position (object, &x, &y);
gl_object_editor_set_position (editor, x, y);
- merge = gl_label_get_merge (GL_LABEL(object->parent));
+ label = gl_label_object_get_parent (object);
+ merge = gl_label_get_merge (label);
if ( GL_IS_LABEL_BOX (object) || GL_IS_LABEL_ELLIPSE (object) )
{
glLabelObject *object = editor->priv->object;
gdouble x, y;
- gdouble w, h;
glColorNode *line_color_node;
gdouble line_width;
glColorNode *fill_color_node;
gboolean auto_shrink;
glTextNode *filename;
const GdkPixbuf *pixbuf;
+ gdouble w, h;
gdouble image_w, image_h;
gdouble new_w, new_h;
glTextNode *bc_data;
gl_object_editor_get_position (editor, &x, &y);
- gl_label_object_set_position (object, x, y);
+ gl_label_object_set_position (object, x, y, TRUE);
if ( GL_IS_LABEL_BOX (object) || GL_IS_LABEL_ELLIPSE (object) )
{
- gl_object_editor_get_size (editor, &w, &h);
fill_color_node = gl_object_editor_get_fill_color (editor);
line_color_node = gl_object_editor_get_line_color (editor);
line_width = gl_object_editor_get_line_width (editor);
- gl_label_object_set_size (object, w, h);
- gl_label_object_set_fill_color (object, fill_color_node);
- gl_label_object_set_line_color (object, line_color_node);
- gl_label_object_set_line_width (object, line_width);
+ gl_label_object_set_fill_color (object, fill_color_node, TRUE);
+ gl_label_object_set_line_color (object, line_color_node, TRUE);
+ gl_label_object_set_line_width (object, line_width, TRUE);
gl_color_node_free (&fill_color_node);
gl_color_node_free (&line_color_node);
else if (GL_IS_LABEL_LINE (object))
{
- gl_object_editor_get_lsize (editor, &w, &h);
line_color_node = gl_object_editor_get_line_color (editor);
line_width = gl_object_editor_get_line_width (editor);
- gl_label_object_set_size (object, w, h);
- gl_label_object_set_line_color (object, line_color_node);
- gl_label_object_set_line_width (object, line_width);
+ gl_label_object_set_line_color (object, line_color_node, TRUE);
+ gl_label_object_set_line_width (object, line_width, TRUE);
gl_color_node_free (&line_color_node);
else if ( GL_IS_LABEL_IMAGE (object) )
{
- gl_object_editor_get_size (editor, &w, &h);
filename = gl_object_editor_get_image (editor);
- gl_label_object_set_size (object, w, h);
- gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename);
+ gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename, TRUE);
/* Setting filename may have modified the size. */
+ gl_object_editor_get_size (editor, &w, &h);
gl_label_object_get_size (object, &new_w, &new_h);
if ( (new_w != w) || (new_h != h) )
{
else if (GL_IS_LABEL_TEXT (object))
{
- gl_object_editor_get_size (editor, &w, &h);
font_family = gl_object_editor_get_font_family (editor);
font_size = gl_object_editor_get_font_size (editor);
font_weight = gl_object_editor_get_font_weight (editor);
text_line_spacing = gl_object_editor_get_text_line_spacing (editor);
auto_shrink = gl_object_editor_get_text_auto_shrink (editor);
- gl_label_object_set_size (object, w, h);
- gl_label_object_set_font_family (object, font_family);
- gl_label_object_set_font_size (object, font_size);
- gl_label_object_set_font_weight (object, font_weight);
- gl_label_object_set_font_italic_flag (object, font_italic_flag);
- gl_label_object_set_text_color (object, text_color_node);
- gl_label_object_set_text_alignment (object, align);
- gl_label_object_set_text_line_spacing (object, text_line_spacing);
- gl_label_text_set_auto_shrink (GL_LABEL_TEXT (object), auto_shrink);
+ gl_label_object_set_font_family (object, font_family, TRUE);
+ gl_label_object_set_font_size (object, font_size, TRUE);
+ gl_label_object_set_font_weight (object, font_weight, TRUE);
+ gl_label_object_set_font_italic_flag (object, font_italic_flag, TRUE);
+ gl_label_object_set_text_color (object, text_color_node, TRUE);
+ gl_label_object_set_text_alignment (object, align, TRUE);
+ gl_label_object_set_text_line_spacing (object, text_line_spacing, TRUE);
+ gl_label_text_set_auto_shrink (GL_LABEL_TEXT (object), auto_shrink, TRUE);
gl_color_node_free (&text_color_node);
g_free (font_family);
else if (GL_IS_LABEL_BARCODE (object))
{
- gl_object_editor_get_size (editor, &w, &h);
line_color_node = gl_object_editor_get_bc_color (editor);
bc_data = gl_object_editor_get_data (editor);
gl_object_editor_get_bc_style (editor,
&id, &text_flag, &cs_flag, &format_digits);
- gl_label_object_set_size (object, w, h);
- gl_label_object_set_line_color (object, line_color_node);
- gl_label_barcode_set_data (GL_LABEL_BARCODE(object), bc_data);
+ gl_label_object_set_line_color (object, line_color_node, TRUE);
+ gl_label_barcode_set_data (GL_LABEL_BARCODE(object), bc_data, TRUE);
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
- id, text_flag, cs_flag, format_digits);
+ id, text_flag, cs_flag, format_digits, TRUE);
gl_color_node_free (&line_color_node);
gl_text_node_free (&bc_data);
shadow_color_node = gl_object_editor_get_shadow_color (editor);
shadow_opacity = gl_object_editor_get_shadow_opacity (editor);
- gl_label_object_set_position (object, x, y);
- gl_label_object_set_shadow_state (object, shadow_state);
- gl_label_object_set_shadow_offset (object, shadow_x, shadow_y);
- gl_label_object_set_shadow_color (object, shadow_color_node);
- gl_label_object_set_shadow_opacity (object, shadow_opacity);
+ gl_label_object_set_shadow_state (object, shadow_state, TRUE);
+ gl_label_object_set_shadow_offset (object, shadow_x, shadow_y, TRUE);
+ gl_label_object_set_shadow_color (object, shadow_color_node, TRUE);
+ gl_label_object_set_shadow_opacity (object, shadow_opacity, TRUE);
gl_color_node_free (&shadow_color_node);
gl_object_editor_get_size (editor, &w, &h);
}
- gl_label_object_set_size (object, w, h);
+ gl_label_object_set_size (object, w, h, TRUE);
editor->priv->stop_signals = FALSE;
label = gl_label_new ();
template = build_template (dialog);
- gl_label_set_template (GL_LABEL(label), template);
+ gl_label_set_template (GL_LABEL(label), template, FALSE);
print_op = gl_print_op_dialog_new (GL_LABEL(label));
gl_print_op_force_outline (GL_PRINT_OP (print_op));
}
+/****************************************************************************/
+/** Edit/Undo command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_undo (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_label_undo (GL_LABEL (GL_VIEW (window->view)->label));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+
+/****************************************************************************/
+/** Edit/Redo command. */
+/****************************************************************************/
+void
+gl_ui_cmd_edit_redo (GtkAction *action,
+ glWindow *window)
+{
+ gl_debug (DEBUG_COMMANDS, "START");
+
+ g_return_if_fail (action && GTK_IS_ACTION(action));
+ g_return_if_fail (window && GL_IS_WINDOW(window));
+
+ gl_label_redo (GL_LABEL (GL_VIEW (window->view)->label));
+
+ gl_debug (DEBUG_COMMANDS, "END");
+}
+
+
/****************************************************************************/
/** Edit/Cut command. */
/****************************************************************************/
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_raise_selection_to_top (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_raise_selection_to_top (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_lower_selection_to_bottom (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_lower_selection_to_bottom (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_rotate_selection_left (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_rotate_selection_left (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_rotate_selection_right (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_rotate_selection_right (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_flip_selection_horiz (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_flip_selection_horiz (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_flip_selection_vert (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_flip_selection_vert (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_align_selection_left (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_align_selection_left (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_align_selection_right (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_align_selection_right (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_align_selection_hcenter (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_align_selection_hcenter (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_align_selection_top (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_align_selection_top (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_align_selection_bottom (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_align_selection_bottom (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_align_selection_vcenter (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_align_selection_vcenter (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_center_selection_horiz (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_center_selection_horiz (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
g_return_if_fail (action && GTK_IS_ACTION(action));
g_return_if_fail (window && GL_IS_WINDOW(window));
- if (window->view != NULL) {
- gl_label_center_selection_vert (GL_VIEW(window->view)->label);
+ if (window->label != NULL) {
+ gl_label_center_selection_vert (window->label);
}
gl_debug (DEBUG_COMMANDS, "END");
+void gl_ui_cmd_edit_undo (GtkAction *action,
+ glWindow *window);
+
+void gl_ui_cmd_edit_redo (GtkAction *action,
+ glWindow *window);
+
void gl_ui_cmd_edit_undo (GtkAction *action,
glWindow *window);
set_doc_items_sensitive (this, TRUE);
- this->priv->label = GL_LABEL (g_object_ref (G_OBJECT (label)));
-
reset_to_default_properties (label, this);
+ this->priv->label = GL_LABEL (g_object_ref (G_OBJECT (label)));
+
g_signal_connect_swapped (G_OBJECT(label), "selection_changed",
G_CALLBACK(selection_changed_cb), this);
/* Edit action entries. */
+ { "EditUndo",
+ GTK_STOCK_UNDO,
+ N_("Undo"),
+ "<control>Z",
+ N_("Undo"),
+ G_CALLBACK (gl_ui_cmd_edit_undo) },
+
+ { "EditRedo",
+ GTK_STOCK_REDO,
+ N_("Redo"),
+ "<shift><control>Z",
+ N_("Redo"),
+ G_CALLBACK (gl_ui_cmd_edit_redo) },
+
{ "EditCut",
GTK_STOCK_CUT,
N_("Cut"),
" <menuitem action='FileQuit' />"
" </menu>"
" <menu action='EditMenu'>"
+" <menuitem action='EditUndo' />"
+" <menuitem action='EditRedo' />"
+" <separator />"
" <menuitem action='EditCut' />"
" <menuitem action='EditCopy' />"
" <menuitem action='EditPaste' />"
"/ui/MenuBar/FileMenu/FileSaveAs",
"/ui/MenuBar/FileMenu/FilePrint",
"/ui/MenuBar/FileMenu/FileClose",
+ "/ui/MenuBar/EditMenu/EditUndo",
+ "/ui/MenuBar/EditMenu/EditRedo",
"/ui/MenuBar/EditMenu/EditCut",
"/ui/MenuBar/EditMenu/EditCopy",
"/ui/MenuBar/EditMenu/EditDelete",
gl_ui_update_undo_redo_verbs (GtkUIManager *ui,
glLabel *label)
{
+ GtkWidget *menu_item;
+ gchar *description;
+ gchar *menu_label;
+
gl_debug (DEBUG_UI, "START");
+ menu_item = gtk_ui_manager_get_widget (ui, "/MenuBar/EditMenu/EditUndo");
+ description = gl_label_get_undo_description (label);
+ menu_label = g_strdup_printf ("%s: %s", _("Undo"), description);
+ gtk_menu_item_set_label (GTK_MENU_ITEM (menu_item), menu_label);
+ g_free (menu_label);
+ g_free (description);
+
+ menu_item = gtk_ui_manager_get_widget (ui, "/MenuBar/EditMenu/EditRedo");
+ description = gl_label_get_redo_description (label);
+ menu_label = g_strdup_printf ("%s: %s", _("Redo"), description);
+ gtk_menu_item_set_label (GTK_MENU_ITEM (menu_item), menu_label);
+ g_free (menu_label);
+ g_free (description);
+
gl_ui_util_set_verb_sensitive (ui, "/ui/MenuBar/EditMenu/EditUndo",
gl_label_can_undo (label));
gl_label_unselect_all (view->label);
- object = gl_label_barcode_new (view->label);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ object = gl_label_barcode_new (view->label, TRUE);
+
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
text_node = gl_text_node_new_from_text ("123456789");
- gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
+ gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node, FALSE);
view->create_object = GL_LABEL_OBJECT (object);
view->create_x0 = x;
gdouble x,
gdouble y)
{
- gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y, FALSE);
}
gdouble x,
gdouble y)
{
- gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y, FALSE);
}
gl_label_unselect_all (view->label);
- object = gl_label_box_new (view->label);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0);
+ object = gl_label_box_new (view->label, TRUE);
+
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0, FALSE);
view->create_object = GL_LABEL_OBJECT (object);
view->create_x0 = x;
gdouble w, h;
gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object),
- MIN (x, view->create_x0), MIN (y, view->create_y0));
+ MIN (x, view->create_x0), MIN (y, view->create_y0),
+ FALSE);
+
w = MAX (x, view->create_x0) - MIN (x, view->create_x0);
h = MAX (y, view->create_y0) - MIN (y, view->create_y0);
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
y = view->create_y0 + 36.0;
}
gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object),
- MIN (x, view->create_x0), MIN (y, view->create_y0));
+ MIN (x, view->create_x0), MIN (y, view->create_y0),
+ FALSE);
+
w = MAX (x, view->create_x0) - MIN (x, view->create_x0);
h = MAX (y, view->create_y0) - MIN (y, view->create_y0);
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
gl_label_unselect_all (view->label);
- object = gl_label_ellipse_new (view->label);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0);
+ object = gl_label_ellipse_new (view->label, TRUE);
+
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0, FALSE);
view->create_object = GL_LABEL_OBJECT (object);
view->create_x0 = x;
gdouble w, h;
gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object),
- MIN (x, view->create_x0), MIN (y, view->create_y0));
+ MIN (x, view->create_x0), MIN (y, view->create_y0),
+ FALSE);
+
w = MAX (x, view->create_x0) - MIN (x, view->create_x0);
h = MAX (y, view->create_y0) - MIN (y, view->create_y0);
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
y = view->create_y0 + 36.0;
}
gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object),
- MIN (x, view->create_x0), MIN (y, view->create_y0));
+ MIN (x, view->create_x0), MIN (y, view->create_y0),
+ FALSE);
+
w = MAX (x, view->create_x0) - MIN (x, view->create_x0);
h = MAX (y, view->create_y0) - MIN (y, view->create_y0);
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
gl_label_unselect_all (view->label);
- object = gl_label_image_new (view->label);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0);
+ object = gl_label_image_new (view->label, TRUE);
+
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0, FALSE);
view->create_object = GL_LABEL_OBJECT (object);
view->create_x0 = x;
gdouble w, h;
gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object),
- MIN (x, view->create_x0), MIN (y, view->create_y0));
+ MIN (x, view->create_x0), MIN (y, view->create_y0),
+ FALSE);
+
w = MAX (x, view->create_x0) - MIN (x, view->create_x0);
h = MAX (y, view->create_y0) - MIN (y, view->create_y0);
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
y = view->create_y0 + 36.0;
}
gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object),
- MIN (x, view->create_x0), MIN (y, view->create_y0));
+ MIN (x, view->create_x0), MIN (y, view->create_y0),
+ FALSE);
+
w = MAX (x, view->create_x0) - MIN (x, view->create_x0);
h = MAX (y, view->create_y0) - MIN (y, view->create_y0);
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
gl_label_unselect_all (view->label);
- object = gl_label_line_new (view->label);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0);
+ object = gl_label_line_new (view->label, TRUE);
+
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), 0.0, 0.0, FALSE);
view->create_object = GL_LABEL_OBJECT (object);
view->create_x0 = x;
w = x - view->create_x0;
h = y - view->create_y0;
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
}
w = x - view->create_x0;
h = y - view->create_y0;
- gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(view->create_object), w, h, FALSE);
}
gl_label_unselect_all (view->label);
- object = gl_label_text_new (view->label);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ object = gl_label_text_new (view->label, TRUE);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
lines = gl_text_node_lines_new_from_text (_("Text"));
- gl_label_text_set_lines (GL_LABEL_TEXT(object), lines);
+ gl_label_text_set_lines (GL_LABEL_TEXT(object), lines, FALSE);
view->create_object = GL_LABEL_OBJECT (object);
view->create_x0 = x;
gdouble x,
gdouble y)
{
- gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y, FALSE);
}
gdouble x,
gdouble y)
{
- gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(view->create_object), x, y, FALSE);
}
g_print ("Invalid handle.\n"); /* Should not happen! */
}
+
if ( (view->resize_handle != GL_LABEL_OBJECT_HANDLE_P1) &&
(view->resize_handle != GL_LABEL_OBJECT_HANDLE_P2) )
{
if ( view->resize_honor_aspect )
{
- gl_label_object_set_size_honor_aspect (view->resize_object, w, h);
+ gl_label_object_set_size_honor_aspect (view->resize_object, w, h, TRUE);
}
else
{
- gl_label_object_set_size (view->resize_object, w, h);
+ gl_label_object_set_size (view->resize_object, w, h, TRUE);
}
/*
}
else
{
- gl_label_object_set_size (view->resize_object, dx, dy);
+ gl_label_object_set_size (view->resize_object, dx, dy, TRUE);
}
/*
cairo_user_to_device (cr, &x0, &y0);
cairo_restore (cr);
cairo_device_to_user (cr, &x0, &y0);
- gl_label_object_set_position (view->resize_object, x0, y0);
+ gl_label_object_set_position (view->resize_object, x0, y0, FALSE);
}
static void set_copy_paste_sensitivity (glWindow *window,
GtkWidget *focus_widget);
+static void label_changed_cb (glLabel *label,
+ glWindow *window);
+
/****************************************************************************/
/* Boilerplate Object stuff. */
focus_widget = gtk_window_get_focus (GTK_WINDOW (window));
set_copy_paste_sensitivity (window, focus_widget);
+ g_signal_connect (G_OBJECT(label), "changed",
+ G_CALLBACK(label_changed_cb), window);
+
gl_debug (DEBUG_WINDOW, "END");
}
}
+/*---------------------------------------------------------------------------*/
+/** PRIVATE. Label "changed" callback. */
+/*---------------------------------------------------------------------------*/
+static void
+label_changed_cb (glLabel *label,
+ glWindow *window)
+{
+ gl_debug (DEBUG_WINDOW, "START");
+
+ g_return_if_fail (label && GL_IS_LABEL (label));
+ g_return_if_fail (window && GL_IS_WINDOW (window));
+
+ gl_ui_update_undo_redo_verbs (window->ui, label);
+
+ gl_debug (DEBUG_WINDOW, "END");
+}
+
+
+
/*---------------------------------------------------------------------------*/
/** PRIVATE. Clipboard "owner change" callback. */
/*---------------------------------------------------------------------------*/
label = GL_LABEL (gl_label_new ());
rotate_flag = lgl_xml_get_prop_boolean (root, "rotate", FALSE);
- gl_label_set_rotate_flag (label, rotate_flag);
+ gl_label_set_rotate_flag (label, rotate_flag, FALSE);
for (node = root->xmlChildrenNode; node != NULL; node = node->next) {
*status = XML_LABEL_UNKNOWN_MEDIA;
}
} else if (xmlStrEqual (node->name, (xmlChar *)"Text")) {
- object = gl_label_text_new (label);
+ object = gl_label_text_new (label, FALSE);
xml04_parse_object (node, GL_LABEL_OBJECT(object));
xml04_parse_text_props (node, GL_LABEL_TEXT(object));
} else if (xmlStrEqual (node->name, (xmlChar *)"Box")) {
- object = gl_label_box_new (label);
+ object = gl_label_box_new (label, FALSE);
xml04_parse_object (node, GL_LABEL_OBJECT(object));
xml04_parse_box_props (node, GL_LABEL_BOX(object));
} else if (xmlStrEqual (node->name, (xmlChar *)"Line")) {
- object = gl_label_line_new (label);
+ object = gl_label_line_new (label, FALSE);
xml04_parse_object (node, GL_LABEL_OBJECT(object));
xml04_parse_line_props (node, GL_LABEL_LINE(object));
} else if (xmlStrEqual (node->name, (xmlChar *)"Ellipse")) {
- object = gl_label_ellipse_new (label);
+ object = gl_label_ellipse_new (label, FALSE);
xml04_parse_object (node, GL_LABEL_OBJECT(object));
xml04_parse_ellipse_props (node,
GL_LABEL_ELLIPSE(object));
} else if (xmlStrEqual (node->name, (xmlChar *)"Image")) {
- object = gl_label_image_new (label);
+ object = gl_label_image_new (label, FALSE);
xml04_parse_object (node, GL_LABEL_OBJECT(object));
xml04_parse_image_props (node, GL_LABEL_IMAGE(object));
} else if (xmlStrEqual (node->name, (xmlChar *)"Barcode")) {
- object = gl_label_barcode_new (label);
+ object = gl_label_barcode_new (label, FALSE);
xml04_parse_object (node, GL_LABEL_OBJECT(object));
xml04_parse_barcode_props (node,
GL_LABEL_BARCODE(object));
ret = TRUE;
}
- gl_label_set_template (label, template);
+ gl_label_set_template (label, template, FALSE);
lgl_template_free (template);
xmlFree (template_name);
x = lgl_xml_get_prop_double (object_node, "x", 0);
y = lgl_xml_get_prop_double (object_node, "y", 0);
- gl_label_object_set_position (object, x, y);
+ gl_label_object_set_position (object, x, y, FALSE);
gl_debug (DEBUG_XML, "END");
}
color_node = gl_color_node_new_default ();
color_node->color = lgl_xml_get_prop_uint (object_node, "color", 0);
- gl_label_object_set_font_family (GL_LABEL_OBJECT(object), (gchar *)font_family);
- gl_label_object_set_font_size (GL_LABEL_OBJECT(object), font_size);
- gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), font_weight);
- gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), font_italic_flag);
- gl_label_object_set_text_color (GL_LABEL_OBJECT(object), color_node);
- gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align);
+ gl_label_object_set_font_family (GL_LABEL_OBJECT(object), (gchar *)font_family, FALSE);
+ gl_label_object_set_font_size (GL_LABEL_OBJECT(object), font_size, FALSE);
+ gl_label_object_set_font_weight (GL_LABEL_OBJECT(object), font_weight, FALSE);
+ gl_label_object_set_font_italic_flag (GL_LABEL_OBJECT(object), font_italic_flag, FALSE);
+ gl_label_object_set_text_color (GL_LABEL_OBJECT(object), color_node, FALSE);
+ gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align, FALSE);
gl_color_node_free (&color_node);
}
- gl_label_text_set_lines (object, lines);
+ gl_label_text_set_lines (object, lines, FALSE);
gl_text_node_lines_free (&lines);
xmlFree (font_family);
break;
case PANGO_ALIGN_CENTER:
x -= w/2.0;
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
break;
case PANGO_ALIGN_RIGHT:
x -= w;
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
break;
default:
/* should not happen */
fill_color_node = gl_color_node_new_default ();
fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
- gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width);
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node);
- gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
+ gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width, FALSE);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node, FALSE);
+ gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node, FALSE);
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
line_color_node = gl_color_node_new_default ();
line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
- gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width);
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
+ gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width, FALSE);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node, FALSE);
gl_color_node_free (&line_color_node);
fill_color_node = gl_color_node_new_default ();
fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
- gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width);
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node);
- gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
+ gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width, FALSE);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node, FALSE);
+ gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node, FALSE);
gl_color_node_free (&line_color_node);
gl_color_node_free (&fill_color_node);
filename = g_new0 (glTextNode, 1);
filename->field_flag = FALSE;
filename->data = (gchar *)xmlGetProp (node, (xmlChar *)"filename");
- gl_label_image_set_filename (object, filename);
+ gl_label_image_set_filename (object, filename, FALSE);
gl_text_node_free (&filename);
w = lgl_xml_get_prop_double (node, "w", 0);
h = lgl_xml_get_prop_double (node, "h", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
gl_debug (DEBUG_XML, "END");
}
if (scale == 0.0) {
scale = 0.5; /* Set to a valid value */
}
- gl_label_barcode_set_props (object, (gchar *)id, text_flag, TRUE, 0);
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color_node);
+ gl_label_barcode_set_props (object, (gchar *)id, text_flag, TRUE, 0, FALSE);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color_node, FALSE);
child = node->xmlChildrenNode;
text_node = g_new0 (glTextNode, 1);
} else {
g_message ("Unexpected Barcode child: \"%s\"", child->name);
}
- gl_label_barcode_set_data (object, text_node);
+ gl_label_barcode_set_data (object, text_node, FALSE);
gl_color_node_free (&color_node);
gl_text_node_free (&text_node);
gl_merge_set_src (merge, (gchar *)string);
xmlFree (string);
- gl_label_set_merge (label, merge);
+ gl_label_set_merge (label, merge, FALSE);
g_object_unref (G_OBJECT(merge));
return NULL;
}
lgl_db_register_template (template);
- gl_label_set_template (label, template);
+ gl_label_set_template (label, template, FALSE);
lgl_template_free (template);
} else if (lgl_xml_is_node (child_node, "Objects")) {
xml_parse_objects (child_node, label);
gl_debug (DEBUG_XML, "START");
rotate_flag = lgl_xml_get_prop_boolean (node, "rotate", FALSE);
- gl_label_set_rotate_flag (label, rotate_flag);
+ gl_label_set_rotate_flag (label, rotate_flag, FALSE);
for (child = node->xmlChildrenNode; child != NULL; child = child->next) {
gl_debug (DEBUG_XML, "START");
- object = gl_label_text_new (label);
+ object = gl_label_text_new (label, FALSE);
/* position attrs */
x = lgl_xml_get_prop_length (node, "x", 0.0);
y = lgl_xml_get_prop_length (node, "y", 0.0);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
/* implied size attrs */
w = lgl_xml_get_prop_length (node, "w", 0);
h = lgl_xml_get_prop_length (node, "h", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
/* justify attr */
string = lgl_xml_get_prop_string (node, "justify", NULL);
align = gl_str_util_string_to_align (string);
g_free (string);
- gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align);
+ gl_label_object_set_text_alignment (GL_LABEL_OBJECT(object), align, FALSE);
/* auto_shrink attr */
auto_shrink = lgl_xml_get_prop_boolean (node, "auto_shrink", FALSE);
- gl_label_text_set_auto_shrink (GL_LABEL_TEXT(object), auto_shrink);
+ gl_label_text_set_auto_shrink (GL_LABEL_TEXT(object), auto_shrink, FALSE);
/* affine attrs */
xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
gl_debug (DEBUG_XML, "START");
- object = gl_label_box_new (label);
+ object = gl_label_box_new (label, FALSE);
/* position attrs */
x = lgl_xml_get_prop_length (node, "x", 0.0);
y = lgl_xml_get_prop_length (node, "y", 0.0);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
/* size attrs */
w = lgl_xml_get_prop_length (node, "w", 0);
h = lgl_xml_get_prop_length (node, "h", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
/* line attrs */
line_width = lgl_xml_get_prop_length (node, "line_width", 1.0);
- gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width);
+ gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width, FALSE);
line_color_node = gl_color_node_new_default ();
string = lgl_xml_get_prop_string (node, "line_color_field", NULL);
} else {
line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0);
}
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node, FALSE);
gl_color_node_free (&line_color_node);
} else {
fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0);
}
- gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node);
+ gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node, FALSE);
gl_color_node_free (&fill_color_node);
/* affine attrs */
gl_debug (DEBUG_XML, "START");
- object = gl_label_ellipse_new (label);
+ object = gl_label_ellipse_new (label, FALSE);
/* position attrs */
x = lgl_xml_get_prop_length (node, "x", 0.0);
y = lgl_xml_get_prop_length (node, "y", 0.0);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
/* size attrs */
w = lgl_xml_get_prop_length (node, "w", 0);
h = lgl_xml_get_prop_length (node, "h", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
/* line attrs */
line_width = lgl_xml_get_prop_length (node, "line_width", 1.0);
- gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width);
+ gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width, FALSE);
line_color_node = gl_color_node_new_default ();
string = lgl_xml_get_prop_string (node, "line_color_field", NULL);
} else {
line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0);
}
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node, FALSE);
gl_color_node_free (&line_color_node);
} else {
fill_color_node->color = lgl_xml_get_prop_uint (node, "fill_color", 0);
}
- gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node);
+ gl_label_object_set_fill_color (GL_LABEL_OBJECT(object), fill_color_node, FALSE);
gl_color_node_free (&fill_color_node);
/* affine attrs */
gl_debug (DEBUG_XML, "START");
- object = gl_label_line_new (label);
+ object = gl_label_line_new (label, FALSE);
/* position attrs */
x = lgl_xml_get_prop_length (node, "x", 0.0);
y = lgl_xml_get_prop_length (node, "y", 0.0);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
/* length attrs */
dx = lgl_xml_get_prop_length (node, "dx", 0);
dy = lgl_xml_get_prop_length (node, "dy", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), dx, dy);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), dx, dy, FALSE);
/* line attrs */
line_width = lgl_xml_get_prop_length (node, "line_width", 1.0);
- gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width);
+ gl_label_object_set_line_width (GL_LABEL_OBJECT(object), line_width, FALSE);
line_color_node = gl_color_node_new_default ();
string = lgl_xml_get_prop_string (node, "line_color_field", NULL);
} else {
line_color_node->color = lgl_xml_get_prop_uint (node, "line_color", 0);
}
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), line_color_node, FALSE);
gl_color_node_free (&line_color_node);
/* affine attrs */
gl_debug (DEBUG_XML, "START");
- object = gl_label_image_new (label);
+ object = gl_label_image_new (label, FALSE);
/* position attrs */
x = lgl_xml_get_prop_length (node, "x", 0.0);
y = lgl_xml_get_prop_length (node, "y", 0.0);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
/* src or field attr */
string = lgl_xml_get_prop_string (node, "src", NULL);
filename = g_new0 (glTextNode, 1);
filename->field_flag = FALSE;
filename->data = g_strdup ((gchar *)string);
- gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename);
+ gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename, FALSE);
gl_text_node_free (&filename);
xmlFree (string);
} else {
filename = g_new0 (glTextNode, 1);
filename->field_flag = TRUE;
filename->data = g_strdup ((gchar *)string);
- gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename);
+ gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename, FALSE);
gl_text_node_free (&filename);
xmlFree (string);
} else {
/* size attrs */
w = lgl_xml_get_prop_length (node, "w", 0);
h = lgl_xml_get_prop_length (node, "h", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
/* affine attrs */
xml_parse_affine_attrs (node, GL_LABEL_OBJECT(object));
gl_debug (DEBUG_XML, "START");
- object = gl_label_barcode_new (label);
+ object = gl_label_barcode_new (label, FALSE);
/* position attrs */
x = lgl_xml_get_prop_length (node, "x", 0.0);
y = lgl_xml_get_prop_length (node, "y", 0.0);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+ gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y, FALSE);
/* size attrs */
w = lgl_xml_get_prop_length (node, "w", 0);
h = lgl_xml_get_prop_length (node, "h", 0);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
+ gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h, FALSE);
/* prop attrs */
id = lgl_xml_get_prop_string (node, "style", NULL);
checksum_flag = lgl_xml_get_prop_boolean (node, "checksum", TRUE);
format_digits = lgl_xml_get_prop_uint (node, "format", 10);
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
- (gchar *)id, text_flag, checksum_flag, format_digits);
+ (gchar *)id, text_flag, checksum_flag, format_digits, FALSE);
g_free (id);
color_node = gl_color_node_new_default ();
} else {
color_node->color = lgl_xml_get_prop_uint (node, "color", 0);
}
- gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color_node);
+ gl_label_object_set_line_color (GL_LABEL_OBJECT(object), color_node, FALSE);
gl_color_node_free (&color_node);
/* data or field attr */
text_node = g_new0 (glTextNode, 1);
text_node->field_flag = FALSE;
text_node->data = string;
- gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
+ gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node, FALSE);
gl_text_node_free (&text_node);
} else {
string = lgl_xml_get_prop_string (node, "field", NULL);
text_node = g_new0 (glTextNode, 1);
text_node->field_flag = TRUE;
text_node->data = string;
- gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
+ gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node, FALSE);
gl_text_node_free (&text_node);
} else {
g_message ("Missing Object-barcode data or field attr");
gl_merge_set_src (merge, string);
g_free (string);
- gl_label_set_merge (label, merge);
+ gl_label_set_merge (label, merge, FALSE);
g_object_unref (G_OBJECT(merge));
}
/* Font family attr */
font_family = lgl_xml_get_prop_string (node, "font_family", "Sans");
- gl_label_object_set_font_family (object, font_family);
+ gl_label_object_set_font_family (object, font_family, FALSE);
g_free (font_family);
/* Font size attr */
font_size = lgl_xml_get_prop_double (node, "font_size", 0.0);
- gl_label_object_set_font_size (object, font_size);
+ gl_label_object_set_font_size (object, font_size, FALSE);
/* Font weight attr */
string = lgl_xml_get_prop_string (node, "font_weight", NULL);
font_weight = gl_str_util_string_to_weight (string);
g_free (string);
- gl_label_object_set_font_weight (object, font_weight);
+ gl_label_object_set_font_weight (object, font_weight, FALSE);
/* Font italic flag attr */
font_italic_flag = lgl_xml_get_prop_boolean (node, "font_italic", FALSE);
- gl_label_object_set_font_italic_flag (object, font_italic_flag);
+ gl_label_object_set_font_italic_flag (object, font_italic_flag, FALSE);
/* Text color attr */
color_node = gl_color_node_new_default ();
} else {
color_node->color = lgl_xml_get_prop_uint (node, "color", 0);
}
- gl_label_object_set_text_color (object, color_node);
+ gl_label_object_set_text_color (object, color_node, FALSE);
gl_color_node_free (&color_node);
-
/* Text line spacing attr */
text_line_spacing = lgl_xml_get_prop_double (node, "line_spacing", 1.0);
- gl_label_object_set_text_line_spacing (object, text_line_spacing);
+ gl_label_object_set_text_line_spacing (object, text_line_spacing, FALSE);
/* Now descend children, and build lines of text nodes */
lines = NULL;
lines = g_list_append (lines, text_nodes);
text_nodes = NULL;
}
- gl_label_text_set_lines (GL_LABEL_TEXT(object), lines);
+ gl_label_text_set_lines (GL_LABEL_TEXT(object), lines, FALSE);
gl_text_node_lines_free (&lines);
gl_debug (DEBUG_XML, "END");
gchar *string;
shadow_state = lgl_xml_get_prop_boolean (node, "shadow", FALSE);
- gl_label_object_set_shadow_state (object, shadow_state);
+ gl_label_object_set_shadow_state (object, shadow_state, FALSE);
if (shadow_state)
{
shadow_x = lgl_xml_get_prop_length (node, "shadow_x", 0.0);
shadow_y = lgl_xml_get_prop_length (node, "shadow_y", 0.0);
- gl_label_object_set_shadow_offset (object, shadow_x, shadow_y);
+ gl_label_object_set_shadow_offset (object, shadow_x, shadow_y, FALSE);
shadow_color_node = gl_color_node_new_default ();
string = lgl_xml_get_prop_string (node, "shadow_color_field", NULL);
} else {
shadow_color_node->color = lgl_xml_get_prop_uint (node, "shadow_color", 0);
}
- gl_label_object_set_shadow_color (object, shadow_color_node);
+ gl_label_object_set_shadow_color (object, shadow_color_node, FALSE);
gl_color_node_free (&shadow_color_node);
shadow_opacity = lgl_xml_get_prop_double (node, "shadow_opacity", 1.0);
- gl_label_object_set_shadow_opacity (object, shadow_opacity);
+ gl_label_object_set_shadow_opacity (object, shadow_opacity, FALSE);
}
}