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

Re: End of feature freeze



On Sun, Nov 09, 2003 at 05:32:01PM +0000, W. Borgert wrote:
> - add a new arrow type (patch attached, needed for message
>   flow diagrammes)

Will I ever learn to attach attachments :-(
Here we go.

Cheers,
-- 
W. Borgert <debacle@debian.org>
diff -uraN dia/lib/arrows.c dia.new/lib/arrows.c
--- dia/lib/arrows.c	2003-09-12 23:27:37.000000000 +0000
+++ dia.new/lib/arrows.c	2003-09-12 23:25:56.000000000 +0000
@@ -50,8 +50,9 @@
    {N_("Filled Dot"),ARROW_FILLED_DOT},
    {N_("Dimension Origin"),ARROW_DIMENSION_ORIGIN},
    {N_("Blanked Dot"),ARROW_BLANKED_DOT},
-   {N_("Double Hollow triangle"),ARROW_DOUBLE_HOLLOW_TRIANGLE},
-   {N_("Double Filled triangle"),ARROW_DOUBLE_FILLED_TRIANGLE},
+   {N_("Double Hollow Triangle"),ARROW_DOUBLE_HOLLOW_TRIANGLE},
+   {N_("Double Filled Triangle"),ARROW_DOUBLE_FILLED_TRIANGLE},
+   {N_("Filled Dot and Triangle"), ARROW_FILLED_DOT_N_TRIANGLE},
    {N_("Filled Box"),ARROW_FILLED_BOX},
    {N_("Blanked Box"),ARROW_BLANKED_BOX},
    {N_("Slashed"),ARROW_SLASH_ARROW},
@@ -242,6 +243,12 @@
     point_normalize(move_line);
     point_scale(move_line, 2*arrow->length);
     return;
+  case ARROW_FILLED_DOT_N_TRIANGLE:
+    *move_line = *to;
+    point_sub(move_line, from);
+    point_normalize(move_line);
+    point_scale(move_line, arrow->length + arrow->width);
+    return;
   default: 
     move_arrow->x = 0.0;
     move_arrow->y = 0.0;
@@ -1042,6 +1049,42 @@
   DIA_RENDERER_GET_CLASS(renderer)->draw_arc(renderer, &p, width, length, angle_start - 180.0, angle_start, fg_color);  
 }
 
+static void
+draw_filled_dot_n_triangle(DiaRenderer *renderer, Point *to, Point *from,
+			   real length, real width, real linewidth,
+			   Color *fg_color, Color *bg_color)
+{
+  Point p_dot = *to, p_tri = *to, delta;
+  real len, rayon;
+  real rapport;
+  Point poly[3];
+
+  DIA_RENDERER_GET_CLASS(renderer)->set_linecaps(renderer, LINECAPS_BUTT);
+  DIA_RENDERER_GET_CLASS(renderer)->set_linejoin(renderer, LINEJOIN_MITER);
+  DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_SOLID);
+  DIA_RENDERER_GET_CLASS(renderer)->set_linewidth(renderer, linewidth);
+  
+  delta = *from;
+  
+  point_sub(&delta, to);	
+  
+  len = sqrt(point_dot(&delta, &delta)); /* line length */
+  
+  /* dot */
+  rayon = (width / 2.0);
+  rapport = rayon / len;
+  p_dot.x += delta.x * rapport;
+  p_dot.y += delta.y * rapport;
+  DIA_RENDERER_GET_CLASS(renderer)->fill_ellipse(renderer, &p_dot,
+						 width, width, fg_color);
+  /* triangle */
+  rapport = width / len;
+  p_tri.x += delta.x * rapport;
+  p_tri.y += delta.y * rapport;
+  calculate_arrow(poly, &p_tri, from, length, width);
+  DIA_RENDERER_GET_CLASS(renderer)->fill_polygon(renderer, poly, 3, fg_color);
+}
+
 void
 arrow_draw(DiaRenderer *renderer, ArrowType type,
 	   Point *to, Point *from,
@@ -1136,5 +1179,9 @@
     draw_open_rounded(renderer, to, from, length, width, linewidth,
 		      fg_color, bg_color);
     break;
+  case ARROW_FILLED_DOT_N_TRIANGLE:
+    draw_filled_dot_n_triangle(renderer, to, from, length, width, linewidth,
+			       fg_color, bg_color);
+    break;
   } 
 }
diff -uraN dia/lib/arrows.h dia.new/lib/arrows.h
--- dia/lib/arrows.h	2003-09-12 23:27:37.000000000 +0000
+++ dia.new/lib/arrows.h	2003-09-12 23:25:56.000000000 +0000
@@ -56,6 +56,7 @@
   ARROW_ROUNDED,
   ARROW_HALF_DIAMOND,		/* ---< */
   ARROW_OPEN_ROUNDED,		/* ---c */
+  ARROW_FILLED_DOT_N_TRIANGLE,	/* ---|>o */
 } ArrowType;
 
 struct menudesc {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK