Commit 684fde4
Hide resize handle when objects are moved and merge birdfont-2.x
Changed files (10)
modifiedlibbirdfont/AbstractMenu.valamodifiedlibbirdfont/AlternateSets.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/OpenFontFormat/AlternateFeature.valamodifiedlibbirdfont/OtfFeatureTable.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/ResizeTool.valamodifiedlibbirdfont/TabContent.valamodifiedlibbirdfont/ZoomTool.valamodifiedscripts/version.py
Diff
@@ -75,7 +75,8 @@ public class AbstractMenu : GLib.Object { return null; } - public void process_key_binding_events (uint keyval) {+ /** @return true if the keybindings consumes the event. */+ public bool process_key_binding_events (uint keyval) { string display; FontDisplay current_display = MainWindow.get_current_display (); ToolItem tm;@@ -96,7 +97,7 @@ public class AbstractMenu : GLib.Object { if (!SettingsDisplay.update_key_bindings && !(item is ToolItem)) { item.action ();- return;+ return true; } if (item is ToolItem) {@@ -106,16 +107,18 @@ public class AbstractMenu : GLib.Object { if (tm.tool.editor_events) { MainWindow.get_toolbox ().set_current_tool (tm.tool); tm.tool.select_action (tm.tool);- return;+ return true; } else { tm.tool.select_action (tm.tool); - return;+ return true; } } } } } }+ + return false; } public void load_key_bindings () {@@ -51,7 +51,30 @@ public class AlternateSets : GLib.Object { return alt; }- ++ public Gee.ArrayList<Alternate> get_alt_with_glyph (string tag, Font font) { + Gee.ArrayList<Alternate> alt;+ alt = new Gee.ArrayList<Alternate> ();+ + foreach (Alternate a in alternates) {+ Alternate available = new Alternate (a.glyph_name, a.tag);+ + foreach (string substitution in a.alternates) {+ if (font.has_glyph (substitution)) {+ available.alternates.add (substitution);+ }+ }+ + if (available.tag == tag && available.alternates.size > 0) {+ if (font.has_glyph (available.glyph_name)) {+ alt.add (available);+ }+ }+ }+ + return alt;+ }+ public void remove_empty_sets () { int i = 0; foreach (Alternate a in alternates) {@@ -1142,19 +1142,9 @@ public class Glyph : FontDisplay { } public void show_zoom_area (int sx, int sy, int nx, int ny) {- double x, y, w, h;- set_zoom_area (sx, sy, nx, ny);- zoom_area_is_visible = true;-- x = Math.fmin (zoom_x1, zoom_x2) - 50;- y = Math.fmin (zoom_y1, zoom_y2) - 50;-- w = Math.fabs (zoom_x1 - zoom_x2) + 100;- h = Math.fabs (zoom_y1 - zoom_y2) + 100;-- redraw_area ((int)x, (int)y, (int)w, (int)h);+ GlyphCanvas.redraw (); } public void set_zoom_area (int sx, int sy, int nx, int ny) {@@ -24,7 +24,7 @@ public class AlternateFeature : GLib.Object { this.tag = tag; this.glyf_table = glyf_table;- alternates = font.alternates.get_alt (tag);+ alternates = font.alternates.get_alt_with_glyph (tag, font); alternates.sort ((a, b) => { Alternate alt1 = (Alternate) a;@@ -53,7 +53,8 @@ public class OtfFeatureTable : Table { GlyphSelection gs = new GlyphSelection (); gs.selected_glyph.connect ((gc) => {- glyph_collection = gc; + glyph_collection = gc;+ replacement_glyph = null; MainWindow.get_tab_bar ().select_tab_name (get_name ()); }); @@ -94,15 +94,13 @@ public class OverView : FontDisplay { TabBar tabs = MainWindow.get_tab_bar (); string n = glyph_collection.get_current ().name; bool selected = tabs.select_char (n);- GlyphCanvas canvas;+ GlyphTab glyph_tab; if (!selected) { glyph_tab = new GlyphTab (glyph_collection);- canvas = MainWindow.get_glyph_canvas (); tabs.add_tab (glyph_tab, true, glyph_collection);- canvas.set_current_glyph_collection (glyph_collection);- set_initial_zoom ();+ set_glyph_zoom (glyph_collection); PenTool.update_orientation (); } @@ -203,7 +201,7 @@ public class OverView : FontDisplay { canvas = MainWindow.get_glyph_canvas (); canvas.set_current_glyph_collection (glyph_collection); - set_initial_zoom ();+ set_glyph_zoom (glyph_collection); } else { warning ("Glyph is already open"); }@@ -291,15 +289,18 @@ public class OverView : FontDisplay { return null; } - public void set_initial_zoom () {+ public void set_glyph_zoom (GlyphCollection glyphs) {+ GlyphCanvas canvas;+ canvas = MainWindow.get_glyph_canvas ();+ canvas.set_current_glyph_collection (glyphs); Toolbox tools = MainWindow.get_toolbox (); ZoomTool z = (ZoomTool) tools.get_tool ("zoom_tool"); z.store_current_view ();- MainWindow.get_current_glyph ().default_zoom ();+ glyphs.get_current ().default_zoom (); z.store_current_view (); OverViewItem.reset_label (); }-+ public double get_height () { double l; Font f;@@ -1072,6 +1073,16 @@ public class OverView : FontDisplay { if (g.length () > 0) { font.add_glyph_collection (g); }++ TabBar tabs = MainWindow.get_tab_bar ();+ Tab? tab = tabs.get_tab (g.get_name ());+ + if (tab != null) {+ Tab t = (!) tab;+ set_glyph_zoom (g);+ t.set_glyph_collection (g);+ t.set_display (new GlyphTab (g));+ } } Font f = BirdFont.get_current_font ();@@ -1096,6 +1107,16 @@ public class OverView : FontDisplay { foreach (GlyphCollection g in previous_collection.glyphs) { font.delete_glyph (g); font.add_glyph_collection (g);++ TabBar tabs = MainWindow.get_tab_bar ();+ Tab? tab = tabs.get_tab (g.get_name ());+ + if (tab != null) {+ Tab t = (!) tab;+ set_glyph_zoom (g);+ t.set_glyph_collection (g);+ t.set_display (new GlyphTab (g));+ } } font.alternates = previous_collection.alternate_sets.copy (); @@ -165,36 +165,38 @@ public class ResizeTool : Tool { Text handle; Glyph g = MainWindow.get_current_glyph (); - if (!rotate_path) {- if (!resize_width) {- handle = proportional_handle;- get_resize_handle_position (out handle.widget_x, out handle.widget_y);+ if (!move_paths) {+ if (!rotate_path) {+ if (!resize_width) {+ handle = proportional_handle;+ get_resize_handle_position (out handle.widget_x, out handle.widget_y);+ + handle.widget_x -= handle.get_sidebearing_extent () / 2;+ handle.widget_y -= handle.get_height () / 2;+ + handle.draw (cr);+ } - handle.widget_x -= handle.get_sidebearing_extent () / 2;- handle.widget_y -= handle.get_height () / 2;- - handle.draw (cr);- } - - if (!resize_path_proportional) {- handle = horizontal_handle;- - get_horizontal_reseize_handle_position (out handle.widget_x, - out handle.widget_y);- - handle.widget_x -= handle.get_sidebearing_extent () / 2;- handle.widget_y -= handle.get_height () / 2;- - handle.draw (cr);+ if (!resize_path_proportional) {+ handle = horizontal_handle;+ + get_horizontal_reseize_handle_position (out handle.widget_x, + out handle.widget_y);+ + handle.widget_x -= handle.get_sidebearing_extent () / 2;+ handle.widget_y -= handle.get_height () / 2;+ + handle.draw (cr);+ } }- } - if (!resize_path_proportional && !resize_width - && g.active_paths.size > 0) {- - draw_rotate_handle (cr);+ if (!resize_path_proportional && !resize_width + && g.active_paths.size > 0) {+ + draw_rotate_handle (cr);+ } }- + MoveTool.draw_actions (cr); }); @@ -150,8 +150,12 @@ public class TabContent : GLib.Object { KeyBindings.add_modifier_from_keyval (keyval); if (!text_input_visible) {- MainWindow.get_menu ().process_key_binding_events (keyval);- GlyphCanvas.current_display.key_press (keyval);+ AbstractMenu menu = MainWindow.get_menu ();+ bool consumed = menu.process_key_binding_events (keyval);+ + if (!consumed) {+ GlyphCanvas.current_display.key_press (keyval);+ } } else { text_input.key_press (keyval); }@@ -36,17 +36,18 @@ public class ZoomTool : Tool { }); press_action.connect((self, b, x, y) => {- if (b == 1 && KeyBindings.modifier != CTRL) {+ if (b == 1 && !KeyBindings.has_ctrl () && !KeyBindings.has_shift ()) { zoom_area_begin_x = x; zoom_area_begin_y = y;+ Glyph g = MainWindow.get_current_glyph ();+ g.zoom_area_is_visible = true; } }); move_action.connect((self, x, y) => {- Glyph g;+ Glyph g = MainWindow.get_current_glyph (); - if (zoom_area_begin_x > 0) {- g = MainWindow.get_current_glyph ();+ if (g.zoom_area_is_visible) { g.show_zoom_area (zoom_area_begin_x, zoom_area_begin_y, x, y); } });@@ -54,7 +55,7 @@ public class ZoomTool : Tool { release_action.connect((self, b, x, y) => { Glyph g; - if (b == 1 && KeyBindings.modifier != CTRL) {+ if (b == 1 && !KeyBindings.has_ctrl () && !KeyBindings.has_shift ()) { store_current_view (); g = MainWindow.get_current_glyph ();@@ -65,6 +66,7 @@ public class ZoomTool : Tool { g.set_zoom_from_area (); } + g.zoom_area_is_visible = false; zoom_area_begin_x = -1; zoom_area_begin_y = -1; }@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ -VERSION = '2.16.0'+VERSION = '2.16.1' SO_VERSION_MAJOR = '36' SO_VERSION_MINOR = '0' SO_VERSION = SO_VERSION_MAJOR + '.' + SO_VERSION_MINOR