add line width to uml small package



Hi

I am attaching a patch to make the line width configurable in the uml small package. Is this ok? Do you think this is worth commiting in the repo? If that is the case, I will continue with the rest of the UML objects.

thanks a lot

--
Pablo Gra\~na
Chief Architect
Globant
Arg Office: +54 (11) 4109 1743
UK  Office: +44 (20) 7043 8269 int 8043
US  Office: +1 (212) 400 7686 int 8043

Index: objects/UML/small_package.c
===================================================================
--- objects/UML/small_package.c (revision 4117)
+++ objects/UML/small_package.c (working copy)
@@ -50,11 +50,11 @@
   char *st_stereotype;
   TextAttributes attrs;
 
+  real line_width;
   Color line_color;
   Color fill_color;
 };
 
-#define SMALLPACKAGE_BORDERWIDTH 0.1
 #define SMALLPACKAGE_TOPHEIGHT 0.9
 #define SMALLPACKAGE_TOPWIDTH 1.5
 #define SMALLPACKAGE_MARGIN_X 0.3
@@ -120,6 +120,7 @@
 
 static PropDescription smallpackage_props[] = {
   ELEMENT_COMMON_PROPERTIES,
+  PROP_STD_LINE_WIDTH,
   PROP_STD_LINE_COLOUR_OPTIONAL, 
   PROP_STD_FILL_COLOUR_OPTIONAL, 
   { "stereotype", PROP_TYPE_STRING, PROP_FLAG_VISIBLE,
@@ -142,6 +143,7 @@
 
 static PropOffset smallpackage_offsets[] = {
   ELEMENT_COMMON_PROPERTIES_OFFSETS,
+  { PROP_STDNAME_LINE_WIDTH, PROP_STDTYPE_LINE_WIDTH, offsetof(SmallPackage, line_width) },
   {"line_colour", PROP_TYPE_COLOUR, offsetof(SmallPackage, line_color) },
   {"fill_colour", PROP_TYPE_COLOUR, offsetof(SmallPackage, fill_color) },
   {"stereotype", PROP_TYPE_STRING, offsetof(SmallPackage , stereotype) },
@@ -240,10 +242,9 @@
   h = elem->height;
   
   renderer_ops->set_fillstyle(renderer, FILLSTYLE_SOLID);
-  renderer_ops->set_linewidth(renderer, SMALLPACKAGE_BORDERWIDTH);
+  renderer_ops->set_linewidth(renderer, pkg->line_width);
   renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID);
 
-
   p1.x = x; p1.y = y;
   p2.x = x+w; p2.y = y+h;
 
@@ -364,8 +365,10 @@
     pkg->connections[i].connected = NULL;
   }
   pkg->connections[8].flags = CP_FLAGS_MAIN;
-  elem->extra_spacing.border_trans = SMALLPACKAGE_BORDERWIDTH/2.0;
+  pkg->line_width = attributes_get_default_linewidth();
 
+  elem->extra_spacing.border_trans = pkg->line_width/2.0;
+
   pkg->line_color = attributes_get_foreground();
   pkg->fill_color = attributes_get_background();
 


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