コード例 #1
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
/*
*       Call to move top window.  This involves BLTing the window if
*       none of it that is partially off the screen needs to be redraw,
*       else the whole desktop to just updated.  All uncovered portions
*       of the desktop are redrawn by later by calling w_update.
*/
WORD w_move(WORD w_handle, WORD *pstop, GRECT *prc)
{
        GRECT           s;                      /* source               */
        GRECT           d;                      /* destination          */
        register GRECT  *pc;
        register WORD   sminus1, dminus1;

        w_getsize(WS_PREV, w_handle, &s);
        s.g_w += 2;
        s.g_h += 2;
        w_getsize(WS_TRUE, w_handle, &d);
                                                /* set flags for when   */
                                                /*   part of the source */
                                                /*   is off the screen  */
        if ( ( (s.g_x + s.g_w > gl_width) && (d.g_x < s.g_x) )  ||
             ( (s.g_y + s.g_h > gl_height) && (d.g_y < s.g_y) )   )
        {
          rc_union(&s, &d);
          *pstop = DESKWH;
        }
        else
        {
          *pstop = w_handle;
        }
                                                /* intersect with full  */
                                                /*   screen and align   */
                                                /*   fringes if -1 xpos */
        sminus1 = w_mvfix(&s, &d);
        dminus1 = w_mvfix(&d, &s);
                                                /* blit what we can     */
        if ( *pstop == w_handle )
        {
          gsx_sclip(&gl_rfull);
          bb_screen(S_ONLY, s.g_x, s.g_y, d.g_x, d.g_y, s.g_w, s.g_h);
                                                /* cleanup left edge    */
          if (sminus1 != dminus1)
          {
            if (dminus1)
              s.g_x--;
            if (sminus1)
            {
              d.g_x--;
              d.g_w = 1;
              gsx_sclip(&d);
              w_clipdraw(gl_wtop, 0, 0, 0);
            }
          }
          pc = &s;
        }
        else
        {
          pc = &d;
        }
                                                /* clean up the rest    */
                                                /*   by returning       */
                                                /*   clip rect          */
        rc_copy(pc, prc);
        return( (*pstop == w_handle) );
}
コード例 #2
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
/*
*       Gives information about the current window to the application
*       that owns it.
*/
void wm_get(WORD w_handle, WORD w_field, WORD *poutwds)
{
        register WORD   which;
        GRECT           t;
        register ORECT  *po;

        which = -1;
        switch(w_field)
        {
          case WF_WXYWH:
                which = WS_WORK;
                break;
          case WF_CXYWH:
                which = WS_CURR;
                break;
          case WF_PXYWH:
                which = WS_PREV;
                break;
          case WF_FXYWH:
                which = WS_FULL;
                break;
          case WF_HSLIDE:
                poutwds[0] = D.w_win[w_handle].w_hslide;
                break;
          case WF_VSLIDE:
                poutwds[0] = D.w_win[w_handle].w_vslide;
                break;
          case WF_HSLSIZ:
                poutwds[0] = D.w_win[w_handle].w_hslsiz;
                break;
          case WF_VSLSIZ:
                poutwds[0] = D.w_win[w_handle].w_vslsiz;
                break;
          case WF_TOP:
                poutwds[0] = w_top();
                break;
          case WF_FIRSTXYWH:
          case WF_NEXTXYWH:
                w_getsize(WS_WORK, w_handle, &t);
                po = (w_field == WF_FIRSTXYWH) ? D.w_win[w_handle].w_rlist : 
                                                 D.w_win[w_handle].w_rnext;
                w_owns(w_handle, po, &t, &poutwds[0]);
                break;
          case WF_SCREEN:
                gsx_mret((LONG *)&poutwds[0], (LONG *)&poutwds[2]);
                break;
          case WF_TATTRB:
                poutwds[0] = D.w_win[w_handle].w_flags >> 3;
                break;
        }
        if (which != -1)
          w_getsize(which, w_handle, (GRECT *)&poutwds[0]);
}
コード例 #3
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
/*
*       Routine to top a window and then make the right redraws happen
*/
void wm_mktop(WORD w_handle)
{
        GRECT           t, p;

        if ( w_handle != gl_wtop )
        {
          ob_order(gl_wtree, w_handle, NIL);
          w_getsize(WS_PREV, w_handle, &p);
          w_getsize(WS_CURR, w_handle, &t);
          draw_change(w_handle, &t);
          w_setsize(WS_PREV, w_handle, &p);
        }
}
コード例 #4
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void w_redraw(WORD w_handle, GRECT *pt)
{
        GRECT           t, d;
        PD              *ppd;

        ppd = D.w_win[w_handle].w_owner;
                                                /* make sure work rect  */
                                                /*   and word rect      */
                                                /*   intersect          */
        rc_copy(pt, &t);
        w_getsize(WS_WORK, w_handle, &d);
        if ( rc_intersect(&t, &d) )
        {
                                                /* make sure window has */
                                                /*   owns a rectangle   */
          if ( w_union(D.w_win[w_handle].w_rlist, &d) )
          {
                                                /* intersect redraw     */
                                                /*   rect with union    */
                                                /*   of owner rects     */
            if ( rc_intersect(&d, &t) )
              ap_sendmsg(wind_msg, WM_REDRAW, ppd,
                        w_handle, t.g_x, t.g_y, t.g_w, t.g_h);
          }
        }
}
コード例 #5
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void w_setactive()
{
        GRECT           d;
        register WORD   wh;
        PD              *ppd;

        wh = w_top();
        w_getsize(WS_WORK, wh, &d);
        ppd = D.w_win[wh].w_owner;
                                                /* BUGFIX 2.1           */
                                                /*  don't chg own if null*/
        if (ppd != NULLPTR)
          ct_chgown(ppd, &d);
}
コード例 #6
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void w_cpwalk(WORD wh, WORD obj, WORD depth, WORD usetrue)
{
        GRECT           c;
                                                /* start with window's  */
                                                /*   true size as clip  */
        if ( usetrue )
          w_getsize(WS_TRUE, wh, &c);
        else
        {
                                                /* use global clip      */
          gsx_gclip(&c);
                                                /* add in drop shadow   */
          c.g_w += 2;
          c.g_h += 2;
        }
        w_bldactive(wh);
        do_walk(wh, gl_awind, obj, depth, &c);
}
コード例 #7
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void draw_change(WORD w_handle, GRECT *pt)
{
        GRECT           c, pprev;
        register GRECT  *pw;
        register WORD   start;
        WORD            stop, moved;
        WORD            oldtop, clrold, diffbord, wasclr;

        wasclr = !(D.w_win[w_handle].w_flags & VF_BROKEN);
                                                /* save old size        */
        w_getsize(WS_CURR, w_handle, &c);
        w_setsize(WS_PREV, w_handle, &c);
                                                /* set new size's       */
        w_setsize(WS_CURR, w_handle, pt);
        pw = (GRECT *) w_getxptr(WS_WORK, w_handle);
        wm_calc(WC_WORK, D.w_win[w_handle].w_kind, 
                        pt->g_x, pt->g_y, pt->g_w, pt->g_h, 
                        &pw->g_x, &pw->g_y, &pw->g_w, &pw->g_h);
                                                /* update rect. lists   */
        everyobj(gl_wtree, ROOT, NIL, (void(*)())newrect, 0, 0, MAX_DEPTH);
                                                /* remember oldtop      */
        oldtop = gl_wtop;
        gl_wtop = W_TREE[ROOT].ob_tail;
                                                /* if new top then      */
                                                /*   change men         */
        if (gl_wtop != oldtop)
          w_menufix();
                                                /* set ctrl rect and    */
                                                /*   mouse owner        */
        w_setactive();
                                                /* init. starting window*/
        start = w_handle;
                                                /* stop at the top      */
        stop = DESKWH;
                                                /* set flag to say we   */
                                                /*   haven't moved      */
                                                /*   the top window     */
        moved = FALSE;
                                                /* if same upper left   */
                                                /*   corner and not     */
                                                /*   zero size window   */
                                                /*   then its a size or */
                                                /*   top request, else  */
                                                /*   its a move, grow,  */
                                                /*   open or close.     */
        if ( (!rc_equal(&gl_rzero, pt)) &&
              (pt->g_x == c.g_x) && 
              (pt->g_y == c.g_y) )
        {
                                                /* size or top request  */
          if ( (pt->g_w == c.g_w) && (pt->g_h == c.g_h) )
          {
                                                /* sizes of prev and    */
                                                /*  current are the same*/
                                                /*  so its a top request*/

                                                /* return if this isn't */
                                                /*   a top request      */
            if ( (w_handle != W_TREE[ROOT].ob_tail) ||
                 (w_handle == oldtop) )

              return;
                                                /* say when borders will*/
                                                /*   change             */
            diffbord = !( (D.w_win[oldtop].w_flags & VF_SUBWIN) &&
                          (D.w_win[gl_wtop].w_flags & VF_SUBWIN) );
                                                /* draw oldtop covered  */
                                                /*   with deactivated   */
                                                /*   borders            */
            if (oldtop != NIL)
            {
              if (diffbord)
                w_clipdraw(oldtop, 0, MAX_DEPTH, 2);
              clrold = !(D.w_win[oldtop].w_flags & VF_BROKEN);
            }
            else
              clrold = TRUE;
                                                /* if oldtop isn't      */
                                                /*   overlapped and new */
                                                /*   top was clear then */
                                                /*   just draw activated*/
                                                /*   borders            */
            if ( (clrold) && 
                 (wasclr) )
            {
              w_clipdraw(gl_wtop, 0, MAX_DEPTH, 1);
              return;
            }
          }
          else
                                                /* size change          */
          {
                                                /* stop before current  */
                                                /*   window if shrink   */
                                                /*   was a pure subset  */
            if ( (pt->g_w <= c.g_w) && (pt->g_h <= c.g_h) )
            {
              stop = w_handle;
              w_clipdraw(gl_wtop, 0, MAX_DEPTH, 2);
              moved = TRUE;
            }
                                                /* start at bottom if   */
                                                /*   a shrink occurred  */
            if ( (pt->g_w < c.g_w) || (pt->g_h < c.g_h) )
              start = DESKWH;
                                                /* update rect. is the  */
                                                /*   union of two sizes */
                                                /*   + the drop shadow  */
            c.g_w = max(pt->g_w, c.g_w) + 2; 
            c.g_h = max(pt->g_h, c.g_h) + 2; 
          }
        }
        else
        {
                                                /* move or grow or open */
                                                /*   or close           */
          if ( !(c.g_w && c.g_h) ||
                ( (pt->g_x <= c.g_x) && 
                  (pt->g_y <= c.g_y) &&
                  (pt->g_x+pt->g_w >= c.g_x+c.g_w) && 
                  (pt->g_y+pt->g_h >= c.g_y+c.g_h)))
          {
                                                /* a grow that is a     */
                                                /*  superset or an open */
            rc_copy(pt, &c);
          }
          else
          {
                                                /* move, close or shrink*/
                                                /* do a move of top guy */
            if ( (pt->g_w == c.g_w) && 
                 (pt->g_h == c.g_h) &&
                 (gl_wtop == w_handle) )
            {
              moved = w_move(w_handle, &stop, &c);
              start = DESKWH;
            }
                                                /* check for a close    */
            if ( !(pt->g_w && pt->g_h) )
              start = DESKWH;
                                                /* handle other moves   */
                                                /*   and shrinks        */
            if ( start != DESKWH )
            {
              rc_union(pt, &c);
              if ( !rc_equal(pt, &c) )
                start = DESKWH;
            }
          }
        }
                                                /* update gl_wtop       */
                                                /*   after close,       */
                                                /*   or open            */
        if ( oldtop != W_TREE[ROOT].ob_tail )
        {
          if (gl_wtop != NIL)
          {
                                                /* open or close with   */
                                                /*   other windows open */
            w_getsize(WS_CURR, gl_wtop, pt);
            rc_union(pt, &c);
                                                /* if it was an open    */
                                                /*   then draw the      */
                                                /*   old top guy        */
                                                /*   covered            */
            if ( (oldtop != NIL ) &&
                 (oldtop != w_handle) )
            {
                                                /* BUGFIX 2/20/86 LKW   */
                                                /* only an open if prev */
                                                /*  size was zero.      */
              w_getsize(WS_PREV, gl_wtop, &pprev);
              if (rc_equal(&pprev, &gl_rzero))
                w_clipdraw(oldtop, 0, MAX_DEPTH, 2);    /* */
            }
          }
        }
        c.g_w += 2;                             /* account for drop shadow*/
        c.g_h += 2;                             /* BUGFIX in 2.1        */
                                                
                                                /* update the desktop   */
                                                /*   background         */
        if (start == DESKWH)
          w_drawdesk(&c);

                                                /* start the redrawing  */
        w_update(start, &c, stop, moved, TRUE);
}
コード例 #8
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void w_bldactive(WORD w_handle)
{
        WORD            istop, issub;
        register WORD   kind;
        register WORD   havevbar;
        register WORD   havehbar;
        GRECT           t;
        register WORD   tempw;
        WORD            offx, offy;
        WINDOW          *pw;

        if (w_handle == NIL)
          return;

        pw = &D.w_win[w_handle];
                                                /* set if it is on top  */
        istop = (gl_wtop == w_handle);
                                                /* get the kind of windo*/
        kind = pw->w_kind;
        w_nilit(NUM_ELEM, &W_ACTIVE[0]);
                                                /* start adding pieces  */
                                                /*   & adjusting sizes  */
        gl_aname.te_ptext = pw->w_pname;
        gl_ainfo.te_ptext = pw->w_pinfo;
        gl_aname.te_just = TE_CNTR;
        issub = ( (pw->w_flags & VF_SUBWIN) &&
                  (D.w_win[gl_wtop].w_flags & VF_SUBWIN) );
        w_getsize(WS_CURR, w_handle, &t);
        rc_copy(&t, (GRECT *)&W_ACTIVE[W_BOX].ob_x); /* FIXME: typecast */
        offx = t.g_x;
        offy = t.g_y;
                                                /* do title area        */
        t.g_x = t.g_y = 0;
        if ( kind & (NAME | CLOSER | FULLER) )
        {
          w_adjust(W_BOX, W_TITLE, t.g_x, t.g_y, t.g_w, gl_hbox);
          tempw = t.g_w;
          if ( (kind & CLOSER) &&
               ( istop || issub ) )
          {
            w_adjust(W_TITLE, W_CLOSER, t.g_x, t.g_y, gl_wbox, gl_hbox);
            t.g_x += gl_wbox;
            tempw -= gl_wbox;
          }
          if ( (kind & FULLER) &&
               ( istop || issub ) )
          {
            tempw -= gl_wbox;
            w_adjust(W_TITLE, W_FULLER, t.g_x + tempw, t.g_y, 
                        gl_wbox, gl_hbox);
          }
          if ( kind & NAME )
          {
            w_adjust(W_TITLE, W_NAME, t.g_x, t.g_y, tempw, gl_hbox);
            W_ACTIVE[W_NAME].ob_state = (istop || issub) ? NORMAL : DISABLED;

            /* uncomment following line to disable pattern in window title */
            gl_aname.te_color = (istop && (!issub)) ? WTS_FG : WTN_FG;
          }
          t.g_x = 0;
          t.g_y += (gl_hbox - 1);
          t.g_h -= (gl_hbox - 1);
        }
                                                /* do info area         */
        if ( kind & INFO )
        {
          w_adjust(W_BOX, W_INFO, t.g_x, t.g_y, t.g_w, gl_hbox);
          t.g_y += (gl_hbox - 1);
          t.g_h -= (gl_hbox - 1);
        }
                                                /* do data area         */
        w_adjust(W_BOX, W_DATA, t.g_x, t.g_y, t.g_w, t.g_h);
                                                /* do work area         */
        t.g_x++;
        t.g_y++;
        t.g_w -= 2;
        t.g_h -= 2;
        havevbar = kind & (UPARROW | DNARROW | VSLIDE | SIZER);
        havehbar = kind & (LFARROW | RTARROW | HSLIDE | SIZER);
        if ( havevbar )
          t.g_w -= (gl_wbox - 1);
        if ( havehbar )
          t.g_h -= (gl_hbox - 1);

        t.g_x += offx;
        t.g_y += offy;

        t.g_x = t.g_y = 1;
        w_adjust(W_DATA, W_WORK, t.g_x, t.g_y, t.g_w, t.g_h);
                                                /* do vert. area        */
        if ( havevbar )
        {
          t.g_x += t.g_w;
          w_bldbar(kind, istop || issub, W_VBAR, pw->w_vslide, 
                        pw->w_vslsiz, t.g_x, 0, 
                        t.g_w + 2, t.g_h + 2);
        }
                                                /* do horiz area        */
        if ( havehbar )
        {
          t.g_y += t.g_h;
          w_bldbar(kind, istop || issub, W_HBAR, pw->w_hslide,
                        pw->w_hslsiz, 0, t.g_y, 
                        t.g_w + 2, t.g_h + 2);
        }
                                                /* do sizer area        */
        if ( (havevbar) &&
             (havehbar) )
        {
          w_adjust(W_DATA, W_SIZER, t.g_x, t.g_y, gl_wbox, gl_hbox);
          W_ACTIVE[W_SIZER].ob_spec = 
                (istop && (kind & SIZER)) ? 0x06011100L: 0x00011100L;
        }
}
コード例 #9
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void wm_set(WORD w_handle, WORD w_field, WORD *pinwds)
{
        WORD            which, liketop, i;
        register WORD   wbar;
        WORD            osl, osz, nsl, nsz;
        GRECT           t;
        WINDOW          *pwin;  

        osl = osz = nsl = nsz = 0;
        which = -1;
                                                /* grab the window sync */
        wm_update(TRUE);
        pwin = &D.w_win[w_handle];
        wbar = wm_gsizes(w_field, &osl, &osz); 
        if (wbar)
        {
          pinwds[0] = max(-1, pinwds[0]);
          pinwds[0] = min(1000, pinwds[0]);
        }
        liketop = ( ( w_handle == gl_wtop ) ||
                    ( pwin->w_flags & VF_SUBWIN ) );
        switch(w_field)
        {
          case WF_NAME:
                which = W_NAME;
                break;
          case WF_INFO:
                which = W_INFO;
                break;
          case WF_SIZTOP:
                ob_order(gl_wtree, w_handle, NIL);
                                                /* fall thru    */
          case WF_CXYWH:
                draw_change(w_handle, (GRECT *)&pinwds[0]);
                break;
          case WF_TOP:
                if (w_handle != gl_wtop)
                {
                  for(i=W_TREE[ROOT].ob_head; i>ROOT; i=W_TREE[i].ob_next)
                  {
                    if ( (i != w_handle) &&
                         (D.w_win[i].w_owner == rlr) &&
                         (D.w_win[i].w_flags & VF_SUBWIN) &&
                         (pwin->w_flags & VF_SUBWIN) )
                      wm_mktop(i);
                  }
                  wm_mktop(w_handle);
                }
                break;
          case WF_NEWDESK:
                pwin->w_owner = rlr;
                desk_tree[rlr->p_pid] = gl_newdesk = *(LONG *) &pinwds[0];
                desk_root[rlr->p_pid] = gl_newroot = pinwds[2];
                break;
          case WF_HSLSIZ:
                pwin->w_hslsiz = pinwds[0];
                break;
          case WF_VSLSIZ:
                pwin->w_vslsiz = pinwds[0];
                break;
          case WF_HSLIDE:
                pwin->w_hslide = pinwds[0];
                break;
          case WF_VSLIDE:
                pwin->w_vslide = pinwds[0];
                break;
          case WF_TATTRB:
                if (pinwds[0] & WA_SUBWIN)
                  pwin->w_flags |= VF_SUBWIN;
                else
                  pwin->w_flags &= ~VF_SUBWIN;
                if (pinwds[0] & WA_KEEPWIN)
                  pwin->w_flags |= VF_KEEPWIN;
                else
                  pwin->w_flags &= ~VF_KEEPWIN;
                break;
        }
        if ( (wbar) &&
             (liketop) )
        {
          w_bldactive(w_handle);
          wm_gsizes(w_field, &nsl, &nsz); 
          if ( (osl != nsl) ||
               (osz != nsz) ||
               (pwin->w_flags & VF_SUBWIN) )
          {
            w_getsize(WS_TRUE, w_handle, &t);
            do_walk(w_handle, gl_awind, wbar + 3, MAX_DEPTH, &t);
          }
        }
        if (which != -1)
          w_strchg(w_handle, which, *(LONG *)pinwds);
                                                /* give up the sync     */
        wm_update(FALSE);
}
コード例 #10
0
ファイル: gemctrl.c プロジェクト: kelihlodversson/emutos
static void hctl_window(WORD w_handle, WORD mx, WORD my)
{
    GRECT   t, f, pt;
    WINDOW  *pwin = &D.w_win[w_handle];
    WORD    x, y, w, h;
    WORD    wm, hm;
    WORD    kind;
    WORD    cpt, message;
    LONG    tree;

    message = 0;
    x = y = w = h = 0;

    if ( (w_handle == gl_wtop) ||
       ( (pwin->w_flags & VF_SUBWIN) && (D.w_win[gl_wtop].w_flags & VF_SUBWIN) )  )
    {
        /*
         * went down on active window so handle control points
         */
        w_bldactive(w_handle);
        tree = gl_awind;
        cpt = ob_find(gl_awind, 0, 10, mx, my);
        w_getsize(WS_CURR, w_handle, &t);
        r_get(&t, &x, &y, &w, &h);
        kind = pwin->w_kind;
        switch(cpt)
        {
        case W_CLOSER:
            if ( kind & HOTCLOSE )
            {
                message = WM_CLOSED;
                break;
            }
            /* else fall thru */
        case W_FULLER:
            if ( gr_watchbox(gl_awind, cpt, SELECTED, NORMAL) )
            {
                message = (cpt == W_CLOSER) ? WM_CLOSED : WM_FULLED;
                ob_change(gl_awind, cpt, NORMAL, TRUE);
            }
            break;
        case W_NAME:
            if ( kind & MOVER )
            {
                /* prevent the mover gadget from being moved completely offscreen */
                r_set(&f, 0, gl_hbox, gl_rscreen.g_w + w - gl_wbox - 6, MAX_COORDINATE);
                gr_dragbox(w, h, x, y, &f, &x, &y);
                message = WM_MOVED;
            }
            break;
        case W_SIZER:
            if (kind & SIZER)
            {
                w_getsize(WS_WORK, w_handle, &t);
                t.g_x -= x;
                t.g_y -= y;
                t.g_w -= w;
                t.g_h -= h;
                wm = gl_wchar;
                hm = gl_hchar;
                if (kind & (LFARROW | RTARROW | HSLIDE))
                    wm = gl_wbox * 7;
                if (kind & (UPARROW | DNARROW | VSLIDE))
                    hm = gl_hbox * 7;
                gr_rubwind(x, y, wm, hm, &t, &w, &h);
                message = WM_SIZED;
            }
            break;
        case W_HSLIDE:
        case W_VSLIDE:
            ob_actxywh(tree, cpt + 1, &pt);
            if (inside(mx, my, &pt))
            {
                cpt = (cpt==W_HSLIDE) ? W_HELEV : W_VELEV;
                goto doelev;
            }

            /* fix up cpt for index into gl_wa[] */
            if (cpt == W_HSLIDE)
            {
                if ( !(mx < pt.g_x) )
                    cpt += 1;
            }
            else
            {
                if ( !(my < pt.g_y) )
                    cpt += 1;
            }
            /* fall thru */
        case W_UPARROW:
        case W_DNARROW:
        case W_LFARROW:
        case W_RTARROW:
            message = WM_ARROWED;
            x = gl_wa[cpt - W_UPARROW];
            break;
        case W_HELEV:
        case W_VELEV:
doelev:     message = (cpt == W_HELEV) ? WM_HSLID : WM_VSLID;
            x = gr_slidebox(gl_awind, cpt - 1, cpt, (cpt == W_VELEV));
            /* slide is 1 less than elev    */
            break;
        }
    }
    else
    {
        perform_untop(gl_wtop);
        /*
         * went down on inactive window so tell ap. to bring it to top
         */
        message = WM_TOPPED;
    }
    ct_msgup(message, pwin->w_owner, w_handle, x, y, w, h);
}