Example #1
0
int Ginitgraphics (void) {
    argn = 0;
#if defined(FEATURE_NEXTAW) || defined(FEATURE_XAW3D)
    if (!(Groot = XtAppInitialize (
        &appcontext, "LEFTY", NULL, 0, &argn, NULL, props, NULL, 0
    )))
#else
    if (!(Groot = XtAppInitialize (
        &appcontext, "LEFTY", NULL, 0, &argn, NULL, NULL, NULL, 0
    )))
#endif
        Gerr (POS, G_ERRINITFAILED);
    XtAppAddActions (appcontext, actiontable, XtNumber (actiontable));
    Gtweoltable = XtParseTranslationTable (deftweoltrans);
    Gqwpoptable = XtParseTranslationTable (defqwpoptrans);
    Glwanytable = XtParseTranslationTable (deflwanytrans);
    Gcwanytable = XtParseTranslationTable (defcwanytrans);
    Gqwdeltable = XtParseTranslationTable (defqwdeltrans);
    Gwmdeltable = XtParseTranslationTable (defwmdeltrans);
    XtRegisterGrabAction (
        Glwbutaction, True,
        ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync
    );
    XtRegisterGrabAction (
        Gcwbutaction, True,
        ButtonPressMask | ButtonReleaseMask, GrabModeAsync, GrabModeAsync
    );
    Gdisplay = XtDisplay (Groot);
    Gscreenn = DefaultScreen (Gdisplay);
    Gdepth = DefaultDepth (Gdisplay, Gscreenn);
    deffont = XLoadQueryFont (Gdisplay, "fixed");
    Gxfd = ConnectionNumber (Gdisplay);
    Gqwdelatom = XInternAtom (Gdisplay, "WM_DELETE_WINDOW", False);
    Gwmdelatom = XInternAtom (Gdisplay, "WM_DELETE_WINDOW", False);
    Gpopdownflag = FALSE;
    Glazyq.flag = 0;
    Gbufp = Marrayalloc ((long) BUFINCR * BUFSIZE);
    Gbufn = BUFINCR;
    Gppp = Marrayalloc ((long) PPINCR * PPSIZE);
    Gppn = PPINCR;
    Gfontp = Marrayalloc ((long) FONTSIZE);
    Gfontn = 1;
    Gfontp[0].name = strdup ("default");
    if (!Gdefaultfont)
        Gfontp[0].font = deffont;
    else if (Gdefaultfont[0] != '\000')
        Gfontp[0].font = XLoadQueryFont (Gdisplay, Gdefaultfont);
    else
        Gfontp[0].font = NULL;
    return 0;
}
Example #2
0
void Cinit (void) {
    Code_t c;

    cbufp = Marrayalloc ((long) CBUFINCR * CBUFSIZE);
    cbufn = CBUFINCR;
    cbufi = 0;
    Cstringoffset = (char *) &c.u.s[0] - (char *) &c + 1;
    /* the + 1 above accounts for the null character */
}
Example #3
0
void Gawinitialize (Gwidget_t *widget, int mode) {
    WAU->data.type = mode;
    if (!(WAU->data.carray = Marrayalloc ((long) AWCARRAYINCR * AWCARRAYSIZE)))
        panic (POS, "Gawinitialize", "cannot allocate carray");
    WAU->data.cn = AWCARRAYINCR;
    WAU->data.cj = 0;
    WAU->data.batchmode = FALSE;
    WAU->data.working = FALSE;
}
Example #4
0
void Einit(void)
{
    root = Ttable(100);
    rootm = Mpushmark(root);
    Tinss(root, "null", (null = Ttable(2)));
    rtno = NULL;
    pljbufp1 = pljbufp2 = NULL, pljtype = 0;
    eljbufp = NULL;
    lvarp = Marrayalloc((long) LVARINCR * LVARSIZE);
    lvarn = LVARINCR;
    llvari = 0;
    flvari = 0;
    sinfop = Marrayalloc((long) SINFOINCR * SINFOSIZE);
    sinfon = SINFOINCR;
    sinfoi = 0;
    Erun = FALSE;
    running = 0;
    Eoktorun = FALSE;
}
Example #5
0
void IOinit (void) {
    struct stat statbuf;
    int ioi;

    iop = Marrayalloc ((long) IOINCR * IOSIZE);
    ion = IOINCR;
    for (ioi = 0; ioi < ion; ioi++)
        iop[ioi].inuse = FALSE;
    for (ioi = 0; ioi < 3; ioi++)
        if (fstat (ioi, &statbuf) == 0) {
            iop[ioi].inuse = TRUE;
            iop[ioi].type = IO_FILE;
            iop[ioi].ifp = iop[ioi].ofp = fdopen (ioi, "r+");
            if (!(iop[ioi].buf = malloc (IOBUFSIZE)))
                panic1 (POS, "IOinit", "malloc failed");
            iop[ioi].buf[0] = 0;
        }
}
Example #6
0
static void viewon (void) {
    Gwattr_t data[5];

    data[0].id = G_ATTRNAME;
    data[0].u.t = "LEFTY text view";
    data[1].id = G_ATTRORIGIN;
    data[1].u.p.x = txtx, data[1].u.p.y = txty;
    data[2].id = G_ATTRSIZE;
    data[2].u.s.x = txtwidth, data[2].u.s.y = txtheight;
    txtwi = Gcreatewidget (-1, G_VIEWWIDGET, 3, &data[0]);

    data[0].id = G_ATTRSIZE;
    data[0].u.s.x = txtwidth, data[0].u.s.y = txtheight;
    data[1].id = G_ATTRBORDERWIDTH;
    data[1].u.i = 1;
    data[2].id = G_ATTRRESIZECB;
    data[2].u.func = coords2func;
    listwi = Gcreatewidget (txtwi, G_ARRAYWIDGET, 3, &data[0]);
    Gawsetmode (&Gwidgets[listwi], TRUE);

    data[0].id = G_ATTRSIZE;
    data[0].u.s.x = txtwidth, data[0].u.s.y = txtheight / 3;
    data[1].id = G_ATTRBORDERWIDTH;
    data[1].u.i = 0;
    data[2].id = G_ATTRTEXT;
    data[2].u.t = NULL;
    data[3].id = G_ATTRNEWLINECB;
    data[3].u.func = TXTprocess;
    data[4].id = G_ATTRMODE;
    data[4].u.t = "oneline";
    cmdwi = Gcreatewidget (listwi, G_TEXTWIDGET, 5, &data[0]);

    data[0].id = G_ATTRSIZE;
    data[0].u.s.x = txtwidth, data[0].u.s.y = txtheight * 2 / 3;
    data[1].id = G_ATTRMODE;
    data[1].u.t = "forcebars";
    scrollwi = Gcreatewidget (listwi, G_SCROLLWIDGET, 2, &data[0]);

    data[0].id = G_ATTRRESIZECB;
    data[0].u.func = coordsfunc;
    data[1].id = G_ATTRSIZE;
    data[1].u.s.x = txtwidth, data[1].u.s.y = txtheight;
    data[2].id = G_ATTRBORDERWIDTH;
    data[2].u.i = 0;
    arraywi = Gcreatewidget (scrollwi, G_ARRAYWIDGET, 3, &data[0]);

    Gawsetmode (&Gwidgets[listwi], FALSE);

    if (!(txtroot = malloc (sizeof (txtnode_t))))
        panic (POS, "TXTinit", "txtroot malloc failed");
    *txtroot = defnode;
    txtroot->mode = TXT_FULL;
    txtroot->vo = root;
    txtroot->path = NULL;
    txtroot->u.f.t.mwi = arraywi;

    seenp = Marrayalloc ((long) SEENINCR * SEENSIZE);
    seeni = 0;
    seenn = SEENINCR;
    txton = TRUE;
}
Example #7
0
void Dinit (void) {
    seenp = Marrayalloc ((long) SEENINCR * SEENSIZE);
    seeni = 0;
    seenn = SEENINCR;
}
Example #8
0
int Ginitgraphics (void) {
    WNDCLASS wc;
    HDC hdc;
    ATOM rtn;

    if (!hprevinstance) {
        wc.style = NULL;
        wc.lpfnWndProc = LeftyWndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hinstance;
        wc.hIcon = LoadIcon ((HINSTANCE) NULL, IDI_APPLICATION);
        wc.hCursor = LoadCursor ((HINSTANCE) NULL, IDC_ARROW);
        wc.hbrBackground = GetStockObject (WHITE_BRUSH);
        wc.lpszMenuName = 0;
        wc.lpszClassName = "LeftyClass";
        if (!(rtn = RegisterClass (&wc)))
            panic (POS, "GXinit", "register class rtn = %d", (int) rtn);

        wc.style = NULL;
        wc.lpfnWndProc = ArrayWndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hinstance;
        wc.hIcon = LoadIcon ((HINSTANCE) NULL, IDI_APPLICATION);
        wc.hCursor = LoadCursor ((HINSTANCE) NULL, IDC_ARROW);
        wc.hbrBackground = GetStockObject (WHITE_BRUSH);
        wc.lpszMenuName = 0;
        wc.lpszClassName = "ArrayClass";
        if (!(rtn = RegisterClass (&wc)))
            panic (POS, "GXinit", "register class rtn = %d", (int) rtn);

        wc.style = CS_OWNDC;
        wc.lpfnWndProc = CanvasWndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hinstance;
        wc.hIcon = LoadIcon ((HINSTANCE) NULL, IDI_APPLICATION);
        wc.hCursor = NULL;
        wc.hbrBackground = GetStockObject (WHITE_BRUSH);
        wc.lpszMenuName = 0;
        wc.lpszClassName = "CanvasClass";
        if (!(rtn = RegisterClass (&wc)))
            panic (POS, "GXinit", "register class rtn = %d", (int) rtn);

        wc.style = NULL;
        wc.lpfnWndProc = ScrollWndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hinstance;
        wc.hIcon = LoadIcon ((HINSTANCE) NULL, IDI_APPLICATION);
        wc.hCursor = LoadCursor ((HINSTANCE) NULL, IDC_ARROW);
        wc.hbrBackground = GetStockObject (WHITE_BRUSH);
        wc.lpszMenuName = 0;
        wc.lpszClassName = "ScrollClass";
        if (!(rtn = RegisterClass (&wc)))
            panic (POS, "GXinit", "register class rtn = %d", (int) rtn);

        wc.style = NULL;
        wc.lpfnWndProc = LabelWndProc;
        wc.cbClsExtra = 0;
        wc.cbWndExtra = 0;
        wc.hInstance = hinstance;
        wc.hIcon = LoadIcon ((HINSTANCE) NULL, IDI_APPLICATION);
        wc.hCursor = LoadCursor ((HINSTANCE) NULL, IDC_ARROW);
        wc.hbrBackground = GetStockObject (WHITE_BRUSH);
        wc.lpszMenuName = 0;
        wc.lpszClassName = "LabelClass";
        if (!(rtn = RegisterClass (&wc)))
            panic (POS, "GXinit", "register class rtn = %d", (int) rtn);
    }
    if (getenv ("LEFTY3BMOUSE"))
        twobmouse = FALSE;
    else
        twobmouse = TRUE;
    hdc = GetDC ((HWND) NULL);
    Gdepth = GetDeviceCaps (hdc, BITSPIXEL);
    deffont = GetStockObject (SYSTEM_FONT);
#ifndef FEATURE_MS
    if (!(Gxfp = fopen ("/dev/windows", "r")))
        panic (POS, "GXinit", "cannot open windows device");
    Gxfd = fileno (Gxfp);
#endif
    Gpopdownflag = FALSE;
    Gbufp = Marrayalloc ((long) BUFINCR * BUFSIZE);
    Gbufn = BUFINCR;
    Gppp = Marrayalloc ((long) PPINCR * PPSIZE);
    Gppn = PPINCR;
    Gfontp = Marrayalloc ((long) FONTSIZE);
    Gfontn = 1;
    Gfontp[0].name = strdup ("default");
    if (!Gdefaultfont)
        Gfontp[0].font = deffont;
    else if (Gdefaultfont[0] != '\000')
        Gfontp[0].font = CreateFont (
            0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Gdefaultfont
        );
    else
        Gfontp[0].font = NULL;
    ReleaseDC ((HWND) NULL, hdc);
    Gnocallbacks = FALSE;
    return 0;
}
Example #9
0
void Pinit (void) {
    lvp = Marrayalloc ((long) LVINCR * LVSIZE);
    lvn = LVINCR;
    flvi = llvi = 0;
}