Commit c2e0e67
remove webkit callbacks
Changed files (13)
modifiedbirdfont/GtkWindow.valamodifiedlibbirdfont/BackgroundSelection.valamodifiedlibbirdfont/DescriptionTab.valamodifiedlibbirdfont/FileTab.valamodifiedlibbirdfont/FontDisplay.valamodifiedlibbirdfont/KerningDisplay.valamodifiedlibbirdfont/KerningList.valamodifiedlibbirdfont/LanguageSelectionTab.valamodifiedlibbirdfont/MenuTab.valamodifiedlibbirdfont/NativeWindow.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/Preview.valamodifiedlibbirdfont/TabBar.vala
Diff
@@ -81,10 +81,6 @@ public class GtkWindow : Gtk.Window, NativeWindow { html_canvas = new WebView (); WebKit.set_cache_model (CacheModel.DOCUMENT_VIEWER); html_canvas.get_settings ().enable_default_context_menu = false;- - html_canvas.title_changed.connect ((p, s) => {- webkit_callback (s);- }); html_box = new ScrolledWindow (null, null); html_box.set_policy (PolicyType.NEVER, PolicyType.AUTOMATIC);@@ -96,7 +92,7 @@ public class GtkWindow : Gtk.Window, NativeWindow { File layout_uri; string uri = ""; FontDisplay fd = tab.get_display ();- bool html = fd.is_html_canvas ();+ bool html = fd.get_name () == "Preview"; MainWindow.glyph_canvas.set_current_glyph (fd); scrollbar.set_visible (fd.has_scrollbar ());@@ -37,10 +37,11 @@ class BackgroundSelection : FontDisplay { add_icon = (!) i; } + public override string get_label () {+ return _("Backgrounds");+ }+ public override string get_name () {- #if translations- _("Backgrounds");- #endif return "Backgrounds"; } @@ -22,12 +22,11 @@ public class DescriptionTab : FontDisplay { } public override string get_name () {- _("Description"); return "Description"; }- - public override bool is_html_canvas () {- return false;++ public override string get_label () {+ return _("Description"); } public override string get_html () {@@ -248,8 +248,11 @@ public class FileTab : FontDisplay { cr.restore (); } + public override string get_label () {+ return _("Files");+ }+ public override string get_name () {- _("Files"); return "Files"; } @@ -16,24 +16,18 @@ using Cairo; namespace BirdFont { -/** Javascripts in webkit do use this callback. */-public class PropertyFunction {- public delegate void PropertyCallback (string val);- public PropertyCallback call;-}- public abstract class FontDisplay : GLib.Object { - List<string> property = new List<string> ();- List<PropertyFunction> call = new List<PropertyFunction> ();- /** Queue redraw area */ public signal void redraw_area (double x, double y, double w, double h); - /** Name of symbol or set of symbols in display selections like the tab panel. */ public virtual string get_name () { return ""; }++ public virtual string get_label () {+ return "";+ } public virtual bool has_scrollbar () { return false;@@ -41,10 +35,6 @@ public abstract class FontDisplay : GLib.Object { public virtual void scroll_to (double percent) { }- - public virtual bool is_html_canvas () {- return false;- } public static string path_to_uri (string path) { string uri = path;@@ -149,49 +139,6 @@ public abstract class FontDisplay : GLib.Object { return f; } - public void add_html_callback (string prop, PropertyFunction.PropertyCallback cb) {- PropertyFunction pf = new PropertyFunction ();- pf.call = cb;- property.append (prop);- call.append (pf);- }- - public void process_property (string prop) {- string k, v;- int i, j;- PropertyFunction cb;- - if (prop == "" || prop == "done") {- return;- }- - i = prop.index_of (":");- - if (i <= 0) {- return;- }- - k = prop.substring (0, i);- v = prop.substring (i + 1);- - j = 0;- - foreach (string p in property) {- if (p == k) {- break;- }- j++;- }- - if (j >= property.length ()) {- warning (@"key \"$k\" not found in property list, value: $v");- return;- }- - cb = call.nth (j).data;- cb.call (v);- }- public static File find_file (string? dir, string name) { return SearchPaths.find_file (dir, name); }@@ -41,6 +41,10 @@ public class KerningDisplay : FontDisplay { row.append (w); } + public override string get_label () {+ return _("Kerning");+ }+ public override string get_name () { return "Kerning"; }@@ -84,8 +84,11 @@ public class KerningList : FontDisplay { cr.show_text (kerning); } + public override string get_label () {+ return _("Kerning Pairs");+ }+ public override string get_name () {- _("Kerning Pairs"); // translate later return "Kerning Pairs"; } @@ -87,9 +87,12 @@ public class LanguageSelectionTab : FontDisplay { cr.show_text (language); } + public override string get_label () {+ return _("Character Set");+ }+ public override string get_name () {- _("Character set");- return "Character set";+ return "Character Set"; } public override bool has_scrollbar () {@@ -25,14 +25,14 @@ public class MenuTab : FontDisplay { public static void set_suppress_event (bool e) { suppress_event = e; }- ++ public override string get_label () {+ return _("Menu");+ }+ public override string get_name () { return "Menu"; }- - public override bool is_html_canvas () {- return true;- } public override string get_html () { return "".dup ();@@ -48,11 +48,6 @@ public interface NativeWindow : GLib.Object { /** Exit the application. */ public abstract void quit ();- - protected void webkit_callback (string s) {- FontDisplay fd = MainWindow.get_current_display ();- fd.process_property (s);- } } }@@ -230,6 +230,10 @@ public class OverView : FontDisplay { public override void next_view () { } + public override string get_label () {+ return _("Overview");+ }+ public override string get_name () { return "Overview"; }@@ -22,10 +22,6 @@ public class Preview : FontDisplay { public override string get_name () { return "Preview"; }- - public override bool is_html_canvas () {- return true;- } public override void selected_canvas () { }@@ -438,7 +438,7 @@ public class TabBar : GLib.Object { int s = (tabs.length () == 0) ? 0 : selected + 1; if (tab_width < 0) {- tab_width = 9 * _(display_item.get_name ()).char_count ();+ tab_width = 9 * display_item.get_label ().char_count (); tab_width += 30; } @@ -489,11 +489,6 @@ public class TabBar : GLib.Object { } - // translation is done here since tabs are selected by name- string translate (string s) {- return _(s);- }- private void draw_tabs (Context cr) { double close_opacity; double offset = 19;@@ -559,7 +554,7 @@ public class TabBar : GLib.Object { cr.set_source_rgba (0, 0, 0, 1); cr.set_font_size (14); cr.move_to (8, height - 6);- cr.show_text (translate (t.get_label ()));+ cr.show_text (t.get_label ()); cr.stroke (); // edges@@ -591,24 +586,6 @@ public class TabBar : GLib.Object { i++; } }- - public void add_empty_tab (string name) {- add_tab (new EmptyTab (name));- }-}--public class EmptyTab : FontDisplay {- - public string name;- - public EmptyTab (string name) {- this.name = name;- }- - public override string get_name () {- return name;- } } - }