The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Remove stroke code settings

These changes was commited to the Birdfont repository Fri, 08 May 2015 23:48:36 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 08 May 2015 23:48:36 +0000 (01:48 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 08 May 2015 23:48:36 +0000 (01:48 +0200)
commit 21c9f9d55251a66c9a8414eb585f9df602d3631f
tree c04a4598daecbe10c02c7b581e3e0def229e7cc6
parent 85ec0359e013dc6547dfa26315828a865009d056
Remove stroke code settings
Fix compiler warnings

14 files changed:
libbirdfont/BezierTool.vala
libbirdfont/DrawingTools.vala
libbirdfont/Glyph.vala
libbirdfont/MenuTab.vala
libbirdfont/Path.vala
libbirdfont/PenTool.vala
libbirdfont/RecentFiles.vala
libbirdfont/SaveCallback.vala
libbirdfont/SpacingTab.vala
libbirdfont/StrokeTool.vala
libbirdfont/SvgParser.vala
libbirdfont/TabContent.vala
libbirdfont/TrackTool.vala
--- a/libbirdfont/BezierTool.vala +++ b/libbirdfont/BezierTool.vala @@ -28,9 +28,6 @@ public const uint MOVE_FIRST_HANDLE = 5; uint state = NONE; - - bool move_right_handle = true; - int previous_point = 0; Path current_path = new Path (); EditPoint current_point = new EditPoint ();
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -773,6 +773,7 @@ // add stroke to path add_stroke = new Tool ("apply_stroke", t_("Apply stroke")); add_stroke.select_action.connect ((self) => { + Font f; Glyph g = MainWindow.get_current_glyph (); StrokeTool.add_stroke = !StrokeTool.add_stroke; StrokeTool.stroke_width = object_stroke.get_value (); @@ -791,6 +792,9 @@ p.stroke = 0; } } + + f = BirdFont.get_current_font (); + f.settings.set_setting ("apply_stroke", @"$(StrokeTool.add_stroke)"); add_stroke.selected = StrokeTool.add_stroke; });
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -1670,12 +1670,6 @@ private Color get_path_fill_color () { return Theme.get_color ("Fill Color"); } - - private void draw_outline_for_paths (PathList pl, Context cr) { - foreach (Path p in pl.paths) { - p.draw_outline (cr); - } - } private void draw_path_list (PathList pl, Context cr, Color? c = null) { foreach (Path p in pl.paths) {
--- a/libbirdfont/MenuTab.vala +++ b/libbirdfont/MenuTab.vala @@ -210,27 +210,12 @@ } string pt = f.settings.get_setting ("point_type"); - print (@"PT: $pt\n"); DrawingTools.set_default_point_type (pt); - } - - public static void set_font_setting_from_tools (Font f) { - string stroke_width; - - f.background_scale = DrawingTools.background_scale.get_display_value (); - - f.grid_width.clear (); - - foreach (SpinButton s in GridTool.sizes) { - f.grid_width.add (s.get_display_value ()); - } - - stroke_width = f.settings.get_setting ("stroke_width"); - - if (stroke_width != "") { - DrawingTools.object_stroke.set_value (stroke_width); - StrokeTool.stroke_width = DrawingTools.object_stroke.get_value (); - } + + string stroke = f.settings.get_setting ("apply_stroke"); + bool s = bool.parse (stroke); + DrawingTools.add_stroke.set_selected (s); + StrokeTool.add_stroke = s; } // FIXME: background thread
--- a/libbirdfont/Path.vala +++ b/libbirdfont/Path.vala @@ -2332,8 +2332,6 @@ } public PathList get_stroke_fast () { - PathList s; - if (full_stroke != null) { return (!) full_stroke; }
--- a/libbirdfont/PenTool.vala +++ b/libbirdfont/PenTool.vala @@ -76,8 +76,6 @@ public static double simplification_threshold = 0.5; public static bool retain_angle = false; - - static int press_counter = 0; public PenTool (string name) { base (name, t_("Add new points"));
--- a/libbirdfont/RecentFiles.vala +++ b/libbirdfont/RecentFiles.vala @@ -230,7 +230,7 @@ if (MenuTab.suppress_event) { return; } - + f = BirdFont.new_font (); MainWindow.clear_glyph_cache ();
--- a/libbirdfont/SaveCallback.vala +++ b/libbirdfont/SaveCallback.vala @@ -85,7 +85,6 @@ fn = f.get_path (); if (f.font_file != null && fn.has_suffix (".bf")) { - MenuTab.set_font_setting_from_tools (f); f.set_font_file (fn); MainWindow.native_window.save (); } else {
--- a/libbirdfont/SpacingTab.vala +++ b/libbirdfont/SpacingTab.vala @@ -125,7 +125,7 @@ } left = new Text (truncate (l, 5), 17); - Theme.text_color (left, "Foreground 3"); + Theme.text_color (left, "Foreground 1"); left.widget_x = middle - box_size / 2.0 + (box_size / 2.0 - left.get_extent ()) / 2.0; left.widget_y = allocation.height - 7 * MainWindow.units; left.draw_at_baseline (cr, left.widget_x, left.widget_y);
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -23,7 +23,6 @@ public static bool add_stroke = false; public static bool show_stroke_tools = false; - public static bool stroke_selected = false; public StrokeTool (string tooltip) { } @@ -32,10 +31,6 @@ public static void stroke_selected_paths () { Glyph g = MainWindow.get_current_glyph (); PathList paths = new PathList (); - - // FIXME: use background thread - - stroke_selected = true; // FIXME: delete g.store_undo_state (); @@ -43,27 +38,6 @@ if (p.stroke > 0) { paths.append (p.get_stroke ()); } - } - - // FIXME: delete - bool h = false; - foreach (Path p in g.active_paths) { - if (p.stroke == 0) { - h = true; - } - } - - if (h) { - PathList n = new PathList (); - - foreach (Path p in g.active_paths) { - if (p.stroke == 0) { - n.add (p); - } - } - - n = merge (n); - paths.append (n); } if (paths.paths.size > 0) { @@ -84,20 +58,29 @@ } PenTool.update_orientation (); - stroke_selected = false; // FIXME: delete + } + + public PathList merge_selected_paths () { + PathList n = new PathList (); + Glyph g = MainWindow.get_current_glyph (); + + foreach (Path p in g.active_paths) { + if (p.stroke == 0) { + n.add (p); + } + } + + n = merge (n); + return n; } public static PathList get_stroke_fast (Path path, double thickness) { PathList o; Path stroke; - o = get_stroke (path, thickness); - - /* // FIXME: stroke = path.copy (); stroke.remove_points_on_points (0.3); - o = create_stroke (stroke, thickness, true); - */ + o = create_stroke (stroke, thickness, false); // set to true for faster stroke return o; } @@ -109,19 +92,7 @@ stroke = path.copy (); stroke.remove_points_on_points (0.3); o = create_stroke (stroke, thickness, false); - - if (stroke_selected) { // FIXME: DELETE - foreach (Path mm in o.paths) - ((!) BirdFont.get_current_font ().get_glyph ("o")).add_path (mm); - } - o = get_all_parts (o); - - if (stroke_selected) { // FIXME: DELETE - foreach (Path mm in o.paths) - ((!) BirdFont.get_current_font ().get_glyph ("p")).add_path (mm); - } - o = remove_intersection_paths (o); o = merge (o); @@ -139,7 +110,6 @@ EditPoint ep, ep_start, last, first, segment_last; int start, stop; int j; - EditPointHandle rh; segment_last = new EditPoint (); last = new EditPoint (); @@ -184,10 +154,6 @@ ep = p.points.get (stop); segment = fit_bezier_path (p, start, stop, 0.0007); - - if (stroke_selected) { // FIXME: DELETE - ((!) BirdFont.get_current_font ().get_glyph ("l")).add_path (segment.copy ()); - } added_segment = segment.copy (); @@ -1250,27 +1216,6 @@ } return r; - } - - static bool has_zero_area_segment (Path p) { - EditPointHandle l, r; - - p.recalculate_linear_handles (); - - foreach (EditPoint ep in p.points) { - l = ep.get_left_handle (); - r = ep.get_right_handle (); - - if (l.length < 0.01 || r.length < 0.01) { - continue; - } - - if (!(fabs ((l.angle - r.angle + PI) % 2 * PI) < 0.0001) - && !(fabs (l.angle - r.angle) < 0.0001)) { - return false; - } - } - return true; } static void remove_merged_parts (PathList r) { @@ -1283,42 +1228,21 @@ foreach (Path p in r.paths) { c = counters (r, p); - - if (has_zero_area_segment (p)) { - //FIXME: remove.add (p); - } if (c % 2 == 0) { if (!p.is_clockwise ()) { remove.add (p); } - - if (stroke_selected) - ((!) BirdFont.get_current_font ().get_glyph ("m")).add_path (p); - } else { - if (stroke_selected) - ((!) BirdFont.get_current_font ().get_glyph ("n")).add_path (p); - if (p.is_clockwise ()) { remove.add (p); } } - } - - if (stroke_selected) { // FIXME: DELETE - foreach (Path mm in r.paths) - ((!) BirdFont.get_current_font ().get_glyph ("i")).add_path (mm); } foreach (Path p in remove) { r.paths.remove (p); - } - - if (stroke_selected) { // FIXME: DELETE - foreach (Path mm in r.paths) - ((!) BirdFont.get_current_font ().get_glyph ("j")).add_path (mm); } } @@ -1333,7 +1257,6 @@ && p != path && path.boundaries_intersecting (p)) { - // FIXME: all points can be corners in counter paths foreach (EditPoint ep in path.points) { if (!is_inside (ep, p)) { inside = false; @@ -1784,9 +1707,6 @@ static bool add_intersection_points (Path path1, Path path2, int n = 1) { bool intersection = false; int found = 0; - - path1.close (); // FIXME: - path2.close (); path1.all_segments ((ep1, ep2) => { double ix, iy; @@ -2205,8 +2125,7 @@ double x, y, x2, y2, x3, y3; EditPoint corner1, corner2, corner3; PointType type; - double handle1_x, handle1_y, handle2_x, handle2_y; - + Path.get_point_for_step (p1, p2, step, out x, out y); Path.get_point_for_step (p1, p2, step + step_size, out x2, out y2); Path.get_point_for_step (p1, p2, step + 2 * step_size, out x3, out y3);
--- a/libbirdfont/SvgParser.vala +++ b/libbirdfont/SvgParser.vala @@ -549,11 +549,6 @@ foreach (EditPoint end in p.points) { create_lines_for_segment (path, start, end, 1); start = end; - } - - if (StrokeTool.stroke_selected) { // FIXME: DELETE - ((!) BirdFont.get_current_font ().get_glyph ("b")).add_path (path); - path.recalculate_linear_handles (); } return path;
--- a/libbirdfont/TabContent.vala +++ b/libbirdfont/TabContent.vala @@ -28,8 +28,7 @@ static const int TEXT_INPUT_HEIGHT = 51; static double last_press_time = 0; - static bool double_click_event = false; - + public static void zoom_in () { if (MenuTab.suppress_event) { }
--- a/libbirdfont/TrackTool.vala +++ b/libbirdfont/TrackTool.vala @@ -54,8 +54,6 @@ bool drawing = false; public TrackTool (string name) { - string sw; - base (name, t_("Freehand drawing")); press_action.connect ((self, button, x, y) => {