Esempio n. 1
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;
}
Esempio n. 2
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);
 }
Esempio n. 3
0
void set_screen_attr()
{
	int16_t work_out[57];

	vq_extnd(screen_vhandle, 0, work_out); 
	x_max = work_out[0]; 
	y_max = work_out[1];
	screen_rez = Getrez(); /* 0 =  low,  1 = med,  2 = high */
	colour_screen = screen_rez < 2; /* mono 2,  colour 0 or 1 */
}
Esempio n. 4
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);
}
Esempio n. 5
0
short
V_Opnwk(short devno, VDI_Workstation *dev)
{
	short i, in[11];
	
	in[0] = dev->dev_id = devno;
	for(i=1;i<10;in[i++]=1);
	in[10]=2;
	i=devno;
	
	v_opnwk(in,&i,&dev->xres);
	dev->handle = i;
	
	if(i)
		vq_extnd(i,1,&dev->screentype);
	
	return(i);
}
Esempio n. 6
0
static inline void plotter_vdi_clip( GEM_PLOTTER self, bool set)
{
	return;
	if( set == true ) {
		struct rect c;
		short vdiflags[58];
		short newclip[4];
		self->get_clip( self, &c );
		vq_extnd( self->vdi_handle, 1, (short*)&vdiflags);
		prev_vdi_clip[0] = vdiflags[45];
		prev_vdi_clip[1] = vdiflags[46];
		prev_vdi_clip[2] = vdiflags[47];
		prev_vdi_clip[3] = vdiflags[48];
		newclip[0] = VIEW(self).x + MAX(c.x0, 0);
		newclip[1] = VIEW(self).y + MAX(c.y0, 0);
		newclip[2] = MIN(VIEW(self).x+VIEW(self).w, newclip[0] + (c.x1 - c.x0) )-1;
		newclip[3] = MIN(VIEW(self).y+VIEW(self).h, newclip[1] + (c.y1 - c.y0) )-1;
		vs_clip( self->vdi_handle, 1, (short*)&newclip );
	} else {
		vs_clip( self->vdi_handle, 1, (short *)&prev_vdi_clip );
	}
}
Esempio n. 7
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);
}
Esempio n. 8
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);
}
Esempio n. 9
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);
}
Esempio n. 10
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);
}
Esempio n. 11
0
/* Pop_Blit()
 *==========================================================================
 * Blit from screen to buffer or buffer to screen for Popup Box redraws.
 *
 * IN: long *PopPtr:	Pointer to memory buffer...
 *     GRECT *area:	GRECT of blit PXY area
 *     GRECT *clip:	GRECT of clip blit area
 *     int   flag:	0 - blit from screen to buffer
 *                      1 - blit from buffer to screen
 *
 * OUT: returns true if successful, false if failed.
 */
int
Pop_Blit( long *PopPtr, GRECT *clip, int flag )
{
    long location = 0L;				/* SCREEN MFDB		*/
    static int  nplanes;				/* Number of planes	*/
    int  pxy[8];					/* pxy for blit		*/
    static MFDB PopMFDB;				/* buffer MFDB		*/

    unsigned long size;				/* size of malloc	*/

    if( !open_vwork() )
        return( FALSE );

    clip->g_w = clip->g_w + 2;
    clip->g_h = clip->g_h + 2;
    rc_2xy( clip, ( WORD *)&pxy[0] );
    vs_clip( vhandle, 1, pxy );

    if( !flag )					/* screen to buffer blit*/
    {
        vq_extnd( vhandle, 1, work_out );
        nplanes = work_out[4];

        size = (unsigned long)(((long)clip->g_w + 7L )/8L) *
               (long)clip->g_h * (long)nplanes;
        size = size * 2L;
        *PopPtr = (long)Malloc( (unsigned long ) size );
        if( !*PopPtr )
        {
            close_vwork();
            return( FALSE );
        }

        PopMFDB.fd_addr 	= (long *)*PopPtr;	/* Setup the MFDB      */
        PopMFDB.fd_w	= clip->g_w;
        PopMFDB.fd_h	= clip->g_h;
        PopMFDB.fd_wdwidth = ( clip->g_w + 15 ) / 16;
        PopMFDB.fd_stand 	= 0;
        PopMFDB.fd_nplanes = nplanes;
        PopMFDB.fd_r1 	= PopMFDB.fd_r2 = PopMFDB.fd_r3 = 0;
    }

    graf_mouse( M_OFF, 0L );

    if(!flag )
    {
        /* Screen to buffer blit */
        rc_intersect( &desk, clip );
        rc_2xy( clip, ( WORD *)&pxy[0] );
        pxy[4] = pxy[5] = 0;
        pxy[6] = clip->g_w - 1;
        pxy[7] = clip->g_h - 1;
        vro_cpyfm( vhandle, 3, pxy, (MFDB *)&location, &PopMFDB );
    }
    else
    {
        /* Buffer to screen blit */
        rc_intersect( &desk, clip );
        pxy[0] = pxy[1] = 0;
        pxy[2] = clip->g_w - 1;
        pxy[3] = clip->g_h - 1;
        rc_2xy( clip, ( WORD *)&pxy[4] );
        vro_cpyfm( vhandle, 3, pxy, &PopMFDB, (MFDB *)&location );
        if( *PopPtr )
            Mfree( (long)*PopPtr );
    }
    graf_mouse( M_ON, 0L );

    close_vwork();
    return( TRUE );
}
Esempio n. 12
0
/*
** Description
** Initialize global variables, open vdi workstation etc
*/
void
init_global (WORD physical_vdi_id)
{
#if 0
  int        temp_vid;
  int        work_in[] = {1,1,1,1,1,1,1,1,1,1,2};
#endif
  int        work_out[57];
  int        dum;
  static int is_inited = FALSE;

  /* Only initialize globals if they haven't been initialized before */
  if(!is_inited)
  {
    is_inited = TRUE;
    
    DEBUG3 ("Entering init_global");
    
#if 0 /* FIXME def MINT_TARGET */
    /* Only mess with videomodes if running under MiNT */
    if(globals.video == 0x00030000L) {
      fprintf(stderr,"VsetMode\r\n");
      oldmode = globals.vmode = 3;
      oldmodecode = globals.vmodecode = VsetMode(-1);
      fprintf(stderr,"/VsetMode\r\n");
    }
    else {
      oldmode = globals.vmode = Getrez();
    };
#endif /* MINT_TARGET */
    
    global_common.mouse_owner = -1;
    global_common.realmove = 0;
    global_common.realsize = 0;
    global_common.realslide = 0;
    global_common.fnt_regul_id = -1;
    global_common.fnt_regul_sz = -1;
    global_common.icon_width = 48;
    global_common.icon_height = 56;
    global_common.wind_appl = 1;
    global_common.graf_mbox = 1;
    global_common.graf_growbox = 1;
    global_common.graf_shrinkbox = 1;
    global_common.fsel_sorted = 1;
    global_common.fsel_extern = 0;
    
    DEBUG3 ("init_global: 2");
    
#if 0 /* FIXME : Remove? def MINT_TARGET */
    fprintf(stderr,"appl_init()\r\n");
    own_appl_init();
    fprintf(stderr,"/appl_init()\r\n");
    
    if(open_physical_ws)
    {
      printf("No other AES found. Opening own Workstation.\r\n");
      work_in[0] = 5;
      v_opnwk(work_in,&global_common.vid,work_out);
      
      if(global_common.video == 0x00030000L)
      {
        VsetScreen(NULL, NULL, global_common.vmode, global_common.vmodecode);
      }
      else
      {
        VsetScreen((void*)-1, (void *)-1, global_common.vmode, global_common.vmodecode);
      }
    }
    else
    {
      printf("Other AES detected.\r\n");
      global_common.vid = own_graf_handle();
      v_clrwk(global_common.vid);
    }
#endif
    
    global_common.physical_vdi_id = physical_vdi_id;
    DEBUG2 ("lib_global.c: init_global: calling vq_extnd");
    vq_extnd (physical_vdi_id, 0, work_out);
    
    
    global_common.screen.x = 0;
    global_common.screen.y = 0;
    global_common.screen.width = work_out[0] + 1;
    global_common.screen.height = work_out[1] + 1;
    
    global_common.num_pens = work_out[13];
    
    vq_extnd (physical_vdi_id, 1, work_out);
    global_common.num_planes = work_out[4];
    
    /* setup systemfont information */
    
    if(global_common.screen.height >= 400)
    {
      global_common.fnt_regul_id = 1;
      global_common.fnt_regul_sz = 13;
    }
    else
    {
      global_common.fnt_regul_id = 1;
      global_common.fnt_regul_sz = 9;
    }
    
    global_common.fnt_small_id = global_common.fnt_regul_id;
    global_common.fnt_small_sz = global_common.fnt_regul_sz / 2;
    
    vst_font (physical_vdi_id, global_common.fnt_regul_id);
    vst_point (physical_vdi_id,
               global_common.fnt_regul_sz,
               &dum,
               &dum,
               &dum,
               &dum);
    
    global_common.arrowrepeat = 100;
    
    DEBUG2 ("lib_global.c: init_global: calling vqt_attributes");
    vqt_attributes (physical_vdi_id, work_out);
    
    global_common.blwidth = work_out[8] + 3;
    global_common.blheight = work_out[9] + 3;
    global_common.clwidth = work_out[8];
    global_common.clheight = work_out[9];
    
    global_common.bswidth = work_out[8] / 2 + 3;
    global_common.bsheight = work_out[9] / 2 + 3;
    global_common.cswidth = work_out[8] / 2;
    global_common.csheight = work_out[9] / 2;
    
    global_common.time = 0L;
    
#ifndef MINT_TARGET
    global_common.callback_handler = oaesis_callback;
#endif
    
    DEBUG2("lib_global.c: init_global: Calling Rsrc_do_rcfix");
    Rsrc_do_rcfix (physical_vdi_id,
                   (RSHDR *)resource,
                   FALSE
                   ,
                   TRUE
                   );
    DEBUG2("lib_global.c: init_global: Called Rsrc_do_rcfix");
    
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  AICONS,
                  &global_common.aiconstad,
                  TRUE); 
    DEBUG3("init_global: 10");
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  ALERT,
                  &global_common.alerttad,
                  TRUE);
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  FISEL,
                  &global_common.fiseltad,
                  TRUE);

    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  PMENU,
                  &global_common.pmenutad,
                  TRUE);
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_FRSTR,
                  0,
                  (OBJECT **)&global_common.fr_string,
                  TRUE);
    
    /* Initialize window elements and resource counters */
    Rsrc_do_gaddr((RSHDR *)resource,
                  R_TREE,
                  WINDOW,
                  &global_common.windowtad,
                  TRUE);
    global_common.elemnumber = -1;
 
    DEBUG3("init_global: 11");
    /* Init mouseforms */
    Rsrc_do_rcfix (physical_vdi_id,
                   (RSHDR *)cursors,
                   FALSE
                   ,
                   TRUE
                   );
    DEBUG3("init_global: 12");
    Rsrc_do_gaddr((RSHDR *)cursors,
                  R_TREE,
                  MOUSEFORMS,
                  &global_common.mouseformstad,
                  TRUE);
    DEBUG3("init_global: 13");
    Graf_init_mouseforms();
    
    DEBUG3("init_global: 14");
#ifdef MINT_TARGET
    /* Initialize semaphore used by Shel_do_write */
    Psemaphore(SEM_CREATE, SHEL_WRITE_LOCK, 0);
    Psemaphore(SEM_UNLOCK, SHEL_WRITE_LOCK, 0);
#endif
  }
}