Example #1
0
void
moving_box(int x, int y)
{
    elastic_movebox();
    adjust_pos(x, y, fix_x, fix_y, &cur_x, &cur_y);
    length_msg(MSG_DIST);
    elastic_movebox();
}
Example #2
0
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);
}
Example #3
0
static void
array_place_compound(int x, int y)
{
    int		    i, j, delta_x, delta_y, start_x, start_y;
    int		    nx, ny;
    F_compound	   *save_compound;

    elastic_movebox();
    /* erase last lengths if appres.showlengths is true */
    erase_lengths();

    tail(&objects, &object_tails);
    save_compound = new_c;

    if ((!cur_numxcopies) && (!cur_numycopies)) {
	place_compound(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_compound_x(start_x+delta_x, start_y);
		new_c = copy_compound(cur_c);
	    }
	    if (cur_numycopies > 0) {
		place_compound_x(start_x, start_y+delta_y);
		new_c = copy_compound(cur_c);
	    }
	} 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_compound_x(x, y);
			new_c = copy_compound(cur_c);
		    }
		}
	    }
	}
    }
    /* put all new compounds in the saved objects structure for undo */
    saved_objects.compounds = save_compound;
    set_action_object(F_ADD, O_ALL_OBJECT);
    /* turn back on all relevant markers */
    update_markers(new_objmask);
}
Example #4
0
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();
}
Example #5
0
void
init_compounddragging(F_compound *c, int x, int y)
{
    new_c = c;
    fix_x = cur_x = x;
    fix_y = cur_y = y;
    x1off = c->nwcorner.x - x;
    x2off = c->secorner.x - x;
    y1off = c->nwcorner.y - y;
    y2off = c->secorner.y - y;
    canvas_locmove_proc = moving_box;
    canvas_ref_proc = elastic_movebox;
    canvas_leftbut_proc = place_compound;
    canvas_middlebut_proc = array_place_compound;
    canvas_rightbut_proc = cancel_drag_compound;
    set_action_on();
    get_interior_links(c->nwcorner.x, c->nwcorner.y, c->secorner.x, c->secorner.y);
    elastic_movebox();
}