Exemplo n.º 1
0
uninit_sys()
{
    WORD dummy;
    WORD i;
    Vector ourmbvec;

    jimints_off();
    wait_penup();
    for (i=0; i<22000; i++)
        ;	/* just stall - hey I'm experimenting */
    free_cfont();
    set_for_gem();
    /*magic poke to set mouse wrap-around*/
    *((WORD *)(aline-692)) = mouse_bx;
    *((WORD *)(aline-690)) = mouse_by;
    *((WORD *)(aline-666)) = gem_colr;
    Setscreen( -1L, -1L, irez);

    /*restore palette...*/
    if (initted_color)
        Setpallete(color_env);
    remove_critical();
    if (handle != 0)
        v_clsvwk(handle);
    if (gl_apid != -1)
        appl_exit(0);
}
Exemplo n.º 2
0
/* set_for_gem and set_for_jim - functions that let me run at low rez
   while doing file requestor and file io at whatever rez GEM thinks
   it is - necessary for file requestor to appear ok, and for system
   io error dialogs to be centered etc.
   Thanks to Dave Staugas (of Neochrome) for the necessary magic aline
   peeks and pokes! */
set_for_gem()
{
    WORD i;

    wait_penup();
    for (i=0; i<22000; i++)
        ;	/* just stall - hey I'm experimenting */
    remove_critical();
    Setpallete(color_env);	/* restore start-up colors */
    hide_mouse();	/* go reset mouse and */
    vs_clip(handle, 0, screen_bounds);
    gem_rez();		/* screen rez */
    gshow_mouse();	/* to what GEM wants */
    Setscreen(pscreen, pscreen, -1);
}
Exemplo n.º 3
0
static int do_pullmouse(Menuhdr *mh,SHORT *hitid)

/* returns 1 or Err_disabled if we got a hit Err_not_found if no hit */
/* This routine is pretty creaky, but who want's to rewrite it? */
{
SHORT x, y;  /* root offset */
Pullwork pw;
int ret;
int in_cchild;
Pull *child, *cchild;
SHORT cx,cy,ccx,ccy;
int gothit;
Pull *p0,*p1;

	reuse_input();		/* make nice for loop */
	init_pullwork(&pw,mh);
	x = mh->x;
	y = mh->y;
	cchild = NULL;
	p0 = NULL; 
	/* note that here pw.level = 0 */

	for (;;)
	{
		wait_any_input();
		if (JSTHIT(KEYHIT))
		{
			ret = Err_not_found;
			reuse_input();
			goto cleanup;
		}
		if(cursin_menu(mh))		/* cursor in menu bar (not leaf yet) */
		{
			child = mh->mbs;

			for(;;)
			{
				if(child == NULL)
				{
					unselect(&pw);
					p0 = NULL; 
					cchild = NULL;
					goto nochild;
				}

				cx = x + child->x;
				cy = y + child->y;

				if(!in_pblock(cx, cy, child))
				{
					child = child->next;
					continue;
				}

				if(p0 != child)
				{
					unselect(&pw);
					pw.leaf_parent = p0 = child;
					pw.lpx = cx;
					pw.lpy = cy;
					child->flags |= PULL_HILIT;
					(*child->see)(cx, cy, child, &pw);

					if ((cchild = child->children) != NULL)
					{
						ccx = cx + cchild->x;
						ccy = cy + cchild->y;
						if(NULL == (pw.behind[0] 
						= 	(Raster *)savedraw_pull(ccx, ccy, cchild, &pw)))
						{
							ret = Err_no_memory;
							goto cleanup;
						}
					}
				}
				break;
			}
		}

		if(cchild == NULL)
			goto nochild;

		reuse_input();
		pw.level = 1; /* it would be nice to have this recursive but alas
					   * this is basicly the way it was */
		p1 = NULL; 

		while((child = cchild->children) != NULL)
		{
			wait_input(ANY_INPUT);
			if(JSTHIT(KEYHIT))
			{
				ret = Err_not_found;
				reuse_input();
				goto cleanup;
			}

			cchild->height += pw.cheight;	/* let them go a bit below end */
			in_cchild = in_pblock(ccx, ccy, cchild);
			cchild->height -= pw.cheight;

			if(!(in_cchild))
			{
				unselect(&pw);
				--pw.level;  /*  = 0; */
				break;
			}

			gothit = 0;

			while(child)
			{
				cx = ccx + child->x;
				cy = ccy + child->y;

				if (in_pblock(cx, cy, child))
				{
					gothit = 1;
					if(p1 != child)
					{
						unselect(&pw);
						p1 = child;
						if(NULL == (pw.behind[1] 
						= (Raster *)save_behind(pw.screen
						, cx, cy, child->width, child->height)))
						{
							ret = Err_no_memory;
							goto cleanup;
						}
						if (!(child->flags & PULL_DISABLED))
							draw_quad(pw.screen->viscel,pw.screen->SRED,cx,cy,
									  child->width,child->height);
					}
					if(JSTHIT(MBPEN))
					{
						if(child->flags & PULL_DISABLED)
							ret = Err_disabled;
						else
							{
							*hitid = p1->id;
							ret = 1; /* yay! we got a hit */
							}
						wait_penup();
						goto cleanup;
					}
				}
				child = child->next;
			}
			if(!gothit)
			{
				unselect(&pw);
				p1 = NULL;
			}
		}

	nochild:
		if(wndo_dot_visible(&(mh->mw->w),icb.mx,icb.my))
			continue;
		ret = Err_not_found;
		reuse_input();
		break;
	}

cleanup:
	while(pw.level >= 0)
	{
		unselect(&pw);
		--pw.level;
	}
	return(ret);
}