Commit ce99078
Draw menu over glyph and set size of glyph in overiview
Changed files (3)
modifiedlibbirdfont/MenuTab.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/OverViewItem.vala
Diff
@@ -326,6 +326,7 @@ public class MenuTab : FontDisplay { MainWindow.get_toolbox ().update_expanders (); MainWindow.get_toolbox ().update_all_expanders (); Toolbox.redraw_tool_box ();+ OverViewItem.glyph_scale = 1; } // FIXME: background thread@@ -387,7 +387,6 @@ public class OverView : FontDisplay { KeyBindings.set_require_modifier (true); update_scrollbar (); update_zoom_bar ();- OverViewItem.glyph_scale = 1; update_item_list (); selected_item = get_selected_item (); GlyphCanvas.redraw ();@@ -1319,7 +1318,7 @@ public class OverView : FontDisplay { } index++; }- + if (update) { update_item_list (); }@@ -292,11 +292,10 @@ public class OverViewItem : GLib.Object { cr.set_line_width (1); cr.stroke (); cr.restore ();- + + draw_thumbnail (cr, x, y + height); draw_caption (cr); draw_menu (cr);- - draw_thumbnail (cr, x, y + height); } public void adjust_scale () {@@ -307,21 +306,22 @@ public class OverViewItem : GLib.Object { if (glyphs != null) { font = BirdFont.get_current_font (); g = ((!) glyphs).get_current ();- g.boundaries (out x1, out y1, out x2, out y2);- - glyph_width = x2 - x1;- glyph_height = y2 - y1;+ + if (g.boundaries (out x1, out y1, out x2, out y2)) {+ glyph_width = x2 - x1;+ glyph_height = y2 - y1; - if (glyph_scale == 1) {- // caption height is 20- glyph_scale = (height - 20) / (font.top_limit - font.bottom_limit); - }+ if (glyph_scale == 1) {+ // caption height is 20+ glyph_scale = (height - 20) / (font.top_limit - font.bottom_limit); + }+ + scale = glyph_scale; + gx = ((width / scale) - glyph_width) / 2; - scale = glyph_scale; - gx = ((width / scale) - glyph_width) / 2;- - if (gx < 0) {- glyph_scale = 1 + 2 * gx / width;+ if (gx < 0) {+ glyph_scale = 1 + 2 * gx / width;+ } } } }@@ -490,7 +490,7 @@ public class OverViewItem : GLib.Object { } private void draw_menu (Context cr) {- if (likely (glyphs == null || !version_menu.menu_visible)) {+ if (glyphs == null || !version_menu.menu_visible) { return; }