static inline void vst_rgbcolor( short vdih, uint32_t cin ) { if( vdi_sysinfo.scr_bpp > 8 ) { unsigned short c[4]; rgb_to_vdi1000( (unsigned char*)&cin, (unsigned short*)&c ); vs_color( vdih, OFFSET_CUSTOM_COLOR, (unsigned short*)&c[0] ); vst_color( vdih, OFFSET_CUSTOM_COLOR ); } else { if( vdi_sysinfo.scr_bpp >= 4 ) vst_color( vdih, RGB_TO_VDI(cin) ); else vst_color( vdih, BLACK ); } }
int redoinpb(short hand,GRECT box) { int xy[4]; char *point; short junk2; char temps[2048]; if(hand==-1)return 0; xy[0]=box.g_x;xy[1]=box.g_y;xy[2]=box.g_x+box.g_w-1;xy[3]=box.g_y+box.g_h-1; vs_clip(ws.handle,1,xy); clearwin(box.g_x,box.g_y,box.g_w,box.g_h,col[CINPBACK]); writeinpinfo(hand); point=wn[hand].inp+strlen(wn[hand].inp); vst_font(ws.handle,(WORD)inpfont); vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2); vst_color(ws.handle,col[CINPTEXT]); point=point-wn[hand].ihc[wn[hand].cvof]; stccpy(temps,point,wn[hand].ihc[wn[hand].cvof]+1); vswr_mode(ws.handle,MD_TRANS); v_gtext(ws.handle,wn[hand].wwa.g_x,wn[hand].wwa.g_y+wn[hand].wwa.g_h-1,temps); if(wn[hand].cvof>0){ point=point-wn[hand].ihc[wn[hand].cvof-1]; stccpy(temps,point,wn[hand].ihc[wn[hand].cvof-1]+1); v_gtext(ws.handle,wn[hand].wwa.g_x,wn[hand].wwa.g_y+wn[hand].wwa.g_h-ith-1,temps); } docursor(hand); vs_clip(ws.handle,0,NULL); return 0; }
global void t_color(int m) { static int mode = -1; if (m ne mode) vst_color(C.vh, mode = m); }
static int ecrit(C_OBJ *obj, int x, int *y, int wc, int hc, int ystop) { char ligne[256]; int x1; int fin_ecran; x1=x; if (obj) /* Si l'oject existe */ { if (obj==sel_obj) /* Si c'est l'objet s‚lectionn‚ */ vst_color(VDIhandle, RED); /* Rouge pour ˆtre vu en moyenne res */ else vst_color(VDIhandle, BLACK); if (obj->type==t_donnee) ecrit_donnee(obj, ligne, x, *y, wc, hc, &x1); else if (obj->type==t_d_procedure || obj->type==t_procedure) ecrit_procedure(obj, ligne, x, *y, wc, hc, &x1); else if (obj->type==t_t_type) ecrit_type(obj, ligne, x, *y, wc, hc, &x1); else if (obj->type==t_bloc) ecrit_bloc(obj, ligne, x, *y, wc, hc, &x1); if (obj->commentaire) /* Afficher le commemtaire */ { vst_effects(VDIhandle, 4); /* texte italique */ if (x1>x+55*wc) /* Le commentaire est si il y a la place … la 50 iŠme colonne */ x1+=5*wc; else x1=(60*wc) +x; v_gtext (VDIhandle, x1, *y, obj->commentaire); /* Afficher la ligne */ } *y+=hc; if(*y<=ystop) /* Si on est pas … la fin de l'‚cran */ { if (obj->fils) fin_ecran=ecrit(obj->fils, x+tab*wc, y, wc, hc, ystop); /* g‚nial c'est r‚cursif */ if (obj->suivant) fin_ecran=ecrit(obj->suivant, x, y, wc, hc, ystop); /* g‚nial c'est r‚cursif */ } } }
static int cdecl draw_underline(PARMBLK *p) { char *str; int d, wBox, hBox, effect = 0; set_clipping(vdi_handle, p->pb_xc, p->pb_yc, p->pb_wc, p->pb_hc, TRUE); vswr_mode(vdi_handle, MD_TRANS); /* Font */ vst_alignment(vdi_handle, 0, 5, &d, &d); vst_font(vdi_handle, sys_big_id); vst_height(vdi_handle, sys_big_height, &d, &d, &wBox, &hBox); /* Text ausgeben */ str = (char *)p->pb_parm; vst_color(vdi_handle, 12); if(p->pb_tree[p->pb_obj].ob_state & DISABLED) effect |= TXT_LIGHT; if(p->pb_tree[p->pb_obj].ob_state & CHECKED) effect |= TXT_UNDERLINED; if(p->pb_tree[p->pb_obj].ob_state & SELECTED) vst_color(vdi_handle, 2); vst_effects(vdi_handle, effect); v_gtext(vdi_handle, p->pb_x, p->pb_y, str); /* Linie */ /* len = get_txtlen(str);*/ /* len = p->pb_w; vsl_color(vdi_handle, 9); pxy[0] = p->pb_x; pxy[1] = p->pb_y + hBox; pxy[2] = p->pb_x + len; pxy[3] = pxy[1]; v_pline(vdi_handle, 2, pxy); vsl_color(vdi_handle, 0); pxy[1]--; pxy[3]--; v_pline(vdi_handle, 2, pxy); */ return (p->pb_currstate & ~(CHECKED|DISABLED|SELECTED)); }
void set_txt_default(int font, int height) { int dummy; vswr_mode(vdi_handle, MD_REPLACE); vst_font(vdi_handle, font); vst_color(vdi_handle, 1); vst_rotation(vdi_handle, 0); vst_alignment(vdi_handle, 0, 5, &dummy, &dummy); vst_point(vdi_handle, height, &dummy, &dummy, &dummy, &dummy); vst_effects(vdi_handle, 0); }
int writeblock(char *dp,short nchar,short hof,short vof,short coll,short hand){ long effects=0; char a; short chof; short pts[8]; if(bold)effects=effects+THICKENED; if(reversed)vswr_mode(ws.handle,MD_ERASE); else{vswr_mode(ws.handle,MD_TRANS);} if(underlined)effects=effects+UNDERLINED; if(reset){effects=0;red=0;underlined=0;bold=0;reversed=0;reset=0;vswr_mode(ws.handle,MD_TRANS);} vst_effects(ws.handle,effects); if(red)vst_color(ws.handle,2); else vst_color(ws.handle,coll); a=*(dp+nchar+1); *(dp+nchar+1)=0; vqt_extent(ws.handle,dp,pts); chof=pts[2]-pts[0]; v_gtext(ws.handle,wn[hand].wwa.g_x+hof,wn[hand].wwa.g_y+wn[hand].wwa.g_h-ith*2-VT-vof*th,dp); vswr_mode(ws.handle,MD_TRANS); *(dp+nchar+1)=a; return chof; }
void drawnicklist(int hand,GRECT box) { short mcto=0,junk=1,junk2; short maxj; short xy[4]; if(hand==-1)return; xy[0]=box.g_x;xy[1]=box.g_y;xy[2]=box.g_x+box.g_w-1;xy[3]=box.g_y+box.g_h-1; vs_clip(ws.handle,1,xy); clearwin(box.g_x,box.g_y,box.g_w,box.g_h,col[CNLBACK]); xy[0]=wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW; xy[1]=wn[hand].wwa.g_y; xy[2]=wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW; xy[3]=wn[hand].wwa.g_y+wn[hand].wwa.g_h-ith*2-VT+4; vsl_color(ws.handle,col[CNLDIVIDE]); v_pline(ws.handle,2,xy); xy[0]+=1; xy[2]+=1; v_pline(ws.handle,2,xy); if(wn[hand].chan==-1)return; vst_font(ws.handle,1); vst_point(ws.handle,8,&junk2,&junk2,&junk2,&junk2); maxj=(wn[hand].wwa.g_h-ith*2-VT)/8; vst_color(ws.handle,col[CNICKLIST]); vswr_mode(ws.handle,MD_TRANS); while(mcto<128){ if(strlen(chan[wn[hand].chan].nl[mcto])){ v_gtext(ws.handle,wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW+4,wn[hand].wwa.g_y+junk*8,chan[wn[hand].chan].nl[mcto]); junk++; if(junk>maxj){ mcto=128; v_gtext(ws.handle,wn[hand].wwa.g_x+wn[hand].wwa.g_w-NLW+4,wn[hand].wwa.g_y+junk*8," "); } } mcto++; } vs_clip(ws.handle,0,NULL); return; }
void writeinpinfo(short w) { short junk2; short xy[8]; vsl_color(ws.handle,col[CDIVIDEB]); xy[0]=wn[w].wwa.g_x; xy[1]=wn[w].wwa.g_y+wn[w].wwa.g_h-ith*2-1; xy[2]=wn[w].wwa.g_x+wn[w].wwa.g_w-1; xy[3]=wn[w].wwa.g_y+wn[w].wwa.g_h-ith*2-1; v_pline(ws.handle,2,xy); xy[1]=xy[1]-10;xy[3]=xy[3]-10; vsl_color(ws.handle,col[CDIVIDET]); v_pline(ws.handle,2,xy); vst_font(ws.handle,1); vst_point(ws.handle,8,&junk2,&junk2,&junk2,&junk2); vst_color(ws.handle,col[CINPINFO]); vst_effects(ws.handle,THICKENED); vswr_mode(ws.handle,MD_TRANS); v_gtext(ws.handle,wn[w].wwa.g_x,wn[w].wwa.g_y+wn[w].wwa.g_h-ith*2-3,wn[w].info2); vst_effects(ws.handle,0); vst_font(ws.handle,inpfont); vst_point(ws.handle,inppoint,&junk2,&junk2,&junk2,&junk2); }
VOID gsx_attr(WORD text, WORD mode, WORD color) { if (mode != gl_mode) { vswr_mode( gl_handle, mode ); gl_mode = mode; } if (text) { if (color != gl_tcolor) { vst_color(gl_handle, color); gl_tcolor = color; } } else { if (color != gl_lcolor) { vsl_color(gl_handle, color); gl_lcolor = color; } } }
/******************************************************************************* 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; }
/******************************************************************************* 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; }
/******************************************************************************* 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; }
/**************************************************************** * * * 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; }
static void __CDECL cert_info_draw( WINDOW * win, short buf[8], void * data) { struct ssl_info_draw_param * dp = (struct ssl_info_draw_param *)data; GRECT work; short pxy[4]; int maxchars; short d, cbh, cbw; int i = 0; short x,y,w,h; int px_ypos, px_xpos; char * line = malloc(512); if( line == NULL ) return; LOG(("Cert info draw, win: %p, data: %p, scrollx: %d", win, data, dp->scrollx )); WindGet( win, WF_WORKXYWH, &x, &y, &w, &h ); /*using static values here, as RsrcUserDraw has mem leaks & a very small stack */ pxy[0] = work.g_x = x + 8; pxy[1] = work.g_y = y + 80; pxy[2] = x + 8 + 272; pxy[3] = y + 80 + 176; work.g_w = 272; work.g_h = 176; maxchars = (work.g_w / 8)+1; vs_clip( atari_plot_vdi_handle, 1,(short*) &pxy ); vswr_mode( atari_plot_vdi_handle, MD_REPLACE ); vsf_interior( atari_plot_vdi_handle, 1 ); vsf_color( atari_plot_vdi_handle, LWHITE ); v_bar( atari_plot_vdi_handle, (short*)&pxy ); vst_height( atari_plot_vdi_handle, 16, &d, &d, &cbw, &cbh ); vst_alignment(atari_plot_vdi_handle, 0, 5, &d, &d ); vst_color( atari_plot_vdi_handle, BLACK ); vst_effects( atari_plot_vdi_handle, 0 ); px_ypos = px_xpos = 0; for(i=0; i<CERT_INF_LINES; i++ ) { switch( i ) { case 0: sprintf(line, "Cert Version: %d", dp->cert_infos_n[dp->current].version ); break; case 1: sprintf(line, "Invalid before: %s", &dp->cert_infos_n[dp->current].not_before ); break; case 2: sprintf(line, "Invalid after: %s", &dp->cert_infos_n[dp->current].not_after ); break; case 3: sprintf(line, "Signature type: %d", dp->cert_infos_n[dp->current].sig_type ); break; case 4: sprintf(line, "Serial: %d", dp->cert_infos_n[dp->current].serial ); break; case 5: sprintf(line, "Issuer: %s", &dp->cert_infos_n[dp->current].issuer ); break; case 6: sprintf(line, "Subject: %s", &dp->cert_infos_n[dp->current].subject ); break; case 7: sprintf(line, "Cert type: %d", dp->cert_infos_n[dp->current].cert_type ); break; default: break; } if( (int)strlen(line) > dp->scrollx ) { if( dp->scrollx + maxchars < 511 && ( (signed int)strlen(line) - dp->scrollx) > maxchars ) line[dp->scrollx + maxchars] = 0; v_gtext(atari_plot_vdi_handle, work.g_x + 1, work.g_y + px_ypos, &line[dp->scrollx]); } px_ypos += cbh; } vst_alignment(atari_plot_vdi_handle, 0, 0, &d, &d ); vs_clip( atari_plot_vdi_handle, 0, (short*)&pxy ); free( line ); }
int wtib(char *point,char aflag) { short junk2,blunk,blunk2,rfoff=0,cellw; short soff=0,lcount=0,wl; char *dp; char temps[2048]; if(cwin==-1)return 0; wl=wn[cwin].cvof; if((strlen(wn[cwin].inp)+strlen(point))>511){*(point+(511-strlen(wn[cwin].inp)))=0;} vst_font(ws.handle,(WORD)inpfont); vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2); if(amatend()){ blunk=findcurpos(); strcat(wn[cwin].inp,point); }else{ aflag=1; blunk=findcurpos(); strcpy(temps,"\0"); if(blunk!=0){ stccpy(temps,wn[cwin].inp,blunk+1); } strcat(temps,point); strcat(temps,wn[cwin].inp+blunk); strcpy(wn[cwin].inp,temps); } junk2=wn[cwin].cvof-1; while(junk2>-1){ rfoff=rfoff+wn[cwin].ihc[junk2]; junk2--; } dp=wn[cwin].inp+rfoff; aflag=FALSE; blunk2=wn[cwin].iof[wl]; while(rfoff<strlen(wn[cwin].inp)){ vqt_width(ws.handle,*(dp+lcount),&cellw,&junk2,&junk2); if(soff+cellw>wn[cwin].wwa.g_w){ wn[cwin].ihc[wl]=lcount; wn[cwin].iof[wl]=soff; dp=dp+lcount-1; lcount=0; soff=0; wl++; soff=soff+cellw; cellw=0; aflag=TRUE; } soff=soff+cellw; lcount++; if(rfoff==blunk+strlen(point)-1){wn[cwin].cvof=wl;wn[cwin].cx=lcount;} rfoff++; } if(lcount){ wn[cwin].ihc[wl]=lcount; wn[cwin].iof[wl]=soff; } if(!aflag){ startupdate(); clchar(); clcursor(); vst_color(ws.handle,col[CINPTEXT]); vswr_mode(ws.handle,MD_TRANS); v_gtext(ws.handle,wn[cwin].wwa.g_x+blunk2,wn[cwin].wwa.g_y+wn[cwin].wwa.g_h-1,point); finishupdate(); } if(aflag)ipbredraw(cwin); return 0; }