The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Merge branch '2.14' of github.com:johanmattssonm/birdfont into 2.14

These changes was commited to the Birdfont repository Sat, 28 Nov 2015 13:20:34 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 28 Nov 2015 13:20:34 +0000 (14:20 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 28 Nov 2015 13:20:34 +0000 (14:20 +0100)
commit 3bf69b215484723549eda626797459d080296fcb
tree c91b6b666ec8d924dceb679f32789499c0fe42b7
parent 92c13abcac9ceda8cb0a824ab7f0b19ca99bfc88
parent c340ed28fe6a998b5a9ae73632652c1de6309242
Merge branch '2.14' of github.com:johanmattssonm/birdfont into 2.14

libbirdfont/AbstractMenu.vala
libbirdfont/BackgroundSelectionTool.vala
libbirdfont/ExportTool.vala
libbirdfont/MainWindow.vala
libbirdfont/OverView.vala
libbirdfont/StrokeTool.vala
--- a/libbirdfont/AbstractMenu.vala +++ b/libbirdfont/AbstractMenu.vala @@ -36,11 +36,15 @@ if (tab_name == "Preview") { MenuTab.select_overview (); } + + MainWindow.hide_scrollbar (); + } else { + MainWindow.show_scrollbar (); } } } - public bool menu_visibility = false; + private bool menu_visibility = false; public SubMenu top_menu; SubMenu current_menu; @@ -219,7 +223,7 @@ y += height; } - menu_visibility = false; + show_menu = false; current_menu = (!) top_menu; GlyphCanvas.redraw (); }
--- a/libbirdfont/BackgroundSelectionTool.vala +++ b/libbirdfont/BackgroundSelectionTool.vala @@ -28,6 +28,7 @@ new_image.connect (add_new_image); select_action.connect ((t) => { + DrawingTools.move_canvas.set_selected (false); GlyphCanvas.redraw (); });
--- a/libbirdfont/ExportTool.vala +++ b/libbirdfont/ExportTool.vala @@ -148,7 +148,7 @@ public static void export_current_glyph () { FileChooser fc = new FileChooser (); - fc.file_selected.connect ((f) => { + fc.file_selected.connect ((selected_file) => { Glyph glyph = MainWindow.get_current_glyph (); FontDisplay fd = MainWindow.get_current_display (); string glyph_svg; @@ -159,19 +159,34 @@ string fn; int i; - name = glyph.get_name (); - - if (f == null) { + if (fd is Glyph) { + glyph = MainWindow.get_current_glyph (); + } else if (fd is OverView) { + OverView overview = MainWindow.get_overview (); + Glyph? g = overview.get_selected_glyph (); + + if (g == null) { + warning("No glyhp selected in overview."); + return; + } + + glyph = (!) g; + } else { return; } - svg_file = (!) f; - - if (!(fd is Glyph)) { + name = glyph.get_name (); + + if (selected_file == null) { return; } + svg_file = (!) selected_file; + try { + #if MAC + file = File.new_for_path (svg_file); + #else i = 1; fn = svg_file.replace (".svg", ""); file = File.new_for_path (fn + ".svg"); @@ -179,8 +194,8 @@ file = File.new_for_path (fn + @"$i.svg"); i++; } - - glyph_svg = export_current_glyph_to_string (); + #endif + glyph_svg = export_to_string (glyph, false); os = new DataOutputStream (file.create(FileCreateFlags.REPLACE_DESTINATION)); os.put_string (glyph_svg);
--- a/libbirdfont/MainWindow.vala +++ b/libbirdfont/MainWindow.vala @@ -36,6 +36,8 @@ /** Number of pixels per mm */ public static double units = 1; + private static double scrollbar_size = -1; + public MainWindow () { singleton = this; @@ -248,10 +250,23 @@ public static void file_chooser (string title, FileChooser fc, uint flags) { MainWindow.native_window.file_chooser (title, fc, flags); + } + + public static void hide_scrollbar () { + if (!is_null (MainWindow.native_window)) { + MainWindow.native_window.set_scrollbar_size (-1); + } + } + + public static void show_scrollbar () { + if (!is_null (MainWindow.native_window)) { + MainWindow.native_window.set_scrollbar_size (scrollbar_size); + } } public static void set_scrollbar_size (double size) { if (!is_null (MainWindow.native_window)) { + scrollbar_size = size; MainWindow.native_window.set_scrollbar_size (size); } }
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -128,6 +128,14 @@ update_item_list (); update_scrollbar (); reset_zoom (); + } + + public Glyph? get_selected_glyph () { + if (selected_items.size == 0) { + return null; + } + + return selected_items.get (0).get_current (); } public void select_all_glyphs () {
--- a/libbirdfont/StrokeTool.vala +++ b/libbirdfont/StrokeTool.vala @@ -535,10 +535,8 @@ next = lep.get_next (); hidden = new EditPoint (0, 0, PointType.QUADRATIC); - px = next.get_right_handle ().x - + (next.get_left_handle ().x - prev.get_right_handle ().x) / 2.0; - py = next.get_right_handle ().y - + (next.get_left_handle ().y - prev.get_right_handle ().y) / 2.0; + px = (next.get_left_handle ().x + prev.get_right_handle ().x) / 2.0; + py = (next.get_left_handle ().y + prev.get_right_handle ().y) / 2.0; hidden.independent_x = px; hidden.independent_y = py;