The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix background tools selection

These changes was commited to the Birdfont repository Thu, 10 Dec 2015 04:21:36 +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>
Thu, 10 Dec 2015 04:21:36 +0000 (05:21 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Thu, 10 Dec 2015 04:21:36 +0000 (05:21 +0100)
commit 846483567d2db14066e070902a0c5db597a712b6
tree 72be208460ec17815eced5627a2968e00aa01d42
parent 815d47d945dd46ef3eba96ce0db7882715563ea5
Fix background tools selection

libbirdfont/BackgroundImage.vala
libbirdfont/BackgroundTools.vala
libbirdfont/DrawingTools.vala
--- a/libbirdfont/BackgroundImage.vala +++ b/libbirdfont/BackgroundImage.vala @@ -366,7 +366,6 @@ if (get_img_rotation_from_coordinate (x, y, out rotation)) { img_rotation = rotation; backgounds = get_image (); - double view_zoom = MainWindow.get_current_glyph ().view_zoom; ImageSurface rotated; img_rotation = rotation;
--- a/libbirdfont/BackgroundTools.vala +++ b/libbirdfont/BackgroundTools.vala @@ -40,17 +40,22 @@ parts.set_unique (true); background_tools.add_tool (select_background); + select_background.select_action.connect (update_tool_selection); + + background_tools.add_tool (DrawingTools.move_background); + DrawingTools.move_background.select_action.connect (update_tool_selection); + background_tools.add_tool (DrawingTools.move_canvas); + DrawingTools.move_canvas.select_action.connect (update_tool_selection); + + background_tools.add_tool (DrawingTools.background_scale); + LabelTool add_new_image = new LabelTool (t_("Add")); add_new_image.select_action.connect ((t) => { load_image (); }); background_selection.add_tool (add_new_image); - - background_tools.add_tool (DrawingTools.move_background); - background_tools.add_tool (DrawingTools.move_canvas); - background_tools.add_tool (DrawingTools.background_scale); - + expanders.add (font_name); expanders.add (background_tools); expanders.add (DrawingTools.zoombar_tool); @@ -58,6 +63,14 @@ expanders.add (background_selection); expanders.add (files); expanders.add (parts); + } + + public void update_tool_selection (Tool selected) { + select_background.set_selected (false); + DrawingTools.move_background.set_selected (false); + DrawingTools.move_canvas.set_selected (false); + DrawingTools.background_scale.set_selected (false); + selected.set_selected (true); } public void remove_images () {
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -1376,8 +1376,6 @@ idle.set_callback (() => { Glyph g = MainWindow.get_current_glyph (); - - hide_all_modifiers (); foreach (Tool t in draw_tools.tool) { if (t != current_tool) { @@ -1385,6 +1383,13 @@ } } + FontDisplay display = MainWindow.get_current_display (); + + if (display.get_name () == "Backgrounds") { + return false; + } + + hide_all_modifiers (); cut_background.set_selected (false); bezier_tool.set_selected (false);