The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Scroll wheel on Mac OS X

These changes was commited to the Birdfont repository Mon, 15 Jun 2015 16:16:11 +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>
Mon, 15 Jun 2015 16:16:11 +0000 (18:16 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Mon, 15 Jun 2015 16:16:11 +0000 (18:16 +0200)
commit 04ead2384539213db26fbbfbc5cfb94630a29af8
tree 234cdc1c534b9cdce510a746cf1dc0434a4a48d7
parent e147293b45c01d5d5eceba16347a46ac68a80b71
Scroll wheel on Mac OS X

libbirdfont/DrawingTools.vala
libbirdfont/FontDisplay.vala
libbirdfont/Glyph.vala
libbirdfont/OverView.vala
libbirdfont/SettingsDisplay.vala
libbirdfont/TabContent.vala
libbirdfont/Table.vala
libbirdfont/TableLayout.vala
--- a/libbirdfont/DrawingTools.vala +++ b/libbirdfont/DrawingTools.vala @@ -1386,7 +1386,8 @@ hide_all_modifiers (); foreach (Tool t in draw_tools.tool) { - t.set_selected (false); + // FIXME: infinite loop on Mac OS + // t.set_selected (false); } cut_background.set_selected (false);
--- a/libbirdfont/FontDisplay.vala +++ b/libbirdfont/FontDisplay.vala @@ -104,9 +104,9 @@ d = y - last_tap_y; if (last_tap_y > -1 && fabs (d) > 15) { // FIXME: pixels, other units are better if (d > 0) { - scroll_wheel_up (x, y); + scroll_wheel_up (x, y, 15); } else { - scroll_wheel_down (x, y); + scroll_wheel_down (x, y, 15); } } @@ -141,10 +141,10 @@ public virtual void next_view () { } - public virtual void scroll_wheel_up (double x, double y) { + public virtual void scroll_wheel_up (double x, double y, double pixeldelta) { } - public virtual void scroll_wheel_down (double x, double y) { + public virtual void scroll_wheel_down (double x, double y, double pixeldelta) { } public virtual void undo () {
--- a/libbirdfont/Glyph.vala +++ b/libbirdfont/Glyph.vala @@ -375,25 +375,25 @@ return background_image; } - public override void scroll_wheel_up (double x, double y) { + public override void scroll_wheel_up (double x, double y, double pixeldelta) { if (KeyBindings.has_alt ()) { zoom_in_at_point (x, y); } else if (KeyBindings.has_ctrl ()) { - view_offset_x -= 10 / view_zoom; + view_offset_x -= pixeldelta / view_zoom; } else { - view_offset_y -= 10 / view_zoom; + view_offset_y -= pixeldelta / view_zoom; } redraw_area (0, 0, allocation.width, allocation.height); } - public override void scroll_wheel_down (double x, double y) { + public override void scroll_wheel_down (double x, double y, double pixeldelta) { if (KeyBindings.has_alt ()) { zoom_out_at_point (x, y); } else if (KeyBindings.has_ctrl ()) { - view_offset_x += 10 / view_zoom; + view_offset_x -= pixeldelta / view_zoom; } else { - view_offset_y += 10 / view_zoom; + view_offset_y -= pixeldelta / view_zoom; } redraw_area (0, 0, allocation.width, allocation.height);
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -266,7 +266,7 @@ return true; } - public override void scroll_wheel_up (double x, double y) { + public override void scroll_wheel_up (double x, double y, double pixeldelta) { key_up (); update_scrollbar (); GlyphCanvas.redraw (); @@ -279,7 +279,7 @@ } } - public override void scroll_wheel_down (double x, double y) { + public override void scroll_wheel_down (double x, double y, double pixeldelta) { key_down (); update_scrollbar (); GlyphCanvas.redraw ();
--- a/libbirdfont/SettingsDisplay.vala +++ b/libbirdfont/SettingsDisplay.vala @@ -219,7 +219,7 @@ return true; } - public override void scroll_wheel_down (double x, double y) { + public override void scroll_wheel_down (double x, double y, double pixeldelta) { foreach (SettingsItem s in tools) { if (s.handle_events && s.button != null) { if (((!) s.button).is_over (x, y)) { @@ -239,7 +239,7 @@ GlyphCanvas.redraw (); } - public override void scroll_wheel_up (double x, double y) { + public override void scroll_wheel_up (double x, double y, double pixeldelta) { foreach (SettingsItem s in tools) { if (s.handle_events && s.button != null) { if (((!) s.button).is_over (x, y)) {
--- a/libbirdfont/TabContent.vala +++ b/libbirdfont/TabContent.vala @@ -202,13 +202,27 @@ } } + public static void scroll_wheel_pixel_delta (double x, double y, double pixeldelta) { + if (MenuTab.suppress_event) { + return; + } + + if (!MainWindow.get_menu ().show_menu) { + if (pixeldelta < 0) { + GlyphCanvas.current_display.scroll_wheel_up (x, y, pixeldelta); + } else { + GlyphCanvas.current_display.scroll_wheel_down (x, y, pixeldelta); + } + } + } + public static void scroll_wheel_up (double x, double y) { if (MenuTab.suppress_event) { return; } if (!MainWindow.get_menu ().show_menu) { - GlyphCanvas.current_display.scroll_wheel_up (x, y); + GlyphCanvas.current_display.scroll_wheel_up (x, y, 15); } } @@ -218,7 +232,7 @@ } if (!MainWindow.get_menu ().show_menu) { - GlyphCanvas.current_display.scroll_wheel_down (x, y); + GlyphCanvas.current_display.scroll_wheel_down (x, y, 15); } }
--- a/libbirdfont/Table.vala +++ b/libbirdfont/Table.vala @@ -210,7 +210,7 @@ return true; } - public override void scroll_wheel_down (double x, double y) { + public override void scroll_wheel_down (double x, double y, double pixeldelta) { scroll += 30 * MainWindow.units; if (scroll > page_height - allocation.height) { @@ -225,7 +225,7 @@ redraw_area (0, 0, allocation.width, allocation.height); } - public override void scroll_wheel_up (double x, double y) { + public override void scroll_wheel_up (double x, double y, double pixeldelta) { scroll -= 30 * MainWindow.units; if (scroll < 0) {
--- a/libbirdfont/TableLayout.vala +++ b/libbirdfont/TableLayout.vala @@ -211,7 +211,7 @@ return true; } - public override void scroll_wheel_down (double x, double y) { + public override void scroll_wheel_down (double x, double y, double pixeldelta) { scroll += 25 * MainWindow.units; if (scroll + allocation.height >= content_height) { @@ -226,7 +226,7 @@ GlyphCanvas.redraw (); } - public override void scroll_wheel_up (double x, double y) { + public override void scroll_wheel_up (double x, double y, double pixeldelta) { scroll -= 25 * MainWindow.units; if (scroll < 0) {