Re: Sequence Diagram in UML



Maybe the lower handle should be a connection point instead - so it
could be possible to make a chain of lifelines.

I had just thought of that after my post and tried it out, to no avail. :-)

How about the enclosed patch? It also includes my dia_defaults.h macros,
but the two things are independent and can be easily separated.

BTW, if there's still interest - I have added a few more of those
DEFAULT_* defines, mainly to UML objects, so, I can send that patch too.

Guennadi
---------------------------------
Guennadi Liakhovetski, Ph.D.
DSA Daten- und Systemtechnik GmbH
Pascalstr. 28
D-52076 Aachen
Germany

--- dia-cvs-snapshot/objects/UML/lifeline.c     Fri Aug 10 14:12:36 2001
+++ dia-cvs-snapshot.build/objects/UML/lifeline.c       Fri May 17 11:21:09 2002
@@ -19,6 +19,7 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+#include <dia_defaults.h>

 #include <assert.h>
 #include <gtk/gtk.h>
@@ -36,13 +37,14 @@

 #include "pixmaps/lifeline.xpm"

+#define LIFELINE_CONNS 7
+
 typedef struct _Lifeline Lifeline;

-
 struct _Lifeline {
   Connection connection;

-  ConnectionPoint connections[6]; /* the static ones. 6 is meant to
+  ConnectionPoint connections[LIFELINE_CONNS]; /* the static ones. 6 is meant to
                                      be hardcoded. */
   Handle boxbot_handle;
   Handle boxtop_handle;
@@ -62,14 +64,14 @@
   */
 };

-#define LIFELINE_LINEWIDTH 0.05
-#define LIFELINE_BOXWIDTH 0.1
+#define LIFELINE_LINEWIDTH DEFAULT_LINE_WIDTH // 0.05
+#define LIFELINE_BOXWIDTH DEFAULT_LINE_WIDTH * 2 // 0.1
 #define LIFELINE_WIDTH 0.7
 #define LIFELINE_HEIGHT 3.0
 #define LIFELINE_BOXMINHEIGHT 0.5
 #define LIFELINE_DASHLEN 0.4
-#define LIFELINE_CROSSWIDTH 0.12
-#define LIFELINE_CROSSLEN 0.8
+#define LIFELINE_CROSSWIDTH DEFAULT_LINE_WIDTH * 2.4 // 0.12
+#define LIFELINE_CROSSLEN 0.6 // 0.8

 #define HANDLE_BOXTOP (HANDLE_CUSTOM1)
 #define HANDLE_BOXBOT (HANDLE_CUSTOM2)
@@ -452,7 +454,7 @@
   obj->type = &lifeline_type;
   obj->ops = &lifeline_ops;

-  connection_init(conn, 4, 6);
+  connection_init(conn, 4, LIFELINE_CONNS);

   lifeline->rtop = LIFELINE_HEIGHT/3;
   lifeline->rbot = lifeline->rtop+0.7;
@@ -475,7 +477,7 @@
   obj->handles[1]->connect_type = HANDLE_NONCONNECTABLE;

   /* Connection points */
-  for (i=0;i<6;i++) {
+  for (i=0;i<LIFELINE_CONNS;i++) {
     obj->connections[i] = &lifeline->connections[i];
     lifeline->connections[i].object = obj;
     lifeline->connections[i].connected = NULL;
@@ -511,7 +513,7 @@
   Connection *conn = &lifeline->connection;
   Object *obj = &conn->object;
   LineBBExtras *extra = &conn->extra_spacing;
-  Point p1, p2, pnw, psw, pne, pse, pmw,pme;
+  Point p1, p2, pnw, psw, pne, pse, pmw, pme, p_low_end;

   obj->position = conn->endpoints[0];

@@ -553,6 +555,8 @@
   pmw.x = pnw.x;
   pme.x = pne.x;
   pmw.y = pme.y = (p1.y + p2.y)/2;
+  p_low_end.x = (p1.x + p2.x)/2;
+  p_low_end.y = conn->endpoints[1].y;

   lifeline->connections[0].pos = pnw;
   lifeline->connections[1].pos = pne;
@@ -560,6 +564,7 @@
   lifeline->connections[3].pos = pme;
   lifeline->connections[4].pos = psw;
   lifeline->connections[5].pos = pse;
+  lifeline->connections[6].pos = p_low_end;

   connpointline_update(lifeline->northwest);
   connpointline_putonaline(lifeline->northwest,&pnw,&pmw);




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