Commit e63d9c6
fix warnings in export
Changed files (18)
modifiedlibbirdfont/BackgroundSelection.valamodifiedlibbirdfont/BackgroundTool.valamodifiedlibbirdfont/BirdFont.valamodifiedlibbirdfont/CircleTool.valamodifiedlibbirdfont/CutBackgroundTool.valamodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/GlyphBackgroundImage.valamodifiedlibbirdfont/GlyphCanvas.valamodifiedlibbirdfont/GridTool.valamodifiedlibbirdfont/KerningClasses.valamodifiedlibbirdfont/KerningDisplay.valamodifiedlibbirdfont/MainWindow.valamodifiedlibbirdfont/MoveTool.valamodifiedlibbirdfont/RectangleTool.valamodifiedlibbirdfont/ResizeTool.valamodifiedlibbirdfont/VersionList.valamodifiedlibbirdfont/ZoomTool.vala
Diff
@@ -165,7 +165,7 @@ class BackgroundSelection : FontDisplay { BirdFont.get_current_font ().add_background_image ((!) file); } - MainWindow.get_glyph_canvas ().redraw (); + GlyphCanvas.redraw (); collect_background_images (); }@@ -277,7 +277,7 @@ class BackgroundSelection : FontDisplay { active += (int) (y / 140) * (int) (allocation.width / 140.0); // row if (active != active_box) {- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); active_box = active; } }@@ -140,7 +140,7 @@ class BackgroundTool : Tool { bg.set_img_offset (this.img_offset_x + dx, this.img_offset_y + dy); } - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } }@@ -34,7 +34,7 @@ public static int run_export (string[] arg) { bool write_ttf = false; bool write_svg = false; File directory;-+ stdout.printf ("birdfont-export version %s\n", VERSION); stdout.printf ("built on %s\n", BUILD_TIMESTAMP); @@ -86,7 +86,7 @@ public class CircleTool : Tool { last_x = x; last_y = y; - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } void press (int button, double x, double y) {@@ -134,7 +134,7 @@ public class CircleTool : Tool { circle = path; - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } }@@ -80,7 +80,7 @@ class CutBackgroundTool : Tool { x2 = x; y2 = y; - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } }); @@ -337,7 +337,7 @@ public class DrawingTools : ToolCollection { bool v = !g.get_xheight_lines_visible (); g.set_xheight_lines_visible (v); self.set_selected (v);- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); if (v && !help_lines.is_selected ()) { MainWindow.get_toolbox ().select_tool (help_lines);@@ -352,7 +352,7 @@ public class DrawingTools : ToolCollection { bool v = !g.get_margin_lines_visible (); g.set_margin_lines_visible (v); self.set_selected (v);- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); if (v && !help_lines.is_selected ()) { MainWindow.get_toolbox ().select_tool (help_lines);@@ -382,7 +382,7 @@ public class DrawingTools : ToolCollection { reset_zoom.select_action.connect ((self) => { zoom_tool.store_current_view (); glyph_canvas.get_current_display ().reset_zoom ();- glyph_canvas.redraw_area(0, 0, glyph_canvas.allocation.width, glyph_canvas.allocation.height);+ glyph_canvas.redraw_area(0, 0, GlyphCanvas.allocation.width, GlyphCanvas.allocation.height); }); view_tools.add_tool (reset_zoom); @@ -408,7 +408,7 @@ public class DrawingTools : ToolCollection { zoom_tool.zoom_full_background_image (); - glyph_canvas.redraw_area(0, 0, glyph_canvas.allocation.width, glyph_canvas.allocation.height);+ glyph_canvas.redraw_area(0, 0, GlyphCanvas.allocation.width, GlyphCanvas.allocation.height); } }); view_tools.add_tool (zoom_bg);@@ -450,7 +450,7 @@ public class DrawingTools : ToolCollection { ((!)img).set_img_scale (s, s); } - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); }); background_tools.add_tool (background_scale); @@ -467,7 +467,7 @@ public class DrawingTools : ToolCollection { show_bg.select_action.connect ((self) => { Glyph g = MainWindow.get_current_glyph (); g.set_background_visible (!g.get_background_visible ());- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); }); background_tools.add_tool (show_bg); @@ -812,7 +812,7 @@ public class DrawingTools : ToolCollection { grid_width.select_action.connect((self) => { SpinButton sb = (SpinButton) self; GridTool.set_grid_width (sb.get_value ());- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); }); grid_expander.add_tool (grid_width);@@ -647,7 +647,7 @@ public class Glyph : FontDisplay { } public void update_view () {- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } public override void double_click (uint button, double ex, double ey) { @@ -733,7 +733,7 @@ public class Glyph : FontDisplay { view_offset_y += y / view_zoom; if (unlikely (allocation.width == 0 || allocation.height == 0)) {- warning (@"Allocation is not set in $(get_name ())");+ return; } view_zoom_x = allocation.width * view_zoom / w;@@ -434,7 +434,7 @@ public class GlyphBackgroundImage { } if (prev_handle != active_handle) {- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } } @@ -24,7 +24,7 @@ public class GlyphCanvas : GLib.Object { public FontDisplay current_display; public signal void signal_redraw_area (int x, int y, int w, int h); - public WidgetAllocation allocation = new WidgetAllocation (); + public static WidgetAllocation allocation = new WidgetAllocation (); public GlyphCanvas () { } @@ -78,8 +78,11 @@ public class GlyphCanvas : GLib.Object { signal_redraw_area (x, y, w, h); } - public void redraw () { - signal_redraw_area (0, 0, allocation.width, allocation.height); + public static void redraw () { + GlyphCanvas c = MainWindow.get_glyph_canvas (); + if (!is_null (c)) { + c.signal_redraw_area (0, 0, allocation.width, allocation.height); + } } } @@ -52,7 +52,7 @@ class GridTool : Tool { select_action.connect((self) => { visible = !visible; update_lines ();- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); self.set_selected (visible); @@ -308,9 +308,7 @@ public class KerningClasses : GLib.Object { classes_kerning.remove_link (classes_kerning.first ()); } - if (!is_null (MainWindow.get_glyph_canvas ())) { // FIXME: reorganize- MainWindow.get_glyph_canvas ().redraw ();- }+ GlyphCanvas.redraw (); if (!is_null (MainWindow.get_toolbox ())) { // FIXME: reorganize Toolbox.redraw_tool_box ();@@ -430,7 +430,7 @@ public class KerningDisplay : FontDisplay { row.first ().data.glyph.append ((!) glyph); row.first ().data.ranges.append (range); - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } void set_selected_handle (int handle) {@@ -444,7 +444,7 @@ public class KerningDisplay : FontDisplay { selected_handle = (int) row.first ().data.glyph.length () - 1; } - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } public static void previous_pair () {@@ -512,7 +512,7 @@ public class KerningDisplay : FontDisplay { } } - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } public override void motion_notify (double ex, double ey) {@@ -529,7 +529,7 @@ public class KerningDisplay : FontDisplay { k = (ex - last_handle_x) / y; // y-axis is for variable precision set_kerning (selected_handle, k);- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } last_handle_x = ex;@@ -590,7 +590,7 @@ public class KerningDisplay : FontDisplay { if (active_handle != i - row_index) { set_active_handle_index (i - row_index);- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } if (col_index == word.glyph.length () || col_index == 0) {@@ -122,7 +122,7 @@ public class MainWindow { TextListener listener = new TextListener (_("Glyph sequence"), Preferences.get ("glyph_sequence"), _("Close")); listener.signal_text_input.connect ((text) => { Preferences.set ("glyph_sequence", text); - get_glyph_canvas ().redraw (); + GlyphCanvas.redraw (); }); listener.signal_submit.connect (() => { MainWindow.native_window.hide_text_input (); @@ -164,7 +164,7 @@ public class MainWindow { } } - get_glyph_canvas ().redraw (); + GlyphCanvas.redraw (); } public static void close_all_tabs () { @@ -138,7 +138,7 @@ class MoveTool : Tool { last_x = x; last_y = y; - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); }); key_press_action.connect ((self, keyval) => {@@ -88,7 +88,7 @@ public class RectangleTool : Tool { press_y = y; resize = true; - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } } @@ -83,7 +83,7 @@ class ResizeTool : Tool { resize (x, y); } - MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); }); draw_action.connect ((self, cr, glyph) => {@@ -18,6 +18,7 @@ using Math; namespace BirdFont { public class VersionList : DropMenu {+ int versions = 1; int current_version = 0; public List<Glyph> glyphs = new List<Glyph> ();@@ -150,7 +151,7 @@ public class VersionList : DropMenu { if (ug == null) { return; }- + updated_glyph = (!) ug; tab.set_display (updated_glyph); updated_glyph.view_zoom = glyph.view_zoom;@@ -115,7 +115,7 @@ class ZoomTool : Tool { MainWindow.select_tab (views.nth (view_index).data); MainWindow.get_current_display ().next_view ();- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } /** Undo last zoom. */@@ -128,7 +128,7 @@ class ZoomTool : Tool { MainWindow.select_tab (views.nth (view_index).data); MainWindow.get_current_display ().restore_last_view ();- MainWindow.get_glyph_canvas ().redraw ();+ GlyphCanvas.redraw (); } }