Ejemplo n.º 1
0
CWinSelect1Icon::CWinSelect1Icon()
{
	// 以下はデフォルト値です。
	// オブジェクト作成後に調整してください。
	m_maxwidth = 0;
	m_dpos.x = 0;
	m_dpos.y = 0;
	m_cur.x  = 0;
	m_cur.y  = 0;
	m_wpos.x = 1;
	m_wpos.y = 1;
	m_winx   = 0;
	m_winy   = 0;
	m_winw   = 5;
	m_winh   = 10;
	m_disable_cansel = false;
	m_cols   = 10;
	setsize(0, 0);		// Windowサイズ(デフォルト)
	movewin(5, 0);		// Window位置(デフォルト)(中央、マージンなし)
}
Ejemplo n.º 2
0
void
docmd(void)
{
	int c;
	struct ww *w;
	char out = 0;

	while (!out && !quit) {
		if ((c = wwgetc()) < 0) {
			if (terse)
				wwsetcursor(0, 0);
			else {
				wwputs("Command: ", cmdwin);
				wwcurtowin(cmdwin);
			}
			do
				wwiomux();
			while ((c = wwgetc()) < 0);
		}
		if (!terse)
			wwputc('\n', cmdwin);
		switch (c) {
		default:
			if (c != escapec)
				break;
		case 'h': case 'j': case 'k': case 'l':
		case 'y': case 'p':
		case ctrl('y'):
		case ctrl('e'):
		case ctrl('u'):
		case ctrl('d'):
		case ctrl('b'):
		case ctrl('f'):
		case ctrl('s'):
		case ctrl('q'):
		case ctrl('['):
			if (selwin == 0) {
				error("No window.");
				continue;
			}
		}
		switch (c) {
		case '1': case '2': case '3': case '4': case '5':
		case '6': case '7': case '8': case '9':
			if ((w = window[c - '1']) == 0) {
				error("%c: No such window.", c);
				break;
			}
			setselwin(w);
			if (checkproc(selwin) >= 0)
				 out = 1;
			break;
		case '%':
			if ((w = getwin()) != 0)
				setselwin(w);
			break;
		case ctrl('^'):
			if (lastselwin != 0) {
				setselwin(lastselwin);
				if (checkproc(selwin) >= 0)
					out = 1;
			} else
				error("No previous window.");
			break;
		case 'c':
			if ((w = getwin()) != 0)
				closewin(w);
			break;
		case 'w':
			c_window();
			break;
		case 'm':
			if ((w = getwin()) != 0)
				c_move(w);
			break;
		case 'M':
			if ((w = getwin()) != 0)
				movewin(w, w->ww_alt.t, w->ww_alt.l);
			break;
		case 's':
			if ((w = getwin()) != 0)
				c_size(w);
			break;
		case 'S':
			if ((w = getwin()) != 0)
				sizewin(w, w->ww_alt.nr, w->ww_alt.nc);
			break;
		case 'y':
			c_yank();
			break;
		case 'p':
			c_put();
			break;
		case ':':
			c_colon();
			break;
		case 'h':
			(void) wwwrite(selwin, "\b", 1);
			break;
		case 'j':
			(void) wwwrite(selwin, "\n", 1);
			break;
		case 'k':
			(void) wwwrite(selwin, "\033A", 2);
			break;
		case 'l':
			(void) wwwrite(selwin, "\033C", 2);
			break;
		case ctrl('e'):
			wwscroll(selwin, 1);
			break;
		case ctrl('y'):
			wwscroll(selwin, -1);
			break;
		case ctrl('d'):
			wwscroll(selwin, selwin->ww_w.nr / 2);
			break;
		case ctrl('u'):
			wwscroll(selwin, - selwin->ww_w.nr / 2);
			break;
		case ctrl('f'):
			wwscroll(selwin, selwin->ww_w.nr);
			break;
		case ctrl('b'):
			wwscroll(selwin, - selwin->ww_w.nr);
			break;
		case ctrl('s'):
			stopwin(selwin);
			break;
		case ctrl('q'):
			startwin(selwin);
			break;
		case ctrl('l'):
			wwredraw();
			break;
		case '?':
			c_help();
			break;
		case ctrl('['):
			if (checkproc(selwin) >= 0)
				out = 1;
			break;
		case ctrl('z'):
			wwsuspend();
			break;
		case 'q':
			c_quit();
			break;
		/* debugging stuff */
		case '&':
			if (debug) {
				c_debug();
				break;
			}
		default:
			if (c == escapec) {
				if (checkproc(selwin) >= 0) {
					(void) write(selwin->ww_pty,
						&escapec, 1);
					out = 1;
				}
			} else {
				if (!terse)
					wwbell();
				error("Type ? for help.");
			}
		}
	}
	if (!quit)
		setcmd(0);
}
Ejemplo n.º 3
0
Cmdret
dohelp ()
{
    char *cp, *ncp;
    int len, num;
#ifndef ANSI
    static char helpfile[] = EDIR(help);
#else
    static char helpfile[] = EDIR("help");
#endif
    Short i;
    Short j;

    cp = append (helpfile, ediag ("", "_r"));
    if (editfile (cp, (Ncols) -1, (Nlines) -1, 0, NO, NO) <= 0) {
	sfree (cp);
	mesg (ERRALL + 1, ediag("Help file gone: notify sys admin.",
	   "Отсутствует help-файл: обратитесь к системным программистам."));
	return CROK;
    }
    sfree (cp);

    fileflags[curfile] &= ~CANMODIFY;

    if (Item == (S_help *) NULL) { /* Initilize help structures */
	if ((cp = pkarg (curwksp,
			 (Nlines) 0, (Ncols) 0,
			 &len, PK_UPTOS)) == (char *) NULL) {
	Err:
	    deffn = curfile;
	    (void) eddeffile (YES);
	    mesg (ERRALL + 1, ediag("Bad format of Help file: notify sys admin.",
	       "Неверный формат help-файла: обратитесь к системным программистам."));
	    return CROK;
	}
	if (len == 0 || s2i (cp, &HelpItems) == cp
	     || HelpItems <= 0 || HelpItems >= la_lsize (curlas) - 1) {
	    sfree (cp);
	    goto Err;
	}
	sfree (cp);
	if ((Item = (S_help *) salloc (HelpItems * sizeof (S_help), NO))
		== (S_help *) NULL)
	    goto Err;
	for (i = 0; i < HelpItems; i++) {
	    if ((cp = pkarg (curwksp,
			     (Nlines) i + 1, (Ncols) 0,
			     &len, PK_FIELD)) == (char *) NULL) {
	ErrAll:
		for (j = 0; j < i; j++)
		    sfree (Item[j].item_name);
		sfree ((char *) Item);
		goto Err;
	    }
	    if (len == 0) {
		sfree (cp);
		goto ErrAll;
	    }
	    Item[i].item_name = cp;
	    Item[i].item_len = len;
	    if ((cp = pkarg (curwksp,
			     (Nlines) i + 1, (Ncols) len + 1,
			     &len, PK_FIELD)) == (char *) NULL) {
	    ErrNum:
		sfree (Item[i].item_name);
		goto ErrAll;
	    }
	    if (len == 0
		|| (ncp = s2i (cp, &num)) == cp
		|| num <= HelpItems + 1) {
	    ErrPar:
		sfree (cp);
		goto ErrNum;
	    }
	    Item[i].def_line = num - 1;
	    while (isspace (*ncp))
		ncp++;
	    if (s2i (ncp, &num) == ncp || num < 0)
		goto ErrPar;
	    sfree (cp);
	    Item[i].def_col = num;
	}
    }   /* End of init */

    fileflags[curfile] |= HELP;
    HelpActive = YES;

    movewin ((Nlines) HelpItems + 1, (Ncols) 0, (Scols) 0, (Slines) 0, NO);
    putupwin ();
    HelpGotoMarg (NO);

    return CROK;
}