コード例 #1
0
/*** Move the cursor according to mouse click ***/
void click(Project p, WORD x, WORD y, BYTE update)
{
	WORD xp = (x-gui.left) / XSIZE,
	     yp = (y-gui.top) / YSIZE;
	LINE *ln;

	if(!p->ccp.select) inv_curs(p, FALSE);

	p->nbl = p->top_line + yp;
	for(ln=p->show; ln->next && yp; yp--,ln=ln->next);
	/* There was no lines, where we've clicked */
	p->nbl -= yp;
	p->edited = ln;
	p->nbrwc  = p->nbrc = xp+p->left_pos;

	xp = curs_visible(p,p->top_line);
	if(xp!=p->left_pos)
		scroll_xy(p, xp, p->top_line, FALSE);
	draw_info( p );
	RP->Mask = gui.selmask;

	/* Set starting selection point */
	if( update )
	{
		ln->flags = FIRSTSEL | LASTSEL;
		p->ccp.xc = p->ccp.xp = p->ccp.startsel = p->ccp.endsel = p->nbrc;
		p->ccp.yc = p->ccp.yp = p->nbl;
		p->ccp.cline = p->ccp.line = ln;
	}
}
コード例 #2
0
/*** Refresh display, according to new window size ***/
void new_size(UBYTE Flags)
{
	inv_curs(edit, FALSE);
	adjust_win(Wnd,NbProject>1);   /* Adjust internal variables */
	SetABPenDrMd(RP, pen.fg, pen.bg, JAM2);
	clear_brcorner();
	prop_adj(edit);
	edit->left_pos = curs_visible(edit, edit->top_line);
	edit->xcurs    = (edit->nbrc - edit->left_pos)*XSIZE + gui.left;
	if(Flags & EDIT_GUI)  reshape_panel(edit);
	if(Flags & EDIT_AREA) redraw_content(edit,edit->show,gui.topcurs,gui.nbline);
	inv_curs(edit,TRUE);
}
コード例 #3
0
/*** Scroll display according to right prop gadget ***/
void scroll_disp(Project p, BOOL adjust)
{
	ULONG pos = ((struct PropInfo *)((struct Gadget*)Prop)->SpecialInfo)->VertPot *
	            (p->max_lines - gui.nbline) / MAXPOT;

	if(p->max_lines>gui.nbline && pos!=p->top_line)
	{
		if(p->ccp.select)
			/* If selection mode is on, don't move cursor */
			p->ycurs-=(pos-p->top_line)*YSIZE,
			scroll_xy(p, p->left_pos, pos, adjust);
		else
			/* Be sure cursor is always in the edit area */
			inv_curs(p,FALSE),
			scroll_xy(p, curs_visible(p,pos), pos, adjust),
			inv_curs(p,TRUE);
	}
}