Clone in a terminal:
Commit 684fde4
Johan Mattsson - 2016-06-14T13:44:13+00:00
684fde4a803662ebacd724f8ef3693256a3a95bbjohan.mattsson.m@gmail.com

Hide resize handle when objects are moved and merge birdfont-2.x

Changed files (10)

Diff

diff --git a/libbirdfont/AbstractMenu.vala b/libbirdfont/AbstractMenu.valaindex ca31619..a76c483 100644--- a/libbirdfont/AbstractMenu.vala+++ b/libbirdfont/AbstractMenu.vala@@ -75,7 +75,8 @@ public class AbstractMenu : GLib.Object { 		return null; 	} -	public void process_key_binding_events (uint keyval) {+	/** @return true if the keybindings consumes the event. */+	public bool process_key_binding_events (uint keyval) { 		string display; 		FontDisplay current_display = MainWindow.get_current_display (); 		ToolItem tm;@@ -96,7 +97,7 @@ public class AbstractMenu : GLib.Object { 					if (!SettingsDisplay.update_key_bindings  						&& !(item is ToolItem)) { 						item.action ();-						return;+						return true; 					} 					 					if (item is ToolItem) {@@ -106,16 +107,18 @@ public class AbstractMenu : GLib.Object { 							if (tm.tool.editor_events) { 								MainWindow.get_toolbox ().set_current_tool (tm.tool); 								tm.tool.select_action (tm.tool);-								return;+								return true; 							} else { 								tm.tool.select_action (tm.tool);								-								return;+								return true; 							} 						} 					} 				} 			} 		}+		+		return false; 	}  	public void load_key_bindings () {diff --git a/libbirdfont/AlternateSets.vala b/libbirdfont/AlternateSets.valaindex 871c1a0..637e3f6 100644--- a/libbirdfont/AlternateSets.vala+++ b/libbirdfont/AlternateSets.vala@@ -51,7 +51,30 @@ public class AlternateSets : GLib.Object { 		 		return alt; 	}-	++	public Gee.ArrayList<Alternate> get_alt_with_glyph (string tag, Font font) {	+		Gee.ArrayList<Alternate> alt;+		alt = new Gee.ArrayList<Alternate> ();+		+		foreach (Alternate a in alternates) {+			Alternate available = new Alternate (a.glyph_name, a.tag);+			+			foreach (string substitution in a.alternates) {+				if (font.has_glyph (substitution)) {+					available.alternates.add (substitution);+				}+			}+			+			if (available.tag == tag && available.alternates.size > 0) {+				if (font.has_glyph (available.glyph_name)) {+					alt.add (available);+				}+			}+		}+		+		return alt;+	}+		 	public void remove_empty_sets () { 		int i = 0; 		foreach (Alternate a in alternates) {diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex b6d3912..fc9ac2c 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -1142,19 +1142,9 @@ public class Glyph : FontDisplay { 	}  	public void show_zoom_area (int sx, int sy, int nx, int ny) {-		double x, y, w, h;- 		set_zoom_area (sx, sy, nx, ny);- 		zoom_area_is_visible = true;--		x = Math.fmin (zoom_x1, zoom_x2) - 50;-		y = Math.fmin (zoom_y1, zoom_y2) - 50;--		w = Math.fabs (zoom_x1 - zoom_x2) + 100;-		h = Math.fabs (zoom_y1 - zoom_y2) + 100;--		redraw_area ((int)x, (int)y, (int)w, (int)h);+		GlyphCanvas.redraw (); 	}  	public void set_zoom_area (int sx, int sy, int nx, int ny) {diff --git a/libbirdfont/OpenFontFormat/AlternateFeature.vala b/libbirdfont/OpenFontFormat/AlternateFeature.valaindex 0a40223..9434b7a 100644--- a/libbirdfont/OpenFontFormat/AlternateFeature.vala+++ b/libbirdfont/OpenFontFormat/AlternateFeature.vala@@ -24,7 +24,7 @@ public class AlternateFeature : GLib.Object { 		 		this.tag = tag; 		this.glyf_table = glyf_table;-		alternates = font.alternates.get_alt (tag);+		alternates = font.alternates.get_alt_with_glyph (tag, font);  		alternates.sort ((a, b) => { 			Alternate alt1 = (Alternate) a;diff --git a/libbirdfont/OtfFeatureTable.vala b/libbirdfont/OtfFeatureTable.valaindex c8873e7..8669ec7 100644--- a/libbirdfont/OtfFeatureTable.vala+++ b/libbirdfont/OtfFeatureTable.vala@@ -53,7 +53,8 @@ public class OtfFeatureTable : Table { 			GlyphSelection gs = new GlyphSelection (); 			 			gs.selected_glyph.connect ((gc) => {-				glyph_collection = gc;		+				glyph_collection = gc;+				replacement_glyph = null;		 				MainWindow.get_tab_bar ().select_tab_name (get_name ()); 			}); 			diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex 951540f..4313a3d 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -94,15 +94,13 @@ public class OverView : FontDisplay { 				TabBar tabs = MainWindow.get_tab_bar (); 				string n = glyph_collection.get_current ().name; 				bool selected = tabs.select_char (n);-				GlyphCanvas canvas;+ 				GlyphTab glyph_tab; 				 				if (!selected) { 					glyph_tab = new GlyphTab (glyph_collection);-					canvas = MainWindow.get_glyph_canvas (); 					tabs.add_tab (glyph_tab, true, glyph_collection);-					canvas.set_current_glyph_collection (glyph_collection);-					set_initial_zoom ();+					set_glyph_zoom (glyph_collection); 					PenTool.update_orientation (); 				} 				@@ -203,7 +201,7 @@ public class OverView : FontDisplay { 			canvas = MainWindow.get_glyph_canvas (); 			canvas.set_current_glyph_collection (glyph_collection); 			-			set_initial_zoom ();+			set_glyph_zoom (glyph_collection); 		} else { 			warning ("Glyph is already open"); 		}@@ -291,15 +289,18 @@ public class OverView : FontDisplay { 		return null; 	} 	-	public void set_initial_zoom () {+	public void set_glyph_zoom (GlyphCollection glyphs) {+		GlyphCanvas canvas;+		canvas = MainWindow.get_glyph_canvas ();+		canvas.set_current_glyph_collection (glyphs); 		Toolbox tools = MainWindow.get_toolbox (); 		ZoomTool z = (ZoomTool) tools.get_tool ("zoom_tool"); 		z.store_current_view ();-		MainWindow.get_current_glyph ().default_zoom ();+		glyphs.get_current ().default_zoom (); 		z.store_current_view (); 		OverViewItem.reset_label (); 	}-+	 	public double get_height () { 		double l; 		Font f;@@ -1072,6 +1073,16 @@ public class OverView : FontDisplay { 			if (g.length () > 0) { 				font.add_glyph_collection (g); 			}++			TabBar tabs = MainWindow.get_tab_bar ();+			Tab? tab = tabs.get_tab (g.get_name ());+			+			if (tab != null) {+				Tab t = (!) tab;+				set_glyph_zoom (g);+				t.set_glyph_collection (g);+				t.set_display (new GlyphTab (g));+			} 		} 		 		Font f = BirdFont.get_current_font ();@@ -1096,6 +1107,16 @@ public class OverView : FontDisplay { 		foreach (GlyphCollection g in previous_collection.glyphs) { 			font.delete_glyph (g); 			font.add_glyph_collection (g);++			TabBar tabs = MainWindow.get_tab_bar ();+			Tab? tab = tabs.get_tab (g.get_name ());+			+			if (tab != null) {+				Tab t = (!) tab;+				set_glyph_zoom (g);+				t.set_glyph_collection (g);+				t.set_display (new GlyphTab (g));+			} 		} 		font.alternates = previous_collection.alternate_sets.copy (); diff --git a/libbirdfont/ResizeTool.vala b/libbirdfont/ResizeTool.valaindex 420b114..1a67b82 100644--- a/libbirdfont/ResizeTool.vala+++ b/libbirdfont/ResizeTool.vala@@ -165,36 +165,38 @@ public class ResizeTool : Tool { 			Text handle; 			Glyph g = MainWindow.get_current_glyph (); 			-			if (!rotate_path) {-				if (!resize_width) {-					handle = proportional_handle;-					get_resize_handle_position (out handle.widget_x, out handle.widget_y);+			if (!move_paths) {+				if (!rotate_path) {+					if (!resize_width) {+						handle = proportional_handle;+						get_resize_handle_position (out handle.widget_x, out handle.widget_y);+						+						handle.widget_x -= handle.get_sidebearing_extent () / 2;+						handle.widget_y -= handle.get_height () / 2;+						+						handle.draw (cr);+					}  					-					handle.widget_x -= handle.get_sidebearing_extent () / 2;-					handle.widget_y -= handle.get_height () / 2;-					-					handle.draw (cr);-				} -				-				if (!resize_path_proportional) {-					handle = horizontal_handle;-					-					get_horizontal_reseize_handle_position (out handle.widget_x, -						out handle.widget_y);-					-					handle.widget_x -= handle.get_sidebearing_extent () / 2;-					handle.widget_y -= handle.get_height () / 2;-					-					handle.draw (cr);+					if (!resize_path_proportional) {+						handle = horizontal_handle;+						+						get_horizontal_reseize_handle_position (out handle.widget_x, +							out handle.widget_y);+						+						handle.widget_x -= handle.get_sidebearing_extent () / 2;+						handle.widget_y -= handle.get_height () / 2;+						+						handle.draw (cr);+					} 				}-			} -			if (!resize_path_proportional && !resize_width -				&& g.active_paths.size > 0) {-				-				draw_rotate_handle (cr);+				if (!resize_path_proportional && !resize_width +					&& g.active_paths.size > 0) {+					+					draw_rotate_handle (cr);+				} 			}-		+			 			MoveTool.draw_actions (cr); 		}); 		diff --git a/libbirdfont/TabContent.vala b/libbirdfont/TabContent.valaindex 89b0789..0bd1013 100644--- a/libbirdfont/TabContent.vala+++ b/libbirdfont/TabContent.vala@@ -150,8 +150,12 @@ public class TabContent : GLib.Object { 		KeyBindings.add_modifier_from_keyval (keyval);  		if (!text_input_visible) {-			MainWindow.get_menu ().process_key_binding_events (keyval);-			GlyphCanvas.current_display.key_press (keyval);+			AbstractMenu menu = MainWindow.get_menu ();+			bool consumed = menu.process_key_binding_events (keyval);+			+			if (!consumed) {+				GlyphCanvas.current_display.key_press (keyval);+			} 		} else { 			text_input.key_press (keyval); 		}diff --git a/libbirdfont/ZoomTool.vala b/libbirdfont/ZoomTool.valaindex 511fb50..7b407f1 100644--- a/libbirdfont/ZoomTool.vala+++ b/libbirdfont/ZoomTool.vala@@ -36,17 +36,18 @@ public class ZoomTool : Tool { 		}); 			 		press_action.connect((self, b, x, y) => {-			if (b == 1 && KeyBindings.modifier != CTRL) {+			if (b == 1 && !KeyBindings.has_ctrl () && !KeyBindings.has_shift ()) { 				zoom_area_begin_x = x; 				zoom_area_begin_y = y;+				Glyph g = MainWindow.get_current_glyph ();+				g.zoom_area_is_visible = true; 			} 		});  		move_action.connect((self, x, y) => {-			Glyph g;+			Glyph g = MainWindow.get_current_glyph (); 			-			if (zoom_area_begin_x > 0) {-				g = MainWindow.get_current_glyph ();+			if (g.zoom_area_is_visible) { 				g.show_zoom_area (zoom_area_begin_x, zoom_area_begin_y, x, y); 			} 		});@@ -54,7 +55,7 @@ public class ZoomTool : Tool { 		release_action.connect((self, b, x, y) => { 			Glyph g; 						-			if (b == 1 && KeyBindings.modifier != CTRL) {+			if (b == 1 && !KeyBindings.has_ctrl () && !KeyBindings.has_shift ()) { 				store_current_view (); 				 				g =	MainWindow.get_current_glyph ();@@ -65,6 +66,7 @@ public class ZoomTool : Tool { 					g.set_zoom_from_area (); 				} 				+				g.zoom_area_is_visible = false; 				zoom_area_begin_x = -1; 				zoom_area_begin_y = -1; 			}diff --git a/scripts/version.py b/scripts/version.pyindex 1ea7b58..2ddc4c6 100644--- a/scripts/version.py+++ b/scripts/version.py@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. """ -VERSION = '2.16.0'+VERSION = '2.16.1' SO_VERSION_MAJOR = '36' SO_VERSION_MINOR = '0' SO_VERSION = SO_VERSION_MAJOR + '.' + SO_VERSION_MINOR

Contact

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