Beispiel #1
0
drawcmd ()
{
	int c;
	CURSOR cursor;

	if (H==LINES-7 && strlen (cur->shortcwd) + 3 + esclen (command) > 79) {
		fullscreen ();
		draw ();
	}
	for (c=H+5; c<LINES-1; ++c) {
		VMove (c, 0);
		VClearLine ();
	}
	VSetDim ();
	VMPutString (H+5, 0, cur->shortcwd);
	VSetBold ();
	VPutString (" > ");
	VSetNormal ();
	cursor = VGetCursor ();
	putescstr (command);
	if (c = command [cpos]) {
		VSetCursor (cursor);
		command [cpos] = 0;
		putescstr (command);
		command [cpos] = c;
	}
}
Beispiel #2
0
static void drawmenu (struct menu *m)
{
    register i, reverse;

    VClearBox (1, m->col-1, m->hgh+3, m->wid+4);
    VSetBold ();
    VDrawBox (1, m->col, m->hgh+2, m->wid+2);
    VSetDim ();
    for (i=0; m->submenu[i].name; ++i)
        if (! m->submenu[i].name[0])
            VHorLine (i+2, m->col+2, m->wid-2);
    VSetNormal ();
    for (i=0; m->submenu[i].name; ++i) {
        if (! m->submenu[i].name[0])
            continue;
        reverse = 0;
        if (i == m->nsm)
            reverse = VStandOut ();
        else if (! m->submenu[i].active)
            VSetDim ();
        VMove (2+i, m->col+1);
        VPutChar (i==m->nsm && !reverse ? '[' : ' ');
        VPrint ("%c %-*s", m->submenu[i].tag ? '*' : ' ',
                m->wid-4, m->submenu[i].name);
        VPutChar (i==m->nsm && !reverse ? ']' : ' ');
        if (i == m->nsm)
            VStandEnd ();
        else if (! m->submenu[i].active)
            VSetNormal ();
    }
}
Beispiel #3
0
static void drawhead (int nm)
{
    register i, reverse;

    VSetDim ();
    reverse = VStandOut ();
    VMove (0, 0);
    for (i=0; i<80; ++i)
        VPutChar (' ');
    VMove (0, 2);
    for (i=0; menu[i].name; ++i) {
        if (i == nm) {
            VStandEnd ();
            VSetBold ();
        }
        VPutChar (' ');
        VPutChar (i==nm && !reverse ? '[' : ' ');
        VPutString (menu[i].name);
        VPutChar (i==nm && !reverse ? ']' : ' ');
        VPutChar (' ');
        if (i == nm) {
            VStandOut ();
            VSetDim ();
        }
    }
    VSetNormal ();
    VStandEnd ();
}
Beispiel #4
0
void runhelp (char *name)
{
	register r, c, w, h;
	BOX *box;
	register struct helptab *p;
	struct help *hp;

	hp = findhelp (name);
	if (! hp)
		return;
	p = hp->htab;
	if (! p->str)
		inithelp (hp);
	w = 72;
	h = 21;
	r = 2;
	c = 4;

	box = VGetBox (r, c-1, h, w+2);                 /* save box */
	VStandOut ();
	VSetDim ();
	VFillBox (r, c-1, h, w+2, ' ');                 /* clear */
	VDrawBox (r, c, h, w);                          /* draw margins */
	VMPutString (r, c + (w-6) / 2, " Help ");       /* head */

	for (; p->row; ++p) {
		if (p->row >= h)
			continue;
		if (p->bold) {
			VSetBold ();
			VStandEnd ();
		}
		if (! p->col)
			VMPutString (r+p->row, c + (w-strlen(p->str))/2, p->str);
		else
			VMPutString (r+p->row, c + p->col, p->str);
		if (p->bold) {
			VSetDim ();
			VStandOut ();
		}
	}
	VStandEnd ();
	VSetNormal ();
	for (;;) {
		hidecursor ();
		VSync ();
		switch (KeyGet ()) {
		default:
			break;
		case cntrl (']'):       /* redraw screen */
			VRedraw ();
			continue;
		}
		break;
	}
	VUngetBox (box);
	VFreeBox (box);
}
Beispiel #5
0
void doquit() {

	if (! saved_batch && loaded_batch)
		save_batch ();

	VMove (LINES - 1, 0);
	VClearLine ();
	VMove (LINES - 2, 0);
	VSetPalette (2, 0, 7, 1, 15, 0, 15, 7, 14, 0, 15, 1);
	VSetBold ();
	VSync ();
	VClose ();
# ifdef MSDOS
	_dos_setvect (0x1C, old_timer);
# endif
	exit (0);

}
Beispiel #6
0
int getchoice (int bold, char *head, char *msg, char *mesg2,
               char *c1, char *c2, char *c3)
{
    int len, ch;
    int isattr;
    register r, c, w, h;
    BOX *box;
    char mesg[67];

    strncpy(mesg, msg, sizeof (mesg));
    mesg[sizeof(mesg)-1] = 0;
    w = strlen (mesg);
    if (mesg2) {
        len = strlen (mesg2);
        if (len > w)
            w = len;
    }
    len = strlen (head);
    if (len > w)
        w = len;
    len = 0;
    if (c1)
        len += strlen (c1);
    if (c2)
        len += strlen (c2);
    if (c3)
        len += strlen (c3);
    if (len > w)
        w = len;
    h = 6;
    w += 10;
    if (bold)
        r = LINES/2;
    else
        r = LINES/4;
    c = (80 - w) / 2;

    box = VGetBox (r-1, c-2, h+2, w+4);             /* save box */
    isattr = VStandOut ();
    if (bold)
        VSetBold ();
    else
        VSetDim ();
    VFillBox (r-1, c-2, h+2, w+4, ' ');             /* clear */
    VDrawBox (r, c, h, w);                          /* draw margins */
    VMPutString (r, c + (w-strlen(head)) / 2, head); /* head */
    if (mesg2) {
        VMPutString (r+1, c + (w-strlen(mesg)) / 2, mesg);
        VMPutString (r+2, c + (w-strlen(mesg2)) / 2, mesg2);
    } else
        VMPutString (r+2, c + (w-strlen(mesg)) / 2, mesg);

    if (c1) {
        if (isattr) {
            attron = VStandEnd;
            attroff = VStandOut;
        } else {
            attron = 0;
            attroff = 0;
        }
        initchoice (r+4, c+w/2, c1, c2, c3);

        ch = menuchoice ();
        VStandEnd ();
        VSetNormal ();
        VUngetBox (box);
        VFreeBox (box);
        return (ch);
    } else {
        /* message */
        VStandEnd ();
        VSetNormal ();
        mbox = box;
        hidecursor ();
        VSync ();
#ifdef DOC
        KeyGet ();
#endif
        return (0);
    }
}