static void ecrit_type(C_OBJ *obj, char *ligne, int x, int y, int wc, int hc, int *x1) { int dummy; vst_effects(VDIhandle, 2); /* texte leger */ strcpy(ligne, "Type "); v_gtext (VDIhandle, *x1, y, ligne); /* Afficher la ligne */ *x1+=wc*strlen(ligne); if (obj->spec.type.tt_nom) /* affiche le nom */ { vst_effects(VDIhandle, 1); /* texte gras */ v_gtext (VDIhandle, *x1, y, obj->spec.type.tt_nom); /* Afficher la ligne */ *x1+=wc*strlen(obj->spec.type.tt_nom); } vst_effects(VDIhandle, 0); /* texte normal */ strcpy(ligne, " : "); if (obj->spec.type.tt_flag & 8) strcat(ligne, "non sign‚ "); if (obj->spec.type.tt_flag & 4) strcat(ligne, "long "); switch(obj->spec.type.tt_type) { case t_int: strcat(ligne, "entier "); break; case t_char: strcat(ligne, "carac. "); break; case t_reel: strcat(ligne, "reŠl "); break; case t_nul: strcat(ligne, "nul "); break; case t_struct: strcat(ligne, "structure "); break; case t_union: strcat(ligne, "union "); break; case t_autre: if (obj->spec.type.tt_autre) strcat(ligne, ((C_OBJ*)(obj->spec.type.tt_autre))->spec.type.tt_nom); strcat(ligne, " "); break; } v_gtext (VDIhandle, *x1, y, ligne); /* Afficher la ligne */ *x1+=wc*strlen(ligne); }
static void ecrit_procedure(C_OBJ *obj, char *ligne, int x, int y, int wc, int hc, int *x1) { int dummy; if (obj->spec.proc.pr_flag & 2) strcpy(ligne, "Externe "); else strcpy(ligne, ""); if (obj->spec.proc.pr_flag & 8) strcat(ligne, "non sign‚ "); if (obj->spec.proc.pr_flag & 4) strcat(ligne, "long "); switch(obj->spec.proc.pr_type) { case t_int: strcat(ligne, "entier "); break; case t_char: strcat(ligne, "carac. "); break; case t_reel: strcat(ligne, "reŠl "); break; case t_nul: if (obj->spec.proc.pr_flag!=0 && obj->spec.proc.pr_flag!=2) /* si rien que nul on affiche rien*/ strcat(ligne, "nul "); break; case t_autre: if (obj->spec.proc.pr_autre) strcat(ligne, ((C_OBJ*)(obj->spec.proc.pr_autre))->spec.type.tt_nom); strcat(ligne, " "); break; } if (obj->spec.proc.pr_flag & 1) strcat(ligne, "*"); vst_effects(VDIhandle, 1); /* texte gras */ v_gtext (VDIhandle, *x1, y, ligne); /* Afficher la ligne */ *x1+=wc*strlen(ligne); if (obj->spec.proc.pr_nom) /* affiche le nom */ { vst_effects(VDIhandle, 0); /* texte normal */ v_gtext (VDIhandle, *x1, y, obj->spec.proc.pr_nom); /* Afficher la ligne */ *x1+=wc*strlen(obj->spec.proc.pr_nom); } }
global void t_effect(int m) /* HR 060202 */ { static int mode = -1; if (m ne mode) vst_effects(C.vh, mode = m); }
static int str_width( FONT_PLOTTER self,const plot_font_style_t *fstyle, const char * str, size_t length, int * width ) { short cw, ch, cellw, cellh; short pxsize; short fx=0; lstr = (char*)str; utf8_to_enc(str, "ATARIST", length, &lstr ); assert( lstr != NULL ); int slen = strlen(lstr); if( fstyle->flags & FONTF_ITALIC ) fx |= 4; if( fstyle->flags & FONTF_OBLIQUE ) fx |= 16; if( fstyle->weight > 450 ) fx |= 1; vst_effects( self->vdi_handle, fx ); /* TODO: replace 90 with global dpi setting */ pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); *width = slen * cellw; free( (void*)lstr ); lstr = NULL; return( 0 ); }
static void ecrit_bloc(C_OBJ *obj, char *ligne, int x, int y, int wc, int hc, int *x1) { if (obj->spec.bloc) /* affiche le nom */ { vst_effects(VDIhandle, 3); /* texte GRAS leger */ v_gtext (VDIhandle, *x1, y, obj->spec.bloc); /* Afficher la ligne */ *x1+=wc*strlen(obj->spec.bloc); } }
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); }
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); }
static int str_split( FONT_PLOTTER self, const plot_font_style_t * fstyle, const char *string, size_t length,int x, size_t *char_offset, int *actual_x ) { short cw, ch, cellw, cellh; short pxsize; short fx=0; int i; lstr = (char*)string; int slen = 0; int last_space_x = 0; int last_space_idx = 0; utf8_to_enc(string, "ATARIST", length, &lstr ); assert( lstr != NULL ); slen = strlen(lstr); if( fstyle->flags & FONTF_ITALIC ) fx |= 4; if( fstyle->flags & FONTF_OBLIQUE ) fx |= 16; if( fstyle->weight > 450 ) fx |= 1; vst_effects( self->vdi_handle, fx ); pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); *actual_x = 0; *char_offset = 0; int cpos=0; for( i=0; i<slen; i++) { if( lstr[i] == ' ' ) { last_space_x = *actual_x; last_space_idx = cpos; } if( *actual_x > x ) { *actual_x = last_space_x; *char_offset = last_space_idx; return true; } *actual_x += cellw; cpos++; } *char_offset = cpos; free( (void*)lstr ); lstr = NULL; return( 0 ); }
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)); }
static int text( FONT_PLOTTER self, int x, int y, const char *text, size_t length, const plot_font_style_t *fstyle ) { /* todo: either limit the string to max 80 chars, or use v_ftext instead of v_gtext */ short cw, ch, cellw, cellh; short pxsize=8; short fx=0; lstr = (char*)text; utf8_to_enc(text, "ATARIST", length, &lstr ); assert( lstr != NULL ); int slen = strlen(lstr); size_t mylen = MIN(511, slen ); char textcpy[mylen+1]; textcpy[mylen] = 0; strncpy((char*)&textcpy, lstr, mylen+1 ); if( fstyle != NULL){ if( fstyle->flags & FONTF_ITALIC ) fx |= 4; if( fstyle->flags & FONTF_OBLIQUE ) fx |= 4; if( fstyle->weight > 450 ) fx |= 1; /* TODO: netsurf uses 90 as default dpi ( somewhere defined in libcss), use that value or pass it as arg, to reduce netsurf dependency */ pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); } x += CURFB(self->plotter).x; y += CURFB(self->plotter).y; vst_effects( self->vdi_handle, fx ); vst_alignment(vdih, 0, 4, &cw, &ch ); vst_height( self->vdi_handle, pxsize, &cw, &ch, &cellw, &cellh); vswr_mode( self->vdi_handle, MD_TRANS ); vst_rgbcolor(self->vdi_handle, fstyle->foreground ); if( atari_sysinfo.gdos_FSMC ){ v_ftext( self->vdi_handle, x, y, (char*)&textcpy ); } else { v_gtext( self->vdi_handle, x, y, (char*)&textcpy ); } free( lstr ); return( 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; }
static int pixel_pos( FONT_PLOTTER self, const plot_font_style_t * fstyle,const char *string, size_t length,int x, size_t *char_offset, int *actual_x ) { short cw, ch, cellw, cellh; short pxsize=0; short fx=0; lstr = (char*)string; int i=0; int curpx=0; utf8_to_enc(string, "ATRIST", length, &lstr ); assert( lstr != NULL ); int slen = strlen(lstr); if( fstyle->flags & FONTF_ITALIC ) fx |= 4; if( fstyle->flags & FONTF_OBLIQUE ) fx |= 16; if( fstyle->weight > 450 ) fx |= 1; vst_effects( self->vdi_handle, fx ); pxsize = ceil( (fstyle->size/FONT_SIZE_SCALE) * 90 / 72 ); vst_height( self->vdi_handle, pxsize ,&cw, &ch, &cellw, &cellh); *actual_x = 0; *char_offset = 0; for( i=0; i<slen; i++) { *actual_x += cellw; if( *actual_x > x) { *actual_x -= cellw; *char_offset = i; break; } } free( (void*)lstr ); lstr = NULL; return( 0 ); }
void small_scale_draw(ALWINDOW *alw, CURRENT_STATUS *cs) { register int loop1,loop2; int cf; short coord[4]; register int curx,cury; int inc_res; int half_fret_height=frets_height/2,half_fret_length=frets_length/2; register int circle_radius; int h,saveh; int tadd; short ch,cw,clh,clw,maxcw; char albuff[10]; char info_buffer[120]; int combination_note,note_val; int frets_x_offset_and_frets_length; int half_fret_height_and_frets_y_offset; int frets_height_and_frets_y_offset; int frets_length_times_loop2; int frets_height_times_7; short tatts[10]; /* text attributes */ NOTE *np; #ifdef PRINTER_TEST /* gdos test stuff*/ short work_in[11],work_out[57],thandle,lop; #endif #define draw(X1,Y1,X2,Y2); coord[0]=X1;coord[1]=Y1;coord[2]=X2;coord[3]=Y2;v_pline(handle,2,coord); #ifdef PRINTER_TEST if(vq_gdos()==0) fatal_error("GDOS NOT LOADED!"); #endif #ifndef PRINTER_TEST if(scale_name_flag && !key_name_flag) { sprintf(info_buffer," %s",cs->current_scale->name); wind_info(scale_window.handle,info_buffer); } else { if(!scale_name_flag && key_name_flag) { sprintf(info_buffer," %s",cs->key->note_name); wind_info(scale_window.handle,info_buffer); } else { if(scale_name_flag && key_name_flag) { sprintf(info_buffer," %s in %s",cs->current_scale->name,cs->key->note_name); wind_info(scale_window.handle,info_buffer); } else { sprintf(info_buffer," "); wind_info(scale_window.handle,info_buffer); } } } #endif scale_offsets(alw,&frets_x_offset,&frets_y_offset); frets_y_offset=frets_y_offset+big_y_offset; frets_height_and_frets_y_offset=frets_height+frets_y_offset; frets_x_offset_and_frets_length=frets_length+frets_x_offset; half_fret_height_and_frets_y_offset=half_fret_height+frets_y_offset; #ifndef PRINTER_TEST h=0;cw=0;ch=0;maxcw=0; while(cw<((frets_length/2)-2) && h<99) { if(cw>maxcw) saveh=h; h++; vst_height(handle,h,&cw,&ch,&clw,&clh); } set_hor(); if(h>=99) vst_height(handle,saveh,&cw,&ch,&clw,&clh); #endif #ifdef PRINTER_TEST clh=0; #endif vqt_attributes(handle,tatts); frets_height_times_7=7*frets_height; total_y_dist=clh+(frets_height_times_7); set_ver(total_y_dist); if(frets_length>frets_height) circle_radius=(frets_height/2)-1-2; else circle_radius=(frets_length/2)-1-2; curx=0; #ifdef PRINTER_TEST work_in[0]=21; /*printer ?*/ for(lop=1;lop<10;lop++) work_in[lop]=1; work_in[10]=2; for(lop=21;lop<31;lop++) { work_in[0]=lop; v_opnwk(work_in,&handle,work_out); if(handle) { error("GOT A PRINTER HANDLE"); lop=32; } else error("NOT GOT A PRINTER HANDLE"); } #endif wclip(alw); graf_mouse(M_OFF,NULL); for(loop2=0;loop2<global_frets && loop2+start_fret<global_frets;loop2++) { frets_length_times_loop2=frets_length*loop2; for(loop1=0;loop1<6;loop1++) { if(curx<desk_x+frets_height) { cf=loop2+start_fret; curx=/*alw->wx+*/(frets_length_times_loop2); cury=/*alw->wy+*/(loop1*frets_height); if(cf!=0) { draw(curx+frets_x_offset,cury+half_fret_height_and_frets_y_offset, curx+frets_x_offset_and_frets_length,cury+half_fret_height_and_frets_y_offset); } switch(loop1) { case 0: draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset+half_fret_height, curx+frets_x_offset_and_frets_length,cury+frets_height_and_frets_y_offset); break; case 5: draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset, curx+frets_x_offset_and_frets_length,cury+half_fret_height_and_frets_y_offset); break; default: draw(curx+frets_x_offset_and_frets_length,cury+frets_y_offset, curx+frets_x_offset_and_frets_length,cury+frets_height_and_frets_y_offset); } #ifndef PRINTER_TEST if(numbers_flag==1) { if(cf==first_fret || (((inc_res=cf%fret_inc)==0) && cf>first_fret)) { if((tadd=clh-frets_height)>0) { sprintf(albuff,"%d",cf); if(strlen(albuff)==1) v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-(tatts[6]/2),frets_y_offset+(frets_height_times_7)+tadd,albuff); else v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6],frets_y_offset+(frets_height_times_7)+tadd,albuff); } else { sprintf(albuff,"%d",cf); if(strlen(albuff)==1) v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-(tatts[6]/2),frets_y_offset+(frets_height_times_7),albuff); else v_gtext(handle,frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6], frets_y_offset+(frets_height_times_7),albuff); } } } #endif if(text_notes==1) { combination_note=0; if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE) { combination_note=1; note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE; } else { note_val=cs->display_fretboard[loop1][cf]; } switch(note_val) { case NO_NOTE: break; case NORMAL_NOTE: if(combination_note) vst_effects(handle,0|UNDERLINED); else vst_effects(handle,0); break; case FILLED_NOTE: if(combination_note) vst_effects(handle,OUTLINE|UNDERLINED); else vst_effects(handle,OUTLINE); break; case RELATIVE_NOTE: vst_effects(handle,SHADED|UNDERLINED); break; } /* draw as text */ if(cs->display_fretboard[loop1][cf]!=NO_NOTE) { np=cs->current_fretboard[loop1][cf]; sprintf(albuff,"%s",np->note_name); if(strlen(albuff)==1) v_gtext(handle,frets_x_offset+frets_length_times_loop2+half_fret_length-(tatts[6]/2), cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff); else v_gtext(handle,/*curx+frets_x_offset*/frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6], cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff); } vst_effects(handle,0); } else { combination_note=0; if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE) { combination_note=1; note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE; } else { note_val=cs->display_fretboard[loop1][cf]; } if(combination_note) { vsf_color(handle,BLACK); vsf_interior(handle,FIS_HOLLOW); vsf_style(handle,0); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius+2); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); } switch(note_val) { case NO_NOTE: break; case NORMAL_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,2); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break; case FILLED_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,FIS_SOLID); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); break; case RELATIVE_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,FIS_HOLLOW); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break; /* case COMMON_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,4); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height_and_frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break;*/ } } } } } graf_mouse(M_ON,NULL); #ifdef PRINTER_TEST v_clswk(handle); #endif }
/* ------------------ */ void set_font(void) { register int eo, i, font_nr, font_height; int tst_x, tst_y, xy[4], dummy; int minADE, maxADE, distance[5], effects[3], maxw; char font_names[4][34]; set_eline(); font_nr = akt_font; font_height = akt_fheight; rsrc_gaddr(ROOT, SET_FONT, &form_adr); for (i = 0; i < 4; i++) form_adr[FONT_1B + i].ob_spec.tedinfo->te_ptext = font_names[i]; form_adr[FONT_S].ob_state &= ~SELECTED; for (i = 0; i < 4; i++) { form_adr[FONT_1B + i].ob_state &= ~SELECTED; if (tfont_names[akt_id][i][0]) { strcpy(font_names[i], tfont_names[akt_id][i]); form_adr[FONT_1B + i].ob_state &= ~DISABLED; } else { strcpy(font_names[i], "-- Unbelegt --"); form_adr[FONT_1B + i].ob_state |= DISABLED; } } form_adr[FONT_S + font_nr - 1].ob_state |= SELECTED; form_draw(); objc_offset(form_adr, TST_FLD, &tst_x, &tst_y); xy[0] = tst_x; xy[1] = tst_y; xy[2] = xy[0] + form_adr[TST_FLD].ob_width - 2; xy[3] = xy[1] + form_adr[TST_FLD].ob_height - 2; vs_clip(vdi_handle, TRUE, xy); vswr_mode(vdi_handle, 1); vst_effects(vdi_handle, NORMAL); vst_alignment(vdi_handle, 0, 5, &dummy, &dummy); do { show_testtext(tst_x, tst_y, font_nr, font_height); vqt_fontinfo(vdi_handle, &minADE, &maxADE, distance, &maxw, effects); if (distance[4] < font_height) font_height = distance[4]; eo = form_do(form_adr, 0); switch(eo & 0x7FFF) { case FONT_S: case FONT_1B: case FONT_2B: case FONT_3B: case FONT_4B: if ((form_adr[eo & 0x7FFF].ob_state & DISABLED) || ((eo & 0x8000) && (eo & 0x7FFF) != FONT_S)) { eo &= 0x7FFF; if (load_font(eo - FONT_S + 1)) { font_nr = eo - FONT_S + 1; vqt_name(vdi_handle, 2, tfont_names[akt_id][eo - FONT_1B]); strcpy(font_names[eo - FONT_1B], tfont_names[akt_id][eo - FONT_1B]); form_adr[eo].ob_state &= ~DISABLED; for (i = 0; i < 5; i++) form_adr[FONT_S + i].ob_state &= ~SELECTED; form_adr[eo].ob_state |= SELECTED; strcpy(txt_fonts[akt_id][font_nr - 2], rindex(font_path, '\\') + 1); } objc_draw(form_adr, ROOT, MAX_DEPTH, fx, fy, fw, fh); } else font_nr = eo - FONT_S + 1; break; case GRT_UP: if (font_height > distance[4] - distance[2]) font_height--; break; case GRT_DWN: font_height++; break; } eo &= 0x7FFF; }while(eo != FONT_OK && eo != FONT_CNC); form_adr[eo & 0x7FFF].ob_state &= ~SELECTED; f_dial(FMD_SHRINK); f_dial(FMD_FINISH); get_eline(); if (eo == FONT_OK) { set_fontd(font_nr, font_height); akt_font = font_nr; akt_fheight = font_height; } vst_alignment(vdi_handle, 0, 3, &dummy, &dummy); }
static void ecrit_donnee(C_OBJ *obj, char *ligne, int x, int y, int wc, int hc, int *x1) { int dummy[10]; if (obj->spec.donnee.d_flag & 2) strcpy(ligne, "Externe "); else strcpy(ligne, ""); if (obj->spec.donnee.d_tab !=0) { strcat(ligne, "tableau de "); strcat(ligne, _ltoa(obj->spec.donnee.d_tab, dummy, 10)); strcat(ligne, " "); } if (obj->spec.donnee.d_flag & 8) strcat(ligne, "non sign‚ "); if (obj->spec.donnee.d_flag & 4) strcat(ligne, "long "); switch(obj->spec.donnee.d_type) { case t_int: strcat(ligne, "entier "); break; case t_char: strcat(ligne, "carac. "); break; case t_reel: strcat(ligne, "reŠl "); break; case t_nul: strcat(ligne, "nul "); break; case t_struct: strcat(ligne, "structure "); break; case t_union: strcat(ligne, "union "); break; case t_autre: if (obj->spec.donnee.d_autre) strcat(ligne, ((C_OBJ*)(obj->spec.donnee.d_autre))->spec.type.tt_nom); strcat(ligne, " "); break; } if (obj->spec.donnee.d_flag & 1) strcat(ligne, "*"); vst_effects(VDIhandle, 1); /* texte gras */ v_gtext (VDIhandle, *x1, y, ligne); /* Afficher la ligne */ *x1+=wc*strlen(ligne); if (obj->spec.donnee.d_nom) /* affiche le nom */ { vst_effects(VDIhandle, 0); /* texte normal */ v_gtext (VDIhandle, *x1, y, obj->spec.donnee.d_nom); /* Afficher la ligne */ *x1+=wc*strlen(obj->spec.donnee.d_nom); } if (obj->spec.donnee.d_vi) /* affiche la valeur initiale */ { vst_effects(VDIhandle, 0); /* texte normal */ strcpy(ligne, " = "); strcat(ligne, obj->spec.donnee.d_vi); v_gtext (VDIhandle, *x1, y, ligne); /* Afficher la ligne */ *x1+=wc*strlen(ligne); } }
void sendout(char *ps,int hand,short coll) { int junk; char *dp; int dolen=(int)strlen(ps); int lcount=0,offset=0; long effects=0; int eff[3],dist[5],cellw; int chof=0,howmany=0; BOOLEAN bd=FALSE; if(hand==-1)return; vst_font(ws.handle,(WORD)winfont); vst_point(ws.handle,(WORD)winpoint,&junk,&junk,&junk,&junk); dp=ps; dolen=(int)strlen(ps); eff[0]=0; vst_effects(ws.handle,0); while(offset<dolen){ vqt_width(ws.handle,*(dp+lcount),&cellw,&junk,&junk); cellw=cellw+eff[0]; if(*(dp+lcount)==2){ cellw=0; if(bd){bd=FALSE;eff[0]=0;} else{bd=TRUE; effects=THICKENED; vst_effects(ws.handle,effects); vqt_fontinfo(ws.handle,&junk,&junk,&dist[0],&junk,&eff[0]); } } if(*(dp+lcount)==3)cellw=0; if(*(dp+lcount)==15){cellw=0;bd=FALSE;eff[0]=0;} if(*(dp+lcount)==22)cellw=0; if(*(dp+lcount)==31)cellw=0; chof=chof+cellw; if(chof>wn[hand].wwa.g_w-NLW-1 || lcount>148){ wn[hand].clc[wn[hand].clcnt]=coll; stccpy(wn[hand].cl[wn[hand].clcnt++],dp,lcount+1); tlog(wn[hand].cl[wn[hand].clcnt-1]); if(wn[hand].clcnt==150)wn[hand].clcnt=0; cellw=0;chof=0;offset--; dp=dp+lcount; lcount=-1; howmany++; } offset++; lcount++; } if(strlen(dp)){ wn[hand].clc[wn[hand].clcnt]=coll; stccpy(wn[hand].cl[wn[hand].clcnt++],dp,lcount+1); tlog(wn[hand].cl[wn[hand].clcnt-1]); if(wn[hand].clcnt==150)wn[hand].clcnt=0; howmany++; } scrollup(hand,howmany); }
/******************************************************************************* 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; }
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; }
/******************************************************************************* 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; }
void specific_note_draw(ALWINDOW *alw, CURRENT_STATUS *cs,int specific_note) { register int loop1,loop2; int cf; short coord[4]; register int curx,cury; int half_fret_height=frets_height/2,half_fret_length=frets_length/2; register int circle_radius; int combination_note,note_val; int frets_length_times_loop2,half_fret_height_and_frets_y_offset; short tatts[10]; /* text attributes */ NOTE *np; char albuff[10]; #define draw(X1,Y1,X2,Y2); coord[0]=X1;coord[1]=Y1;coord[2]=X2;coord[3]=Y2;v_pline(handle,2,coord); scale_offsets(alw,&frets_x_offset,&frets_y_offset); frets_y_offset=frets_y_offset+big_y_offset; half_fret_height_and_frets_y_offset=half_fret_height+frets_y_offset; if(frets_length>frets_height) circle_radius=(frets_height/2)-1-2; else circle_radius=(frets_length/2)-1-2; vqt_attributes(handle,tatts); wclip(alw); graf_mouse(M_OFF,NULL); for(loop2=0;loop2<global_frets && loop2+start_fret<global_frets;loop2++) { frets_length_times_loop2=frets_length*loop2; for(loop1=0;loop1<6;loop1++) { cf=loop2+start_fret; curx=(loop2*frets_length); cury=(loop1*frets_height); if(cs->current_fretboard[loop1][cf]->number==specific_note) { /* vsf_color(handle,WHITE); vsf_interior(handle,FIS_SOLID); vsf_style(handle,1); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius+2); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); */ /* Wipe out the old note */ coord[0]=curx+frets_x_offset+1; coord[1]=cury+frets_y_offset; coord[2]=curx+frets_x_offset+frets_length-1; coord[3]=cury+frets_height+frets_y_offset; vsf_color(handle,WHITE); vsf_interior(handle,FIS_SOLID); vsf_style(handle,1); vr_recfl(handle,coord); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); /* if the current fret is 0 then it is the open notes only draw the string if it is not the open note */ if(cf!=0) { draw(curx+frets_x_offset, cury+half_fret_height+frets_y_offset, curx+frets_length+frets_x_offset, cury+half_fret_height+frets_y_offset); } /* draw the note */ if(text_notes==1) { combination_note=0; if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE) { combination_note=1; note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE; } else { note_val=cs->display_fretboard[loop1][cf]; } switch(note_val) { case NO_NOTE: break; case NORMAL_NOTE: if(combination_note) vst_effects(handle,0|UNDERLINED); else vst_effects(handle,0); break; case FILLED_NOTE: if(combination_note) vst_effects(handle,OUTLINE|UNDERLINED); else vst_effects(handle,OUTLINE); break; case RELATIVE_NOTE: vst_effects(handle,UNDERLINED); break; } /* draw as text */ if(cs->display_fretboard[loop1][cf]!=NO_NOTE) { np=cs->current_fretboard[loop1][cf]; sprintf(albuff,"%s",np->note_name); if(strlen(albuff)==1) v_gtext(handle,frets_x_offset+frets_length_times_loop2+half_fret_length-(tatts[6]/2), cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff); else v_gtext(handle,/*curx+frets_x_offset*/frets_x_offset+(frets_length_times_loop2)+half_fret_length-tatts[6], cury+half_fret_height_and_frets_y_offset+(tatts[7]/2)/*cury+frets_y_offset+frets_height*/,albuff); } vst_effects(handle,0); } else { combination_note=0; if(cs->display_fretboard[loop1][cf]>RELATIVE_NOTE) { combination_note=1; note_val=cs->display_fretboard[loop1][cf]-RELATIVE_NOTE; } else { note_val=cs->display_fretboard[loop1][cf]; } if(combination_note) { vsf_color(handle,BLACK); vsf_interior(handle,FIS_HOLLOW); vsf_style(handle,0); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius+2); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); } switch(note_val) { case NO_NOTE: /* vsf_color(handle,WHITE); vsf_interior(handle,FIS_SOLID); vsf_style(handle,1); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); if(cf!=0) { draw(curx+frets_x_offset, cury+half_fret_height+frets_y_offset, curx+frets_length+frets_x_offset, cury+half_fret_height+frets_y_offset); }*/ break; case NORMAL_NOTE: /* if(cf!=0) { draw(curx+frets_x_offset, cury+half_fret_height+frets_y_offset, curx+frets_length+frets_x_offset, cury+half_fret_height+frets_y_offset); } */ vsf_color(handle,BLACK); vsf_interior(handle,2); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break; case FILLED_NOTE: /* if(cf!=0) { draw(curx+frets_x_offset, cury+half_fret_height+frets_y_offset, curx+frets_length+frets_x_offset, cury+half_fret_height+frets_y_offset); } */ vsf_color(handle,BLACK); vsf_interior(handle,FIS_SOLID); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius); vsf_color(handle,BLACK); break; case RELATIVE_NOTE: /* if(cf!=0) { draw(curx+frets_x_offset, cury+half_fret_height+frets_y_offset, curx+frets_length+frets_x_offset, cury+half_fret_height+frets_y_offset); } */ vsf_color(handle,BLACK); vsf_interior(handle,FIS_HOLLOW); vsf_style(handle,0); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break; /* case COMMON_NOTE: vsf_color(handle,BLACK); vsf_interior(handle,4); vsf_style(handle,2); alcircle(handle, curx+half_fret_length+frets_x_offset, cury+half_fret_height+frets_y_offset, circle_radius); vsf_color(handle,BLACK); vsf_interior(handle,8); vsf_style(handle,2); break; */ } } } } } graf_mouse(M_ON,NULL); }
/******************************************************************************* 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; }
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 ); }