[dia] [restructuring] obsoletion of TextAttributes duplication
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [restructuring] obsoletion of TextAttributes duplication
- Date: Sun, 14 Oct 2012 13:27:10 +0000 (UTC)
commit c3d5ec9636ecdf256183fb41d097df26ba7c883c
Author: Hans Breuer <hans breuer org>
Date: Fri Oct 12 14:31:05 2012 +0200
[restructuring] obsoletion of TextAttributes duplication
The StdProps system now optionally uses a second offset to get/set a
value on a Text object given by it's pointer. This way we can more
easily set a single text attribute via properties. Formerly doing so
from a scratch property was not possible due to missing values for
other attributes.
Almost all existing objects/ are converted to use the new scheme,
but the old way is still working at the moment.
The one object not converted is "UML - Object", it is doing some smart
things with TextAttributes which could not be replace mechanically.
lib/prop_attr.c | 48 ++++++++++++++++++++++++++++++------
lib/prop_geomtypes.c | 16 ++++++++++-
lib/prop_inttypes.c | 16 ++++++++++-
objects/AADL/aadl.h | 1 -
objects/AADL/aadlbox.c | 9 ++----
objects/FS/flow-ortho.c | 12 +++------
objects/FS/flow.c | 12 +++------
objects/FS/function.c | 9 ++----
objects/GRAFCET/action.c | 15 ++++-------
objects/Istar/actor.c | 4 ---
objects/Istar/goal.c | 4 ---
objects/Istar/other.c | 4 ---
objects/Jackson/domain.c | 12 +++------
objects/Jackson/requirement.c | 10 ++-----
objects/KAOS/goal.c | 3 --
objects/KAOS/other.c | 3 --
objects/SADT/annotation.c | 20 +++++----------
objects/SADT/box.c | 15 ++++-------
objects/UML/activity.c | 11 +++-----
objects/UML/actor.c | 11 ++------
objects/UML/classicon.c | 10 ++-----
objects/UML/component.c | 12 +++------
objects/UML/component_feature.c | 12 +++------
objects/UML/node.c | 12 +++------
objects/UML/note.c | 12 ++-------
objects/UML/small_package.c | 13 +++-------
objects/UML/state.c | 13 +++-------
objects/UML/usecase.c | 11 +++-----
objects/custom/custom_object.c | 15 +++--------
objects/flowchart/box.c | 13 +++-------
objects/flowchart/diamond.c | 13 +++-------
objects/flowchart/ellipse.c | 14 ++++-------
objects/flowchart/parallelogram.c | 13 +++-------
objects/network/basestation.c | 13 +++-------
objects/network/radiocell.c | 13 +++-------
objects/standard/textobj.c | 16 +++---------
36 files changed, 176 insertions(+), 264 deletions(-)
---
diff --git a/lib/prop_attr.c b/lib/prop_attr.c
index 67ffa04..1d89ad0 100644
--- a/lib/prop_attr.c
+++ b/lib/prop_attr.c
@@ -332,14 +332,26 @@ static void
colorprop_get_from_offset(ColorProperty *prop,
void *base, guint offset, guint offset2)
{
- prop->color_data = struct_member(base,offset,Color);
+ if (offset2 == 0) {
+ prop->color_data = struct_member(base,offset,Color);
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ g_return_if_fail (base2 != NULL);
+ prop->color_data = struct_member(base2,offset2,Color);
+ }
}
static void
colorprop_set_from_offset(ColorProperty *prop,
void *base, guint offset, guint offset2)
{
- struct_member(base,offset,Color) = prop->color_data;
+ if (offset2 == 0) {
+ struct_member(base,offset,Color) = prop->color_data;
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ g_return_if_fail (base2 != NULL);
+ struct_member(base2,offset2,Color) = prop->color_data;
+ }
}
static const PropertyOps colorprop_ops = {
@@ -433,9 +445,17 @@ static void
fontprop_get_from_offset(FontProperty *prop,
void *base, guint offset, guint offset2)
{
- if (prop->font_data)
- dia_font_unref(prop->font_data);
- prop->font_data = dia_font_ref(struct_member(base,offset,DiaFont *));
+ /* if we get the same font dont unref before reuse */
+ DiaFont *old_font = prop->font_data;
+ if (offset2 == 0) {
+ prop->font_data = dia_font_ref(struct_member(base,offset,DiaFont *));
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ g_return_if_fail (base2 != NULL);
+ prop->font_data = dia_font_ref(struct_member(base2,offset2,DiaFont *));
+ }
+ if (old_font)
+ dia_font_unref(old_font);
}
static void
@@ -443,9 +463,21 @@ fontprop_set_from_offset(FontProperty *prop,
void *base, guint offset, guint offset2)
{
if (prop->font_data) {
- if (struct_member(base,offset,DiaFont *))
- dia_font_unref(struct_member(base,offset,DiaFont *));
- struct_member(base,offset,DiaFont *) = dia_font_ref(prop->font_data);
+ DiaFont *old_font;
+
+ if (offset2 == 0) {
+ old_font = struct_member(base,offset,DiaFont *);
+ struct_member(base,offset,DiaFont *) = dia_font_ref(prop->font_data);
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ g_return_if_fail (base2 != NULL);
+ old_font = struct_member(base2,offset2,DiaFont *);
+ struct_member(base2,offset2,DiaFont *) = dia_font_ref(prop->font_data);
+ g_return_if_fail (offset2 == offsetof(Text, font));
+ text_set_font ((Text *)base2, prop->font_data);
+ }
+ if (old_font)
+ dia_font_unref(old_font);
}
}
diff --git a/lib/prop_geomtypes.c b/lib/prop_geomtypes.c
index 2acc0f7..8f28581 100644
--- a/lib/prop_geomtypes.c
+++ b/lib/prop_geomtypes.c
@@ -338,7 +338,12 @@ static void
fontsizeprop_get_from_offset(FontsizeProperty *prop,
void *base, guint offset, guint offset2)
{
- prop->fontsize_data = struct_member(base,offset,real);
+ if (offset2 == 0) {
+ prop->fontsize_data = struct_member(base,offset,real);
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ prop->fontsize_data = struct_member(base2,offset2,real);
+ }
}
static void
@@ -354,7 +359,14 @@ fontsizeprop_set_from_offset(FontsizeProperty *prop,
else if (value > numdata->max)
value = numdata->max;
}
- struct_member(base,offset,real) = value;
+ if (offset2 == 0) {
+ struct_member(base,offset,real) = value;
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ struct_member(base2,offset2,real) = value;
+ g_return_if_fail (offset2 == offsetof(Text, height));
+ text_set_height ((Text*)base2, value);
+ }
}
static int
diff --git a/lib/prop_inttypes.c b/lib/prop_inttypes.c
index 4464e71..572023c 100644
--- a/lib/prop_inttypes.c
+++ b/lib/prop_inttypes.c
@@ -579,14 +579,26 @@ static void
enumprop_get_from_offset(EnumProperty *prop,
void *base, guint offset, guint offset2)
{
- prop->enum_data = struct_member(base,offset,gint);
+ if (offset2 == 0) {
+ prop->enum_data = struct_member(base,offset,gint);
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ g_return_if_fail (base2 != NULL);
+ prop->enum_data = struct_member(base2,offset2,gint);
+ }
}
static void
enumprop_set_from_offset(EnumProperty *prop,
void *base, guint offset, guint offset2)
{
- struct_member(base,offset,gint) = prop->enum_data;
+ if (offset2 == 0) {
+ struct_member(base,offset,gint) = prop->enum_data;
+ } else {
+ void *base2 = struct_member(base,offset,void*);
+ g_return_if_fail (base2 != NULL);
+ struct_member(base2,offset2,gint) = prop->enum_data;
+ }
}
static const PropertyOps enumprop_ops = {
diff --git a/objects/AADL/aadl.h b/objects/AADL/aadl.h
index 5ee5208..a9e9a36 100755
--- a/objects/AADL/aadl.h
+++ b/objects/AADL/aadl.h
@@ -77,7 +77,6 @@ struct _Aadlbox
gchar *declaration;
Text *name;
- TextAttributes attrs;
int num_ports;
Aadlport **ports;
diff --git a/objects/AADL/aadlbox.c b/objects/AADL/aadlbox.c
index 3da3d24..f63ffcd 100755
--- a/objects/AADL/aadlbox.c
+++ b/objects/AADL/aadlbox.c
@@ -170,16 +170,15 @@ static PropOffset aadlbox_offsets[] = {
{"line_colour",PROP_TYPE_COLOUR,offsetof(Aadlbox,line_color)},
{"fill_colour",PROP_TYPE_COLOUR,offsetof(Aadlbox,fill_color)},
{"name",PROP_TYPE_TEXT,offsetof(Aadlbox,name)},
- {"text_font",PROP_TYPE_FONT,offsetof(Aadlbox,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT,offsetof(Aadlbox,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Aadlbox,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Aadlbox,name),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT,offsetof(Aadlbox,name),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Aadlbox,name),offsetof(Text,color)},
{ NULL, 0, 0 },
};
void
aadlbox_get_props(Aadlbox * aadlbox, GPtrArray *props)
{
- text_get_attributes(aadlbox->name,&aadlbox->attrs);
object_get_props_from_offsets(&aadlbox->element.object,
aadlbox_offsets,props);
}
@@ -189,7 +188,6 @@ aadlbox_set_props(Aadlbox *aadlbox, GPtrArray *props)
{
object_set_props_from_offsets(&aadlbox->element.object,
aadlbox_offsets,props);
- apply_textattr_properties(props,aadlbox->name,"name",&aadlbox->attrs);
aadlbox_update_data(aadlbox);
}
@@ -894,7 +892,6 @@ DiaObject *aadlbox_create(Point *startpoint, void *user_data,
p.x = 0.0;
p.y = 0.0;
aadlbox->name = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
- text_get_attributes(aadlbox->name,&aadlbox->attrs);
dia_font_unref(font);
element_init(elem, 8, 0); /* 8 handles and 0 connection */
diff --git a/objects/FS/flow-ortho.c b/objects/FS/flow-ortho.c
index 12b0510..32caed5 100644
--- a/objects/FS/flow-ortho.c
+++ b/objects/FS/flow-ortho.c
@@ -60,7 +60,6 @@ struct _Orthflow {
Handle text_handle;
Text* text;
- TextAttributes attrs;
OrthflowType type;
Point textpos; /* This is the master position, only overridden in load */
};
@@ -188,17 +187,16 @@ static PropOffset orthflow_offsets[] = {
OBJECT_COMMON_PROPERTIES_OFFSETS,
{ "type", PROP_TYPE_ENUM, offsetof(Orthflow, type) },
{ "text", PROP_TYPE_TEXT, offsetof (Orthflow, text) },
- { "text_alignment", PROP_TYPE_ENUM, offsetof (Orthflow, attrs.alignment) },
- { "text_font", PROP_TYPE_FONT, offsetof (Orthflow, attrs.font) },
- { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof (Orthflow, attrs.height) },
- { "text_colour", PROP_TYPE_COLOUR, offsetof (Orthflow, attrs.color) },
+ { "text_alignment", PROP_TYPE_ENUM, offsetof(Orthflow,text),offsetof(Text,alignment) },
+ { "text_font", PROP_TYPE_FONT, offsetof(Orthflow,text),offsetof(Text,font) },
+ { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Orthflow,text),offsetof(Text,height) },
+ { "text_colour", PROP_TYPE_COLOUR, offsetof(Orthflow,text),offsetof(Text,color) },
{ NULL, 0, 0 }
};
static void
orthflow_get_props(Orthflow * orthflow, GPtrArray *props)
{
- text_get_attributes (orthflow->text, &orthflow->attrs);
object_get_props_from_offsets(&orthflow->orth.object,
orthflow_offsets, props);
}
@@ -208,7 +206,6 @@ orthflow_set_props(Orthflow *orthflow, GPtrArray *props)
{
object_set_props_from_offsets(&orthflow->orth.object,
orthflow_offsets, props);
- apply_textattr_properties (props, orthflow->text, "text", &orthflow->attrs);
orthflow_update_data(orthflow);
}
@@ -422,7 +419,6 @@ orthflow_create(Point *startpoint,
orthflow->text = new_text("", font, ORTHFLOW_FONTHEIGHT, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(orthflow->text, &orthflow->attrs);
#if 0
if ( orthflow_default_label ) {
diff --git a/objects/FS/flow.c b/objects/FS/flow.c
index 29c6d5b..3935219 100644
--- a/objects/FS/flow.c
+++ b/objects/FS/flow.c
@@ -57,7 +57,6 @@ struct _Flow {
Handle text_handle;
Text* text;
- TextAttributes attrs;
FlowType type;
Point textpos; /* This is the master position, but overridden in load */
};
@@ -165,17 +164,16 @@ static PropOffset flow_offsets[] = {
OBJECT_COMMON_PROPERTIES_OFFSETS,
{ "type", PROP_TYPE_ENUM, offsetof(Flow, type) },
{ "text", PROP_TYPE_TEXT, offsetof (Flow, text) },
- { "text_alignment", PROP_TYPE_ENUM, offsetof (Flow, attrs.alignment) },
- { "text_font", PROP_TYPE_FONT, offsetof (Flow, attrs.font) },
- { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof (Flow, attrs.height) },
- { "text_colour", PROP_TYPE_COLOUR, offsetof (Flow, attrs.color) },
+ { "text_alignment", PROP_TYPE_ENUM, offsetof(Flow,text),offsetof(Text,alignment) },
+ { "text_font", PROP_TYPE_FONT, offsetof(Flow,text),offsetof(Text,font) },
+ { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Flow,text),offsetof(Text,height) },
+ { "text_colour", PROP_TYPE_COLOUR, offsetof(Flow,text),offsetof(Text,color) },
{ NULL, 0, 0 }
};
static void
flow_get_props(Flow * flow, GPtrArray *props)
{
- text_get_attributes (flow->text, &flow->attrs);
object_get_props_from_offsets(&flow->connection.object,
flow_offsets, props);
}
@@ -185,7 +183,6 @@ flow_set_props(Flow *flow, GPtrArray *props)
{
object_set_props_from_offsets(&flow->connection.object,
flow_offsets, props);
- apply_textattr_properties (props, flow->text, "text", &flow->attrs);
flow_update_data(flow);
}
@@ -407,7 +404,6 @@ flow_create(Point *startpoint,
flow->text = new_text("", font, FLOW_FONTHEIGHT, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(flow->text, &flow->attrs);
flow->text_handle.id = HANDLE_MOVE_TEXT;
flow->text_handle.type = HANDLE_MINOR_CONTROL;
diff --git a/objects/FS/function.c b/objects/FS/function.c
index ae1b776..bae5578 100644
--- a/objects/FS/function.c
+++ b/objects/FS/function.c
@@ -49,7 +49,6 @@ struct _Function {
ConnectionPoint connections[NUM_CONNECTIONS];
Text *text;
- TextAttributes attrs;
int is_wish;
int is_user;
@@ -164,16 +163,15 @@ static PropOffset function_offsets[] = {
{ "wish function", PROP_TYPE_BOOL, offsetof(Function, is_wish) },
{ "user function", PROP_TYPE_BOOL, offsetof(Function, is_user) },
{ "text", PROP_TYPE_TEXT, offsetof (Function, text) },
- { "text_font", PROP_TYPE_FONT, offsetof (Function, attrs.font) },
- { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof (Function, attrs.height) },
- { "text_colour", PROP_TYPE_COLOUR, offsetof (Function, attrs.color) },
+ { "text_font", PROP_TYPE_FONT, offsetof(Function,text),offsetof(Text,font) },
+ { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Function,text),offsetof(Text,height) },
+ { "text_colour", PROP_TYPE_COLOUR, offsetof(Function,text),offsetof(Text,color) },
{ NULL, 0, 0}
};
static void
function_get_props(Function * function, GPtrArray *props)
{
- text_get_attributes (function->text, &function->attrs);
object_get_props_from_offsets(&function->element.object,
function_offsets, props);
}
@@ -183,7 +181,6 @@ function_set_props(Function *function, GPtrArray *props)
{
object_set_props_from_offsets(&function->element.object,
function_offsets, props);
- apply_textattr_properties (props, function->text, "text", &function->attrs);
function_update_data(function);
}
diff --git a/objects/GRAFCET/action.c b/objects/GRAFCET/action.c
index a9f2b64..ab18f9a 100644
--- a/objects/GRAFCET/action.c
+++ b/objects/GRAFCET/action.c
@@ -61,7 +61,6 @@ typedef struct _Action {
Rectangle labelbb; /* The bounding box of the label itself */
Point labelstart;
- TextAttributes attrs;
ConnPointLine *cps; /* aaahrg ! again one ! */
} Action;
@@ -147,18 +146,17 @@ action_describe_props(Action *action)
static PropOffset action_offsets[] = {
CONNECTION_COMMON_PROPERTIES_OFFSETS,
{"text",PROP_TYPE_TEXT,offsetof(Action,text)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Action,attrs.alignment)},
- {"text_font",PROP_TYPE_FONT,offsetof(Action,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Action,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Action,attrs.color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Action,text),offsetof(Text,alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Action,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Action,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Action,text),offsetof(Text,color)},
{"macro_call",PROP_TYPE_BOOL,offsetof(Action,macro_call)},
{ NULL,0,0 }
};
static void
action_get_props(Action *action, GPtrArray *props)
-{
- text_get_attributes(action->text,&action->attrs);
+{
object_get_props_from_offsets(&action->connection.object,
action_offsets,props);
}
@@ -168,7 +166,6 @@ action_set_props(Action *action, GPtrArray *props)
{
object_set_props_from_offsets(&action->connection.object,
action_offsets,props);
- apply_textattr_properties(props,action->text,"text",&action->attrs);
action_update_data(action);
}
@@ -421,8 +418,6 @@ action_create(Point *startpoint,
&pos, /* never used */
&color_black, ALIGN_LEFT);
dia_font_unref(action_font);
-
- text_get_attributes(action->text,&action->attrs);
action->macro_call = FALSE;
diff --git a/objects/Istar/actor.c b/objects/Istar/actor.c
index ded0fb3..f1e5702 100644
--- a/objects/Istar/actor.c
+++ b/objects/Istar/actor.c
@@ -77,7 +77,6 @@ struct _Actor {
ActorType type;
ConnectionPoint connections[NUM_CONNECTIONS];
Text *text;
- TextAttributes attrs;
int init;
};
@@ -170,7 +169,6 @@ static PropOffset actor_offsets[] = {
static void
actor_get_props(Actor *actor, GPtrArray *props)
{
- text_get_attributes(actor->text,&actor->attrs);
object_get_props_from_offsets(&actor->element.object,
actor_offsets,props);
}
@@ -182,7 +180,6 @@ actor_set_props(Actor *actor, GPtrArray *props)
object_set_props_from_offsets(&actor->element.object,
actor_offsets,props);
- apply_textattr_properties(props,actor->text,"text",&actor->attrs);
actor_update_data(actor, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -462,7 +459,6 @@ static DiaObject
p.x += elem->width / 2.0;
p.y += elem->height / 2.0 + ACTOR_FONT / 2;
actor->text = new_text("", font, ACTOR_FONT, &p, &ACTOR_FG_COLOR, ALIGN_CENTER);
- text_get_attributes(actor->text,&actor->attrs);
dia_font_unref(font);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/Istar/goal.c b/objects/Istar/goal.c
index d2b8837..b2cd5d3 100644
--- a/objects/Istar/goal.c
+++ b/objects/Istar/goal.c
@@ -84,7 +84,6 @@ typedef struct _Goal {
real padding;
GoalType type;
- TextAttributes attrs;
int init;
} Goal;
@@ -178,7 +177,6 @@ static PropOffset goal_offsets[] = {
static void
goal_get_props(Goal *goal, GPtrArray *props)
{
- text_get_attributes(goal->text,&goal->attrs);
object_get_props_from_offsets(&goal->element.object,
goal_offsets,props);
}
@@ -190,7 +188,6 @@ goal_set_props(Goal *goal, GPtrArray *props)
object_set_props_from_offsets(&goal->element.object,
goal_offsets,props);
- apply_textattr_properties(props,goal->text,"text",&goal->attrs);
goal_update_data(goal, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -525,7 +522,6 @@ goal_create(Point *startpoint,
&color_black,
ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(goal->text,&goal->attrs);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/Istar/other.c b/objects/Istar/other.c
index 933f1f9..9588bda 100644
--- a/objects/Istar/other.c
+++ b/objects/Istar/other.c
@@ -81,7 +81,6 @@ typedef struct _Other {
real padding;
OtherType type;
- TextAttributes attrs;
int init;
} Other;
@@ -180,7 +179,6 @@ static PropOffset other_offsets[] = {
static void
other_get_props(Other *other, GPtrArray *props)
{
- text_get_attributes(other->text,&other->attrs);
object_get_props_from_offsets(&other->element.object,
other_offsets,props);
}
@@ -192,7 +190,6 @@ other_set_props(Other *other, GPtrArray *props)
object_set_props_from_offsets(&other->element.object,
other_offsets,props);
- apply_textattr_properties(props,other->text,"text",&other->attrs);
other_update_data(other, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -528,7 +525,6 @@ other_create(Point *startpoint,
&color_black,
ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(other->text,&other->attrs);
element_init(elem, 8, 0);
diff --git a/objects/Jackson/domain.c b/objects/Jackson/domain.c
index 2fcc94e..6d57de1 100644
--- a/objects/Jackson/domain.c
+++ b/objects/Jackson/domain.c
@@ -108,7 +108,6 @@ typedef struct _Box {
DomainType domtype;
DomainKind domkind;
- TextAttributes attrs;
int init; /* workaround for property bug */
} Box;
@@ -216,10 +215,10 @@ static PropOffset box_offsets[] = {
{ "domtype", PROP_TYPE_ENUM, offsetof(Box,domtype)},
{ "domkind", PROP_TYPE_ENUM, offsetof(Box,domkind)},
{ "text", PROP_TYPE_TEXT, offsetof(Box,text)},
- { "text_alignment",PROP_TYPE_ENUM,offsetof(Box,attrs.alignment)},
- { "text_font",PROP_TYPE_FONT,offsetof(Box,attrs.font)},
- { PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Box,attrs.height)},
- { "text_colour",PROP_TYPE_COLOUR,offsetof(Box,attrs.color)},
+ { "text_alignment",PROP_TYPE_ENUM,offsetof(Box,text),offsetof(Text,alignment)},
+ { "text_font",PROP_TYPE_FONT,offsetof(Box,text),offsetof(Text,font)},
+ { PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Box,text),offsetof(Text,height)},
+ { "text_colour",PROP_TYPE_COLOUR,offsetof(Box,text),offsetof(Text,color)},
{ "cpl_north",PROP_TYPE_CONNPOINT_LINE, offsetof(Box,north)},
{ "cpl_west",PROP_TYPE_CONNPOINT_LINE, offsetof(Box,west)},
{ "cpl_south",PROP_TYPE_CONNPOINT_LINE, offsetof(Box,south)},
@@ -230,7 +229,6 @@ static PropOffset box_offsets[] = {
static void
jackson_box_get_props(Box *box, GPtrArray *props)
{
- text_get_attributes(box->text,&box->attrs);
object_get_props_from_offsets(&box->element.object,
box_offsets,props);
}
@@ -243,7 +241,6 @@ jackson_box_set_props(Box *box, GPtrArray *props)
object_set_props_from_offsets(&box->element.object,
box_offsets,props);
- apply_textattr_properties(props,box->text,"text",&box->attrs);
jackson_box_update_data(box, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -590,7 +587,6 @@ jackson_box_create(Point *startpoint,
&color_black,
ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(box->text,&box->attrs);
element_init(elem, 8, 0);
diff --git a/objects/Jackson/requirement.c b/objects/Jackson/requirement.c
index 86840ba..38f9003 100644
--- a/objects/Jackson/requirement.c
+++ b/objects/Jackson/requirement.c
@@ -56,7 +56,6 @@ struct _Requirement {
Text *text;
int text_outside;
int collaboration;
- TextAttributes attrs;
int init;
};
@@ -145,16 +144,15 @@ req_describe_props(Requirement *req)
static PropOffset req_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
{"text",PROP_TYPE_TEXT,offsetof(Requirement,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Requirement,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Requirement,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Requirement,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Requirement,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Requirement,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Requirement,text),offsetof(Text,color)},
{ NULL, 0, 0 },
};
static void
req_get_props(Requirement * req, GPtrArray *props)
{
- text_get_attributes(req->text,&req->attrs);
object_get_props_from_offsets(&req->element.object,
req_offsets,props);
}
@@ -166,7 +164,6 @@ req_set_props(Requirement *req, GPtrArray *props)
object_set_props_from_offsets(&req->element.object,
req_offsets,props);
- apply_textattr_properties(props,req->text,"text",&req->attrs);
req_update_data(req);
}
@@ -395,7 +392,6 @@ req_create(Point *startpoint,
req->text = new_text("", font, REQ_FONT, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(req->text,&req->attrs);
req->text_outside = 0;
req->collaboration = 0;
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/KAOS/goal.c b/objects/KAOS/goal.c
index f84f769..2570f0c 100644
--- a/objects/KAOS/goal.c
+++ b/objects/KAOS/goal.c
@@ -90,7 +90,6 @@ typedef struct _Goal {
real padding;
GoalType type;
- TextAttributes attrs;
int init;
} Goal;
@@ -190,7 +189,6 @@ static PropOffset goal_offsets[] = {
static void
goal_get_props(Goal *goal, GPtrArray *props)
{
- text_get_attributes(goal->text,&goal->attrs);
object_get_props_from_offsets(&goal->element.object,
goal_offsets,props);
}
@@ -202,7 +200,6 @@ goal_set_props(Goal *goal, GPtrArray *props)
object_set_props_from_offsets(&goal->element.object,
goal_offsets,props);
- apply_textattr_properties(props,goal->text,"text",&goal->attrs);
goal_update_data(goal, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
diff --git a/objects/KAOS/other.c b/objects/KAOS/other.c
index cdd635a..044642b 100644
--- a/objects/KAOS/other.c
+++ b/objects/KAOS/other.c
@@ -82,7 +82,6 @@ typedef struct _Other {
real padding;
OtherType type;
- TextAttributes attrs;
int init;
ConnectionPoint center_cp;
@@ -184,7 +183,6 @@ static PropOffset other_offsets[] = {
static void
other_get_props(Other *other, GPtrArray *props)
{
- text_get_attributes(other->text,&other->attrs);
object_get_props_from_offsets(&other->element.object,
other_offsets,props);
}
@@ -196,7 +194,6 @@ other_set_props(Other *other, GPtrArray *props)
object_set_props_from_offsets(&other->element.object,
other_offsets,props);
- apply_textattr_properties(props,other->text,"text",&other->attrs);
other_update_data(other, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
diff --git a/objects/SADT/annotation.c b/objects/SADT/annotation.c
index 5bd13ef..0ecda57 100644
--- a/objects/SADT/annotation.c
+++ b/objects/SADT/annotation.c
@@ -48,8 +48,6 @@ typedef struct _Annotation {
Text *text;
- TextAttributes attrs;
-
Color line_color;
} Annotation;
@@ -123,16 +121,14 @@ static ObjectOps annotation_ops = {
static gboolean
handle_btn1(Annotation *annotation, Property *prop) {
Color col;
- text_get_attributes(annotation->text,&annotation->attrs);
- col = annotation->attrs.color;
+ col = annotation->text->color;
/* g_message("in handle_btn1 for object %p col=%.2f:%.2f:%.2f",
annotation,col.red,col.green,col.blue); */
col.red = g_random_double();
col.green = g_random_double();
col.blue = g_random_double();
col.alpha = 1.0;
- annotation->attrs.color = col;
- text_set_attributes(annotation->text,&annotation->attrs);
+ annotation->text->color = col;
/* g_message("end of handle_btn1 for object %p col=%.2f:%.2f:%.2f",
annotation,col.red,col.green,col.blue); */
return TRUE;
@@ -168,10 +164,10 @@ annotation_describe_props(Annotation *annotation)
static PropOffset annotation_offsets[] = {
CONNECTION_COMMON_PROPERTIES_OFFSETS,
{"text",PROP_TYPE_TEXT,offsetof(Annotation,text)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Annotation,attrs.alignment)},
- {"text_font",PROP_TYPE_FONT,offsetof(Annotation,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Annotation,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Annotation,attrs.color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Annotation,text),offsetof(Text,alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Annotation,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Annotation,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Annotation,text),offsetof(Text,color)},
{ "line_colour", PROP_TYPE_COLOUR, offsetof(Annotation, line_color) },
{"pos", PROP_TYPE_POINT, offsetof(Annotation,text_handle.pos)},
{ NULL,0,0 }
@@ -179,8 +175,7 @@ static PropOffset annotation_offsets[] = {
static void
annotation_get_props(Annotation *annotation, GPtrArray *props)
-{
- text_get_attributes(annotation->text,&annotation->attrs);
+{
object_get_props_from_offsets(&annotation->connection.object,
annotation_offsets,props);
}
@@ -190,7 +185,6 @@ annotation_set_props(Annotation *annotation, GPtrArray *props)
{
object_set_props_from_offsets(&annotation->connection.object,
annotation_offsets,props);
- apply_textattr_properties(props,annotation->text,"text",&annotation->attrs);
annotation_update_data(annotation);
}
diff --git a/objects/SADT/box.c b/objects/SADT/box.c
index 19d1ab2..e2300b6 100644
--- a/objects/SADT/box.c
+++ b/objects/SADT/box.c
@@ -65,8 +65,6 @@ typedef struct _Box {
gchar *id;
real padding;
- TextAttributes attrs;
-
Color line_color;
Color fill_color;
} Box;
@@ -166,10 +164,10 @@ static PropOffset box_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
{ "padding",PROP_TYPE_REAL,offsetof(Box,padding)},
{ "text", PROP_TYPE_TEXT, offsetof(Box,text)},
- { "text_alignment",PROP_TYPE_ENUM,offsetof(Box,attrs.alignment)},
- { "text_font",PROP_TYPE_FONT,offsetof(Box,attrs.font)},
- { PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Box,attrs.height)},
- { "text_colour",PROP_TYPE_COLOUR,offsetof(Box,attrs.color)},
+ { "text_alignment",PROP_TYPE_ENUM,offsetof(Box,text),offsetof(Text,alignment)},
+ { "text_font",PROP_TYPE_FONT,offsetof(Box,text),offsetof(Text,font)},
+ { PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Box,text),offsetof(Text,height)},
+ { "text_colour",PROP_TYPE_COLOUR,offsetof(Box,text),offsetof(Text,color)},
{ "line_colour", PROP_TYPE_COLOUR, offsetof(Box, line_color) },
{ "fill_colour", PROP_TYPE_COLOUR, offsetof(Box, fill_color) },
{ "id", PROP_TYPE_STRING, offsetof(Box,id)},
@@ -182,8 +180,7 @@ static PropOffset box_offsets[] = {
static void
sadtbox_get_props(Box *box, GPtrArray *props)
-{
- text_get_attributes(box->text,&box->attrs);
+{
object_get_props_from_offsets(&box->element.object,
box_offsets,props);
}
@@ -193,7 +190,6 @@ sadtbox_set_props(Box *box, GPtrArray *props)
{
object_set_props_from_offsets(&box->element.object,
box_offsets,props);
- apply_textattr_properties(props,box->text,"text",&box->attrs);
sadtbox_update_data(box, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -514,7 +510,6 @@ sadtbox_create(Point *startpoint,
&color_black,
ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(box->text,&box->attrs);
box->id = g_strdup("A0"); /* should be made better.
Automatic counting ? */
diff --git a/objects/UML/activity.c b/objects/UML/activity.c
index ef6842e..172a0ff 100644
--- a/objects/UML/activity.c
+++ b/objects/UML/activity.c
@@ -47,7 +47,6 @@ struct _State {
Text *text;
- TextAttributes attrs;
Color line_color;
Color fill_color;
};
@@ -144,16 +143,15 @@ static PropOffset state_offsets[] = {
{"line_colour",PROP_TYPE_COLOUR,offsetof(State,line_color)},
{"fill_colour",PROP_TYPE_COLOUR,offsetof(State,fill_color)},
{"text",PROP_TYPE_TEXT,offsetof(State,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(State,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(State,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(State,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(State,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(State,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(State,text),offsetof(Text,color)},
{ NULL, 0, 0 },
};
static void
state_get_props(State * state, GPtrArray *props)
{
- text_get_attributes(state->text,&state->attrs);
object_get_props_from_offsets(&state->element.object,
state_offsets,props);
}
@@ -163,7 +161,6 @@ state_set_props(State *state, GPtrArray *props)
{
object_set_props_from_offsets(&state->element.object,
state_offsets,props);
- apply_textattr_properties(props,state->text,"text",&state->attrs);
state_update_data(state);
}
@@ -330,7 +327,7 @@ state_create_activity(Point *startpoint,
p.y += STATE_HEIGHT/2.0;
state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
- text_get_attributes(state->text,&state->attrs);
+ dia_font_unref(font);
element_init(elem, 8, 8);
for (i=0;i<8;i++) {
diff --git a/objects/UML/actor.c b/objects/UML/actor.c
index 8f69a34..858cf68 100644
--- a/objects/UML/actor.c
+++ b/objects/UML/actor.c
@@ -42,7 +42,6 @@ struct _Actor {
ConnectionPoint connections[NUM_CONNECTIONS];
Text *text;
- TextAttributes attrs;
real line_width;
Color line_color;
@@ -138,9 +137,9 @@ actor_describe_props(Actor *actor)
static PropOffset actor_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
{"text",PROP_TYPE_TEXT,offsetof(Actor,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Actor,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Actor,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Actor,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Actor,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Actor,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Actor,text),offsetof(Text,color)},
{ PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Actor, line_width) },
{"line_colour",PROP_TYPE_COLOUR,offsetof(Actor,line_color)},
{"fill_colour",PROP_TYPE_COLOUR,offsetof(Actor,fill_color)},
@@ -150,7 +149,6 @@ static PropOffset actor_offsets[] = {
static void
actor_get_props(Actor * actor, GPtrArray *props)
{
- text_get_attributes(actor->text,&actor->attrs);
object_get_props_from_offsets(&actor->element.object,
actor_offsets,props);
}
@@ -160,7 +158,6 @@ actor_set_props(Actor *actor, GPtrArray *props)
{
object_set_props_from_offsets(&actor->element.object,
actor_offsets,props);
- apply_textattr_properties(props,actor->text,"text",&actor->attrs);
actor_update_data(actor);
}
@@ -358,8 +355,6 @@ actor_create(Point *startpoint,
font, 0.8, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(actor->text,&actor->attrs);
-
element_init(elem, 8, NUM_CONNECTIONS);
for (i=0;i<NUM_CONNECTIONS;i++) {
diff --git a/objects/UML/classicon.c b/objects/UML/classicon.c
index 6086740..6bd627d 100644
--- a/objects/UML/classicon.c
+++ b/objects/UML/classicon.c
@@ -49,7 +49,6 @@ struct _Classicon {
int stereotype;
int is_object;
Text *text;
- TextAttributes attrs;
Color line_color;
Color fill_color;
@@ -169,10 +168,10 @@ static PropOffset classicon_offsets[] = {
{ "type", PROP_TYPE_ENUM, offsetof(Classicon, stereotype) },
{ "is_object", PROP_TYPE_BOOL, offsetof(Classicon, is_object) },
{ "text",PROP_TYPE_TEXT,offsetof(Classicon,text)},
- { "text_font",PROP_TYPE_FONT,offsetof(Classicon,attrs.font)},
- { PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Classicon,attrs.height)},
+ { "text_font",PROP_TYPE_FONT,offsetof(Classicon,text),offsetof(Text,font)},
+ { PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Classicon,text),offsetof(Text,height)},
{ PROP_STDNAME_LINE_WIDTH,PROP_TYPE_LENGTH,offsetof(Classicon, line_width) },
- { "text_colour",PROP_TYPE_COLOUR,offsetof(Classicon,attrs.color)},
+ { "text_colour",PROP_TYPE_COLOUR,offsetof(Classicon,text),offsetof(Text,color)},
{ "line_colour",PROP_TYPE_COLOUR,offsetof(Classicon,line_color) },
{ "fill_colour",PROP_TYPE_COLOUR,offsetof(Classicon,fill_color) },
{ NULL, 0, 0 },
@@ -181,7 +180,6 @@ static PropOffset classicon_offsets[] = {
static void
classicon_get_props(Classicon * classicon, GPtrArray *props)
{
- text_get_attributes(classicon->text,&classicon->attrs);
object_get_props_from_offsets(&classicon->element.object,
classicon_offsets,props);
}
@@ -191,7 +189,6 @@ classicon_set_props(Classicon *classicon, GPtrArray *props)
{
object_set_props_from_offsets(&classicon->element.object,
classicon_offsets,props);
- apply_textattr_properties(props,classicon->text,"text",&classicon->attrs);
classicon_update_data(classicon);
}
@@ -461,7 +458,6 @@ classicon_create(Point *startpoint,
p.x = 0.0;
p.y = 0.0;
cicon->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
- text_get_attributes(cicon->text,&cicon->attrs);
dia_font_unref(font);
diff --git a/objects/UML/component.c b/objects/UML/component.c
index 44605ac..0e283fd 100644
--- a/objects/UML/component.c
+++ b/objects/UML/component.c
@@ -48,7 +48,6 @@ struct _Component {
Text *text;
char *st_stereotype;
- TextAttributes attrs;
Color line_color;
Color fill_color;
@@ -145,9 +144,9 @@ static PropOffset component_offsets[] = {
{"fill_colour",PROP_TYPE_COLOUR,offsetof(Component,fill_color)},
{"stereotype", PROP_TYPE_STRING, offsetof(Component , stereotype) },
{"text",PROP_TYPE_TEXT,offsetof(Component,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Component,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Component,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Component,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Component,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Component,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Component,text),offsetof(Text,color)},
{ NULL, 0, 0 },
};
@@ -155,7 +154,6 @@ static PropOffset component_offsets[] = {
static void
component_get_props(Component * component, GPtrArray *props)
{
- text_get_attributes(component->text,&component->attrs);
object_get_props_from_offsets(&component->element.object,
component_offsets,props);
}
@@ -165,7 +163,6 @@ component_set_props(Component *component, GPtrArray *props)
{
object_set_props_from_offsets(&component->element.object,
component_offsets, props);
- apply_textattr_properties(props,component->text,"text",&component->attrs);
g_free(component->st_stereotype);
component->st_stereotype = NULL;
component_update_data(component);
@@ -281,7 +278,7 @@ component_draw(Component *cmp, DiaRenderer *renderer)
p1.y -= cmp->text->height;
renderer_ops->set_font(renderer, cmp->text->font, cmp->text->height);
renderer_ops->draw_string(renderer, cmp->st_stereotype, &p1,
- ALIGN_LEFT, &cmp->attrs.color);
+ ALIGN_LEFT, &cmp->text->color);
}
text_draw(cmp->text, renderer);
@@ -415,7 +412,6 @@ component_create(Point *startpoint,
p.y += 2*COMPONENT_CHEIGHT;
cmp->text = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
- text_get_attributes(cmp->text,&cmp->attrs);
dia_font_unref(font);
diff --git a/objects/UML/component_feature.c b/objects/UML/component_feature.c
index e493102..3552e21 100644
--- a/objects/UML/component_feature.c
+++ b/objects/UML/component_feature.c
@@ -68,7 +68,6 @@ struct _Compfeat {
CompRole roletmp;
Text *text;
- TextAttributes attrs;
Point text_pos;
Handle text_handle;
@@ -226,10 +225,10 @@ static PropOffset compfeat_offsets[] = {
ORTHCONN_COMMON_PROPERTIES_OFFSETS,
{ "role", PROP_TYPE_ENUM, offsetof(Compfeat, role) },
{ "text", PROP_TYPE_TEXT, offsetof(Compfeat, text) },
- { "text_font", PROP_TYPE_FONT, offsetof(Compfeat, attrs.font) },
- { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Compfeat, attrs.height) },
- { "text_colour", PROP_TYPE_COLOUR, offsetof(Compfeat, attrs.color) },
- { "text_alignment", PROP_TYPE_ENUM, offsetof(Compfeat, attrs.alignment) },
+ { "text_font", PROP_TYPE_FONT, offsetof(Compfeat,text),offsetof(Text,font) },
+ { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Compfeat,text),offsetof(Text,height) },
+ { "text_colour", PROP_TYPE_COLOUR, offsetof(Compfeat,text),offsetof(Text,color) },
+ { "text_alignment", PROP_TYPE_ENUM, offsetof(Compfeat,text),offsetof(Text,alignment) },
{ "text_pos", PROP_TYPE_POINT, offsetof(Compfeat, text_pos) },
{ PROP_STDNAME_LINE_WIDTH,PROP_TYPE_LENGTH,offsetof(Compfeat, line_width) },
{ "line_colour",PROP_TYPE_COLOUR,offsetof(Compfeat, line_color) },
@@ -242,7 +241,6 @@ compfeat_get_props(Compfeat *compfeat, GPtrArray *props)
if (compfeat->roletmp)
compfeat->role = compfeat->roletmp;
text_set_position(compfeat->text, &compfeat->text_pos);
- text_get_attributes(compfeat->text, &compfeat->attrs);
object_get_props_from_offsets(&compfeat->orth.object,
compfeat_offsets, props);
}
@@ -254,7 +252,6 @@ compfeat_set_props(Compfeat *compfeat, GPtrArray *props)
compfeat_offsets, props);
compfeat->text_handle.pos = compfeat->text_pos;
text_set_position(compfeat->text, &compfeat->text_handle.pos);
- apply_textattr_properties(props, compfeat->text, "text", &compfeat->attrs);
compfeat_update_data(compfeat);
}
@@ -395,7 +392,6 @@ compfeat_create(Point *startpoint,
COMPPROP_FONTHEIGHT, &p, &compfeat->line_color,
ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(compfeat->text, &compfeat->attrs);
compfeat->text_handle.id = HANDLE_MOVE_TEXT;
compfeat->text_handle.type = HANDLE_MINOR_CONTROL;
diff --git a/objects/UML/node.c b/objects/UML/node.c
index e10e73d..0a87267 100644
--- a/objects/UML/node.c
+++ b/objects/UML/node.c
@@ -48,7 +48,6 @@ struct _Node
Element element;
ConnectionPoint connections[NUM_CONNECTIONS];
Text *name;
- TextAttributes attrs;
Color line_color;
Color fill_color;
@@ -152,9 +151,9 @@ static PropOffset node_offsets[] = {
{"name",PROP_TYPE_TEXT,offsetof(Node,name)},
/* new name matching "same name, same type" rule */
{"text",PROP_TYPE_TEXT,offsetof(Node,name)},
- {"text_font",PROP_TYPE_FONT,offsetof(Node,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Node,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Node,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Node,name),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Node,name),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Node,name),offsetof(Text,color)},
{ PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Node, line_width) },
{"line_colour",PROP_TYPE_COLOUR,offsetof(Node,line_color)},
{"fill_colour",PROP_TYPE_COLOUR,offsetof(Node,fill_color)},
@@ -164,7 +163,6 @@ static PropOffset node_offsets[] = {
static void
node_get_props(Node * node, GPtrArray *props)
{
- text_get_attributes(node->name,&node->attrs);
object_get_props_from_offsets(&node->element.object,
node_offsets,props);
}
@@ -174,7 +172,6 @@ node_set_props(Node *node, GPtrArray *props)
{
object_set_props_from_offsets(&node->element.object,
node_offsets,props);
- apply_textattr_properties(props,node->name,"name",&node->attrs);
node_update_data(node);
}
@@ -286,7 +283,7 @@ static void node_draw(Node *node, DiaRenderer *renderer)
for (i = 0; i < node->name->numlines; i++)
{
points[1].x = points[0].x + text_get_line_width(node->name, i);
- renderer_ops->draw_line(renderer, points, points + 1, &node->attrs.color);
+ renderer_ops->draw_line(renderer, points, points + 1, &node->name->color);
points[0].y = points[1].y += node->name->height;
}
}
@@ -355,7 +352,6 @@ static DiaObject *node_create(Point *startpoint, void *user_data, Handle **handl
p.x = 0.0;
p.y = 0.0;
node->name = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
- text_get_attributes(node->name,&node->attrs);
dia_font_unref(font);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/UML/note.c b/objects/UML/note.c
index 579e4b7..67d5a41 100644
--- a/objects/UML/note.c
+++ b/objects/UML/note.c
@@ -43,7 +43,6 @@ struct _Note {
ConnectionPoint connections[NUM_CONNECTIONS];
Text *text;
- TextAttributes attrs;
real line_width;
Color line_color;
@@ -136,9 +135,9 @@ note_describe_props(Note *note)
static PropOffset note_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
{"text",PROP_TYPE_TEXT,offsetof(Note,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Note,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Note,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Note,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Note,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Note,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Note,text),offsetof(Text,color)},
{ PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Note, line_width)},
{"line_colour",PROP_TYPE_COLOUR,offsetof(Note,line_color)},
{"fill_colour",PROP_TYPE_COLOUR,offsetof(Note,fill_color)},
@@ -148,7 +147,6 @@ static PropOffset note_offsets[] = {
static void
note_get_props(Note * note, GPtrArray *props)
{
- text_get_attributes(note->text,¬e->attrs);
object_get_props_from_offsets(¬e->element.object,
note_offsets,props);
}
@@ -158,8 +156,6 @@ note_set_props(Note *note, GPtrArray *props)
{
object_set_props_from_offsets(¬e->element.object,
note_offsets,props);
- apply_textattr_properties(props,
- note->text,"text",¬e->attrs);
note_update_data(note);
}
@@ -330,8 +326,6 @@ note_create(Point *startpoint,
note->text = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
dia_font_unref(font);
- text_get_attributes(note->text,¬e->attrs);
-
element_init(elem, 8, NUM_CONNECTIONS);
for (i=0;i<NUM_CONNECTIONS;i++) {
diff --git a/objects/UML/small_package.c b/objects/UML/small_package.c
index 0e0ca5d..43955dc 100644
--- a/objects/UML/small_package.c
+++ b/objects/UML/small_package.c
@@ -48,7 +48,6 @@ struct _SmallPackage {
Text *text;
char *st_stereotype;
- TextAttributes attrs;
real line_width;
Color line_color;
@@ -148,9 +147,9 @@ static PropOffset smallpackage_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
{"stereotype", PROP_TYPE_STRING, offsetof(SmallPackage , stereotype) },
{"text",PROP_TYPE_TEXT,offsetof(SmallPackage,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(SmallPackage,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(SmallPackage,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(SmallPackage,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(SmallPackage,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(SmallPackage,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(SmallPackage,text),offsetof(Text,color)},
{ PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(SmallPackage, line_width) },
{"line_colour", PROP_TYPE_COLOUR, offsetof(SmallPackage, line_color) },
{"fill_colour", PROP_TYPE_COLOUR, offsetof(SmallPackage, fill_color) },
@@ -161,7 +160,6 @@ static void
smallpackage_get_props(SmallPackage * smallpackage,
GPtrArray *props)
{
- text_get_attributes(smallpackage->text,&smallpackage->attrs);
object_get_props_from_offsets(&smallpackage->element.object,
smallpackage_offsets,props);
}
@@ -172,8 +170,6 @@ smallpackage_set_props(SmallPackage *smallpackage,
{
object_set_props_from_offsets(&smallpackage->element.object,
smallpackage_offsets, props);
- apply_textattr_properties(props,smallpackage->text,
- "text",&smallpackage->attrs);
g_free(smallpackage->st_stereotype);
smallpackage->st_stereotype = NULL;
smallpackage_update_data(smallpackage);
@@ -288,7 +284,7 @@ smallpackage_draw(SmallPackage *pkg, DiaRenderer *renderer)
p1 = pkg->text->position;
p1.y -= pkg->text->height;
renderer_ops->draw_string(renderer, pkg->st_stereotype, &p1,
- ALIGN_LEFT, &pkg->attrs.color);
+ ALIGN_LEFT, &pkg->text->color);
}
}
@@ -369,7 +365,6 @@ smallpackage_create(Point *startpoint,
pkg->text = new_text("", font, 0.8, &p, &color_black, ALIGN_LEFT);
dia_font_unref(font);
- text_get_attributes(pkg->text,&pkg->attrs);
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/UML/state.c b/objects/UML/state.c
index 65d9d88..193ddf6 100644
--- a/objects/UML/state.c
+++ b/objects/UML/state.c
@@ -61,8 +61,6 @@ struct _State {
Text *text;
int state_type;
- TextAttributes attrs;
-
Color line_color;
Color fill_color;
@@ -184,9 +182,9 @@ static PropOffset state_offsets[] = {
{ "type", PROP_TYPE_INT, offsetof(State, state_type) },
{"text",PROP_TYPE_TEXT,offsetof(State,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(State,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(State,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(State,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(State,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(State,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(State,text),offsetof(Text,color)},
{ PROP_STDNAME_LINE_WIDTH,PROP_TYPE_LENGTH,offsetof(State, line_width) },
{"line_colour",PROP_TYPE_COLOUR,offsetof(State,line_color)},
@@ -198,7 +196,6 @@ static PropOffset state_offsets[] = {
static void
state_get_props(State * state, GPtrArray *props)
{
- text_get_attributes(state->text,&state->attrs);
object_get_props_from_offsets(&state->element.object,
state_offsets,props);
}
@@ -208,7 +205,6 @@ state_set_props(State *state, GPtrArray *props)
{
object_set_props_from_offsets(&state->element.object,
state_offsets,props);
- apply_textattr_properties(props,state->text,"text",&state->attrs);
state_update_data(state);
}
@@ -263,7 +259,7 @@ state_draw_action_string(State *state, DiaRenderer *renderer, StateAction action
action_text,
&pos,
ALIGN_LEFT,
- &state->attrs.color);
+ &state->text->color);
g_free(action_text);
}
@@ -444,7 +440,6 @@ state_create(Point *startpoint,
p.y += STATE_HEIGHT/2.0;
state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
- text_get_attributes(state->text,&state->attrs);
dia_font_unref(font);
diff --git a/objects/UML/usecase.c b/objects/UML/usecase.c
index e2ff1fa..2ea2f7e 100644
--- a/objects/UML/usecase.c
+++ b/objects/UML/usecase.c
@@ -48,7 +48,6 @@ struct _Usecase {
Text *text;
int text_outside;
int collaboration;
- TextAttributes attrs;
real line_width;
Color line_color;
@@ -157,9 +156,9 @@ static PropOffset usecase_offsets[] = {
{"collaboration", PROP_TYPE_BOOL, offsetof(Usecase, collaboration) },
{"text_outside", PROP_TYPE_BOOL, offsetof(Usecase, text_outside) },
{"text",PROP_TYPE_TEXT,offsetof(Usecase,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Usecase,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Usecase,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Usecase,attrs.color)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Usecase,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Usecase,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Usecase,text),offsetof(Text,color)},
{PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(Usecase, line_width)},
{"line_colour", PROP_TYPE_COLOUR, offsetof(Usecase, line_color) },
{"fill_colour", PROP_TYPE_COLOUR, offsetof(Usecase, fill_color) },
@@ -169,7 +168,6 @@ static PropOffset usecase_offsets[] = {
static void
usecase_get_props(Usecase * usecase, GPtrArray *props)
{
- text_get_attributes(usecase->text,&usecase->attrs);
object_get_props_from_offsets(&usecase->element.object,
usecase_offsets,props);
}
@@ -179,7 +177,6 @@ usecase_set_props(Usecase *usecase, GPtrArray *props)
{
object_set_props_from_offsets(&usecase->element.object,
usecase_offsets,props);
- apply_textattr_properties(props,usecase->text,"text",&usecase->attrs);
usecase_update_data(usecase);
}
@@ -430,7 +427,7 @@ usecase_create(Point *startpoint,
usecase->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(usecase->text,&usecase->attrs);
+
usecase->text_outside = 0;
usecase->collaboration = 0;
element_init(elem, 8, NUM_CONNECTIONS);
diff --git a/objects/custom/custom_object.c b/objects/custom/custom_object.c
index 3ebfd4c..4eec912 100644
--- a/objects/custom/custom_object.c
+++ b/objects/custom/custom_object.c
@@ -110,7 +110,6 @@ struct _Custom {
gboolean flip_h, flip_v;
Text *text;
- TextAttributes attrs;
real padding;
TextFitting text_fitting;
@@ -266,10 +265,10 @@ static PropOffset custom_offsets_text[] = {
{ "subscale", PROP_TYPE_REAL, offsetof(Custom, subscale) },
{ "padding", PROP_TYPE_REAL, offsetof(Custom, padding) },
{"text",PROP_TYPE_TEXT,offsetof(Custom,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Custom,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT,offsetof(Custom,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Custom,attrs.color)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Custom,attrs.alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Custom,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT,offsetof(Custom,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Custom,text),offsetof(Text,color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Custom,text),offsetof(Text,alignment)},
{PROP_STDNAME_TEXT_FITTING,PROP_TYPE_ENUM,offsetof(Custom,text_fitting)},
{ NULL, 0, 0 }
};
@@ -394,8 +393,6 @@ custom_describe_props(Custom *custom)
static void
custom_get_props(Custom *custom, GPtrArray *props)
{
- if (custom->info->has_text)
- text_get_attributes(custom->text,&custom->attrs);
object_get_props_from_offsets(&custom->element.object,
custom->info->prop_offsets,props);
}
@@ -405,8 +402,6 @@ custom_set_props(Custom *custom, GPtrArray *props)
{
object_set_props_from_offsets(&custom->element.object,
custom->info->prop_offsets,props);
- if (custom->info->has_text)
- apply_textattr_properties(props,custom->text,"text",&custom->attrs);
custom_update_data(custom, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -1595,7 +1590,6 @@ custom_create(Point *startpoint,
p.y += elem->height / 2.0 + font_height / 2;
custom->text = new_text("", font, font_height, &p, &custom->border_color,
info->text_align);
- text_get_attributes(custom->text,&custom->attrs);
dia_font_unref(font);
/* new default: shrink with textbox, too. */
@@ -1668,7 +1662,6 @@ custom_copy(Custom *custom)
if (custom->info->has_text) {
newcustom->text = text_copy(custom->text);
- text_get_attributes(newcustom->text,&newcustom->attrs);
}
newcustom->connections = g_new0(ConnectionPoint, custom->info->nconnections);
diff --git a/objects/flowchart/box.c b/objects/flowchart/box.c
index 21f2726..90bae4d 100644
--- a/objects/flowchart/box.c
+++ b/objects/flowchart/box.c
@@ -66,7 +66,6 @@ struct _Box {
real corner_radius;
Text *text;
- TextAttributes attrs;
real padding;
TextFitting text_fitting;
@@ -181,10 +180,10 @@ static PropOffset box_offsets[] = {
{ "corner_radius", PROP_TYPE_REAL, offsetof(Box, corner_radius) },
{ "padding", PROP_TYPE_REAL, offsetof(Box, padding) },
{"text",PROP_TYPE_TEXT,offsetof(Box,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Box,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Box,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Box,attrs.color)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Box,attrs.alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Box,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Box,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Box,text),offsetof(Text,color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Box,text),offsetof(Text,alignment)},
{PROP_STDNAME_TEXT_FITTING,PROP_TYPE_ENUM,offsetof(Box,text_fitting)},
{ NULL, 0, 0 },
};
@@ -192,7 +191,6 @@ static PropOffset box_offsets[] = {
static void
box_get_props(Box *box, GPtrArray *props)
{
- text_get_attributes(box->text,&box->attrs);
object_get_props_from_offsets(&box->element.object,
box_offsets,props);
}
@@ -202,7 +200,6 @@ box_set_props(Box *box, GPtrArray *props)
{
object_set_props_from_offsets(&box->element.object,
box_offsets,props);
- apply_textattr_properties(props,box->text,"text",&box->attrs);
box_update_data(box, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -643,7 +640,6 @@ box_create(Point *startpoint,
p.y += elem->height / 2.0 + font_height / 2;
box->text = new_text("", font, font_height, &p, &box->border_color,
ALIGN_CENTER);
- text_get_attributes(box->text,&box->attrs);
dia_font_unref(font);
/* new default: let the user decide the size */
@@ -778,7 +774,6 @@ box_load(ObjectNode obj_node, int version,DiaContext *ctx)
box->text = data_text(attribute_first_data(attr), ctx);
else /* paranoid */
box->text = new_text_default(&obj->position, &box->border_color, ALIGN_CENTER);
- text_get_attributes(box->text,&box->attrs);
/* old default: only growth, manual shrink */
box->text_fitting = TEXTFIT_WHEN_NEEDED;
diff --git a/objects/flowchart/diamond.c b/objects/flowchart/diamond.c
index cb117d3..fd7c26b 100644
--- a/objects/flowchart/diamond.c
+++ b/objects/flowchart/diamond.c
@@ -66,7 +66,6 @@ struct _Diamond {
real dashlength;
Text *text;
- TextAttributes attrs;
real padding;
TextFitting text_fitting;
@@ -178,10 +177,10 @@ static PropOffset diamond_offsets[] = {
offsetof(Diamond, line_style), offsetof(Diamond, dashlength) },
{ "padding", PROP_TYPE_REAL, offsetof(Diamond, padding) },
{"text",PROP_TYPE_TEXT,offsetof(Diamond,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Diamond,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Diamond,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Diamond,attrs.color)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Diamond,attrs.alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Diamond,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Diamond,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Diamond,text),offsetof(Text,color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Diamond,text),offsetof(Text,alignment)},
{PROP_STDNAME_TEXT_FITTING,PROP_TYPE_ENUM,offsetof(Diamond,text_fitting)},
{ NULL, 0, 0 },
};
@@ -189,7 +188,6 @@ static PropOffset diamond_offsets[] = {
static void
diamond_get_props(Diamond *diamond, GPtrArray *props)
{
- text_get_attributes(diamond->text,&diamond->attrs);
object_get_props_from_offsets(&diamond->element.object,
diamond_offsets,props);
}
@@ -199,7 +197,6 @@ diamond_set_props(Diamond *diamond, GPtrArray *props)
{
object_set_props_from_offsets(&diamond->element.object,
diamond_offsets,props);
- apply_textattr_properties(props,diamond->text,"text",&diamond->attrs);
diamond_update_data(diamond,ANCHOR_MIDDLE,ANCHOR_MIDDLE);
}
@@ -532,7 +529,6 @@ diamond_create(Point *startpoint,
p.y += elem->height / 2.0 + font_height / 2;
diamond->text = new_text("", font, font_height, &p, &diamond->border_color,
ALIGN_CENTER);
- text_get_attributes(diamond->text,&diamond->attrs);
dia_font_unref(font);
/* new default: let the user decide the size? */
@@ -660,7 +656,6 @@ diamond_load(ObjectNode obj_node, int version,DiaContext *ctx)
diamond->text = data_text(attribute_first_data(attr), ctx);
else /* paranoid */
diamond->text = new_text_default(&obj->position, &diamond->border_color, ALIGN_CENTER);
- text_get_attributes(diamond->text, &diamond->attrs);
/* old default: only growth, manual shrink */
diamond->text_fitting = TEXTFIT_WHEN_NEEDED;
diff --git a/objects/flowchart/ellipse.c b/objects/flowchart/ellipse.c
index 3644795..6bed6e2 100644
--- a/objects/flowchart/ellipse.c
+++ b/objects/flowchart/ellipse.c
@@ -66,7 +66,6 @@ struct _Ellipse {
real dashlength;
Text *text;
- TextAttributes attrs;
real padding;
TextFitting text_fitting;
@@ -177,10 +176,10 @@ static PropOffset ellipse_offsets[] = {
offsetof(Ellipse, line_style), offsetof(Ellipse, dashlength) },
{ "padding", PROP_TYPE_REAL, offsetof(Ellipse, padding) },
{"text",PROP_TYPE_TEXT,offsetof(Ellipse,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Ellipse,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Ellipse,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Ellipse,attrs.color)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Ellipse,attrs.alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Ellipse,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Ellipse,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Ellipse,text),offsetof(Text,color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Ellipse,text),offsetof(Text,alignment)},
{PROP_STDNAME_TEXT_FITTING,PROP_TYPE_ENUM,offsetof(Ellipse,text_fitting)},
{ NULL, 0, 0 },
};
@@ -188,7 +187,6 @@ static PropOffset ellipse_offsets[] = {
static void
ellipse_get_props(Ellipse *ellipse, GPtrArray *props)
{
- text_get_attributes(ellipse->text,&ellipse->attrs);
object_get_props_from_offsets(&ellipse->element.object,
ellipse_offsets,props);
}
@@ -198,7 +196,6 @@ ellipse_set_props(Ellipse *ellipse, GPtrArray *props)
{
object_set_props_from_offsets(&ellipse->element.object,
ellipse_offsets,props);
- apply_textattr_properties(props,ellipse->text,"text",&ellipse->attrs);
ellipse_update_data(ellipse, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -508,7 +505,6 @@ ellipse_create(Point *startpoint,
p.y += elem->height / 2.0 + font_height / 2;
ellipse->text = new_text("", font, font_height, &p, &ellipse->border_color,
ALIGN_CENTER);
- text_get_attributes(ellipse->text,&ellipse->attrs);
dia_font_unref(font);
/* new default: let the user decide the size? */
@@ -635,7 +631,7 @@ ellipse_load(ObjectNode obj_node, int version,DiaContext *ctx)
ellipse->text = data_text(attribute_first_data(attr), ctx);
else
ellipse->text = new_text_default(&obj->position, &ellipse->border_color, ALIGN_CENTER);
- text_get_attributes(ellipse->text, &ellipse->attrs);
+
/* old default: only growth, manual shrink */
ellipse->text_fitting = TEXTFIT_WHEN_NEEDED;
attr = object_find_attribute(obj_node, PROP_STDNAME_TEXT_FITTING);
diff --git a/objects/flowchart/parallelogram.c b/objects/flowchart/parallelogram.c
index e69b63f..2a201af 100644
--- a/objects/flowchart/parallelogram.c
+++ b/objects/flowchart/parallelogram.c
@@ -67,7 +67,6 @@ struct _Pgram {
real shear_angle, shear_grad;
Text *text;
- TextAttributes attrs;
real padding;
TextFitting text_fitting;
@@ -183,10 +182,10 @@ static PropOffset pgram_offsets[] = {
{ "shear_angle", PROP_TYPE_REAL, offsetof(Pgram, shear_angle) },
{ "padding", PROP_TYPE_REAL, offsetof(Pgram, padding) },
{"text",PROP_TYPE_TEXT,offsetof(Pgram,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Pgram,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Pgram,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Pgram,attrs.color)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Pgram,attrs.alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Pgram,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Pgram,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Pgram,text),offsetof(Text,color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Pgram,text),offsetof(Text,alignment)},
{PROP_STDNAME_TEXT_FITTING,PROP_TYPE_ENUM,offsetof(Pgram,text_fitting)},
{ NULL, 0, 0 },
};
@@ -194,7 +193,6 @@ static PropOffset pgram_offsets[] = {
static void
pgram_get_props(Pgram *pgram, GPtrArray *props)
{
- text_get_attributes(pgram->text,&pgram->attrs);
object_get_props_from_offsets(&pgram->element.object,
pgram_offsets,props);
}
@@ -204,7 +202,6 @@ pgram_set_props(Pgram *pgram, GPtrArray *props)
{
object_set_props_from_offsets(&pgram->element.object,
pgram_offsets,props);
- apply_textattr_properties(props,pgram->text,"text",&pgram->attrs);
pgram_update_data(pgram, ANCHOR_MIDDLE, ANCHOR_MIDDLE);
}
@@ -589,7 +586,6 @@ pgram_create(Point *startpoint,
p.y += elem->height / 2.0 + font_height / 2;
pgram->text = new_text("", font, font_height, &p, &pgram->border_color,
ALIGN_CENTER);
- text_get_attributes(pgram->text,&pgram->attrs);
dia_font_unref(font);
/* new default: let the user decide the size */
@@ -724,7 +720,6 @@ pgram_load(ObjectNode obj_node, int version,DiaContext *ctx)
pgram->text = data_text(attribute_first_data(attr), ctx);
else /* paranoid */
pgram->text = new_text_default(&obj->position, &pgram->border_color, ALIGN_CENTER);
- text_get_attributes(pgram->text, &pgram->attrs);
/* old default: only growth, manual shrink */
pgram->text_fitting = TEXTFIT_WHEN_NEEDED;
diff --git a/objects/network/basestation.c b/objects/network/basestation.c
index 97f0847..a4d02d3 100644
--- a/objects/network/basestation.c
+++ b/objects/network/basestation.c
@@ -49,7 +49,6 @@ struct _Basestation {
Color fill_colour;
Text *text;
- TextAttributes attrs;
int sectors; /* oftenly 3 or 4, always >= 1, but
check is missing */
@@ -150,11 +149,11 @@ static PropOffset basestation_offsets[] = {
{"line_colour", PROP_TYPE_COLOUR, offsetof(Basestation, line_colour)},
{"fill_colour", PROP_TYPE_COLOUR, offsetof(Basestation, fill_colour)},
{"text", PROP_TYPE_TEXT, offsetof(Basestation, text)},
- {"text_font", PROP_TYPE_FONT, offsetof(Basestation, attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Basestation, attrs.height)},
- {"text_colour", PROP_TYPE_COLOUR, offsetof(Basestation, attrs.color)},
+ {"text_font", PROP_TYPE_FONT, offsetof(Basestation,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(Basestation,text),offsetof(Text,height)},
+ {"text_colour", PROP_TYPE_COLOUR, offsetof(Basestation,text),offsetof(Text,color)},
{"text_alignment", PROP_TYPE_ENUM,
- offsetof(Basestation, attrs.alignment)},
+ offsetof(Basestation,text),offsetof(Text,alignment)},
{"sectors", PROP_TYPE_INT, offsetof(Basestation, sectors)},
{ NULL, 0, 0 },
};
@@ -162,7 +161,6 @@ static PropOffset basestation_offsets[] = {
static void
basestation_get_props(Basestation * basestation, GPtrArray *props)
{
- text_get_attributes(basestation->text,&basestation->attrs);
object_get_props_from_offsets(&basestation->element.object,
basestation_offsets,props);
}
@@ -172,8 +170,6 @@ basestation_set_props(Basestation *basestation, GPtrArray *props)
{
object_set_props_from_offsets(&basestation->element.object,
basestation_offsets, props);
- apply_textattr_properties(props,basestation->text,
- "text", &basestation->attrs);
basestation_update_data(basestation);
}
@@ -401,7 +397,6 @@ basestation_create(Point *startpoint,
basestation->text = new_text(_("Base Station"),
font, 0.8, &p, &color_black, ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(basestation->text,&basestation->attrs);
basestation->line_colour = color_black;
basestation->fill_colour = color_white;
basestation->sectors = 3;
diff --git a/objects/network/radiocell.c b/objects/network/radiocell.c
index 2f9e248..657ad4b 100644
--- a/objects/network/radiocell.c
+++ b/objects/network/radiocell.c
@@ -52,7 +52,6 @@ struct _RadioCell {
gboolean show_background;
Color fill_colour;
Text *text;
- TextAttributes attrs;
};
#define RADIOCELL_LINEWIDTH 0.1
@@ -151,18 +150,17 @@ static PropOffset radiocell_offsets[] = {
{ "show_background", PROP_TYPE_BOOL,
offsetof(RadioCell, show_background) },
{ "text", PROP_TYPE_TEXT, offsetof(RadioCell, text) },
- { "text_font", PROP_TYPE_FONT, offsetof(RadioCell, attrs.font) },
- { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(RadioCell, attrs.height) },
- { "text_colour", PROP_TYPE_COLOUR, offsetof(RadioCell, attrs.color) },
+ { "text_font", PROP_TYPE_FONT, offsetof(RadioCell,text),offsetof(Text,font) },
+ { PROP_STDNAME_TEXT_HEIGHT, PROP_STDTYPE_TEXT_HEIGHT, offsetof(RadioCell,text),offsetof(Text,height) },
+ { "text_colour", PROP_TYPE_COLOUR, offsetof(RadioCell,text),offsetof(Text,color) },
{ "text_alignment", PROP_TYPE_ENUM,
- offsetof(RadioCell, attrs.alignment) },
+ offsetof(RadioCell,text),offsetof(Text,alignment) },
{ NULL, 0, 0 },
};
static void
radiocell_get_props(RadioCell *radiocell, GPtrArray *props)
{
- text_get_attributes(radiocell->text, &radiocell->attrs);
object_get_props_from_offsets(&radiocell->poly.object,
radiocell_offsets, props);
}
@@ -172,8 +170,6 @@ radiocell_set_props(RadioCell *radiocell, GPtrArray *props)
{
object_set_props_from_offsets(&radiocell->poly.object,
radiocell_offsets, props);
- apply_textattr_properties(props, radiocell->text,
- "text", &radiocell->attrs);
radiocell_update_data(radiocell);
}
@@ -340,7 +336,6 @@ radiocell_create(Point *startpoint,
radiocell->text = new_text("", font, RADIOCELL_FONTHEIGHT, startpoint,
&color_black, ALIGN_CENTER);
dia_font_unref(font);
- text_get_attributes(radiocell->text, &radiocell->attrs);
polyshape_init(poly, 6);
diff --git a/objects/standard/textobj.c b/objects/standard/textobj.c
index 91a33f6..1656c47 100644
--- a/objects/standard/textobj.c
+++ b/objects/standard/textobj.c
@@ -58,8 +58,6 @@ struct _Textobj {
Handle text_handle;
/*! the real text object to be drawn */
Text *text;
- /*! synched copy of attributes from _Text object */
- TextAttributes attrs;
/*! vertical alignment of the whole text block */
Valign vert_align;
/*! bounding box filling */
@@ -131,10 +129,10 @@ static PropDescription textobj_props[] = {
static PropOffset textobj_offsets[] = {
OBJECT_COMMON_PROPERTIES_OFFSETS,
{"text",PROP_TYPE_TEXT,offsetof(Textobj,text)},
- {"text_font",PROP_TYPE_FONT,offsetof(Textobj,attrs.font)},
- {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Textobj,attrs.height)},
- {"text_colour",PROP_TYPE_COLOUR,offsetof(Textobj,attrs.color)},
- {"text_alignment",PROP_TYPE_ENUM,offsetof(Textobj,attrs.alignment)},
+ {"text_font",PROP_TYPE_FONT,offsetof(Textobj,text),offsetof(Text,font)},
+ {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Textobj,text),offsetof(Text,height)},
+ {"text_colour",PROP_TYPE_COLOUR,offsetof(Textobj,text),offsetof(Text,color)},
+ {"text_alignment",PROP_TYPE_ENUM,offsetof(Textobj,text),offsetof(Text,alignment)},
{"text_vert_alignment",PROP_TYPE_ENUM,offsetof(Textobj,vert_align)},
{ "fill_colour", PROP_TYPE_COLOUR, offsetof(Textobj, fill_color) },
{ "show_background", PROP_TYPE_BOOL, offsetof(Textobj, show_background) },
@@ -180,7 +178,6 @@ static ObjectOps textobj_ops = {
static void
textobj_get_props(Textobj *textobj, GPtrArray *props)
{
- text_get_attributes(textobj->text,&textobj->attrs);
object_get_props_from_offsets(&textobj->object,textobj_offsets,props);
}
@@ -188,7 +185,6 @@ static void
textobj_set_props(Textobj *textobj, GPtrArray *props)
{
object_set_props_from_offsets(&textobj->object,textobj_offsets,props);
- apply_textattr_properties(props,textobj->text,"text",&textobj->attrs);
textobj_update_data(textobj);
}
@@ -323,7 +319,6 @@ textobj_create(Point *startpoint,
/* need to initialize to object.position as well, it is used update data */
obj->position = *startpoint;
- text_get_attributes(textobj->text,&textobj->attrs);
dia_font_unref(font);
textobj->vert_align = default_properties.vert_align;
@@ -350,7 +345,6 @@ static void
textobj_destroy(Textobj *textobj)
{
text_destroy(textobj->text);
- dia_font_unref(textobj->attrs.font);
object_destroy(&textobj->object);
}
@@ -395,8 +389,6 @@ textobj_load(ObjectNode obj_node, int version, DiaContext *ctx)
&startpoint, &color_black, ALIGN_CENTER);
dia_font_unref(font);
}
- /* initialize attrs from text */
- text_get_attributes(textobj->text,&textobj->attrs);
attr = object_find_attribute(obj_node, "valign");
if (attr != NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]