コード例 #1
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void w_drawdesk(GRECT *pc)
{
        register LONG   tree;
        register WORD   depth;
        register WORD   root;
        GRECT           pt;
        
        rc_copy(pc, &pt);
        if (gl_newdesk)
        {
          tree = gl_newdesk;
          depth = MAX_DEPTH;
          root = gl_newroot;
        }
        else
        {
          tree = gl_wtree;
          depth = 0;
          root = ROOT;
        }
                                                /* account for drop     */
                                                /*   shadow             */
                                                /* BUGFIX in 2.1        */
        pt.g_w += 2;
        pt.g_h += 2;

        do_walk(DESKWH, tree, root, depth, pc);
}
コード例 #2
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);
          }
        }
}
コード例 #3
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) );
}
コード例 #4
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
/* Get the size (x,y,w,h) of the window */
void w_getsize(WORD which, WORD w_handle, GRECT *pt)
{
        rc_copy(w_getxptr(which, w_handle), pt);
        if ( (which == WS_TRUE) && pt->g_w && pt->g_h)
        {
          pt->g_w += 2;
          pt->g_h += 2;
        }
}
コード例 #5
0
ファイル: gemctrl.c プロジェクト: kelihlodversson/emutos
/*
 * 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  */
    }
}
コード例 #6
0
ファイル: RCSLIB.C プロジェクト: daemqn/Atari_ST_Sources
VOID icon_wh(LONG taddr, WORD *w, WORD *h)
{
	ICONBLK	here;
	GRECT	p;

	LBCOPY(ADDR(&here), taddr, sizeof(ICONBLK));
	rc_copy((GRECT *) &here.ib_xchar, &p);
	rc_union((GRECT *) &here.ib_xicon, &p);
	rc_union((GRECT *) &here.ib_xtext, &p);
	*w = p.g_x + p.g_w;
	*h = p.g_y + p.g_h;
}
コード例 #7
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
/*
*       Opens or closes a window.
*/
void wm_opcl(WORD wh, GRECT *pt, WORD isadd)
{
        GRECT           t;

        rc_copy(pt, &t);
        wm_update(TRUE);
        if (isadd)
        {
          D.w_win[wh].w_flags |= VF_INTREE;
          w_obadd(&W_TREE[ROOT], ROOT, wh);
        }
        else
        {
          ob_delete(gl_wtree, wh);
          D.w_win[wh].w_flags &= ~VF_INTREE;
        }
        draw_change(wh, &t);
        if (isadd)
          w_setsize(WS_PREV, wh, pt);
        wm_update(FALSE);
}
コード例 #8
0
ファイル: geminput.c プロジェクト: kelihlodversson/emutos
/*
 *  Get the current control rectangle which is the part of the screen
 *  owned by the active process.  Normally, the work area of the top
 *  window, but sometimes the whole screen during form fill-in.
 */
void get_ctrl(GRECT *pt)
{
    rc_copy(&ctrl, pt);
}
コード例 #9
0
ファイル: geminput.c プロジェクト: kelihlodversson/emutos
/*
 *  Set the current control rectangle which is the part of the screen
 *  owned by the active process.  Normally, the work area of the top window.
 */
void set_ctrl(GRECT *pt)
{
    rc_copy(pt, &ctrl);
}
コード例 #10
0
ファイル: TEST_GFA.C プロジェクト: daemqn/Atari_ST_Sources
void p_grafik(void)
	{
	deftext( 1,24,0,32);
	text( 174,200,-1,"4. DEMO: GRAFIK");
	p_s_top();
	printf("\33E");
	deftext( -1,1,0,13);
	for(h_long=1;h_long<=2;h_long++)
		{
		for(j_long=4;j_long<=24 ;j_long+= 4)
			{
			for(i_long=0;i_long<=5;i_long++)
				{
				deftext( -1,pow(2,i_long),-1,-1);
				text( 320,50+i_long*(16+j_long*2),-1,"B_NACH_C");
				}
			pause( 10);
			printf("\33E");
			deftext( -1,-1,-1,j_long);
			}
		deftext( -1,-1,h_long*1800,-1);
		}
	deftext( -1,1,-1,13);
	for(h_long=1;h_long<=4;h_long++)
		{
		for(i_long=2;i_long<=3;i_long++)
			{
			for(j_long=0;j_long<=2;j_long++)
				{
				defline( h_long,i_long,j_long,j_long);
				draw(100+50*j_long,50+25*j_long , 539-50*j_long,50+25*j_long);
				box( 50+50*j_long,150,320-50*j_long,350);
				circle( 480,250,20+40*j_long);
				}
			pause( 10);
			printf("\33E");
			}
		}
	defline( 1,2,1,1);
	deffill( 1,1,1);
	for(i_long=2;i_long<=3;i_long++)
		{
		for(j_long=1;j_long<=20;j_long++)
			{
			deffill( 1,i_long,j_long);
			pbox( 16*j_long-16,10,655-16*j_long,190);
			pcircle( 160,299,105-5*j_long);
			pellipse( 480,299,5*j_long,105-5*j_long);
			}
		if(j_long>20 &  i_long==2)
			{
			bild_char = sget(bild_char);
			}
		}
	pause( 50);
	s_adr_long=(long)(bild_char);
	d_adr_long=xbios(2);
	for(i_long=1;i_long<=1000;i_long++)
		{
		rc_copy(s_adr_long,(int)((double)rand()*(10)/32767)*64,(int)((double)rand()*(10)/32767)*40,64,40 ,d_adr_long,(int)((double)rand()*(10)/32767)*64,(int)((double)rand()*(10)/32767)*40,
	-1);
		}
	pause( 100);
	printf("\33E");
	sput( bild_char);
	deffill( 1,1,1);
コード例 #11
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);
}
コード例 #12
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;
        }
}
コード例 #13
0
ファイル: gemwmlib.c プロジェクト: ragnar76/emutos
void w_setsize(WORD which, WORD w_handle, GRECT *pt)
{
        rc_copy(pt, w_getxptr(which, w_handle));
}