Commit 06a43b6
Hide stroke and grid tools in toolbox
Changed files (6)
modifiedbirdfont/GtkWindow.valamodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/GridTool.valamodifiedlibbirdfont/LayerLabel.valamodifiedlibbirdfont/MenuTab.valamodifiedlibbirdfont/Tool.vala
Diff
@@ -802,7 +802,7 @@ class ToolboxCanvas : DrawingArea { add_events (EventMask.BUTTON_PRESS_MASK | EventMask.BUTTON_RELEASE_MASK | EventMask.POINTER_MOTION_MASK | EventMask.LEAVE_NOTIFY_MASK | EventMask.SCROLL_MASK); - set_size_request (170, 100);+ set_size_request (212, 100); leave_notify_event.connect ((t, e)=> { tb.reset_active_tool ();@@ -98,9 +98,9 @@ public class DrawingTools : ToolCollection { public ZoomBar zoom_bar; - Tool line_cap_butt;- Tool line_cap_round;- Tool line_cap_square;+ static Tool line_cap_butt;+ static Tool line_cap_round;+ static Tool line_cap_square; public DrawingTools (GlyphCanvas main_glyph_canvas) { bool selected_line;@@ -812,7 +812,7 @@ public class DrawingTools : ToolCollection { StrokeTool.stroke_width = object_stroke.get_value (); add_stroke.selected = StrokeTool.add_stroke;- + set_stroke_tool_visibility (); GlyphCanvas.redraw (); g.store_undo_state (); @@ -830,7 +830,8 @@ public class DrawingTools : ToolCollection { f = BirdFont.get_current_font (); f.settings.set_setting ("apply_stroke", @"$(StrokeTool.add_stroke)"); - add_stroke.selected = StrokeTool.add_stroke;+ stroke_expander.redraw ();+ MainWindow.get_toolbox ().update_expanders (); }); stroke_expander.add_tool (add_stroke); add_stroke.selected = StrokeTool.add_stroke;@@ -1048,8 +1049,13 @@ public class DrawingTools : ToolCollection { background_help_lines.set_selected (selected_line); guideline_tools.add_tool (background_help_lines); - Tool new_grid = new GridTool ("show_grid");- guideline_tools.add_tool (new_grid);+ Tool show_grid = new GridTool ("show_grid");+ show_grid.select_action.connect (() => {+ grid_expander.visible = show_grid.selected;+ MainWindow.get_toolbox ().update_expanders ();+ });+ guideline_tools.add_tool (show_grid);+ grid_expander.visible = false; // Zoom tools zoom_bar = new ZoomBar ();@@ -1219,6 +1225,7 @@ public class DrawingTools : ToolCollection { add_new_grid (4); MainWindow.get_toolbox ().move (0, 0);+ set_stroke_tool_visibility (); return false; });@@ -1248,6 +1255,7 @@ public class DrawingTools : ToolCollection { add_stroke.selected = stroke; StrokeTool.add_stroke = stroke;+ set_stroke_tool_visibility (); // FIXME: This is slow: Toolbox.redraw_tool_box (); } @@ -1600,6 +1608,15 @@ public class DrawingTools : ToolCollection { } } }+ + public static void set_stroke_tool_visibility () {+ object_stroke.visible = StrokeTool.add_stroke;+ line_cap_butt.visible = StrokeTool.add_stroke;+ line_cap_round.visible = StrokeTool.add_stroke;+ line_cap_square.visible = StrokeTool.add_stroke;+ MainWindow.get_toolbox ().update_expanders ();+ stroke_expander.redraw ();+ } } }@@ -22,7 +22,7 @@ class GridTool : Tool { static Gee.ArrayList<Line> horizontal; static Gee.ArrayList<Line> vertical; - static bool visible = false;+ static bool grid_visible = false; public static bool ttf_units = false; public static double size_x;@@ -50,16 +50,16 @@ class GridTool : Tool { update_lines (); select_action.connect((self) => {- visible = !visible;+ grid_visible = !grid_visible; update_lines (); GlyphCanvas.redraw (); - self.set_selected (visible);+ self.set_selected (grid_visible); Toolbox tb = MainWindow.get_toolbox (); Tool t = tb.get_tool ("help_lines"); - if (visible && !t.is_selected ()) {+ if (grid_visible && !t.is_selected ()) { MainWindow.get_toolbox ().select_tool (t); } });@@ -262,7 +262,7 @@ class GridTool : Tool { } public static bool is_visible () {- return visible;+ return grid_visible; } public static Gee.ArrayList<Line> get_horizontal_lines () {@@ -70,12 +70,13 @@ public class LayerLabel : Tool { // remove layer after the click loop IdleSource idle = new IdleSource (); - idle.set_callback (() => { + idle.set_callback (() => { Glyph g = MainWindow.get_current_glyph (); g.layers.remove_layer (layer); DrawingTools.update_layers (); BirdFont.get_current_font ().touch ();- MainWindow.get_current_glyph ().clear_active_paths ();+ g.clear_active_paths ();+ g.store_undo_state (); GlyphCanvas.redraw (); return false; });@@ -232,6 +232,8 @@ public class MenuTab : FontDisplay { } else if (lc == "round") { StrokeTool.line_cap = LineCap.ROUND; }+ + DrawingTools.set_stroke_tool_visibility (); } // FIXME: background thread@@ -77,7 +77,7 @@ public class Tool : Widget { bool showing_this_tooltip = false; static Tool active_tooltip = new Tool (); - bool visible = true;+ public bool visible = true; public bool is_tool_modifier = false; public string icon_color = "";