void undo_addpoint(void) { if (last_object == O_POLYLINE) linepoint_deleting(saved_objects.lines, last_prev_point, last_selected_point); else splinepoint_deleting(saved_objects.splines, last_prev_point, last_selected_point); }
static void init_delete_point(F_line *obj, int type, int x, int y, F_point *p, F_point *q) { int n; switch (type) { case O_POLYLINE: cur_l = (F_line *) obj; /* the search routine will ensure we don't have a box */ n = num_points(cur_l->points); if (cur_l->type == T_POLYGON) { if (n <= 4) { /* count first pt twice for closed object */ put_msg("A polygon cannot have less than 3 points"); beep(); return; } } else if (n <= 1) { /* alternative would be to remove the dot altogether */ put_msg("A dot must have at least 1 point"); beep(); return; } linepoint_deleting(cur_l, p, q); break; case O_SPLINE: cur_s = (F_spline *) obj; n = num_points(cur_s->points); if (closed_spline(cur_s)) { if (n <= CLOSED_SPLINE_MIN_NUM_POINTS) { put_msg("A closed spline cannot have less than %d points", CLOSED_SPLINE_MIN_NUM_POINTS); beep(); return; } } else if (n <= OPEN_SPLINE_MIN_NUM_POINTS) { put_msg("A spline cannot have less than %d points", OPEN_SPLINE_MIN_NUM_POINTS); beep(); return; } splinepoint_deleting(cur_s, p, q); break; default: return; } }