/******************************************************************************* G_LINE in popup menu *******************************************************************************/ int cdecl _drawNiceLine(PARMBLK *parm) { vqf_attributes(glb.vdi.ha,fattr); vql_attributes(glb.vdi.ha,lattr); my1.g_x=parm->pb_x; my1.g_y=parm->pb_y; my1.g_w=parm->pb_w; my1.g_h=parm->pb_h; my2.g_x=parm->pb_xc; my2.g_y=parm->pb_yc; my2.g_w=parm->pb_wc; my2.g_h=parm->pb_hc; _rcIntersect(&my1,&my2); tab_clip[0]=my2.g_x; tab_clip[1]=my2.g_y; tab_clip[2]=tab_clip[0]+my2.g_w-1; tab_clip[3]=tab_clip[1]+my2.g_h-1; vs_clip(glb.vdi.ha,TRUE,tab_clip); bar[0]=my1.g_x; bar[1]=my1.g_y; bar[2]=bar[0]+my1.g_w-1; bar[3]=bar[1]+my1.g_h-1; vswr_mode(glb.vdi.ha,MD_REPLACE); vsf_perimeter(glb.vdi.ha,FALSE); vsf_interior(glb.vdi.ha,FIS_SOLID); vsf_style(glb.vdi.ha,0); vsf_color(glb.vdi.ha,WHITE); v_bar(glb.vdi.ha,bar); vsl_type(glb.vdi.ha,USERLINE); vsl_width(glb.vdi.ha,1); vsl_udsty(glb.vdi.ha,(int)0x5555); x=parm->pb_x; y=parm->pb_y+parm->pb_h/2; bar[0]=x; bar[1]=y; bar[2]=x+parm->pb_w; bar[3]=y; v_pline(glb.vdi.ha,2,bar); bar[1]+=1; bar[3]+=1; vsl_udsty(glb.vdi.ha,(int)0xAAAA); v_pline(glb.vdi.ha,2,bar); vs_clip(glb.vdi.ha,FALSE,tab_clip); vsl_type(glb.vdi.ha,lattr[0]); vsl_color(glb.vdi.ha,lattr[1]); vsf_interior(glb.vdi.ha,fattr[2]); vsf_style(glb.vdi.ha,fattr[0]); vsf_perimeter(glb.vdi.ha,fattr[4]); return parm->pb_currstate&~DISABLED; }
void iw_xdraw(ICONWIND iw) { WORD xy[4], bxy[10]; wind_update(BEG_UPDATE); graf_mouse(M_OFF, NULL); rc_getpts(&iw->w.rwind, xy); vs_clip(iw->w.wsid, 1, xy); vswr_mode(iw->w.wsid, MD_XOR); vsl_color(iw->w.wsid, BLACK); vsl_ends(iw->w.wsid, 0, 0); vsl_type(iw->w.wsid, 1); vsl_width(iw->w.wsid, 1); rc_boxpts(&iw->w.rwind, bxy); bxy[9]--; v_pline(iw->w.wsid, 5, bxy); vsf_color(iw->w.wsid, BLACK); vsf_interior(iw->w.wsid, FIS_SOLID); vsf_perimeter(iw->w.wsid, 0); xy[0]++, xy[2]--; xy[3] = xy[1]++ + 7; v_bar(iw->w.wsid, xy); graf_mouse(M_ON, NULL); wind_update(END_UPDATE); }
/* * Draw the color boxes */ void draw_boxes(void) { GRECT obrect; int obj, objcol; int lastbox; wind_update(TRUE); HIDE_MOUSE; if (numcol < MAX_COL_SHOWN) /* init last box to be drawn */ lastbox = headbox + numcol - 1; else lastbox = headbox + MAX_COL_SHOWN - 1; vsf_interior(vhandle, SOLID); /* fill with SOLID pattern */ for (obj = headbox, objcol = headcol; obj <= lastbox; obj++, objcol++) { vsf_color(vhandle, objcol); /* fill with color of obj */ obrect = ObRect(obj); objc_offset(tree, obj, &obrect.g_x, &obrect.g_y); pxyarray[0] = obrect.g_x; pxyarray[1] = obrect.g_y; pxyarray[2] = obrect.g_x + obrect.g_w - 1; pxyarray[3] = obrect.g_y + obrect.g_h - 1; v_bar(vhandle, pxyarray); } SHOW_MOUSE; wind_update(FALSE); }
int cdecl draw_currentcolor(PARMBLK *parmblock) { WEXTENSION_PAL *wext = (WEXTENSION_PAL *) parmblock->pb_parm ; int xyc[4], xy[4] ; if (parmblock->pb_prevstate != parmblock->pb_currstate) return(0) ; xyc[0] = parmblock->pb_xc ; xyc[1] = parmblock->pb_yc ; xyc[2] = xyc[0]+parmblock->pb_wc ; xyc[3] = xyc[1]+parmblock->pb_hc ; vs_clip(handle, 1, xyc); vswr_mode(handle, MD_REPLACE) ; vsf_interior(handle, FIS_SOLID) ; vsf_style(handle, 7) ; vsf_perimeter(handle, 1) ; vsf_color(handle, wext->index) ; xy[0] = parmblock->pb_x ; xy[1] = parmblock->pb_y ; xy[2] = parmblock->pb_x+parmblock->pb_w-1 ; xy[3] = parmblock->pb_y+parmblock->pb_h-1 ; v_hide_c(handle) ; v_bar(handle, xy) ; v_show_c(handle, 1) ; vs_clip(handle, 0, xyc) ; return(0) ; }
short draw_multiline(PARMBLK *parmblock) { GRECT clip_area; short sizing = 4; //Set up clipping OUTPUT_WINDOW *window = (OUTPUT_WINDOW*)parmblock->pb_parm; short handle = window->workstation; char buffer[255]; short last_index = 0; short draw_region[4] = { parmblock->pb_x, parmblock->pb_y, parmblock->pb_x + parmblock->pb_w, parmblock->pb_y + parmblock->pb_h }; short clip_region[4] = { parmblock->pb_xc, parmblock->pb_yc, parmblock->pb_xc + parmblock->pb_wc, parmblock->pb_yc + parmblock->pb_hc }; vs_clip(handle, 1, clip_region); vsf_interior(handle, 1); //vsf_color(handle, 6); //vr_recfl(handle, draw_region); // clear entire message area vsl_color(handle, 1); vst_height(handle, sizing, &sizing, &sizing, &sizing, &sizing); short position = 6; while (tokenize_multiline(buffer, window->text, parmblock->pb_w, sizing, &last_index)) { v_gtext(handle, parmblock->pb_x, parmblock->pb_y + position, buffer); position += sizing; } vs_clip(handle, 0, clip_region); return 0; }
global void f_interior(int m) { static int mode = -1; if (m ne mode) vsf_interior(C.vh, mode = m); }
void display_status(int status) { int x_align, y_align ; int xy[8] ; char txt[50] ; switch (status ) { case STATUS_LOADING : strcpy( txt, "Loading..." ) ; break ; case STATUS_SCALING : strcpy( txt, "Scaling..." ) ; break ; case STATUS_WAITING : strcpy( txt, "Waiting..." ) ; break ; default : strcpy( txt, " " ) ; } vsf_color( handle, back_color ) ; vsf_interior( handle, FIS_SOLID ) ; vqt_extent( handle, txt, xy ) ; xy[2] = xy[4] ; xy[3] = xy[5] ; yprog = xy[3] + ttype.hcar ; v_hide_c(handle) ; vr_recfl( handle, xy ) ; v_show_c(handle, 1) ; vst_alignment( handle, 0, 1, &x_align, &y_align ) ; aff_text( txt, 0, ttype.hcar, txt_color ) ; vst_alignment( handle, x_align, y_align, &x_align, &y_align ) ; }
static int disc(GEM_PLOTTER self,int x, int y, int radius, const plot_style_t * pstyle) { plotter_vdi_clip( self, 1); if( pstyle->fill_type != PLOT_OP_TYPE_SOLID) { vsf_rgbcolor( self->vdi_handle, pstyle->stroke_colour ); vsf_perimeter( self->vdi_handle, 1); vsf_interior( self->vdi_handle, 0 ); v_circle( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius ); } else { vsf_rgbcolor( self->vdi_handle, pstyle->fill_colour ); vsf_perimeter( self->vdi_handle, 0); vsf_interior( self->vdi_handle, FIS_SOLID ); v_circle( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius ); } plotter_vdi_clip( self, 0); return ( 1 ); }
/* Similar to clear() above but clears with pattern and colour */ void pclear(RECT *r) { int pxy[4]; vsf_color(vdi_handle, options.V2_2.win_color); if ( options.V2_2.win_pattern != 0 ) { vsf_interior(vdi_handle, FIS_PATTERN); vsf_style(vdi_handle, options.V2_2.win_pattern); } else vsf_interior(vdi_handle, FIS_SOLID); /* maybe a little faster so? */ vsf_perimeter(vdi_handle, 0); vswr_mode(vdi_handle, MD_REPLACE); xd_rect2pxy(r, pxy); v_bar(vdi_handle, pxy); }
void clear(RECT *r) /* HR 021202: use v_bar for a white rectangle (for true colour) */ { int pxy[4]; vsf_color(vdi_handle, WHITE); vsf_interior(vdi_handle, FIS_SOLID); vsf_perimeter(vdi_handle, 0); vswr_mode(vdi_handle, MD_REPLACE); xd_rect2pxy(r, pxy); v_bar(vdi_handle, pxy); }
/* Clear given area of screen */ void clear_area (int app_handle, int x, int y, int w, int h) { int pxy[4]; vsf_interior (app_handle, SOLID); vsf_color (app_handle, WHITE); pxy[0] = x; pxy[1] = y; pxy[2] = x + w - 1; pxy[3] = y + h - 1; vr_recfl (app_handle, pxy); }
void redraw( const WINFO *w, GRECT *clip ) { OBJECT *tree; int savex, savey; GRECT rect; int pxy[4]; rect = w->work; wind_adjust( w, &rect ); rc_2xy( clip, (WORD *)pxy ); vs_clip( vhandle, 1, pxy ); graf_mouse( M_OFF, NULL ); #if SILLY_PATTERN vsf_interior( vhandle, FIS_PATTERN ); vsf_style( vhandle, 19 ); /* balls */ vsf_color( vhandle, BLACK ); #else vsf_interior( vhandle, FIS_SOLID ); vsf_color( vhandle, WHITE ); #endif vsf_perimeter( vhandle, FALSE ); vswr_mode( vhandle, MD_REPLACE ); v_bar( vhandle, pxy ); graf_mouse( M_ON, NULL ); tree = (OBJECT *)(w->x); savex = ObX(ROOT); savey = ObY(ROOT); ObX(ROOT) = rect.g_x - w->vir.g_x * gl_wchar; ObY(ROOT) = rect.g_y - w->vir.g_y * gl_hchar; Objc_draw( tree, ROOT, MAX_DEPTH, clip ); ObX(ROOT) = savex; ObY(ROOT) = savey; }
static void GEM_ClearRect(_THIS, short *rect) { short oldrgb[3], rgb[3]={0,0,0}; vq_color(VDI_handle, vdi_index[0], 0, oldrgb); vs_color(VDI_handle, vdi_index[0], rgb); vsf_color(VDI_handle,0); vsf_interior(VDI_handle,1); vsf_perimeter(VDI_handle,0); v_bar(VDI_handle, rect); vs_color(VDI_handle, vdi_index[0], oldrgb); }
static int cdecl draw_aquaback(PARMBLK *p) { int16 pxy[8]; int16 x0; int16 y0; set_clipping(vdi_handle, p->pb_xc, p->pb_yc, p->pb_wc, p->pb_hc, TRUE); vswr_mode(vdi_handle, MD_REPLACE); pxy[0] = x0 = p->pb_x; pxy[1] = y0 = p->pb_y; pxy[2] = p->pb_x + p->pb_w -1 ; pxy[3] = p->pb_y + p->pb_h - 1; vsf_interior(vdi_handle, FIS_PATTERN); /* FIS_PATTERN */ vsf_color(vdi_handle, LWHITE ); vsf_style(vdi_handle, 4); v_bar(vdi_handle, pxy); pxy[3] = pxy[1]; /* while( (pxy[1]-y0) < (p->pb_h) ) { vsl_color(vdi_handle, WHITE); v_pline(vdi_handle, 2, pxy); pxy[1]+=2; pxy[3]+=2; } */ while( (pxy[1]-y0+2) < (p->pb_h) ) { vsl_color(vdi_handle, LWHITE); v_pline(vdi_handle, 2, pxy); pxy[1]+=2; pxy[3]+=2; vsl_color(vdi_handle, WHITE); v_pline(vdi_handle, 2, pxy); pxy[1]+=2; pxy[3]+=2; } if( (pxy[1]-y0) < (p->pb_h) ) { vsl_color(vdi_handle, LWHITE); v_pline(vdi_handle, 2, pxy); } return (p->pb_currstate); }
int cdecl draw_pencil(PARMBLK *parmblk) { WEXTENSION_PENCIL *wext = (WEXTENSION_PENCIL *) parmblk->pb_parm ; int xy[8] ; int xc, yc ; xy[0] = parmblk->pb_x ; xy[1] = parmblk->pb_y ; xy[2] = parmblk->pb_x+parmblk->pb_w-1 ; xy[3] = parmblk->pb_y+parmblk->pb_h-1 ; vs_clip(handle, 1, xy) ; xc = (xy[0]+xy[2])/2 ; yc = (xy[1]+xy[3])/2 ; vswr_mode(handle, MD_REPLACE) ; vsf_interior(handle, FIS_SOLID) ; vsf_color(handle, 0) ; vr_recfl(handle, xy) ; vsf_color(handle, wext->pencil.color) ; switch( wext->pencil.type ) { case 0 : xy[0] = xc-wext->pencil.height/2 ; xy[1] = yc-wext->pencil.height/2 ; xy[2] = xc+wext->pencil.height/2 ; xy[3] = yc+wext->pencil.height/2 ; vr_recfl(handle, xy) ; break ; case 1 : v_circle(handle, xc, yc, wext->pencil.height/2) ; break ; case 2 : xy[0] = xc ; xy[1] = yc-wext->pencil.height/2 ; xy[2] = xc+wext->pencil.height/2 ; xy[3] = yc ; xy[4] = xc ; xy[5] = yc+wext->pencil.height/2 ; xy[6] = xc-wext->pencil.height/2 ; xy[7] = yc ; v_fillarea(handle, 4, xy) ; break ; } vs_clip(handle, 0, xy) ; return(0) ; }
int cdecl draw_colors(PARMBLK *parmblock) { WEXTENSION_PAL *wext = (WEXTENSION_PAL *) parmblock->pb_parm ; int xyc[4], xy[4] ; int nb_col_y, col_y, col_x, ind_col ; nb_col_y = wext->nb_col_x = (int)sqrt((double)nb_colors) ; wext->ww = (int)(parmblock->pb_w/wext->nb_col_x) ; wext->hh = (int)(parmblock->pb_h/nb_col_y) ; if (parmblock->pb_prevstate != parmblock->pb_currstate) return(0) ; xyc[0] = parmblock->pb_xc ; xyc[1] = parmblock->pb_yc ; xyc[2] = xyc[0]+parmblock->pb_wc ; xyc[3] = xyc[1]+parmblock->pb_hc ; vs_clip(handle, 1, xyc) ; vswr_mode(handle, MD_REPLACE) ; vsf_interior(handle, FIS_SOLID) ; vsf_style(handle, 7) ; vsf_perimeter(handle, 1) ; xy[1] = parmblock->pb_y ; xy[3] = xy[1]+wext->hh ; for (col_y = 0, ind_col = 0; col_y < nb_col_y; col_y++) { xy[0] = parmblock->pb_x ; xy[2] = xy[0]+wext->ww ; for (col_x = 0; col_x < wext->nb_col_x; col_x++, ind_col++) { vsf_color(handle, ind_col) ; v_bar(handle, xy) ; xy[0] += wext->ww ; xy[2] += wext->ww ; } xy[1] += wext->hh ; xy[3] += wext->hh ; } vs_clip(handle, 0, xyc); return(0) ; }
void sldcls_screen( VSS_INFO *vss_info, INFO_IMAGE *inf ) { int xyarray[4] ; compute_colors( vss_info, inf ) ; if ( !vss_info->do_not_cls_scr ) { xyarray[0] = 0 ; xyarray[1] = 0 ; xyarray[2] = Xmax ; xyarray[3] = Ymax ; vsf_color( handle, back_color ) ; vsf_interior( handle, FIS_SOLID ) ; if ( !vss_info->do_not_show_mouse ) v_hide_c(handle) ; vr_recfl(handle, xyarray) ; if ( !vss_info->do_not_show_mouse ) v_show_c(handle, 1) ; } }
void OnDrawRTZoom(void *wnd, int xycoords[4]) { int xy[8] ; int index ; int must_fill = ( rtoffx > 0 ) || ( rtoffy > 0 ) ; if ( must_fill ) { if ( !Truecolor ) index = 0 ; else { int rgb[3] = { 1000, 1000, 1000 } ; index = 19 ; vs_color( handle, index, rgb ) ; } vswr_mode( handle, MD_REPLACE ) ; vsf_color( handle, index ) ; vsf_interior( handle, FIS_SOLID ) ; vsf_perimeter( handle, 0 ) ; } if ( intersect( rtx + rtoffx, rty + rtoffy, rtw - rtoffx, rth - rtoffy, xycoords[0], xycoords[1], xycoords[2], xycoords[3], &xy[4] ) ) { xy[0] = smart_offx + xy[4] - rtx - rtoffx ; xy[1] = xy[5] - rty - rtoffy ; xy[2] = smart_offx + xy[6] - rtx - rtoffx ; xy[3] = xy[7] - rty - rtoffy ; vro_cpyfm( handle, S_ONLY, xy, &RTZoomDst, &screen ) ; if ( must_fill ) { if ( intersect( rtx, rty, rtoffx, rth, xycoords[0], xycoords[1], xycoords[2], xycoords[3], xy ) ) vr_recfl( handle, xy ) ; if ( intersect( rtx, rty, rtw, rtoffy, xycoords[0], xycoords[1], xycoords[2], xycoords[3], xy ) ) vr_recfl( handle, xy ) ; } } }
static int arc(GEM_PLOTTER self,int x, int y, int radius, int angle1, int angle2, const plot_style_t * pstyle) { //plotter_vdi_clip( self, 1); vswr_mode( self->vdi_handle, MD_REPLACE ); if( pstyle->fill_type == PLOT_OP_TYPE_NONE ) return 1; if( pstyle->fill_type != PLOT_OP_TYPE_SOLID) { vsl_rgbcolor( self->vdi_handle, pstyle->stroke_colour); vsf_perimeter( self->vdi_handle, 1); vsf_interior( self->vdi_handle, 1 ); v_arc( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius, angle1*10, angle2*10 ); } else { vsf_rgbcolor( self->vdi_handle, pstyle->fill_colour); vsl_width( self->vdi_handle, 1 ); vsf_perimeter( self->vdi_handle, 1); v_arc( self->vdi_handle, VIEW(self).x + x, VIEW(self).y + y, radius, angle1*10, angle2*10 ); } //plotter_vdi_clip( self, 0); return ( 1 ); }
LOCAL VOID bb_fill(WORD mode, WORD fis, WORD patt, WORD hx, WORD hy, WORD hw, WORD hh) { gsx_fix(&gl_dst, 0x0L, 0, 0); ptsin[0] = hx; ptsin[1] = hy; ptsin[2] = hx + hw - 1; ptsin[3] = hy + hh - 1; gsx_attr(TRUE, mode, gl_tcolor); if (fis != gl_fis) { vsf_interior(gl_handle, fis); gl_fis = fis; } if (patt != gl_patt) { vsf_style( gl_handle, patt ); gl_patt = patt; } vr_recfl(gl_handle, &ptsin[0]); }
main() { gem_init(); whandle = wind_create (4095, 20, 20, 280, 150); /* 4095 = tous les organes de commande */ if (whandle < 0) form_alert (1, "[3][D‚sol‚!|Il ne reste plus de handle fenˆtre libre!][OK]" ); else { wind_open (whandle, 20, 20, 280, 150); /* Calcul de la zone de travail */ wind_calc (1, 4095, 20, 20, 280, 150, &x, &y, &w, &h); /* Conversion de hauteur/largeur du deuxiŠme angle (x2/y2) */ pxyarray[0] = x; pxyarray[1] = y; pxyarray[2] = x+w-1; pxyarray[3] = y+h-1; /* Effacer la zone de travail */ vsf_interior (handle, 0); /* Remplir avec couleur du fond */ vsf_perimeter (handle, 0); /* Pas de cadre */ v_bar (handle, pxyarray); vsf_perimeter (handle, 1); /* R‚activer le cadre */ Crawcin(); /* Attendre appui touche */ wind_close (whandle); wind_delete (whandle); } gem_exit(); }
static void GEM_ClearScreen(_THIS) { short rgb[3]= {0,0,0}; short oldrgb[3]; short pxy[4]; v_hide_c(VDI_handle); vq_color(VDI_handle, vdi_index[0], 0, oldrgb); vs_color(VDI_handle, vdi_index[0], rgb); pxy[0] = pxy[1] = 0; pxy[2] = VDI_w - 1; pxy[3] = VDI_h - 1; vsf_color(VDI_handle,0); vsf_interior(VDI_handle,1); vsf_perimeter(VDI_handle,0); v_bar(VDI_handle,pxy); vs_color(VDI_handle, vdi_index[0], oldrgb); v_show_c(VDI_handle, 1); }
/* * draw the polynomial into the editfield * Note: User VDI must be initialized! */ WORD cdecl draw_polynomial(PARMBLK *pb) { int i,j, field_w, field_h, *polyfactors; double x, y; int xo,yo; OBJECT *tree; int clipper[4], box[4], zero[4]; if (userhandle<=0) return(NORMAL); /* NO VDI!!! */ tree = rs_trindex[POLY_ED]; /* check: draw only if current state = old state */ if (pb->pb_prevstate!=pb->pb_currstate) return (pb->pb_currstate & ~SELECTED); field_w = ObW(P_EDITFIELD); field_h = ObH(P_EDITFIELD); polyfactors = *(int**)pb->pb_parm; box[0] = pb->pb_x-1; box[1] = pb->pb_y-1; box[2] = pb->pb_x+pb->pb_w; box[3] = pb->pb_y+pb->pb_h; /* get pixel offsets */ xo = box[0]; yo = box[1]+ObY(P_ZEROLINE)+ObH(P_ZEROLINE); /* Set Clip: */ clipper[0] = MAX(box[0], pb->pb_xc); clipper[1] = MAX(box[1], pb->pb_yc); clipper[2] = MIN(box[2], pb->pb_xc+pb->pb_wc-1); clipper[3] = MIN(box[3], pb->pb_yc+pb->pb_hc-1); vs_clip(userhandle, 1, clipper); /* draw box */ vsf_perimeter(userhandle, 1); /* visible fill perimeter */ vsf_color(userhandle, BLACK); vsf_interior(userhandle, FIS_HOLLOW); v_bar(userhandle, (int *)box); /* fill rectangle */ /* draw zeroline */ zero[0]=xo; zero[1]=yo; zero[2]=xo+field_w; zero[3]=yo; vsl_type(userhandle, 3); vsl_color(userhandle, BLUE); v_pline(userhandle, 2, (int*)zero); /* calc polyarray */ for (i=0; i<=POLYPOINTS; i++) { x = (XSCALE*(double)i)/(double)POLYPOINTS; for (j=0, y=0.0; j<4; j++) y=x*y+polyfactors[j]; y=y*x/256.0; polyarray[i][0] = xo + ((double)field_w*i)/(double)POLYPOINTS; polyarray[i][1] = yo - ((double)field_h*y)/YSCALE; if (polyarray[i][1]<0) polyarray[i][1]=0; }; /* draw curve */ vsl_type(userhandle, 1); vsl_color(userhandle, RED); v_pline(userhandle, POLYPOINTS, (int *)&polyarray[0]); return (pb->pb_currstate & ~SELECTED); }
/******************************************************************************* PopUp G_BUTTON *******************************************************************************/ int cdecl _drawPopUp(PARMBLK *parm) { pb.pb_tree = glb.rsc.head.trindex[FUSER]; pb.pb_obj = FUSDPOP+glb.vdi.low; pb.pb_prevstate = pb.pb_tree[pb.pb_obj].ob_state; pb.pb_currstate = parm->pb_tree[parm->pb_obj].ob_state; pb.pb_w = pb.pb_tree[pb.pb_obj].ob_width; pb.pb_h = pb.pb_tree[pb.pb_obj].ob_height; pb.pb_x = parm->pb_x+parm->pb_w-pb.pb_w; pb.pb_y = parm->pb_y+(parm->pb_h-pb.pb_h)/2; pb.pb_xc = parm->pb_xc; pb.pb_yc = parm->pb_yc; pb.pb_wc = parm->pb_wc; pb.pb_hc = parm->pb_hc; pb.pb_parm = pb.pb_tree[pb.pb_obj].ob_spec.userblk->ub_parm; vqt_attributes(glb.vdi.ha,tattr); vqf_attributes(glb.vdi.ha,fattr); flags=parm->pb_tree[parm->pb_obj].ob_flags; state=parm->pb_tree[parm->pb_obj].ob_state; vsl_color(glb.vdi.ha,BLACK); vst_effects(glb.vdi.ha,TXT_NORMAL); vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy); user=(UBLK *)(parm->pb_parm); vst_point(glb.vdi.ha,10-glb.vdi.low,&dummy,&htext,&dummy,&dummy); my1.g_x=parm->pb_x-3; my1.g_y=parm->pb_y-3; my1.g_w=parm->pb_w+6; my1.g_h=parm->pb_h+6; my2.g_x=parm->pb_xc; my2.g_y=parm->pb_yc; my2.g_w=parm->pb_wc; my2.g_h=parm->pb_hc; _rcIntersect(&my1,&my2); tab_clip[0]=my2.g_x; tab_clip[1]=my2.g_y; tab_clip[2]=tab_clip[0]+my2.g_w-1; tab_clip[3]=tab_clip[1]+my2.g_h-1; vs_clip(glb.vdi.ha,TRUE,tab_clip); pxy[0]=parm->pb_x-1; pxy[1]=parm->pb_y-1; pxy[2]=parm->pb_x+parm->pb_w; pxy[3]=pxy[1]; pxy[4]=pxy[2]; pxy[5]=parm->pb_y+parm->pb_h; pxy[6]=pxy[0]; pxy[7]=pxy[5]; pxy[8]=pxy[0]; pxy[9]=pxy[1]; v_pline(glb.vdi.ha,5,pxy); pxy[0]=parm->pb_x+parm->pb_w+1; pxy[1]=parm->pb_y; pxy[2]=pxy[0]; pxy[3]=parm->pb_y+parm->pb_h+1; pxy[4]=parm->pb_x; pxy[5]=pxy[3]; v_pline(glb.vdi.ha,3,pxy); pxy[0]=parm->pb_x+parm->pb_w+2; pxy[1]=parm->pb_y; pxy[2]=pxy[0]; pxy[3]=parm->pb_y+parm->pb_h+2; pxy[4]=parm->pb_x; pxy[5]=pxy[3]; v_pline(glb.vdi.ha,3,pxy); bar[0]=my1.g_x; bar[1]=my1.g_y; bar[2]=bar[0]+my1.g_w-1; bar[3]=bar[1]+my1.g_h-1; vswr_mode(glb.vdi.ha,MD_REPLACE); vsf_perimeter(glb.vdi.ha,FALSE); vsf_interior(glb.vdi.ha,FIS_SOLID); vsf_style(glb.vdi.ha,0); if (flags&FL3DACT) backcol=LWHITE; else backcol=WHITE; textcol=BLACK; if (backcol==LWHITE && glb.vdi.extnd[4]<4) backcol=WHITE; bar[0]=parm->pb_x; bar[1]=parm->pb_y; bar[2]=bar[0]+parm->pb_w-1; bar[3]=bar[1]+parm->pb_h-1; vsf_color(glb.vdi.ha,backcol); /**************************************************************************** Fond Blanc/Gris suivant r‚solution et 3D ****************************************************************************/ v_bar(glb.vdi.ha,bar); vst_color(glb.vdi.ha,textcol); vs_clip(glb.vdi.ha,FALSE,tab_clip); my1.g_x=parm->pb_x; my1.g_y=parm->pb_y; my1.g_w=parm->pb_w; my1.g_h=parm->pb_h; my2.g_x=parm->pb_xc; my2.g_y=parm->pb_yc; my2.g_w=parm->pb_wc; my2.g_h=parm->pb_hc; _rcIntersect(&my1,&my2); tab_clip[0]=my2.g_x; tab_clip[1]=my2.g_y; tab_clip[2]=tab_clip[0]+my2.g_w-1; tab_clip[3]=tab_clip[1]+my2.g_h-1; vs_clip(glb.vdi.ha,TRUE,tab_clip); vswr_mode(glb.vdi.ha,MD_TRANS); p=(char *)user->spec; while (*p==32) p++; vqt_extent(glb.vdi.ha,p,extent); x=parm->pb_x+pb.pb_w/2; y=parm->pb_y; y+=parm->pb_h/2; y-=(extent[7]-extent[1])/2; y+=htext; /**************************************************************************** Si bouton 3D alors on d‚cale le texte ****************************************************************************/ if (flags&FL3DIND && flags&FL3DACT && state&SELECTED) { x+=1; y+=1; } v_gtext(glb.vdi.ha,x,y,p); vs_clip(glb.vdi.ha,FALSE,tab_clip); vst_effects(glb.vdi.ha,TXT_NORMAL); vst_alignment (glb.vdi.ha,tattr[3],tattr[4],&dummy,&dummy); vsf_interior(glb.vdi.ha,fattr[2]); vsf_style(glb.vdi.ha,fattr[0]); vsf_perimeter(glb.vdi.ha,fattr[4]); _drawCicon(&pb); /**************************************************************************** Si le bouton est en relief alors il faut demander … l'AES de dessiner l'attribut SELECTED pour qu'il inverse le cadre fin gris/noir. Par contre si le bouton n'est pas en relief, il ne faut surtout pas demander … l'AES de dessiner cet attribut sinon; lorsque l'objet est s‚lectionn‚ (donc noir), l'AES le recouvre en blanc !! ****************************************************************************/ if (flags&FL3DIND && flags&FL3DACT || flags&FL3DIND) return parm->pb_currstate; else return parm->pb_currstate&~SELECTED; }
/******************************************************************************* G_BUTTON *******************************************************************************/ int cdecl _drawButton(PARMBLK *parm) { vqt_attributes(glb.vdi.ha,tattr); vqf_attributes(glb.vdi.ha,fattr); flags=parm->pb_tree[parm->pb_obj].ob_flags; state=parm->pb_tree[parm->pb_obj].ob_state; vst_effects(glb.vdi.ha,TXT_NORMAL); vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy); user=(UBLK *)(parm->pb_parm); vst_point(glb.vdi.ha,10-glb.vdi.low,&dummy,&htext,&dummy,&dummy); tour=1; if (flags & EXIT) tour+=1; if (flags & DEFAULT) tour+=1; my1.g_x=parm->pb_x-tour; my1.g_y=parm->pb_y-tour; my1.g_w=parm->pb_w+2*tour; my1.g_h=parm->pb_h+2*tour; my2.g_x=parm->pb_xc; my2.g_y=parm->pb_yc; my2.g_w=parm->pb_wc; my2.g_h=parm->pb_hc; _rcIntersect(&my1,&my2); tab_clip[0]=my2.g_x; tab_clip[1]=my2.g_y; tab_clip[2]=tab_clip[0]+my2.g_w-1; tab_clip[3]=tab_clip[1]+my2.g_h-1; vs_clip(glb.vdi.ha,TRUE,tab_clip); bar[0]=my1.g_x; bar[1]=my1.g_y; bar[2]=bar[0]+my1.g_w-1; bar[3]=bar[1]+my1.g_h-1; vswr_mode(glb.vdi.ha,MD_REPLACE); vsf_perimeter(glb.vdi.ha,FALSE); vsf_interior(glb.vdi.ha,FIS_SOLID); vsf_style(glb.vdi.ha,0); vsf_color(glb.vdi.ha,BLACK); /**************************************************************************** Cadre Noir (attributs EXIT/DEFAUT/SELECTABLE) ****************************************************************************/ v_bar(glb.vdi.ha,bar); if (flags&FL3DIND && flags&FL3DACT) { backcol=LWHITE; textcol=BLACK; } else if (flags&FL3DIND) { if (state&SELECTED) { backcol=LBLACK; textcol=WHITE; } else { backcol=LWHITE; textcol=BLACK; } } else { if (state&SELECTED) { backcol=BLACK; textcol=WHITE; } else { backcol=WHITE; textcol=BLACK; } } if (backcol==LWHITE && glb.vdi.extnd[4]<4) backcol=WHITE; if (backcol!=BLACK) { bar[0]=parm->pb_x; bar[1]=parm->pb_y; bar[2]=bar[0]+parm->pb_w-1; bar[3]=bar[1]+parm->pb_h-1; vsf_color(glb.vdi.ha,backcol); /************************************************************************* Cadre Int‚rieur Blanc/Noir/Gris suivant s‚lection *************************************************************************/ v_bar(glb.vdi.ha,bar); } vst_color(glb.vdi.ha,textcol); vs_clip(glb.vdi.ha,FALSE,tab_clip); my1.g_x=parm->pb_x; my1.g_y=parm->pb_y; my1.g_w=parm->pb_w; my1.g_h=parm->pb_h; my2.g_x=parm->pb_xc; my2.g_y=parm->pb_yc; my2.g_w=parm->pb_wc; my2.g_h=parm->pb_hc; _rcIntersect(&my1,&my2); tab_clip[0]=my2.g_x; tab_clip[1]=my2.g_y; tab_clip[2]=tab_clip[0]+my2.g_w-1; tab_clip[3]=tab_clip[1]+my2.g_h-1; vs_clip(glb.vdi.ha,TRUE,tab_clip); vswr_mode(glb.vdi.ha,MD_TRANS); tLarg=0; trait=(uchar *)strchr((char *)user->spec,'['); if (trait!=NULL) { if (trait!=(uchar *)user->spec) { *trait=0; vst_effects(glb.vdi.ha,TXT_UNDERLINED); vqt_extent(glb.vdi.ha,(char *)user->spec,extent); vst_effects(glb.vdi.ha,TXT_NORMAL); *trait='['; tLarg=extent[2]-extent[6]; } trait++; } else trait=(uchar *)user->spec; vqt_extent(glb.vdi.ha,(char *)trait,extent); tLarg+=extent[2]-extent[6]; x=parm->pb_x; x+=(parm->pb_w-tLarg)/2; y=parm->pb_y; y+=parm->pb_h/2; y-=(extent[7]-extent[1])/2; y+=htext; /**************************************************************************** Si bouton 3D alors on d‚cale le texte ****************************************************************************/ if (flags&FL3DIND && flags&FL3DACT && state&SELECTED) { x+=1; y+=1; } trait=(uchar *)strchr((char *)user->spec,'['); if (trait!=NULL) { if (trait!=(uchar *)user->spec) { *trait=0; vqt_extent(glb.vdi.ha,(char *)user->spec,extent); v_gtext(glb.vdi.ha,x,y,(char *)user->spec); *trait='['; x+=extent[2]-extent[0]; } trait++; if (*trait!=0) { car[0]=*trait; car[1]=0; vst_effects(glb.vdi.ha,TXT_UNDERLINED); v_gtext(glb.vdi.ha,x,y,(char *)car); vqt_extent(glb.vdi.ha,(char *)car,extent); vst_effects(glb.vdi.ha,TXT_NORMAL); trait++; x+=extent[2]-extent[0]; } if (*trait!=0) v_gtext(glb.vdi.ha,x,y,(char *)trait); } else v_gtext(glb.vdi.ha,x,y,(char *)user->spec); vs_clip(glb.vdi.ha,FALSE,tab_clip); vst_effects(glb.vdi.ha,TXT_NORMAL); vst_alignment (glb.vdi.ha,tattr[3],tattr[4],&dummy,&dummy); vsf_interior(glb.vdi.ha,fattr[2]); vsf_style(glb.vdi.ha,fattr[0]); vsf_perimeter(glb.vdi.ha,fattr[4]); /**************************************************************************** Si le bouton est en relief alors il faut demander … l'AES de dessiner l'attribut SELECTED pour qu'il inverse le cadre fin gris/noir. Par contre si le bouton n'est pas en relief, il ne faut surtout pas demander … l'AES de dessiner cet attribut sinon; lorsque l'objet est s‚lectionn‚ (donc noir), l'AES le recouvre en blanc !! ****************************************************************************/ if (flags&FL3DIND && flags&FL3DACT || flags&FL3DIND) return parm->pb_currstate; else return parm->pb_currstate&~SELECTED; }
/******************************************************************************* Cross & Radio G_BUTTON *******************************************************************************/ int cdecl _drawCroixCarre(PARMBLK *parm) { pb.pb_tree = glb.rsc.head.trindex[FUSER]; if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_CROSS) pb.pb_obj = FUSDCAR+glb.vdi.low; else if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_ROUND) pb.pb_obj = FUSDCIR+glb.vdi.low; else pb.pb_obj = FUSDLAR+glb.vdi.low; pb.pb_prevstate = pb.pb_tree[pb.pb_obj].ob_state; if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_NUM) pb.pb_currstate= pb.pb_tree[pb.pb_obj].ob_state; else pb.pb_currstate= parm->pb_tree[parm->pb_obj].ob_state; pb.pb_w = pb.pb_tree[pb.pb_obj].ob_width; pb.pb_h = pb.pb_tree[pb.pb_obj].ob_height; pb.pb_x = parm->pb_x; pb.pb_y = parm->pb_y+(parm->pb_h-pb.pb_h)/2; pb.pb_xc = parm->pb_xc; pb.pb_yc = parm->pb_yc; pb.pb_wc = parm->pb_wc; pb.pb_hc = parm->pb_hc; pb.pb_parm = pb.pb_tree[pb.pb_obj].ob_spec.userblk->ub_parm; vqt_attributes(glb.vdi.ha,tattr); vqf_attributes(glb.vdi.ha,fattr); flags=parm->pb_tree[parm->pb_obj].ob_flags; state=parm->pb_tree[parm->pb_obj].ob_state; vst_effects(glb.vdi.ha,TXT_NORMAL); vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy); user=(UBLK *)(parm->pb_parm); vst_point(glb.vdi.ha,10-glb.vdi.low,&dummy,&htext,&dummy,&dummy); my1.g_x=parm->pb_x; my1.g_y=parm->pb_y; my1.g_w=parm->pb_w; my1.g_h=parm->pb_h; my2.g_x=parm->pb_xc; my2.g_y=parm->pb_yc; my2.g_w=parm->pb_wc; my2.g_h=parm->pb_hc; _rcIntersect(&my1,&my2); tab_clip[0]=my2.g_x; tab_clip[1]=my2.g_y; tab_clip[2]=tab_clip[0]+my2.g_w-1; tab_clip[3]=tab_clip[1]+my2.g_h-1; vs_clip(glb.vdi.ha,TRUE,tab_clip); bar[0]=my1.g_x; bar[1]=my1.g_y; bar[2]=bar[0]+my1.g_w-1; bar[3]=bar[1]+my1.g_h-1; vswr_mode(glb.vdi.ha,MD_REPLACE); vsf_perimeter(glb.vdi.ha,FALSE); vsf_interior(glb.vdi.ha,FIS_SOLID); vsf_style(glb.vdi.ha,0); if (flags&FL3DACT) backcol=LWHITE; else backcol=WHITE; textcol=BLACK; if (backcol==LWHITE && glb.vdi.extnd[4]<4) backcol=WHITE; bar[0]=parm->pb_x; bar[1]=parm->pb_y; bar[2]=bar[0]+parm->pb_w-1; bar[3]=bar[1]+parm->pb_h-1; vsf_color(glb.vdi.ha,backcol); /**************************************************************************** Fond Blanc/Gris suivant r‚solution et 3D ****************************************************************************/ v_bar(glb.vdi.ha,bar); vst_color(glb.vdi.ha,textcol); vs_clip(glb.vdi.ha,FALSE,tab_clip); my1.g_x=parm->pb_x; my1.g_y=parm->pb_y; my1.g_w=parm->pb_w; my1.g_h=parm->pb_h; my2.g_x=parm->pb_xc; my2.g_y=parm->pb_yc; my2.g_w=parm->pb_wc; my2.g_h=parm->pb_hc; _rcIntersect(&my1,&my2); tab_clip[0]=my2.g_x; tab_clip[1]=my2.g_y; tab_clip[2]=tab_clip[0]+my2.g_w-1; tab_clip[3]=tab_clip[1]+my2.g_h-1; vs_clip(glb.vdi.ha,TRUE,tab_clip); vswr_mode(glb.vdi.ha,MD_TRANS); tLarg=0; trait=(uchar *)strchr((char *)user->spec,'['); if (trait!=NULL) { if (trait!=(uchar *)user->spec) { *trait=0; vst_effects(glb.vdi.ha,TXT_UNDERLINED); vqt_extent(glb.vdi.ha,(char *)user->spec,extent); vst_effects(glb.vdi.ha,TXT_NORMAL); *trait='['; tLarg=extent[2]-extent[6]; } trait++; } else trait=(uchar *)user->spec; vqt_extent(glb.vdi.ha,(char *)trait,extent); tLarg+=extent[2]-extent[6]; if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_NUM) { vst_alignment(glb.vdi.ha,ALI_CENTER,ALI_BASE,&dummy,&dummy); x=parm->pb_x+parm->pb_w/2; } else { vst_alignment(glb.vdi.ha,ALI_LEFT,ALI_BASE,&dummy,&dummy); x=parm->pb_x+1.5*pb.pb_w; } y=parm->pb_y; y+=parm->pb_h/2; y-=(extent[7]-extent[1])/2; y+=htext; trait=(uchar *)strchr((char *)user->spec,'['); if (trait!=NULL) { if (trait!=(uchar *)user->spec) { *trait=0; vqt_extent(glb.vdi.ha,(char *)user->spec,extent); v_gtext(glb.vdi.ha,x,y,(char *)user->spec); *trait='['; x+=extent[2]-extent[0]; } trait++; if (*trait!=0) { car[0]=*trait; car[1]=0; vst_effects(glb.vdi.ha,TXT_UNDERLINED); v_gtext(glb.vdi.ha,x,y,(char *)car); vqt_extent(glb.vdi.ha,(char *)car,extent); vst_effects(glb.vdi.ha,TXT_NORMAL); trait++; x+=extent[2]-extent[0]; } if (*trait!=0) v_gtext(glb.vdi.ha,x,y,(char *)trait); } else v_gtext(glb.vdi.ha,x,y,(char *)user->spec); vs_clip(glb.vdi.ha,FALSE,tab_clip); vst_effects(glb.vdi.ha,TXT_NORMAL); vst_alignment (glb.vdi.ha,tattr[3],tattr[4],&dummy,&dummy); vsf_interior(glb.vdi.ha,fattr[2]); vsf_style(glb.vdi.ha,fattr[0]); vsf_perimeter(glb.vdi.ha,fattr[4]); _drawCicon(&pb); if (((parm->pb_tree[parm->pb_obj].ob_type)&0xFF00)==USD_NUM) { pb.pb_tree = glb.rsc.head.trindex[FUSER]; pb.pb_obj = FUSDRAR+glb.vdi.low; pb.pb_prevstate= pb.pb_tree[pb.pb_obj].ob_state; pb.pb_currstate= pb.pb_tree[pb.pb_obj].ob_state; pb.pb_w = pb.pb_tree[pb.pb_obj].ob_width; pb.pb_h = pb.pb_tree[pb.pb_obj].ob_height; pb.pb_x = parm->pb_x+parm->pb_w-pb.pb_w; pb.pb_y = parm->pb_y+(parm->pb_h-pb.pb_h)/2; pb.pb_xc = parm->pb_xc; pb.pb_yc = parm->pb_yc; pb.pb_wc = parm->pb_wc; pb.pb_hc = parm->pb_hc; pb.pb_parm = pb.pb_tree[pb.pb_obj].ob_spec.userblk->ub_parm; _drawCicon(&pb); } /**************************************************************************** Si le bouton est en relief alors il faut demander … l'AES de dessiner l'attribut SELECTED pour qu'il inverse le cadre fin gris/noir. Par contre si le bouton n'est pas en relief, il ne faut surtout pas demander … l'AES de dessiner cet attribut sinon; lorsque l'objet est s‚lectionn‚ (donc noir), l'AES le recouvre en blanc !! ****************************************************************************/ return parm->pb_currstate&~SELECTED; }
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); }
/**************************************************************** * * * ouvre la fenˆtre du tampon * * * ****************************************************************/ void ouvrir_tampon(void) { windowptr thewin = Tampon; WIN *win; GRECT rect; t_win_coord *window; int dummy; /* demande la taille de la fenˆtre */ window = get_info(1, Tampon, &rect); thewin -> fonction.secteur.couleur_curseur = window -> fonction.texte.curseur_c; thewin -> fonction.secteur.trame_curseur = window -> fonction.texte.curseur_t; thewin -> fonction.text.couleur_texte = window -> fonction.texte.texte_c; thewin -> fonction.text.taille_pt = window -> fonction.texte.texte_pt; thewin -> fonction.text.couleur_fond = window -> fonction.texte.background_c; thewin -> fonction.text.trame_fond = window -> fonction.texte.background_t; /* Create the information for the window. Max size is the desktop. */ win = open_window(thewin -> title, thewin -> title, NULL, NULL, window -> type, TRUE, 10, 10, &desk, &rect, NULL, secteurproc, NULL, 0); /* Check for error. */ if (win == NULL) { error_msg(Z_NO_MORE_WINDOW); return; } if (!open_work(&win -> vdi_handle, work_out)) { my_alert(1, FAIL, X_ICN_STOP, Messages(MAIN_9), NULL); close_window(win, FALSE); return; } thewin -> win = win; vst_point(win -> vdi_handle, thewin -> fonction.text.taille_pt, &dummy, &dummy, &thewin -> fonction.text.taille_w, &thewin -> fonction.text.taille_h); vst_color(win -> vdi_handle, thewin -> fonction.secteur.couleur_texte); vsf_interior(win -> vdi_handle, FIS_SOLID); vswr_mode(win -> vdi_handle, MD_REPLACE); vsf_perimeter(win -> vdi_handle, 0); /* Insert into windowlist. */ { register windowptr winptr = (windowptr)&Firstwindow; while(winptr -> next) { winptr = winptr -> next; winptr -> place++; } winptr -> next = thewin; } convert_sect(thewin -> fonction.secteur.secteurBin, thewin -> fonction.text.Ligne, thewin -> fonction.secteur.ascii); /* initialise les ascenseurs */ wind_set(win -> handle, WF_HSLSIZE, (int)(thewin -> win -> work.g_w *1000. / max_w), 0, 0, 0); wind_set(win -> handle, WF_VSLSIZE, 1000, 0, 0, 0); wind_set(win -> handle, WF_VSLIDE, 1000, 0, 0, 0); /* entr‚e dans le menu */ get_menu_entry(thewin, thewin -> title +1); make_frontwin(thewin); menu_ienable(Menu, OUVRIR_TAMPON, 0); ajoute(Firstwindow, Messages(TAMPON_13)); } /* ouvrir_tampon */
static void __CDECL evnt_sb_redraw( COMPONENT *c, long buff[8] ) { size_t i; struct gui_window * gw = (struct gui_window *)mt_CompDataSearch(&app, c, CDT_OWNER); assert(gw != NULL); CMP_STATUSBAR sb = gw->root->statusbar; assert( sb != NULL ); if( sb == NULL ) return; if( sb->attached == false ) return; LGRECT work, lclip; short pxy[8], d, pxyclip[4]; mt_CompGetLGrect(&app, sb->comp, WF_WORKXYWH, &work); lclip = work; if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) { return; } vsf_interior(atari_plot_vdi_handle, FIS_SOLID ); vsl_color(atari_plot_vdi_handle, BLACK ); vsl_type(atari_plot_vdi_handle, 1); vsl_width(atari_plot_vdi_handle, 1 ); vst_color(atari_plot_vdi_handle, BLACK); vst_height(atari_plot_vdi_handle, atari_sysinfo.medium_sfont_pxh, &pxy[0], &pxy[1], &pxy[2], &pxy[3] ); vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d ); vst_effects(atari_plot_vdi_handle, 0 ); pxyclip[0] = lclip.g_x; pxyclip[1] = lclip.g_y; pxyclip[2] = lclip.g_x + lclip.g_w-1; pxyclip[3] = lclip.g_y + lclip.g_h-1; vs_clip(atari_plot_vdi_handle, 1, (short*)&pxyclip ); vswr_mode(atari_plot_vdi_handle, MD_REPLACE ); if( lclip.g_y <= work.g_y ) { pxy[0] = work.g_x; pxy[1] = work.g_y; pxy[2] = MIN( work.g_x + work.g_w, lclip.g_x + lclip.g_w ); pxy[3] = work.g_y; v_pline(atari_plot_vdi_handle, 2, (short*)&pxy ); } if(app.nplanes > 2) { vsf_color(atari_plot_vdi_handle, LWHITE); } else { vsf_color(atari_plot_vdi_handle, WHITE ); } pxy[0] = work.g_x; pxy[1] = work.g_y+1; pxy[2] = work.g_x + work.g_w-1; pxy[3] = work.g_y + work.g_h-1; v_bar(atari_plot_vdi_handle, pxy ); if( sb->textlen > 0 ) { short curx; short vqw[4]; char t[2]; short cw = 8; t[1]=0; if( atari_sysinfo.sfont_monospaced ) { t[0]='A'; int r = vqt_width(atari_plot_vdi_handle, t[0], &vqw[0], &vqw[1], &vqw[2] ); cw = vqw[0]; } vswr_mode(atari_plot_vdi_handle, MD_TRANS ); for( curx = work.g_x + 2, i=0 ; (curx+cw < work.g_x+work.g_w ) && i < sb->textlen; i++ ){ t[0] = sb->text[i]; if( !atari_sysinfo.sfont_monospaced ) { vqt_width(atari_plot_vdi_handle, t[0], &vqw[0], &vqw[1], &vqw[2] ); cw = vqw[0]; } if( curx >= lclip.g_x - cw ) { v_gtext(atari_plot_vdi_handle, curx, work.g_y + 5, (char*)&t ); } curx += cw; if( curx >= lclip.g_x + lclip.g_w ) break; } } vswr_mode(atari_plot_vdi_handle, MD_REPLACE ); pxy[0] = work.g_x + work.g_w; pxy[1] = work.g_y + work.g_h; pxy[2] = work.g_x + work.g_w; pxy[3] = work.g_y + work.g_h-work.g_h; v_pline(atari_plot_vdi_handle, 2, (short*)&pxy ); vs_clip(atari_plot_vdi_handle, 0, (short*)&pxyclip ); return; }
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); }