Clone in a terminal:
Commit 1925a4f
Johan Mattsson - 2014-11-02T12:48:26+00:00
1925a4f1381a14a154617331471f998e9db46c40johan.mattsson.m@gmail.com

Display font name in tool box

Changed files (7)

Diff

diff --git a/icons/tool_button_deselected.png b/icons/tool_button_deselected.pngindex 88a331d..0b708b4 100644Binary files a/icons/tool_button_deselected.png and b/icons/tool_button_deselected.png differdiff --git a/icons/tool_button_deselected_active.png b/icons/tool_button_deselected_active.pngindex f4dd4ba..f8bb94b 100644Binary files a/icons/tool_button_deselected_active.png and b/icons/tool_button_deselected_active.png differdiff --git a/icons/tool_button_selected.png b/icons/tool_button_selected.pngindex 50748df..7a7ab0c 100644Binary files a/icons/tool_button_selected.png and b/icons/tool_button_selected.png differdiff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex 3c354b5..1b01efa 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -89,7 +89,8 @@ public class DrawingTools : ToolCollection  { 		 		draw_tools = new Expander (); 		shape_tools = new Expander ();-			+		+		Expander font_name = new Expander (); 		Expander path_tool_modifiers = new Expander (); 		Expander key_tools = new Expander (); 		Expander draw_tool_modifiers = new Expander ();@@ -103,6 +104,10 @@ public class DrawingTools : ToolCollection  { 		 		grid_expander = grid; +		// font name +		font_name.add_tool (new FontName ());+		font_name.draw_separator = false;+ 		// Draw tools 		foresight_tool = new ForesightTool ("foresight"); 		foresight_tool.select_action.connect ((self) => {@@ -1129,7 +1134,7 @@ public class DrawingTools : ToolCollection  { 			pen_tool.set_simplification_threshold (simplification_threshold.get_value ()); 		}); -		// selection policy	+		add_expander (font_name); 		add_expander (draw_tools); 		 		if (BirdFont.android) {diff --git a/libbirdfont/Expander.vala b/libbirdfont/Expander.valaindex c6b1799..4c0181d 100644--- a/libbirdfont/Expander.vala+++ b/libbirdfont/Expander.vala@@ -19,6 +19,8 @@ namespace BirdFont {  public class Expander : GLib.Object { 	+	public bool draw_separator { get; set; }+	 	public double x = 7; 	public double y = 5; 	public double scroll = 0;@@ -40,7 +42,8 @@ public class Expander : GLib.Object { 	double content_height = 0; 	 	public Expander () {-		tool = new Gee.ArrayList<Tool> ();	+		tool = new Gee.ArrayList<Tool> ();+		draw_separator = true; 	}  	public double get_content_height () {@@ -90,7 +93,10 @@ public class Expander : GLib.Object { 		}  		foreach (Tool t in tool) {-			if (t is KerningRange) {+			if (t is FontName) {+				t.w = Toolbox.allocation_width * scale;+				t.h = 20 * scale;+			} else if (t is KerningRange) { 				t.w = Toolbox.allocation_width * scale; 				t.h = 17 * scale;				 			} else {@@ -185,33 +191,35 @@ public class Expander : GLib.Object { 		double yt = y + scroll + 2; 		double ih2 = 5.4 / 2; 		double iw2 = 5.4 / 2;-				-		cr.save ();-		cr.set_line_width (0.5);-		cr.set_source_rgba (0, 0, 0, 0.25);-		cr.move_to (x, yt);-		cr.line_to (wd - w - x + 6, yt);	-		cr.stroke ();-		cr.restore ();-		-		// arrow-		cr.save ();-		cr.new_path ();-		cr.set_line_width (1);-		cr.set_source_rgba (0, 0, 0, opacity); 		-		cr.move_to (x - iw2 + 3, yt - ih2 - 0.7 + 1);-		cr.line_to (x + iw2 + 3, yt - ih2 - 0.7 + 1);-		cr.line_to (x + iw2, yt + 2 + 1);	+		if (draw_separator) {		+			cr.save ();+			cr.set_line_width (0.5);+			cr.set_source_rgba (0, 0, 0, 0.25);+			cr.move_to (x, yt);+			cr.line_to (wd - w - x + 6, yt);	+			cr.stroke ();+			cr.restore ();+			+			// arrow+			cr.save ();+			cr.new_path ();+			cr.set_line_width (1);+			cr.set_source_rgba (0, 0, 0, opacity);+			+			cr.move_to (x - iw2 + 3, yt - ih2 - 0.7 + 1);+			cr.line_to (x + iw2 + 3, yt - ih2 - 0.7 + 1);+			cr.line_to (x + iw2, yt + 2 + 1);	 -		cr.close_path();-		cr.stroke ();-		cr.restore ();+			cr.close_path();+			cr.stroke ();+			cr.restore ();+		} 	} 	 	public void draw_content (int w, int h, Context cr) { 		cr.save ();-		foreach (var t in tool) {+		foreach (Tool t in tool) { 			if (t.tool_is_visible ()) { 				t.draw (cr); 			}diff --git a/libbirdfont/TabBar.vala b/libbirdfont/TabBar.valaindex 0d31b91..64de802 100644--- a/libbirdfont/TabBar.vala+++ b/libbirdfont/TabBar.vala@@ -584,7 +584,7 @@ public class TabBar : GLib.Object { 		return_if_fail (next_tab != null); 		return_if_fail (progress != null); 		return_if_fail (tab_bar_background != null);-		+ 		cr.save (); 		cr.set_line_width (0); 		cr.set_source_rgba (background_r, background_g, background_b, 1);diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex 5c8fbda..79bd86d 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -417,7 +417,7 @@ public class Toolbox : GLib.Object  { 		if (BirdFont.android) { 			cr.set_source_rgba (222/255.0, 221/255.0, 222/255.0, 1); 		} else {-			cr.set_source_rgba (240/255.0, 240/255.0, 240/255.0, 1);+			cr.set_source_rgba (51/255.0, 54/255.0, 59/255.0, 1); 		} 		cr.fill (); 		

Contact

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