Commit a6cb480
update spin button with scroll wheel
Changed files (5)
modifiedbirdfont/GtkWindow.valadeletedlayout/birdfont_logo.pngmodifiedlibbirdfont/SpinButton.valamodifiedlibbirdfont/Tool.valamodifiedlibbirdfont/Toolbox.vala
Diff
@@ -408,7 +408,7 @@ public class GtkWindow : Gtk.Window, NativeWindow { preview_item.activate.connect (() => { MenuTab.preview (); }); preview_item.add_accelerator ("activate", accel_group, 'P', Gdk.ModifierType.CONTROL_MASK, Gtk.AccelFlags.VISIBLE); - Gtk.MenuItem description_item = new Gtk.MenuItem.with_mnemonic(_("_Description"));+ Gtk.MenuItem description_item = new Gtk.MenuItem.with_mnemonic(_("Name and _description")); file_menu.append (description_item); description_item.activate.connect (() => { MenuTab.show_description (); }); @@ -804,8 +804,17 @@ class ToolboxCanvas : DrawingArea { return true; });++ scroll_event.connect ((t, e)=> {+ if (e.direction == Gdk.ScrollDirection.UP) {+ tb.scroll_up (e.x, e.y);+ } else if (e.direction == Gdk.ScrollDirection.DOWN) {+ tb.scroll_down (e.x, e.y);+ } + return true;+ }); - add_events (EventMask.BUTTON_PRESS_MASK | EventMask.BUTTON_RELEASE_MASK | EventMask.POINTER_MOTION_MASK | EventMask.LEAVE_NOTIFY_MASK);+ add_events (EventMask.BUTTON_PRESS_MASK | EventMask.BUTTON_RELEASE_MASK | EventMask.POINTER_MOTION_MASK | EventMask.LEAVE_NOTIFY_MASK | EventMask.SCROLL_MASK); set_size_request (160, 100); deleted file mode 100644Binary files a/layout/birdfont_logo.png and /dev/null differ@@ -87,6 +87,14 @@ public class SpinButton : Tool { panel_release_action.connect ((selected, button, tx, ty) => { value_from_motion = false; });+ + scroll_wheel_up_action.connect ((selected) => {+ increase ();+ });++ scroll_wheel_down_action.connect ((selected) => {+ decrease ();+ }); } public void set_max (double max) {@@ -53,6 +53,8 @@ public class Tool : GLib.Object { public signal void double_click_action (Tool selected, int button, int x, int y); public signal void move_action (Tool selected, int x, int y); public signal void release_action (Tool selected, int button, int x, int y);+ public signal void scroll_wheel_up_action (Tool selected);+ public signal void scroll_wheel_down_action (Tool selected); public signal void key_press_action (Tool selected, uint32 keyval); public signal void key_release_action (Tool selected, uint32 keyval);@@ -675,7 +675,29 @@ public class Toolbox : GLib.Object { } } }- ++ public void scroll_up (double x, double y) {+ foreach (var exp in expanders) {+ foreach (Tool t in exp.tool) {+ if (t.is_over (x, y)) {+ t.scroll_wheel_up_action (t);+ press_tool = t;+ }+ }+ }+ }++ public void scroll_down (double x, double y) {+ foreach (var exp in expanders) {+ foreach (Tool t in exp.tool) {+ if (t.is_over (x, y)) {+ t.scroll_wheel_down_action (t);+ press_tool = t;+ }+ }+ }+ }+ private void select_draw_tool () { select_tool_by_name ("pen_tool"); }