Esempio n. 1
0
/*
 * Internal process context used to control the screen for use by
 * the menu manager, and the window manager.
 * This process never terminates and forms an integral part of
 * the system.
 */
void ctlmgr(void)
{
    WORD    ev_which;
    WORD    rets[6];
    WORD    i, wh;

    /*
     * set defaults for multi wait
     */
    gl_ctwait.m_out = FALSE;
    rc_copy(&gl_rmenu, (GRECT *)&gl_ctwait.m_x);
    while(TRUE)
    {
        /* fix up ctrl rect */
        w_setactive();
        /*
         * wait for something to happen, keys need to be eaten
         * inc. fake key sent by ... or if button already down,
         * then let other guys run then do it
         */
        if (button)
        {
            for (i = 0; i < (totpds*2); i++)
                dsptch();

            ev_which = MU_BUTTON;
            rets[0] = xrat;
            rets[1] = yrat;
        }
        else
        {
            ev_which = MU_KEYBD | MU_BUTTON;
            if ( gl_mntree != 0x0L )    /* only wait on bar when there  */
                ev_which |= MU_M1;      /* is a menu                    */
            ev_which = ev_multi(ev_which, &gl_ctwait, &gl_ctwait,
                                0x0L, 0x0001ff01L, 0x0L, rets);
        }

        ct_mouse(TRUE);                 /* grab screen sink     */
        /*
         * button down over area ctrl mgr owns.  find out which
         * window the mouse clicked over and handle it
         */
        if (ev_which & MU_BUTTON)
        {
            wh = wm_find(rets[0], rets[1]);
            if (wh > 0)
                hctl_window( wh, rets[0], rets[1] );
        }
                                        /* mouse over menu bar  */
        if (ev_which & MU_M1)
            hctl_rect();
        ct_mouse(FALSE);                /* give up screen sink  */
    }
}
Esempio n. 2
0
WORD fm_alert(WORD defbut, LONG palstr)
{
        register WORD   i;
        WORD            inm, nummsg, mlenmsg, numbut, mlenbut, image;
        LONG            tree;
        GRECT           d, t;
        OBJECT          *obj;

                                                /* init tree pointer    */
        tree = (LONG) rs_trees[DIALERT];

        gsx_mfset(ad_armice);

        fm_parse(tree, palstr, &inm, &nummsg, &mlenmsg, &numbut, &mlenbut);
        fm_build(tree, (inm != 0), nummsg, mlenmsg, numbut, mlenbut);

        if (defbut)
        {
          obj = ((OBJECT *)tree) + BUTOFF + defbut - 1;
          obj->ob_flags |= DEFAULT;
        }

        obj = ((OBJECT *)tree) + 1;

        if (inm != 0)
        {
          switch(inm) {
            case 1:
              image = NOTEBB;
              break;
            case 2:
              image = QUESTBB;
              break;
            default:
              image = STOPBB;
              break;
          }
          obj->ob_spec = (LONG) &rs_bitblk[image];
        }
                                                /* convert to pixels    */
        for(i=0; i<NUM_ALOBJS; i++)
          rs_obfix(tree, i);
                                                /* fix up icon, 32x32   */
        obj->ob_type = G_IMAGE;
        obj->ob_width = obj->ob_height = 32;
                                                /* center tree on screen*/
        ob_center(tree, &d);

        /* Fix 2003-09-25: Limit drawing to the screen! */
        rc_intersect(&gl_rscreen, &d);
                                                /* save screen under-   */
                                                /*   neath the alert    */
        wm_update(TRUE);
        gsx_gclip(&t);
        bb_save(&d);
                                                /* draw the alert       */
        gsx_sclip(&d);
        ob_draw(tree, ROOT, MAX_DEPTH);
                                                /* turn on the mouse    */
        ct_mouse(TRUE);
                                                /* let user pick button */
        i = fm_do(tree, 0);
                                                /* turn off mouse if necessary */
        ct_mouse(FALSE);
                                                /* restore saved screen */
        gsx_sclip(&d);
        bb_restore(&d);
        gsx_sclip(&t);
        wm_update(FALSE);
                                                /* return selection     */
        return( i - BUTOFF + 1 );
}