static void place_spline_x(int x, int y) { canvas_leftbut_proc = null_proc; canvas_middlebut_proc = null_proc; canvas_rightbut_proc = null_proc; canvas_locmove_proc = null_proc; canvas_ref_proc = null_proc; adjust_pos(x, y, fix_x, fix_y, &x, &y); translate_spline(new_s, x - fix_x, y - fix_y); if (return_proc == copy_selected) { add_spline(new_s); } else { list_add_spline(&objects.splines, new_s); clean_up(); set_lastposition(fix_x, fix_y); set_newposition(x, y); set_action_object(F_MOVE, O_SPLINE); set_latestspline(new_s); set_modifiedflag(); } redisplay_spline(new_s); /* turn back on all relevant markers */ update_markers(new_objmask); (*return_proc) (); draw_mousefun_canvas(); }
void undo_move(void) { int dx, dy; int xmin1, ymin1, xmax1, ymax1; int xmin2, ymin2, xmax2, ymax2; int dum; dx = last_position.x - new_position.x; dy = last_position.y - new_position.y; switch (last_object) { case O_POLYLINE: line_bound(saved_objects.lines, &xmin1, &ymin1, &xmax1, &ymax1); translate_line(saved_objects.lines, dx, dy); line_bound(saved_objects.lines, &xmin2, &ymin2, &xmax2, &ymax2); adjust_links(last_linkmode, last_links, dx, dy, 0, 0, 1.0, 1.0, False); redisplay_regions(xmin1, ymin1, xmax1, ymax1, xmin2, ymin2, xmax2, ymax2); break; case O_ELLIPSE: ellipse_bound(saved_objects.ellipses, &xmin1, &ymin1, &xmax1, &ymax1); translate_ellipse(saved_objects.ellipses, dx, dy); ellipse_bound(saved_objects.ellipses, &xmin2, &ymin2, &xmax2, &ymax2); redisplay_regions(xmin1, ymin1, xmax1, ymax1, xmin2, ymin2, xmax2, ymax2); break; case O_TXT: text_bound(saved_objects.texts, &xmin1, &ymin1, &xmax1, &ymax1, &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum); translate_text(saved_objects.texts, dx, dy); text_bound(saved_objects.texts, &xmin2, &ymin2, &xmax2, &ymax2, &dum,&dum,&dum,&dum,&dum,&dum,&dum,&dum); redisplay_regions(xmin1, ymin1, xmax1, ymax1, xmin2, ymin2, xmax2, ymax2); break; case O_SPLINE: spline_bound(saved_objects.splines, &xmin1, &ymin1, &xmax1, &ymax1); translate_spline(saved_objects.splines, dx, dy); spline_bound(saved_objects.splines, &xmin2, &ymin2, &xmax2, &ymax2); redisplay_regions(xmin1, ymin1, xmax1, ymax1, xmin2, ymin2, xmax2, ymax2); break; case O_ARC: arc_bound(saved_objects.arcs, &xmin1, &ymin1, &xmax1, &ymax1); translate_arc(saved_objects.arcs, dx, dy); arc_bound(saved_objects.arcs, &xmin2, &ymin2, &xmax2, &ymax2); redisplay_regions(xmin1, ymin1, xmax1, ymax1, xmin2, ymin2, xmax2, ymax2); break; case O_COMPOUND: compound_bound(saved_objects.compounds, &xmin1, &ymin1, &xmax1, &ymax1); translate_compound(saved_objects.compounds, dx, dy); compound_bound(saved_objects.compounds, &xmin2, &ymin2, &xmax2, &ymax2); adjust_links(last_linkmode, last_links, dx, dy, 0, 0, 1.0, 1.0, False); redisplay_regions(xmin1, ymin1, xmax1, ymax1, xmin2, ymin2, xmax2, ymax2); break; } swap_newp_lastp(); }
static void align_spline(void) { F_spline *s; for (s = cur_c->splines; s != NULL; s = s->next) { if (!active_layer(s->depth)) continue; spline_bound(s, &llx, &lly, &urx, &ury); get_dx_dy(); translate_spline(s, dx, dy); } }
static void adjust_object_pos (F_line *obj_ptr, int obj_type, int delta_x, int delta_y) { F_ellipse *e; F_arc *a; F_line *l; F_spline *s; F_compound *c; F_text *t; switch (obj_type) { case O_ELLIPSE: e = (F_ellipse *) obj_ptr; translate_ellipse(e, delta_x, delta_y); e->distrib = 1; break; case O_POLYLINE: l = (F_line *) obj_ptr; translate_line(l, delta_x, delta_y); l->distrib = 1; break; case O_SPLINE: s = (F_spline *) obj_ptr; translate_spline(s, delta_x, delta_y); s->distrib = 1; break; case O_TEXT: t = (F_text *) obj_ptr; translate_text(t, delta_x, delta_y); t->distrib = 1; break; case O_ARC: a = (F_arc *) obj_ptr; translate_arc(a, delta_x, delta_y); a->distrib = 1; break; case O_COMPOUND: c = (F_compound *) obj_ptr; translate_compound(c, delta_x, delta_y); c->distrib = 1; break; default: break; } } /* adjust_object_pos */