void ReadWriteTextarea(char sw) { struct HTMLrecord *aptr=(struct HTMLrecord *)ie_getswap(focusedatom); char fname[80]; if(aptr) { memcpy(&activeatom,aptr,sizeof(struct HTMLrecord)); activeatomptr=&activeatom; activeadr=focusedatom; getTXTprompt(fname,79); editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr); if(editorptr) { memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor)); if(sw==INPUT_READFILE) { ie_insblock(&tmpeditor,fname); editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr); if(editorptr) { memcpy(editorptr,&tmpeditor,sizeof(struct ib_editor)); swapmod=1; } else MALLOCERR(); } else { strcpy(tmpeditor.filename,fname); outs(MSG_WRITE); ie_savef(&tmpeditor); } } else MALLOCERR(); redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL); activeatomptr=&activeatom; activeadr=focusedatom; activeatomcursor(1); }//end if pointer exists - else "nonfatal error" }
void MemInfo(char forced) { #ifndef TEXTONLY char str[30]; unsigned long ldsp; int y=endvtoolbar(); int color; long value; if(forced && meminfovisible) { if(arachne.framescount) { p->activeframe=0; redrawHTML(REDRAW_NO_MESSAGE,REDRAW_CREATE_VIRTUAL); } else redrawHTML(REDRAW_WITH_MESSAGE,REDRAW_VIRTUAL); meminfovisible=0; return; } if((x_maxx()<640 || arachne.GUIstyle || fullscreen || customerscreen || fixedfont) /*fixedfont=printing hack*/ && !forced) return; if(arachne.GUIstyle) meminfovisible=1; mouseoff(); y+=2; Box3D(x_maxx()-150,y,x_maxx()-1,x_maxy()-17); y+=1; htmlfont(0,NORMAL); if(forced && lastinfo && endvtoolbar()>=x_maxy()-14*(fonty(0,NORMAL)-1)) goto moreinfo; #ifndef POSIX //DOS memory value=farcoreleft();//>>10; //!!glennmcc Oct 09, 2004 don't round off to KB sprintf(str,"%4lu",value); if(value<50000l || memory_model==0) { color=2; strcat(str,"[!!!]"); } else if(memory_model==2) { color=3; strcat(str,"[+]"); } else { color=0; strcat(str,"[?]"); } MemInfoLine("Dos mem",str,color,&y);//!!glennmcc Oct 09, 2004 don't round off to KB //XMS used sprintf(str,"%5lu",mem_all_xmem()); MemInfoLine("Used XMS (KB)",str,0,&y); #endif//posix //XSWAP free ldsp=ie_free()>>10; sprintf(str,"%4ld",ldsp); if(ldsp<500) { color=2; strcat(str,"[!!!]"); } else color=0; MemInfoLine("Free xSwap (KB)",str,color,&y); //XSWAP used sprintf(str,"%4ld",ie_used()>>10); MemInfoLine("Used xSwap (KB)",str,0,&y); #ifndef POSIX //disk space //!!glennmcc: Nov 25, 2005 -- check space on the cache drive //and the current drive .... display both when not the same drive //when cache is on local drive, display only one #ifndef NOKEY { ldsp=lastdiskspace(configvariable(&ARACHNEcfg,"CachePath",NULL))>>20; //local & cache /**/ if(ldsp==(localdiskspace()>>20)) sprintf(str,"%4lu",ldsp); else sprintf(str,"%4lu %4lu",localdiskspace()>>20,ldsp); /**/ //temp & cache /* if(ldsp==(lastdiskspace(getenv("TEMP"))>>20)) sprintf(str,"cache_%4lu",ldsp); else sprintf(str,"temp_%4lu cache_%4lu",lastdiskspace(getenv("TEMP"))>>20,ldsp); */ }
//search in HTML document void SearchString(void) { struct HTMLrecord HTMLatom,foundatom; unsigned currentHTMLatom=p->firstonscr,foundHTMLatom,nextHTMLatom; struct HTMLframe *frame=&(p->htmlframe[p->activeframe]); long minY=0l; char *str,*tmp,*foundstr,*ptr,found=0; struct HTMLrecord *atomptr; str=farmalloc(IE_MAXLEN+2); tmp=farmalloc(IE_MAXLEN+2); foundstr=farmalloc(IE_MAXLEN+2); if(!str || !tmp || !foundstr) memerr(); getTXTprompt(str,IE_MAXLEN); if(p->HTMLatomcounter>1000) { sprintf(tmp,MSG_SRCH1,str); outs(tmp); } strlwr(str); while(currentHTMLatom!=IE_NULL) { // kbhit(); atomptr=(struct HTMLrecord *)ie_getswap(currentHTMLatom); if(!atomptr) MALLOCERR(); nextHTMLatom=atomptr->next; if(atomptr->type==TEXT && atomptr->frameID==p->activeframe && atomptr->y>=frame->posY) { memcpy(&HTMLatom,atomptr,sizeof(struct HTMLrecord)); ptr=ie_getswap(atomptr->ptr); if(!ptr) MALLOCERR(); strcpy(tmp,ptr); //tmp[IE_MAXLEN]='\0'; strlwr(tmp); if(strstr(tmp,str) && HTMLatom.y>frame->posY && lastfound!=currentHTMLatom && (lastfoundY<HTMLatom.y || lastfoundY==HTMLatom.y && lastfoundX<HTMLatom.x) && (!found || HTMLatom.y<minY)) { minY=HTMLatom.y; memcpy(&foundatom,&HTMLatom,sizeof(struct HTMLrecord)); makestr(foundstr,ptr,IE_MAXLEN); foundHTMLatom=currentHTMLatom; found=1; if(foundHTMLatom==p->firstHTMLatom) break; } } currentHTMLatom=nextHTMLatom; }//loop if(found) { if(foundatom.yy>frame->posY+frame->scroll.ysize) { frame->posY=foundatom.y-FUZZYPIX; if(frame->posY+frame->scroll.ysize>frame->scroll.total_y) frame->posY=frame->scroll.total_y-frame->scroll.ysize; if(frame->posY<0) frame->posY=0; } if(foundatom.xx>frame->posX+frame->scroll.xsize || foundatom.x<frame->posX) { frame->posX=foundatom.x; if(frame->posX+frame->scroll.xsize>frame->scroll.total_x) frame->posX=frame->scroll.total_x-frame->scroll.xsize; } //!!glennmcc: Sep 21, 2007 -- place pointer at new postion #ifdef CAV ImouseSet((int)foundatom.x,(int)foundatom.y); #endif //!!glennmcc: end if(arachne.framescount) { p->activeframe=0; redrawHTML(REDRAW_NO_MESSAGE,REDRAW_CREATE_VIRTUAL); } else redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL); highlightatom(&foundatom); lastfound=foundHTMLatom; lastfoundY=foundatom.y; lastfoundX=foundatom.x; outs(foundstr); ie_appendclip(foundstr); GLOBAL.clipdel=0; } else { redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL); outs(MSG_SRCH2); } farfree(foundstr); farfree(tmp); farfree(str); }
//search in active TEXTAREA... void SearchInTextarea(char cont) { int i=0; struct HTMLrecord *aptr=(struct HTMLrecord *)ie_getswap(focusedatom); if(aptr) { char searchstring[IE_MAXLEN+1],str[IE_MAXLEN+80],*ptr; int l1,l2,x; memcpy(&activeatom,aptr,sizeof(struct HTMLrecord)); activeatomptr=&activeatom; activeadr=focusedatom; getTXTprompt(searchstring,IE_MAXLEN); sprintf(str,MSG_SRCH1,searchstring); outs(str); l1=strlen(searchstring); if(l1==0) goto redraw_and_exit; editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr); if(editorptr) { memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor)); if(cont) i=tmpeditor.y; while(i<tmpeditor.lines) { ptr=ie_getline(&tmpeditor,i); if(cont) { x=tmpeditor.x+l1; ptr+=x; cont=0; } else x=0; l2=strlen(ptr); while(l2>=l1) { if(!strncmpi(searchstring,ptr,l1)) { tmpeditor.y=i; tmpeditor.x=x; editorptr=(struct ib_editor *)ie_getswap(activeatomptr->ptr); if(editorptr) { memcpy(editorptr,&tmpeditor,sizeof(struct ib_editor)); swapmod=1; } activeatomtick(ZOOM_SYNCHRO,TEXTAREA_NOREFRESH); //found goto redraw_and_exit; } ptr++; l2--; x++; }//loop i++; }//loop } else MALLOCERR(); outs(MSG_SRCH2); //not found redraw_and_exit: redrawHTML(REDRAW_NO_MESSAGE,REDRAW_VIRTUAL); activeatomptr=&activeatom; activeadr=focusedatom; activeatomcursor(1); }//end if pointer exists - else "nonfatal error" }