Clone in a terminal:
Commit 89bb8b6
Johan Mattsson - 2013-09-13T17:50:08+00:00
89bb8b6ff05e49183f8e6bc95e0471faafb9bc0cjohan.mattsson.m@gmail.com

remove html canvas

Changed files (12)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex 3a0a648..1403aaf 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -91,11 +91,8 @@ public class GtkWindow : Gtk.Window, NativeWindow { 		html_canvas.set_editable (true); 		 		MainWindow.get_tab_bar ().signal_tab_selected.connect ((f, tab) => {-			File layout_dir;-			File layout_uri; 			string uri = ""; 			FontDisplay fd = tab.get_display ();-			bool html = fd.get_name () == "Preview"; 			MainWindow.glyph_canvas.set_current_glyph (fd); 			 			scrollbar.set_visible (fd.has_scrollbar ());@@ -105,86 +102,66 @@ public class GtkWindow : Gtk.Window, NativeWindow { 				description.canvas.set_visible (true); 				html_box.set_visible (false); 				glyph_canvas_area.set_visible (false);-			} else if (html) {-				layout_dir = FontDisplay.find_layout_dir ();-				uri = fd.get_uri ();-				-				if (uri == "") {-					layout_uri = layout_dir.get_child (fd.get_html_file ());-					uri = FontDisplay.path_to_uri ((!) layout_uri.get_path ());-				}-		-				if (fd.get_html () == "") {+			} else if (fd.get_name () == "Preview") {+				uri = Preview.get_uri ();++				// hack: force webkit to ignore cache in preview+				html_box.set_visible (false);+				glyph_canvas_area.set_visible (true);+										+				try {+					DataInputStream dis = new DataInputStream (Preview.get_html_file ().read ());+					string? line;+					StringBuilder sb = new StringBuilder ();+					uint rid = Random.next_int ();+					Font font = BirdFont.get_current_font (); 					-					if (fd.get_name () == "Preview") {-						// hack: force webkit to ignore cache in preview					--						html_box.set_visible (false);-						glyph_canvas_area.set_visible (true);-												-						try {-							Preview preview = (Preview) fd;-							DataInputStream dis = new DataInputStream (preview.get_html_file ().read ());-							string? line;-							StringBuilder sb = new StringBuilder ();-							uint rid = Random.next_int ();-							Font font = BirdFont.get_current_font ();-							-							File preview_directory = BirdFont.get_preview_directory ();-							-							File f_ttf = font.get_folder ().get_child (@"$(font.get_full_name ()).ttf");-							File f_eot = font.get_folder ().get_child (@"$(font.get_full_name ()).eot");-							File f_svg = font.get_folder ().get_child (@"$(font.get_full_name ()).svg");--							if (f_ttf.query_exists ()) {-								f_ttf.delete ();-							}-								-							if (f_eot.query_exists ()) {-								f_eot.delete ();-							}-							-							if (f_svg.query_exists ()) {-								f_svg.delete ();-							}-							-							ExportTool.export_ttf_font ();							-							ExportTool.export_svg_font ();-							-							File r_ttf = preview_directory.get_child (@"$(font.get_full_name ())$rid.ttf");-							File r_svg = preview_directory.get_child (@"$(font.get_full_name ())$rid.svg");-							-							if (BirdFont.win32) {-								f_ttf.copy (r_ttf, FileCopyFlags.NONE);-							}-							-							f_svg.copy (r_svg, FileCopyFlags.NONE);--							while ((line = dis.read_line (null)) != null) {-								line = ((!) line).replace (@"$(font.get_full_name ()).ttf", @"$(FontDisplay.path_to_uri ((!) f_ttf.get_path ()))?$rid");-								line = ((!) line).replace (@"$(font.get_full_name ()).eot", @"$(FontDisplay.path_to_uri ((!) f_eot.get_path ()))?$rid");-								line = ((!) line).replace (@"$(font.get_full_name ()).svg", @"$(FontDisplay.path_to_uri ((!) f_svg.get_path ()))?$rid");-								sb.append ((!) line);-							}+					File preview_directory = BirdFont.get_preview_directory (); 					-							html_canvas.load_html_string (sb.str, uri);-												-						} catch (Error e) {-							warning (e.message);-							warning ("Failed to load html into canvas.");-						}-					} else {-						// normal way to load a uri for all other pages-						html_canvas.load_uri (uri);-						html_canvas.reload_bypass_cache ();			+					File f_ttf = font.get_folder ().get_child (@"$(font.get_full_name ()).ttf");+					File f_eot = font.get_folder ().get_child (@"$(font.get_full_name ()).eot");+					File f_svg = font.get_folder ().get_child (@"$(font.get_full_name ()).svg");++					if (f_ttf.query_exists ()) {+						f_ttf.delete (); 					} 						-				} else {-					html_canvas.load_html_string (fd.get_html (), uri);+					if (f_eot.query_exists ()) {+						f_eot.delete ();+					}+					+					if (f_svg.query_exists ()) {+						f_svg.delete ();+					}+					+					ExportTool.export_ttf_font ();							+					ExportTool.export_svg_font ();+					+					File r_ttf = preview_directory.get_child (@"$(font.get_full_name ())$rid.ttf");+					File r_svg = preview_directory.get_child (@"$(font.get_full_name ())$rid.svg");+					+					if (BirdFont.win32) {+						f_ttf.copy (r_ttf, FileCopyFlags.NONE);+					}+					+					f_svg.copy (r_svg, FileCopyFlags.NONE);++					while ((line = dis.read_line (null)) != null) {+						line = ((!) line).replace (@"$(font.get_full_name ()).ttf", @"$(FontDisplay.path_to_uri ((!) f_ttf.get_path ()))?$rid");+						line = ((!) line).replace (@"$(font.get_full_name ()).eot", @"$(FontDisplay.path_to_uri ((!) f_eot.get_path ()))?$rid");+						line = ((!) line).replace (@"$(font.get_full_name ()).svg", @"$(FontDisplay.path_to_uri ((!) f_svg.get_path ()))?$rid");+						sb.append ((!) line);+					}+			+					html_canvas.load_html_string (sb.str, uri);+										+				} catch (Error e) {+					warning (e.message);+					warning ("Failed to load html into canvas."); 				} 				-				html_box.set_visible (html);-				glyph_canvas_area.set_visible (!html);+				html_box.set_visible (true);+				glyph_canvas_area.set_visible (false); 				description.canvas.set_visible (false); 			} else { 				html_box.set_visible (false);diff --git a/birdfont/Main.vala b/birdfont/Main.valaindex 08d8fe3..03fadb5 100644--- a/birdfont/Main.vala+++ b/birdfont/Main.vala@@ -31,8 +31,8 @@ public static int main (string[] arg) { 	BirdFont.BirdFont birdfont = new BirdFont.BirdFont (); 	CharDatabaseParser db = new CharDatabaseParser (); 	unowned Thread<int> db_thread;-	Mutex database_mutex = new Mutex ();-	Cond main_loop_idle = new Cond ();+	Mutex database_mutex = Mutex ();+	Cond main_loop_idle = Cond (); 	bool in_idle = false;  	birdfont.init (arg, null);diff --git a/layout/delete_backup.png b/layout/delete_backup.pngdeleted file mode 100644index e3ae819..0000000Binary files a/layout/delete_backup.png and /dev/null differdiff --git a/layout/index.html b/layout/index.htmldeleted file mode 100644index 0f2a2fc..0000000--- a/layout/index.html+++ /dev/null@@ -1,9 +0,0 @@-<html>-<head>-	<script type="text/javascript" src="supplement.js"></script>-	<style type="text/css">@import url("style.css");</style>-</head>-<body>-<h1>Supplement index</h1>-</body>-</html>diff --git a/layout/style.css b/layout/style.cssdeleted file mode 100644index aef5093..0000000--- a/layout/style.css+++ /dev/null@@ -1,92 +0,0 @@-@charset "UTF-8";--.clearBoth { clear:both; }--body {-}--div {-	font-size: 10pt;-}--div.content {-	width: 100%;-}--div.heading {-	width: 100%;-	background-color: #BABABA; -}--div.menu_item {-	width: 100%;-	background-color: #CEDAE7; -	color: #000000;-	margin: 0 0 2px 0;-	padding: 0 -3px 0 3px;-	cursor: default;-}--div.menu_item:hover {-	background-color: #E6ECF6; -}--div.inner_format_box {-	float: left;-	width: 210px;-	padding: 0 0 0 0;-	margin: 0 10px 0 0;-	top: 50%;-}--div.one_line {-	position: relative;-	top: 100px;-	overflow: hidden;-	white-space: nowrap;	-}--div.recent_font {-	float: left;-	overflow: hidden;-	background-color: #EFEFEF; -	width: 100px;-	height: 120px;-	margin: 5px 5px 5px 5px;-	font-size: 10pt;-	text-align: center;-	padding: 10px 10px 10px 10px;-	cursor: default;-}--div.recent_list {-	margin: 10px 0 0 0;	-}--h2 {-	font-size: 12pt;-	margin-left: 3px;-	margin-bottom: 4px;-}--h3 {-	font-size: 10pt;-	margin-left: 3px;-	margin-bottom: 4px;-}--input.text {-	border: 1px solid #bebebe;-	background: #FFF;-	width: 100%;	-}--input.button {-	border: 1px solid #dedede;-	background: #efefef;-}--input.checkbox {-	border: 1px solid #dedede;-	background: #efefef;-}diff --git a/layout/supplement.js b/layout/supplement.jsdeleted file mode 100644index 8e60415..0000000--- a/layout/supplement.js+++ /dev/null@@ -1,47 +0,0 @@-function call (command) {-	document.title=command;-	document.title='done';-}--// MenuTab text fields-function update_text_fields () {-	mess = 'glyph_sequence:';-	mess += document.getElementById('glyph_sequence').value;-	call (mess);	-}--// DescriptionTab text fields-function update_name_fields () {-	mess = 'postscript_name:';-	mess += document.getElementById('postscript_name').value;-	call (mess);-	-	mess = 'name:';-	mess += document.getElementById('name').value;-	call (mess);-	-	mess = 'subfamily:';-	mess += document.getElementById('subfamily').value;-	call (mess);--	mess = 'full_name:';-	mess += document.getElementById('full_name').value;-	call (mess);--	mess = 'unique_identifier:';-	mess += document.getElementById('unique_identifier').value;-	call (mess);-	-	mess = 'version:';-	mess += document.getElementById('version').value;-	call (mess);--	mess = 'description:';-	mess += document.getElementById('description').value;-	call (mess);-	-	mess = 'copyright:';-	mess += document.getElementById('copyright').value;-	call (mess);-	-}diff --git a/libbirdfont/CharDatabase.vala b/libbirdfont/CharDatabase.valaindex 721a7bf..20c455b 100644--- a/libbirdfont/CharDatabase.vala+++ b/libbirdfont/CharDatabase.vala@@ -56,8 +56,8 @@ public class CharDatabase { 		} 		 		foreach (string i in index.get (s)) {-				c = Font.to_unichar ("U+" + i.down ());-				ucd_result.add_single (c);+			c = Font.to_unichar ("U+" + i.down ());+			ucd_result.add_single (c); 		} 		 		try {diff --git a/libbirdfont/DescriptionTab.vala b/libbirdfont/DescriptionTab.valaindex 01c843a..9e3f294 100644--- a/libbirdfont/DescriptionTab.vala+++ b/libbirdfont/DescriptionTab.vala@@ -28,10 +28,6 @@ public class DescriptionTab : FontDisplay { 	public override string get_label () { 		return _("Description"); 	}--	public override string get_html () {-		return "".dup ();-	} }  }diff --git a/libbirdfont/FontDisplay.vala b/libbirdfont/FontDisplay.valaindex 45d5dfb..95f44b0 100644--- a/libbirdfont/FontDisplay.vala+++ b/libbirdfont/FontDisplay.vala@@ -22,10 +22,12 @@ public abstract class FontDisplay : GLib.Object { 	public signal void redraw_area (double x, double y, double w, double h); 	 	public virtual string get_name () {+		warning ("No name."); 		return ""; 	}  	public virtual string get_label () {+		warning ("No label."); 		return ""; 	} 	@@ -61,18 +63,6 @@ public abstract class FontDisplay : GLib.Object { 		 		return uri; 	}--	public virtual string get_uri () {-		return "";-	}-	-	public virtual string get_html_file () {-		return "index.html";-	}-	-	public virtual string get_html () {-		return "";-	} 	 	public virtual void draw (WidgetAllocation allocation, Context cr) { 	}@@ -114,15 +104,12 @@ public abstract class FontDisplay : GLib.Object { 	} 	 	public virtual void store_current_view () {-		warning ("store_current_view not implemented for this class."); 	} 	 	public virtual void restore_last_view () {-		warning ("restore_last_view not implemented for this class."); 	}  	public virtual void next_view () {-		warning ("next_view not implemented for this class."); 	} 	 	public virtual void scroll_wheel_up (double x, double y) {@@ -134,11 +121,6 @@ public abstract class FontDisplay : GLib.Object { 	public virtual void undo () { 	} -	public static File find_layout_dir () {-		File f = find_file (null, "layout");-		return f;		-	}- 	public static File find_file (string? dir, string name) { 		return SearchPaths.find_file (dir, name);	 	}diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 8f28f59..14af745 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -543,7 +543,11 @@ public class Glyph : FontDisplay { 	public override string get_name () { 		return name; 	}-			++	public override string get_label () {+		return name;+	}+				 	private void help_line_event (double x, double y) { 		bool m = false; 		diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex f586bbd..295cef1 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -45,10 +45,6 @@ public class MenuTab : FontDisplay { 		return "Menu"; 	} -	public override string get_html () {-		return "".dup ();-	}- 	public static void select_overview () { 		if (suppress_event) { 			return;diff --git a/libbirdfont/Preview.vala b/libbirdfont/Preview.valaindex 7238f2b..b2ecc7e 100644--- a/libbirdfont/Preview.vala+++ b/libbirdfont/Preview.vala@@ -23,6 +23,10 @@ public class Preview : FontDisplay { 		return "Preview"; 	} +	public override string get_label () {+		return _("Preview");+	}+	 	public override void selected_canvas () { 	} @@ -43,11 +47,11 @@ public class Preview : FontDisplay { 		return file; 	} -	public new File get_html_file () {+	public static File get_html_file () { 		return get_file ();	 	} -	public override string get_uri () {+	public static string get_uri () { 		return path_to_uri ((!) get_html_file ().get_path ()); 	} 	

Contact

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