void draw_main_labels (int app_handle, char * title, char * x_label, char * y_label, int x, int y, int w, int h, int y_value_width) { int offset; int char_w, char_h, cell_w, cell_h; vsf_color (app_handle, BLACK); vst_point (app_handle, TITLE_FONT, &char_w, &char_h, &cell_w, &cell_h); offset = cell_w * (w/cell_w - strlen(title))/2; if (offset < 0) offset = 0; v_gtext (app_handle, x + offset, y-h-cell_h, title); vst_point (app_handle, AXES_TITLE_FONT, &char_w, &char_h, &cell_w, &cell_h); offset = cell_w * (w/cell_w - strlen(x_label))/2; if (offset < 0) offset = 0; v_gtext (app_handle, x + offset, y+2*cell_h, x_label); offset = cell_h * (h/cell_h - strlen(y_label))/2; if (offset < 0) offset = 0; vst_rotation (app_handle, 900); v_gtext (app_handle, x-(y_value_width+1)*cell_w, y-offset, y_label); vst_rotation (app_handle, 0); }
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; }
static void ob_text(XA_TREE *wt, RECT *r, RECT *o, OBJC_COLOURS *c, char *t, int state, int und) { if (t) if (*t) { OBJECT *ob = wt->tree + wt->current; bool fits = !o or (o and (o->h >= r->h - (d3_foreground(ob) ? 4 : 0))); /* HR 300602 */ if (c) /* set according to circumstances. */ { /* HR 051002: more restrictions */ if ( c->opaque and !MONO and d3_any(ob) and ( c->pattern eq IP_HOLLOW or ( c->pattern eq IP_SOLID and c->fillc eq WHITE ) ) ) { f_color(screen.dial_colours.bg_col); wr_mode(MD_REPLACE); gbar(0, o ? o : r); wr_mode(MD_TRANS); } else wr_mode(c->opaque ? MD_REPLACE : MD_TRANS); } if (!MONO and (state&DISABLED) != 0) { done(DISABLED); if (fits) { t_color(screen.dial_colours.lit_col); v_gtext(C.vh, r->x+1, r->y+1, t); t_color(screen.dial_colours.shadow_col); } } if (fits) v_gtext(C.vh, r->x, r->y, t); /* Now underline the shortcut character, if any. */ if (und >= 0) { int l = strlen(t); if (und < l) { G_i x = r->x + und*screen.c_max_w, y = r->y + screen.c_max_h - 1; line(x, y, x + screen.c_max_w - 1, y, RED); } } } }
/* ----------------------- */ void show_testtext(int xpos, int ypos, int font_nr, int font_hg) { int dummy, height; vst_font(vdi_handle, font_nr); vst_height(vdi_handle, font_hg, &dummy, &dummy, &dummy, &height); v_gtext(vdi_handle, xpos, ypos + height, " "); v_gtext(vdi_handle, xpos, ypos, "Testtext "); }
show_msg(int stat) { if ((_AccFlag) && (para.multi == MULTIJA)) { if (!stat) v_gtext(handle,640-12*8,13,"COMPLETED "); else v_gtext(handle,640-12*8,13,"CANCELED "); } }
void display_score( void ) { char s[256]; sprintf(s, "Your Score: %8ld points",score ); v_gtext( handle, 16, 40+(HEIGHT*16), s ); sprintf(s, "Highscore : %8ld points by %s ",hiscore, hiname ); v_gtext( handle, 16, 56+(HEIGHT*16), s ); }
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); } }
static void OnDraw(void *wnd, int xywh[4]) { GEM_WINDOW *gwnd = (GEM_WINDOW *) wnd ; HEX_DUMP *hex_dump = (HEX_DUMP *) gwnd->Extension ; char *txt ; int x, y, w, h ; int htline ; long line, sline, eline, char_offset ; set_texttype( &hex_dump->ttype ) ; vswr_mode( handle, MD_REPLACE ) ; sline = eline = hex_dump->ystart ; htline = hex_dump->h_char + hex_dump->interline ; GWGetWorkXYWH( gwnd, &x, &y, &w, &h ) ; sline += ( xywh[1] - y ) / htline ; eline += ( xywh[1] - y + xywh[3] - 1 ) / htline ; y += (int)(sline - hex_dump->ystart) * htline ; char_offset = ( xywh[0] - x ) / hex_dump->w_char ; x += (int)char_offset * hex_dump->w_char ; if ( ( hex_dump->ycursor >= sline ) && ( hex_dump->ycursor <= eline ) ) ShowCursor( gwnd, 0 ) ; for ( line = sline; line <= eline; line++, y += htline ) { txt = (char*) hex_dump->formatted_txt[line-hex_dump->ystart] ; txt += char_offset ; v_gtext( handle, x, y, txt ) ; } }
main() { int i; init_screens (); /* Initialisiation du 2Šme ‚cran */ gem_init(); /* Se trouve dans fichier Include GEM_INEX.C */ v_hide_c (handle); /* D‚sactiver pointeur souris */ for (i=20; i<=300; i++) { Cconws ("\33E"); /* Effacer ‚cran */ v_gtext (handle, i, i, "Salut!"); /* Affichage texte sous GEM */ swap_screens (); /* Commuter ‚crans log./phys. */ Vsync(); /* Attente retour image */ } Crawcin(); /* Attente appui touche */ Setscreen (screen1, screen1, -1); /* Retour … l'‚cran normal */ v_show_c (handle, 1); /* Pointeur souris actif */ gem_exit(); }
draw_dial(int bnr, int ret, int st) { char bbb[5]; switch(st) { case ACK: strcpy((char *)transfer[STATUS].ob_spec,"ACK"); break; case NAK: strcpy((char *)transfer[STATUS].ob_spec,"NAK"); break; case CHK: strcpy((char *)transfer[STATUS].ob_spec,"CHK"); break; case -1: strcpy((char *)transfer[STATUS].ob_spec,"TIMOUT"); break; default: strcpy((char *)transfer[STATUS].ob_spec,"???"); } if ((!_AccFlag) || (para.multi==MULTINE)) { strcpy((char *)transfer[BLOCKNUM].ob_spec,itoas(bnr,4,bbb,0)); strcpy((char *)transfer[RETRIES].ob_spec,itoas(ret,4,bbb,0)); objc_draw(transfer,REDRAWTF,2,x,y,w,h); } else { itoas(bnr,4,msg,1); itoas(ret,2,&msg[5],1); strcpy(&msg[8],(char *)transfer[STATUS].ob_spec); msg[12]=0; v_gtext(handle,640-12*8,13,msg); } }
static int cdecl mdraw_text(PARMBLK *pb) { int x, y, extent[8]; RECT r; FNT_DIALOG *fnt_dial = ((FNT_USERBLK *) pb->pb_parm)->fnt_dial; char *text = ((FNT_USERBLK *) pb->pb_parm)->text; xd_clip_on(&pb->c); set_txt_default(fnt_dial->fd[fnt_dial->font].id, fnt_dial->fsize); fnt_point(fnt_dial->fsize, &fnt_dial->chw, &fnt_dial->chh); clear(&pb->r); xd_rcintersect(&pb->r, &pb->c, &r); xd_clip_on(&r); vqt_extent(vdi_handle, text, extent); x = pb->r.x + (pb->r.w - extent[2] + extent[0] - 1) / 2; y = pb->r.y + (pb->r.h - extent[7] + extent[1] - 1) / 2; v_gtext(vdi_handle, x, y, text); xd_clip_off(); return 0; }
static int cdecl draw_text(PARMBLK *pb) { int x, y, extent[8]; RECT r; xd_clip_on(&pb->c); set_txt_default(fd[font].id, fsize); fnt_point(fsize, &chw, &chh); clear(&pb->r); xd_rcintersect(&pb->r, &pb->c, &r); xd_clip_on(&r); vqt_extent(vdi_handle, (char *) pb->pb_parm, extent); x = pb->r.x + (pb->r.w - extent[2] + extent[0] - 1) / 2; y = pb->r.y + (pb->r.h - extent[7] + extent[1] - 1) / 2; v_gtext(vdi_handle, x, y, (char *) pb->pb_parm); xd_clip_off(); return 0; }
short draw_multiline(PARMBLK *parmblock) { GRECT clip_area; short sizing = 4; //Set up clipping OUTPUT_WINDOW *window = (OUTPUT_WINDOW*)parmblock->pb_parm; short handle = window->workstation; char buffer[255]; short last_index = 0; short draw_region[4] = { parmblock->pb_x, parmblock->pb_y, parmblock->pb_x + parmblock->pb_w, parmblock->pb_y + parmblock->pb_h }; short clip_region[4] = { parmblock->pb_xc, parmblock->pb_yc, parmblock->pb_xc + parmblock->pb_wc, parmblock->pb_yc + parmblock->pb_hc }; vs_clip(handle, 1, clip_region); vsf_interior(handle, 1); //vsf_color(handle, 6); //vr_recfl(handle, draw_region); // clear entire message area vsl_color(handle, 1); vst_height(handle, sizing, &sizing, &sizing, &sizing, &sizing); short position = 6; while (tokenize_multiline(buffer, window->text, parmblock->pb_w, sizing, &last_index)) { v_gtext(handle, parmblock->pb_x, parmblock->pb_y + position, buffer); position += sizing; } vs_clip(handle, 0, clip_region); return 0; }
void draw_example (int app_handle, struct win_data * wd, int x, int y, int w, int h) { int i = 0; int lines_to_ignore = wd->vert_posn; int cur_y = y + wd->cell_h; wd->lines_shown = 0; wd->colns_shown = 0; while (wd->poem[i] != 0) { if (lines_to_ignore == 0) { v_gtext (app_handle, x+wd->cell_w*(1-wd->horz_posn), cur_y, wd->poem[i]); if (strlen(wd->poem[i])+2 > wd->colns_shown) { wd->colns_shown = strlen (wd->poem[i]) + 2; } cur_y += wd->cell_h; } else { lines_to_ignore -= 1; } wd->lines_shown += 1; i = i + 1; } }
open_dial(int flag) { static int x,y,w,h; if ((!_AccFlag) || (para.multi==MULTINE)){ if(flag) { strcpy((char *)transfer[BLOCKNUM].ob_spec,"0001"); strcpy((char *)transfer[STATUS].ob_spec,"---"); strcpy((char *)transfer[RETRIES].ob_spec,"0001"); form_center(transfer,&x,&y,&w,&h); form_dial(0,0,0,0,0,x,y,w,h); objc_draw(transfer,0,8,x,y,w,h); } else form_dial(3,0,0,0,0,x,y,w,h); } else { if (flag) { wind_up(0); strcpy(msg,"0001 01 ---"); v_gtext(handle,640-12*8,13,msg); } else wind_up(1); was_full=0;Bconout(2,7); } }
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); } }
static void g_text(XA_TREE *wt, RECT r, RECT *o, char *text, int state) { /* HR: only center the text. ;-) */ r.y += (r.h-screen.c_max_h) / 2; if (!MONO and (state&DISABLED) != 0) { t_color(screen.dial_colours.lit_col); v_gtext(C.vh, r.x+1, r.y+1, text); t_color(screen.dial_colours.shadow_col); v_gtext(C.vh, r.x, r.y, text); done(DISABLED); othw t_color(menu_dis_col(wt)); /* HR */ ob_text(wt, &r, o, nil, text, 0, (state&WHITEBAK) ? (state>>8)&0x7f : -1); if (state&DISABLED) { write_disable(&wt->r, screen.dial_colours.bg_col); done(DISABLED); } }
int updinpak() { char *point; char temps[2048]; startupdate(); point=wn[cwin].inp+findcurpos()-1; stccpy(temps,point,wn[cwin].ihc[wn[cwin].cvof]-wn[cwin].cx); vswr_mode(ws.handle,MD_TRANS); v_gtext(ws.handle,wn[cwin].wwa.g_x+fdtc(),wn[cwin].wwa.g_y+wn[cwin].wwa.g_h-1,temps); finishupdate(); return 0; }
/* display numeric range and tick marks of y-axis */ void draw_y_axis_labels (int app_handle, int min_y, int max_y, int x, int y, int h) { char str[20]; int pxy[4]; int i; int char_w, char_h, cell_w, cell_h; int range = max_y - min_y; vsf_color (app_handle, BLACK); vst_point (app_handle, AXES_LABEL_FONT, &char_w, &char_h, &cell_w, &cell_h); vsl_width (app_handle, 1); /* print 2,3,5 or 9 values on y-axis, depending on space available */ if (h > 3 * cell_h) { /* print lower and top values in most cases */ pxy[0] = x; pxy[1] = y; pxy[2] = x-5; pxy[3] = y; v_pline (app_handle, 2, pxy); sprintf (str, "%d", min_y); v_gtext (app_handle, pxy[2]-strlen(str)*cell_w, pxy[3]+cell_h/2, str); pxy[0] = x; pxy[1] = y-h; pxy[2] = x-5; pxy[3] = pxy[1]; sprintf (str, "%d", max_y); v_pline (app_handle, 2, pxy); v_gtext (app_handle, pxy[2]-strlen(str)*cell_w, pxy[3]+cell_h/2, str); } if (h > 10 * cell_h) { /* print remaining labels depending on space available */ draw_intermediate_y_labels (app_handle, 8, min_y, max_y, x, y, h, cell_w, cell_h); } else if (h > 6 * cell_h) { draw_intermediate_y_labels (app_handle, 4, min_y, max_y, x, y, h, cell_w, cell_h); } else if (h > 4 * cell_h) { draw_intermediate_y_labels (app_handle, 2, min_y, max_y, x, y, h, cell_w, cell_h); } }
main() { gem_init(); v_gtext (handle, 0, 14, "Tapez une touche. Si vous n'avez pas tap‚ de touche dans"); v_gtext (handle, 0, 30, "3 secondes, le programme "); v_gtext (handle, 0, 46, "s'arrˆtera."); which = evnt_multi (33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0L, 3000, 0, &dummy, &dummy, &dummy, &dummy, &touche, &dummy); if (which == 1) v_gtext (handle, 0, 80, "Taper une touche pour quitter"); else v_gtext (handle, 0, 80, "Arrˆt dans 3 secondes"); Crawcin(); /* Attendre touche */ gem_exit(); }
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 aff_text(char *text, int x, int y, int color) { TEXT_TYPE old_ttype ; memcpy( &old_ttype, &ttype, sizeof(TEXT_TYPE) ) ; ttype.angle = 0 ; ttype.color = color ; ttype.attribute = 0 ; /* ttype.font = 1 ; SystŠme */ /* ttype.hcar = 6 ;*/ set_texttype( &ttype ) ; vswr_mode( handle, MD_TRANS ) ; v_gtext( handle, x, y, text ) ; memcpy( &ttype, &old_ttype, sizeof(TEXT_TYPE) ) ; set_texttype( &ttype ) ; }
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)); }
/* draw the specified number of intermediate y labels, equally spaced */ void draw_intermediate_y_labels (int app_handle, int number, int min_y, int max_y, int x, int y, int h, cell_w, cell_h) { int i; int pxy[4]; char str[20]; for (i=1; i<=number; i += 1) { int val = min_y + (max_y-min_y) * i / number; pxy[0] = x; pxy[1] = y - rescale (val, min_y, max_y, h); pxy[2] = x-5; pxy[3] = pxy[1]; sprintf (str, "%d", val); v_pline (app_handle, 2, pxy); v_gtext (app_handle, pxy[2]-strlen(str)*cell_w, pxy[3]+cell_h/2, str); } }
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 ); }
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); }
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; }
/******************************************************************************* 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; }