Le Tue, Aug 12, 2003, à 03:13:17PM +0200, Sven Vermeulen a écrit:
Hi, During my quest to have double-line support in Dia, I've somehow been able to add something to the property dialog of the "Standard - Line": http://studwww.ugent.be/~sjvermeu/dia-1.png I have however no idea how I did that, I never did a gtk_entry_new, and I was actually planning on adding a GtkToggleButton there (of which I think have already included the base).
This bit of your patch did it: --- dia/lib/properties.c 2001-08-13 09:24:25.000000000 +0200 +++ dia-work/lib/properties.c 2003-08-11 19:21:08.000000000 +0200 @@ -70,6 +70,7 @@ static char *list [] = { N_("Line colour"), N_("Line style"), + N_("Line count"), N_("Fill colour"), N_("Draw background"), N_("Start arrow"), diff -utr dia/lib/properties.h dia-work/lib/properties.h --- dia/lib/properties.h 2003-07-01 22:30:38.000000000 +0200 +++ dia-work/lib/properties.h 2003-08-11 19:21:56.000000000 +0200 @@ -479,7 +479,10 @@ #define PROP_STD_LINE_STYLE \ { "line_style", PROP_TYPE_LINESTYLE, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \ N_("Line style"), NULL, NULL } - +#define PROP_STD_LINE_COUNT \ + { "line_count", PROP_TYPE_ENUM, PROP_FLAG_VISIBLE|PROP_FLAG_STANDARD, \ + N_("Line count"), NULL, NULL } Note that the TYPE_ENUM property definition is not entirely fulfilled, as you need to provide the different choices (I wonder why it falls back to behaving as if it was a PROP_TYPE_INT ?). It sounds perfectly reasonable to leave it as an enum (once it's completely defined -- grep for examples), you'll just have a combo menu with two items in it, spelt out in plain text (I'm not convinced having a checkbox saying "double" is the right thing). Are you sure you really need to allocate, construct, copy, then destroy and free a temporary copy of a full-blown Line object each time you draw a double-line? you can indeed break the line down to its individual components and call the renderer primitives (or maybe better, add a new method to the renderers, with an extra LineCount parameter, and make its default implementation use the basic renderer primitives. Standard - Line then delegates to your new renderer method instead of draw_line_with_arrows(). -- Cyrille --
Attachment:
pgpkLyP7pKNuH.pgp
Description: PGP signature