Clone in a terminal:
Commit 06a43b6
Johan Mattsson - 2015-06-04T09:43:24+00:00
06a43b6a090639b191ac97f4a1003f523bb48d85johan.mattsson.m@gmail.com

Hide stroke and grid tools in toolbox

Changed files (6)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex ceb45b8..98b03a9 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -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 ();diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex b769e82..449fd96 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -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 ();+	} }  }diff --git a/libbirdfont/GridTool.vala b/libbirdfont/GridTool.valaindex c3b7cb0..21abb5e 100644--- a/libbirdfont/GridTool.vala+++ b/libbirdfont/GridTool.vala@@ -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 () {diff --git a/libbirdfont/LayerLabel.vala b/libbirdfont/LayerLabel.valaindex 6fa9946..4c158c0 100644--- a/libbirdfont/LayerLabel.vala+++ b/libbirdfont/LayerLabel.vala@@ -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; 		});diff --git a/libbirdfont/MenuTab.vala b/libbirdfont/MenuTab.valaindex 7a1ff1e..24260a9 100644--- a/libbirdfont/MenuTab.vala+++ b/libbirdfont/MenuTab.vala@@ -232,6 +232,8 @@ public class MenuTab : FontDisplay { 		} else if (lc == "round") { 			StrokeTool.line_cap = LineCap.ROUND; 		}+		+		DrawingTools.set_stroke_tool_visibility (); 	} 	 	// FIXME: background threaddiff --git a/libbirdfont/Tool.vala b/libbirdfont/Tool.valaindex 74ec692..fed0573 100644--- a/libbirdfont/Tool.vala+++ b/libbirdfont/Tool.vala@@ -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 = "";

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112