Clone in a terminal:
Commit f9cef16
Johan Mattsson - 2012-12-30T22:50:07+00:00
f9cef163d0a39f1d4dee768d9935c756c0e840e1johan.mattsson.m@gmail.com

fix compiler warnings

Changed files (35)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex f4a261d..c6ff416 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -90,7 +90,7 @@ public class GtkWindow : Gtk.Window, NativeWindow { 				 				if (uri == "") { 					layout_uri = layout_dir.get_child (fd.get_html_file ());-					uri = fd.path_to_uri ((!) layout_uri.get_path ());+					uri = FontDisplay.path_to_uri ((!) layout_uri.get_path ()); 				} 		 				if (fd.get_html () == "") {@@ -213,21 +213,19 @@ public class GtkWindow : Gtk.Window, NativeWindow { 		}  		key_press_event.connect ((t, event) => {-			MainWindow window = MainWindow.get_singleton ();-			FontDisplay fd = window.glyph_canvas.current_display;+			FontDisplay fd = MainWindow.glyph_canvas.current_display; 			 			if (fd is Glyph) {-				window.tools.key_press (event.keyval);+				MainWindow.tools.key_press (event.keyval); 			} 			-			window.glyph_canvas.key_press (event.keyval);+			MainWindow.glyph_canvas.key_press (event.keyval); 			return false; 		}); 		 		key_release_event.connect ((t, event) => {-			MainWindow window = MainWindow.get_singleton ();-			if (window.glyph_canvas is Glyph) {-				window.glyph_canvas.key_release (event.keyval);+			if (MainWindow.glyph_canvas is Glyph) {+				MainWindow.glyph_canvas.key_release (event.keyval); 			} 			return false; 		});@@ -236,7 +234,7 @@ public class GtkWindow : Gtk.Window, NativeWindow { 	} 	 	public void color_selection (ColorTool color_tool) {-		ColorWindow c = new ColorWindow (color_tool);+		new ColorWindow (color_tool); 	} 	 	class ColorWindow : Gtk.Window {@@ -258,18 +256,18 @@ public class GtkWindow : Gtk.Window, NativeWindow { 		}	 	} 	-	public string get_clipboard () {-		SelectionData selection_data;+	public string get_clipboard_data () {+		SelectionData? selection_data; 		Atom target;  		target = Atom.intern_static_string ("image/x-inkscape-svg"); 		selection_data = clipboard.wait_for_contents (target); 		-		if (is_null (selection_data) || is_null (selection_data.data)) {+		if (is_null (selection_data) || is_null (((!) selection_data).data)) { 			return ""; 		} 		-		return (string) selection_data.data;+		return (string) ((!) selection_data).data; 	} 	 	public void set_inkscape_clipboard (string inkscape_clipboard_data) {diff --git a/birdfont/Main.vala b/birdfont/Main.valaindex 09cbc58..3ac72cc 100644--- a/birdfont/Main.vala+++ b/birdfont/Main.vala@@ -43,7 +43,7 @@ public static int main (string[] arg) {  	file = supplement.args.get_file (); 	if (file != "") {-		window.menu_tab.load_font (file);+		MainWindow.menu_tab.load_font (file); 	} 	 	Gtk.main ();diff --git a/dodo.py b/dodo.pyindex aa7bfbe..d23c359 100644--- a/dodo.py+++ b/dodo.py@@ -56,24 +56,30 @@ def task_pkg_flags():             }  -+valac_options = [+	'--enable-experimental-non-null',+	'--thread',+	'--enable-deprecated',+	'--enable-experimental'+	]		 libbird = Vala(src='libbirdfont', build='build', library='birdfont', pkg_libs=LIBS) def task_libbirdfont():-    yield libbird.gen_c(['--enable-experimental-non-null', '--thread'])++    yield libbird.gen_c(valac_options)     yield libbird.gen_o(['-fPIC', """-D 'GETTEXT_PACKAGE="birdfont"'"""])     yield libbird.gen_so()   def task_birdfont ():     bird = Vala(src='birdfont', build='build', pkg_libs=LIBS, vala_deps=[libbird])-    yield bird.gen_c([])+    yield bird.gen_c(valac_options)     yield bird.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """])   def task_birdfont_export ():      exp = Vala(src='birdfont-export', build='build', pkg_libs=LIBS,                 vala_deps=[libbird])-     yield exp.gen_c([])+     yield exp.gen_c(valac_options)      yield exp.gen_bin(["""-D 'GETTEXT_PACKAGE="birdfont"' """])  diff --git a/libbirdfont/BackgroundSelection.vala b/libbirdfont/BackgroundSelection.valaindex 84f5bf5..9ced932 100644--- a/libbirdfont/BackgroundSelection.vala+++ b/libbirdfont/BackgroundSelection.vala@@ -193,7 +193,7 @@ class BackgroundSelection : FontDisplay { 		zoom_background = MainWindow.get_tool ("zoom_background_image"); 		zoom_background.select_action (zoom_background); -		MainWindow.get_toolbox ().select_tool_by_name ("cut_background");+		Toolbox.select_tool_by_name ("cut_background"); 	}  	private void add_unique_background (string file) {diff --git a/libbirdfont/Birdfont.vala b/libbirdfont/Birdfont.valaindex e0f858a..030725b 100644--- a/libbirdfont/Birdfont.vala+++ b/libbirdfont/Birdfont.vala@@ -35,7 +35,6 @@ public static int run_export (string[] arg) { 	bool specific_formats = false;	 	bool write_ttf = false; 	bool write_svg = false;-	Supplement.Supplement supplement = new Supplement.Supplement (); 	 	File directory; 		@@ -46,7 +45,7 @@ public static int run_export (string[] arg) { 	for (int i = 1; i < arg.length; i++) {  		if (arg[i] == "-f" || arg[i] == "--fatal-warnings") {-			supplement.fatal_wanings = true;+			Supplement.Supplement.fatal_wanings = true; 			return 0; 		} @@ -90,19 +89,19 @@ public static int run_export (string[] arg) { 		} 	} -	if (supplement.fatal_wanings) {+	if (Supplement.Supplement.fatal_wanings) { 		LogLevelFlags levels = LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL | LogLevelFlags.LEVEL_WARNING;-		Log.set_handler (null, levels, supplement.fatal_warning);		+		Log.set_handler (null, levels, Supplement.Supplement.fatal_warning);		 	} 	 	Preferences preferences = new Preferences ();-	preferences.load ();+	Preferences.load (); 			-	supplement.args = new Argument ("");-	supplement.current_font = new Font ();-	supplement.current_glyph = new Glyph ("");+	Supplement.Supplement.args = new Argument ("");+	Supplement.Supplement.current_font = new Font ();+	Supplement.Supplement.current_glyph = new Glyph (""); 	-	if (!supplement.get_current_font ().load (file_name, false)) {+	if (!Supplement.Supplement.get_current_font ().load (file_name, false)) { 		stderr.printf (@"Failed to load font $file_name.\n"); 		 		if (!file_name.has_suffix (".ffi")) {@@ -120,12 +119,12 @@ public static int run_export (string[] arg) { 	}  	if (!specific_formats || write_svg) {-		print (_("Writing") + @" $(supplement.current_font.get_name ()).svg to $output_directory\n");+		print (_("Writing") + @" $(Supplement.Supplement.current_font.get_name ()).svg to $output_directory\n"); 		ExportTool.export_svg_font_path (File.new_for_path (output_directory)); 	}  	if (!specific_formats || write_ttf) {-		print (_("Writing") + @" $(supplement.current_font.get_name ()).ttf to $output_directory\n");+		print (_("Writing") + @" $(Supplement.Supplement.current_font.get_name ()).ttf to $output_directory\n"); 		ExportTool.export_ttf_font_path (File.new_for_path (output_directory), false); 	} 	diff --git a/libbirdfont/ClipTool.vala b/libbirdfont/ClipTool.valaindex b1fa32d..a9ea53e 100644--- a/libbirdfont/ClipTool.vala+++ b/libbirdfont/ClipTool.vala@@ -52,7 +52,7 @@ public class ClipTool : Tool { 				glyph = g.copy (); 			} 			-			native_window = MainWindow.get_singleton ().native_window;+			native_window = MainWindow.native_window; 			 			// several clipboards does not work on windows 			if (!Supplement.win32) {@@ -73,7 +73,6 @@ public class ClipTool : Tool { 		string gc; 		Glyph? destination = null; 		unichar new_char;-		Path inserted; 		string svg; 		 		// paste internal@@ -98,7 +97,7 @@ public class ClipTool : Tool { 			 			((!)destination).store_undo_state (); 			-			svg = MainWindow.get_singleton ().native_window.get_clipboard ();+			svg = MainWindow.native_window.get_clipboard_data (); 			ImportSvg.import_svg (svg); 			 			((!)destination).update_view ();diff --git a/libbirdfont/Context.vala b/libbirdfont/Context.valaindex 1061488..c8ecec0 100644--- a/libbirdfont/Context.vala+++ b/libbirdfont/Context.vala@@ -210,7 +210,7 @@ public class ContextDisplay : FontDisplay { 		Font f = Supplement.get_current_font (); 		string name; 		-		if (KeyBindings.singleton.modifier == NONE || KeyBindings.singleton.modifier == SHIFT) {+		if (KeyBindings.modifier == NONE || KeyBindings.modifier == SHIFT) { 					 			if (keyval == Key.BACK_SPACE && row.length () > 0) {	 				row.first ().data.glyph.remove_link (row.first ().data.glyph.last ());diff --git a/libbirdfont/CutBackgroundTool.vala b/libbirdfont/CutBackgroundTool.valaindex db17ddd..2c480ab 100644--- a/libbirdfont/CutBackgroundTool.vala+++ b/libbirdfont/CutBackgroundTool.vala@@ -164,8 +164,8 @@ class CutBackgroundTool : Tool { 		ty *= g.view_zoom; 		tx *= g.view_zoom; -		vx = g.path_coordinate_x (tx) - g.path_coordinate_x (fmin (x1, x2));			-		vy = g.path_coordinate_y (ty) - g.path_coordinate_y (fmin (y1, y2));+		vx = Glyph.path_coordinate_x (tx) - Glyph.path_coordinate_x (fmin (x1, x2));			+		vy = Glyph.path_coordinate_y (ty) - Glyph.path_coordinate_y (fmin (y1, y2)); 		 		x = (int) (vx / bg.img_scale_x); 		y = (int) (-vy / bg.img_scale_y);@@ -236,8 +236,8 @@ class CutBackgroundTool : Tool { 		wc = newbg.get_margin_width (); 		hc = newbg.get_margin_height (); 		-		newbg.img_x = g.path_coordinate_x (fmin (x1, x2)) - wc - 0.5;-		newbg.img_y = g.path_coordinate_y (fmin (y1, y2)) + hc + 0.5;+		newbg.img_x = Glyph.path_coordinate_x (fmin (x1, x2)) - wc - 0.5;+		newbg.img_y = Glyph.path_coordinate_y (fmin (y1, y2)) + hc + 0.5;  		new_image (newbg); 	}diff --git a/libbirdfont/EotWriter.vala b/libbirdfont/EotWriter.valaindex 2f32e05..5d97b7a 100644--- a/libbirdfont/EotWriter.vala+++ b/libbirdfont/EotWriter.vala@@ -120,26 +120,26 @@ class EotWriter : GLib.Object { 	 		fd.add_littleendian_u16 (0); // padding 		-		tn = names.get_name (names.FONT_NAME);+		tn = names.get_name (NameTable.FONT_NAME); 		fd.add_littleendian_u16 ((uint16) (2 * tn.char_count ())); // strlen of family name 		fd.add_str_littleendian_utf16 (tn); 		 		fd.add_littleendian_u16 (0); // padding 		-		tn = names.get_name (names.SUBFAMILY_NAME);+		tn = names.get_name (NameTable.SUBFAMILY_NAME); 		fd.add_littleendian_u16 ((uint16) (2 * tn.char_count ())); // strlen of family name 		fd.add_str_littleendian_utf16 (tn);  		fd.add_littleendian_u16 (0); // padding 		 		// FIXA version or name + version-		tn = names.get_name (names.VERSION);+		tn = names.get_name (NameTable.VERSION); 		fd.add_littleendian_u16 ((uint16) (2 * tn.char_count ())); // strlen of family name 		fd.add_str_littleendian_utf16 (tn); 		 		fd.add_littleendian_u16 (0); // padding 		-		tn = names.get_name (names.FULL_FONT_NAME);+		tn = names.get_name (NameTable.FULL_FONT_NAME); 		fd.add_littleendian_u16 ((uint16) (2 * tn.char_count ())); // strlen of family name 		fd.add_str_littleendian_utf16 (tn); 		diff --git a/libbirdfont/ExportTool.vala b/libbirdfont/ExportTool.valaindex 5edf714..615feab 100644--- a/libbirdfont/ExportTool.vala+++ b/libbirdfont/ExportTool.vala@@ -18,11 +18,7 @@ namespace Supplement {  public class ExportTool : Tool {-	private static string? prefered_browser = null; 	private static ExportThread export_thread;-	-	private static unowned Thread<void*> export_thread_handle;- 	private static bool stop_export_thread = false;  	public ExportTool (string n) {@@ -118,7 +114,6 @@ public class ExportTool : Tool { 	 	public static void export_current_glyph () { 		Glyph glyph = MainWindow.get_current_glyph ();-		Font font = Supplement.get_current_font (); 		FontDisplay fd = MainWindow.get_current_display (); 		string glyph_svg; 		string? f;@@ -440,25 +435,20 @@ os.put_string (  			export_thread = new ExportThread (temp_file, (!) ttf_file.get_path (), (!) eot_file.get_path ()); -			try {-				if (async) {-					export_command = @"$(get_birdfont_export ()) --ttf -o $((!) folder.get_path ()) $temp_file";-					-					try {-						Process.spawn_command_line_async (export_command);-					} catch (Error e) {-						stderr.printf (@"Failed to execute \"$export_command\" \n");-						critical (@"$(e.message)");-					}-				}+			if (async) {+				export_command = @"$(get_birdfont_export ()) --ttf -o $((!) folder.get_path ()) $temp_file"; 				-				if (!async) {-					export_thread.run ();+				try {+					Process.spawn_command_line_async (export_command);+				} catch (Error e) {+					stderr.printf (@"Failed to execute \"$export_command\" \n");+					critical (@"$(e.message)"); 				}-			} catch (ThreadError e) {-				warning (e.message);-				done = false;-			}	+			}+			+			if (!async) {+				export_thread.run ();+			} 			 		} catch (Error e) { 			critical (@"$(e.message)");@@ -509,10 +499,10 @@ os.put_string ( 		private static string ttf; 		private static string eot; -		public ExportThread (string ffi, string ttf, string eot) {-			this.ffi = ffi.dup ();-			this.ttf = ttf.dup ();-			this.eot = eot.dup ();+		public ExportThread (string nffi, string nttf, string neot) {+			ffi = nffi.dup ();+			ttf = nttf.dup ();+			eot = neot.dup (); 		} 		 		public void* run () {diff --git a/libbirdfont/Font.vala b/libbirdfont/Font.valaindex 282674a..2392372 100644--- a/libbirdfont/Font.vala+++ b/libbirdfont/Font.vala@@ -617,10 +617,6 @@ public class Font : GLib.Object { 			stderr.printf (@"Failed to save $path \n"); 			stderr.printf (@"$(e.message) \n"); 			return false;-		} catch (GLib.IOError e) {-			stderr.printf (@"Failed to save $path \n");-			stderr.printf (@"$(e.message) \n");-			return false; 		} 		 		return true;@@ -1243,8 +1239,6 @@ public class Font : GLib.Object { 		double x = 0; 		double y = 0; 		-		PointType type = PointType.LINE;-		 		double angle_right = 0; 		double angle_left = 0; 		@@ -1298,10 +1292,19 @@ public class Font : GLib.Object { 	 	public bool restore_backup () { 		string? b = present_backup_file ();+		bool r = false;+		+		if (b == null) {+			return false;+		} 		-		if (b == null) return false;+		try {+			r = parse_file ((!)b);+		} catch (GLib.Error e) {+			warning (e.message);+		} 		-		return parse_file ((!)b);+		return r; 	} 	 	private string? present_backup_file () {diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 2440a0b..244ad2e 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -689,23 +689,23 @@ public class Glyph : FontDisplay { 	public static double path_coordinate_x (double x) { 		Glyph g = MainWindow.get_current_glyph (); 		return_if_fail (g.view_zoom != 0);-		return x * g.ivz () - g.xc () + g.view_offset_x;+		return x * ivz () - xc () + g.view_offset_x; 	}  	public static int reverse_path_coordinate_x (double x) { 		Glyph g = MainWindow.get_current_glyph (); 		return_if_fail (g.view_zoom != 0);-		return (int) ((x - g.view_offset_x + g.xc ()) * g.view_zoom);+		return (int) ((x - g.view_offset_x + xc ()) * g.view_zoom); 	}  	public static double path_coordinate_y (double y) { 		Glyph g = MainWindow.get_current_glyph ();-		return g.yc () - y * g.ivz () - g.view_offset_y;+		return yc () - y * ivz () - g.view_offset_y; 	}  	public static int reverse_path_coordinate_y (double y) { 		Glyph g = MainWindow.get_current_glyph ();-		y = ((y + g.view_offset_y - g.yc ()) * g.view_zoom);+		y = ((y + g.view_offset_y - yc ()) * g.view_zoom); 		return (int) (-y); 	} @@ -1458,7 +1458,6 @@ public class Glyph : FontDisplay { 	}  	public void reload () {-		Glyph g; 		Font f = Supplement.get_current_font (); 		 		if (f.has_glyph (name)) {diff --git a/libbirdfont/GridTool.vala b/libbirdfont/GridTool.valaindex e2dc97c..12a1bf8 100644--- a/libbirdfont/GridTool.vala+++ b/libbirdfont/GridTool.vala@@ -214,7 +214,7 @@ class GridTool : Tool { 		 		pp = ep.get_prev ().data; 		-		ep.to_coordinate (ref tx, ref ty);+		EditPoint.to_coordinate (ref tx, ref ty); 		 		a = fabs (tx - pp.x); 		b = fabs (ty - pp.y);diff --git a/libbirdfont/IOThread.vala b/libbirdfont/IOThread.valadeleted file mode 100644index 9869591..0000000--- a/libbirdfont/IOThread.vala+++ /dev/null@@ -1,32 +0,0 @@-/*-    Copyright (C) 2012 Johan Mattsson--    This program is free software: you can redistribute it and/or modify-    it under the terms of the GNU General Public License as published by-    the Free Software Foundation, either version 3 of the License, or-    (at your option) any later version.--    This program is distributed in the hope that it will be useful,-    but WITHOUT ANY WARRANTY; without even the implied warranty of-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the-    GNU General Public License for more details.--    You should have received a copy of the GNU General Public License-    along with this program.  If not, see <http://www.gnu.org/licenses/>.-*/--namespace Supplement {--class IOThread {--	public static void add (ThreadFunc<weak void*> func) {-		try {-			unowned Thread<void*> thread = Thread.create<void*> (func, false);-		} catch (Error e) {-			warning (@"e.message");-		}-	}-	-}--}diff --git a/libbirdfont/ImportSvg.vala b/libbirdfont/ImportSvg.valaindex dd37bea..87a908a 100644--- a/libbirdfont/ImportSvg.vala+++ b/libbirdfont/ImportSvg.vala@@ -87,9 +87,6 @@ public class ImportSvg { 	} 	 	private static void parse_layer (Xml.Node* node) {-		string attr_name = "";-		string attr_content;-		 		return_if_fail (node != null); 				 		for (Xml.Node* iter = node->children; iter != null; iter = iter->next) {@@ -115,7 +112,6 @@ public class ImportSvg { 	 	private static void parse_svg_data (string d) { 		string[] c;-		string[] cp; 		string[] command; 		int ci = 0; 		double px = 0;@@ -342,9 +338,6 @@ public class ImportSvg { 	static bool is_point (string s) { 		return double.try_parse (s); 	}-	-	static void parse_c (string[] data, int index, Path p, double posx, double posy) {-	} }  }diff --git a/libbirdfont/IntersectionList.vala b/libbirdfont/IntersectionList.valaindex aad5713..19eaed7 100644--- a/libbirdfont/IntersectionList.vala+++ b/libbirdfont/IntersectionList.vala@@ -59,21 +59,7 @@ class IntersectionList { 			points.append (i); 		} 	}-	-	public void clear () {-		while (points.length () > 0) {-			points.remove_link (points.first ());-		}-	}-	-	public void remove_point (EditPoint e) {-		foreach (Intersection n in points) {-			if (n.editpoint_a == e || n.editpoint_b == e) {-				points.remove_all (n);-			}-		}	-	}-	+		 	public bool has_edit_point (EditPoint e) { 		foreach (Intersection n in points) { 			if (n.editpoint_a == e || n.editpoint_b == e) {@@ -97,31 +83,6 @@ class IntersectionList { 		 		return false; 	}-		-	public int get_point_index (EditPoint e) {-		int i = 0;-		foreach (Intersection n in points) {-			if (e.x == n.x && e.y == n.y) {-				return i;-			}-			i++;-		}-		return -1;-	}-	-	public Intersection? get_next_intersection (EditPoint e) {-		bool found = false;-		foreach (Intersection n in points) {-			if (found) {-				return n;-			}-			-			if (n.editpoint_a == e || n.editpoint_b == e) {-				found = true;-			}-		}-		return null;-	} 	 	public Intersection? get_intersection (EditPoint e) { 		Intersection? p = null;@@ -206,31 +167,6 @@ class IntersectionList {  		return il; 	}-	-	/** return true if ranges does overlap */-	bool has_intersection (double a0, double a1, double b0, double b1) {-		if (a0 <= b0 <= a1 || a1 <= b0 <= a0) {-			if (a0 <= b1 <= a1 || a1 <= b1 <= a0) {-				return true;-			}-			-			if (b0 <= a1 <= b1 || b1 <= a1 <= b0) {-				return true;-			}-		}-		-		if (b0 <= a0 <= b1 || b1 <= a0 <= b0) {-			if (a0 <= a0 <= a1 || a1 <= a0 <= a0) {-				return true;-			}-			-			if (b0 <= a0 <= b1 || b1 <= a0 <= b0) {-				return true;-			}-		}-		-		return false;-	} }  }diff --git a/libbirdfont/Line.vala b/libbirdfont/Line.valaindex d5adc9f..a1a5531 100644--- a/libbirdfont/Line.vala+++ b/libbirdfont/Line.vala@@ -120,10 +120,10 @@ public class Line : GLib.Object { 		Glyph g = MainWindow.get_current_glyph (); 		 		if (vertical) {-			p = g.reverse_path_coordinate_x (pos);+			p = Glyph.reverse_path_coordinate_x (pos); 			queue_draw_area ((int)p - 10, 0, 200, g.allocation.height); 		} else {-			p = g.reverse_path_coordinate_y (pos);+			p = Glyph.reverse_path_coordinate_y (pos); 			queue_draw_area (0, (int)p - 10, g.allocation.width, 300); 		} 	}	diff --git a/libbirdfont/MainWindow.vala b/libbirdfont/MainWindow.valaindex db86fdf..9e80b14 100644--- a/libbirdfont/MainWindow.vala+++ b/libbirdfont/MainWindow.vala@@ -44,14 +44,6 @@ public class MainWindow { 	public void set_native (NativeWindow nw) {
 		native_window = nw;
 	}
-
-	internal static NativeWindow get_native () {
-		return native_window;
-	}
-	
-	internal static MainWindow get_current_window () {
-		return singleton;
-	}
 	 
 	public static FontDisplay get_current_display () {
 		return get_glyph_canvas ().get_current_display ();
@@ -71,19 +63,19 @@ public class MainWindow { 	}
 	
 	public static Toolbox get_toolbox () {
-		return get_singleton ().tools;
+		return tools;
 	}
 	
 	internal static Tool get_tool (string n) {
-		return get_singleton ().tools.get_tool (n);
+		return tools.get_tool (n);
 	}
 	
 	public static TabBar get_tab_bar () {
-		return get_singleton ().tabs;
+		return tabs;
 	}
 
 	internal static Tab get_current_tab () {
-		return get_singleton ().tabs.get_selected_tab ();
+		return tabs.get_selected_tab ();
 	}
 
 	internal static TooltipArea get_tool_tip () {
@@ -91,7 +83,7 @@ public class MainWindow { 	}
 
 	internal static bool select_tab (Tab t) {
-		return get_singleton ().tabs.selected_open_tab (t);
+		return tabs.selected_open_tab (t);
 	}
 
 	internal static OverView get_overview () {
@@ -110,11 +102,11 @@ public class MainWindow { 	}
 	
 	internal static MenuTab get_content_display () {
-		if (unlikely ((MenuTab?) get_singleton ().menu_tab == null)) {
+		if (unlikely ((MenuTab?) menu_tab == null)) {
 			warning ("MenuTab not instantiated.");
 		}
 		
-		return get_singleton ().menu_tab;
+		return menu_tab;
 	}
 	
 	public static MainWindow get_singleton () {
@@ -122,7 +114,7 @@ public class MainWindow { 	}
 	
 	public static string? file_chooser (string title) {
-		return get_singleton ().native_window.file_chooser (title);
+		return MainWindow.native_window.file_chooser (title);
 	}
 	
 	public void set_title (string title) {
diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex ace3b37..c4d5fad 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -220,12 +220,10 @@ c.append (""" 	} 	 	private static void select_overview () {-		Toolbox tb = MainWindow.get_toolbox ();-		 		if (Supplement.get_current_font ().is_empty ()) {-			tb.select_tool_by_name ("custom_character_set");+			Toolbox.select_tool_by_name ("custom_character_set"); 		} else {-			tb.select_tool_by_name ("available_characters");	+			Toolbox.select_tool_by_name ("available_characters");	 		} 	} diff --git a/libbirdfont/MergeTool.vala b/libbirdfont/MergeTool.valaindex 030d9bb..4fd2642 100644--- a/libbirdfont/MergeTool.vala+++ b/libbirdfont/MergeTool.vala@@ -39,10 +39,10 @@ class MergeTool : Tool { 	private void test_merge_simple_path_box () { 		Tool pen_tool = MainWindow.get_toolbox ().get_tool ("pen_tool"); -		this.yield ();+		Tool.yield (); 		MainWindow.get_tab_bar ().select_overview (); -		this.yield ();+		Tool.yield (); 		MainWindow.get_overview ().open_current_glyph (); 		 		pen_tool.test_select_action ();@@ -102,10 +102,10 @@ class MergeTool : Tool { 	private void test_merge_simple_path_box_and_triangle () { 		Tool pen_tool = MainWindow.get_toolbox ().get_tool ("pen_tool"); -		this.yield ();+		Tool.yield (); 		MainWindow.get_tab_bar ().select_overview (); -		this.yield ();+		Tool.yield (); 		MainWindow.get_overview ().open_current_glyph (); 		 		pen_tool.test_select_action ();@@ -158,10 +158,10 @@ class MergeTool : Tool { 	private void test_merge_second_triangle () { 		Tool pen_tool = MainWindow.get_toolbox ().get_tool ("pen_tool"); -		this.yield ();+		Tool.yield (); 		MainWindow.get_tab_bar ().select_overview (); -		this.yield ();+		Tool.yield (); 		MainWindow.get_overview ().open_current_glyph (); 		 		pen_tool.test_select_action ();@@ -213,18 +213,16 @@ class MergeTool : Tool { 	} 	 	private void add_point_on_path (Path p, int x, int y) {-		Glyph g = MainWindow.get_current_glyph ();-		p.add (g.path_coordinate_x (x), g.path_coordinate_y (y));+		p.add (Glyph.path_coordinate_x (x), Glyph.path_coordinate_y (y)); 	} 	-	 	private void test_merge_odd_paths () { 		Tool pen_tool = MainWindow.get_toolbox ().get_tool ("pen_tool"); -		this.yield ();+		Tool.yield (); 		MainWindow.get_tab_bar ().select_overview (); -		this.yield ();+		Tool.yield (); 		MainWindow.get_overview ().open_current_glyph (); 		 		pen_tool.test_select_action ();@@ -262,7 +260,7 @@ class MergeTool : Tool { 		pen_tool.test_click_action (1, 203, 260);  		pen_tool.test_click_action (3, 203, 260);  -		this.yield ();+		Tool.yield (); 		 		test_select_action (); 	}	diff --git a/libbirdfont/MoveTool.vala b/libbirdfont/MoveTool.valaindex 6dc3d4a..2ccadc9 100644--- a/libbirdfont/MoveTool.vala+++ b/libbirdfont/MoveTool.vala@@ -102,7 +102,7 @@ class MoveTool : Tool { 			 			if (move_path) { 				foreach (Path path in glyph.active_paths) {-					path.move (glyph.ivz () * -dx * p, glyph.ivz () * dy * p);+					path.move (Glyph.ivz () * -dx * p, Glyph.ivz () * dy * p); 				} 			} 			diff --git a/libbirdfont/NativeWindow.vala b/libbirdfont/NativeWindow.valaindex 3086e1e..aafe949 100644--- a/libbirdfont/NativeWindow.vala+++ b/libbirdfont/NativeWindow.vala@@ -26,7 +26,7 @@ public interface NativeWindow : GLib.Object { 	 	public abstract void update_window_size (); -	public abstract string get_clipboard ();+	public abstract string get_clipboard_data (); 	public abstract void set_clipboard (string data); 	public abstract void set_inkscape_clipboard (string data); diff --git a/libbirdfont/OpenFontFormatWriter.vala b/libbirdfont/OpenFontFormatWriter.valaindex 71e2350..4864560 100644--- a/libbirdfont/OpenFontFormatWriter.vala+++ b/libbirdfont/OpenFontFormatWriter.vala@@ -47,14 +47,14 @@ class OpenFontFormatWriter : Object  { 		os = new DataOutputStream(file.create (FileCreateFlags.REPLACE_DESTINATION));
 	}
 	
-	public void write_ttf_font (Font font) throws Error {
+	public void write_ttf_font (Font nfont) throws Error {
 		long dl;
 		uint8* data;
 		unowned List<Table> tables;
 		FontData fd;
 		uint l;
 		
-		this.font = font;
+		font = nfont;
 				
 		directory_table.process ();	
 		tables = directory_table.get_tables ();
@@ -152,14 +152,6 @@ class FontData : Object { 		table_data[pos]= new_data;
 	}
 	
-	public void write_table_data (FontData fd, uint32 offset, uint32 length) {
-		fd.seek (offset);
-		for (uint32 i = 0; i < length; i++) {
-			add (table_data [rp++]);
-		}
-		fd.seek (0);
-	}
-	
 	public void write_table (OtfInputStream dis, uint32 offset, uint32 length) throws Error {
 		uint32 l = length + (length % 4);  // padding after end of table
 		uint8 b;
@@ -311,22 +303,10 @@ class FontData : Object { 		return (char) read_byte ();
 	}
 	
-	public void add_udate (int64 d) throws Error {
-		add_64 (d);
-	}
-	
 	public void add_fixed (Fixed f) throws Error {
 		add_u32 (f);
 	}
 
-	public void add_fword (int16 word) {
-		add_16 (word);
-	}
-
-	public void add_f2dot14 (F2Dot14 f) throws Error {
-		add_u32 (f);
-	}
-
 	public void add_short (int16 d) throws Error {
 		add_16 (d);
 	}
@@ -399,20 +379,6 @@ class FontData : Object { 		add_u16 ((uint16) (i - (s << 16)));
 	}
 
-	public void add_32 (int32 i) {
-		int32 s = (int16) (i >> 16);
-		
-		add_16 ((int16) s);
-		add_16 ((int16) (i - (s << 16)));
-	}
-	
-	public void add_u64(uint64 i) {
-		uint64 s = (uint32) (i >> 32);
-		
-		add_u32 ((uint32) s);
-		add_u32 ((uint32)(i - (s << 32)));		
-	}
-
 	public void add_64(int64 i) {
 		int64 s = (int32) (i >> 32);
 		
@@ -857,8 +823,7 @@ class GlyfTable : Table { 		double xmin, xmax;
 		double units_per_em = head_table.get_units_per_em ();
 		unichar character = 0;
-		string name;	
-		uint32 end;
+		string name;
 		
 		character = cmap_table.get_char (index);
 		name = post_table.get_name (index);
@@ -905,7 +870,7 @@ class GlyfTable : Table { 		uint16 glyph_index;
 		int16 arg1 = 0;
 		int16 arg2 = 0;
-		uint16 arg1and2;
+
 		F2Dot14 scale;
 		
 		F2Dot14 scalex;
@@ -989,7 +954,6 @@ class GlyfTable : Table { 	}
 	
 	Glyph parse_next_glyf (FontData dis, unichar character, int gid, out double xmin, out double xmax, double units_per_em) throws Error {
-
 		uint16* end_points = null;
 		uint8* instructions = null;
 		uint8* flags = null;
@@ -1019,6 +983,9 @@ class GlyfTable : Table { 		StringBuilder name = new StringBuilder ();
 		name.append_unichar (character);
 
+		xmin = 0;
+		xmax = 0;
+
 		start = loca_table.get_offset (gid);
 		end = loca_table.get_offset (gid + 1);
 		len = start - end;
@@ -1841,16 +1808,6 @@ class CmapSubtableWindowsUnicode : CmapSubtable { 		// assert (validate_subtable ());
 	}
 	
-	void print_range (unichar start_char, unichar end_char, uint16 delta_offset, uint16 range_offset) {
-		StringBuilder s = new StringBuilder ();
-		StringBuilder e = new StringBuilder ();
-		
-		s.append_unichar (start_char);
-		e.append_unichar (end_char);
-		
-		print (@"New range $(s.str) - $(e.str) delta: $delta_offset, range: $range_offset\n");
-	}
-	
 	public void process (FontData fd, GlyfTable glyf_table) throws GLib.Error {
 		GlyphRange glyph_range = new GlyphRange ();
 		unowned List<UniRange> ranges;
@@ -1998,10 +1955,6 @@ class CmapTable : Table { 		id = "cmap";
 	}
 	
-	public uint32 get_length () {
-		return get_prefered_table ().get_length ();
-	}
-	
 	public unichar get_char (uint32 i) {
 		return get_prefered_table ().get_char (i) ;
 	}
diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex e8915c2..0a52435 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -91,9 +91,6 @@ public class OverView : FontDisplay { 		 		scrollbar = new Scrollbar (); 		scrollbar.signal_scroll.connect ((delta, delta_last, absolute) => {-			int64 adjustement = (int64) (-delta_last * get_height ());-			int64 pixels = (int64) (-5.0 * delta_last * nail_height);-			 			if (absolute <= 0.002) { 				first_character = 0; 				first_visible = 0;@@ -1018,7 +1015,7 @@ public class OverView : FontDisplay { 		}  		if (unlikely (!done)) {-			MainWindow.get_toolbox ().select_tool_by_name ("custom_character_set");+			Toolbox.select_tool_by_name ("custom_character_set"); 			warning (@"No glyph \"$c\"\n"); 			return; 		}diff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 0620816..b317f9d 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -47,8 +47,6 @@ public class Path {  	public delegate bool RasterIterator (double x, double y, double step); // iterate over each pixel at a given zoom level 	-	bool selected = false;-	 	private static ImageSurface? edit_point_image = null; 	private static ImageSurface? active_edit_point_image = null; 	@@ -353,20 +351,6 @@ public class Path { 		} 		return false; 	}--	private EditPoint? get_edit_point_at (double x, double y) {-		foreach (var p in points) {-			if (p.x == x && p.y == y) return p;-		}-				-		return null;-	}-		-	private void remove_all_edit_points () {-		while (points.length () > 0) {-			points.remove_link (points.first ());-		}-	} 	 	/** Replace edit points in this path with @param new_path.points. */ 	public void replace_path (Path new_path) {@@ -381,24 +365,6 @@ public class Path { 		close (); 	} 	-	/** Returns true if this path can be merged with @param union */ -	private bool is_valid_union (Path union) {-		if (union == this) {-			warning ("Path can't union with it self.");-			return false;-		}-		-		if (union.points.length () <= 2 || points.length () <= 2) {-			return false;-		}--		if (!has_overlapping_boundry (union)) {-			return false;-		}--		return true;-	}-	 	/** Set direction for this path to clockwise for outline and  	 * counter clockwise for inline paths. 	 */@@ -458,48 +424,6 @@ public class Path { 		} 	} 	-	private bool validate_list () {-		unowned List<EditPoint> ep = points.first ();-		-		if (points.length () < 3) {-			warning ("points.length () < 3");-		}-		-		if (!is_open ()) {-			for (int i = 0; i < points.length (); i++) {-				if (ep.data.next == null) {-					return false;-				}--				if (ep.data.prev == null) {-					return false;-				}-								-				ep = (!) ep.data.next;-			}-		}--		if (is_open ()) {-			for (int i = 1; i < points.length () - 1; i++) {-				if (ep.data.next == null) {-					return false;-				}--				if (ep.data.prev == null) {-					return false;-				}-								-				ep = (!) ep.data.next;-			}-			-			if (ep.data.next != null) {-				return false;-			}-		}-		-		return true;-	}-	 	private double clockwise_sum () { 		return_if_fail (points.length () >= 3); 		@@ -684,21 +608,6 @@ public class Path { 		return Math.fabs (Math.sqrt (Math.pow (ax - bx, 2) + Math.pow (ay - by, 2))); 	} 	-	/** Estimate length of path. */-	private double get_length () {-		double len = 0;-		-		return_if_fail (points.length () > 2);-		-		EditPoint prev = points.last ().data;-		foreach (EditPoint p in points) {-			len += get_length_from (prev, p);-			prev = p;-		}-		-		return len;-	}-	 	private static double get_length_from (EditPoint a, EditPoint b) { 		double x, y; 		@@ -1179,22 +1088,6 @@ public class Path { 		return false; 	} -	double distance_to_path (EditPoint start, EditPoint stop, double x, double y) {-		double min = double.MAX;-		-		all_of (start, stop, (cx, cy, t) => {-			double n = pow (x - cx, 2) + pow (y - cy, 2);-			-			if (n < min) {-				min = n;-			}-			-			return true;-		});-		-		return min;-	}- 	public void insert_new_point_on_path (EditPoint? epp) { 		EditPoint start, stop; 		double x0, x1, y0, y1;diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex 6e50cbd..46da7b4 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -115,10 +115,6 @@ class PenTool : Tool { 		}); 	} 	-	public double get_precision () {-		return precision;-	}-	 	public void set_precision (double p) { 		precision = p; 		MainWindow.get_toolbox ().precision.set_value_round (p, false, false);@@ -408,11 +404,6 @@ class PenTool : Tool { 		} 	} -	public static bool insert_new_point_on_path_selected () {-		Tool t = MainWindow.get_toolbox ().get_tool ("insert_point_on_path");-		return t.is_selected ();-	}- 	public static bool is_new_point_from_path_selected () { 		if (!Supplement.experimental) { 			return false;@@ -421,11 +412,6 @@ class PenTool : Tool { 		Tool t = MainWindow.get_toolbox ().get_tool ("new_point_on_path"); 		return t.is_selected (); 	}--	public static bool is_erase_selected () {-		Tool t = MainWindow.get_toolbox ().get_tool ("erase_tool");-		return t.is_selected ();-	} 	 	public void new_point_action (int x, int y) { 		Glyph glyph;@@ -445,14 +431,6 @@ class PenTool : Tool { 		move_selected = true; 	} -	void set_linear_handles_for_last_point () {-		Glyph glyph;-		glyph = MainWindow.get_current_glyph ();-		return_if_fail (glyph.active_paths.length () > 0);-		return_if_fail (glyph.active_paths.last ().data.points.length () > 0);-		glyph.active_paths.last ().data.points.last ().data.right_handle.parent.recalculate_linear_handles ();-	}- 	public static void set_default_handle_positions () { 		Glyph g = MainWindow.get_current_glyph (); 		foreach (var p in g.path_list) {@@ -472,7 +450,8 @@ class PenTool : Tool { 	bool new_point_on_path_at (int x, int y) { 		EditPoint ep; 		Glyph glyph = MainWindow.get_current_glyph ();-		+		int px, py;+						 		if (is_new_point_from_path_selected ()) { 			 			if (glyph.new_point_on_path != null) {@@ -480,10 +459,12 @@ class PenTool : Tool { 				 				begin_new_point_on_path = false; 				-				glyph.add_new_edit_point (glyph.reverse_path_coordinate_x (ep.x), glyph.reverse_path_coordinate_x (ep.y));+				px = Glyph.reverse_path_coordinate_x (ep.x);+				py = Glyph.reverse_path_coordinate_x (ep.y);+				glyph.add_new_edit_point (px, py); 				glyph.new_point_on_path = null; 				-				MainWindow.get_toolbox ().select_tool_by_name ("new_point");+				Toolbox.select_tool_by_name ("new_point");  				return false; 			}@@ -660,7 +641,7 @@ class PenTool : Tool { 		// merge it 		 		-		this.yield ();+		Tool.yield (); 		 		return true; 	}@@ -714,11 +695,11 @@ class PenTool : Tool { 		x = 10; 		y = 15; 		-		px = g.path_coordinate_x (x);-		py = g.path_coordinate_y (y);+		px = Glyph.path_coordinate_x (x);+		py = Glyph.path_coordinate_y (y); -		mx = x * g.ivz () - g.xc () + g.view_offset_x;-		my = g.yc () - y * g.ivz () - g.view_offset_y;+		mx = x * Glyph.ivz () - Glyph.xc () + g.view_offset_x;+		my = Glyph.yc () - y * Glyph.ivz () - g.view_offset_y; 		 		if (mx != px || my != py) { 			warning (@"bad coordinate $mx != $px || $my != $py");@@ -731,8 +712,8 @@ class PenTool : Tool { 		n = "Offset no zoom"; 		g.reset_zoom (); 		-		px = g.path_coordinate_x (x);-		py = g.path_coordinate_y (y);+		px = Glyph.path_coordinate_x (x);+		py = Glyph.path_coordinate_y (y); 		 		test_reverse_coordinate (x, y, px, py, n); 		test_click_action (1, x, y);@@ -741,26 +722,11 @@ class PenTool : Tool { 		test_click_action (3, x, y); 	} 	-	private void test_coordinate (double x, double y, double px, double py, string n) {-		if (!(px - 0.5 <= x <= px + 0.5|| py - 0.5 <= y <= py + 0.5)) {-			warning (@"Expecting (x == px || y == py) got ($x == $px || $y == $py) in \"$n\"\n");-		}-	}-	 	private void test_reverse_coordinate (int x, int y, double px, double py, string n) {-		Glyph g = MainWindow.get_current_glyph ();-		if (x != g.reverse_path_coordinate_x (px) || g.reverse_path_coordinate_y (py) != y) {-			warning (@"Reverse coordinates does not match current point for test case \"$n\".\n $x != $(g.reverse_path_coordinate_x (px)) || $(g.reverse_path_coordinate_y (py)) != $y (x != g.reverse_path_coordinate_x (px) || g.reverse_path_coordinate_y (py) != y)");+		if (x != Glyph.reverse_path_coordinate_x (px) || Glyph.reverse_path_coordinate_y (py) != y) {+			warning (@"Reverse coordinates does not match current point for test case \"$n\".\n $x != $(Glyph.reverse_path_coordinate_x (px)) || $(Glyph.reverse_path_coordinate_y (py)) != $y (x != Glyph.reverse_path_coordinate_x (px) || Glyph.reverse_path_coordinate_y (py) != y)"); 		} 	}--	private void test_last_is_counter_clockwise (string name) {-		bool d = ((!)MainWindow.get_current_glyph ().get_last_path ()).is_clockwise ();-		-		if (d) {-			critical (@"\nPath $name is clockwise, in test_last_is_counter_clockwise");-		}		-	} 	 	private void test_last_is_clockwise (string name) { 		bool d = ((!)MainWindow.get_current_glyph ().get_last_path ()).is_clockwise ();@@ -786,7 +752,7 @@ class PenTool : Tool { 			return false; 		} -		this.yield ();+		Tool.yield (); 		return true; 	} 	@@ -809,10 +775,10 @@ class PenTool : Tool { 	private void test_triangle (Point a, Point b, Point c, string name = "") { 		Tool pen_tool = MainWindow.get_toolbox ().get_tool ("pen_tool"); 		-		this.yield ();+		Tool.yield (); 		MainWindow.get_tab_bar ().select_overview (); -		this.yield ();+		Tool.yield (); 		MainWindow.get_overview ().open_current_glyph (); 		 		pen_tool.test_select_action ();@@ -826,7 +792,7 @@ class PenTool : Tool { 		 		test_reverse_last (@"Triangle reverse \"$name\" ($(a.x), $(a.y)), ($(b.x), $(b.y)), ($(c.x), $(c.y)) failed."); 		-		this.yield ();+		Tool.yield (); 	} 	 	private void test_various_triangles () {@@ -840,10 +806,10 @@ class PenTool : Tool { 		// open a new glyph 		Tool pen_tool = MainWindow.get_toolbox ().get_tool ("pen_tool"); -		this.yield ();+		Tool.yield (); 		MainWindow.get_tab_bar ().select_overview (); -		this.yield ();+		Tool.yield (); 		MainWindow.get_overview ().open_current_glyph (); 		 		pen_tool.test_select_action ();@@ -961,7 +927,7 @@ class PenTool : Tool { 		pen = select_pen ();  		for (int i = 0; i < 30; i++) {-			this.yield ();+			Tool.yield (); 			 			ax = Random.int_range (0, 300); 			bx = Random.int_range (0, 300);diff --git a/libbirdfont/Preview.vala b/libbirdfont/Preview.valaindex 39f5da8..7217b98 100644--- a/libbirdfont/Preview.vala+++ b/libbirdfont/Preview.vala@@ -35,7 +35,7 @@ public class Preview : FontDisplay { 	public override void selected_canvas () { 	} -	public File get_html_file () {+	public new File get_html_file () { 		Font font = Supplement.get_current_font (); 		string path = @"$(font.get_name ()).html"; 		File dir = font.get_folder ();diff --git a/libbirdfont/ResizeTool.vala b/libbirdfont/ResizeTool.valaindex a63a312..cd50107 100644--- a/libbirdfont/ResizeTool.vala+++ b/libbirdfont/ResizeTool.vala@@ -203,7 +203,7 @@ class ResizeTool : Tool { 			resize_test_glyph (i); 		} -		this.yield ();+		Tool.yield (); 		 		return true; 	}@@ -211,7 +211,7 @@ class ResizeTool : Tool { 	private void resize_test_glyph (double ratio_percent) { 		test_select_action (); 		-		this.yield ();+		Tool.yield (); 		 		Glyph g = MainWindow.get_current_glyph (); 		Path? pn = g.get_last_path ();@@ -225,11 +225,10 @@ class ResizeTool : Tool { 	private void draw_test_glyph (int x_offset, int y_offset) { 		// open a new glyph 		Tool pen_tool = MainWindow.get_toolbox ().get_tool ("pen_tool");--		this.yield ();+		Tool.yield (); 		MainWindow.get_tab_bar ().select_overview (); -		this.yield ();+		Tool.yield (); 		MainWindow.get_overview ().open_current_glyph (); 		 		pen_tool.test_select_action ();diff --git a/libbirdfont/SaveDialog.vala b/libbirdfont/SaveDialog.valaindex 2a8ac81..ea13f26 100644--- a/libbirdfont/SaveDialog.vala+++ b/libbirdfont/SaveDialog.vala@@ -64,7 +64,11 @@ public class SaveDialog : FontDisplay { 		if (fn == "") { 			fn = f.get_name () + ".ffi"; 		}-				++		// FIXME:+		// tell xgettext to extract this:+		_("Save?");+					 		return """ <html> <head>@@ -88,10 +92,6 @@ public class SaveDialog : FontDisplay { 	</div> </body> </html>""";--		// FIXME:-		// tell xgettext to extract this:-		_("Save?"); 	} } 	diff --git a/libbirdfont/ShrinkTool.vala b/libbirdfont/ShrinkTool.valadeleted file mode 100644index cea88be..0000000--- a/libbirdfont/ShrinkTool.vala+++ /dev/null@@ -1,113 +0,0 @@-/*-    Copyright (C) 2012 Johan Mattsson--    This program is free software: you can redistribute it and/or modify-    it under the terms of the GNU General Public License as published by-    the Free Software Foundation, either version 3 of the License, or-    (at your option) any later version.--    This program is distributed in the hope that it will be useful,-    but WITHOUT ANY WARRANTY; without even the implied warranty of-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the-    GNU General Public License for more details.--    You should have received a copy of the GNU General Public License-    along with this program.  If not, see <http://www.gnu.org/licenses/>.-*/--namespace Supplement {--// TODO contrast--class ShrinkTool : Tool {--	public ShrinkTool (string n) {-		base (n, "shrink path");--		select_action.connect((self) => {-			Glyph g = MainWindow.get_current_glyph ();-		-			foreach (Path p in g.path_list) {-				shrink_copy (p, 0.25);-			}-			-			MainWindow.get_glyph_canvas ().redraw ();-		});--		select_action.connect((self) => {-		});-			-		press_action.connect((self, b, x, y) => {-		});--		move_action.connect((self, x, y) => {-		});-	}-	-	public static int path_index (Path p) {-		Glyph g = MainWindow.get_current_glyph ();-		int i = 0;-		-		foreach (Path pt in g.path_list) {-			if (p == pt) {-				return i;-			}-			i++;-		}-		-		return -1;-	}-	-	public static void shrink_copy (Path px, double step) {		-		Path p = px.copy ();-		shrink (px, step);-		p.set_editable (true);-	}	-	-	public static void shrink (Path p, double step) {		-		if (p.points.length () < 3) return;--		p.create_list ();-		-		EditPoint ep;--		p.create_list ();--		foreach (EditPoint pep in p.points) {-			unowned List<EditPoint>? lep = pep.get_next ();-			-			if (unlikely (lep == null)) {-				warning ("Bad list.");-				stderr.printf (@"No links in path $(path_index (p)). Length: $(p.points.length ())\n");-				p.print_boundries ();-				continue;-			}-			-			ep = ((!)lep).data;-			move_point (p, pep, ep, step);-		}-		-		move_point (p, p.points.last ().data, p.points.first ().data, step);-		-		p.set_editable (true);-	}-	-	static void move_point (Path p, EditPoint pep, EditPoint ep, double step) {	-		double istep = 1 - step;-		-		double mx = ep.get_right_handle ().x () / 2 + ep.get_left_handle ().x () / 2;-		double my = ep.get_right_handle ().y () / 2 + ep.get_left_handle ().y () / 2;-			-		ep.x = mx * step + ep.x * istep;-		ep.y = my * step + ep.y * istep;--	}-	-	public override bool test () {-		test_select_action ();-		return true;-	}--}-	-}diff --git a/libbirdfont/Supplement.vala b/libbirdfont/Supplement.valaindex 74275b6..e3fd5a4 100644--- a/libbirdfont/Supplement.vala+++ b/libbirdfont/Supplement.vala@@ -37,7 +37,6 @@ public class Supplement { 		int err_arg;
 		int i;
 		File font_file;
-		IdleSource idle;
 		string exec_path;
 
 		stdout.printf ("birdfont version %s\n", VERSION);
@@ -59,8 +58,7 @@ public class Supplement { 			Process.exit (0);
 		}
 
-		Preferences preferences = new Preferences ();
-		preferences.load ();
+		Preferences.load ();
 		
 		current_font = new Font ();
 		current_glyph = new Glyph ("");
@@ -98,7 +96,7 @@ public class Supplement { 			Log.set_handler (null, levels, fatal_warning);
 		}
 		
-		preferences.set_last_file (get_current_font ().get_path ());
+		Preferences.set_last_file (get_current_font ().get_path ());
 	}
 
 	static void init_gettext () {
diff --git a/libbirdfont/TabBar.vala b/libbirdfont/TabBar.valaindex 0c329e7..02f700a 100644--- a/libbirdfont/TabBar.vala+++ b/libbirdfont/TabBar.vala@@ -72,17 +72,8 @@ public class TabBar : GLib.Object { 	} 	 	public void motion (double x, double y) {-		TooltipArea status = MainWindow.get_tool_tip (); 		is_over_close (x, y, out over, out over_close); 	}-	-	private bool is_over_next (double x) {-		return x > width - 19 && has_scroll ();-	}--	private bool is_over_previous (double x) {-		return x < 19  && has_scroll ();-	}  	private void is_over_close (double x, double y, out int over, out int over_close) { 		int i = 0;@@ -477,16 +468,12 @@ public class TabBar : GLib.Object { 		switch (s) { 			case "Overview": 				return _("Overview");-				break; 			case "Kerning": 				return _("Kerning");-				break; 			case "Menu": 				return _("Menu");-				break; 			default: 				return s;-				break; 		} 	} 	diff --git a/libbirdfont/Tool.vala b/libbirdfont/Tool.valaindex aeb9700..bf81e9d 100644--- a/libbirdfont/Tool.vala+++ b/libbirdfont/Tool.vala@@ -295,7 +295,7 @@ public class Tool : GLib.Object { 		OverView o = MainWindow.get_overview (); 		 		MainWindow.get_tab_bar ().select_overview ();-		MainWindow.get_toolbox ().select_tool_by_name ("utf_8");+		Toolbox.select_tool_by_name ("utf_8"); 		 		o.select_next_glyph (); 		Tool.yield ();diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex 0c8260e..8218068 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -23,8 +23,6 @@ namespace Supplement { public class Toolbox : GLib.Object  { 	GlyphCanvas glyph_canvas; 	-	bool expanded = true;-	 	ToolboxExpander toolbox_expander; 	 	public List<Expander> expanders;@@ -85,9 +83,6 @@ public class Toolbox : GLib.Object  { 		Tool move_tool = new MoveTool ("move"); 		draw_tools.add_tool (move_tool); -		Tool shrink_tool = new ShrinkTool ("shrink");-		// Fixa: draw_tools.add_tool (shrink_tool);	-		 		// Draw tool modifiers 		// DELETE tools: 		@@ -120,7 +115,7 @@ public class Toolbox : GLib.Object  { 			 			select_draw_tool (); 			-			foreach (EditPoint ep in pen_tool.selected_points) {+			foreach (EditPoint ep in PenTool.selected_points) { 				tie = !ep.tie_handles;  				if (tie) {@@ -137,7 +132,7 @@ public class Toolbox : GLib.Object  { 		Tool tie_x_or_y = new Tool ("tie_x_or_y", _("Tie coordinates to previous edit point"), 'q'); 		tie_x_or_y.select_action.connect((self) => { 			select_draw_tool ();-			pen_tool.tie_x_or_y_coordinates = !pen_tool.tie_x_or_y_coordinates;+			PenTool.tie_x_or_y_coordinates = !PenTool.tie_x_or_y_coordinates; 		}); 		// Fixa: draw_tool_modifiers.add_tool (tie_x_or_y);	 @@ -291,10 +286,10 @@ public class Toolbox : GLib.Object  { 		Tool help_lines = new Tool ("help_lines", "Show help lines", 'l'); 		help_lines.select_action.connect ((self) => { 				bool h;-				h = glyph_canvas.get_current_glyph ().get_show_help_lines ();-				glyph_canvas.get_current_glyph ().set_show_help_lines (!h);+				h = GlyphCanvas.get_current_glyph ().get_show_help_lines ();+				GlyphCanvas.get_current_glyph ().set_show_help_lines (!h); 				self.set_selected (!h);-				glyph_canvas.get_current_glyph ().redraw_help_lines ();+				GlyphCanvas.get_current_glyph ().redraw_help_lines (); 			});	  		guideline_tools.add_tool (help_lines);@@ -439,7 +434,7 @@ public class Toolbox : GLib.Object  { 			TooltipArea tp = MainWindow.get_tool_tip (); 			tp.show_text (_("Creating thumbnails")); 			-			bg_selection.yield ();+			Tool.yield (); 		 			if (fd is Glyph) { 				g = (Glyph) fd;@@ -595,7 +590,7 @@ public class Toolbox : GLib.Object  { 			pen_tool.set_selected (true); 			select_draw_tool ();			 			-			if (glyph_canvas.get_current_glyph ().get_show_help_lines ()) {+			if (GlyphCanvas.get_current_glyph ().get_show_help_lines ()) { 				help_lines.set_selected (true); 				help_lines.set_active (false); 			}diff --git a/libbirdfont/UserActions.vala b/libbirdfont/UserActions.valadeleted file mode 100644index d7946eb..0000000--- a/libbirdfont/UserActions.vala+++ /dev/null@@ -1,52 +0,0 @@-/*-    Copyright (C) 2012 Johan Mattsson--    This program is free software: you can redistribute it and/or modify-    it under the terms of the GNU General Public License as published by-    the Free Software Foundation, either version 3 of the License, or-    (at your option) any later version.--    This program is distributed in the hope that it will be useful,-    but WITHOUT ANY WARRANTY; without even the implied warranty of-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the-    GNU General Public License for more details.--    You should have received a copy of the GNU General Public License-    along with this program.  If not, see <http://www.gnu.org/licenses/>.-*/--namespace Supplement {--/** User interface action for unit testing and undo command.- */-interface UserActions {-	public abstract void do_action ();-	public abstract void undo ();-	public abstract void reundo ();-	public abstract void test ();-}--interface UserClickActions {-	public abstract void do_click (int button, int x, int y);-}--class NewPointAction : UserActions, UserClickActions {--	public void do_action () {-	}--	public void undo () {-	}-	-	public void reundo () {-	}-	-	public void do_click (int button, int x, int y) {-	}-	-	public void test () {-	}-	-}--}

Contact

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