• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

作図ソフト dia の改良版


Commit MetaInfo

Revision6b5edf96e0379e8bbb9078e784b319bba90dfc31 (tree)
Time2004-04-02 00:56:29
AuthorLars Clausen <lclausen@src....>
CommiterLars Clausen

Log Message

Persistent arrow types, too.

Change Summary

Incremental Difference

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
11 2004-04-01 Lars Clausen <lc@pc770.sb.statsbiblioteket.dk>
22
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+
38 * app/color_area.c (color_area_create):
49 * lib/attributes.c:
510 * app/linewidth_area.c: Also persistent colors and line width.
--- a/app/interface.c
+++ b/app/interface.c
@@ -37,6 +37,7 @@
3737 #include "persistence.h"
3838 #include "diaarrowchooser.h"
3939 #include "dialinechooser.h"
40+#include "widgets.h"
4041
4142 #include <gdk-pixbuf/gdk-pixbuf.h>
4243 #include "dia-app-icons.h"
@@ -1109,9 +1110,15 @@ static void
11091110 create_lineprops_area(GtkWidget *parent)
11101111 {
11111112 GtkWidget *chooser;
1113+ Arrow arrow;
11121114
11131115 chooser = dia_arrow_chooser_new(TRUE, change_start_arrow_style, NULL, tool_tips);
11141116 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);
11151122 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);
11161123 gtk_widget_show(chooser);
11171124
@@ -1121,7 +1128,12 @@ create_lineprops_area(GtkWidget *parent)
11211128 gtk_widget_show(chooser);
11221129
11231130 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+
11251137 gtk_wrap_box_pack(GTK_WRAP_BOX(parent), chooser, FALSE, TRUE, FALSE, TRUE);
11261138 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);
11271139 gtk_widget_show(chooser);
--- a/lib/arrows.c
+++ b/lib/arrows.c
@@ -18,6 +18,8 @@
1818
1919 #include <config.h>
2020
21+#include <stdio.h>
22+#include <string.h>
2123 #include <glib.h>
2224 #include <math.h>
2325
@@ -1399,3 +1401,14 @@ arrow_draw(DiaRenderer *renderer, ArrowType type,
13991401 break;
14001402 }
14011403 }
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+}
--- a/lib/arrows.h
+++ b/lib/arrows.h
@@ -101,4 +101,7 @@ calculate_arrow_point(const Arrow *arrow, const Point *to, const Point *from,
101101 void arrow_transform_points(Arrow *arrow, Point *start, Point *to,
102102 int linewidth, Point *arrowtip);
103103
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+
104107 #endif /* ARROWS_H */
--- a/lib/attributes.c
+++ b/lib/attributes.c
@@ -101,6 +101,9 @@ void
101101 attributes_set_default_start_arrow(Arrow arrow)
102102 {
103103 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);
104107 }
105108
106109 Arrow