示例#1
0
文件: SEARCH.C 项目: ifilex/SRC
void getTXTprompt(char *str,int lim)
{
 char *ptr;

 editorptr=(struct ib_editor *)ie_getswap(TXTprompt.ptr);
 if(!editorptr)
   MALLOCERR();
 memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor));
 ptr=ie_getline(&tmpeditor,0);
 if(!ptr)
   MALLOCERR();
 makestr(str,ptr,lim);
}
示例#2
0
文件: SEARCH.C 项目: ifilex/SRC
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"
}
示例#3
0
文件: PRINT.C 项目: ifilex/SRC
void generateprt(void)
{
 unsigned currentHTMLatom;
 struct ib_editor txt;
 int x,y,l,k;
 char radka[IE_MAXLEN+2], *ptr;
 struct HTMLrecord *atomptr;

/* printf("Console width is: %d\n\n",CONSOLEWIDTH);
#ifndef CLEMENTINE
 fflush(stdout);
#endif*/
 
 ie_openf_lim(&txt,CONTEXT_TMP,MAXLINES2PRINT);
 strcpy(txt.filename,PRINTFNAME);

 currentHTMLatom=p->firstHTMLatom;

 while(currentHTMLatom!=IE_NULL)
 {
//  kbhit();
  atomptr=(struct HTMLrecord *)ie_getswap(currentHTMLatom);
  if(!atomptr)
   MALLOCERR();
  currentHTMLatom=atomptr->next;

  if(atomptr->frameID==p->activeframe &&
     atomptr->type==TEXT ||
     atomptr->type==HR ||
     atomptr->type==LI ||
     atomptr->type==TD_BACKGROUND ||
     (atomptr->type==TD)
      && (atomptr->data1 || atomptr->data2) ||
     (atomptr->type==TABLE)
      && (atomptr->data1) ||
     atomptr->type==INPUT
      && (atomptr->data1==TEXT ||
          atomptr->data1==SUBMIT ||
          atomptr->data1==BUTTON))

  {
   x=atomptr->x/FIXEDFONTX;
   y=(int)((atomptr->y+FIXEDFONTY/2-1)/FIXEDFONTY);

   if(x>=0 && x<IE_MAXLEN && y>=0 && y<MAXLINES2PRINT)
   {
    if(atomptr->type==LI)
    {
     if(x>0)x--;
     virtualtextdraw(&txt,x,y,"*",1);
    }
    else
    if(atomptr->type==HR || atomptr->type==TD ||
       atomptr->type==TD_BACKGROUND || atomptr->type==TABLE)
    {
     char z='-';
     int yy;
     if(atomptr->type==HR)
      z='=';

     l=atomptr->xx/FIXEDFONTX-x;
     if(l<0)l=0;
     if(l>IE_MAXLEN)l=IE_MAXLEN;
     radka[l]='\0';
     k=l;
     while(--k>=0)
      radka[k]=z;

     if(atomptr->type==TD || atomptr->type==TD_BACKGROUND)
     {
      strcat(radka,"+-");
      yy=(int)((atomptr->yy+FIXEDFONTY/2)/FIXEDFONTY);

      while(y<yy)
       virtualtextdraw(&txt,x+l,y++,"|",1);

      l++; //+-
     }
     else
     if(atomptr->type==TABLE)
     {
      radka[0]=',';
      yy=(int)(atomptr->yy/FIXEDFONTY)-1;

      while(yy>y)
       virtualtextdraw(&txt,x,yy--,"|",1);

      l--;
     }

     virtualtextdraw(&txt,x,y,radka,l);
    }
    else
    {
     if(atomptr->type==INPUT)
     {
      editorptr=(struct ib_editor *)ie_getswap(atomptr->ptr);
      if(editorptr)
      {
       memcpy(&tmpeditor,editorptr,sizeof(struct ib_editor));
       ptr=ie_getline(&tmpeditor,0);
      }
      else
       ptr=NULL;
     }
     else
      ptr=ie_getswap(atomptr->ptr);

     if(!ptr)
      memerr();

     l=strlen(ptr);
     if(l+x>IE_MAXLEN)l=IE_MAXLEN-x;
     if(l<0)l=0;
     makestr(radka,ptr,l);
     virtualtextdraw(&txt,x,y,radka,l);
    }
   }
  }
 }
 if(txt.lines+4<txt.maxlines)
 {
  int l;

  ie_insline(&txt,0,"");

  memset(radka,'_',CONSOLEWIDTH);
  radka[CONSOLEWIDTH]='\0';
  ie_insline(&txt,0,radka);

  memset(radka,' ',CONSOLEWIDTH);
  l=strlen(p->htmlframe[p->activeframe].cacheitem.URL);
  if(l>CONSOLEWIDTH-28)
  {
   l=CONSOLEWIDTH-28;
   strncpy(&radka[CONSOLEWIDTH-28],"...",3);
  }
  strncpy(radka,p->htmlframe[p->activeframe].cacheitem.URL,l);
  inettime(&radka[CONSOLEWIDTH-25]);
  ie_insline(&txt,0,radka);

   memset(radka,' ',CONSOLEWIDTH);
  l=strlen(arachne.title);
  if(l>CONSOLEWIDTH-16)
  {
   l=CONSOLEWIDTH-16;
   strncpy(&radka[CONSOLEWIDTH-16],"...",3);
  }
  strncpy(radka,arachne.title,l);
//!!glennmcc: Jan 26, 2005 -- keep aligned regardless of changes to VER
//also added lowercase 'v' in front of version number
  sprintf(&radka[CONSOLEWIDTH-(9+strlen(VER))],"Arachne v%s",VER);
//  sprintf(&radka[CONSOLEWIDTH-17],"Arachne %s",VER);
//!!glennmcc: end
  ie_insline(&txt,0,radka);
 }
 {
  char ffeed[2]=" ";
  ffeed[0]=12; //form feed?

  ie_insline(&txt,txt.lines,ffeed);
 }
 ie_savef(&txt);

 ie_killcontext(CONTEXT_TMP); //clear temporary file
// ie_closef(&txt);

}
示例#4
0
//. Mix only the paletes on screen (visible)
void MixVisiblePaletes(char writepal)
{

 int pocet=0,i,celkpocet=0;
 int secidx[MAXPALMIX+1];
 XSWAP atomadr[MAXPALMIX+1];
 struct picinfo *dataptr;
 struct picinfo *obrazky;
 struct Url url;
 int maxpocet;//,frameID;
 XSWAP dummy1;
 unsigned dummy2;
 unsigned currentHTMLatom=p->firstHTMLatom,nextHTMLatom;
 struct HTMLframe *frame;
 struct HTMLrecord *imgatomptr;
 struct HTTPrecord HTTPdoc;
// struct TMPframedata *htmldata;

#ifdef POSIX
 maxpocet=MAXPALMIX;
#else 
 maxpocet=(int)((farcoreleft()-2000l)/(5500+sizeof(struct picinfo)));
 if(maxpocet>MAXPALMIX)
  maxpocet=MAXPALMIX;
 else if(maxpocet<1)
  maxpocet=1;
#endif

 obrazky=farmalloc(sizeof(struct picinfo)*maxpocet);
 if(!obrazky)memerr();

// while(HTMLdoc.cur<HTMLdoc.len)
 while(currentHTMLatom!=IE_NULL)
 {
  kbhit();
  imgatomptr=(struct HTMLrecord *)ie_getswap(currentHTMLatom);
  if(!imgatomptr)
   MALLOCERR();
  nextHTMLatom=imgatomptr->next;
  frame=&(p->htmlframe[imgatomptr->frameID]);
  if( (imgatomptr->type==IMG || imgatomptr->type==TD_BACKGROUND) &&
      (imgatomptr->y>=frame->posY ||
       imgatomptr->yy>=frame->posY) &&
      (imgatomptr->y<frame->posY+frame->scroll.ysize ||
       imgatomptr->yy<frame->posY+frame->scroll.ysize) &&
      (imgatomptr->x>=frame->posX ||
       imgatomptr->xx>=frame->posX) &&
      (imgatomptr->x<frame->posX+frame->scroll.xsize ||
       imgatomptr->xx<frame->posX+frame->scroll.xsize)
      || imgatomptr->type==BACKGROUND)
  {
//   idx[celkpocet]=HTMLdoc.cur;
   atomadr[celkpocet]=currentHTMLatom;
   dataptr=(struct picinfo *)ie_getswap(imgatomptr->ptr);
   if(dataptr)
   {
    dataptr->palismap=0;
    swapmod=1;

    if(celkpocet<MAXPALMIX)
    {
     memcpy(&obrazky[pocet],dataptr,sizeof(struct picinfo));
     AnalyseURL(obrazky[pocet].URL,&url,IGNORE_PARENT_FRAME);
     if(SearchInCache(&url,&HTTPdoc,&dummy1,&dummy2))
     {
      i=0;
      while(i<pocet)
      {
       if(!strcmp(obrazky[i].filename,HTTPdoc.locname))
       {
        secidx[celkpocet++]=i;
        goto nextobrazek;
       }
       i++;
      }
      //pocitaji se jenom GIFy a bitmapy:
      // tr.: only GIFs and bitmaps are counted/calculated
      if(HTTPdoc.locname[0] &&
      (strstr(HTTPdoc.locname,".GIF") ||
       strstr(HTTPdoc.locname,".BMP")))
      {
       strcpy(obrazky[pocet].filename,HTTPdoc.locname);
       secidx[celkpocet++]=pocet; //u prvniho obrazku 0, u druheho 1;
         // tr.: at the first picture 0, at the second 1
       pocet++;
      }

      if(pocet==maxpocet)
       goto allobrazky;

     }


    }
    else
     goto allobrazky;

   }//endif nasel sem neco (tr.: endif I found something)
   else
    MALLOCERR();

  }
  nextobrazek:
//  HTMLdoc.cur++;
  currentHTMLatom=nextHTMLatom;
 }
 allobrazky:


 i=0;
 if(celkpocet>0)
 {
  if(!MixPal(obrazky,pocet,writepal)) //zkusim smichat palety...
    // tr.: I try to mix the palette
   goto ven;
  while(i<celkpocet)
  {

   //zrychlena verze (tr.: accelerated version)
   imgatomptr=(struct HTMLrecord *)ie_getswap(atomadr[i]);
   if(imgatomptr && (imgatomptr->type==IMG || imgatomptr->type==BACKGROUND || imgatomptr->type==TD_BACKGROUND))
   {
    dataptr=(struct picinfo *)ie_getswap(imgatomptr->ptr);
    if(dataptr)
    {
     int resize_x=dataptr->resize_x;
     int resize_y=dataptr->resize_y;
     memcpy(dataptr,&obrazky[secidx[i]],sizeof(struct picinfo));
     dataptr->resize_x=resize_x;
     dataptr->resize_y=resize_y;
     swapmod=1;
    }
    else
     MALLOCERR();
   }
   else
    MALLOCERR();
   i++;
  }
 }
 ven:
 if(obrazky) farfree(obrazky);
}
示例#5
0
文件: SEARCH.C 项目: ifilex/SRC
//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);

}
示例#6
0
文件: SEARCH.C 项目: ifilex/SRC
//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"
}