Clone in a terminal:
Commit 21c9f9d
Johan Mattsson - 2015-05-08T23:48:36+00:00
21c9f9d55251a66c9a8414eb585f9df602d3631fjohan.mattsson.m@gmail.com

Remove stroke code settings Fix compiler warnings

Changed files (13)

Diff

diff --git a/libbirdfont/BezierTool.vala b/libbirdfont/BezierTool.valaindex 6ae4532..7ff7c4e 100644--- a/libbirdfont/BezierTool.vala+++ b/libbirdfont/BezierTool.vala@@ -28,9 +28,6 @@ public class BezierTool : Tool { 	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 ();diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex 3119299..67f9ace 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -773,6 +773,7 @@ public class DrawingTools : ToolCollection  { 		// 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 ();@@ -792,6 +793,9 @@ public class DrawingTools : ToolCollection  { 				}	 			} 			+			f = BirdFont.get_current_font ();+			f.settings.set_setting ("apply_stroke", @"$(StrokeTool.add_stroke)");+			 			add_stroke.selected = StrokeTool.add_stroke; 		}); 		stroke_expander.add_tool (add_stroke);diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 45b7ac6..8b91982 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -1671,12 +1671,6 @@ public class Glyph : FontDisplay { 		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) { 			p.draw_path (cr, this, c);diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex 29d2128..da793cb 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -210,27 +210,12 @@ public class MenuTab : FontDisplay { 		} 		 		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 threaddiff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 23bc49f..7f76655 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -2332,8 +2332,6 @@ public class Path { 	} 	 	public PathList get_stroke_fast () {-		PathList s;-		 		if (full_stroke != null) { 			return (!) full_stroke; 		}diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex 89d2aae..bfa003c 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -77,8 +77,6 @@ public class PenTool : Tool { 		 	public static bool retain_angle = false; 	-	static int press_counter = 0;-	 	public PenTool (string name) {	 		base (name, t_("Add new points")); 		diff --git a/libbirdfont/RecentFiles.vala b/libbirdfont/RecentFiles.valaindex 733a1e9..2998724 100644--- a/libbirdfont/RecentFiles.vala+++ b/libbirdfont/RecentFiles.vala@@ -230,7 +230,7 @@ public class RecentFiles : Table { 			if (MenuTab.suppress_event) { 				return; 			}-					+			 			f = BirdFont.new_font (); 			 			MainWindow.clear_glyph_cache ();diff --git a/libbirdfont/SaveCallback.vala b/libbirdfont/SaveCallback.valaindex f8f822b..a402a5d 100644--- a/libbirdfont/SaveCallback.vala+++ b/libbirdfont/SaveCallback.vala@@ -85,7 +85,6 @@ public class SaveCallback : GLib.Object { 			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 {diff --git a/libbirdfont/SpacingTab.vala b/libbirdfont/SpacingTab.valaindex 6537c2a..ef7ea62 100644--- a/libbirdfont/SpacingTab.vala+++ b/libbirdfont/SpacingTab.vala@@ -125,7 +125,7 @@ public class SpacingTab : KerningDisplay { 			} 			 			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);diff --git a/libbirdfont/StrokeTool.vala b/libbirdfont/StrokeTool.valaindex c6ffb3e..8cd0d90 100644--- a/libbirdfont/StrokeTool.vala+++ b/libbirdfont/StrokeTool.vala@@ -23,7 +23,6 @@ public class StrokeTool : Tool { 	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 class StrokeTool : Tool { 	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 (); 		@@ -45,27 +40,6 @@ public class StrokeTool : Tool { 			} 		} -		// 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) { 			foreach (Path p in g.active_paths) { 				g.path_list.remove (p);@@ -84,20 +58,29 @@ public class StrokeTool : Tool { 		} 		 		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 @@ public class StrokeTool : Tool { 		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 @@ public class StrokeTool : Tool { 		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 @@ public class StrokeTool : Tool { 				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 ();	 				@@ -1252,27 +1218,6 @@ public class StrokeTool : Tool { 		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) { 		Gee.ArrayList<Path> remove = new Gee.ArrayList<Path> (); 		int c;@@ -1284,42 +1229,21 @@ public class StrokeTool : Tool { 		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);-		} 	}  	public static int counters (PathList pl, Path path) {@@ -1333,7 +1257,6 @@ public class StrokeTool : Tool { 				&& 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 @@ public class StrokeTool : Tool { 	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 @@ public class StrokeTool : Tool { 		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);diff --git a/libbirdfont/SvgParser.vala b/libbirdfont/SvgParser.valaindex b6edab1..0bd0fda 100644--- a/libbirdfont/SvgParser.vala+++ b/libbirdfont/SvgParser.vala@@ -550,11 +550,6 @@ public class SvgParser { 			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; 	}diff --git a/libbirdfont/TabContent.vala b/libbirdfont/TabContent.valaindex 6c14289..4ee4069 100644--- a/libbirdfont/TabContent.vala+++ b/libbirdfont/TabContent.vala@@ -28,8 +28,7 @@ public class TabContent : GLib.Object { 	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) { 		}diff --git a/libbirdfont/TrackTool.vala b/libbirdfont/TrackTool.valaindex 8985f8e..2304705 100644--- a/libbirdfont/TrackTool.vala+++ b/libbirdfont/TrackTool.vala@@ -54,8 +54,6 @@ public class TrackTool : Tool { 	bool drawing = false;  	public TrackTool (string name) {-		string sw;-		 		base (name, t_("Freehand drawing")); 		 		press_action.connect ((self, button, x, y) => {

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112