The Birdfont Source Code


All Repositories / birdfont.git / commitdiff – RSS feed

Draw menu over glyph and set size of glyph in overiview

These changes was commited to the Birdfont repository Tue, 22 Dec 2015 19:22:19 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
[Tue, 22 Dec 2015 19:22:19 +0000]

Updated Files

libbirdfont/MenuTab.vala
libbirdfont/OverView.vala
libbirdfont/OverViewItem.vala
--- a/libbirdfont/MenuTab.vala +++ b/libbirdfont/MenuTab.vala @@ -326,6 +326,7 @@ MainWindow.get_toolbox ().update_expanders (); MainWindow.get_toolbox ().update_all_expanders (); Toolbox.redraw_tool_box (); + OverViewItem.glyph_scale = 1; } // FIXME: background thread
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -387,7 +387,6 @@ 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 @@ } index++; } - + if (update) { update_item_list (); }
--- a/libbirdfont/OverViewItem.vala +++ b/libbirdfont/OverViewItem.vala @@ -292,11 +292,10 @@ 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 @@ 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 @@ } private void draw_menu (Context cr) { - if (likely (glyphs == null || !version_menu.menu_visible)) { + if (glyphs == null || !version_menu.menu_visible) { return; }