Clone in a terminal:
Commit 4a59a7c
Johan Mattsson - 2013-07-28T08:37:09+00:00
4a59a7c3efcc8def73921fbf2b98b0be45f01b73johan.mattsson.m@gmail.com

new point selection

Changed files (3)

Diff

diff --git a/libbirdfont/DescriptionTab.vala b/libbirdfont/DescriptionTab.valaindex 798b40b..0872ea0 100644--- a/libbirdfont/DescriptionTab.vala+++ b/libbirdfont/DescriptionTab.vala@@ -1,3 +1,4 @@+ /*     Copyright (C) 2012 Johan Mattsson @@ -93,7 +94,7 @@ public class DescriptionTab : FontDisplay { 			<h3>""" + _("Style") + " (Regular/Bold/Italic)" + """</h3> 			<input class="text" type="text" id="subfamily" value=""" + "\"" + font.subfamily + "\"" + """ onchange="update_name_fields ();"/><br /> -			<h3>""" + _("Full name (name & style)") + """</h3>+			<h3>""" + _("Full name (name and style)") + """</h3> 			<input class="text" type="text" id="full_name" value=""" + "\"" + font.full_name + "\"" + """ onchange="update_name_fields ();"/><br />  			<h3>""" + _("Unique identifier") + """</h3>@@ -136,7 +137,7 @@ c.append ( 	_("Postscript name"); 	_("Name"); 	_("Style");-	_("Full name (name & style)");+	_("Full name (name and style)"); 	_("Unique identifier"); 	_("Version"); 	_("Description");diff --git a/libbirdfont/EditPoint.vala b/libbirdfont/EditPoint.valaindex 49f7f32..dba5821 100644--- a/libbirdfont/EditPoint.vala+++ b/libbirdfont/EditPoint.vala@@ -69,6 +69,15 @@ public class EditPoint { 		} 	} +	public bool equals (EditPoint e) {+		return e.x == x +			&& e.y == y +			&& get_right_handle ().x () == e.get_right_handle ().x ()+			&& get_right_handle ().y () == e.get_right_handle ().y ()+			&& get_left_handle ().x () == e.get_left_handle ().x ()+			&& get_left_handle ().y () == e.get_left_handle ().y ();+	}+ 	/** Flip handles if next point on path is in the other direction.  	 *  Used to recalculate handles after new point is inserted on a path. 	 */diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex e2d9c97..53a0b0a 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -307,37 +307,51 @@ public class PenTool : Tool { 	} 	 	bool is_new_point_from_path_selected () {-		// TODO: 		return false; 	} 	+	public void remove_from_selected (EditPoint ep) +		requires (selected_points.length () > 0) {+		for (unowned List<EditPoint> e = selected_points.first (); !is_null (e.next); e = e.next) {+			if (ep.equals (e.data)) {+				ep.set_selected (false);+				selected_points.remove_link (e);+				return;+			}+		}+	}+	 	public void select_active_point (double x, double y) { 		Glyph? g = MainWindow.get_current_glyph (); 		Glyph glyph = (!) g;-		-		if (KeyBindings.modifier != SHIFT) {-			if (active_edit_point != null) {-				((!)active_edit_point).set_active (false);-			}--			remove_all_selected_points ();-		}+		bool new_selection; 		 		move_selected = true; 		move_point_on_path = true;-+		 		if (active_edit_point != null) {-			((!)active_edit_point).set_selected (true);-			selected_point = (!)active_edit_point;+			if (KeyBindings.modifier == SHIFT) {+				if (((!)active_edit_point).is_selected ()) {+					((!)active_edit_point).set_selected (false);+					remove_from_selected ((!)active_edit_point);+				} else {+					((!)active_edit_point).set_selected (true);+					selected_point = (!)active_edit_point;+					add_selected_point (selected_point);+				}+			} else {+				if (!((!)active_edit_point).is_selected ()) {+					remove_all_selected_points ();+					((!)active_edit_point).set_selected (true);+					selected_point = (!)active_edit_point;+					add_selected_point (selected_point);+				}+			} 		}--		if (!is_over_handle (x, y)) {-			edit_active_corner = true;-			set_default_handle_positions ();-			-			if (active_edit_point != null) {-				last_selected_is_handle = false;-				add_selected_point ((!) active_edit_point);+		+		if (active_edit_point == null) {+			if (KeyBindings.modifier != SHIFT) {+				remove_all_selected_points (); 			} 		} 		

Contact

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