作図ソフト dia の改良版
修订版 | d1d38486baab68850fe91026705592482db3e737 (tree) |
---|---|
时间 | 2004-05-06 05:27:09 |
作者 | Lars Clausen <lclausen@src....> |
Commiter | Lars Clausen |
Arrow and network things.
@@ -1,5 +1,17 @@ | ||
1 | 1 | 2004-05-05 Lars Clausen <lars@raeder.dk> |
2 | 2 | |
3 | + * objects/network/Makefile.am: | |
4 | + * objects/network/pixmaps/radiocell.xpm: | |
5 | + * objects/network/pixmaps/basestation.xpm: | |
6 | + * objects/network/network.c: | |
7 | + * objects/network/basestation.c: | |
8 | + * objects/network/radiocell.c: | |
9 | + Patch from W. Borgert <debacle@debian.org>: Radio cell and base | |
10 | + station objects. | |
11 | + | |
12 | + * lib/arrows.[ch]: Patch from Anthony <anthonym@overture.com>: | |
13 | + Backslash arrow head. | |
14 | + | |
3 | 15 | * app/pagesetup.c (pagesetup_respond): Do not free ps twice. |
4 | 16 | Notify takes care. Should maybe use that more. |
5 | 17 |
@@ -69,6 +69,7 @@ struct menudesc arrow_types[] = | ||
69 | 69 | {N_("Blanked Concave"),ARROW_BLANKED_CONCAVE}, |
70 | 70 | {N_("Round"), ARROW_ROUNDED}, |
71 | 71 | {N_("Open Round"), ARROW_OPEN_ROUNDED}, |
72 | + {N_("Backslash"),ARROW_BACKSLASH}, | |
72 | 73 | {NULL,0}}; |
73 | 74 | |
74 | 75 | ///////////// prototypes ////////////// |
@@ -765,6 +766,8 @@ draw_integral(DiaRenderer *renderer, Point *to, Point *from, | ||
765 | 766 | DIA_RENDERER_GET_CLASS(renderer)->draw_bezier(renderer,bp,sizeof(bp)/sizeof(bp[0]),fg_color); |
766 | 767 | } |
767 | 768 | |
769 | + | |
770 | + | |
768 | 771 | static void |
769 | 772 | draw_slashed(DiaRenderer *renderer, Point *to, Point *from, |
770 | 773 | real length, real width, real linewidth, |
@@ -1046,6 +1049,51 @@ draw_slashed_cross(DiaRenderer *renderer, Point *to, Point *from, | ||
1046 | 1049 | } |
1047 | 1050 | |
1048 | 1051 | static void |
1052 | +draw_backslash(DiaRenderer *renderer, Point *to, Point *from, | |
1053 | + real length, real width, real linewidth, Color *color) | |
1054 | +{ | |
1055 | + Point point1; | |
1056 | + Point point2; | |
1057 | + Point delta; | |
1058 | + Point orth_delta; | |
1059 | + real len; | |
1060 | + | |
1061 | + delta = *to; | |
1062 | + point_sub(&delta, from); | |
1063 | + len = sqrt(point_dot(&delta, &delta)); | |
1064 | + if (len <= 0.0001) { | |
1065 | + delta.x=1.0; | |
1066 | + delta.y=0.0; | |
1067 | + } else { | |
1068 | + delta.x/=len; | |
1069 | + delta.y/=len; | |
1070 | + } | |
1071 | + | |
1072 | + orth_delta.x = delta.y; | |
1073 | + orth_delta.y = -delta.x; | |
1074 | + | |
1075 | + point_scale(&delta, length/2.0); | |
1076 | + point_scale(&orth_delta, width/2.0); | |
1077 | + | |
1078 | + point1 = *to; | |
1079 | + point_sub(&point1, &delta); | |
1080 | + point_sub(&point1, &delta); | |
1081 | + point_sub(&point1, &delta); | |
1082 | + point_add(&point1, &orth_delta); | |
1083 | + | |
1084 | + point2 = *to; | |
1085 | + point_sub(&point2, &delta); | |
1086 | + point_sub(&point2, &orth_delta); | |
1087 | + | |
1088 | + DIA_RENDERER_GET_CLASS(renderer)->set_linewidth(renderer, linewidth); | |
1089 | + DIA_RENDERER_GET_CLASS(renderer)->set_linestyle(renderer, LINESTYLE_SOLID); | |
1090 | + DIA_RENDERER_GET_CLASS(renderer)->set_linejoin(renderer, LINEJOIN_MITER); | |
1091 | + DIA_RENDERER_GET_CLASS(renderer)->set_linecaps(renderer, LINECAPS_BUTT); | |
1092 | + | |
1093 | + DIA_RENDERER_GET_CLASS(renderer)->draw_line(renderer, &point1,&point2, color); | |
1094 | +} | |
1095 | + | |
1096 | +static void | |
1049 | 1097 | draw_cross(DiaRenderer *renderer, Point *to, Point *from, |
1050 | 1098 | real length, real width, real linewidth, Color *color) |
1051 | 1099 | { |
@@ -1399,6 +1447,9 @@ arrow_draw(DiaRenderer *renderer, ArrowType type, | ||
1399 | 1447 | draw_filled_dot_n_triangle(renderer, to, from, length, width, linewidth, |
1400 | 1448 | fg_color, bg_color); |
1401 | 1449 | break; |
1450 | + case ARROW_BACKSLASH: | |
1451 | + draw_backslash(renderer,to,from,length,width,linewidth,fg_color); | |
1452 | + break; | |
1402 | 1453 | } |
1403 | 1454 | } |
1404 | 1455 |
@@ -61,6 +61,7 @@ typedef enum { | ||
61 | 61 | ARROW_NONE_OR_MANY, /* ER-model: 0 or many*/ |
62 | 62 | ARROW_ONE_OR_NONE, /* ER-model: 1 or 0 */ |
63 | 63 | ARROW_ONE_EXACTLY, /* ER-model: exactly one*/ |
64 | + ARROW_BACKSLASH, /* -\---- */ | |
64 | 65 | } ArrowType; |
65 | 66 | |
66 | 67 | struct menudesc { |
@@ -5,6 +5,8 @@ libnetwork_objects_la_SOURCES = \ | ||
5 | 5 | network.h \ |
6 | 6 | network.c \ |
7 | 7 | bus.c \ |
8 | + radiocell.c \ | |
9 | + basestation.c \ | |
8 | 10 | wanlink.c |
9 | 11 | |
10 | 12 | libnetwork_objects_la_LDFLAGS = -export-dynamic -module -avoid-version |
@@ -17,6 +19,8 @@ EXTRA_DIST = \ | ||
17 | 19 | pixmaps/computer.xpm \ |
18 | 20 | pixmaps/disc.xpm \ |
19 | 21 | pixmaps/flash.xpm \ |
22 | + pixmaps/radiocell.xpm \ | |
23 | + pixmaps/basestation.xpm \ | |
20 | 24 | pixmaps/wanlink.xpm \ |
21 | 25 | pixmaps/hub.xpm \ |
22 | 26 | pixmaps/modem.xpm \ |
@@ -31,6 +31,8 @@ Color computer_color = { 0.7, 0.7, 0.7 }; | ||
31 | 31 | |
32 | 32 | extern DiaObjectType bus_type; |
33 | 33 | extern DiaObjectType bus_type_std; |
34 | +extern DiaObjectType radiocell_type; | |
35 | +extern DiaObjectType basestation_type; | |
34 | 36 | extern DiaObjectType wanlink_type; |
35 | 37 | |
36 | 38 | DIA_PLUGIN_CHECK_INIT |
@@ -44,6 +46,8 @@ dia_plugin_init(PluginInfo *info) | ||
44 | 46 | |
45 | 47 | object_register_type(&bus_type_std); |
46 | 48 | object_register_type(&bus_type); |
49 | + object_register_type(&radiocell_type); | |
50 | + object_register_type(&basestation_type); | |
47 | 51 | object_register_type(&wanlink_type); |
48 | 52 | |
49 | 53 | return DIA_PLUGIN_INIT_OK; |
@@ -42,9 +42,15 @@ | ||
42 | 42 | <object name="Network - Antenna"> |
43 | 43 | <_description>Antenna for wireless transmission</_description> |
44 | 44 | </object> |
45 | + <object name="Network - Base Station"> | |
46 | + <_description>Mobile telephony base station</_description> | |
47 | + </object> | |
45 | 48 | <object name="Network - Cloud"> |
46 | 49 | <_description>Network cloud</_description> |
47 | 50 | </object> |
51 | + <object name="Network - Radio Cell"> | |
52 | + <_description>Mobile telephony cell</_description> | |
53 | + </object> | |
48 | 54 | <object name="Network - Router Symbol"> |
49 | 55 | <_description>Router symbol</_description> |
50 | 56 | </object> |