int fnt_point(int height, int *cw, int *ch) { int dummy, r; r = vst_point(vdi_handle, height, &dummy, &dummy, &dummy, ch); vqt_width(vdi_handle, ' ', cw, &dummy, &dummy); return r; }
int clchar() { short xy[8],cellw,junk2,junk3=0; short mcto; if(cwin==-1)return 0; junk3=findcurpos(); vqt_width(ws.handle,*(wn[cwin].inp+junk3-1),&cellw,&junk2,&junk2); mcto=fdtc(); xy[0]=wn[cwin].wwa.g_x+mcto;xy[1]=wn[cwin].wwa.g_y+wn[cwin].wwa.g_h-ith/8*7-1; xy[2]=wn[cwin].wwa.g_x+mcto-cellw;xy[3]=wn[cwin].wwa.g_y+wn[cwin].wwa.g_h-ith/8*7-1; xy[4]=wn[cwin].wwa.g_x+mcto-cellw;xy[5]=wn[cwin].wwa.g_y+wn[cwin].wwa.g_h-ith/4-1; xy[6]=wn[cwin].wwa.g_x+mcto;xy[7]=wn[cwin].wwa.g_y+wn[cwin].wwa.g_h-ith/4-1; v_fillarea(ws.handle,4,xy); return 0; }
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; }
void fnt_mdialog(int ap_id, int win, int id, int size, int color, int effect, int prop) { FNT_DIALOG *fnt_dial; char name[34]; int i; OBJECT *o = &wdfont[WDFTEXT]; if ((fnt_dial = malloc(sizeof(FNT_DIALOG))) == NULL) { xform_error(ENSMEM); return; } if ((fnt_dial->fd = malloc((nfonts + 1) * sizeof(FONTDATA))) == NULL) { free(fnt_dial); xform_error(ENSMEM); return; } fnt_dial->userblock.fnt_dial = fnt_dial; fnt_dial->userblock.text = (char *) o->ob_spec.index; fnt_dial->userblock.userblock.ub_code = mdraw_text; fnt_dial->userblock.userblock.ub_parm = (long) &fnt_dial->userblock; o->ob_type = (o->ob_type & 0xFF00) | G_USERDEF; o->ob_spec.userblk = &fnt_dial->userblock.userblock; rsc_title(wdfont, WDFTITLE, DTVFONT); fnt_dial->ap_id = ap_id; /* Application id of caller. */ fnt_dial->win = win; /* Window id of caller. */ fnt_dial->color = color; /* Color of font. */ fnt_dial->effect = effect; /* Text effects of font. */ fnt_dial->nf = 0; for (i = 0; i <= nfonts; i++) { FONTDATA *h = &fnt_dial->fd[fnt_dial->nf]; int j, iw, mw, dummy; char *s = h->name; FONT fnt; h->id = vqt_name(vdi_handle, i + 1, name); fnt_setfont(h->id, 10, &fnt); vqt_width(vdi_handle, 'i', &iw, &dummy, &dummy); vqt_width(vdi_handle, 'm', &mw, &dummy, &dummy); if ((prop != FALSE) || (iw == mw)) { strsncpy(s, name, sizeof(h->name)); /* HR 120203: secure cpy */ j = (int) strlen(h->name); while (j < 16) s[j++] = ' '; h->flag = (int) name[32]; fnt_dial->nf++; } } fnt_dial->sl_info.slider.type = 0; fnt_dial->sl_info.slider.up_arrow = WDFUP; fnt_dial->sl_info.slider.down_arrow = WDFDOWN; fnt_dial->sl_info.slider.slider = FSLIDER; fnt_dial->sl_info.slider.sparent = FSPARENT; fnt_dial->sl_info.slider.lines = NLINES; fnt_dial->sl_info.slider.n = fnt_dial->nf; fnt_dial->sl_info.slider.line = set_font(&fnt_dial->sl_info.slider, id, &fnt_dial->font, fnt_dial->fd, fnt_dial->nf); fnt_dial->sl_info.slider.set_selector = mset_selector; fnt_dial->sl_info.slider.first = WDFONT1; fnt_dial->sl_info.slider.findsel = mfind_selected; fnt_dial->sl_info.fnt_dial = fnt_dial; fnt_dial->cursize = get_size(fnt_dial->font, fnt_dial->fd, fnt_dial->fsizes, &fnt_dial->nfsizes, size); fnt_dial->fsize = fnt_dial->fsizes[fnt_dial->cursize]; sl_init(wdfont, &fnt_dial->sl_info.slider); xd_nmopen(wdfont, &fnt_dial->dialog, &fnt_funcs, 0, -1, -1, NULL, NULL, FALSE, "Font selector"); }
boolean fnt_dialog(int title, FONT *wd_font, boolean prop) { char name[34]; int button, i, newfont, curobj, cursize, fsizes[100], nfsizes; XDINFO info; SLIDER sl_info; boolean stop = FALSE, ok = FALSE; OBJECT *o = &wdfont[WDFTEXT]; static USERBLK userblock; if ((fd = malloc((nfonts + 1) * sizeof(FONTDATA))) == NULL) { xform_error(ENSMEM); return FALSE; } if (o->ob_type != G_USERDEF) xd_userdef(o, &userblock, draw_text); rsc_title(wdfont, WDFTITLE, title); nf = 0; for (i = 0; i <= nfonts; i++) { FONTDATA *h = &fd[nf]; int j, iw, mw, dummy; char *s = h->name; FONT fnt; h->id = vqt_name(vdi_handle, i + 1, name); fnt_setfont(h->id, 10, &fnt); vqt_width(vdi_handle, 'i', &iw, &dummy, &dummy); vqt_width(vdi_handle, 'm', &mw, &dummy, &dummy); if ((prop != FALSE) || (iw == mw)) { strsncpy(s, name, sizeof(h->name)); /* HR 120203: secure cpy */ j = (int) strlen(h->name); while (j < 16) s[j++] = ' '; h->flag = (int) name[32]; nf++; } } sl_info.type = 0; sl_info.up_arrow = WDFUP; sl_info.down_arrow = WDFDOWN; sl_info.slider = FSLIDER; sl_info.sparent = FSPARENT; sl_info.lines = NLINES; sl_info.n = nf; sl_info.line = set_font(&sl_info, wd_font->id, &font, fd, nf); sl_info.set_selector = set_selector; sl_info.first = WDFONT1; sl_info.findsel = find_selected; fsize = fsizes[cursize = get_size(font, fd, fsizes, &nfsizes, wd_font->size)]; sl_init(wdfont, &sl_info); xd_open(wdfont, &info); while (stop == FALSE) { button = sl_form_do(wdfont, 0, &sl_info, &info) & 0x7FFF; switch (button) { case WDFONT1: case WDFONT2: case WDFONT3: case WDFONT4: case WDFONT5: case WDFONT6: curobj = font - sl_info.line + WDFONT1; if (((newfont = sl_info.line + button - WDFONT1) < nf) && (curobj != button)) { if ((curobj >= WDFONT1) && (curobj <= WDFONT6)) xd_change(&info, curobj, NORMAL, 1); xd_change(&info, button, SELECTED, 1); font = newfont; fsize = fsizes[cursize = get_size(font, fd, fsizes, &nfsizes, fsize)]; xd_draw(&info, WDFTEXT, 1); xd_draw(&info, WDFSIZE, 1); } break; case WDFSUP: if (cursize < nfsizes - 1) { cursize++; goto cont; } xd_change(&info, button, NORMAL, 1); break; case WDFSDOWN: if (cursize > 0) { cursize--; cont:fsize = fsizes[cursize]; itoa(fsize, wdfont[WDFSIZE].ob_spec.free_string, 10); xd_draw(&info, WDFTEXT, 1); xd_draw(&info, WDFSIZE, 1); } xd_change(&info, button, NORMAL, 1); break; case WDFOK: if ((fd[font].id != wd_font->id) || (fsize != wd_font->size)) { wd_font->id = fd[font].id; wd_font->size = fsize; wd_font->cw = chw; wd_font->ch = chh; ok = TRUE; } default: stop = TRUE; break; } } xd_change(&info, button, NORMAL, 0); xd_close(&info); free(fd); return ok; }
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; }
int inputprocess(){ int junk,junk2,cellw,rfoff=0,lcount=0,wl; char aflag=FALSE; char *dp; int sff=0; char temps[2048]; if(cwin==-1)return 0; wind_get(wn[cwin].hand,WF_TOP,&junk,&junk2,&junk2,&junk2); if(cwin!=-1 && wn[cwin].stat!=WMDONTWRITE && junk==wn[cwin].hand){ strcpy(chinp,"\0"); sprintf(chinp,"%c",kreturn); if(wn[cwin].scb){sbvslid(1000);wn[cwin].scb=0;} if(!strncmp("\b",chinp,1) && inpbcontents()){ vst_font(ws.handle,(WORD)inpfont); vst_point(ws.handle,(WORD)inppoint,&junk2,&junk2,&junk2,&junk2); clcursor(cwin); junk2=findcurpos(); stccpy(temps,wn[cwin].inp,junk2); strcat(temps,wn[cwin].inp+junk2); strcpy(wn[cwin].inp,temps); if(wn[cwin].cx>0){wn[cwin].cx--;} else{ if(wn[cwin].cvof!=0){ wn[cwin].cvof--;wn[cwin].cx=wn[cwin].ihc[wn[cwin].cvof]-1;} } wl=wn[cwin].cvof; junk2=wn[cwin].cvof-1; while(junk2>-1){ rfoff=rfoff+wn[cwin].ihc[junk2]; junk2--; } dp=wn[cwin].inp+rfoff; if(rfoff==strlen(wn[cwin].inp)){wn[cwin].ihc[wl]=0; wn[cwin].iof[wl]=0; } else{ while(rfoff<strlen(wn[cwin].inp)){ vqt_width(ws.handle,*(dp+lcount),&cellw,&junk2,&junk2); if(sff+cellw>wn[cwin].wwa.g_w){ wn[cwin].ihc[wl]=lcount; wn[cwin].iof[wl]=sff; dp=dp+lcount; lcount=-1; sff=0; wl++; cellw=0; } sff=sff+cellw; lcount++; rfoff++; } wn[cwin].ihc[wl]=lcount; wn[cwin].iof[wl]=sff; } ipbredraw(cwin); strcpy(chinp,"\0"); aflag=TRUE; } if(!strncmp("\b",chinp,1) && !inpbcontents()){ strcpy(chinp,"\0"); aflag=TRUE; } if(strlen(wn[cwin].inp)>511){flag=TRUE;} if(!strncmp("\r",chinp,1)){ aflag=TRUE; strcpy(chinp,"\0"); gotcmd(); clearipb(cwin); docursor(cwin); } if(!aflag){ clcursor(cwin); wtib(chinp,aflag); docursor(cwin); strcpy(chinp,"\0"); } } return 0; }
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); }