Commit 9fe1b5d
Fix color tool on Windows and the missing stroke.
Changed files (5)
modifiedlibbirdfont/ColorTool.valamodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Icons.valamodifiedlibbirdfont/SearchPaths.valamodifiedlibbirdfont/SpinButton.vala
Diff
@@ -37,6 +37,10 @@ public class ColorTool : Tool { }); } + public void signal_color_updated () {+ color_updated ();+ }+ public override void draw (Context cr) { double scale = Toolbox.get_scale (); double xt = x + w / 2 - 8 * scale;@@ -533,25 +533,24 @@ public class DrawingTools : ToolCollection { SpinButton stroke_width; stroke_width = new SpinButton ("stroke_width", t_("Stroke width"));- - if (Preferences.get ("stroke_width") == "") {- stroke_width.set_value_round (1);- } else {- stroke_width.set_value (Preferences.get ("stroke_width"));- }- - stroke_width.new_value_action.connect((self) => {++ stroke_width.new_value_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); Path.stroke_width = stroke_width.get_value ();- Path.stroke_width = Math.sqrt (Path.stroke_width); g.redraw_area (0, 0, g.allocation.width, g.allocation.height);- Preferences.set ("stroke_width", @"$(Path.stroke_width)");+ Preferences.set ("stroke_width", stroke_width.get_display_value ()); MainWindow.get_toolbox ().redraw ((int) stroke_width.x, (int) stroke_width.y, 70, 70); }); style_tools.add_tool (stroke_width);+ stroke_width.set_max (4); stroke_width.set_min (0.2);-+ stroke_width.set_value_round (1);+ + if (Preferences.get ("stroke_width") != "") {+ stroke_width.set_value (Preferences.get ("stroke_width"));+ }+ ColorTool handle_color = new ColorTool (t_("Handle color")); handle_color.color_updated.connect (() => { Path.handle_color_r = handle_color.color_r;@@ -575,7 +574,6 @@ public class DrawingTools : ToolCollection { // adjust precision string precision_value = Preferences.get ("precision");- precision = new SpinButton ("precision", t_("Set precision")); if (precision_value != "") {@@ -586,7 +584,6 @@ public class DrawingTools : ToolCollection { precision.new_value_action.connect ((self) => { MainWindow.get_toolbox ().select_tool (precision);- Preferences.set ("precision", self.get_display_value ()); MainWindow.get_toolbox ().redraw ((int) precision.x, (int) precision.y, 70, 70); });@@ -18,7 +18,6 @@ using Cairo; public class Icons { - public static string directory = "icons"; public static bool high_res = true; public static int get_dpi () {@@ -26,7 +25,6 @@ public class Icons { } public static void use_high_resolution (bool high_res) {- directory = (high_res) ? "icons" : "icons-72dpi"; Icons.high_res = high_res; } @@ -52,7 +50,7 @@ public class Icons { } public static File find_icon (string name) {- return FontDisplay.find_file (directory, name);+ return SearchPaths.find_file ("icons", name); } } @@ -28,7 +28,7 @@ public class SearchPaths { printd ("Looking for: "); printd (resources + "/" + d + "/" + name);-+ f = get_file (resources + "/" + d + "/", name); if (likely (f.query_exists ())) return f; @@ -61,7 +61,7 @@ public class SearchPaths { f = get_file ("../" + d + "/", name); if (likely (f.query_exists ())) return f;-+ f = get_file (".\\" + d + "\\", name); if (likely (f.query_exists ())) return f; @@ -194,7 +194,7 @@ public class SpinButton : Tool { } public void set_value (string new_value, bool check_boundries = true, bool emit_signal = true) {- string v = new_value;+ string v = new_value.replace (",", "."); while (v.char_count () < 5) { if (v.index_of (".") == -1) {