[dia] uml: update 'UML - Activity' to have main point



commit 84c37afb9e258ed00cb6911c0949a9e0df314e07
Author: Hans Breuer <hans breuer org>
Date:   Sun Nov 23 15:37:17 2014 +0100

    uml: update 'UML - Activity' to have main point
    
    less code, more functionality

 objects/UML/activity.c |   34 +++++++---------------------------
 1 files changed, 7 insertions(+), 27 deletions(-)
---
diff --git a/objects/UML/activity.c b/objects/UML/activity.c
index a724531..7930187 100644
--- a/objects/UML/activity.c
+++ b/objects/UML/activity.c
@@ -39,11 +39,13 @@
 
 typedef struct _State State;
 
+#define NUM_CONNECTIONS 9
+
 /** \file objects/UML/activity.c  Implementation of the 'UML - Activity' type */
 struct _State {
   Element element;
 
-  ConnectionPoint connections[8];
+  ConnectionPoint connections[NUM_CONNECTIONS];
 
   Text *text;
 
@@ -259,30 +261,7 @@ state_update_data(State *state)
   extra->border_trans = STATE_LINEWIDTH / 2.0;
 
   /* Update connections: */
-  state->connections[0].pos = elem->corner;
-  state->connections[1].pos.x = elem->corner.x + elem->width / 2.0;
-  state->connections[1].pos.y = elem->corner.y;
-  state->connections[2].pos.x = elem->corner.x + elem->width;
-  state->connections[2].pos.y = elem->corner.y;
-  state->connections[3].pos.x = elem->corner.x;
-  state->connections[3].pos.y = elem->corner.y + elem->height / 2.0;
-  state->connections[4].pos.x = elem->corner.x + elem->width;
-  state->connections[4].pos.y = elem->corner.y + elem->height / 2.0;
-  state->connections[5].pos.x = elem->corner.x;
-  state->connections[5].pos.y = elem->corner.y + elem->height;
-  state->connections[6].pos.x = elem->corner.x + elem->width / 2.0;
-  state->connections[6].pos.y = elem->corner.y + elem->height;
-  state->connections[7].pos.x = elem->corner.x + elem->width;
-  state->connections[7].pos.y = elem->corner.y + elem->height;
-  
-  state->connections[0].directions = DIR_NORTH|DIR_WEST;
-  state->connections[1].directions = DIR_NORTH;
-  state->connections[2].directions = DIR_NORTH|DIR_EAST;
-  state->connections[3].directions = DIR_WEST;
-  state->connections[4].directions = DIR_EAST;
-  state->connections[5].directions = DIR_SOUTH|DIR_WEST;
-  state->connections[6].directions = DIR_SOUTH;
-  state->connections[7].directions = DIR_SOUTH|DIR_EAST;
+  element_update_connections_rectangle (elem, state->connections);
                                                                                           
   element_update_boundingbox(elem);
 
@@ -325,13 +304,14 @@ state_create_activity(Point *startpoint,
   
   state->text = new_text("", font, 0.8, &p, &color_black, ALIGN_CENTER);
   dia_font_unref(font);
-  element_init(elem, 8, 8);
+  element_init(elem, 8, NUM_CONNECTIONS);
   
-  for (i=0;i<8;i++) {
+  for (i=0;i<NUM_CONNECTIONS;i++) {
     obj->connections[i] = &state->connections[i];
     state->connections[i].object = obj;
     state->connections[i].connected = NULL;
   }
+  state->connections[8].flags = CP_FLAGS_MAIN;
   elem->extra_spacing.border_trans = 0.0;
   state_update_data(state);
 


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