[dia] More color for SADT



commit aeb71aca5761bcd510296893720f12b77afc4e48
Author: Hans Breuer <hans breuer org>
Date:   Wed Jan 13 21:13:45 2010 +0100

    More color for SADT

 objects/SADT/annotation.c |   20 ++++++++------------
 objects/SADT/arrow.c      |   34 +++++++---------------------------
 objects/SADT/box.c        |   22 ++++++++++++----------
 3 files changed, 27 insertions(+), 49 deletions(-)
---
diff --git a/objects/SADT/annotation.c b/objects/SADT/annotation.c
index ee25943..355ec81 100644
--- a/objects/SADT/annotation.c
+++ b/objects/SADT/annotation.c
@@ -48,7 +48,9 @@ typedef struct _Annotation {
 
   Text *text;
 
-  TextAttributes attrs; 
+  TextAttributes attrs;
+
+  Color line_color;
 } Annotation;
 
   
@@ -149,6 +151,7 @@ static PropDescription annotation_props[] = {
   PROP_STD_TEXT_FONT,
   PROP_STD_TEXT_HEIGHT,
   PROP_STD_TEXT_COLOUR,
+  PROP_STD_LINE_COLOUR_OPTIONAL,
   {"pos", PROP_TYPE_POINT, PROP_FLAG_DONT_SAVE},
   PROP_DESC_END
 };
@@ -169,6 +172,7 @@ static PropOffset annotation_offsets[] = {
   {"text_font",PROP_TYPE_FONT,offsetof(Annotation,attrs.font)},
   {PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Annotation,attrs.height)},
   {"text_colour",PROP_TYPE_COLOUR,offsetof(Annotation,attrs.color)},
+  { "line_colour", PROP_TYPE_COLOUR, offsetof(Annotation, line_color) },
   {"pos", PROP_TYPE_POINT, offsetof(Annotation,text_handle.pos)},
   { NULL,0,0 }
 };
@@ -316,7 +320,7 @@ annotation_draw(Annotation *annotation, DiaRenderer *renderer)
     pts[3] = annotation->connection.endpoints[1];
     renderer_ops->draw_polyline(renderer,
 			     pts, sizeof(pts) / sizeof(pts[0]),
-			     &color_black);
+			     &annotation->line_color);
   }
   text_draw(annotation->text,renderer);
 }
@@ -350,6 +354,8 @@ annotation_create(Point *startpoint,
   
   connection_init(conn, 3, 0);
 
+  annotation->line_color = color_black;
+
   font = dia_font_new_from_style(DIA_FONT_SANS,ANNOTATION_FONTHEIGHT);
   annotation->text = new_text("", font,
                               ANNOTATION_FONTHEIGHT,
@@ -419,13 +425,3 @@ annotation_load(ObjectNode obj_node, int version, const char *filename)
   return object_load_using_properties(&sadtannotation_type,
                                       obj_node,version,filename);
 }
-
-
-
-
-
-
-
-
-
-
diff --git a/objects/SADT/arrow.c b/objects/SADT/arrow.c
index 4527ac3..81bc7ba 100644
--- a/objects/SADT/arrow.c
+++ b/objects/SADT/arrow.c
@@ -47,7 +47,6 @@
 #define ARROW_HEAD_LENGTH .8
 #define ARROW_HEAD_WIDTH .8
 #define ARROW_HEAD_TYPE ARROW_FILLED_TRIANGLE
-#define ARROW_COLOR color_black
 #define ARROW_DOT_LOFFSET .4
 #define ARROW_DOT_WOFFSET .5
 #define ARROW_DOT_RADIUS .25
@@ -67,6 +66,8 @@ typedef struct _Sadtarrow {
 
   Sadtarrow_style style;
   gboolean autogray;
+  
+  Color line_color;
 } Sadtarrow;
 
 static ObjectChange* sadtarrow_move_handle(Sadtarrow *sadtarrow, Handle *handle,
@@ -142,12 +143,14 @@ PropEnumData flow_style[] = {
 
 static PropDescription sadtarrow_props[] = {
   NEWORTHCONN_COMMON_PROPERTIES,
+
   { "arrow_style", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE,
     N_("Flow style:"), NULL, flow_style },
   { "autogray",PROP_TYPE_BOOL,PROP_FLAG_VISIBLE,
     N_("Automatically gray vertical flows:"),
     N_("To improve the ease of reading, flows which begin and end vertically "
        "can be rendered gray")},
+  PROP_STD_LINE_COLOUR_OPTIONAL,
   PROP_DESC_END
 };
 
@@ -164,6 +167,7 @@ static PropOffset sadtarrow_offsets[] = {
   NEWORTHCONN_COMMON_PROPERTIES_OFFSETS,
   { "arrow_style", PROP_TYPE_ENUM, offsetof(Sadtarrow,style)},
   { "autogray",PROP_TYPE_BOOL, offsetof(Sadtarrow,autogray)},
+  { "line_colour", PROP_TYPE_COLOUR, offsetof(Sadtarrow, line_color) },
   { NULL, 0, 0 }
 };
 
@@ -251,7 +255,7 @@ sadtarrow_draw(Sadtarrow *sadtarrow, DiaRenderer *renderer)
   renderer_ops->set_linestyle(renderer, LINESTYLE_SOLID);
   renderer_ops->set_linecaps(renderer, LINECAPS_BUTT);
   
-  col = ARROW_COLOR;
+  col = sadtarrow->line_color;
   if (sadtarrow->autogray && 
       (orth->orientation[0] == VERTICAL) && 
       (orth->orientation[orth->numpoints-2] == VERTICAL)) {
@@ -386,6 +390,7 @@ sadtarrow_create(Point *startpoint,
 
   sadtarrow->style = SADT_ARROW_NORMAL; /* sadtarrow_defaults.style; */
   sadtarrow->autogray = TRUE; /* sadtarrow_defaults.autogray; */
+  sadtarrow->line_color = color_black;
 
   *handle1 = orth->handles[0];
   *handle2 = orth->handles[orth->numpoints-2];
@@ -488,28 +493,3 @@ sadtarrow_load(ObjectNode obj_node, int version, const char *filename)
                                       obj_node,version,filename);
 }
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/objects/SADT/box.c b/objects/SADT/box.c
index 87679a0..082a611 100644
--- a/objects/SADT/box.c
+++ b/objects/SADT/box.c
@@ -50,8 +50,6 @@
 #define DEFAULT_HEIGHT 5.0
 #define DEFAULT_BORDER 0.25
 #define SADTBOX_LINE_WIDTH 0.10
-#define SADTBOX_FG_COLOR color_black
-#define SADTBOX_BG_COLOR color_white
 
 typedef enum {
   ANCHOR_MIDDLE,
@@ -70,6 +68,9 @@ typedef struct _Box {
   real padding;
 
   TextAttributes attrs;
+  
+  Color line_color;
+  Color fill_color;
 } Box;
 
 static real sadtbox_distance_from(Box *box, Point *point);
@@ -142,6 +143,8 @@ static PropDescription box_props[] = {
   PROP_STD_TEXT_FONT,
   PROP_STD_TEXT_HEIGHT,
   PROP_STD_TEXT_COLOUR,
+  PROP_STD_LINE_COLOUR_OPTIONAL,
+  PROP_STD_FILL_COLOUR_OPTIONAL,
   { "id", PROP_TYPE_STRING, PROP_FLAG_VISIBLE|PROP_FLAG_DONT_MERGE,
     N_("Activity/Data identifier"),
     N_("The identifier which appears in the lower right corner of the Box")},
@@ -169,6 +172,8 @@ static PropOffset box_offsets[] = {
   { "text_font",PROP_TYPE_FONT,offsetof(Box,attrs.font)},
   { PROP_STDNAME_TEXT_HEIGHT,PROP_STDTYPE_TEXT_HEIGHT,offsetof(Box,attrs.height)},
   { "text_colour",PROP_TYPE_COLOUR,offsetof(Box,attrs.color)},
+  { "line_colour", PROP_TYPE_COLOUR, offsetof(Box, line_color) },
+  { "fill_colour", PROP_TYPE_COLOUR, offsetof(Box, fill_color) },
   { "id", PROP_TYPE_STRING, offsetof(Box,id)},
   { "cpl_north",PROP_TYPE_CONNPOINT_LINE, offsetof(Box,north)},
   { "cpl_west",PROP_TYPE_CONNPOINT_LINE, offsetof(Box,west)},
@@ -284,7 +289,7 @@ sadtbox_draw(Box *box, DiaRenderer *renderer)
   renderer_ops->fill_rect(renderer, 
 			   &elem->corner,
 			   &lr_corner, 
-			   &SADTBOX_BG_COLOR);
+			   &box->fill_color);
 
 
   renderer_ops->set_linewidth(renderer, SADTBOX_LINE_WIDTH);
@@ -294,7 +299,7 @@ sadtbox_draw(Box *box, DiaRenderer *renderer)
   renderer_ops->draw_rect(renderer, 
 			   &elem->corner,
 			   &lr_corner, 
-			   &SADTBOX_FG_COLOR);
+			   &box->line_color);
 
 
   text_draw(box->text, renderer);
@@ -497,6 +502,9 @@ sadtbox_create(Point *startpoint,
 
   box->padding = 0.5; /* default_values.padding; */
   
+  box->line_color = color_black;
+  box->fill_color = color_white;
+  
   p = *startpoint;
   p.x += elem->width / 2.0;
   p.y += elem->height / 2.0 + /*default_properties.font_size*/ 0.8 / 2;
@@ -551,9 +559,3 @@ sadtbox_load(ObjectNode obj_node, int version, const char *filename)
                                       obj_node,version,filename);
 }
 
-
-
-
-
-
-



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