[dia] std-props: use text_set_*() for property setting with tow offsets



commit 5d0042a6e17cbd559122fdeefc3adc86e39ac0d6
Author: Hans Breuer <hans breuer org>
Date:   Sun Apr 20 10:14:10 2014 +0200

    std-props: use text_set_*() for property setting with tow offsets

 lib/prop_attr.c     |    2 ++
 lib/prop_inttypes.c |    2 ++
 lib/prop_text.c     |    3 ++-
 3 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/lib/prop_attr.c b/lib/prop_attr.c
index 707f209..3da4ec8 100644
--- a/lib/prop_attr.c
+++ b/lib/prop_attr.c
@@ -345,6 +345,8 @@ colorprop_set_from_offset(ColorProperty *prop,
     void *base2 = struct_member(base,offset,void*);
     g_return_if_fail (base2 != NULL);
     struct_member(base2,offset2,Color) = prop->color_data;
+    g_return_if_fail (offset2 == offsetof(Text, color));
+    text_set_color ((Text *)base2, &prop->color_data);
   }
 }
 
diff --git a/lib/prop_inttypes.c b/lib/prop_inttypes.c
index b1aaf06..a8451e3 100644
--- a/lib/prop_inttypes.c
+++ b/lib/prop_inttypes.c
@@ -598,6 +598,8 @@ enumprop_set_from_offset(EnumProperty *prop,
     void *base2 = struct_member(base,offset,void*);
     g_return_if_fail (base2 != NULL);
     struct_member(base2,offset2,gint) = prop->enum_data;
+    g_return_if_fail (offset2 == offsetof(Text, alignment));
+    text_set_alignment (base2, prop->enum_data);
   }
 }
 
diff --git a/lib/prop_text.c b/lib/prop_text.c
index 447cd12..a6e6d13 100644
--- a/lib/prop_text.c
+++ b/lib/prop_text.c
@@ -435,7 +435,8 @@ textprop_set_from_offset(TextProperty *prop,
 {
   Text *text = struct_member(base,offset,Text *);
   text_set_string(text,prop->text_data);
-  text_set_attributes(text,&prop->attr);
+  if (prop->attr.color.alpha != 0.0) /* HACK */
+    text_set_attributes(text,&prop->attr);
 }
 
 static const PropertyOps textprop_ops = {


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