Commit 4a59a7c
new point selection
Changed files (3)
modifiedlibbirdfont/DescriptionTab.valamodifiedlibbirdfont/EditPoint.valamodifiedlibbirdfont/PenTool.vala
Diff
@@ -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");@@ -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. */@@ -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 (); } }