Exemplo n.º 1
0
static void draw_atom(Display *disp, Window w, GC gc,
                      atom_id ai, iv2 vec2[], unsigned long col[], int size[],
                      bool bBall, bool bPlus)
{
    int xi, yi;

    xi = vec2[ai][XX];
    yi = vec2[ai][YY];
    XSetForeground(disp, gc, col[ai]);
    if (bBall)
    {
        XFillCircle(disp, w, gc, xi, yi, size[ai]-1);
        XSetForeground(disp, gc, BLACK);
        XDrawCircle(disp, w, gc, xi, yi, size[ai]);
        /*    XSetForeground(disp,gc,WHITE);
           XFillCircle(disp,w,gc,xi+4,yi-4,4); */
    }
    else if (bPlus)
    {
        XDrawLine(disp, w, gc, xi-MSIZE, yi, xi+MSIZE+1, yi);
        XDrawLine(disp, w, gc, xi, yi-MSIZE, xi, yi+MSIZE+1);
    }
    else
    {
        XDrawLine(disp, w, gc, xi-1, yi, xi+1, yi);
    }

}
Exemplo n.º 2
0
static int WndProcRB(t_x11 *x11, t_dlgitem *dlgitem, XEvent *event)
{
    t_radiobutton *rb;
    t_windata     *win;
    int            x, y, rad;

    if (dlgitem->type != edlgRB)
    {
        gmx_incons("radiobutton processing");
    }
    rb  = &(dlgitem->u.radiobutton);
    win = &(dlgitem->win);

    rad = win->height/3;
    x   = rad;
    y   = win->height/2;
    switch (event->type)
    {
        case Expose:
            XClearArea(x11->disp, win->self, x-rad, y-rad, x+rad, y+rad, False);
            if (rb->bSelect)
            {
                /* Filled */
                XFillCircle(x11->disp, win->self, x11->gc, x, y, rad);
            }
            XDrawCircle(x11->disp, win->self, x11->gc, x, y, rad);
            x += rad+OFFS_X;
            TextInRect(x11, win->self, win->text, x, 0, win->width-x, win->height,
                       eXLeft, eYCenter);
            break;
        case ButtonPress:
            if (!rb->bSelect)
            {
                return RBPRESSED;
            }
            XBell(x11->disp, 50);
            break;
        case EnterNotify:
        case LeaveNotify:
            break;
        default:
            return DefWndProc(x11, dlgitem, event);
    }
    return ITEMOK;
}
Exemplo n.º 3
0
static bool LogoCallBack(t_x11 *x11, XEvent *event, Window /*w*/, void *data)
{
    /* Assume window is 100x110 */
    static bool bFirst = true;
#define CSIZE 9
#define NSIZE 8
#define OSIZE 9
#define HSIZE 7
#define YOFFS 30
    static t_circle c[] = {
        { 10, YOFFS+12, CSIZE, &LIGHTGREEN },
        { 20, YOFFS+22, CSIZE, &LIGHTGREEN },
        { 20, YOFFS+34, OSIZE, &LIGHTRED   },
        { 30, YOFFS+12, NSIZE, &LIGHTCYAN  },
        { 30, YOFFS+ 2, HSIZE, &WHITE     },
        { 40, YOFFS+22, CSIZE, &LIGHTGREEN },
        { 40, YOFFS+34, CSIZE, &LIGHTGREEN },
        { 50, YOFFS+12, CSIZE, &LIGHTGREEN },
        { 50, YOFFS,    OSIZE, &LIGHTRED   },
        { 60, YOFFS+22, NSIZE, &LIGHTCYAN  },
        { 60, YOFFS+32, HSIZE, &WHITE     },
        { 70, YOFFS+12, CSIZE, &LIGHTGREEN },
        { 80, YOFFS+22, CSIZE, &LIGHTGREEN },
        { 80, YOFFS+34, OSIZE, &LIGHTRED   },
        { 90, YOFFS+12, NSIZE, &LIGHTCYAN  },
        { 90, YOFFS+ 2, HSIZE, &WHITE      },
        {100, YOFFS+22, CSIZE, &LIGHTGREEN }
    };
    static int      lines[] = {
        0, 1, 1, 2, 1, 3, 3, 4, 3, 5, 5, 6, 5, 7, 7, 8, 7, 9,
        9, 10, 9, 11, 11, 12, 12, 13, 12, 14, 14, 15, 14, 16
    };
#define COFFS 70
    static t_mess   Mess[] = {
        { "GROMACS",                         0,       20, NULL },
        { NULL,                             16,        9, NULL },
        { "Copyright (c) 1991-2013",        COFFS+ 2,  9, NULL },
        { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11,  9, NULL },
        { "& Groningen University ",        COFFS+20,  9, NULL },
        { "click to dismiss",               COFFS+31,  8, NULL }
    };
#define NMESS asize(Mess)
    int             i;
    real            wfac, hfac;
    t_logo         *logo;
    t_windata      *wd;

    logo = (t_logo *)data;
    wd   = &(logo->wd);
    if (bFirst)
    {
        wfac = wd->width/110.0;
        hfac = wd->height/110.0;
        for (i = 0; (i < asize(c)); i++)
        {
            c[i].x *= wfac;
            c[i].y *= hfac;
        }
        Mess[1].text = GromacsVersion();
        for (i = 0; (i < NMESS); i++)
        {
            Mess[i].y  *= hfac;
            Mess[i].h  *= hfac;
            Mess[i].fnt = (i == 0) ? logo->bigfont : (i == NMESS-1) ? x11->font :
                logo->smallfont;
        }
        bFirst = false;
    }
    switch (event->type)
    {
        case Expose:
            XSetForeground(x11->disp, x11->gc, WHITE);
            XSetLineAttributes(x11->disp, x11->gc, 3, LineSolid, CapNotLast, JoinRound);
            for (i = 0; (i < asize(lines)); i += 2)
            {
                XDrawLine(x11->disp, wd->self, x11->gc,
                          c[lines[i]].x, c[lines[i]].y, c[lines[i+1]].x, c[lines[i+1]].y);
            }
            XSetLineAttributes(x11->disp, x11->gc, 1, LineSolid, CapNotLast, JoinRound);
            for (i = 0; (i < asize(c)); i++)
            {
                XSetForeground(x11->disp, x11->gc, *(c[i].col));
                XFillCircle(x11->disp, wd->self, x11->gc, c[i].x, c[i].y, c[i].rad);
            }
            XSetForeground(x11->disp, x11->gc, BLACK);
            XDrawRectangle(x11->disp, wd->self, x11->gc, 2, 2, wd->width-5, wd->height-5);
            for (i = 0; (i < NMESS); i++)
            {
                SpecialTextInRect(x11, Mess[i].fnt, wd->self, Mess[i].text,
                                  0, Mess[i].y, wd->width, Mess[i].h,
                                  eXCenter, eYCenter);
            }
            XSetForeground(x11->disp, x11->gc, x11->fg);
            break;
        case ButtonPress:
            hide_logo(x11, logo);
            return logo->bQuitOnClick;
            break;
        default:
            break;
    }

    return false;
}