Commit 9ff93c4
update preview hack for windows and wine
Changed files (3)
Diff
@@ -24,7 +24,7 @@ static void print_export_help (string[] arg) { stdout.printf (" [OPTION ...] FILE\n"); stdout.printf ("-h, --help print this message\n"); stdout.printf ("-o, --output [DIRECTORY] write files to this directory\n");- stdout.printf ("-s, --svg write file\n");+ stdout.printf ("-s, --svg write svg file\n"); stdout.printf ("-t, --ttf write ttf and eot files\n"); stdout.printf ("\n"); }@@ -88,19 +88,51 @@ public class GtkWindow : Gtk.Window, NativeWindow { layout_uri = layout_dir.get_child (fd.get_html_file ()); uri = fd.path_to_uri ((!) layout_uri.get_path ()); }-- if (fd.get_name () == "Preview") {- ExportTool.export_all ();- } if (fd.get_html () == "") {- html_canvas.load_html_string ("<html></html>", "file:///"); - html_canvas.reload_bypass_cache ();- - html_canvas.load_uri (uri);- html_canvas.reload_bypass_cache ();- html_canvas.load_uri (uri); + // this hack forces webkit to reload the font and ignore cached data+ // it's only required on windows platform and in wine+ //+ // webkit will crash if the loaded file is updated with export_all+ //+ if (Supplement.win32) {+ html_canvas.load_uri (uri);+ + TimeoutSource loadscreen = new TimeoutSource(300);+ loadscreen.set_callback(() => {+ html_canvas.load_html_string ("<html>Loading ...</html>", "file:///");+ html_box.set_visible (n);+ glyph_canvas_area.set_visible (!n);+ + if (fd.get_name () == "Preview") {+ ExportTool.export_all ();+ }+ + return false;+ });+ loadscreen.attach(null);+ + TimeoutSource update = new TimeoutSource(2000); + update.set_callback(() => {+ html_canvas.load_uri (uri);+ return false;+ });+ update.attach(null);++ } else {++ if (fd.get_name () == "Preview") {+ ExportTool.export_all ();+ }+ + html_canvas.load_html_string ("<html></html>", "file:///"); + html_canvas.reload_bypass_cache ();+ + html_canvas.load_uri (uri);+ html_canvas.reload_bypass_cache ();+ html_canvas.load_uri (uri);+ } } else { html_canvas.load_html_string (fd.get_html (), uri); }@@ -25,7 +25,7 @@ public class Supplement { internal static bool experimental = false; internal static bool show_coordinates = false; internal static bool fatal_wanings = false; - internal static bool win32 = false; + public static bool win32 = false; internal static string exec_path = ""; internal static Font current_font;