static void fix_movedcompoundpoint(int x, int y) { float scalex, scaley; canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); adjust_box_pos(x, y, from_x, from_y, &cur_x, &cur_y); /* make a copy of the original and save as unchanged object */ old_c = copy_compound(cur_c); clean_up(); old_c->next = cur_c; set_latestcompound(old_c); set_action_object(F_EDIT, O_COMPOUND); scalex = ((float) (cur_x - fix_x)) / (from_x - fix_x); scaley = ((float) (cur_y - fix_y)) / (from_y - fix_y); /* scale the compound */ scale_compound(cur_c, scalex, scaley, fix_x, fix_y); /* redraw anything under the old compound */ redisplay_compound(old_c); /* and the new compound */ redisplay_compound(cur_c); /* turn back on all relevant markers */ update_markers(new_objmask); set_lastposition(from_x, from_y); set_newposition(cur_x, cur_y); set_modifiedflag(); wrapup_movepoint(); }
static void fix_movedlinepoint(int x, int y) { (*canvas_locmove_proc) (x, y); canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_linelink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); if (cur_latexcursor != crosshair_cursor) set_cursor(crosshair_cursor); /* make a copy of the original and save as unchanged object */ old_l = copy_line(cur_l); clean_up(); set_latestline(old_l); set_action_object(F_EDIT, O_POLYLINE); old_l->next = cur_l; /* now change the original to become the new object */ relocate_linepoint(cur_l, cur_x, cur_y, moved_point, left_point); /* redraw anything under the old line */ redisplay_line(old_l); /* and the new line */ redisplay_line(cur_l); /* turn back on all relevant markers */ update_markers(new_objmask); wrapup_movepoint(); }
static void place_spline(int x, int y) { elastic_moveline(new_s->points); /* erase last lengths if appres.showlengths is true */ erase_lengths(); place_spline_x(x, y); }
static void place_text(int x, int y) { elastic_movetext(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); place_text_x(x, y); }
static void place_arc(int x, int y) { elastic_movearc(new_a); /* erase last lengths if appres.showlengths is true */ erase_lengths(); place_arc_x(x, y); }
static void place_ellipse(int x, int y) { elastic_moveellipse(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); place_ellipse_x(x, y); }
static void place_compound(int x, int y) { elastic_movebox(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); place_compound_x(x, y); }
static void cancel_movedsplinepoint(void) { canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_linelink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); /* turn back on all relevant markers */ update_markers(new_objmask); wrapup_movepoint(); }
static void cancel_compound(void) { canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_box(fix_x, fix_y, cur_x, cur_y); /* erase last lengths if appres.showlengths is true */ erase_lengths(); /* turn back on all relevant markers */ update_markers(new_objmask); wrapup_movepoint(); }
static void array_place_ellipse(int x, int y) { int i, j, delta_x, delta_y, start_x, start_y; int nx, ny; F_ellipse *save_ellipse; elastic_moveellipse(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); tail(&objects, &object_tails); save_ellipse = new_e; if ((!cur_numxcopies) && (!cur_numycopies)) { place_ellipse(x, y); } else { delta_x = cur_x - fix_x; delta_y = cur_y - fix_y; start_x = cur_x - delta_x; start_y = cur_y - delta_y; if ((cur_numxcopies < 2) && (cur_numycopies < 2)) { /* special cases */ if (cur_numxcopies > 0) { place_ellipse_x(start_x+delta_x, start_y); new_e = copy_ellipse(cur_e); } if (cur_numycopies > 0) { place_ellipse_x(start_x, start_y+delta_y); new_e = copy_ellipse(cur_e); } } else { nx = cur_numxcopies; if (nx == 0) nx++; ny = cur_numycopies; if (ny == 0) ny++; for (i = 0, x = start_x; i < nx; i++, x+=delta_x) { for (j = 0, y = start_y; j < ny; j++, y+=delta_y) { if (i || j ) { place_ellipse_x(x, y); new_e = copy_ellipse(cur_e); } } } } } /* put all new ellipses in the saved objects structure for undo */ saved_objects.ellipses = save_ellipse; set_action_object(F_ADD, O_ALL_OBJECT); /* turn back on all relevant markers */ update_markers(new_objmask); }
static void cancel_movedlinepoint(void) { canvas_ref_proc = canvas_locmove_proc = null_proc; /* erase the elastic line */ elastic_linelink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); /* redraw original line */ redisplay_line(cur_l); /* turn back on all relevant markers */ update_markers(new_objmask); wrapup_movepoint(); }
void cancel_line_drawing(int a, int b) { elastic_line(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); cur_x = fix_x; cur_y = fix_y; if (cur_point != first_point) elastic_moveline(first_point); /* erase control vector */ free_points(first_point); first_point = NULL; return_proc(); draw_mousefun_canvas(); }
static void cancel_ellipse(void) { canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_moveellipse(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); if (return_proc == copy_selected) { free_ellipse(&new_e); } else { list_add_ellipse(&objects.ellipses, new_e); redisplay_ellipse(new_e); } /* turn back on all relevant markers */ update_markers(new_objmask); (*return_proc) (); draw_mousefun_canvas(); }
static void cancel_drag_compound(void) { canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_movebox(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); free_linkinfo(&cur_links); if (return_proc == copy_selected) { free_compound(&new_c); } else { list_add_compound(&objects.compounds, new_c); redisplay_compound(new_c); } /* turn back on all relevant markers */ update_markers(new_objmask); (*return_proc) (); draw_mousefun_canvas(); }
static void fix_movedarcpoint(int x, int y) { canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_arclink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); adjust_pos(x, y, cur_a->point[movedpoint_num].x, cur_a->point[movedpoint_num].y, &x, &y); new_a = copy_arc(cur_a); relocate_arcpoint(new_a, x, y, movedpoint_num); change_arc(cur_a, new_a); /* redraw anything under the old arc */ redisplay_arc(cur_a); /* and the new one */ redisplay_arc(new_a); /* turn back on all relevant markers */ update_markers(new_objmask); wrapup_movepoint(); }
static void fix_movedsplinepoint(int x, int y) { (*canvas_locmove_proc) (x, y); canvas_ref_proc = canvas_locmove_proc = null_proc; elastic_linelink(); /* erase last lengths if appres.showlengths is true */ erase_lengths(); old_s = copy_spline(cur_s); clean_up(); set_latestspline(old_s); set_action_object(F_EDIT, O_SPLINE); old_s->next = cur_s; relocate_splinepoint(cur_s, cur_x, cur_y, moved_point); /* redraw anything under the old spline */ redisplay_spline(old_s); /* and the new one */ redisplay_spline(cur_s); /* turn back on all relevant markers */ update_markers(new_objmask); wrapup_movepoint(); }
void create_lineobject(int x, int y) { F_line *line; F_compound *comp; int dot; if (num_point == 0) { if ((first_point = create_point()) == NULL) { line_drawing_selected(); draw_mousefun_canvas(); return; } cur_point = first_point; first_point->x = fix_x = cur_x = x; first_point->y = fix_y = cur_y = y; first_point->next = NULL; num_point++; } else if (x != fix_x || y != fix_y) { get_intermediatepoint(x, y, 0); } /* dimension line must have 2 different points */ if (dimension_line && first_point->x == x && first_point->y == y) return; dot = (num_point == 1); elastic_line(); /* erase any length info if appres.showlengths is true */ erase_lengths(); if ((line = create_line()) == NULL) { line_drawing_selected(); draw_mousefun_canvas(); return; } line->type = T_POLYLINE; line->style = cur_linestyle; line->thickness = cur_linewidth; line->pen_color = cur_pencolor; line->fill_color = cur_fillcolor; line->depth = cur_depth; line->pen_style = -1; line->join_style = cur_joinstyle; line->cap_style = cur_capstyle; line->fill_style = cur_fillstyle; line->style_val = cur_styleval * (cur_linewidth + 1) / 2; line->points = first_point; if (!dot) { if (cur_mode == F_POLYGON) { /* close off polygon */ line->type = T_POLYGON; num_point++; append_point(first_point->x, first_point->y, &cur_point); elastic_line(); fix_x = first_point->x; fix_y = first_point->y; elastic_line(); /* fix last elastic line */ } else { /* polyline; draw any arrows */ if (autoforwardarrow_mode && !dimension_line) line->for_arrow = forward_arrow(); /* arrow will be drawn in draw_line below */ if (autobackwardarrow_mode && !dimension_line) line->back_arrow = backward_arrow(); /* arrow will be drawn in draw_line below */ } cur_x = fix_x; cur_y = fix_y; elastic_moveline(first_point); /* erase temporary outline */ } if (dimension_line) { comp = create_dimension_line(line, True); reset_action_on(); /* this signals redisplay_curobj() not to refresh */ /* draw it and anything on top of it */ redisplay_compound(comp); } else { add_line(line); reset_action_on(); /* this signals redisplay_curobj() not to refresh */ /* draw it and anything on top of it */ redisplay_line(line); } line_drawing_selected(); if (!edit_remember_dimline_mode) draw_mousefun_canvas(); }