Commit 1925a4f
Display font name in tool box
Changed files (7)
modifiedicons/tool_button_deselected.pngmodifiedicons/tool_button_deselected_active.pngmodifiedicons/tool_button_selected.pngmodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Expander.valamodifiedlibbirdfont/TabBar.valamodifiedlibbirdfont/Toolbox.vala
Diff
Binary files a/icons/tool_button_deselected.png and b/icons/tool_button_deselected.png differBinary files a/icons/tool_button_deselected_active.png and b/icons/tool_button_deselected_active.png differBinary files a/icons/tool_button_selected.png and b/icons/tool_button_selected.png differ@@ -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) {@@ -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); }@@ -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);@@ -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 ();