示例#1
0
void
moving_text(int x, int y)
{
    elastic_movetext();
    adjust_pos(x, y, fix_x, fix_y, &cur_x, &cur_y);
    length_msg(MSG_DIST);
    elastic_movetext();
}
示例#2
0
文件: u_drag.c 项目: hhoeflin/xfig
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);
}
示例#3
0
文件: u_drag.c 项目: hhoeflin/xfig
static void
array_place_text(int x, int y)
{
    int		    i, j, delta_x, delta_y, start_x, start_y;
    int		    nx, ny;
    F_text	   *save_text;

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

    tail(&objects, &object_tails);
    save_text = new_t;

    if ((!cur_numxcopies) && (!cur_numycopies)) {
	place_text(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_text_x(start_x+delta_x, start_y);
		new_t = copy_text(cur_t);
	    }
	    if (cur_numycopies > 0) {
		place_text_x(start_x, start_y+delta_y);
		new_t = copy_text(cur_t);
	    }
	} 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_text_x(x, y);
			new_t = copy_text(cur_t);
		    }
		}
	    }
	}
    }
    /* put all new texts in the saved objects structure for undo */
    saved_objects.texts = save_text;
    set_action_object(F_ADD, O_ALL_OBJECT);
    /* turn back on all relevant markers */
    update_markers(new_objmask);
}
示例#4
0
文件: u_drag.c 项目: hhoeflin/xfig
static void
cancel_text(void)
{
    canvas_ref_proc = canvas_locmove_proc = null_proc;
    elastic_movetext();
    /* erase last lengths if appres.showlengths is true */
    erase_lengths();
    if (return_proc == copy_selected) {
	free_text(&new_t);
    } else {
	list_add_text(&objects.texts, new_t);
	redisplay_text(new_t);
    }
    /* turn back on all relevant markers */
    update_markers(new_objmask);
    (*return_proc) ();
    draw_mousefun_canvas();
}
示例#5
0
文件: u_drag.c 项目: hhoeflin/xfig
void
init_textdragging(F_text *t, int x, int y)
{
    float	   cw,cw2;
    int		   x1, y1;

    new_t = t;
    fix_x = cur_x = x;
    fix_y = cur_y = y;
    x1 = new_t->base_x;
    y1 = new_t->base_y;
    /* adjust fix_x/y so that text will fall on grid if grid is on */		// isometric grid
    round_coords( &x1, &y1 );
    fix_x += new_t->base_x - x1;
    fix_y += new_t->base_y - y1;
    x1off = x1-x; /*new_t->base_x - x;*/
    y1off = y1-y; /*new_t->base_y - y;*/
    if (t->type == T_CENTER_JUSTIFIED || t->type == T_RIGHT_JUSTIFIED) {
	txsize = textsize(t->fontstruct, strlen(t->cstring), t->cstring);
	if (t->type == T_CENTER_JUSTIFIED) {
	    cw2 = txsize.length/2.0/display_zoomscale;
	    x1off = round(x1off - cos((double)t->angle)*cw2);
	    y1off = round(y1off + sin((double)t->angle)*cw2);
	} else { /* T_RIGHT_JUSTIFIED */
	    cw = 1.0*txsize.length/display_zoomscale;
	    x1off = round(x1off - cos((double)t->angle)*cw);
	    y1off = round(y1off + sin((double)t->angle)*cw);
	}
    }
    canvas_locmove_proc = moving_text;
    canvas_ref_proc = elastic_movetext;
    canvas_leftbut_proc = place_text;
    canvas_middlebut_proc = array_place_text;
    canvas_rightbut_proc = cancel_text;
    elastic_movetext();
    set_action_on();
}