Exemple #1
0
/*#DOC*/
int view_resize(View v, int w, int h)
{
	w = viewP_posrelat(w, TERM_W);
	h = viewP_posrelat(h, TERM_H);
	if (ERR == wresize(view_win(v), h, w)) return ERR;
	return replace_panel(view_pan(v), view_win(v));
}
Exemple #2
0
/*#DOC*/
int view_setStyle(View v, Style s)
{
	if (NULL == v) return ERR;
	if (OK == wattrset(view_win(v), (int)viewP_style2chtype(s))) {
		v->_sty = s;
		return OK;
	}
	return ERR;
}
Exemple #3
0
/*#DOC*/
int view_printf(View v, const char *fmt, ...)
{
	va_list        ap;
	int            ret;
	va_start(ap, fmt);
	ret = vw_printw(view_win(v), fmt, ap);
	va_end(ap);
	return ret;
}
Exemple #4
0
/*#DOC*/
View view_init(View v, int x, int y, int w, int h)
{
	if (NULL == v) return NULL;
	/* Allow relative positions */
	x = viewP_posrelat(x, TERM_W);
	y = viewP_posrelat(y, TERM_H);
	w = viewP_posrelat(w, TERM_W - x);
	h = viewP_posrelat(h, TERM_H - y);

	v->_win = newwin(h, w, y, x);
	v->_pan = new_panel(view_win(v));
	v->_sty = 0;
	if (NULL == view_win(v) || NULL == view_pan(v)) {
		view_delete(v); return NULL;
	} /* set_panel_userptr(view_pan(v), v); /@* Loopback pointer */
	keypad(view_win(v), TRUE);
	return v;
}
Exemple #5
0
/*#DOC*/
int view_scanf(View v, char* fmt, ...)
{
	va_list        ap;
	int            ret;
	viewP_cbreak(FALSE);
	va_start(ap, fmt);
	ret = vw_scanw(view_win(v), fmt, ap);
	va_end(ap);
	return ret;
}
Exemple #6
0
/*#DOC*/
Canvas canvas_new(int w, int h)
{
	Canvas c = malloc(sizeof(struct View));
	if (NULL == c) return NULL;
	c->_win = newpad(h, w);
	c->_pan = NULL;
	c->_sty = (Style) 0;
	if (NULL == view_win(c)) {
		free(c);
		return NULL;
	}
	return c;
}
Exemple #7
0
/*#DOC*/
int view_moveCursor(View v, int dx, int dy)
{
	int w, h;
	if (NULL == v) return ERR;
	w = view_w(v);
	h = view_h(v);
	dx += getcurx(view_win(v));
	dy += getcury(view_win(v));
	while (dx < 0) {
		/* Si el destino x es negativo,
		** 'wrappeamos' al otro lado */
		dy -= 1;
		dx += w;
	}
	while (dx > w) {
		/* Igual para el lado derecho de la pantalla */
		dy += 1;
		dx -= w;
	}
	if (dy < 0) dy = 0;
	if (dy > h) dy = h;
	return wmove(view_win(v), dy, dx);
}
Exemple #8
0
/* We've clicked the 'goto' button, selecting 'r' in 'v'
 * If this window is under external control, just send the event,
 * otherwise expand the selection, and 'goto' it, in the context of 'v'.
 */
void
b3(View *v, Range r) {
	char	*s;
	View *oldv;
	Range expanded;
	Data	*d;
	View*found;
	
	/* Try to send simply expanded version to remote process */
	expanded = view_expand(v, r, notaddress);
	if (!RLEN(expanded))
		return;	/* empty click nowhere -- ignore */
	s = text_duputf(v->t, expanded);
	d = view_data(v);
	oldv = v;
	
	/* Send to remote process? */
	if(data_sendgoto(d,expanded, s))
		goto cleanup;
	
	
	if (view_gotofile(&v, &expanded, s)) { /* Simple file? */
		r = expanded;
	} else if ( (found = openinclude(v,r)) ) {
		v = found;
		r = found->sel;
	} else if (view_literal(&v, &expanded, s)) { /* Literal? */
		r = expanded;
	} else {	/* found nothing */
		goto cleanup;
	}
	
	view_show(v,r);
	view_select(v,r);
	view_setlastselection(v);

	/* warp unless b3 in the tag jumps to the body. */
	if (oldv != tile_tag(view_win(v)))
		view_warp(v,r);
	
cleanup:
	free(s);
}
Exemple #9
0
/*#DOC*/
int view_clearLine(View v, int y)
{
	wmove(view_win(v), y, 0);
	return wclrtoeol(view_win(v));
}
Exemple #10
0
/*#DOC*/
int view_touch(View v)
{
	return touchwin(view_win(v));
}
Exemple #11
0
/*#DOC*/
int view_clear(View v)
{
	return werase(view_win(v));
}
Exemple #12
0
/*#DOC*/
int view_setCursor(View v, int x, int y)
{
	if (x < 0) x += view_w(v);
	if (y < 0) y += view_h(v);
	return wmove(view_win(v), y, x);
}
Exemple #13
0
/*#DOC*/
int view_setBGStyle(View v, Style s)
{
	return wbkgd(view_win(v), viewP_style2chtype(s));
}
Exemple #14
0
int view_copy(View d, View s, int sx, int sy, int dx, int dy, int dw, int dh) {
	return copywin(view_win(s), view_win(d), sy, sx, dy, dx, dh-1, dw-1, 0);
}
Exemple #15
0
/*#DOC*/
int canvas_drawTo(Canvas c, View d, int x, int y)
{
	int w = MIN( view_w(c)-x-1, view_w(d)-1 );
	int h = MIN( view_h(c)-y-1, view_h(d)-1 );
	return copywin(view_win(c), view_win(d), y, x, 0, 0, h, w, 0);
}
Exemple #16
0
/*#DOC*/
int view_w(View v) { return getmaxx(view_win(v));
}
Exemple #17
0
/*#DOC*/
int view_curX(View v)
{
	return getcurx(view_win(v));
}
Exemple #18
0
/*#DOC*/
int view_setTimeout(View v, int delay)
{
	wtimeout(view_win(v), delay);
	return OK;
}
Exemple #19
0
/*#DOC*/
int view_getc(View v)
{
	viewP_cbreak(TRUE);
	return wgetch(view_win(v));
}
Exemple #20
0
/*#DOC*/
int view_hline(View v, int x, int y, int n)
{
	x = viewP_posrelat(x, view_w(v));
	y = viewP_posrelat(y, view_h(v));
	return mvwhline(view_win(v), y, x, ACS_HLINE, n);
}
Exemple #21
0
/*#DOC*/
int view_border(View v)
{
	return box(view_win(v), 0, 0);
}
Exemple #22
0
/*#DOC*/
int view_curY(View v)
{
	return getcury(view_win(v));
}
Exemple #23
0
/*#DOC*/
int view_setScroll(View v, int b)
{
	return scrollok(view_win(v), b);
}
Exemple #24
0
/*#DOC*/
int view_insc(View v, int chr)
{
	return winsch(view_win(v), viewP_style2chtype((Style) chr));
}
Exemple #25
0
/*#DOC*/
int view_scroll(View v, int n)
{
	return wscrl(view_win(v), n);
}
Exemple #26
0
/*#DOC*/
int view_putc(View v, int chr)
{
	return waddch(view_win(v), viewP_style2chtype((Style) chr));
}
Exemple #27
0
/*#DOC*/
int view_h(View v) { return getmaxy(view_win(v));
}
Exemple #28
0
/*#DOC*/
int view_puts(View v, const char* s)
{
	return waddstr(view_win(v), s);
}
Exemple #29
0
/*#DOC*/
char* view_gets(View v, char* s, int n)
{
	viewP_cbreak(FALSE);
	if (OK == wgetnstr(view_win(v), s, n)) return s;
	return NULL;
}
Exemple #30
0
/*#DOC*/
int view_getCursor(View v, int* x, int* y)
{
	if (NULL == v || NULL == x || NULL == y) return ERR;
	getyx(view_win(v), *y, *x);
	return OK;
}