The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Tool tip for beziér tool modifiers

These changes was commited to the Birdfont repository Fri, 14 Aug 2015 15:57:49 +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>
Fri, 14 Aug 2015 15:57:49 +0000 (17:57 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Fri, 14 Aug 2015 15:58:21 +0000 (17:58 +0200)
commit fadd6b3f308bac8ffd00e932c32f3437666994ef
tree cb636c25aa622d31d0fd188658f4f070cff9f713
parent 137a0a38242b29053527952e41a863b5d23b2634
Tool tip for beziér tool modifiers

libbirdfont/BezierTool.vala
libbirdfont/HiddenTools.vala
libbirdfont/Tool.vala
libbirdfont/Toolbox.vala
--- a/libbirdfont/BezierTool.vala +++ b/libbirdfont/BezierTool.vala @@ -47,7 +47,7 @@ bool swap = false; public BezierTool (string name) { - base (name, t_ ("Create Beziér curves")); + base (name, ""); select_action.connect ((self) => { state = NONE; @@ -85,6 +85,24 @@ PenTool.draw_join_icon (cairo_context, last_x, last_y); } }); + } + + public override string get_tip () { + string tip = t_ ("Create Beziér curves") + "\n"; + + tip += HiddenTools.bezier_line.get_key_binding (); + tip += " - "; + tip += t_ ("line") + "\n"; + + tip += HiddenTools.bezier_corner.get_key_binding (); + tip += " - "; + tip += t_ ("corner") + "\n"; + + tip += HiddenTools.move_along_axis.get_key_binding (); + tip += " - "; + tip += t_ ("on axis") + "\n"; + + return tip; } public void press (int b, int x, int y) {
--- a/libbirdfont/HiddenTools.vala +++ b/libbirdfont/HiddenTools.vala @@ -21,6 +21,10 @@ public Gee.ArrayList<Expander> expanders; public Expander hidden_expander; + + public static Tool bezier_line; + public static Tool bezier_corner; + public static Tool move_along_axis; public HiddenTools () { hidden_expander = new Expander (); @@ -40,7 +44,7 @@ }); hidden_expander.add_tool (zoom_out); - Tool bezier_line = new Tool ("bezier_line", t_("Convert the last segment to a straight line")); + bezier_line = new Tool ("bezier_line", t_("Convert the last segment to a straight line")); bezier_line.select_action.connect ((self) => { DrawingTools.bezier_tool.switch_to_line_mode (); }); @@ -48,7 +52,7 @@ hidden_expander.add_tool (bezier_line); bezier_line.set_tool_visibility (false); - Tool bezier_corner = new Tool ("bezier_corner", t_("Convert the last control point to a corner node")); + bezier_corner = new Tool ("bezier_corner", t_("Convert the last control point to a corner node")); bezier_corner.select_action.connect ((self) => { DrawingTools.bezier_tool.create_corner (); }); @@ -56,7 +60,7 @@ hidden_expander.add_tool (bezier_corner); bezier_corner.set_tool_visibility (false); - Tool move_along_axis = new Tool ("bezier", t_("Move handle along axis")); + move_along_axis = new Tool ("bezier", t_("Move handle along axis")); move_along_axis.select_action.connect ((self) => { Tool t = MainWindow.get_toolbox ().get_current_tool (); if (t is BezierTool) {
--- a/libbirdfont/Tool.vala +++ b/libbirdfont/Tool.vala @@ -126,6 +126,10 @@ } return false; }); + } + + public virtual string get_tip () { + return tip; } public override void draw (Context cr) { @@ -170,7 +174,7 @@ waiting_for_tooltip = true; timer_show = new TimeoutSource (timeout_interval); timer_show.set_callback (() => { - if (tip != "" && active_tooltip.is_active () && !active_tooltip.showing_this_tooltip) { + if (get_tip () != "" && active_tooltip.is_active () && !active_tooltip.showing_this_tooltip) { show_tooltip (); } waiting_for_tooltip = false; @@ -205,7 +209,7 @@ active_tooltip.showing_this_tooltip = true; - tip = @"$(active_tooltip.tip)"; + tip = @"$(active_tooltip.get_tip ())"; key_binding = active_tooltip.get_key_binding (); if (key_binding != "") { @@ -262,10 +266,6 @@ public bool is_selected () { return selected; - } - - public string get_tip () { - return tip; } public new bool is_over (double xp, double yp) {
--- a/libbirdfont/Toolbox.vala +++ b/libbirdfont/Toolbox.vala @@ -504,6 +504,10 @@ t.widget_x = 10 * get_scale (); t.widget_y = tool_tip_y - t.height - 5 * get_scale (); + + if (t.widget_y < 5) { + t.widget_y = 5; + } t.draw (cr); }