sync on
sync rate  400
set text font "Fixedsys",1
font$="Fixedsys"
set text size 20
global dim folder$(600)
global dropdown
global t
global replace
global add
global cut
global coppy
global fontnumber
global keypress$
global menuscroll
global font$
fontnumber=1
global paste
global scroll3
add=3
wrap=15
cls
color backdrop rgb(100,100,100)
dim letter$(100000)
dim letter2$(100000,1)
dim hilighting(100000)
dim coppy$(1000)
syn=5
set image colorkey 255,0,255
ink rgb(255,0,255),rgb(255,0,255)
box 0,0,10,20
ink 0,0
line 5,0,5,20
line 0,0,10,0
line 0,20,10,20
get image 1,0,0,10,21
gosub fontfacing
backspace=200
keypress$=""
lastchar=(screen width()-400)/text width("a")
oldcursor=0
cursor=0
set window size 800,600
do
   gosub autosave
   main:
   scroll2=mousemovez()/120
   spacebar=spacekey()
   backkey=keystate(14)
   theight=text height("a")
   scroll=scroll+scroll2*theight+scroll3*theight
   cursor=cursor-lastchar*(scroll3+scroll2)
   if cursor>i
      for j=i to cursor
          letter$(j)=" "
      next j
      i=cursor
   endif
   scroll3=0
   if scroll>0 then scroll=0
   twidth=text width("a")
   lastrow=scroll+650
   keypress$=entry$()
   clear entry buffer
   if asc(keypress$)>32 and spacebar=1 then goto nocheck
   write:
   if keypress$=key$
      if keypress$=""
      else
         held=held+1
         if held>750
            letter$(cursor)=letter$(cursor)+keypress$
            wait 5
            i=i+1
            cursor=cursor+1
            oldcursor=cursor
            if cursor<i
               for j=i to cursor step -1
                  letter$(j+1)=letter$(j)
               next j
            endif
         endif
      endif
   else
      held=0
      a=asc(keypress$)
      if a>32
         if cursor<i
            for j=i to cursor step -1
               letter$(j+1)=letter$(j)
            next j
         endif
         letter$(cursor)=keypress$
         i=i+1
         cursor=cursor+1
         oldcursor=cursor
      endif
   endif
   nocheck:
   if asc(keypress$)>32
      key$=keypress$
   else
      key$=""
   endif
   if spacebar=1 then key$=" "
   if spacebar=1 and spaceagain=0
      if i>cursor
         for j=i to cursor step -1
               letter$(j+1)=letter$(j)
         next j
         spaceagain=1
         letter$(cursor)=" "
         i=i+1
         cursor=cursor+1
         oldcursor=cursor
      else
         spaceagain=1
         letter$(cursor)=" "
         i=i+1
         cursor=cursor+1
         oldcursor=cursor
      endif
   endif
   if spacebar=0 then spaceagain=0
   if returnkey()=1
      row=cursor/lastchar
      newcursor=(row+1)*lastchar
      differencecursor=newcursor-cursor
      cursor=newcursor
      oldcursor=cursor
      if cursor>i
         for j=i to cursor
            letter$(j)=" "
         next j
         i=cursor
      else
         i=i+differencecursor
      endif
      wait 200
   endif
   if cursorchange>0
      if backkey=1 and back=0 and i>0
         if cursor>oldcursor
            bakspace:
            for j=oldcursor to i
               letter$(j)=letter$(j+cursorchange)
            next j
            for j=i-cursorchange to i
               letter$(j)=""
            next j
            cursor=cursor-cursorchange
            oldcursor=cursor
            i=i-cursorchange
            if i<0 then i=0
            if cursor<0 then cursor=0
            cursorchange=0
            back=1
            wait 200
         endif
         if cursor<oldcursor
            for j=cursor to i
               letter$(j)=letter$(j+cursorchange)
            next j
            for j=i-cursorchange to i
               letter$(j)=""
            next j
            oldcursor=cursor
            i=i-cursorchange
            cursorchange=0
            back=1
            wait 200
         endif
      endif
   endif
   if backkey=1 and i>0 and cursor>0 and back=0 or backspace<1 and i>0 and cursor>0
      back=1
      i=i-1
      cursor=cursor-1
      oldcursor=cursor
      letter$(cursor)=""
      if cursor<i
         for j=cursor to i
            letter$(j)=letter$(j+1)
         next j
      endif
   endif
 
   if backkey=1 then backspace=backspace-1
   if backkey=0 then backspace=75:back=0
   if controlkey()=1 then ctrl=1
   if controlkey()=0 then ctrl=0
   if ctrl=1 and keystate(45)=1
   cut:
      cop=0
      if oldcursor>cursor then c1=cursor:c2=oldcursor
      if oldcursor<cursor then c2=cursor:c1=oldcursor
      clipcop$=""
      for j=c1 to c2-1
         coppy$(cop)=letter$(j)
         clipcop$=clipcop$+coppy$(cop)
         cop=cop+1
      next j
      write to clipboard clipcop$
      for j=c2 to i
         letter$(j-cop)=letter$(j)
         if j>i-cop then letter$(j)=""
      next j
      i=i-cop
      if i<0 then i=0
      cursor=cursor-cop
      if cursor<0 then cursor=0
      wait 200
   endif
   cut=0
   if ctrl=1 and keystate(46)=1
      coppy:
      cop=0
      if oldcursor>cursor then c1=cursor:c2=oldcursor
      if oldcursor<cursor then c2=cursor:c1=oldcursor
      clipcop$=""
      for j=c1 to c2-1
         coppy$(cop)=letter$(j)
         clipcop$=clipcop$+coppy$(cop)
         cop=cop+1
      next j
      write to clipboard clipcop$
      wait 200
   endif
   coppy=0
   if ctrl=1 and keystate(47)=1
   paste:
      paste$=get clipboard$()
      paste1=len(paste$)
      for j=1 to paste1
         if 32>asc(mid$(paste$,j))
            ri$=right$(paste$,paste1-j-1)
            le$=left$(paste$,j-1)
            paste$=le$+ri$
            ri$=""
            le$=""
            paste1=len(paste$)
         endif
      next j
      paste1=len(paste$)
      for j=i to cursor step -1
         letter$(j+paste1)=letter$(j)
      next j
      for j=cursor to cursor+paste1-1
         letter$(j)=mid$(paste$,j-cursor+1)
      next j
      cursor=cursor+len(paste$)
      i=i+len(paste$)
      wait 200
      paste1=0
   endif
   paste=0
 
   if syn=0
 
      cls rgb(100,100,100)
   ink rgb(255,255,255),rgb(255,255,255)
   box 100,50,700,800
      colum=colum+twidth
      wrap=wrap-1
      if wrap=0
         gosub checkforwrap
         wrap=30
      endif
      gosub movecursor
      if mouseclick()=1 then gosub checkmouse
      if mouseclick()=1
         mousehold=1
         if mouseclic>0 then mousehold=2
      else
         if mousehold=1 then mouseclic=10
         mousehold=0
      endif
      if mouseclic>0 then mouseclic=mouseclic-1
      ink 0,rgb(255,255,255)
      for j=0 to i
         column=j*twidth
         row=column/(screen width()-400)
         column=column-row*(screen width()-400)
         if row*theight+scroll>-20 and row*theight+scroll<700
            ink val(letter2$(j,1)),rgb(255,255,255)
            if hilighting(j)=1 then ink val(letter2$(j,1)),rgb(0,0,255)
            text column+200,row*theight+150+scroll,letter$(j)
            if letter2$(j,0)="1" and asc(letter$(j))>64 or letter2$(j,0)="5" and asc(letter$(j))>64 then paste image asc(letter$(j)),column+200,row*theight+150+scroll-1
            if letter2$(j,0)="2" and asc(letter$(j))>64 or letter2$(j,0)="6" and asc(letter$(j))>64 then paste image asc(letter$(j))*4,column+200,row*theight+150+scroll-1
            if letter2$(j,0)="3" and asc(letter$(j))>64 or letter2$(j,0)="7" and asc(letter$(j))>64 then paste image asc(letter$(j))*8,column+200,row*theight+150+scroll-1
            if letter2$(j,0)="4" and asc(letter$(j))>64 or letter2$(j,0)="5" or letter2$(j,0)="6" or letter2$(j,0)="7" then line column+200,row*theight+150+scroll+theight-2,column+200+twidth,row*theight+150+scroll+theight-2
            ink 0,rgb(255,255,255)
         endif
      next j
      ink rgb(200,200,200),rgb(200,200,200)
      box 0,0,800,21
      menu("FILE",200,0,250,21,1,9,0)
      menu("EDIT",250,0,300,21,2,9,0)
      menu("FONTS",650,0,800,21,3,21,0)
      menu("Special Chars.",0,0,200,21,4,200,1)
      button("/\",760,520,800,560,11)
      button("\/",760,560,800,600,12)
      button("COLOR",600,0,650,21,36)
      row2=(cursor*twidth)/(screen width()-400)
      paste image 1,(cursor*twidth)-row2*(screen width()-400)+200-(twidth/2),row2*theight+150+scroll,1
      fastsync
      cls rgb(100,100,100)
      syn=5
 
   endif
   if syn>0 then syn=syn-1
   if search=1 then goto insearch
loop
 
 
checkforwrap:
   for j=1 to i/lastchar
      if asc(letter$(lastchar*j))>32
         for k=lastchar*j to ((lastchar*(j-1)))+1 step -1
            if letter$(k)=" " then firstchar=k: goto checknext
         next k
         goto nowrap
         checknext:
         for k=i to firstchar step -1
            letter$((lastchar*j)-firstchar+(k)-1)=letter$(k)
         next k
         i=i+(lastchar*j)-firstchar
         if cursor=(lastchar*j) or cursor=(lastchar*j)+1 then cursor=cursor+(lastchar*j)-firstchar+1:oldcursor=cursor
         for k=firstchar to lastchar*j-1
            letter$(k)=" "
         next k
      endif
      nowrap:
   next j
return
 
movecursor:
   if shift=0
      if rightkey()=1  and cursor<i
         cursor=cursor+1:oldcursor=cursor:cursorchange=abs(cursor-oldcursor):wait 100
         for j=0 to i
            hilighting(j)=0
         next j
      endif
      if leftkey()=1  and cursor>0
         cursor=cursor-1:oldcursor=cursor:cursorchange=abs(cursor-oldcursor):wait 100
         for j=0 to i
            hilighting(j)=0
         next j
      endif
      if upkey()=1 and cursor>lastchar
         cursor=cursor-lastchar:wait 100
         oldcursor=cursor:cursorchange=abs(cursor-oldcursor)
         for j=0 to i
            hilighting(j)=0
         next j
      endif
      if downkey()=1 and cursor<i-lastchar+1
         cursor=cursor+lastchar:wait 100
         oldcursor=cursor:cursorchange=abs(cursor-oldcursor)
         for j=0 to i
            hilighting(j)=0
         next j
      endif
   endif
   if shiftkey()=1 and shift=1 then shift=2
   if shiftkey()=1 and shift=0 then shift=1
   if shiftkey()=0 then shift=0
   if shift=2
      for j=0 to i
          hilighting(j)=0
      next j
      if rightkey()=1  and cursor<i then cursor=cursor+1:wait 100
      if leftkey()=1  and cursor>0 then cursor=cursor-1:wait 100
      if downkey()=1 and cursor<i-lastchar+1 then cursor=cursor+lastchar:wait 100
      if upkey()=1 and cursor>lastchar then cursor=cursor-lastchar:wait 100
         if cursor<oldcursor
            for j=cursor to oldcursor-1
               hilighting(j)=1
            next j
            cursorchange=abs(cursor-oldcursor)
         endif
         if cursor>oldcursor
            for j=cursor-1 to oldcursor step -1
               hilighting(j)=1
            next j
            cursorchange=abs(cursor-oldcursor)
         endif
   endif
return
 
checkmouse:
   if mousey()<100 then goto nomovecursor
   if mousehold=0 or mousehold=2
      x=(mousex()-200)/twidth
      y=(mousey()-150-scroll)/theight
      if mousex()<200 or mousex()>screen width()-200 or mousey()<140 then goto nomovecursor
      cursor=y*((screen width()-400)/twidth)+x
      oldcursor=cursor
      for j=0 to i
          hilighting(j)=0
      next j
      if cursor>i
         for j=i to cursor
            letter$(j)=" "
         next j
         i=cursor
      endif
   endif
   if mousehold=1
      for j=1 to i
          hilighting(j)=0
      next j
      x=(mousex()-200)/twidth
      y=(mousey()-150-scroll)/theight
      if mousex()<200 or mousex()>screen width()-200 or mousey()<140 then goto nomovecursor
      cursor=y*((screen width()-400)/twidth)+x
      if cursor>i
         for j=i to cursor
            letter$(j)=" "
         next j
         i=cursor
      endif
      if cursor<oldcursor
         for j=cursor to oldcursor-1
            hilighting(j)=1
         next j
      endif
      if cursor>oldcursor
         for j=cursor-1 to oldcursor step -1
            hilighting(j)=1
         next j
      endif
   endif
   if mousehold=2
      if cursor>i
         for j=i to cursor
            letter$(j)=" "
         next j
         i=cursor
      endif
      h=cursor
      repeat
         h=h-1
      until letter$(h)=" " or letter$(h)="" or h=0
      oldcursor=h
      repeat
         h=h+1
      until letter$(h)=" " or letter$(h)=""
      cursor=h
      for j=cursor-1 to oldcursor step -1
         hilighting(j)=1
      next j
   endif
   cursorchange=abs(cursor-oldcursor)
   nomovecursor:
return
 
 
 
function button(caption$,left,top,right,bottom,number)
   ink 0,rgb(200,200,200)
   if mousex()>left and mousey()>top and mousex()<right and mousey()<bottom then inside=1
   if inside=1 then ink 0,rgb(0,0,200)
   if number<40 or number>200 then center text left+(right-left)/2,top+(bottom-top)/2-10,caption$
   if number>39 and number<200 then center text left+(right-left)/2,top+(bottom-top)/2-10,chr$(val(caption$))
   if inside=1 and mouseclick()=1
      if number=1 then gosub save
      if number=2 then gosub load
      if number=3 then end
      if number=4 then goto cut
      if number=5 then goto coppy
      if number=6 then goto paste
      if number=7 then gosub bold
      if number=8 then gosub Italics
      if number=9 then gosub normal
      if number=10 then gosub underline
      if number=11 then scroll3=1:wait 100
      if number=12 then scroll3=-1:wait 100
      if number=13 then gosub export
      if number=14 then gosub prin
      if number>14 and number<36
         if number>16 and number<25 or number>31 and number<35
            fontnumber=number-13
            set text font caption$,1
            set text size 20
            gosub fontfacing
            font$=caption$
         else
            fontnumber=number-13
            set text font caption$,255
            set text size 20
            gosub fontfacing
            font$=caption$
         endif
      endif
      if number=35
         fontnumber=number-13
         set text font caption$,1
         set text size 20
         gosub fontfacing
         font$=caption$
      endif
      if number=36 then gosub collor
      if number=37 then gosub upper
      if number=38 then gosub lower
      if number=39 then gosub definition
      if number>39 and number<200
         keypress$=chr$(val(caption$))
         goto write
      endif
      if number=201 then gosub search
      if number=202 then replace=1:gosub search
      if number=203 then replace=1:gosub unifyspaces
   endif
   ink 0,rgb(255,255,255)
endfunction
 
function menu(caption$,left,top,right,bottom,number,numofbuttons,scroll)
   ink 0,rgb(200,200,200)
   if mousex()>left and mousey()>top and mousex()<right and mousey()<bottom and mouseclick()=1 then dropdown=number
   if dropdown=number then ink 0,rgb(0,0,200)
   center text left+(right-left)/2,top+(bottom-top)/2-10,caption$
   ink 0,rgb(255,255,255)
      if dropdown=number
         if number=1 then restore m1
         if number=2 then restore m2
         if number=3 then restore m3
         if number=4 then restore m4
         if scroll=1
            if downkey()=1 then menuscroll=menuscroll+1
            if upkey()=1 then menuscroll=menuscroll-1
         for k=1 to menuscroll
            read a$
            read b
         next k
         endif
 
         for i=1 to numofbuttons
         read a$
         read b
         button(a$,left,bottom*i,right,bottom*(i+1),b)
         next i
         if (numofbuttons+1)*bottom <mousey() or  mousey()<top or mousex()>right or mousex()<left then dropdown=0
      endif
      back:
endfunction
 
Bold:
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   for j=c1 to c2-1
      if letter2$(j,0)="2" then letter2$(j,0)="3"
      if letter2$(j,0)="3" then goto nextbold
      if letter2$(j,0)="4" then letter2$(j,0)="5"
      if letter2$(j,0)="5" then goto nextbold
      if letter2$(j,0)="6" then letter2$(j,0)="7"
      if letter2$(j,0)="7" then goto nextbold
      letter2$(j,0)="1"
      nextbold:
   next j
return
 
Italics:
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   for j=c1 to c2-1
      if letter2$(j,0)="1" then letter2$(j,0)="3"
      if letter2$(j,0)="3" then goto nextitalics
      if letter2$(j,0)="4" then letter2$(j,0)="6"
      if letter2$(j,0)="6" then goto nextitalics
      if letter2$(j,0)="5" then letter2$(j,0)="7"
      if letter2$(j,0)="7" then goto nextitalics
      letter2$(j,0)="2"
      nextitalics:
   next j
return
 
Underline:
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   for j=c1 to c2-1
      if letter2$(j,0)="1" then letter2$(j,0)="5"
      if letter2$(j,0)="5" then goto nextunderline
      if letter2$(j,0)="2" then letter2$(j,0)="6"
      if letter2$(j,0)="6" then goto nextunderline
      if letter2$(j,0)="3" then letter2$(j,0)="7"
      if letter2$(j,0)="7" then goto nextunderline
      letter2$(j,0)="4"
      nextunderline:
   next j
return
 
Unifyspaces:
   for j=0 to i
      if letter$(j)=" " then space=space+1
      if asc(letter$(j))>32 and space>1
         for h=j to i
            letter$(h-space+1)=letter$(h)
            if letter$(h-space+1)="" then letter$(h-space+1)=" "
         next h
         i=i-space+1
         space=0
      endif
      if asc(letter$(j))>32 then space=0
   next j
return
 
search:
   ink 0,rgb(255,255,255)
   search=1
   text 0,0,"Input the search item"
   set cursor 0,20
   input search$
   wait 250
   if replace=1
      text 0,40,"Input the replace item"
      set cursor 0,60
      input replac$
      wait 100
   endif
   clear entry buffer
   searchlength=len(search$)
   search$=lower$(search$)
   firstcharofsearch$=mid$(search$,1)
   for j=0 to i
      searchj=j
      if lower$(letter$(j))=firstcharofsearch$
         for k=2 to searchlength
            if mid$(search$,k)=lower$(letter$(j+k-1))
            else
               goto stopwordsearch
            endif
         next k
         oldcursor=j
         cursor=j+searchlength
         cursorchange=abs(cursor-oldcursor)
         for k=0 to searchlength-1
            hilighting(k+j)=1
         next k
         do
         goto main
         insearch:
         if returnkey()=1 or wordreplace=1 then wait 500:clear entry buffer:goto stopwordsearch
         if mouseclick()=1 then text 0,0,"search aborted":sync:wait 500:goto quitsearch
         if mouseclick()=2 and replace=1 then wait 250: gosub replace
         loop
         stopwordsearch:
         for k=0 to i
            hilighting(k)=0
         next k
      endif
      j=searchj
   next j
   text 0,0,"search finished"
   sync
   wait 500
   quitsearch:
   search=0
   replace=0
   cursorchange=0
   oldcursor=cursor
return
 
replace:
   replacelength=len(replac$)
   differencelength=searchlength-replacelength
   if differencelength<0
      for h=i to cursor step -1
         letter$(h-differencelength)=letter$(h)
      next h
   endif
   if differencelength>0
      for h=cursor to i
         letter$(h-differencelength)=letter$(h)
      next h
   endif
   for h=oldcursor to oldcursor+replacelength-1
      letter$(h)=mid$(replac$,h-oldcursor+1)
   next h
   for h=i to i-differencelength
      letter$(h)=" "
   next h
   i=i-differencelength
   goto stopwordsearch
return
 
Normal:
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   for j=c1 to c2-1
      letter2$(j,0)="0"
   next j
return
 
save:
   if len(save$)>0 then goto save2
   ink 0,rgb(255,255,255)
   cls
   sync
   text 0,0,"Save as: "
   input "Save as: ",save$
   clear entry buffer
   save2:
   save array save$+".spopovichtext",letter$(100000)
   letter2$(100000,1)=str$(i)
   letter2$(100000,0)=str$(cursor)
   save array save$+".spopovichformating",letter2$(100000,1)
return
 
load:
   ink 0,rgb(255,255,255)
   cls
   text 0,0,"Load: "
   sync
   input "Load: ",save$
   clear entry buffer
   load array save$+".spopovichtext",letter$(100000)
   load array save$+".spopovichformating",letter2$(100000,1)
   i=val(letter2$(100000,1))
   cursor=val(letter2$(100000,0))
   clear entry buffer
return
 
export:
   ink 0,rgb(255,255,255)
   cls
   sync
   text 0,0,"Export as: "
   input "Export as: ",save$
   open to write 1,save$+".txt"
   for j=0 to i
      line$=line$+letter$(j)
      lin=lin+1
      if lin=40
         write string 1,line$
         line$=""
         lin=0
      endif
   next j
   write string 1,line$
   close file 1
   clear entry buffer
return
 
 
upper:
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   for j=c1 to c2-1
      letter$(j)=upper$(letter$(j))
   next j
return
 
lower:
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   for j=c1 to c2-1
      letter$(j)=lower$(letter$(j))
   next j
return
 
collor:
   ink 0,rgb(255,255,255)
   sync
   repeat
   r$=r$+(inkey$())
   if keystate(14)=1 then r$=left$(r$,len(r$)-2)
   cls
   text 0,20,r$
   text 0,0,"red amount"
   sync
   wait 100
   until returnkey()=1
   r=val(r$)
   sync
   sync
   repeat
   g$=g$+(inkey$())
   if keystate(14)=1 then g$=left$(g$,len(g$)-2)
   text 0,60,g$
   text 0,40,"green amount"
   sync
   wait 100
   until returnkey()=1
   g=val(g$)
   sync
   repeat
   b$=b$+(inkey$())
   if keystate(14)=1 then b$=left$(b$,len(b$)-2)
   text 0,100,b$
   text 0,80,"blue amount"
   sync
   wait 100
   until returnkey()=1
   b=val(b$)
   sync
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   color=(rgb(r,g,b))
   color$=str$(color)
   color$=right$(color$,len(color$)-1)
   for j=c1 to c2-1
      letter2$(j,1)=color$
   next j
   clear entry buffer
return
 
prin:
   open to write 5,"print.html"
   write string 5,"<html>"
   write string 5,"<title>Print Prievew</title>"
   write string 5,"<body>"
   write string 5,"<div align="+chr$(34)+"center"+chr$(34)+">"
   write string 5,"<font size="+chr$(34)+"10"+chr$(34)+" face="+chr$(34)+font$+chr$(34)+">"
   write string 5,save$
   if save$="" then write string 5,"Untitled <br></div>"
   write string 5,"<div align="+chr$(34)+"left"+chr$(34)+">"
   for j=0 to i
      if letter2$(j,0)="1" and bol=0 or letter2$(j,0)="5" and bol=0 then line$=line$+"<b>":bol=1:goto notnormal
      if letter2$(j,0)="2" and ital=0 or letter2$(j,0)="6" and ital=0 then line$=line$+"<i>":ital=1:goto notnormal
      if bol=1 then line$=line$+"</b>":bol=0
      if ital=1 then line$=line$+"</i>":ital=0
      notnormal:
      line$=line$+letter$(j)
      brake=brake+1
      if brake=80 then brake=0:write string 5,line$:line$="":write string 5,"<br>"
   next j
   if bol=1 then line$=line$+"</b>"
   if ital=1 then line$=line$+"</i>"
   write string 5,"</font>"
   write string 5,"</div>"
   write string 5,"</body>"
   write string 5,"</html>"
   close file 5
   execute file "print.html","","",1
   suspend for mouse
   delete file "print.html"
   bol=0
   ital=0
   brake=0
return
 
autosave:
   if timer()>savetime+300000 and len(save$)>0 then savetime=timer():text 0,0,"Autosaving":sync: goto save2
return
 
definition:
   word$=""
   if oldcursor>cursor then c1=cursor:c2=oldcursor
   if oldcursor<cursor then c2=cursor:c1=oldcursor
   for j=c1 to c2-1
      word$=word$+letter$(j)
   next j
   execute file "C:\Program Files\Internet Explorer\iexplore.exe","http://dictionary.reference.com/search?q="+word$,""
return
 
fontfacing:
   add=3
   cls
   ink 0,rgb(255,255,255)
   cls rgb(255,255,255)
   sync
   set text to bold
   width=text width("a")
   height=text height("A")
   for j=65 to 90
   text 0,fontnumber*20,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   sync
   get image j,(j-65)*width,fontnumber*20,(j-64)*width,fontnumber*20+20
   next j
   cls rgb(255,255,255)
   sync
   cls rgb(255,255,255)
   text 0,fontnumber*20,"abcdefghijklmnopqrstuvwxyz"
   sync
   for j=97 to 122
   get image j,(j-97)*width,fontnumber*20,(j-96)*width,fontnumber*20+20
   next j
   ink 0,rgb(255,255,255)
   set text to italic
   ink 0,rgb(255,255,255)
   cls rgb(255,255,255)
   sync
   width=text width("a")
   text 0,fontnumber*20,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   sync
   for j=65 to 90
   get image j*4,(j-65)*width+width/2-2,fontnumber*20,(j-64)*width+width/2-2,fontnumber*20+20
   next j
   cls rgb(255,255,255)
   text 0,fontnumber*20,"abcdefghijklmnopqrstuvwxyz"
   sync
   for j=97 to 122
   get image j*4,(j-97)*width+width/2-2,fontnumber*20,(j-96)*width+width/2-2,fontnumber*20+20
   next j
   ink 0,rgb(255,255,255)
   box 0,0,10,20
   set text to bolditalic
   ink 0,rgb(255,255,255)
   cls rgb(255,255,255)
   sync
   width=text width("a")
   text 0,fontnumber*20,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
   sync
   for j=65 to 90
   get image j*8,(j-65)*width+width/2-2,fontnumber*20,(j-64)*width+width/2-2,fontnumber*20+20
   next j
   cls rgb(255,255,255)
   text 0,fontnumber*20,"abcdefghijklmnopqrstuvwxyz"
   sync
   for j=97 to 122
   get image j*8,(j-97)*width+width/2-2,fontnumber*20,(j-96)*width+width/2-2,fontnumber*20+20
   next j
   ink 0,rgb(255,255,255)
   set text to normal
   set text opaque
return
 
m1:
data "Save",1
data "Load",2
data "Definition",39
data "Find",201
data "Replace",202
data "Unify spaces",203
data "Export",13
data "print",14
data "Exit",3
return
m2:
data "Cut",4
data "Copy",5
data "Paste",6
data "Bold",7
data "Italics",8
data "Normal",9
data "Undeline",10
data "Uppercase",37
data "Lowercase",38
return
m3:
data "Lucida Console",15
data "Impact",16
data "AvantGarde Bk BT",17
data "Swiss911 XCm BT",18
data "WP BoxDrawing",19
data "Cuckoo",20
data "Tristan",21
data "Aurora Cn BT",22
data "Informal011 BT",23
data "Unicorn",24
data "MS Mincho",25
data "MS Gothic",26
data "GulimChe",27
data "DotumChe",28
data "BatangChe",29
data "Gungsuh",30
data "GungsuhChe",31
data "SimSun",32
data "NSimSun",33
data "MingLiU",34
data "Fixedsys",35
m4:
data "123",163
data "124",162
data "125",161
data "126",160
data "127",159
data "128",158
data "129",157
data "130",156
data "131",130
data "132",131
data "133",132
data "134",133
data "135",134
data "136",135
data "137",136
data "138",137
data "139",138
data "140",139
data "141",140
data "142",141
data "143",142
data "144",143
data "145",144
data "146",145
data "147",146
data "148",147
data "149",148
data "150",149
data "151",150
data "152",151
data "153",152
data "154",153
data "159",154
data "160",155
data "161",104
data "162",105
data "163",106
data "164",107
data "165",108
data "171",109
data "172",110
data "173",111
data "174",112
data "175",113
data "176",114
data "177",115
data "178",116
data "179",117
data "180",118
data "181",119
data "182",120
data "183",121
data "184",122
data "185",123
data "186",124
data "187",125
data "188",126
data "189",127
data "190",128
data "191",129
data "192",40
data "193",41
data "194",42
data "195",43
data "196",44
data "197",45
data "198",46
data "199",47
data "200",48
data "201",49
data "202",50
data "203",51
data "204",52
data "205",53
data "206",54
data "207",55
data "208",56
data "209",57
data "210",58
data "211",59
data "212",60
data "213",61
data "214",62
data "215",63
data "216",64
data "217",65
data "218",66
data "219",67
data "220",68
data "221",69
data "222",70
data "223",71
data "224",72
data "225",73
data "226",74
data "227",75
data "228",76
data "229",77
data "230",78
data "231",79
data "232",80
data "233",81
data "234",82
data "235",83
data "236",84
data "237",85
data "238",86
data "239",87
data "240",88
data "241",89
data "242",90
data "243",91
data "244",92
data "245",93
data "246",94
data "247",95
data "248",96
data "249",97
data "250",98
data "251",99
data "242",100
data "243",101
data "254",102
data "255",103