]> git.sur5r.net Git - glabels/commitdiff
2004-02-15 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Mon, 16 Feb 2004 02:53:37 +0000 (02:53 +0000)
committerJim Evins <evins@snaught.com>
Mon, 16 Feb 2004 02:53:37 +0000 (02:53 +0000)
* src/label-barcode.c: (gl_label_barcode_set_data),
(gl_label_barcode_set_props):
Don't emit "changed" signal, if no change actually made for these
methods.  Reduces number of unnecessary redraws of barcodes.

* src/label-object.h:
* src/label-object.c: (gl_label_object_set_position),
(gl_label_object_set_position_relative), (set_size),
(gl_label_object_set_size),
(gl_label_object_set_size_honor_aspect):
Don't emit "changed" signal, if no change actually made for these
methods.

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

glabels2/ChangeLog
glabels2/src/label-barcode.c
glabels2/src/label-object.c
glabels2/src/label-object.h

index f6ac66c0e470eba0af160043eb17b03eb2db1270..a5eae24c22d5b7ea866c3f60b63f20b4edcd641b 100644 (file)
@@ -1,3 +1,18 @@
+2004-02-15  Jim Evins  <evins@snaught.com>
+
+       * src/label-barcode.c: (gl_label_barcode_set_data),
+       (gl_label_barcode_set_props):
+               Don't emit "changed" signal, if no change actually made for these
+               methods.  Reduces number of unnecessary redraws of barcodes.
+       
+       * src/label-object.h:
+       * src/label-object.c: (gl_label_object_set_position),
+       (gl_label_object_set_position_relative), (set_size),
+       (gl_label_object_set_size),
+       (gl_label_object_set_size_honor_aspect):
+               Don't emit "changed" signal, if no change actually made for these
+               methods.
+
 2004-02-15  Jim Evins  <evins@snaught.com>
 
        * data/glabels-2.0.dtd:
index c2cb91e736ff2d37b2a9adb491ccd1e9007c5b44..b49d4d34e1a81b409f14837414fc162ff7f11dd8 100644 (file)
@@ -201,10 +201,14 @@ gl_label_barcode_set_data (glLabelBarcode *lbc,
 
        g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc));
 
-       gl_text_node_free (&lbc->private->text_node);
-       lbc->private->text_node = gl_text_node_dup (text_node);
+       if (!gl_text_node_equal (lbc->private->text_node, text_node)) {
+
+               gl_text_node_free (&lbc->private->text_node);
+               lbc->private->text_node = gl_text_node_dup (text_node);
 
-       gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc));
+               gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc));
+
+       }
 
        gl_debug (DEBUG_LABEL, "END");
 }
@@ -219,11 +223,18 @@ gl_label_barcode_set_props (glLabelBarcode *lbc,
 
        g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc));
 
-       lbc->private->id               = g_strdup (id);
-       lbc->private->text_flag        = text_flag;
-       lbc->private->checksum_flag    = checksum_flag;
+       if ( ((lbc->private->id == NULL) && (id != NULL))
+            || (g_strcasecmp (lbc->private->id, id) != 0)
+            || (lbc->private->text_flag != text_flag)
+            || (lbc->private->checksum_flag != checksum_flag) ) {
 
-       gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc));
+               lbc->private->id               = g_strdup (id);
+               lbc->private->text_flag        = text_flag;
+               lbc->private->checksum_flag    = checksum_flag;
+
+               gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc));
+
+       }
 
        gl_debug (DEBUG_LABEL, "END");
 }
index 3274873f9f80b269de0ebd395c172f87a65b743d..1df223e0af89cbfb4d54a96fad60433c1c071126 100644 (file)
@@ -376,13 +376,17 @@ gl_label_object_set_position (glLabelObject *object,
 
        g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
 
-       dx = x - object->private->x;
-       dy = y - object->private->y;
+       if ( (x != object->private->x) || (y != object->private->y) ) {
 
-       object->private->x = x;
-       object->private->y = y;
+               dx = x - object->private->x;
+               dy = y - object->private->y;
 
-       g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy);
+               object->private->x = x;
+               object->private->y = y;
+
+               g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy);
+
+       }
 
        gl_debug (DEBUG_LABEL, "END");
 }
@@ -399,14 +403,18 @@ gl_label_object_set_position_relative (glLabelObject *object,
 
        g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
 
-       object->private->x += dx;
-       object->private->y += dy;
+       if ( (dx != 0.0) || (dy != 0.0) ) {
 
-       gl_debug (DEBUG_LABEL, "       x = %f, y= %f",
-                 object->private->x,
-                 object->private->y);
+               object->private->x += dx;
+               object->private->y += dy;
 
-       g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy);
+               gl_debug (DEBUG_LABEL, "       x = %f, y= %f",
+                         object->private->x,
+                         object->private->y);
+
+               g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy);
+
+       }
 
        gl_debug (DEBUG_LABEL, "END");
 }
@@ -439,8 +447,13 @@ set_size (glLabelObject *object,
 {
        g_return_if_fail (object && GL_IS_LABEL_OBJECT (object));
 
-       object->private->w = w;
-       object->private->h = h;
+       if ( (object->private->w != w) || (object->private->h != h) ) {
+
+               object->private->w = w;
+               object->private->h = h;
+
+               g_signal_emit (G_OBJECT(object), signals[CHANGED], 0);
+       }
 }
 
 /*****************************************************************************/
@@ -460,15 +473,10 @@ gl_label_object_set_size (glLabelObject *object,
                /* We have an object specific method, use it */
                GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h);
 
-       } else {
-
-               set_size (object, w, h);
+               object->private->aspect_ratio = h / w;
 
        }
 
-       object->private->aspect_ratio = h / w;
-
-       g_signal_emit (G_OBJECT(object), signals[CHANGED], 0);
 
        gl_debug (DEBUG_LABEL, "END");
 }
@@ -500,14 +508,8 @@ gl_label_object_set_size_honor_aspect (glLabelObject *object,
                /* We have an object specific method, use it */
                GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h);
 
-       } else {
-
-               set_size (object, w, h);
-
        }
 
-       g_signal_emit (G_OBJECT(object), signals[CHANGED], 0);
-
        gl_debug (DEBUG_LABEL, "END");
 }
 
index afc17708faa7b8b062bda001f280fb8f04089102..222f71d1768a27ffccbe2103e3af53b6fd69b896 100644 (file)
@@ -93,8 +93,8 @@ struct _glLabelObjectClass {
        void              (*set_text_alignment)   (glLabelObject     *object,
                                                   GtkJustification   text_alignment);
 
-       void              (*set_text_line_spacing) (glLabelObject     *object,
-                                                   gdouble            text_line_spacing);
+       void              (*set_text_line_spacing) (glLabelObject    *object,
+                                                   gdouble           text_line_spacing);
 
        void              (*set_text_color)       (glLabelObject     *object,
                                                   guint              text_color);
@@ -118,7 +118,7 @@ struct _glLabelObjectClass {
 
        GtkJustification  (*get_text_alignment)   (glLabelObject     *object);
 
-       gdouble           (*get_text_line_spacing) (glLabelObject     *object);
+       gdouble           (*get_text_line_spacing) (glLabelObject    *object);
 
        guint             (*get_text_color)       (glLabelObject     *object);