Clone in a terminal:
Commit a6cb480
Johan Mattsson - 2013-07-02T17:03:28+00:00
a6cb48069f1b4b08988964181e16e39e37c48151johan.mattsson.m@gmail.com

update spin button with scroll wheel

Changed files (5)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex 8763fe3..2e62b71 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -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); diff --git a/layout/birdfont_logo.png b/layout/birdfont_logo.pngdeleted file mode 100644index 86b8c86..0000000Binary files a/layout/birdfont_logo.png and /dev/null differdiff --git a/libbirdfont/SpinButton.vala b/libbirdfont/SpinButton.valaindex f7cdac0..aaff7fc 100644--- a/libbirdfont/SpinButton.vala+++ b/libbirdfont/SpinButton.vala@@ -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) {diff --git a/libbirdfont/Tool.vala b/libbirdfont/Tool.valaindex ac51456..cf1291f 100644--- a/libbirdfont/Tool.vala+++ b/libbirdfont/Tool.vala@@ -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);diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex c8dcafb..39f3d0a 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -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"); 	}

Contact

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