Updated Files
libbirdfont/DrawingTools.vala |
libbirdfont/EditPointHandle.vala |
libbirdfont/ForesightTool.vala |
libbirdfont/PenTool.vala |
--- a/libbirdfont/DrawingTools.vala
+++ b/libbirdfont/DrawingTools.vala
@@ -491,12 +491,21 @@
// tie edit point handles
tie_handles = new Tool ("tie_point", t_("Tie curve handles for the selected edit point"));
tie_handles.select_action.connect ((self) => {
- bool tie;
+ bool tie, end_point;
EditPoint p;
if (PenTool.move_selected_handle) {
p = PenTool.active_handle.parent;
tie = !p.tie_handles;
+
+ // don't tie end points
+ foreach (Path path in MainWindow.get_current_glyph ().active_paths) {
+ if (path.is_open ()) {
+ if (p == path.get_first_point () || p == path.get_last_point ()) {
+ tie = false;
+ }
+ }
+ }
if (tie) {
p.process_tied_handle ();
@@ -510,13 +519,18 @@
foreach (PointSelection ep in PenTool.selected_points) {
tie = !ep.point.tie_handles;
- if (tie) {
- ep.point.process_tied_handle ();
- ep.point.set_reflective_handles (false);
+ end_point = ep.point == ep.path.get_first_point ()
+ || ep.point == ep.path.get_last_point ();
+
+ if (!ep.path.is_open () || !end_point) {
+ if (tie) {
+ ep.point.process_tied_handle ();
+ ep.point.set_reflective_handles (false);
+ }
+
+ ep.point.set_tie_handle (tie);
+ ep.path.update_region_boundaries ();
}
-
- ep.point.set_tie_handle (tie);
- ep.path.update_region_boundaries ();
}
}
@@ -528,20 +542,26 @@
// symmetrical handles
reflect_handle = new Tool ("symmetric", t_("Symmetrical handles"));
reflect_handle.select_action.connect ((self) => {
- bool symmetrical;
+ bool symmetrical, end_point;
PointSelection ep;
if (PenTool.selected_points.size > 0) {
ep = PenTool.selected_points.get (0);
symmetrical = ep.point.reflective_point;
- foreach (PointSelection p in PenTool.selected_points) {
- p.point.set_reflective_handles (!symmetrical);
- p.point.process_symmetrical_handles ();
+
+ foreach (PointSelection p in PenTool.selected_points) {
+ end_point = p.point == p.path.get_first_point ()
+ || p.point == p.path.get_last_point ();
- if (symmetrical) {
- ep.point.set_tie_handle (false);
+ if (!p.path.is_open () || !end_point) {
+ p.point.set_reflective_handles (!symmetrical);
+ p.point.process_symmetrical_handles ();
+
+ if (symmetrical) {
+ ep.point.set_tie_handle (false);
+ }
+
+ p.path.update_region_boundaries ();
}
-
- p.path.update_region_boundaries ();
}
MainWindow.get_current_glyph ().update_view ();
}
--- a/libbirdfont/EditPointHandle.vala
+++ b/libbirdfont/EditPointHandle.vala
@@ -107,7 +107,7 @@
return n;
}
- public unowned EditPoint get_parent () {
+ public EditPoint get_parent () {
return parent;
}
--- a/libbirdfont/ForesightTool.vala
+++ b/libbirdfont/ForesightTool.vala
@@ -198,10 +198,17 @@
PointSelection last;
bool lh;
EditPointHandle h;
-
+ Path a;
+
last_move_x = x;
last_move_y = y;
-
+
+ a = get_active_path ();
+ if (a.is_open ()) {
+ a.get_first_point ().set_reflective_handles (false);
+ a.get_first_point ().set_tie_handle (false);
+ }
+
if (MainWindow.dialog.visible && state != NONE) {
state = NONE;
p.release_action (p, 1, last_move_x, last_move_y);
@@ -325,12 +332,14 @@
public void stop_drawing () {
PenTool p = (PenTool) PointTool.pen ();
+ Path a;
p.release_action (p, 1, 0, 0);
if (state != NONE) {
- if (get_active_path ().is_open () && state != NONE) {
- get_active_path ().delete_last_point ();
+ a = get_active_path ();
+ if (a.is_open () && state != NONE) {
+ a.delete_last_point ();
}
}
--- a/libbirdfont/PenTool.vala
+++ b/libbirdfont/PenTool.vala
@@ -194,6 +194,15 @@
point_selection_image = false;
BirdFont.get_current_font ().touch ();
reset_stroke ();
+
+ foreach (Path p in g.active_paths) {
+ if (p.is_open ()) {
+ p.get_first_point ().set_tie_handle (false);
+ p.get_first_point ().set_reflective_handles (false);
+ p.get_last_point ().set_tie_handle (false);
+ p.get_last_point ().set_reflective_handles (false);
+ }
+ }
});
move_action.connect ((self, x, y) => {
@@ -798,6 +807,7 @@
public void press (int button, int x, int y, bool double_click) {
Glyph? g = MainWindow.get_current_glyph ();
Glyph glyph = (!) g;
+ bool reflective;
return_if_fail (g != null);
@@ -832,9 +842,22 @@
if ((KeyBindings.has_alt () || KeyBindings.has_ctrl ())
&& is_over_handle (x, y)) {
- selected_handle.parent.set_reflective_handles (false);
- selected_handle.parent.set_tie_handle (false);
- GlyphCanvas.redraw ();
+ // don't use set point to reflective to on open ends
+ reflective = true;
+ foreach (Path path in MainWindow.get_current_glyph ().active_paths) {
+ if (path.is_open ()) {
+ if (selected_handle.parent == path.get_first_point ()
+ || selected_handle.parent == path.get_last_point ()) {
+ reflective = false;
+ }
+ }
+ }
+
+ if (reflective) {
+ selected_handle.parent.set_reflective_handles (false);
+ selected_handle.parent.set_tie_handle (false);
+ GlyphCanvas.redraw ();
+ }
}
return;
@@ -1750,7 +1773,8 @@
}
private void curve_corner_event (double event_x, double event_y) {
- MainWindow.get_current_glyph ().open_path ();
+ Glyph g = MainWindow.get_current_glyph ();
+ g.open_path ();
PointSelection p;
if (!is_over_handle (event_x, event_y)) {
@@ -1764,6 +1788,9 @@
selected_handle = p.handle;
handle_selection = p;
selected_handle.selected = true;
+
+ active_path = p.path;
+ g.add_active_path (active_path);
}
public static void add_selected_point (EditPoint p, Path path) {