Commit 04ead23
Scroll wheel on Mac OS X
Changed files (8)
modifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/FontDisplay.valamodifiedlibbirdfont/Glyph.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/SettingsDisplay.valamodifiedlibbirdfont/TabContent.valamodifiedlibbirdfont/Table.valamodifiedlibbirdfont/TableLayout.vala
Diff
@@ -1386,7 +1386,8 @@ public class DrawingTools : ToolCollection { 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);@@ -104,9 +104,9 @@ public abstract class FontDisplay : GLib.Object { 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 abstract class FontDisplay : GLib.Object { 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 () {@@ -375,25 +375,25 @@ public class Glyph : FontDisplay { 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);@@ -266,7 +266,7 @@ public class OverView : FontDisplay { 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 class OverView : FontDisplay { } } - 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 ();@@ -219,7 +219,7 @@ public abstract class SettingsDisplay : FontDisplay { 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 @@ public abstract class SettingsDisplay : FontDisplay { 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)) {@@ -202,13 +202,27 @@ public class TabContent : GLib.Object { } } + 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 @@ public class TabContent : GLib.Object { } if (!MainWindow.get_menu ().show_menu) {- GlyphCanvas.current_display.scroll_wheel_down (x, y);+ GlyphCanvas.current_display.scroll_wheel_down (x, y, 15); } } @@ -210,7 +210,7 @@ public abstract class Table : FontDisplay { 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 @@ public abstract class Table : FontDisplay { 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) {@@ -211,7 +211,7 @@ public class TableLayout : FontDisplay { 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 @@ public class TableLayout : FontDisplay { 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) {