作図ソフト dia の改良版
Revisão | 3c79ed5c731d35da21bd2458d16ffce0a8738be7 (tree) |
---|---|
Hora | 2014-09-08 00:25:25 |
Autor | Hans Breuer <hans@breu...> |
Commiter | Hans Breuer |
[autorouting] Toggling autorouting and undo, fix number of points
The recent crash fixed with c865c8b87e0cd774c75131d913ac53bfd156c69b had
also some visible effect when toggling auorouting for a fresh D&D
"UML - Component Feature". Switching the autorouting of again by undo did
not restore the original number of points, because taht wasn't stored with
the change information.
@@ -106,6 +106,7 @@ autoroute_create_change(OrthConn *orth, gboolean on); | ||
106 | 106 | struct AutorouteChange { |
107 | 107 | ObjectChange obj_change; |
108 | 108 | gboolean on; |
109 | + int num_points; | |
109 | 110 | Point *points; |
110 | 111 | }; |
111 | 112 |
@@ -1193,7 +1194,8 @@ autoroute_change_apply(struct AutorouteChange *change, DiaObject *obj) | ||
1193 | 1194 | obj->handles[1]->connected_to); |
1194 | 1195 | } else { |
1195 | 1196 | orth->autorouting = FALSE; |
1196 | - orthconn_set_points(orth, orth->numpoints, change->points); | |
1197 | + orthconn_set_points(orth, change->num_points, change->points); | |
1198 | + /* adjust the rest of the object? nope, see: object_change_revert() */ | |
1197 | 1199 | } |
1198 | 1200 | } |
1199 | 1201 |
@@ -1204,7 +1206,7 @@ autoroute_change_revert(struct AutorouteChange *change, DiaObject *obj) | ||
1204 | 1206 | |
1205 | 1207 | if (change->on) { |
1206 | 1208 | orth->autorouting = FALSE; |
1207 | - orthconn_set_points(orth, orth->numpoints, change->points); | |
1209 | + orthconn_set_points(orth, change->num_points, change->points); | |
1208 | 1210 | } else { |
1209 | 1211 | orth->autorouting = TRUE; |
1210 | 1212 | autoroute_layout_orthconn(orth, obj->handles[0]->connected_to, |
@@ -1225,6 +1227,7 @@ autoroute_create_change(OrthConn *orth, gboolean on) | ||
1225 | 1227 | change->obj_change.free = (ObjectChangeFreeFunc) autoroute_change_free; |
1226 | 1228 | |
1227 | 1229 | change->on = on; |
1230 | + change->num_points = orth->numpoints; | |
1228 | 1231 | change->points = g_new(Point, orth->numpoints); |
1229 | 1232 | for (i = 0; i < orth->numpoints; i++) |
1230 | 1233 | change->points[i] = orth->points[i]; |