Commit 1d7f3e1
Various bug fixes for Mac
Changed files (6)
modifiedlibbirdfont/GlyphCanvas.valamodifiedlibbirdfont/OpenFontFormat/CodePageBits.valamodifiedlibbirdfont/Tab.valamodifiedlibbirdfont/TabBar.valamodifiedlibbirdfont/TabContent.valamodifiedlibbirdfont/TestCases.vala
Diff
@@ -19,7 +19,7 @@ namespace BirdFont { public class GlyphCanvas : GLib.Object { /** Tab content. */ - internal static FontDisplay current_display; + public static FontDisplay current_display; public signal void signal_redraw_area (int x, int y, int w, int h); public static WidgetAllocation allocation; @@ -41,7 +41,14 @@ public class GlyphCanvas : GLib.Object { } public void key_press (uint e) { - current_display.key_press (e); + Toolbox tb;+ + current_display.key_press (e);+ + if (current_display is Glyph) {+ tb = MainWindow.get_toolbox ();+ tb.key_press (e);+ } } public void set_current_glyph (FontDisplay fd) { @@ -52,12 +52,12 @@ public class CodePageBits : GLib.Object { } void set_bits_for_glyph (Glyph g, ref uint32 p0, ref uint32 p1) {- List<int> bits;+ Gee.ArrayList<int> bits; if (!g.is_unassigned ()) { bits = get_bits (g.get_unichar ()); - if (unlikely (bits.length () == 0)) {+ if (unlikely (bits.size == 0)) { warning (@"Unknown codepage for glyph $(g.get_name ()) ($(Font.to_hex (g.get_unichar ())))"); } @@ -67,11 +67,11 @@ public class CodePageBits : GLib.Object { } } - public List<int> get_bits (unichar c) {- List<int> bits = new List<int> ();+ public Gee.ArrayList<int> get_bits (unichar c) {+ Gee.ArrayList<int> bits = new Gee.ArrayList<int> (); foreach (PageBit pb in codepages) { if (pb.has_char (c)) {- bits.append (pb.bit); + bits.add (pb.bit); } } return bits;@@ -19,11 +19,13 @@ public class Tab : GLib.Object { bool always_open; double width; FontDisplay display;+ string label; public Tab (FontDisplay glyph, double tab_width, bool always_open) { width = tab_width;- this.display = glyph;+ display = glyph; this.always_open = always_open;+ label = display.get_label (); } public bool has_close_button () {@@ -41,6 +43,10 @@ public class Tab : GLib.Object { public double get_width () { return width; }+ + public string get_label () {+ return label;+ } } }@@ -742,7 +742,7 @@ public class TabBar : GLib.Object { cr.set_source_rgba (0, 0, 0, 1); cr.set_font_size (14 / scale); cr.move_to (8 / scale, h - 6 / scale);- cr.show_text (t.get_display ().get_label ());+ cr.show_text (t.get_label ()); cr.stroke (); // edges@@ -126,7 +126,7 @@ public class TabContent : GLib.Object { return; } - GlyphCanvas.current_display.undo (x, y);+ GlyphCanvas.current_display.undo (); } public static string path_to_uri (string path) {@@ -81,19 +81,19 @@ class TestCases { public static void test_codepages () { CodePageBits pages = new CodePageBits (); - if (pages.get_bits ('ó').length () == 0) {+ if (pages.get_bits ('ó').size == 0) { warning ("Codepage for Hungarian is not set."); } - if (pages.get_bits ('ö').length () == 0) {+ if (pages.get_bits ('ö').size == 0) { warning ("Codepage for Swedish is not set."); } - if (pages.get_bits ('ツ').length () == 0) {+ if (pages.get_bits ('ツ').size == 0) { warning ("Codepage for Japanese is not set."); } - if (pages.get_bits ('马').length () == 0) {+ if (pages.get_bits ('马').size == 0) { warning ("Codepage for Chinese is not set."); } }