[dia] [substitute] improve property exchange for wildly different objects



commit ace62f037bb758bbb974c20fc3da4f8c92460700
Author: Hans Breuer <hans breuer org>
Date:   Tue Oct 2 21:19:40 2012 +0200

    [substitute] improve property exchange for wildly different objects
    
    object_substitute() is a stress test for get_props() / set_props()
    with not perfectly matching property vectors. While set_prop() did
    check for properties not set, this function was not made available
    by get_props(). Now it is.

 lib/object.c      |    8 ++++++++
 lib/propoffsets.c |    3 +++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/lib/object.c b/lib/object.c
index a1c97c6..e006332 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -360,7 +360,15 @@ static PropDescription _style_prop_descs[] = {
   PROP_STD_LINE_JOIN,
   PROP_STD_LINE_CAPS,
   PROP_STD_FILL_COLOUR,
+#if 0 /* not this way */
   PROP_STD_TEXT,
+#else
+  PROP_STD_TEXT_ALIGNMENT,
+  PROP_STD_TEXT_FONT,
+  PROP_STD_TEXT_HEIGHT,
+  PROP_STD_TEXT_COLOUR,
+  PROP_STD_TEXT_FITTING,
+#endif
   PROP_DESC_END
 };
 
diff --git a/lib/propoffsets.c b/lib/propoffsets.c
index 9fcaf29..60e53d2 100644
--- a/lib/propoffsets.c
+++ b/lib/propoffsets.c
@@ -61,10 +61,13 @@ do_get_props_from_offsets(void *base,
   for (i = 0; i < props->len; i++) {
     Property *prop = g_ptr_array_index(props,i);
     const PropOffset *ofs;
+    /* nothing set yet - may happen with a foreign property list */
+    prop->experience |= PXP_NOTSET;
     for (ofs = offsets; ofs->name ; ofs++) {
       if ((prop->name_quark == ofs->name_quark) &&
           (prop->type_quark == ofs->type_quark)) {
         prop->ops->get_from_offset(prop,base,ofs->offset,ofs->offset2);
+        prop->experience &= ~PXP_NOTSET;
         break;
       }                                    
     }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]