作図ソフト dia の改良版
Révision | f86ac53cf333bf94500c773ee8a166857d331657 (tree) |
---|---|
l'heure | 2001-06-09 06:37:07 |
Auteur | Cyrille Chepelov <cyrille@src....> |
Commiter | Cyrille Chepelov |
patch from Marc <mrw@siemens.ch> (fixes #55863) : some clean-ups in the
* objects/UML/lifeline.c: patch from Marc <mrw@siemens.ch>
(fixes #55863) : some clean-ups in the handling of connection
points. Now the total number of connection points is just a
#define (the proper solution is to retrofit the GRAFCET Vergent's
dynamic behaviour wrt connection points).
@@ -2,6 +2,12 @@ | ||
2 | 2 | |
3 | 3 | * plug-ins/xfig/xfig-import.c: corrected a typo (fixes #55910) |
4 | 4 | |
5 | + * objects/UML/lifeline.c: patch from Marc <mrw@siemens.ch> | |
6 | + (fixes #55863) : some clean-ups in the handling of connection | |
7 | + points. Now the total number of connection points is just a | |
8 | + #define (the proper solution is to retrofit the GRAFCET Vergent's | |
9 | + dynamic behaviour wrt connection points). | |
10 | + | |
5 | 11 | 2001-06-07 Cyrille Chepelov <chepelov@calixo.net> |
6 | 12 | |
7 | 13 | * app/app_procs.c (app_init): added a call to unicode_init() (only |
@@ -45,10 +45,12 @@ struct _LifelineState { | ||
45 | 45 | int draw_cross; |
46 | 46 | }; |
47 | 47 | |
48 | +#define CONNECTIONS 6 /* must be even */ | |
49 | + | |
48 | 50 | struct _Lifeline { |
49 | 51 | Connection connection; |
50 | 52 | |
51 | - ConnectionPoint connections[6]; | |
53 | + ConnectionPoint connections[CONNECTIONS]; | |
52 | 54 | |
53 | 55 | Handle boxbot_handle; |
54 | 56 | Handle boxtop_handle; |
@@ -341,7 +343,7 @@ lifeline_create(Point *startpoint, | ||
341 | 343 | obj->type = &lifeline_type; |
342 | 344 | obj->ops = &lifeline_ops; |
343 | 345 | |
344 | - connection_init(conn, 4, 6); | |
346 | + connection_init(conn, 4, CONNECTIONS); | |
345 | 347 | |
346 | 348 | lifeline->rtop = LIFELINE_HEIGHT/3; |
347 | 349 | lifeline->rbot = lifeline->rtop+0.7; |
@@ -364,7 +366,7 @@ lifeline_create(Point *startpoint, | ||
364 | 366 | obj->handles[1]->connect_type = HANDLE_NONCONNECTABLE; |
365 | 367 | |
366 | 368 | /* Connection points */ |
367 | - for (i=0;i<6;i++) { | |
369 | + for (i=0;i<CONNECTIONS;i++) { | |
368 | 370 | obj->connections[i] = &lifeline->connections[i]; |
369 | 371 | lifeline->connections[i].object = obj; |
370 | 372 | lifeline->connections[i].connected = NULL; |
@@ -401,7 +403,7 @@ lifeline_copy(Lifeline *lifeline) | ||
401 | 403 | |
402 | 404 | connection_copy(conn, newconn); |
403 | 405 | |
404 | - for (i = 0; i < 6; i++) { | |
406 | + for (i = 0; i < CONNECTIONS; i++) { | |
405 | 407 | newobj->connections[i] = &newlifeline->connections[i]; |
406 | 408 | newlifeline->connections[i].object = newobj; |
407 | 409 | newlifeline->connections[i].connected = NULL; |
@@ -488,21 +490,17 @@ lifeline_update_data(Lifeline *lifeline) | ||
488 | 490 | p1.x -= LIFELINE_WIDTH/2.0; |
489 | 491 | p2.x += LIFELINE_WIDTH/2.0; |
490 | 492 | /* Update connections: */ |
491 | - lifeline->connections[0].pos = p1; | |
492 | - lifeline->connections[1].pos.x = p2.x; | |
493 | - lifeline->connections[1].pos.y = p1.y; | |
494 | - lifeline->connections[2].pos.x = p2.x; | |
495 | - lifeline->connections[2].pos.y = (p1.y + p2.y)/2.0; | |
496 | - lifeline->connections[3].pos.x = p2.x; | |
497 | - lifeline->connections[3].pos.y = p2.y; | |
498 | - lifeline->connections[4].pos.x = p1.x; | |
499 | - lifeline->connections[4].pos.y = (p1.y + p2.y)/2.0; | |
500 | - lifeline->connections[5].pos.x = p1.x; | |
501 | - lifeline->connections[5].pos.y = p2.y; | |
493 | + r = (p2.y - p1.y)/(float)(CONNECTIONS/2-1); | |
494 | + for (i = 0; i < CONNECTIONS/2; ++i) { | |
495 | + lifeline->connections[i*2].pos.x = p1.x; | |
496 | + lifeline->connections[i*2+1].pos.x = p2.x; | |
497 | + lifeline->connections[i*2+1].pos.y = | |
498 | + lifeline->connections[i*2].pos.y = p1.y + i*r; | |
499 | + } | |
502 | 500 | } else { |
503 | 501 | /* without focus of control, the points are over the line */ |
504 | - r = (p2.y - p1.y)/5.0; | |
505 | - for (i = 0; i < 6; i++) { | |
502 | + r = (p2.y - p1.y)/(float)(CONNECTIONS-1); | |
503 | + for (i = 0; i < CONNECTIONS; i++) { | |
506 | 504 | lifeline->connections[i].pos.x = p1.x; |
507 | 505 | lifeline->connections[i].pos.y = p1.y + i*r; |
508 | 506 | } |
@@ -545,7 +543,7 @@ lifeline_load(ObjectNode obj_node, int version, const char *filename) | ||
545 | 543 | |
546 | 544 | connection_load(conn, obj_node); |
547 | 545 | |
548 | - connection_init(conn, 4, 6); | |
546 | + connection_init(conn, 4, CONNECTIONS); | |
549 | 547 | |
550 | 548 | attr = object_find_attribute(obj_node, "rtop"); |
551 | 549 | if (attr != NULL) |
@@ -572,7 +570,7 @@ lifeline_load(ObjectNode obj_node, int version, const char *filename) | ||
572 | 570 | lifeline->draw_cross = 0; |
573 | 571 | |
574 | 572 | /* Connection points */ |
575 | - for (i=0;i<6;i++) { | |
573 | + for (i=0;i<CONNECTIONS;i++) { | |
576 | 574 | obj->connections[i] = &lifeline->connections[i]; |
577 | 575 | lifeline->connections[i].object = obj; |
578 | 576 | lifeline->connections[i].connected = NULL; |