Beispiel #1
0
void
moving_spline(int x, int y)
{
    elastic_moveline(new_s->points);
    adjust_pos(x, y, fix_x, fix_y, &cur_x, &cur_y);
    length_msg(MSG_DIST);
    elastic_moveline(new_s->points);
}
Beispiel #2
0
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);
}
Beispiel #3
0
static void
array_place_spline(int x, int y)
{
    int		    i, j, delta_x, delta_y, start_x, start_y;
    int		    nx, ny;
    F_spline	   *save_spline;

    elastic_moveline(new_s->points);
    /* erase last lengths if appres.showlengths is true */
    erase_lengths();

    tail(&objects, &object_tails);
    save_spline = new_s;

    if ((!cur_numxcopies) && (!cur_numycopies)) {
	place_spline(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_spline_x(start_x+delta_x, start_y);
		new_s = copy_spline(cur_s);
	    }
	    if (cur_numycopies > 0) {
		place_spline_x(start_x, start_y+delta_y);
		new_s = copy_spline(cur_s);
	    }
	} 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_spline_x(x, y);
			new_s = copy_spline(cur_s);
		    }
		}
	    }
	}
    }
    /* put all new splines in the saved objects structure for undo */
    saved_objects.splines = save_spline;
    set_action_object(F_ADD, O_ALL_OBJECT);
    /* turn back on all relevant markers */
    update_markers(new_objmask);
}
Beispiel #4
0
void
init_splinedragging(F_spline *s, int x, int y)
{
    new_s = s;
    cur_x = fix_x = x;
    cur_y = fix_y = y;
    canvas_locmove_proc = moving_spline;
    canvas_ref_proc = elastic_movenewspline;
    canvas_leftbut_proc = place_spline;
    canvas_middlebut_proc = array_place_spline;
    canvas_rightbut_proc = cancel_spline;
    set_action_on();
    elastic_moveline(new_s->points);
}
Beispiel #5
0
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();
}
Beispiel #6
0
static void
cancel_spline(void)
{
    canvas_ref_proc = canvas_locmove_proc = null_proc;
    elastic_moveline(new_s->points);
    /* erase last lengths if appres.showlengths is true */
    erase_lengths();
    if (return_proc == copy_selected) {
	free_spline(&new_s);
    } else {
	list_add_spline(&objects.splines, new_s);
	redisplay_spline(new_s);
    }
    /* turn back on all relevant markers */
    update_markers(new_objmask);
    (*return_proc) ();
    draw_mousefun_canvas();
}
Beispiel #7
0
void
init_linedragging(F_line *l, int x, int y)
{
    int		    xmin, ymin, xmax, ymax;

    new_l = l;
    cur_x = fix_x = x;
    cur_y = fix_y = y;
    canvas_locmove_proc = moving_line;
    canvas_ref_proc = elastic_movenewline;
    canvas_leftbut_proc = place_line;
    canvas_middlebut_proc = array_place_line;
    canvas_rightbut_proc = cancel_line;
    set_action_on();
    if (l->type == T_BOX || l->type == T_ARCBOX || l->type == T_PICTURE) {
	line_bound(l, &xmin, &ymin, &xmax, &ymax);
	get_links(xmin, ymin, xmax, ymax);
    }
    elastic_moveline(new_l->points);
}
Beispiel #8
0
void
elastic_movenewspline(void)
{
    elastic_moveline(new_s->points);
}
Beispiel #9
0
void
elastic_movenewline(void)
{
    elastic_moveline(new_l->points);
}
Beispiel #10
0
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();
}