Exemplo n.º 1
0
/*
 * Top level;
 * we get control from the desktop.
 */
main()
{
	pnf = 0;		/* set the flag to it isn't partition yet */
    appl_init();
    phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
    wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
    open_vwork();
    wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk);

    hidden = FALSE;
    butdown = TRUE;

	/* doing a checking see if the cache in the system */
	cachexst = (char) chkcache();

    rsrc_load(RESOURCEFILE);
    /* Get all addresses of dialogues from resource file */
    getalladdr();

	needscan = TRUE;

   	if (domulti() != 11)
		reboot();

    wind_delete(wi_handle);
    v_clsvwk(handle);
    appl_exit();
}
Exemplo n.º 2
0
static void init_vdi(void)
{
	int dummy, work_out[58], pix_height;

	screen_info.phy_handle = graf_handle(&screen_info.fnt_w, &screen_info.fnt_h, &dummy, &dummy);

	vq_extnd(vdi_handle, 0, work_out);

	max_w = work_out[0] + 1;	/* Screen width (pixels)  */
	max_h = work_out[1] + 1;	/* Screen height (pixels) */
	ncolors = work_out[13];		/* Number of colours      */
	npatterns = work_out[14];	/* Number of patterns DjV 011 180103 */
	pix_height = work_out[4];


	/* DjV 007 190103 
	 * Note: vqt_attributes below uses work_out and destroys information
	 * in work_out[0] to work_out[9]; not a nice thing to do!
	 */

	vqt_attributes(vdi_handle, work_out);

	fnt_setfont(1, (int) (((long) work_out[7] * (long) pix_height * 72L + 12700L) / 25400L), &def_font);

	screen_info.vdi_handle = vdi_handle;
}
Exemplo n.º 3
0
void  gem_prgm()

{
   OBJECT  *tree;
   int     box_x, box_y, box_w, box_h, button, end = FALSE;
   int     work_in[11], work_out[57], count, dummy;

   for (count = 0; count < 10; count++)   work_in[count] = 1;
   work_in[10] = 2;
   vdi_handle = graf_handle (& dummy, & dummy, & dummy, & dummy);
   v_opnvwk (work_in, & vdi_handle, work_out);
   vq_extnd (vdi_handle, 1, work_out);
   planes = work_out[4];

   rsrc_gaddr (R_TREE, LOGCTRL, & tree);
   form_center (tree, & box_x, & box_y, & box_w, & box_h);
   form_dial (FMD_START, 0,0,0,0, box_x, box_y, box_w, box_h);
   objc_draw (tree, ROOT, MAX_DEPTH, box_x, box_y, box_w, box_h);

   do {
        button = form_do (tree, 0) & 0x7fffu;
        evnt_timer (60, 0);
        tree[button].ob_state &= ~SELECTED;
        objc_draw (tree, button, 1, box_x, box_y, box_w, box_h);

        switch (button) {
           case FILENAM :
             modify_fname();
             objc_draw (tree, ROOT, MAX_DEPTH, box_x, box_y, box_w, box_h);
             break;
           case CLIENT :
           case MODULE :
             form_dial (FMD_FINISH, 0,0,0,0, box_x, box_y, box_w, box_h);
             do_dialog ((button == CLIENT) ? CLI_API : MOD_API);
             form_dial (FMD_START, 0,0,0,0, box_x, box_y, box_w, box_h);
             objc_draw (tree, ROOT, MAX_DEPTH, box_x, box_y, box_w, box_h);
             break;
           case TERM :
             if (form_alert (1, "[2][ |  Remove LogSTinG and   |   leave LogCTRL ?][ Yes | No ]") == 1) {
                  if ((long) (*sting_drivers->get_dftab) ("LOGSTING : REMOVE") == 'OkOk')
                       end = TRUE;
                    else
                       form_alert (1, "[1][ |  Could not remove LogSTinG !  ][ Hmmm ]");
                }
             break;
           case FIX :
             if (form_alert (1, "[2][ |  Activate new settings ?   ][ Yes | No ]") == 1)
                  do_settings();
             break;
           case CANCEL :
             if (form_alert (1, "[2][ |  Leave LogCTRL ?   ][ Yes | No ]") == 1)
                  end = TRUE;
             break;
           }
     } while (! end);

   form_dial (FMD_FINISH, 0,0,0,0, box_x, box_y, box_w, box_h);
   v_clsvwk (vdi_handle);
 }
Exemplo n.º 4
0
/*
 * Top level;
 * we get control from the desktop.
 */
main()
{
	pnf = 0;		/* set the flag to it isn't partition yet */
    appl_init();
    phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
    wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
    open_vwork();
    wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk);

    hidden = FALSE;
    butdown = TRUE;

	/* doing a checking see if the cache in the system */
	cachexst = (char) chkcache();

	/* check the existence of the BLiTTER */
	blitxst = chkblit();

    if (!rsrc_load(RESOURCEFILE)) {
	errs("[2][|", RESOURCEFILE, "][ EXIT ]");
	goto punt;
    }

    
    /* Get all addresses of dialogues from resource file */
    if (getalladdr() != OK) {
	errs("[2][|", RESOURCEFILE, "][ EXIT ]");
	goto punt;
    }


	needscan = TRUE;

redomul:
    ARROW_MOUSE;

    /* display menu bar */
    menu_bar(menuobj, 1);

    running = TRUE;
    while (running) {
    	domulti();
    }

    /*
     * If nothing has been done to the hard disks
     * then just get out, back to the desktop.
     * Otherwise reboot the system.
     */
    menu_bar(menuobj, 0);		/* erase menu bar */

punt:

    wind_delete(wi_handle);
    v_clsvwk(handle);
    appl_exit();
}
Exemplo n.º 5
0
/* Standard code to set up GEM arrays and open work area.
 * In particular, this gets app_handle, which is needed to use the screen.
*/
void open_vwork (void) {
	int i;
	int dum;

	app_handle = graf_handle (&dum, &dum, &dum, &dum);
	work_in[0] = 2 + Getrez ();
	for (i = 1; i < 10; work_in[i++] = 1);
	work_in[10] = 2;
	v_opnvwk (work_in, &app_handle, work_out);
}
Exemplo n.º 6
0
/*
 * Top level;
 * we get control from the desktop.
 *
 */
main()
{
    long *cookptr;	/* pointer to AHDI cookie */

    running = TRUE;
    appl_init();
    phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
    wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
    open_vwork();
    wi_handle = wind_create(WI_KIND, xdesk, ydesk, wdesk, hdesk);
  
    hidden = FALSE;
    butdown = TRUE;
  
    if (!rsrc_load(RESOURCEFILE)) {
	errs("[2][", RESOURCEFILE, "][ OK ]");
	goto punt;
    }
  
    graf_mouse(ARROW, 0L);
  
    /* display menu bar */
    if (getalladdr() == ERROR) {
	errs("[2][", RESOURCEFILE, "][ OK ]");
	goto punt;
    }
  
    ostack = Super(NULL);	/* Superuser mode for low memory access */
    pun = (int *)(*(long *)PUNPTR);
    Super(ostack);		/* back to User mode */

    if (!pun || !(*pun)) {	/* if no unit exists */
	err(noavdrv);		/* return error */
	goto punt;
    }

    cookptr = (long *)((char *)pun + 2 + 16 + 16*4);
    if (*cookptr != AHDI || cookptr != *(long *)(cookptr + 1))
	vernum = 0L;
    else
	vernum = (int *)(cookptr + 2);

    menu_bar(menubar, 1);	/* put up menu bar */
  
    while (running)
	domulti();
    
    menu_bar(menubar, 0);	/* erase menu bar */
  
punt:
    wind_delete(wi_handle);	/* close window on screen */
    v_clsvwk(handle);		/* close virtual workstation */
    appl_exit();		/* exit application HDX */
    Pterm(0);			/* terminate process */
}
Exemplo n.º 7
0
/* ---------------------------- */
void open_vwork(void)
{
register int i;
int dummy;

vdi_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);

for(i = 0; i < 10; work_in[i++] = 1);
work_in[10] = 2;

v_opnvwk(work_in, &vdi_handle, work_out);
}
Exemplo n.º 8
0
int gem_init(int *px, int *py, int *pw, int *ph, int *aes_screenhandle, int *screenhandle, int work_in[], int work_out[])
{
    int ap_id;
    int wc, hc, wb, hb;

    ap_id = appl_init();
    if (ap_id == -1)
    {
        fprintf(stderr, "Error initialising AES process\n");
        getchar();
        exit(1);
    }
#ifdef WND_DEBUG
    wdebug_report = fopen("wndhndlr.dbg", "w");
    sprintf(wdbg_tmpbuf, "wind_set(%1d, WF_NEWDESK, p%p, %d)", 0, (void *) NULL, 0);
    wnd_report(wdbg_tmpbuf);
#endif
    /* wind_set(0, WF_NEWDESK, NULL, 0); */
#ifdef WND_DEBUG
    wnd_report("wind_get");
#endif
    wind_get(0, WF_WORKXYWH, px, py, pw, ph);
    _wndh_gl.dw_x = *px;
    _wndh_gl.dw_y = *py;
    _wndh_gl.dw_w = *pw;
    _wndh_gl.dw_h = *ph;
    *aes_screenhandle = graf_handle(&wc, &hc, &wb, &hb);
    _wndh_gl.aes_screen = *aes_screenhandle;
    work_in[0] = 1;         /* current screen driver */
    work_in[1] = LT_SOLID;  /* line type */
    work_in[2] = BLACK;     /* line color */
    work_in[3] = MT_DOT;    /* marker type */
    work_in[4] = BLACK;     /* marker color */
    work_in[5] = 1;         /* font number (?) */
    work_in[6] = BLACK;     /* text color */
    work_in[7] = FIS_SOLID; /* fill pattern */
    work_in[8] = 1;         /* fill pattern index */
    work_in[9] = BLACK;     /* fill color */
    work_in[10] = 2;        /* RC coordinate system */
    *screenhandle = *aes_screenhandle;
    v_opnvwk(work_in, screenhandle, work_out);
    if (*screenhandle == 0)
    {
        fprintf(stderr, "Error initialising VDI screen workstation\n");
        getchar();
        exit(1);
    }
    _wndh_gl.vwk_screen = *screenhandle;
    graf_mouse(ARROW, NULL);
    return (ap_id);
}
Exemplo n.º 9
0
fix_objects()
    {
    int test, ii;
    int wchar, hchar;

    graf_handle( &wchar, &hchar, &ii, &ii );

    for (ii = 0; ii < NUM_OBS; ii++)
        {
        rs_object[ii].ob_x = adj(rs_object[ii].ob_x, wchar);
        rs_object[ii].ob_y = adj(rs_object[ii].ob_y, hchar);
        rs_object[ii].ob_width = adj(rs_object[ii].ob_width, wchar);
        rs_object[ii].ob_height = adj(rs_object[ii].ob_height, hchar);
        test = (int) rs_object[ii].ob_spec;

        switch (rs_object[ii].ob_type)
            {
        case G_TITLE:
        case G_STRING:
        case G_BUTTON:
            fix_str(&rs_object[ii].ob_spec);
            break;

        case G_TEXT:
        case G_BOXTEXT:
        case G_FTEXT:
        case G_FBOXTEXT:
            if (test != NIL)
               rs_object[ii].ob_spec =
                (char *) &rs_tedinfo[test];
            break;

#ifdef NOT_NEED
        case G_ICON:
            if (test != NIL)
               rs_object[ii].ob_spec =
                (char *) &rs_iconblk[test];
            break;

        case G_IMAGE:
            if (test != NIL)
               rs_object[ii].ob_spec =
                (char *) &rs_bitblk[test];
            break;
#endif
        default:
            break;
            }
        }
    }
Exemplo n.º 10
0
main()
{
	int gr_mkmx, gr_mkmy;
	int gr_mkmstate, gr_mkkstate;
	int tmpx, tmpy;
	int tmpx1, tmpy1;
	int tmpx2, tmpy2;
	int index, rgb_in[3];
	int draw;

	appl_init();
	phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
	wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
	open_vwork();
	wi_handle = wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk);
	graf_mouse(3, 0x0L);
	vswr_mode(handle, 3);
	graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
	while(!(0x0002&gr_mkmstate))	{
		graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
		if (0x0001&gr_mkmstate)	{
			tmpy = gr_mkmy;
			tmpx = gr_mkmx;
			graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
			graf_mouse(M_OFF, 0x0L);
			tmpy1 = gr_mkmy;
			tmpx1 = gr_mkmx;
			drawframe(tmpx, tmpy, tmpx1, tmpy1);
			graf_mouse(M_ON, 0x0L);
			while (0x0001&gr_mkmstate)	{
				graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
				if (((tmpx1 != gr_mkmx) || (tmpy1 != gr_mkmy)) &&
					(0x0001&gr_mkmstate))	{
					graf_mouse(M_OFF, 0x0L);
					drawframe(tmpx, tmpy, tmpx1, tmpy1);
					drawframe(tmpx, tmpy, gr_mkmx, gr_mkmy);
					graf_mouse(M_ON, 0x0L);
					tmpy1 = gr_mkmy;
					tmpx1 = gr_mkmx;
				}
			}
			graf_mouse(M_OFF, 0x0L);
			drawframe(tmpx, tmpy, tmpx1, tmpy1);
			graf_mouse(M_ON, 0x0L);
		}
	}
	wind_delete(wi_handle);
	v_clsvwk(handle);
	appl_exit();
}
Exemplo n.º 11
0
void app_set_up(short *workstation) {
    short work_in[11];
    short work_out[57];
    short dummy;

    appl_init();
    *workstation = graf_handle(&dummy, &dummy, &dummy, &dummy);

    for (short loop = 0; loop < 10; loop++) {
        work_in[loop] = 1;
    }

    work_in[10] = 2;

    v_opnvwk(work_in, workstation, work_out);
}
Exemplo n.º 12
0
short
V_Opnvwk(VDI_Workstation *dev)
{	
	short i, in[11];
	
	in[0] = Getrez() + 2;
	dev->dev_id = in[0];
	for(i=1;i<10;in[i++]=1);
	in[10]=2;
	i=graf_handle(&dev->wchar,&dev->hchar,&dev->wbox,&dev->hbox);
	v_opnvwk(in,&i,&dev->xres);
	dev->handle=i;
	
	if(i)
		vq_extnd(i,1,&dev->screentype);
	
	return(i);
}
Exemplo n.º 13
0
/* main()
 * ================================================================
 */
void
main( void )
{
	int 	i;

	appl_init();
	AES_Version = _AESglobal[0];	/* Get the AES version number */

	vhandle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox );

	work_in[0] = Getrez()+2; /* let's not gag GDOS */
	for( i = 1; i < 10; work_in[i++] = 1 );
	work_in[10] = 2;
	v_opnvwk( work_in, &vhandle, work_out );
	xres = work_out[0];
	yres = work_out[1];
	num_pens = work_out[13];

	gl_screen.g_x = gl_screen.g_y = 0;
        gl_screen.g_w = xres + 1;
        gl_screen.g_h = yres + 1;

	/* We're too wide for ST LOW Rez */
        if(( work_in[0] == STLOW ) || ( work_in[0] == TTLOW ))
        {
	    form_alert( 1, alow );
	    v_clsvwk( vhandle );
	    appl_exit();
	    exit( 0 );
        }

	wind_get( 0, WF_WORKXYWH, &gl_full.g_x, &gl_full.g_y,
				  &gl_full.g_w, &gl_full.g_h );

	initialize();
	if( !rsrc_init())
        {
	   form_alert( 1, arsc );
	   Gem_Exit( -1 );
        }

	do_main();
	Gem_Exit( 0 );
}
Exemplo n.º 14
0
/*-----------------------------------------------------------------------
 * Initialize GEM application:
 * open virtual workstation and get desktop extent.
 */
void
gem_init(void)
{
	WORD	i, wsin[11], hch;

	appl_init();
	if (!isAES4())
	{
		form_alert(1, "[3][ |Viewer can't run on |this TOS version.][ Quit ]");
		gem_exit(-1);
	}

	AES_Version = _AESglobal[0];
	MultiFlag   = _AESglobal[1];	/* -1 == MULTITOS, else single tasking */

	if( AES_Version >= 0x0410 )		/* CJG 06/24/93 */
	    IconFlag = SMALLER;
	else
	    IconFlag = 0;

	shel_grok(G_AP_TERM);
	wsid = aesid = graf_handle(&wchar, &hchar, &wbox, &hbox);
	wsin[0] = Getrez()+2;
	for (i = 1; i < 10; i++)
		wsin[i] = 1;
	wsin[i] = 2;

	v_opnvwk(wsin, &wsid, wsout);
	if (!wsid)
	{
		form_error(8); /* not enough memory */
		gem_exit(-1);
	}

/* Get default AES point size */
	vqt_attributes(aesid, &aes_t_attr.font);
	vst_font(wsid, 1);
	hch = def_pts = 0;
	while (hch < aes_t_attr.hchar)
		vst_point(wsid, ++def_pts, &i, &hch, &i, &i);

	wind_grect(0, WF_WORKXYWH, &desk);
}
Exemplo n.º 15
0
int
main(void)
{
  int      x,y,w,h;
	
  int      vid;

  int      work_in[] = {1,7,1,1,1,1,1,1,1,1,2};
  int      work_out[57];
  OBJECT * dial;
	
  appl_init();

  vid = graf_handle(&vid,&vid,&vid,&vid);

  v_opnvwk(work_in,&vid,work_out);
	
  if(rsrc_load("test2rsc.rsc"))
  {
    rsrc_gaddr(R_TREE,TESTDIAL,&dial);
    
    form_center(dial,&x,&y,&w,&h);
    form_dial(FMD_START,0,0,0,0,x,y,w,h);
    
    objc_draw(dial,0,9,x,y,w,h);
    
    own_form_do(dial,0);
    
    form_dial(FMD_FINISH,0,0,0,0,x,y,w,h);
    
    rsrc_free();
  }
  else
  {
    form_alert(1,"[1][Couldn't load resource file!][Bummer!]");
  }
	
  v_clsvwk(vid);
	
  appl_exit();

  return 0;
}
Exemplo n.º 16
0
void init_tet( void )
{
	int i;
	char s[127];
	
	handle=graf_handle( &i, &i, &i, &i );
	
	work_in[0] = 0;
	work_in[1] = 1;
	work_in[2] = 1;
	work_in[3] = 1;
	work_in[4] = 1;
	work_in[5] = 1;
	work_in[6] = 1;
	work_in[7] = 1;
	work_in[8] = 1;
	work_in[9] = 1;
	work_in[10] = 2;
	v_opnvwk( work_in, &handle, work_out );
	v_clrwk( handle );
	v_hide_c( handle );
	puts("\033H");
	puts("Willkommen zum BLOWCONF-Cheatmodus,\ndem Mini TETris von Michael Eberl");
	puts("");
	puts("Dieses Programm entstand auf dringenden Wunsch von");
	puts("Georg Acher am 14.7.1994 und wurde am 27.9.96 von");
	puts("Michael Eberl in BlowConf integriert.");
	puts("");
	puts("Bedienung:");
	puts("Bewegung nach links  :  Linke Shift-Taste");
	puts("Bewegung nach rechts : Rechte Shift-Taste");
	puts("Drehung des Steins   : Alternate-Taste");
	puts("");
	puts("Aus praktischen Gr�nden ist eine y-Aufl�sung\nvon mind. 544 Punkten n�tig!!!");
	puts("");
	puts("Nach Spielende wird ein eventueller Highscore abgespeichert,");
	puts("dann wird zu BLOWCONF zur�ckgekehrt.");
	puts("");
	puts("Viel Spa�!");
	puts("");
	puts("Press <Return> to start...!");
	(void)gets(s);
	
	v_clrwk( handle );
	xres = 1+ work_out[0];
	yres = 1+ work_out[1];
	
	for (i=0; i<HEIGHT; i++)
		playfield[i]=0;
	
	stones[0]=stone1;
	stones[1]=stone2;
	stones[2]=stone3;
	stones[3]=stone4;
	stones[4]=stone5;
	stones[5]=stone6;
	stones[6]=stone7;
	if ((highfile=(int)Fopen("HISCORE.DAT", FO_READ))<0)
	{
		hiscore=0;
		strcpy(hiname,"");
	}
	else
	{
		Fread( highfile, 4, &hiscore );
		Fread( highfile, 128, hiname );
		Fclose( highfile );
	}
}
Exemplo n.º 17
0
int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
{
    int i;
    short work_in[12], work_out[272], dummy;

    /* Open AES (Application Environment Services) */
    if (appl_init() == -1) {
        fprintf(stderr,"Can not open AES\n");
        return 1;
    }

    /* Read version and features */
    GEM_version = aes_params.global[0];
    if (GEM_version >= 0x0400) {
        short ap_gout[4];

        GEM_wfeatures=0;
        if (appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2], &ap_gout[3])==0) {
            GEM_wfeatures=ap_gout[0];
        }
    }

    /* Ask VDI physical workstation handle opened by AES */
    VDI_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);
    if (VDI_handle<1) {
        fprintf(stderr,"Wrong VDI handle %d returned by AES\n",VDI_handle);
        return 1;
    }

    /* Open virtual VDI workstation */
    work_in[0]=Getrez()+2;
    for(i = 1; i < 10; i++)
        work_in[i] = 1;
    work_in[10] = 2;

    v_opnvwk(work_in, &VDI_handle, work_out);
    if (VDI_handle == 0) {
        fprintf(stderr,"Can not open VDI virtual workstation\n");
        return 1;
    }

    /* Read fullscreen size */
    VDI_w = work_out[0] + 1;
    VDI_h = work_out[1] + 1;

    /* Read desktop size and position */
    if (!wind_get(DESKTOP_HANDLE, WF_WORKXYWH, &GEM_desk_x, &GEM_desk_y, &GEM_desk_w, &GEM_desk_h)) {
        fprintf(stderr,"Can not read desktop properties\n");
        return 1;
    }

    /* Read bit depth */
    vq_extnd(VDI_handle, 1, work_out);
    VDI_bpp = work_out[4];
    VDI_oldnumcolors=0;

    switch(VDI_bpp) {
    case 8:
        VDI_pixelsize=1;
        break;
    case 15:
    case 16:
        VDI_pixelsize=2;
        break;
    case 24:
        VDI_pixelsize=3;
        break;
    case 32:
        VDI_pixelsize=4;
        break;
    default:
        fprintf(stderr,"%d bits colour depth not supported\n",VDI_bpp);
        return 1;
    }

    /* Setup hardware -> VDI palette mapping */
    for(i = 16; i < 255; i++) {
        vdi_index[i] = i;
    }
    vdi_index[255] = 1;

    /* Save current palette */
    if (VDI_bpp>8) {
        VDI_oldnumcolors=1<<8;
    } else {
        VDI_oldnumcolors=1<<VDI_bpp;
    }

    for(i = 0; i < VDI_oldnumcolors; i++) {
        short rgb[3];

        vq_color(VDI_handle, i, 0, rgb);

        VDI_oldpalette[i][0] = rgb[0];
        VDI_oldpalette[i][1] = rgb[1];
        VDI_oldpalette[i][2] = rgb[2];
    }

    /* Setup screen info */
    GEM_title_name = empty_name;
    GEM_icon_name = empty_name;

    GEM_handle = -1;
    GEM_locked = SDL_FALSE;
    GEM_win_fulled = SDL_FALSE;

    VDI_screen = NULL;
    VDI_ReadExtInfo(this, work_out);
    if (VDI_screen == NULL) {
        VDI_pitch = VDI_w * VDI_pixelsize;
        VDI_format = VDI_FORMAT_UNKNOWN;
        VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0;
    }

    /* Setup destination mfdb */
    VDI_dst_mfdb.fd_addr = NULL;

    /* Update hardware info */
    this->info.hw_available = 0;
    this->info.video_mem = 0;

    /*	TC, screen : no shadow (direct)
     *  8P, screen: no shadow (direct)
     *  8I, screen: shadow, c2p (shadow -> c2p)
     *  TC, no screen: shadow (vro_cpyfm)
     *  8P, no screen: shadow (vro_cpyfm)
     *  8I/U, no screen: shadow, shadow_c2p, c2p (shadow -> c2p -> vro_cpyfm)
     */

    /* Determine the screen depth */
    /* we change this during the SDL_SetVideoMode implementation... */
    vformat->BitsPerPixel = VDI_bpp;

    /* Set mouse cursor to arrow */
    graf_mouse(ARROW, NULL);

    /* Init chunky to planar routine */
    Atari_C2pInit = Atari_C2pInit8;
    if (atari_cpu060_avail) {
        Atari_C2pConvert = Atari_C2pConvert8_060;
    } else {
        Atari_C2pConvert = Atari_C2pConvert8;
    }
    Atari_C2pInit();

    /* We're done! */
    return(0);
}
Exemplo n.º 18
0
init_sys()
{
    WORD work_in[11];
    WORD work_out[57];
    WORD i;



    save_critical();
    got_blitter = ( (_xbios(64, -1) & 3 ) == 3);
    if ( (gl_apid = appl_init()) == -1)
    {
        exit(-1);
    }
    aline = ainit();


    if (!init_mem())
        exit(-2);

    /* save initial rez ... we'll see if GEM agrees with this later */
    if ( (irez = Getrez()) != 0)
    {
        if (irez != 1)
        {
            puts("Cyber Paint can't run on black and white systems, sorry");
            for (i=0; i<60; i++)
            {
                Vsync();
            }
            exit(-3);
        }
    }

    get_cmap(color_env);
    copy_words(init_cmap, sys_cmap, COLORS);
    put_cmap(sys_cmap);
    initted_color = 1;

    if (!init_pulls())
        return(-4);

    /* save mouse wrap-around */
    mouse_bx = *((WORD *)(aline-692));
    mouse_by = *((WORD *)(aline-690));
    /* save # of colors gem thinks exist */
    gem_colr = *((WORD *)(aline-666));

    gr_handle = graf_handle(&gr_hwchar, &gr_hhchar, &gr_hwbox, &gr_hhbox);
    handle = gr_handle;
    stuff_words(work_in, 1, 10);
    work_in[10] = 2;
    v_opnvwk(work_in, &handle, work_out);
    if (handle == 0)
        return(-5);
    if (work_out[0] == 639)
    {
        gem_mrez = 1;	/* see what GEM thinks rez is in so file-requestor can
						work */
        /* poke in initial mouse location (in case off-screen for lo-rez */
        *((WORD *)(aline-602)) = 160;
        *((WORD *)(aline-600)) = 100;
    }
    jim_rez();
    pscreen = cscreen = (WORD *)Physbase();

    if ((uscreen = askmem(32000)) == NULL)
        return(-6);
    if ((start_screen = askmem(32000)) == NULL)
        return(-7);
    if ((end_screen = askmem(32000)) == NULL)
        return(-8);
    if ((prev_screen = laskmem(2L*32000L)) == NULL)
        /* prev/next form 64K buffer */
        return(-9);
    next_screen = prev_screen+16000;
    if ((bscreen = askmem(32000)) == NULL)
        return(-11);
    empty_ram_dlt();
    zero_screens();
    if (!init_input())
        return(-13);
    init_fname();
    init_menu_colors();
    install_critical();
    jimints_on();

    cel_mem_alloc = mem_free;	/* "user" memory starts here */

    return(1);
}
Exemplo n.º 19
0
int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
{
	int i, menubar_size;
	short work_in[12], work_out[272], dummy;

	/* Open AES (Application Environment Services) */
	if (appl_init() == -1) {
		fprintf(stderr,"Can not open AES\n");
		return 1;
	}

	/* Read version and features */
	GEM_version = aes_global[0];
	if (GEM_version >= 0x0410) {
		short ap_gout[4], errorcode;
		
		GEM_wfeatures=0;
		errorcode=appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2], &ap_gout[3]);

		if (errorcode==0) {
			GEM_wfeatures=ap_gout[0];			
		}
	}	

	/* Ask VDI physical workstation handle opened by AES */
	VDI_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);
	if (VDI_handle<1) {
		fprintf(stderr,"Wrong VDI handle %d returned by AES\n",VDI_handle);
		return 1;
	}

	/* Open virtual VDI workstation */
	work_in[0]=Getrez()+2;
	for(i = 1; i < 10; i++)
		work_in[i] = 1;
	work_in[10] = 2;

	v_opnvwk(work_in, &VDI_handle, work_out);
	if (VDI_handle == 0) {
		fprintf(stderr,"Can not open VDI virtual workstation\n");
		return 1;
	}

	/* Read fullscreen size */
	VDI_w = work_out[0] + 1;
	VDI_h = work_out[1] + 1;

	/* Read desktop size and position */
	if (!wind_get(DESKTOP_HANDLE, WF_WORKXYWH, &GEM_desk_x, &GEM_desk_y, &GEM_desk_w, &GEM_desk_h)) {
		fprintf(stderr,"Can not read desktop properties\n");
		return 1;
	}

	/* Read bit depth */
	vq_extnd(VDI_handle, 1, work_out);
	VDI_bpp = work_out[4];
	VDI_oldnumcolors=0;

	switch(VDI_bpp) {
		case 8:
			VDI_pixelsize=1;
			break;
		case 15:
		case 16:
			VDI_pixelsize=2;
			break;
		case 24:
			VDI_pixelsize=3;
			break;
		case 32:
			VDI_pixelsize=4;
			break;
		default:
			fprintf(stderr,"%d bits colour depth not supported\n",VDI_bpp);
			return 1;
	}

	/* Setup hardware -> VDI palette mapping */
	for(i = 16; i < 255; i++) {
		vdi_index[i] = i;
	}
	vdi_index[255] = 1;

	/* Save current palette */
	if (VDI_bpp>8) {
		VDI_oldnumcolors=1<<8;
	} else {
		VDI_oldnumcolors=1<<VDI_bpp;
	}
	
	for(i = 0; i < VDI_oldnumcolors; i++) {
		short rgb[3];

		vq_color(VDI_handle, i, 0, rgb);

		VDI_oldpalette[i][0] = rgb[0];
		VDI_oldpalette[i][1] = rgb[1];
		VDI_oldpalette[i][2] = rgb[2];
	}
	VDI_setpalette = GEM_SetNewPalette;
	SDL_memcpy(VDI_curpalette,VDI_oldpalette,sizeof(VDI_curpalette));

	/* Setup screen info */
	GEM_title_name = empty_name;
	GEM_icon_name = empty_name;

	GEM_handle = -1;
	GEM_locked = SDL_FALSE;
	GEM_win_fulled = SDL_FALSE;
	GEM_fullscreen = SDL_FALSE;
	GEM_lock_redraw = SDL_TRUE;	/* Prevent redraw till buffers are setup */

	VDI_screen = NULL;
	VDI_pitch = VDI_w * VDI_pixelsize;
	VDI_format = ( (VDI_bpp <= 8) ? VDI_FORMAT_INTER : VDI_FORMAT_PACK);
	VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0;
	VDI_ReadExtInfo(this, work_out);

#ifdef DEBUG_VIDEO_GEM
	printf("sdl:video:gem: screen: address=0x%08x, pitch=%d\n", VDI_screen, VDI_pitch);
	printf("sdl:video:gem: format=%d\n", VDI_format);
	printf("sdl:video:gem: masks: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
		VDI_alphamask, VDI_redmask, VDI_greenmask, VDI_bluemask
	);
#endif

	/* Setup destination mfdb */
	VDI_dst_mfdb.fd_addr = NULL;

	/* Determine the current screen size */
	this->info.current_w = VDI_w;
	this->info.current_h = VDI_h;

	/* Determine the screen depth */
	/* we change this during the SDL_SetVideoMode implementation... */
	vformat->BitsPerPixel = VDI_bpp;

	/* Set mouse cursor to arrow */
	graf_mouse(ARROW, NULL);
	GEM_cursor = NULL;

	/* Init chunky to planar routine */
	SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;

	/* Setup VDI fill functions */
	vsf_color(VDI_handle,0);
	vsf_interior(VDI_handle,1);
	vsf_perimeter(VDI_handle,0);

	/* Menu bar save buffer */
	menubar_size = GEM_desk_w * GEM_desk_y * VDI_pixelsize;
	GEM_menubar=Atari_SysMalloc(menubar_size,MX_PREFTTRAM);

	/* Fill video modes list */
	SDL_modelist[0] = SDL_malloc(sizeof(SDL_Rect));
	SDL_modelist[0]->x = 0;
	SDL_modelist[0]->y = 0;
	SDL_modelist[0]->w = VDI_w;
	SDL_modelist[0]->h = VDI_h;

	SDL_modelist[1] = NULL;

#if SDL_VIDEO_OPENGL
	SDL_AtariGL_InitPointers(this);
#endif

	this->info.wm_available = 1;

	/* We're done! */
	return(0);
}
Exemplo n.º 20
0
/*
 * main()
 * ================================================================
 */
void
main( void )
{
	int	event, msg[8], key, nclicks;
	MRETS	mrets;


/*
 * See if we were run from the AUTO folder...
 */
        gl_apid = appl_init();

	/* Get the AES version #.  TOS 3.0 is TT TOS */
	AES_Version = _GemParBlk.global[0];
/*
 * Set up work_in to initialize VDI functions to useful values,
 * Get the physical workstation handle from the AES, then
 * open a virtual workstation and get our AES work area's extent.
 */
	phys_handle = graf_handle(&gl_wchar,&gl_hchar,&gl_wbox,&gl_hbox );

	Wind_get( 0, WF_WORKXYWH, ( WARGS *)&desk );
	
	/* Call initialization hooks */
	rsrc_init();


	if( !open_vwork() )
        {
	   /* Unable to open workstation - exit application */
           form_alert( 1, alert18 );
	   gem_exit( 0 );
        }
	close_vwork();
	gl_ncolors = work_out[13];
	xres       = work_out[0];
	yres	   = work_out[1];
	vhandle = 0;

	
	wind_init();
	evnt_init();
	
	/* Main event loop */
	do
	{

		event = Evnt_multi( ev_mask, ev_clicks, ev_bmask, ev_bstate,
				    &ev_m1, &ev_m2, ( WORD *)msg, ev_time,
				    &mrets,(WORD *)&key,(WORD *)&nclicks );
		wind_update( BEG_UPDATE );
		

	/* Dispatch events.
	 * It is possible to get more than one event at a time, so if the
	 * order of event handling is important to you, change the order
	 * in which they're handled here.
	 */
		if( event & MU_MESAG )
			switch( msg[0] ) {

				case MN_SELECTED:
				break;

				case WM_REDRAW:
				case WM_TOPPED:
				case WM_CLOSED:
				case WM_FULLED:
				case WM_ARROWED:
				case WM_HSLID:
				case WM_VSLID:
				case WM_SIZED:
				case WM_MOVED:
				case WM_NEWTOP:
					do_windows( msg, &event );
				break;

				case AC_OPEN:
					acc_open( msg );
				break;
				
				case AP_TERM:
				case AC_CLOSE:
					acc_close( msg );
				break;

				default:
					break;
			} /* switch */
		/* MU_MESAG */

		wind_update( END_UPDATE );

	/*
	 * Event handling routines zero out the event variable
	 * to exit the application.
	 */
	} while( event );

	gem_exit( 0 );
}
Exemplo n.º 21
0
void
main( int argc, char *argv[], char *envp[] )
{
	int 	i;
/* 	-----	evnt_multi return parameters */
	int		event, msg[8], key, nclicks;
	MRETS	mrets;
	int  	rez;
/*
 * Initialize global arguments
 */
	if( (nargs = argc) != 1)
		args = argv;
	env = envp;

/*
 * See if we were run from the AUTO folder...
 */
	if( (gl_apid = appl_init()) == -1 ) {
		Cconws("\r\nError initializing GEM, hit a key...");
		Cconin();
		exit( gl_apid );
	}
	rez = Getrez() + 2;
	if(( rez != 2 ) && ( rez != 6 ) )
	{
	   /* Ensure that we run ONLY in ST LOW or TT MED - 640x480 16 colors */
	   form_alert( 1, "[3][ | This program runs in| ST LOW or TT MED Only][ OK ]" );
	   appl_exit();
	   exit( -1 );
	}
/*
 * Set up work_in to initialize VDI functions to useful values,
 * Get the physical workstation handle from the AES, then
 * open a virtual workstation and get our AES work area's extent.
 */
	work_in[0] = Getrez()+2; /* let's not gag GDOS */
	for( i = 1; i < 10; work_in[i++] = 1 )
	;
	work_in[10] = 2; /* raster coordinates */
	vhandle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox );
	v_opnvwk( work_in, &vhandle, work_out );
	xres = work_out[0];
	yres = work_out[1];

/*
 * Call initialization hooks
 */
	Wind_get( 0, WF_WORKXYWH, ( WARGS *)&desk );
	if( !rsrc_init() ) {
		form_alert( 1, "[3][ RSC ERROR ][ OK ]" );
		v_clsvwk( vhandle );
		appl_exit();
		exit( -1 );
	}

	wind_init();
	evnt_init();

/*
 * Main event loop
 */
	do {

		event = Evnt_multi( ev_mask, ev_clicks, ev_bmask, ev_bstate,
							&ev_m1, &ev_m2, ( WORD *)msg, ev_time,
							&mrets, ( WORD *)&key, ( WORD *)&nclicks );
		wind_update( BEG_UPDATE );
	/*
	 * call pre-event-processing hook
	 */
		if( evnt_hook( event, msg, &mrets, &key, &nclicks ) )
			continue;

	/* Dispatch events.
	 * It is possible to get more than one event at a time, so if the
	 * order of event handling is important to you, change the order
	 * in which they're handled here.
	 */
		if( event & MU_TIMER )
			do_timer( &event );

		if( event & MU_KEYBD )
			do_key( mrets.kstate, key, &event );

		if( event & MU_BUTTON )
			do_button( &mrets, nclicks, &event );

		if( event & MU_M1 )
			do_m1( &mrets, &event );

		if( event & MU_M2 )
			do_m2( &mrets, &event );

		if( event & MU_MESAG )
			switch( msg[0] ) {

				case MN_SELECTED:
					do_menu( msg, &event );
				break;

				case WM_REDRAW:
				case WM_TOPPED:
				case WM_CLOSED:
				case WM_FULLED:
				case WM_ARROWED:
				case WM_HSLID:
				case WM_VSLID:
				case WM_SIZED:
				case WM_MOVED:
				case WM_NEWTOP:
					do_windows( msg, &event );
				break;

				case AC_OPEN:
					acc_open( msg );
				break;

				case AC_CLOSE:
					acc_close( msg );
				break;

				default:
					msg_hook( msg, &event );
			} /* switch */
		/* MU_MESAG */

		wind_update( END_UPDATE );

	/*
	 * Event handling routines zero out the event variable
	 * to exit the application.
	 */
	} while( event );

	gem_exit( 0 );
}
Exemplo n.º 22
0
void	main(void) {
	WORD	x,y,w,h;
	
	WORD	mx,my,button,kstate,clicks;
	
	MFDB	mfdbs,mfdbd;
	
	WORD	xyarray[8],vid;

	WORD	work_in[] = {1,7,1,1,1,1,1,1,1,1,2};
	WORD	work_out[57];
	OBJECT	*dial;
	
	char	path[200],file[30];
	
	appl_init();

	strcpy(path,"C:\\*");
	strcpy(file,"noname.inf");

	vid = graf_handle(&vid,&vid,&vid,&vid);

	v_opnvwk(work_in,&vid,work_out);


/*	for(x = 0; x < 25; x++)
		form_error(x);
*/
/*	fsel_input(path,file,&button);
*/
	form_alert(3,"[2][Test av|form_alert.|Windoze rulez...|...___NOOOT!___][Ja|Kanske|Nej]");
	
	if(rsrc_load("test2rsc.rsc")) {
		int co;
		int i;
		
		rsrc_gaddr(R_TREE,TESTDIAL,&dial);

		form_center(dial,&x,&y,&w,&h);
		form_dial(FMD_START,0,0,0,0,x,y,w,h);

		objc_draw(dial,0,9,x,y,w,h);

		form_do(dial,0);

		form_dial(FMD_FINISH,0,0,0,0,x,y,w,h);

		i = 0;
		
		objc_delete(dial,11);
		
		while(1) {
			fprintf(stderr,"%3d next=%3d head=%3d tail=%3d\r\n",
				i,dial[i].ob_next,dial[i].ob_head,dial[i].ob_tail);
			
			if(dial[i].ob_flags & LASTOB) {
				break;
			};
			
			i++;
		};
		
		getchar();

		rsrc_free();
	}
	else {
		form_alert(1,"[1][Couldn't load resource file!][Bummer!]");
	};
	
	v_clsvwk(vid);

	fprintf(stderr,"environ size=%d",shel_write(SWM_ENVIRON,ENVIRON_SIZE,0,NULL,NULL));
	
	appl_exit();
}
Exemplo n.º 23
0
/* *** Beim GEM anmelden *** */
int initGEM(void)
{
 int rgb[3];
 int work_in[12], work_out[57];		/* VDI-Felder */
 int i, ap_id;

 ap_id=appl_init();
 if(ap_id==-1)	return(-1);
 if(aesversion>=0x400)					/* Wenn m�glich einen Namen anmelden */
	menu_register(ap_id, "  STed\0\0\0\0");
 graf_mouse(ARROW, 0L);					/* Maus als Pfeil */

 if( !rsrc_load("sted.rsc") )
  {
   form_alert(1, "[3][Could not|load <sted.rsc>][Cancel]");
   appl_exit();
   return(-1);
  }
 rsrc_gaddr(R_TREE, MAINMENU, &menu);	/* Adresse holen */
 rsrc_gaddr(R_TREE, ABOUTSED, &aboutdlg);
 rsrc_gaddr(R_TREE, LDATDIA, &lvdatdlg);

#ifdef RESTRIC_STED
 lvdatdlg[LVLTYP].ob_flags |= HIDETREE;
 lvdatdlg[LVLTYP].ob_flags &= ~EDITABLE;
 lvdatdlg[LVLTYPT1].ob_flags |= HIDETREE;
 lvdatdlg[LVLTYPT2].ob_flags |= HIDETREE;
 lvdatdlg[LVLID].ob_flags |= HIDETREE;
 lvdatdlg[LVLID].ob_flags &= ~EDITABLE;
 lvdatdlg[LVLIDT1].ob_flags |= HIDETREE;
#endif

 wind_get(0, WF_WORKXYWH, &deskx, &desky, &deskw, &deskh); /* Desktopgr��e */

 vhndl=graf_handle(&i, &i, &i, &i);
 for(i=0; i<10; i++)	work_in[i]=1;
 work_in[10]=2;
 v_opnvwk(work_in, &vhndl, work_out);	/* VDI-Station �ffnen */

 vq_extnd(vhndl, 1, work_out);
 bipp=work_out[4];						/* Bits pro Bitplane ermitteln */
 if(bipp>8)
  {
   form_alert(1, "[3][Sorry, STed only works|in 16 and 256 colors!][Ok]");
   v_clsvwk(vhndl); rsrc_free(); appl_exit();
   return(-1);
  }

 menu_bar(menu, 1);			/* Men� darstellen */

 for(i=0; i<15; i++)		/* Alte Farben sichern */
  {
   vq_color(vhndl, i, 1, rgb);
   oldpal[i][0]=rgb[0];
   oldpal[i][1]=rgb[1];
   oldpal[i][2]=rgb[2];
  }
 setpal(newpal);			/* Neue Farben setzen */

 return(0);
}
Exemplo n.º 24
0
/* MAIN()
 * ================================================================
 */
VOID
main( VOID )
{
	OBJECT  *tree;
	WORD    i;
	WORD    button;
	GRECT   box;
	GRECT   xrect;
        WORD    tempx;

        GRECT   rect;
        MRETS   mk;
	
        WORD    ptitle, pitem, pmenu;
	OBJECT  *ptree;
        BOOLEAN flag;
	BOOLEAN done;
	WORD    dummy;

        WORD	xvalue;

        
	appl_init();

	phys_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox );

        graf_mouse( ARROW, 0L );
        
        rsrc_load( "TEST.RSC" );

        rsrc_gaddr( 0, MENU1, &ad_tree );
	rsrc_gaddr( 0, BIGBOX, &ad_box );
        rsrc_gaddr( 0, COUNTRY, &ad_country );
	rsrc_gaddr( 0, OTHER, &ad_other );
        rsrc_gaddr( 0, MENUBAR, &ad_menubar );
	rsrc_gaddr( 0, TREE6, &ad_extra );

	ad_other[ ROOT ].ob_x = ad_other[ ROOT ].ob_y = 0;
#if 0
	/* test setting delay and height variables */
	TData.Delay  = 100L;
	TData.Drag   = 10000L;
	TData.Delay  = 250L;
	TData.Speed  = 0L;
	TData.Height = 16;
	menu_settings( 1, &TData );
#endif

	/* test attaching submenus */
	Menu.mn_tree   = ad_country;
	Menu.mn_menu   = ROOT;
        Menu.mn_item   = Cur2;
	Menu.mn_scroll = TRUE;
	menu_attach( 1, ad_tree, DELETE, &Menu );

	Menu.mn_tree   = ad_other;
	Menu.mn_menu   = DISNEY;
        Menu.mn_item   = MICKEY;
	Menu.mn_scroll = FALSE;
	menu_attach( 1, ad_tree, FLOPPY, &Menu );

	Menu.mn_tree   = ad_other;
	Menu.mn_menu   = MODEM;
        Menu.mn_item   = Cur3;
	Menu.mn_scroll = FALSE;
        menu_attach( 1, ad_country, 5, &Menu );

	Menu.mn_tree   = ad_other;
	Menu.mn_menu   = DISNEY;
        Menu.mn_item   = MICKEY;
	Menu.mn_scroll = FALSE;
        menu_attach( 1, ad_country, 1, &Menu );

	Menu.mn_tree   = ad_other;
	Menu.mn_menu   = DISNEY;
        Menu.mn_item   = MICKEY;
	Menu.mn_scroll = FALSE;
	menu_attach( 1, ad_country, ARKANSAS, &Menu );

	Menu.mn_tree   = ad_other;
	Menu.mn_menu   = QUOTES;
        Menu.mn_item   = Cur4;
	Menu.mn_scroll = FALSE;
	menu_attach( 1, ad_other, 5, &Menu );

	Menu.mn_tree   = ad_country;
	Menu.mn_menu   = ROOT;
        Menu.mn_item   = Cur2;
	Menu.mn_scroll = TRUE;
	menu_attach( 1, ad_menubar, PASTE, &Menu );

	Menu.mn_tree   = ad_country;
	Menu.mn_menu   = ROOT;
        Menu.mn_item   = Cur2;
	Menu.mn_scroll = TRUE;
	menu_attach( 1, ad_menubar, FNEW, &Menu );

        menu_icheck( ad_tree, Cur1, 1 );
	menu_icheck( ad_country, Cur2, 1 );
	menu_icheck( ad_other, Cur3, 1 );
	menu_icheck( ad_other, Cur4, 1 );
	menu_icheck( ad_other, Cur5, 1 );

	ActiveTree( ad_box );

        form_center( ad_box, &rect.g_x, &rect.g_y, &rect.g_w, &rect.g_h );

	ObX( ROOT ) = rect.g_x;
        xrect = ObRect( TITLE1 );
        objc_offset( ad_box, TITLE1, &xrect.g_x, &xrect.g_y );
	tempx = xrect.g_x;
        xrect.g_x = (( xrect.g_x + 7 )/8 ) * 8;
	rect.g_x = rect.g_x + ( xrect.g_x - tempx );
	ObX( ROOT ) = rect.g_x;
	rect.g_x -= 3;

	form_dial( FMD_START, rect.g_x, rect.g_y, rect.g_w, rect.g_h,
			      rect.g_x, rect.g_y, rect.g_w, rect.g_h );
	objc_draw( ad_box, ROOT, MAX_DEPTH, rect.g_x, rect.g_y,
					    rect.g_w, rect.g_h );

        do
        {
	  ActiveTree( ad_box );
          button = form_do( ad_box, 0L );

	  switch( button )
	  {
	    case TITLE1:
			 box = ObRect( TITLE1 );
			 objc_offset( ad_box, TITLE1, &box.g_x, &box.g_y );
			 
			 Menu.mn_tree   = ad_tree;
			 Menu.mn_menu   = ROOT;
			 Menu.mn_item   = Cur1;
			 Menu.mn_scroll = FALSE;
			 flag = menu_popup( &Menu, box.g_x, box.g_y, &MData );
			 if( flag )
			   MenuCheck( MData.mn_tree,
				      MData.mn_menu, 
				      MData.mn_item );
			 break;

            case TITLE2:
			 box = ObRect( TITLE2 );
			 objc_offset( ad_box, TITLE2, &box.g_x, &box.g_y );

			 Menu.mn_tree   = ad_country;
			 Menu.mn_menu   = ROOT;
			 Menu.mn_item   = Cur2;
			 Menu.mn_scroll = TRUE;
			 flag = menu_popup( &Menu, box.g_x, box.g_y, &MData );
			 if( flag )
			   MenuCheck( MData.mn_tree,
				      MData.mn_menu,
				      MData.mn_item );
			 break;

            case TITLE3:
			 box = ObRect( TITLE3 );
			 objc_offset( ad_box, TITLE3, &box.g_x, &box.g_y );

			 Menu.mn_tree   = ad_other;
			 Menu.mn_menu   = MODEM;
			 Menu.mn_item   = Cur3;
			 Menu.mn_scroll = FALSE;
			 flag = menu_popup( &Menu, box.g_x, box.g_y, &MData );
			 if( flag )
			   MenuCheck( MData.mn_tree,
				      MData.mn_menu,
				      MData.mn_item );
			 break;

            case TITLE4:
			 box = ObRect( TITLE4 );
			 objc_offset( ad_box, TITLE4, &box.g_x, &box.g_y );

			 Menu.mn_tree   = ad_other;
			 Menu.mn_menu   = QUOTES;
			 Menu.mn_item   = Cur4;
			 Menu.mn_scroll = FALSE;
			 flag = menu_popup( &Menu, box.g_x, box.g_y, &MData );
			 if( flag )
			   MenuCheck( MData.mn_tree,
				      MData.mn_menu,
				      MData.mn_item );
			 break;

            default:
			break;
          }

        }while( button != XEXIT );

	form_dial( FMD_FINISH, rect.g_x, rect.g_y, rect.g_w, rect.g_h,
			       rect.g_x, rect.g_y, rect.g_w, rect.g_h );

        evnt_button( 1, 1, 0, &dummy, &dummy, &dummy, &dummy );



       /* display menubar stuff here */
        ActiveTree( ad_menubar );
        menu_bar( ad_menubar, TRUE );

        
	do
	{
	    evnt_mesag( msg );
	    if( msg[0] == MN_SELECTED )
	    {
		/* msg[7] is the parent of FQUIT - which the user can't know */
		ptr = &msg[5];
		if( ( *ptr == ad_menubar ) &&
                    ( msg[4] == FQUIT )
		  )
                {
		  button = form_alert( 1, "[1][ |  EXIT PROGRAM? ][OK|Cancel]");
		  if( button == 1 )
		    done = TRUE;
                }  
		else
		    MenuCheck( *ptr, msg[7], msg[4] );
		menu_tnormal( ad_menubar, msg[3], TRUE );
            }	
	}while( !done );
        menu_bar( ad_menubar, FALSE );

        rsrc_free();
	graf_mouse( ARROW, 0L );
	appl_exit();
}
Exemplo n.º 25
0
/* show configuration dial, return 1 to cancel installation */
int
configure( void )
{
    OBJECT *tree = rs_object;
    int quit = 0;
    int x, y, w, h, ox, oy;
    MRETS mk;
    int savelinear, saveudset, savetime, saveptime;

    if( ma_info == &start ) /* ma_info points at our start */
	ObString(OK) = (char *)(rs_frstr[INSTRING]);

/* set accel buttons */
    savelinear = ma_info->linear;
    set_accelbox( savelinear );
/* set screensave buttons */
    saveudset = ma_info->udset;
    set_screenbox( saveudset );
    savetime = (ma_info->timeout)/3600;
    sl_x( SAVEBOX, savetime, SAVE_MIN, SAVE_MAX );
    /* set modem switch */
    if( ma_info->watch ) {
	Select(MODEM);
    } else {
	Deselect(MODEM);
    }
/* set stacy options box */
    if( ma_info->stacy ) {
	ObFlags( SWITCH ) = ObFlags( LITE ) = TOUCHEXIT;
    	if( ma_info->stacmask & SH_SCREEN ) Select( SWITCH );
    	if( ma_info->stacmask & SH_LIGHT ) Select( LITE );
    } else {
	ObFlags(SWITCH) = ObFlags(LITE) = NONE;
	ObState(SWITCH) = ObState(LITE) = DISABLED; /* deselects */
    }

/* set up park box */
    Supexec((long(*)())get_parktime);
    if( parktime >= 0 ) parktime = ma_info->savepark;
    saveptime = parktime;
    if( saveptime == 0 ) saveptime = 1;
    set_parkbox();
    if( parktime >= 0 )
    	sl_x( PARKBOX, parktime, PARK_MIN, PARK_MAX );
    	

/* set appropriate icons */
    graf_handle( &x, &y, &w, &h );
    if( y < 16 ) {
    /* if char cell is < 16 pixels high, use 8 pixel icons */
	ObSpec(IACCOFF).bitblk = (BITBLK *)(rs_frimg[ACCOFF8]);
	ObSpec(IACCSLOW).bitblk = (BITBLK *)(rs_frimg[ACCSLOW8]);
	ObSpec(IACCFAST).bitblk = (BITBLK *)(rs_frimg[ACCFAST8]);
	ObSpec(ISCREEN).bitblk = (BITBLK *)(rs_frimg[SCREEN8]);
	ObSpec(SAVEUP).bitblk = (BITBLK *)(rs_frimg[TIMEHI8]);
	ObSpec(SAVEDOWN).bitblk = (BITBLK *)(rs_frimg[TIMELO8]);
	ObSpec(IMODEM).bitblk = (BITBLK *)(rs_frimg[MODEM8]);
	ObSpec(IPARK).bitblk = (BITBLK *)(rs_frimg[PARK8]);
	ObSpec(PARKUP).bitblk = (BITBLK *)(rs_frimg[TIMEHI8]);
	ObSpec(PARKDOWN).bitblk = (BITBLK *)(rs_frimg[TIMELO8]);
	ObSpec(ILITE).bitblk = (BITBLK *)(rs_frimg[LITE8]);
	ObSpec(ISWITCH).bitblk = (BITBLK *)(rs_frimg[SCREEN8]);
    }

    form_center( rs_object, &x, &y, &w, &h );
    form_dial( FMD_START, 0, 0, 0, 0, x, y, w, h );
    form_dial( FMD_GROW, 0, 0, 0, 0, x, y, w, h );
    objc_draw( tree, 0, MAX_DEPTH, x, y, w, h );
    graf_mouse( ARROW, 0L );
    do {
	switch( form_do( rs_object, 0 ) & 0x7fff ) {
	case LITE:
	    if( IsSelected(LITE) ) { /* deselecting */
	    /* don't allow user to select screensave without litesave */
	    	Deselect(SWITCH);
	    	Deselect(LITE);
	    } else {
	    	Select(LITE);
	    }
	    Objc_draw( tree, STACOPTS, MAX_DEPTH, NULL );
	    break;
	case SWITCH:
	    if( IsSelected(SWITCH) ) { /* deselecting */
	    	Deselect(SWITCH);
	    } else {
	    /* don't allow user to select screensave without litesave */
		Select(LITE);
		Select(SWITCH);
	    }
	    Objc_draw( tree, STACOPTS, MAX_DEPTH, NULL );
	    break;
	case SCREEN:
	/* floggle the bit */
	    ma_info->udset ^= 1;
	    ma_info->updown = ma_info->udset;
	    set_screenbox( ma_info->udset );
	    Objc_draw( tree, SCRNSECT, MAX_DEPTH, NULL);
	    break;
	case ACCOFF:
	    ma_info->linear = -1;
	    break;
	case ACCSLOW:
	    ma_info->linear = 1;
	    break;
	case ACCFAST:
	    ma_info->linear = 0;
	    break;
	case SAVEUP:
	    sl_arrow( SAVEBOX, SAVEUP, 1, SAVE_MIN, SAVE_MAX, &savetime );
	    break;
	case SAVEDOWN:
	    sl_arrow( SAVEBOX, SAVEDOWN, -1, SAVE_MIN, SAVE_MAX, &savetime );
	    break;
	case SAVESLID:
	    sl_drag( SAVEBOX, SAVE_MIN, SAVE_MAX, &savetime );
	    break;
	case SAVEBOX:
    	    Graf_mkstate( &mk );
    	    objc_offset( tree, SAVESLID, &ox, &oy );
    	    if( mk.x < ox )
    	    	oy = -SAVE_PAGE;
    	    else
    	        oy = SAVE_PAGE;
	    sl_arrow( SAVEBOX, -1, oy, SAVE_MIN, SAVE_MAX, &savetime );
	    break;
	case PARK:
	    if( IsSelected( PARK ) ) { /* deselecting */
		saveptime = parktime;
	    	parktime = 0;
	    } else {
	    	parktime = saveptime;
		sl_x( PARKBOX, parktime, PARK_MIN, PARK_MAX );
	    }
	    set_parkbox();
	    Objc_draw( tree, PARKSECT, MAX_DEPTH, NULL );
	    break;
	case PARKUP:
	    sl_arrow( PARKBOX, PARKUP, 1, PARK_MIN, PARK_MAX, &parktime );
	    break;
	case PARKDOWN:
	    sl_arrow( PARKBOX, PARKDOWN, -1, PARK_MIN, PARK_MAX, &parktime );
	    break;
	case PARKSLID:
	    sl_drag( PARKBOX, PARK_MIN, PARK_MAX, &parktime );
	    break;
	case PARKBOX:
    	    Graf_mkstate( &mk );
    	    objc_offset( tree, PARKSLID, &ox, &oy );
    	    if( mk.x < ox )
    	    	oy = -PARK_PAGE;
    	    else
    	        oy = PARK_PAGE;
	    sl_arrow( PARKBOX, -1, oy, PARK_MIN, PARK_MAX, &parktime );
	    break;
	case SAVE:
	    save_conf( savetime );
	    rs_object[SAVE].ob_state = NORMAL;
	    Objc_draw( tree, ROOT, MAX_DEPTH, NULL );
	    break;
	case OK:
	    quit = OK;
	    break;
	case CANCEL:
	    quit = CANCEL;
	    break;
	}
	/* delay after touchexit objects */
	wait_bup();
    } while (!quit);


    form_dial( FMD_SHRINK, 0, 0, 0, 0, x, y, w, h );
    form_dial( FMD_FINISH, 0, 0, 0, 0, x, y, w, h );

    if( quit == CANCEL ) {
	ma_info->updown = ma_info->udset = saveudset;
	ma_info->linear = savelinear;
    } else {
    	if( IsSelected(MODEM) ) ma_info->watch = 1;
    	else ma_info->watch = 0;
	if( ma_info->stacy ) {
	    if( IsSelected(SWITCH) ) {
		ma_info->stacmask |= SH_SCREEN;
	    } else {
		ma_info->stacmask &= ~SH_SCREEN;
	    }
	    if( IsSelected(LITE) ) {
		ma_info->stacmask |= SH_LIGHT;
	    } else {
		ma_info->stacmask &= ~SH_LIGHT;
	    }
	}
 
	ma_info->timeout = savetime * 3600;
	ma_info->savepark = parktime;
	Supexec((long(*)())set_ptime);
    }
    return (quit == CANCEL);
}
Exemplo n.º 26
0
int GEM_VideoInit(_THIS, SDL_PixelFormat *vformat)
{
	int i, menubar_size;
	short work_in[12], work_out[272], dummy;

	
	if (appl_init() == -1) {
		fprintf(stderr,"Can not open AES\n");
		return 1;
	}

	
	GEM_version = aes_global[0];
	if (GEM_version >= 0x0410) {
		short ap_gout[4], errorcode;
		
		GEM_wfeatures=0;
		errorcode=appl_getinfo(AES_WINDOW, &ap_gout[0], &ap_gout[1], &ap_gout[2], &ap_gout[3]);

		if (errorcode==0) {
			GEM_wfeatures=ap_gout[0];			
		}
	}	

	
	VDI_handle = graf_handle(&dummy, &dummy, &dummy, &dummy);
	if (VDI_handle<1) {
		fprintf(stderr,"Wrong VDI handle %d returned by AES\n",VDI_handle);
		return 1;
	}

	
	work_in[0]=Getrez()+2;
	for(i = 1; i < 10; i++)
		work_in[i] = 1;
	work_in[10] = 2;

	v_opnvwk(work_in, &VDI_handle, work_out);
	if (VDI_handle == 0) {
		fprintf(stderr,"Can not open VDI virtual workstation\n");
		return 1;
	}

	
	VDI_w = work_out[0] + 1;
	VDI_h = work_out[1] + 1;

	
	if (!wind_get(DESKTOP_HANDLE, WF_WORKXYWH, &GEM_desk_x, &GEM_desk_y, &GEM_desk_w, &GEM_desk_h)) {
		fprintf(stderr,"Can not read desktop properties\n");
		return 1;
	}

	
	vq_extnd(VDI_handle, 1, work_out);
	VDI_bpp = work_out[4];
	VDI_oldnumcolors=0;

	switch(VDI_bpp) {
		case 8:
			VDI_pixelsize=1;
			break;
		case 15:
		case 16:
			VDI_pixelsize=2;
			break;
		case 24:
			VDI_pixelsize=3;
			break;
		case 32:
			VDI_pixelsize=4;
			break;
		default:
			fprintf(stderr,"%d bits colour depth not supported\n",VDI_bpp);
			return 1;
	}

	
	for(i = 16; i < 255; i++) {
		vdi_index[i] = i;
	}
	vdi_index[255] = 1;

	
	if (VDI_bpp>8) {
		VDI_oldnumcolors=1<<8;
	} else {
		VDI_oldnumcolors=1<<VDI_bpp;
	}
	
	for(i = 0; i < VDI_oldnumcolors; i++) {
		short rgb[3];

		vq_color(VDI_handle, i, 0, rgb);

		VDI_oldpalette[i][0] = rgb[0];
		VDI_oldpalette[i][1] = rgb[1];
		VDI_oldpalette[i][2] = rgb[2];
	}
	VDI_setpalette = GEM_SetNewPalette;
	SDL_memcpy(VDI_curpalette,VDI_oldpalette,sizeof(VDI_curpalette));

	
	GEM_title_name = empty_name;
	GEM_icon_name = empty_name;

	GEM_handle = -1;
	GEM_locked = SDL_FALSE;
	GEM_win_fulled = SDL_FALSE;
	GEM_fullscreen = SDL_FALSE;
	GEM_lock_redraw = SDL_TRUE;	

	VDI_screen = NULL;
	VDI_pitch = VDI_w * VDI_pixelsize;
	VDI_format = ( (VDI_bpp <= 8) ? VDI_FORMAT_INTER : VDI_FORMAT_PACK);
	VDI_redmask = VDI_greenmask = VDI_bluemask = VDI_alphamask = 0;
	VDI_ReadExtInfo(this, work_out);

#ifdef DEBUG_VIDEO_GEM
	printf("sdl:video:gem: screen: address=0x%08x, pitch=%d\n", VDI_screen, VDI_pitch);
	printf("sdl:video:gem: format=%d\n", VDI_format);
	printf("sdl:video:gem: masks: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n",
		VDI_alphamask, VDI_redmask, VDI_greenmask, VDI_bluemask
	);
#endif

	
	VDI_dst_mfdb.fd_addr = NULL;

	
	this->info.current_w = VDI_w;
	this->info.current_h = VDI_h;

	
	
	vformat->BitsPerPixel = VDI_bpp;

	
	graf_mouse(ARROW, NULL);
	GEM_cursor = NULL;

	
	SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;

	
	vsf_color(VDI_handle,0);
	vsf_interior(VDI_handle,1);
	vsf_perimeter(VDI_handle,0);

	
	menubar_size = GEM_desk_w * GEM_desk_y * VDI_pixelsize;
	GEM_menubar=Atari_SysMalloc(menubar_size,MX_PREFTTRAM);

	
	SDL_modelist[0] = SDL_malloc(sizeof(SDL_Rect));
	SDL_modelist[0]->x = 0;
	SDL_modelist[0]->y = 0;
	SDL_modelist[0]->w = VDI_w;
	SDL_modelist[0]->h = VDI_h;

	SDL_modelist[1] = NULL;

#if SDL_VIDEO_OPENGL
	SDL_AtariGL_InitPointers(this);
#endif

	this->info.wm_available = 1;

	
	return(0);
}
Exemplo n.º 27
0
main()
{
	int gr_mkmx, gr_mkmy;
	int gr_mkmstate, gr_mkkstate;
	int tmpx, tmpy;
	int tmpx1, tmpy1;
	int tmpx2, tmpy2;
	int index, rgb_in[3];
	int draw;

	appl_init();
	phys_handle = graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
	wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
	open_vwork();
	wi_handle = wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk);
	graf_mouse(3, 0x0L);
	graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
	tmpx = gr_mkmx;
	tmpy = gr_mkmy;
	vswr_mode(handle, 3);
	v_enter_cur(handle);
	v_exit_cur(handle);
	graf_mouse(M_OFF, 0x0L);
	drawicon(gr_mkmx,gr_mkmy);
	graf_mouse(M_ON, 0x0L);
	drawicon(gr_mkmx+65,gr_mkmy);
	drawicon(gr_mkmx+65,gr_mkmy+65);
	drawicon(gr_mkmx+130,gr_mkmy);
	drawicon(gr_mkmx+130,gr_mkmy+130);
	drawicon(gr_mkmx+195,gr_mkmy);
	drawicon(gr_mkmx+195,gr_mkmy+195);
	drawicon(gr_mkmx+260,gr_mkmy);
	drawicon(gr_mkmx+260,gr_mkmy+260);
	drawicon(gr_mkmx+325,gr_mkmy);
	drawicon(gr_mkmx+325,gr_mkmy+325);
	drawicon(gr_mkmx+390,gr_mkmy);
	drawicon(gr_mkmx,gr_mkmy+65);
	drawicon(gr_mkmx+130,gr_mkmy+65);
	drawicon(gr_mkmx+195,gr_mkmy+65);
	drawicon(gr_mkmx+260,gr_mkmy+65);
	drawicon(gr_mkmx+325,gr_mkmy+65);
	drawicon(gr_mkmx+390,gr_mkmy+65);
	drawicon(gr_mkmx,gr_mkmy+130);
	drawicon(gr_mkmx+65,gr_mkmy+130);
	drawicon(gr_mkmx+195,gr_mkmy+130);
	drawicon(gr_mkmx+260,gr_mkmy+130);
	drawicon(gr_mkmx+325,gr_mkmy+130);
	drawicon(gr_mkmx+390,gr_mkmy+130);
	drawicon(gr_mkmx,gr_mkmy+195);
	drawicon(gr_mkmx+65,gr_mkmy+195);
	drawicon(gr_mkmx+130,gr_mkmy+195);
	drawicon(gr_mkmx+260,gr_mkmy+195);
	drawicon(gr_mkmx+325,gr_mkmy+195);
	drawicon(gr_mkmx+390,gr_mkmy+195);
	drawicon(gr_mkmx,gr_mkmy+260);
	drawicon(gr_mkmx+65,gr_mkmy+260);
	drawicon(gr_mkmx+130,gr_mkmy+260);
	drawicon(gr_mkmx+195,gr_mkmy+260);
	drawicon(gr_mkmx+325,gr_mkmy+260);
	drawicon(gr_mkmx+390,gr_mkmy+260);
	drawicon(gr_mkmx,gr_mkmy+325);
	drawicon(gr_mkmx+65,gr_mkmy+325);
	drawicon(gr_mkmx+130,gr_mkmy+325);
	drawicon(gr_mkmx+195,gr_mkmy+325);
	drawicon(gr_mkmx+260,gr_mkmy+325);
	drawicon(gr_mkmx+390,gr_mkmy+325);
	while(!(0x0002&gr_mkmstate))	{
		graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
		tmpx1 = gr_mkmx;
		tmpy1 = gr_mkmy;
		tmpx2 = gr_mkmx;
		tmpy2 = gr_mkmy;
		graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
		while (((tmpx1 != gr_mkmx) || (tmpy1 != gr_mkmy)) &&
				((abs(tmpx1, tmpx2) < 6) || (abs(tmpy1, tmpy2) < 6)) &&
				(0x0001&gr_mkmstate))	{
			graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
			tmpx1 = gr_mkmx;
			tmpy1 = gr_mkmy;
			graf_mkstate(&gr_mkmx, &gr_mkmy, &gr_mkmstate, &gr_mkkstate);
			draw = 1;
		}
		if (draw)	{
		/*
			v_enter_cur(handle);
			graf_mouse(M_OFF, 0x0L);
			graf_mouse(M_ON, 0x0L);
		*/
			v_exit_cur(handle);

			drawicon(gr_mkmx,gr_mkmy);

			drawicon(gr_mkmx+65,gr_mkmy);
			drawicon(gr_mkmx+65,gr_mkmy+65);
			drawicon(gr_mkmx+130,gr_mkmy);
			drawicon(gr_mkmx+130,gr_mkmy+130);
			drawicon(gr_mkmx+195,gr_mkmy);
			drawicon(gr_mkmx+195,gr_mkmy+195);
			drawicon(gr_mkmx+260,gr_mkmy);
			drawicon(gr_mkmx+260,gr_mkmy+260);
			drawicon(gr_mkmx+325,gr_mkmy);
			drawicon(gr_mkmx+325,gr_mkmy+325);
			drawicon(gr_mkmx+390,gr_mkmy);
			drawicon(gr_mkmx,gr_mkmy+65);
			drawicon(gr_mkmx+130,gr_mkmy+65);
			drawicon(gr_mkmx+195,gr_mkmy+65);
			drawicon(gr_mkmx+260,gr_mkmy+65);
			drawicon(gr_mkmx+325,gr_mkmy+65);
			drawicon(gr_mkmx+390,gr_mkmy+65);
			drawicon(gr_mkmx,gr_mkmy+130);
			drawicon(gr_mkmx+65,gr_mkmy+130);
			drawicon(gr_mkmx+195,gr_mkmy+130);
			drawicon(gr_mkmx+260,gr_mkmy+130);
			drawicon(gr_mkmx+325,gr_mkmy+130);
			drawicon(gr_mkmx+390,gr_mkmy+130);
			drawicon(gr_mkmx,gr_mkmy+195);
			drawicon(gr_mkmx+65,gr_mkmy+195);
			drawicon(gr_mkmx+130,gr_mkmy+195);
			drawicon(gr_mkmx+260,gr_mkmy+195);
			drawicon(gr_mkmx+325,gr_mkmy+195);
			drawicon(gr_mkmx+390,gr_mkmy+195);
			drawicon(gr_mkmx,gr_mkmy+260);
			drawicon(gr_mkmx+65,gr_mkmy+260);
			drawicon(gr_mkmx+130,gr_mkmy+260);
			drawicon(gr_mkmx+195,gr_mkmy+260);
			drawicon(gr_mkmx+325,gr_mkmy+260);
			drawicon(gr_mkmx+390,gr_mkmy+260);
			drawicon(gr_mkmx,gr_mkmy+325);
			drawicon(gr_mkmx+65,gr_mkmy+325);
			drawicon(gr_mkmx+130,gr_mkmy+325);
			drawicon(gr_mkmx+195,gr_mkmy+325);
			drawicon(gr_mkmx+260,gr_mkmy+325);
			drawicon(gr_mkmx+390,gr_mkmy+325);
			draw = 0;
		}
	}
	wind_delete(wi_handle);
	v_clsvwk(handle);
	appl_exit();
}
Exemplo n.º 28
0
GemInit()
{
	int	work_in[11];
	int	i;
	int 	dev_id;
	int work_out[57];


	appl_init();

	if( gl_apid == -1 ) 
		return(4);

	/* Make Alice compatible with the fine Atari GDOS */
        dev_id = Getrez() + 2;

	gem_handle = graf_handle( &gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox );
	vdi_handle = gem_handle;

	/*
	 * Open the Virtual Workstation
	 */
	for( i=1; i<10; i++ ) work_in[i] = 1;
	work_in[0] = dev_id;
	work_in[10] = 2;		/* Raster coords */

	v_opnvwk( work_in, &vdi_handle, work_out );

	scr_area.g_w = work_out[0] + 1;
	scr_area.g_h = work_out[1] + 1;
	scr_area.g_x = 0;
	scr_area.g_y = 0;

	if( (scr_area.g_w / gl_wchar) < 70 )
		LoRes = TRUE;

#ifdef EMBEDDED_RCS
	rsc_fix();
#else

	if( !rsrc_load( "ALICE.RSC" ) ) {
		form_alert( 1, LDS( 375, 
		"[3][Fatal Error !|ALICE.RSC must be|in current directory][ Abort ]"));
		v_clsvwk( vdi_handle );
		appl_exit();
		exit( 1 );
	}

#endif EMBEDDED_RCS

#ifndef SAI
	/*
	 * Set up the menu bar
	 */

	rsrc_gaddr( R_TREE, MENU, &gl_menu );

	if( LoRes ) {
		ShortenMenu( gl_menu );
		FixBar( gl_menu );
	}

	menu_bar( gl_menu, TRUE );

#endif SAI

	/*
	 * Set the mouse to an arrow, and end the update
	 */
	graf_mouse( ARROW, 0x0L );

	resetVDI();

}
Exemplo n.º 29
0
/*
 * Top level;
 * we get control from the desktop.
 */
main()
{
	pnf = 0;		/* set the flag to it isn't partition yet */
    appl_init();
    phys_handle=graf_handle(&gl_wchar, &gl_hchar, &gl_wbox, &gl_hbox);
    wind_get(0, WF_WORKXYWH, &xdesk, &ydesk, &wdesk, &hdesk);
    open_vwork();
    wi_handle=wind_create(0x0040&0x0080, xdesk, ydesk, wdesk, hdesk);

    hidden = FALSE;
    butdown = TRUE;

	/* doing a checking see if the cache in the system */
	cachexst = (char) chkcache();

    if (!rsrc_load(RESOURCEFILE)) {
	errs("[2][|", RESOURCEFILE, "][ EXIT ]");
	goto punt;
    }

    
    /* Get all addresses of dialogues from resource file */
    if (getalladdr() != OK) {
	errs("[2][|", RESOURCEFILE, "][ EXIT ]");
	goto punt;
    }


    /*
     * Get maximum partition size from
     * wincap "@@" entry.
     */
	/*
    if (wgetent("Parameters", "@@") == OK) {
	if (wgetnum("ms", &mxpsiz) != OK)
	    mxpsiz = MAXPSIZ;
    } else {
    	goto punt;
    }
	*/

	needscan = TRUE;

redomul:
    ARROW_MOUSE;

    /* display menu bar */
    menu_bar(menuobj, 1);

    running = TRUE;
    while (running) {
    	domulti();
    }

    /*
     * If nothing has been done to the hard disks
     * then just get out, back to the desktop.
     * Otherwise reboot the system.
     */
    menu_bar(menuobj, 0);		/* erase menu bar */

punt:
    /*
     * If we have to reboot,
     * tell the user and then do it.
     *
     */
    if (rebootp) {
		if (form_alert(2, autoboot) == 1)	{
			reboot();
		} else {
			goto redomul;
		}
    }

    wind_delete(wi_handle);
    v_clsvwk(handle);
    appl_exit();
}
Exemplo n.º 30
0
short main(int argc, char *argv[])
{
	MFDB dest;
	short my_AppId, x, y, w, h;
	short work_in[11] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2};
	short work_out[57], msg[16], w_id1;
	short open_windows = 1, dummy;
	short wx, wy, ww, wh, clip[4], pnt[4];
	char win1_name[20];
	unsigned short logo_trnfrm[LOGO_DATASIZE];
	GRECT dirty, walk;
	short e = 0, evx, evy, a, kc_shstate, kc_key, click_count;

	my_AppId = appl_init();
	my_handle = graf_handle(&x, &y, &w, &h);		/* Open a virtual workstation */
	v_opnvwk(work_in, &my_handle, work_out);

	logo_bm.fd_w = LOGO_W;
	logo_bm.fd_h = LOGO_H;
	logo_bm.fd_wdwidth = 12;
	logo_bm.fd_nplanes = 4;
	logo_bm.fd_stand = 1;
	dest = logo_bm;
	dest.fd_stand = 0;

	logo_bm.fd_addr = (void *)x_logo;
	dest.fd_addr = (void *)logo_trnfrm;
	vr_trnfm(my_handle, &logo_bm, &dest);
	logo_bm.fd_addr = (void *)logo_trnfrm;

	w_id1 = wind_create(NAME|CLOSE|MOVER, 0, 0, LOGO_W + 40, LOGO_H + 40);

	if (argc > 1)
		sprintf(win1_name,"%s", argv[1]);
	else
		sprintf(win1_name,"Welcome to...", argv[1]);
		
	wind_set(w_id1, WF_NAME, ADDR(win1_name));

	x = (work_out[0] - (LOGO_W + 40)) / 2;
	y = (work_out[1] - (LOGO_H + 40)) / 2;
	wind_open(w_id1, x, y, LOGO_W + 40, LOGO_H + 40);

	while((open_windows) && (!(e & MU_TIMER))) {
		e = evnt_multi(MU_MESAG|MU_TIMER, 258, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
			msg, 15000, 0, &evx, &evy, &a, &kc_shstate, &kc_key, &click_count);

		if (e & MU_MESAG) {
			dummy = msg[0];
			switch(dummy) {
			case WM_CLOSED:	/* Did someone close one of our windows? */
				wind_close(msg[3]);
				open_windows--;
				break;
			case WM_MOVED:
				wind_set(msg[3], WF_CURRXYWH, msg[4], msg[5], msg[6], msg[7]);
				break;
			case WM_REDRAW:
				dirty.g_x = msg[4];
				dirty.g_y = msg[5];
				dirty.g_w = msg[6];
				dirty.g_h = msg[7];
				wind_update(BEG_UPDATE);
				wind_get(msg[3], WF_WORKXYWH, &wx, &wy, &ww, &wh);
				walk.g_x = wx;
				walk.g_y = wy;
				walk.g_w = ww;
				walk.g_h = wh;
				pnt[0] = wx;
				pnt[1] = wy;
				pnt[2] = wx + ww;
				pnt[3] = wy + wh;
				wind_get(msg[3], WF_FIRSTXYWH, &x, &y, &w, &h);
				rc_intersect(&walk, &dirty);
				graf_mouse(M_OFF, NULL);
				while(h) {
					walk.g_x = x;
					walk.g_y = y;
					walk.g_w = w;
					walk.g_h = h;
					if (rc_intersect(&dirty, &walk)) {
						clip[0] = walk.g_x;
						clip[1] = walk.g_y;
						clip[2] = walk.g_x + walk.g_w;
						clip[3] = walk.g_y + walk.g_h;
						vs_clip(my_handle, 1, clip);
						vsf_color(my_handle, LWHITE);
						v_bar(my_handle, pnt);
						display_bitmap(wx, wy);
					}
					wind_get(msg[3], WF_NEXTXYWH, &x, &y, &w, &h);
				}
				vs_clip(my_handle, 0, clip);
				graf_mouse(M_ON, NULL);
				wind_update(END_UPDATE);
				break;
			case WM_TOPPED:
				wind_set(msg[3], WF_TOP, 0, 0, 0, 0);
				break;
			case WM_BOTTOMED:
				wind_set(msg[3], WF_BOTTOM, 0, 0, 0, 0);
				break;
			}
		}
	}
	
	v_clsvwk(my_handle);
	
	appl_exit();
	
	return 0;
}