Commit f52b074
Put back "Stroke settings"" This reverts commit 78f95e2181e127e51c4df67adc0bea127c5b9b1f.
Changed files (10)
modifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/EmptyTab.valamodifiedlibbirdfont/Expander.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/PenTool.valamodifiedlibbirdfont/StrokeTool.valamodifiedlibbirdfont/Toolbox.valamodifiedlibbirdfont/TrackTool.valamodifiedresources/icons.bf
Diff
@@ -26,6 +26,7 @@ public class DrawingTools : ToolCollection { Expander grid_expander; Expander shape_tools; public static Expander draw_tool_modifiers;+ public static Expander stroke_expander; public static Expander zoombar_tool; public static Expander view_tools; public static Expander guideline_tools;@@ -101,6 +102,7 @@ public class DrawingTools : ToolCollection { draw_tools = new Expander (t_("Drawing Tools")); draw_tool_modifiers = new Expander (t_("Control Point"));+ stroke_expander = new Expander (t_("Stroke")); shape_tools = new Expander (t_("Geometrical Shapes")); zoombar_tool = new Expander (t_("Zoom")); view_tools = new Expander ();@@ -218,7 +220,21 @@ public class DrawingTools : ToolCollection { }); insert_point_on_path_tool.set_persistent (true); key_tools.add_tool (insert_point_on_path_tool); - ++ // stroke+ Tool stroke_settings = new Tool ("stroke");+ stroke_settings.select_action.connect((self) => {+ StrokeTool.show_stroke_tools = !StrokeTool.show_stroke_tools;+ stroke_settings.set_selected (StrokeTool.show_stroke_tools);+ stroke_expander.visible = StrokeTool.show_stroke_tools;+ MainWindow.get_toolbox ().update_expanders ();+ Toolbox.redraw_tool_box ();+ });+ + if (BirdFont.has_argument ("--test")) {+ draw_tool_modifiers.add_tool (stroke_settings);+ }+ // quadratic Bézier points quadratic_points = new Tool ("quadratic_points", t_("Create quadratic Bézier curves")); quadratic_points.select_action.connect ((self) => {@@ -255,7 +271,7 @@ public class DrawingTools : ToolCollection { }); convert_points.set_persistent (false); draw_tool_modifiers.add_tool (convert_points);-+ // x coordinate x_coordinate = new SpinButton ("x_coordinate", t_("X coordinate")); x_coordinate.set_big_number (true);@@ -480,38 +496,6 @@ public class DrawingTools : ToolCollection { width.set_value_round (MoveTool.selection_box_width, true, false); height.set_value_round (MoveTool.selection_box_height, true, false); });- - // edit stroke width- object_stroke = new SpinButton ("object_stroke", t_("Stroke width"));- object_stroke.set_int_value ("2.000");- object_stroke.set_int_step (0.015);- - object_stroke.new_value_action.connect((self) => {- if (move_tool.is_selected () && object_stroke.is_selected ()) {- StrokeTool.set_stroke_for_selected_paths (object_stroke.get_value ());- }- - if (track_tool.is_selected ()) {- track_tool.set_stroke_width (object_stroke.get_value ());- }- - if (pen_tool.is_selected ()) {- pen_tool.set_stroke_width (object_stroke.get_value ());- }- });- - if (BirdFont.has_argument ("--test") || BirdFont.android) {- draw_tool_modifiers.add_tool (object_stroke);- }-- stroke_tool = new StrokeTool ("stroke"); // create outline from path- stroke_tool.select_action.connect ((self) => {- update_drawing_and_background_tools (self);- });- - if (BirdFont.has_argument ("--test") || BirdFont.android) {- draw_tools.add_tool (stroke_tool);- } // tie edit point handles tie_handles = new Tool ("tie_point", t_("Tie curve handles for the selected edit point"));@@ -753,6 +737,55 @@ public class DrawingTools : ToolCollection { }); draw_tool_modifiers.add_tool (delete_background); ++ // add stroke to path+ Tool add_stroke = new Tool ("apply_stroke", t_("Apply stroke"));+ add_stroke.select_action.connect ((self) => {+ Glyph g = MainWindow.get_current_glyph ();+ StrokeTool.add_stroke = !StrokeTool.add_stroke;+ add_stroke.selected = StrokeTool.add_stroke;+ + if (StrokeTool.add_stroke) {+ foreach (Path p in g.active_paths) {+ p.stroke = StrokeTool.stroke_width;+ }+ } else {+ foreach (Path p in g.active_paths) {+ p.stroke = 0;+ }+ }+ + GlyphCanvas.redraw ();+ });+ stroke_expander.add_tool (add_stroke); + + // edit stroke width+ object_stroke = new SpinButton ("object_stroke", t_("Stroke width"));+ object_stroke.set_value_round (StrokeTool.stroke_width);+ object_stroke.set_int_step (0.015);+ + object_stroke.new_value_action.connect((self) => {+ bool tool = resize_tool.is_selected ()+ || move_tool.is_selected ()+ || pen_tool.is_selected ()+ || track_tool.is_selected ()+ || point_tool.is_selected ()+ || foresight_tool.is_selected ();+ + if (tool && object_stroke.is_selected () && StrokeTool.add_stroke) {+ StrokeTool.set_stroke_for_selected_paths (object_stroke.get_value ());+ }+ + StrokeTool.stroke_width = object_stroke.get_value ();+ });+ stroke_expander.add_tool (object_stroke);++ // create outline from path+ Tool outline = new Tool ("stroke_to_outline", t_("Create outline form stroke"));+ outline.select_action.connect ((self) => {+ stroke_tool.select_action (stroke_tool);+ });+ stroke_expander.add_tool (outline); if (BirdFont.has_argument ("--test")) { Tool test_case = new Tool ("test_case");@@ -925,6 +958,8 @@ public class DrawingTools : ToolCollection { }); shape_tools.add_tool (rectangle); + stroke_expander.visible = false;+ add_expander (font_name); add_expander (draw_tools); @@ -933,6 +968,7 @@ public class DrawingTools : ToolCollection { } add_expander (draw_tool_modifiers);+ add_expander (stroke_expander); add_expander (guideline_tools); add_expander (grid); add_expander (zoombar_tool);@@ -947,6 +983,9 @@ public class DrawingTools : ToolCollection { draw_tools.set_persistent (true); draw_tools.set_unique (false); + stroke_expander.set_persistent (true);+ stroke_expander.set_unique (false);+ key_tools.set_persistent (false); key_tools.set_unique (false); @@ -36,7 +36,7 @@ public class EmptyTab : FontDisplay { public override void draw (WidgetAllocation allocation, Context cr) { cr.save ();- Theme.color (cr, "Background 9");+ Theme.color (cr, "Default Background"); cr.rectangle (0, 0, allocation.width, allocation.height); cr.fill (); cr.restore ();@@ -43,6 +43,8 @@ public class Expander : GLib.Object { string? headline; + public bool visible = true;+ public Expander (string? headline = null) { this.headline = headline; tool = new Gee.ArrayList<Tool> ();@@ -1101,10 +1101,12 @@ public class Glyph : FontDisplay { double xt, yt; Path np; EditPoint inserted;+ bool stroke = StrokeTool.add_stroke; if (path_list.size == 0) { np = new Path (); path_list.add (np);+ np.stroke = stroke ? StrokeTool.stroke_width : 0; } xt = path_coordinate_x (x);@@ -1117,6 +1119,7 @@ public class Glyph : FontDisplay { np.add (xt, yt); } else { np = new Path ();+ np.stroke = stroke ? StrokeTool.stroke_width : 0; path_list.add (np); np.add (xt, yt); @@ -465,11 +465,13 @@ public class OverView : FontDisplay { } void draw_empty_canvas (WidgetAllocation allocation, Context cr) {+ Text t = new Text (t_("No glyphs in this view."), 24);+ cr.save ();- Theme.color (cr, "Default Background");- cr.move_to (30, 40);- cr.set_font_size (18);- cr.show_text (t_("No glyphs in this view."));+ Theme.text_color (t, "Text Foreground");+ t.widget_x = 40;+ t.widget_y = 40;+ t.draw (cr); cr.restore (); } @@ -248,12 +248,6 @@ public class PenTool : Tool { } } }-- public void set_stroke_width (double width) {- string w = SpinButton.convert_to_string (width);- Preferences.set ("pen_tool_stroke_width", w);- path_stroke_width = width;- } public bool has_join_icon () { double mx, my;@@ -19,6 +19,10 @@ namespace BirdFont { public class StrokeTool : Tool { + public static double stroke_width = 0;+ public static bool add_stroke = false;+ + public static bool show_stroke_tools = false; public static bool stroke_selected = false; static int iterations = 0; @@ -418,14 +418,14 @@ public class Toolbox : GLib.Object { pos = 4 * get_scale (); foreach (Expander e in current_set.get_expanders ()) {- e.set_offset (pos);- - pos += e.get_content_height () + 4 * get_scale ();- - current_set.content_height = pos;- - if (BirdFont.android) {- current_set.content_height *= 1.15;+ if (e.visible) {+ e.set_offset (pos);+ pos += e.get_content_height () + 4 * get_scale ();+ current_set.content_height = pos;+ + if (BirdFont.android) {+ current_set.content_height *= 1.15;+ } } } @@ -436,8 +436,10 @@ public class Toolbox : GLib.Object { private void draw_expanders (int w, int h, Context cr) { foreach (Expander e in current_set.get_expanders ()) {- e.draw (w, h, cr);- e.draw_content (w, h, cr);+ if (e.visible) {+ e.draw (w, h, cr);+ e.draw_content (w, h, cr);+ } } } @@ -103,8 +103,6 @@ public class TrackTool : Tool { } glyph.set_active_path (end_point.path); add_corner (x, y);- - set_stroke_width (end_point.path.stroke); } else { p = new Path (); glyph.add_path (p);@@ -195,12 +193,6 @@ public class TrackTool : Tool { samples_per_point = s; } - public void set_stroke_width (double width) {- string w = SpinButton.convert_to_string (width);- Preferences.set ("freehand_stroke_width", w);- stroke_width = width;- }- void add_endpoint_and_merge (int x, int y) { Glyph glyph; Path p;@@ -81,6 +81,11 @@ GNU Lesser General Public License</copyright> <glyph id="1" left="-28" right="28"> </glyph> </collection>+<collection unicode="U+48">+ <selected id="1"/>+ <glyph id="1" left="-28" right="28">+ </glyph>+</collection> <collection unicode="U+5f"> <selected id="1"/> <glyph id="1" left="-28" right="28">@@ -98,6 +103,14 @@ GNU Lesser General Public License</copyright> <path stroke="0" skew="0" data="S 0.0000000000,46.5449735450 L 4.0000000000,46.5449735450 L 4.0000000000,10.5449735450 L 0.0000000000,10.5449735450 L 0.0000000000,46.5449735450" /> </glyph> </collection>+<collection name="apply_stroke">+ <selected id="1"/>+ <glyph id="1" left="-26.53515625" right="29.796903565002076">+ <path stroke="0" skew="0" data="S -2.2806382158,53.8421078046 L 6.6321666040,53.8421078046 L 29.7969035650,0.0000000000 L 15.3593750000,-0.0976562500 L 8.5769240494,15.3982858010 L -6.1525944080,15.4878247687 L -12.7276143570,0.2191673315 L -26.5351562500,0.0730557772 L -2.2806382158,53.8421078046" />+ <path stroke="0" skew="0" data="S -23.9701162601,1.6913361719 L -13.6514251179,1.6601562500 L -6.7601327602,17.1372850855 L 1.2029469558,17.0414241652 L 1.2760027330,20.1899532074 L -6.3948538742,20.2893794388 L 2.2987836140,41.3294432756 L 2.6640625000,52.3608656345 L -1.4653715679,52.3261204014 L -23.9701162601,1.6913361719" />+ <path stroke="0" skew="0" data="S 6.8632812500,21.7154782755 L 2.0415999540,35.7421875000 L -3.5836948912,21.7885340527 L 6.8632812500,21.7154782755" />+ </glyph>+</collection> <collection name="auto_trace_resolution"> <selected id="1"/> <glyph id="1" left="-27.706519058400005" right="32.620610941599999">@@ -850,6 +863,12 @@ GNU Lesser General Public License</copyright> <path stroke="0" skew="0" data="B -22.1111346178,-2.1662692265 M -22.1111346178,3.6619307735 M -8.0081446178,3.6619307735 M -8.0081446178,1.3594907735 M 36.2240153822,1.3594907735 M 36.2240153822,3.9824507735 M 49.3675767137,3.9824507735 M 49.3654353822,-1.2046992265 M 14.1079053822,-10.4998592265 M -22.1111346178,-2.1662692265" /> </glyph> </collection>+<collection name="stroke">+ <selected id="1"/>+ <glyph id="1" left="-12.495767671363756" right="27.75425997273625">+ <path stroke="0" skew="0" data="B 23.0052716923,43.4486841473 C 22.3482657507,44.0857808179 21.7027386187,44.5618043950 20.9423490570,44.9661675247 C 20.2414622759,45.3388880178 19.5640547203,45.5848423657 18.7959127519,45.7508132052 C 18.0586501736,45.9101119990 17.3327525085,45.9680687958 16.5882068428,45.9443906500 C 15.8384199813,45.9205458230 15.0812867309,45.8066048982 14.3933520522,45.6384367349 C 13.6727573547,45.4622847098 12.9342470250,45.1982838973 12.3379494616,44.9308138412 C 11.6972761218,44.6434389723 11.0421646823,44.2690808416 10.5720338168,43.9496769469 C 10.0674381327,43.6068578754 9.5693393040,43.1872322824 9.2535146942,42.8650230566 C 8.9481585027,42.5534938756 8.7171357275,42.2763279484 8.5332941752,41.9340022994 C 8.2519401415,41.4101016848 8.0175468243,40.8358280013 7.8803172187,40.3909264427 C 7.7298588093,39.9031367956 7.6300671444,39.3692908717 7.5893076055,38.9505905941 C 7.5429295330,38.4741742167 7.5512170746,37.9430925141 7.5877855916,37.5402917006 C 7.6318526566,37.0548946688 7.7051720814,36.6299572494 7.8380767446,36.0997324575 C 8.0972826495,35.0656273046 8.5057988154,34.0521135886 8.9783918210,33.0412365972 C 9.4941430439,31.9380441286 10.1483820193,30.7230006098 10.6689636273,29.7365291561 C 11.2940063382,28.5521100714 12.0098525908,27.1230122657 12.4290161146,26.1427417242 C 12.9873649777,24.8369674586 13.5441210340,22.9246591258 13.6912454486,22.1334025645 C 13.8251664501,21.4131558846 13.9159934826,20.2383539587 13.9227444464,19.9384299275 C 13.9312351481,19.5612148257 13.9175079258,19.0961165524 13.8972529120,18.7968011094 C 13.8712085598,18.4119345821 13.8114776757,17.9275066148 13.7633204542,17.6313970371 C 13.6368454022,16.8537260459 13.3154380074,15.7379829922 13.1380527970,15.2511434013 C 12.8508481419,14.4629007040 12.3415165561,13.4236287019 12.0007938546,12.8339163339 C 11.2429265896,11.5222229907 10.1182267992,10.1408146059 9.4930549022,9.5074123126 C 8.5632515573,8.5653680943 7.2144033536,7.6107281712 6.5382349412,7.2237194035 C 5.5040884185,6.6318198649 4.0503803443,6.0985943738 3.3447659689,5.9075414470 C 2.2769030321,5.6184057000 0.8304318465,5.4433217229 0.1240767557,5.4098187556 C -0.9236250320,5.3601254509 -2.2957224271,5.4562606941 -2.9651757804,5.5432504017 C -3.9533176523,5.6716509423 -5.2175037221,5.9625826007 -5.8069250581,6.1289522231 C -6.7029118508,6.3818527805 -7.8381457919,6.8110221611 -8.3029243282,7.0101985944 C -9.0801569529,7.3432742637 -9.8677872098,7.7565945215 -10.3668890655,8.0559046129 M -8.2407524732,11.6012535648 C -7.6985736303,11.2761103157 -7.2640058638,11.0625876034 -6.6745611859,10.8099866775 C -6.1792475367,10.5977247112 -5.3984758145,10.3091866215 -4.6839423293,10.1075029380 C -4.0557871521,9.9302003307 -3.2154097011,9.7445208716 -2.4324764498,9.6427854269 C -1.7128157794,9.5492717101 -0.8724217716,9.5012015334 -0.0717818703,9.5391765021 C 0.6992254968,9.5757459768 1.4898859448,9.6881671600 2.2643429189,9.8978599848 C 3.0493433609,10.1104075706 3.7658267721,10.4001576820 4.4846897638,10.8116029307 C 5.2485511797,11.2488032787 5.9002146961,11.7522407103 6.5508223629,12.4114136357 C 7.2574153048,13.1273088831 7.8546504616,13.9213111117 8.4213076418,14.9020639235 C 8.7994723391,15.5565797458 9.0441082447,16.0907473986 9.2538511653,16.6663937978 C 9.4480160056,17.1992856389 9.5963776234,17.7628065712 9.6829304733,18.2950035502 C 9.7225873193,18.5388459387 9.7524310937,18.7765997564 9.7726861075,19.0759151994 C 9.7821732826,19.2161105139 9.7965422603,19.5454776154 9.7897912965,19.8454016466 C 9.7837212861,20.1150730655 9.7204033056,20.8748482719 9.6269063109,21.3776887474 C 9.4678271617,22.2332396149 9.0655990443,23.4938626792 8.6279346851,24.5173999244 C 8.1726315255,25.5821878878 7.5852612700,26.7223904797 7.0128312281,27.8071116587 C 6.4791692790,28.8183695874 5.7769052707,30.1279662559 5.2334389129,31.2904414305 C 4.7746007754,32.2718967430 4.1501701006,33.8098211037 3.8281284980,35.0946100472 C 3.7071422821,35.5772860469 3.5340843069,36.4685356525 3.4707172689,37.1665211470 C 3.4369597307,37.5383591365 3.4029159362,38.6131432263 3.4747575832,39.3511328689 C 3.5118340088,39.7319985537 3.6940888028,40.8446820763 3.9299683595,41.6094090604 C 4.0541569599,42.0120313786 4.4756964236,43.1160938149 4.8912632045,43.8899078207 C 5.0586973594,44.2016817643 5.6939048924,45.1392018969 6.3012316770,45.7588062182 C 6.5803059664,46.0435221901 7.5019703630,46.8617214007 8.2488623438,47.3691550221 C 8.6771465165,47.6601285422 9.7760852327,48.3125168577 10.6460472617,48.7027394696 C 11.1937306708,48.9484035828 12.4421667773,49.4171891367 13.4116859824,49.6541916735 C 14.0405232639,49.8079132607 15.4166674988,50.0432231775 16.4568032269,50.0763017200 C 17.1282841328,50.0976562500 18.5961914071,50.0233644734 19.6689900520,49.7915670987 C 20.3499459912,49.6444343634 21.8337143553,49.1743432157 22.8833571555,48.6161597934 C 23.5499395756,48.2616818163 24.9288159533,47.3418881317 25.8831385786,46.4164843738 M 23.0052716923,43.4486841473" />+ </glyph>+</collection> <collection name="symmetric"> <selected id="1"/> <glyph id="1" left="-40.784482758620676" right="42.890804597701162">@@ -1060,6 +1079,7 @@ GNU Lesser General Public License</copyright> <ligature sequence="d e l e t e _ b u t t o n" replacement="delete_button"/> <ligature sequence="f l i p _ v e r t i c a l" replacement="flip_vertical"/> <ligature sequence="d r o p d o w n _ m e n u" replacement="dropdown_menu"/>+<ligature sequence="a p p l y _ s t r o k e" replacement="apply_stroke"/> <ligature sequence="e x p o r t _ f o n t s" replacement="export_fonts"/> <ligature sequence="r e v e r s e _ p a t h" replacement="reverse_path"/> <ligature sequence="c u b i c _ p o i n t s" replacement="cubic_points"/>@@ -1097,6 +1117,7 @@ GNU Lesser General Public License</copyright> <ligature sequence="z o o m _ o u t" replacement="zoom_out"/> <ligature sequence="s e t t i n g s" replacement="settings"/> <ligature sequence="z o o m _ i n" replacement="zoom_in"/>+<ligature sequence="s t r o k e" replacement="stroke"/> <ligature sequence="c i r c l e" replacement="circle"/> <ligature sequence="r e s i z e" replacement="resize"/> <ligature sequence="h e i g h t" replacement="height"/>