two small changes
- From: Krzysztof Foltman <kfoltman onet pl>
- To: dia-list gnome org
- Subject: two small changes
- Date: Thu, 17 Jul 2003 22:45:16 +0200
This one eliminates one of three startup warnings (this one is caused by
unref'ing a NULL font; I'm not sure if it's correct to fix it here,
maybe the font shouldn't be non-NULL in the first place).
Index: ER/attribute.c
===================================================================
RCS file: /cvs/gnome/dia/objects/ER/attribute.c,v
retrieving revision 1.32
diff -u -r1.32 attribute.c
--- ER/attribute.c 24 Apr 2003 19:22:23 -0000 1.32
+++ ER/attribute.c 17 Jul 2003 20:05:14 -0000
@@ -544,7 +544,8 @@
if (attr != NULL)
attribute->multivalue = data_boolean(attribute_first_data(attr));
- dia_font_unref(attribute->font);
+ if (attribute->font)
+ dia_font_unref(attribute->font);
attribute->font = NULL;
attr = object_find_attribute (obj_node, "font");
if (attr != NULL)
===================================================================
This one fixes 3 existing and adds 2 new connection points in Component
object in UML. May I safely add connections to existing objects without
breaking compatibility ? (I've tried to load some old diagram with one
component, doesn't crash).
Index: objects/UML/component.c
===================================================================
RCS file: /cvs/gnome/dia/objects/UML/component.c,v
retrieving revision 1.28
diff -u -r1.28 component.c
--- objects/UML/component.c 13 Jul 2003 21:11:23 -0000 1.28
+++ objects/UML/component.c 17 Jul 2003 20:36:52 -0000
@@ -40,7 +40,7 @@
struct _Component {
Element element;
- ConnectionPoint connections[8];
+ ConnectionPoint connections[10];
char *stereotype;
Text *text;
@@ -184,7 +184,7 @@
assert(handle!=NULL);
assert(to!=NULL);
- assert(handle->id < 8);
+ assert(handle->id < 10);
}
static void
@@ -267,6 +267,7 @@
Element *elem = &cmp->element;
Object *obj = &elem->object;
Point p;
+ real cw2, ch;
cmp->stereotype = remove_stereotype_from_string(cmp->stereotype);
if (!cmp->st_stereotype) {
@@ -300,22 +301,29 @@
2*COMPONENT_MARGIN_X + COMPONENT_CWIDTH);
}
+ cw2 = COMPONENT_CWIDTH/2;
+ ch = COMPONENT_CHEIGHT;
/* Update connections: */
- cmp->connections[0].pos = elem->corner;
- cmp->connections[1].pos.x = elem->corner.x + elem->width / 2.0;
+ cmp->connections[0].pos.x = elem->corner.x + cw2;
+ cmp->connections[0].pos.y = elem->corner.y;
+ cmp->connections[1].pos.x = elem->corner.x + cw2 + (elem->width -
cw2) / 2;
cmp->connections[1].pos.y = elem->corner.y;
cmp->connections[2].pos.x = elem->corner.x + elem->width;
cmp->connections[2].pos.y = elem->corner.y;
- cmp->connections[3].pos.x = elem->corner.x;
+ cmp->connections[3].pos.x = elem->corner.x + cw2;
cmp->connections[3].pos.y = elem->corner.y + elem->height / 2.0;
cmp->connections[4].pos.x = elem->corner.x + elem->width;
cmp->connections[4].pos.y = elem->corner.y + elem->height / 2.0;
- cmp->connections[5].pos.x = elem->corner.x;
+ cmp->connections[5].pos.x = elem->corner.x + cw2;
cmp->connections[5].pos.y = elem->corner.y + elem->height;
- cmp->connections[6].pos.x = elem->corner.x + elem->width / 2.0;
+ cmp->connections[6].pos.x = elem->corner.x + cw2 + (elem->width - cw2)/2;
cmp->connections[6].pos.y = elem->corner.y + elem->height;
cmp->connections[7].pos.x = elem->corner.x + elem->width;
cmp->connections[7].pos.y = elem->corner.y + elem->height;
+ cmp->connections[8].pos.x = elem->corner.x;
+ cmp->connections[8].pos.y = elem->corner.y + elem->height / 2.0 - ch;
+ cmp->connections[9].pos.x = elem->corner.x;
+ cmp->connections[9].pos.y = elem->corner.y + elem->height / 2.0 + ch;
cmp->connections[0].directions = DIR_NORTH|DIR_WEST;
cmp->connections[1].directions = DIR_NORTH;
@@ -325,6 +333,8 @@
cmp->connections[5].directions = DIR_SOUTH|DIR_WEST;
cmp->connections[6].directions = DIR_SOUTH;
cmp->connections[7].directions = DIR_SOUTH|DIR_EAST;
+ cmp->connections[8].directions = DIR_WEST;
+ cmp->connections[9].directions = DIR_WEST;
===================================================================
Krzysztof
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]