Patch: UML component resizing




Hello maintainers,

i find UML component object to be to un-practical to use.
Apart from two left side bumps being too big and taking too much space,
and appearing as a visual noise to an extent, major issue i have is the
auto-risizing according to the text inputed. That means that it is
impossible to have sub-components inside components, and that it is very
difficult to fit few components onto a single physical piece of hardware,
without taking vast amount of space on the diagram. Fiting few components
onto a single object is regular part of combined deployment/component
diagrams. This week, i had to do one of these diagrams, doing a new revision
of an already existing UML diagram done in a propriatory software (i only
had a png of it) called Erwin [1], and Erwin had everything that i described
above, which Dia's UML compoment object couldn't do at all (sub-components 
inside components), or could do badly (few components on a single hardware
object) by taking tons of space. Not to mention those bumps. Just kidding
about the bumps - that's not so critical, although it makes diagrams look
much cleaner having them smaller. It's the ability to arbitrarily resize
component object that was crucial for me to be able to use Dia instead of
propriatory Erwin. Component objects are still enalarged as the text is
typed into them - i didn't touch that feature.

Patch is against todays CVS.

regards,

toni

[1] http://www3.ca.com/Solutions/Product.asp?ID=260


--- dia.cvs/objects/UML/component.c     2004-07-27 09:51:10.000000000 +0100
+++ dia.cvs.patch/objects/UML/component.c       2004-07-27 09:40:58.000000000 +0100
@@ -54,6 +54,6 @@ struct _Component {
 
 #define COMPONENT_BORDERWIDTH 0.1
-#define COMPONENT_CHEIGHT 0.7
-#define COMPONENT_CWIDTH 2.0
+#define COMPONENT_CHEIGHT 0.4
+#define COMPONENT_CWIDTH 1.0
 #define COMPONENT_MARGIN_X 0.4
 #define COMPONENT_MARGIN_Y 0.3
@@ -195,4 +195,6 @@ component_move_handle(Component *cmp, Ha
 
   assert(handle->id < 8);
+  element_move_handle(&cmp->element, handle->id, to, cp, reason, modifiers);
+  component_update_data(cmp);
 
   return NULL;
@@ -289,9 +291,7 @@ component_update_data(Component *cmp)
 
   text_calc_boundingbox(cmp->text, NULL);
-  elem->width = cmp->text->max_width + 2*COMPONENT_MARGIN_X + COMPONENT_CWIDTH;
-  elem->width = MAX(elem->width, 2*COMPONENT_CWIDTH);
-  elem->height =  cmp->text->height*cmp->text->numlines +
-    cmp->text->descent + 0.1 + 2*COMPONENT_MARGIN_Y ;
-  elem->height = MAX(elem->height, 5*COMPONENT_CHEIGHT);
+  elem->width = MAX(elem->width, cmp->text->max_width + 2*COMPONENT_MARGIN_X + COMPONENT_CWIDTH);
+  elem->height = MAX(elem->height, cmp->text->height*cmp->text->numlines + 
+                     cmp->text->descent + 0.1 + 2*COMPONENT_MARGIN_Y);
 
   p = elem->corner;
@@ -415,8 +415,4 @@ component_create(Point *startpoint,
   component_update_data(cmp);
 
-  for (i=0;i<8;i++) {
-    obj->handles[i]->type = HANDLE_NON_MOVABLE;
-  }
-
   *handle1 = NULL;
   *handle2 = NULL;



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