Clone in a terminal:
Commit ad96b82
Johan Mattsson - 2015-03-06T13:50:53+00:00
ad96b822ce334e250ff0f708da3292af91caf1eejohan.mattsson.m@gmail.com

Fix key bingings for zoom and move in edit view alt+scroll - zoom space+click - move

Changed files (4)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex c423b64..7369893 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -853,8 +853,6 @@ public class GlyphCanvasArea : DrawingArea  { 		});  		button_press_event.connect ((t, e)=> {-			set_modifier ((int) e.state);-			 			if (e.type == EventType.BUTTON_PRESS) { 				TabContent.button_press (e.button, e.x, e.y);	 			} else if (e.type == EventType.2BUTTON_PRESS) {@@ -865,7 +863,6 @@ public class GlyphCanvasArea : DrawingArea  { 		}); 		 		button_release_event.connect ((t, e)=> {-			set_modifier ((int) e.state); 			TabContent.button_release ((int) e.button, e.x, e.y); 			return true; 		});@@ -876,8 +873,6 @@ public class GlyphCanvasArea : DrawingArea  { 		}); 		 		scroll_event.connect ((t, e)=> {-			set_modifier ((int) e.state);-			 			if (e.direction == Gdk.ScrollDirection.UP) { 				TabContent.scroll_wheel_up (e.x, e.y); 			} else if (e.direction == Gdk.ScrollDirection.DOWN) {@@ -890,20 +885,6 @@ public class GlyphCanvasArea : DrawingArea  { 		 		can_focus = true; 	}--	static void set_modifier (int k) {-		KeyBindings.set_modifier (NONE);--		if (has_flag (k, ModifierType.SHIFT_MASK)) {-			KeyBindings.set_modifier (SHIFT);-		} else if (has_flag (k, ModifierType.CONTROL_MASK)) {-			KeyBindings.set_modifier (CTRL);-		} else if (has_flag (k, ModifierType.CONTROL_MASK | ModifierType.SHIFT_MASK)) {-			KeyBindings.set_modifier (SHIFT | CTRL);-		} else if (has_flag (k, ModifierType.MOD5_MASK)) {-			KeyBindings.set_modifier (LOGO);-		}-	} }  public class DescriptionForm : GLib.Object {diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 175cb7a..c377254 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -63,6 +63,7 @@ public class Glyph : FontDisplay { 	bool view_is_moving = false; 	public double move_offset_x = 0; 	public double move_offset_y = 0;+	bool move_canvas = false;  	public WidgetAllocation allocation = new WidgetAllocation (); @@ -332,9 +333,9 @@ public class Glyph : FontDisplay { 	} 		 	public override void scroll_wheel_up (double x, double y) {-		if (KeyBindings.has_ctrl ()) {+		if (KeyBindings.has_alt ()) { 			zoom_in_at_point (x, y);-		} else if (KeyBindings.has_alt ()) { +		} else if (KeyBindings.has_ctrl ()) {  			view_offset_x -= 10 / view_zoom; 		} else { 			view_offset_y -= 10 / view_zoom;@@ -344,9 +345,9 @@ public class Glyph : FontDisplay { 	} 	 	public override void scroll_wheel_down (double x, double y) {-		if (KeyBindings.has_ctrl ()) {+		if (KeyBindings.has_alt ()) { 			zoom_out_at_point (x, y);-		} else	if (KeyBindings.has_alt ()) { +		} else	if (KeyBindings.has_ctrl ()) {  			view_offset_x += 10 / view_zoom; 		} else { 			view_offset_y += 10 / view_zoom;@@ -644,12 +645,20 @@ public class Glyph : FontDisplay { 		Tool t; 		t = MainWindow.get_toolbox ().get_current_tool (); 		t.key_release_action (t, keyval);++		if (keyval == (uint)' ') {+			move_canvas = false;+		} 	}  	public override void key_press (uint keyval) {	 		Tool t = MainWindow.get_toolbox ().get_current_tool (); 		t.key_press_action (t, keyval); 		+		if (keyval == (uint)' ') {+			move_canvas = true;+		}+ 		switch (keyval) { 			case Key.NUM_PLUS: 				zoom_in ();@@ -789,7 +798,7 @@ public class Glyph : FontDisplay { 			return; 		} 			-		if (KeyBindings.has_ctrl () || DrawingTools.move_canvas.is_selected ()) {+		if (move_canvas || DrawingTools.move_canvas.is_selected ()) { 			view_is_moving = true; 			move_offset_x = view_offset_x; 			move_offset_y = view_offset_y;diff --git a/libbirdfont/KeyBindings.vala b/libbirdfont/KeyBindings.valaindex 1938a0b..55f9aa6 100644--- a/libbirdfont/KeyBindings.vala+++ b/libbirdfont/KeyBindings.vala@@ -114,7 +114,7 @@ public class KeyBindings { 	}  	public static uint get_mod_from_key (uint keyval) {-		uint mod = 0;+		uint mod = NONE; 		mod |= (keyval == Key.CTRL_RIGHT || keyval == Key.CTRL_LEFT) ? CTRL : 0; 		mod |= (keyval == Key.SHIFT_RIGHT || keyval == Key.SHIFT_LEFT) ? SHIFT : 0; 		mod |= (keyval == Key.ALT_LEFT || keyval == Key.ALT_GR) ? ALT : 0;diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex a68018b..99affee 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -163,7 +163,6 @@ public class PenTool : Tool { 			y = Glyph.path_coordinate_y (iy); 						 			if (has_join_icon ()) {-				print ("merge in pen_tool\n"); 				join_paths (x, y); 			} 

Contact

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