Esempio n. 1
0
File: menu.c Progetto: ralienpp/deco
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 ();
    }
}
Esempio n. 2
0
/* main, menu */
void setdwid (void) {
	VClearBox (1, 0, LINES-2, 80);
	fullwin ^= 1;
	while (left->d.topfile + PAGELEN (left) <= left->d.curfile)
		left->d.topfile += H;
	while (right->d.topfile + PAGELEN (right) <= right->d.curfile)
		right->d.topfile += H;
}
Esempio n. 3
0
/* com, main, menu */
void fullscreen (void) {
	VClearBox (1, 0, LINES-2, 80);
	if (H == LINES/2-1)
		H = LINES-7;
	else
		H = LINES/2-1;
	while (left->d.topfile + PAGELEN (left) <= left->d.curfile)
		left->d.topfile += H;
	while (right->d.topfile + PAGELEN (right) <= right->d.curfile)
		right->d.topfile += H;
}
Esempio n. 4
0
static char *editstring (int r, int c, int w, char *str, int cp)
{
    register key, k;
    int firstkey = 1;

    if (cp) {
        for (cp=0; str[cp]; ++cp);
        firstkey = 0;
    }
    for (; ; firstkey=0) {
        VClearBox (r, c, 1, w);
        VMPutString (r, c, str);
        VMove (r, c+cp);
        VSync ();
        switch (key = KeyGet ()) {
        default:
            if (key<' ' || (key>'~' && key<0300) || key>0377) {
                VBeep ();
                continue;
            }
            if (firstkey) {
                str[0] = key;
                str[1] = 0;
                cp = 1;
                continue;
            }
            for (k=cp; str[k]; ++k)
                SWAP (key, str[k]);
            str [k] = key;
            str [w] = str [k+1] = 0;
        /* fall through */
        case meta ('r'):        /* right */
            if (str [cp]) {
                ++cp;
                if (cp >= w)
                    cp = w-1;
            }
            continue;
        case meta ('l'):        /* left */
            if (--cp < 0)
                cp = 0;
            continue;
        case cntrl (']'):       /* redraw screen */
            VRedraw ();
            continue;
        case cntrl ('C'):
        case cntrl ('['):
        case meta ('J'):        /* f0 */
            return (0);
        case cntrl ('M'):
        case cntrl ('J'):
            return (str);
        case cntrl ('I'):
            if (str [cp])
                while (str [++cp]);
            else
                cp = 0;
            continue;
        case meta ('h'):        /* home */
            cp = 0;
            continue;
        case meta ('e'):        /* end */
            while (str [cp])
                ++cp;
            continue;
        case meta ('b'):        /* back space */
            if (cp) {
                for (k=cp--; str[k]; ++k)
                    str[k-1] = str[k];
                str [k-1] = 0;
            }
            continue;
        case cntrl ('G'):       /* delete */
            if (! str [cp])
                continue;
            for (k=cp+1; str[k]; ++k)
                str[k-1] = str[k];
            str [k-1] = 0;
            continue;
        case cntrl ('Y'):       /* clear line */
            str [cp = 0] = 0;
            continue;
        }
    }
}