patch: add fill and line color properties to UML activity
From: Tim Olsen <tolsen718 gmail com>
To: discussions about usage and development of dia <dia-list gnome org>
Subject: patch: add fill and line color properties to UML activity
Date: Fri, 7 Jan 2005 00:51:01 -0500
Hello. I found myself in need of changing the fill color on the UML
activity object, so I patched up the current CVS to add fill and
(while I was at it) line color properties to it.
I barely know GTK so you'll definitely want to sanity check this. I
just copied over the appropriate lines from UML/state.c.
I also changed PROP_STD_TEXT_COLOUR to PROP_STD_TEXT_COLOUR_OPTIONAL
to match state.c. I'm not suree if that was the right thing to do.
-Tim
--- objects/UML/activity.c.~1.9.~ 2004-07-04 12:05:28.000000000 -0400
+++ objects/UML/activity.c 2005-01-06 23:55:42.000000000 -0500
@@ -47,6 +47,8 @@
Text *text;
TextAttributes attrs;
+ Color line_color;
+ Color fill_color;
};
@@ -116,9 +118,11 @@
static PropDescription activity_props[] = {
ELEMENT_COMMON_PROPERTIES,
+ PROP_STD_LINE_COLOUR_OPTIONAL,
+ PROP_STD_FILL_COLOUR_OPTIONAL,
PROP_STD_TEXT_FONT,
PROP_STD_TEXT_HEIGHT,
- PROP_STD_TEXT_COLOUR,
+ PROP_STD_TEXT_COLOUR_OPTIONAL,
{ "text", PROP_TYPE_TEXT, 0, N_("Text"), NULL, NULL },
PROP_DESC_END
@@ -135,6 +139,8 @@
static PropOffset state_offsets[] = {
ELEMENT_COMMON_PROPERTIES_OFFSETS,
+ {"line_colour",PROP_TYPE_COLOUR,offsetof(State,line_color)},
+ {"fill_colour",PROP_TYPE_COLOUR,offsetof(State,fill_color)},
{"text",PROP_TYPE_TEXT,offsetof(State,text)},
{"text_font",PROP_TYPE_FONT,offsetof(State,attrs.font)},
{"text_height",PROP_TYPE_REAL,offsetof(State,attrs.height)},
@@ -224,8 +230,10 @@
p1.y = y;
p2.x = x + w;
p2.y = y + h;
- renderer_ops->fill_rounded_rect(renderer, &p1, &p2, &color_white, 1.0);
- renderer_ops->draw_rounded_rect(renderer, &p1, &p2, &color_black, 1.0);
+ renderer_ops->fill_rounded_rect(renderer, &p1, &p2,
+ &state->fill_color, 1.0);
+ renderer_ops->draw_rounded_rect(renderer, &p1, &p2,
+ &state->line_color, 1.0);
text_draw(state->text, renderer);
}
@@ -310,6 +318,9 @@
elem->width = STATE_WIDTH;
elem->height = STATE_HEIGHT;
+ state->line_color = attributes_get_foreground();
+ state->fill_color = attributes_get_background();
+
font = dia_font_new_from_style (DIA_FONT_SANS, 0.8);
p = *startpoint;
p.x += STATE_WIDTH/2.0;