作図ソフト dia の改良版
修订版 | 6b5edf96e0379e8bbb9078e784b319bba90dfc31 (tree) |
---|---|
时间 | 2004-04-02 00:56:29 |
作者 | Lars Clausen <lclausen@src....> |
Commiter | Lars Clausen |
Persistent arrow types, too.
@@ -1,5 +1,10 @@ | ||
1 | 1 | 2004-04-01 Lars Clausen <lc@pc770.sb.statsbiblioteket.dk> |
2 | 2 | |
3 | + * lib/attributes.c: | |
4 | + * app/interface.c: Default arrows now stored persistently, too. | |
5 | + | |
6 | + * lib/arrows.[ch]: New function to get arrow type from name. | |
7 | + | |
3 | 8 | * app/color_area.c (color_area_create): |
4 | 9 | * lib/attributes.c: |
5 | 10 | * app/linewidth_area.c: Also persistent colors and line width. |
@@ -37,6 +37,7 @@ | ||
37 | 37 | #include "persistence.h" |
38 | 38 | #include "diaarrowchooser.h" |
39 | 39 | #include "dialinechooser.h" |
40 | +#include "widgets.h" | |
40 | 41 | |
41 | 42 | #include <gdk-pixbuf/gdk-pixbuf.h> |
42 | 43 | #include "dia-app-icons.h" |
@@ -1109,9 +1110,15 @@ static void | ||
1109 | 1110 | create_lineprops_area(GtkWidget *parent) |
1110 | 1111 | { |
1111 | 1112 | GtkWidget *chooser; |
1113 | + Arrow arrow; | |
1112 | 1114 | |
1113 | 1115 | chooser = dia_arrow_chooser_new(TRUE, change_start_arrow_style, NULL, tool_tips); |
1114 | 1116 | gtk_wrap_box_pack_wrapped(GTK_WRAP_BOX(parent), chooser, FALSE, TRUE, FALSE, TRUE, TRUE); |
1117 | + arrow.width = persistence_register_real("start-arrow-width", DEFAULT_ARROW_WIDTH); | |
1118 | + arrow.length = persistence_register_real("start-arrow-length", DEFAULT_ARROW_LENGTH); | |
1119 | + arrow.type = arrow_type_from_name(persistence_register_string("start-arrow-type", "None")); | |
1120 | + dia_arrow_chooser_set_arrow_type(DIA_ARROW_CHOOSER(chooser), arrow.type); | |
1121 | + attributes_set_default_start_arrow(arrow); | |
1115 | 1122 | gtk_tooltips_set_tip(tool_tips, chooser, _("Arrow style at the beginning of new lines. Click to pick an arrow, or set arrow parameters with Details..."), NULL); |
1116 | 1123 | gtk_widget_show(chooser); |
1117 | 1124 |
@@ -1121,7 +1128,12 @@ create_lineprops_area(GtkWidget *parent) | ||
1121 | 1128 | gtk_widget_show(chooser); |
1122 | 1129 | |
1123 | 1130 | chooser = dia_arrow_chooser_new(FALSE, change_end_arrow_style, NULL, tool_tips); |
1124 | - dia_arrow_chooser_set_arrow_type(DIA_ARROW_CHOOSER(chooser), ARROW_FILLED_CONCAVE); | |
1131 | + arrow.width = persistence_register_real("end-arrow-width", DEFAULT_ARROW_WIDTH); | |
1132 | + arrow.length = persistence_register_real("end-arrow-length", DEFAULT_ARROW_LENGTH); | |
1133 | + arrow.type = arrow_type_from_name(persistence_register_string("end-arrow-type", "Filled Concave")); | |
1134 | + dia_arrow_chooser_set_arrow_type(DIA_ARROW_CHOOSER(chooser), arrow.type); | |
1135 | + attributes_set_default_end_arrow(arrow); | |
1136 | + | |
1125 | 1137 | gtk_wrap_box_pack(GTK_WRAP_BOX(parent), chooser, FALSE, TRUE, FALSE, TRUE); |
1126 | 1138 | gtk_tooltips_set_tip(tool_tips, chooser, _("Arrow style at the end of new lines. Click to pick an arrow, or set arrow parameters with Details..."), NULL); |
1127 | 1139 | gtk_widget_show(chooser); |
@@ -18,6 +18,8 @@ | ||
18 | 18 | |
19 | 19 | #include <config.h> |
20 | 20 | |
21 | +#include <stdio.h> | |
22 | +#include <string.h> | |
21 | 23 | #include <glib.h> |
22 | 24 | #include <math.h> |
23 | 25 |
@@ -1399,3 +1401,14 @@ arrow_draw(DiaRenderer *renderer, ArrowType type, | ||
1399 | 1401 | break; |
1400 | 1402 | } |
1401 | 1403 | } |
1404 | + | |
1405 | +ArrowType | |
1406 | +arrow_type_from_name(gchar *name) | |
1407 | +{ | |
1408 | + int i; | |
1409 | + for (i = 0; arrow_types[i].name != NULL; i++) { | |
1410 | + if (!strcmp(arrow_types[i].name, name)) return arrow_types[i].enum_value; | |
1411 | + } | |
1412 | + printf("Unknown arrow type %s\n", name); | |
1413 | + return 0; | |
1414 | +} |
@@ -101,4 +101,7 @@ calculate_arrow_point(const Arrow *arrow, const Point *to, const Point *from, | ||
101 | 101 | void arrow_transform_points(Arrow *arrow, Point *start, Point *to, |
102 | 102 | int linewidth, Point *arrowtip); |
103 | 103 | |
104 | +/** Returns the ArrowType for a given name of an arrow, or 0 if not found. */ | |
105 | +ArrowType arrow_type_from_name(gchar *name); | |
106 | + | |
104 | 107 | #endif /* ARROWS_H */ |
@@ -101,6 +101,9 @@ void | ||
101 | 101 | attributes_set_default_start_arrow(Arrow arrow) |
102 | 102 | { |
103 | 103 | attributes_start_arrow = arrow; |
104 | + persistence_set_string("start-arrow-type", arrow_types[arrow.type].name); | |
105 | + persistence_set_real("start-arrow-width", arrow.width); | |
106 | + persistence_set_real("start-arrow-length", arrow.length); | |
104 | 107 | } |
105 | 108 | |
106 | 109 | Arrow |