/******************************************************************************* 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); }
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) ; }
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 ); }
/* --------------------------------- */ void init_mtext(void) { register int i, j; int a, b; scrtchp = (long)Malloc(2048L); mtext_mlen = (long)Malloc(-1L) - 75000; mtext_mem = (unsigned char *)Malloc(mtext_mlen); /*printf("\033H%lx\n", mtext_mem);*/ memset(mtext_mem, 0, mtext_mlen); pathes[0][0] = Dgetdrv(); pathes[0][1] = ':'; Dgetpath(pathes[0] + 2, 0); strcat(pathes[0] + 2, "\\"); pathes[0][0] += 'A'; strcpy(pathes[1], pathes[0]); strcpy(pathes[2], pathes[0]); strcpy(pathes[3], pathes[0]); pic_fpath[0] = pathes[0][0]; del_file[0] = font_path[0] = pathes[0][0]; for (i = 0; i < 68; txt_lineal[0][i++] = '.'); txt_lineal[0][68] = 0; strcpy(txt_lineal[1], txt_lineal[0]); strcpy(txt_lineal[2], txt_lineal[0]); strcpy(txt_lineal[3], txt_lineal[0]); strncpy(txt_linpar[0], "NPS110", 6); strncpy(txt_linpar[1], txt_linpar[0], 6); strncpy(txt_linpar[2], txt_linpar[0], 6); strncpy(txt_linpar[3], txt_linpar[0], 6); strcpy(txt_infol[0], " Seite: 999, Zeile: 99999, Spalte: 999 Einf�gen "); strcpy(txt_infol[1], txt_infol[0]); strcpy(txt_infol[2], txt_infol[0]); strcpy(txt_infol[3], txt_infol[0]); vst_alignment(vdi_handle, 0, 3, &a, &b); vsf_perimeter(vdi_handle, FALSE); load_cfg(); get_work(0); for (i = 0; i < 4; i++) { w_koor[i][0] = wx; w_koor[i][1] = wy; w_koor[i][2] = ww - (3 - i) * 10; w_koor[i][3] = wh - i * 10; } }
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); }
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 ); }
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_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); }
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) ; }
/* 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 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 ) ; } } }
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_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); }
/**************************************************************** * * * 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 */
/******************************************************************************* 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; }
void browser_redraw( struct gui_window * gw ) { LGRECT bwrect; struct s_browser * b = gw->browser; short todo[4]; struct rect clip; /* used for clipping of content redraw: */ struct rect redraw_area; if( b->attached == false || b->bw->current_content == NULL ) { return; } browser_get_rect(gw, BR_CONTENT, &bwrect); plotter->resize(plotter, bwrect.g_w, bwrect.g_h); plotter->move(plotter, bwrect.g_x, bwrect.g_y ); clip.x0 = 0; clip.y0 = 0; clip.x1 = bwrect.g_w; clip.y1 = bwrect.g_h; plotter->set_clip( plotter, &clip ); if( plotter->lock(plotter) == 0 ) return; if( b->scroll.required == true && b->bw->current_content != NULL) { browser_process_scroll( gw, bwrect ); b->scroll.required = false; } if ((b->redraw.areas_used > 0) && b->bw->current_content != NULL ) { if( (plotter->flags & PLOT_FLAG_OFFSCREEN) == 0 ) { int i; GRECT area; GRECT fbwork; short wf_top[4]; todo[0] = bwrect.g_x; todo[1] = bwrect.g_y; todo[2] = todo[0] + bwrect.g_w-1; todo[3] = todo[1] + bwrect.g_h-1; vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]); wind_get( 0, WF_TOP, &wf_top[0], &wf_top[1], &wf_top[2], &wf_top[3] ); if( wf_top[0] == gw->root->handle->handle && wf_top[1] == _AESapid ){ /* The window is on top, so there is no need to walk the */ /* AES rectangle list. */ for( i=0; i<b->redraw.areas_used; i++ ){ fbwork.g_x = todo[0] - bwrect.g_x; fbwork.g_y = todo[1] - bwrect.g_y; if( fbwork.g_x < 0 ){ fbwork.g_w = todo[2] + todo[0]; fbwork.g_x = 0; } else { fbwork.g_w = todo[2]; } if( fbwork.g_y < 0 ){ fbwork.g_h = todo[3] + todo[1]; fbwork.g_y = 0; } else { fbwork.g_h = todo[3]; } area.g_x = b->redraw.areas[i].x0; area.g_y = b->redraw.areas[i].y0; area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0; area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0; if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) { redraw_area.x0 = area.g_x; redraw_area.y0 = area.g_y; redraw_area.x1 = area.g_x + area.g_w; redraw_area.y1 = area.g_y + area.g_h; browser_redraw_content( gw, 0, 0, &redraw_area ); } else { /* the area should be kept scheduled for later redraw,*/ /* but because this is onscreen plotter, it doesn't */ /* make much sense anyway... */ } } } else { /* walk the AES rectangle list: */ if( wind_get(gw->root->handle->handle, WF_FIRSTXYWH, &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) { while (todo[2] && todo[3]) { /* convert screen to framebuffer coords: */ fbwork.g_x = todo[0] - bwrect.g_x; fbwork.g_y = todo[1] - bwrect.g_y; if( fbwork.g_x < 0 ){ fbwork.g_w = todo[2] + todo[0]; fbwork.g_x = 0; } else { fbwork.g_w = todo[2]; } if( fbwork.g_y < 0 ){ fbwork.g_h = todo[3] + todo[1]; fbwork.g_y = 0; } else { fbwork.g_h = todo[3]; } /* walk the redraw requests: */ for( i=0; i<b->redraw.areas_used; i++ ){ area.g_x = b->redraw.areas[i].x0; area.g_y = b->redraw.areas[i].y0; area.g_w = b->redraw.areas[i].x1 - b->redraw.areas[i].x0; area.g_h = b->redraw.areas[i].y1 - b->redraw.areas[i].y0; if (rc_intersect((GRECT *)&fbwork,(GRECT *)&area)) { redraw_area.x0 = area.g_x; redraw_area.y0 = area.g_y; redraw_area.x1 = area.g_x + area.g_w; redraw_area.y1 = area.g_y + area.g_h; browser_redraw_content( gw, 0, 0, &redraw_area ); } else { /* the area should be kept scheduled for later redraw,*/ /* but because this is onscreen plotter, it doesn't */ /* make much sense anyway... */ } } if (wind_get(gw->root->handle->handle, WF_NEXTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])==0) { break; } } } } vs_clip(plotter->vdi_handle, 0, (short*)&todo); } else { /* its save to do a complete redraw without knowledge about GEM windows :) */ /* walk the redraw requests: */ int i; for( i=0; i<b->redraw.areas_used; i++ ){ struct redraw_context ctx = { .interactive = true, .background_images = true, .plot = &atari_plotters }; browser_window_redraw( b->bw, -b->scroll.current.x, -b->scroll.current.y, &b->redraw.areas[i], &ctx ); } GRECT area; area.g_x = bwrect.g_x; area.g_y = bwrect.g_y; area.g_w = bwrect.g_w; area.g_h = bwrect.g_h; //plotter->blit( plotter, &area ); } b->redraw.areas_used = 0; } if( b->caret.redraw == true && b->bw->current_content != NULL ) { LGRECT area; todo[0] = bwrect.g_x; todo[1] = bwrect.g_y; todo[2] = todo[0] + bwrect.g_w; todo[3] = todo[1] + bwrect.g_h; area.g_x = bwrect.g_x; area.g_y = bwrect.g_y; area.g_w = bwrect.g_w; area.g_h = bwrect.g_h; vs_clip(plotter->vdi_handle, 1, (short*)&todo[0]); browser_redraw_caret( gw, &area ); vs_clip(plotter->vdi_handle, 0, (short*)&todo[0]); b->caret.redraw = false; } plotter->unlock(plotter); /* TODO: if we use offscreen bitmap, trigger content redraw here */ } static void __CDECL browser_evnt_redraw( COMPONENT * c, long buff[8], void * data) { struct gui_window * gw = (struct gui_window *) data; CMP_BROWSER b = gw->browser; LGRECT work, lclip; browser_get_rect( gw, BR_CONTENT, &work ); lclip = work; if ( !rc_lintersect( (LGRECT*)&buff[4], &lclip ) ) return; if( b->bw->current_content == NULL ){ short pxy[4]; pxy[0] = lclip.g_x; pxy[1] = lclip.g_y; pxy[2] = lclip.g_x + lclip.g_w - 1; pxy[3] = lclip.g_y + lclip.g_h - 1; vsf_color( gw->root->handle->graf->handle, WHITE ); vsf_perimeter( gw->root->handle->graf->handle, 0); vsf_interior( gw->root->handle->graf->handle, FIS_SOLID ); vsf_style( gw->root->handle->graf->handle, 1); v_bar( gw->root->handle->graf->handle, (short*)&pxy ); return; } /* convert redraw coords to framebuffer coords: */ lclip.g_x -= work.g_x; lclip.g_y -= work.g_y; if( lclip.g_x < 0 ) { lclip.g_w = work.g_w + lclip.g_x; lclip.g_x = 0; } if( lclip.g_y < 0 ) { lclip.g_h = work.g_h + lclip.g_y; lclip.g_y = 0; } if( lclip.g_h > 0 && lclip.g_w > 0 ) { if( gw->browser->reformat_pending == true ){ LGRECT newsize; gw->browser->reformat_pending = false; browser_get_rect(gw, BR_CONTENT, &newsize); /* this call will also schedule an redraw for the complete */ /* area. */ /* Resize must be handled here, because otherwise */ /* a redraw is scheduled twice (1. by the frontend, 2. by AES) */ browser_window_reformat(b->bw, false, newsize.g_w, newsize.g_h ); } else { browser_schedule_redraw( gw, lclip.g_x, lclip.g_y, lclip.g_x + lclip.g_w, lclip.g_y + lclip.g_h ); } } return; }
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); }
/******************************************************************************* 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; }
/* * 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; }
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); }