home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / wp_dtp / uedit25d.lzh / config!s < prev    next >
Text File  |  1989-10-16  |  10KB  |  376 lines

  1. ======== SPELLING CMDS ======
  2.  
  3. Start spell-checking mode by loading in the dictionary table.
  4. <rAmiga-u:  if (spellerUp)
  5.                 putMsg("Speller is up")
  6.             else if (startSpell("Udtable","Udict",1))
  7.                 putMsg("Speller is up")
  8.             else if (startSpell("s:Udtable","s:Udict",1)) .. K. Perano
  9.                  putMsg("Speller is up")
  10.             else if (startSpell("u:Udtable","u:Udict",1)) .. K. Perano
  11.                 putMsg("Speller is up")
  12.             else {
  13.                 putMsg("No memory or dictionary not found")
  14.                 returnFalse
  15.             } >
  16.  
  17. Find first misspelled word, starting at cursor.  Abort with Amiga-ESC.
  18. <rAmiga-c:
  19.     if (not spellerUp) {
  20.         putMsg("Speller not up")
  21.         returnFalse
  22.     }
  23.     putMsg(" ")
  24.     while (not spell(buf54,curFile)) runKey(virtual-z) >
  25.  
  26. Click word in msg line (buf54), select word to replace word before cursor.
  27. <virtual-z:
  28.     if (isEmpty(buf54)) return
  29.     insertRgn(buf54,efile," ***",all)
  30.     putMsg(buf54)
  31.     vscroll(atCursor)
  32.     updateDisplay
  33.     getKeyVal(n3,n4)
  34.     if (eqNum(n3,normal-esc)) abort
  35.     mousexy(n1,n2)
  36.     while (inputKey(n54)) nothing
  37.     if (mouseDown) while (not inputWaiting) {
  38.         if (not mouseDown) goto label(0)
  39.         inputKey(n54)
  40.     }
  41.     label(0)
  42.     if (geNum(n3,normal-gadget1) & geNum(normal-gadget4,n3)
  43.                                  & gtNum(n2,10) & gtNum(20,n2)) {
  44.         div(n1,n1,8)
  45.         incNum(n1)
  46.         moveCursor(buf54,sfile)
  47.         moveCursor(buf54,eword)
  48.         locToIndex(buf54,n54,atcursor)
  49.         if (gtNum(n1,n54)) {
  50.             indexToLoc(buf54,atCursor,n1)
  51.             if (is(buf54,alpha)) {
  52.                 movecursor(buf54,eword)
  53.                 movecursor(buf54,sword)
  54.                 movecursor(curfile,sword)
  55.                 if (is(curfile,upperCase)) toUpper(buf54)
  56.                 clearRgn(curfile,word)
  57.                 insertrgn(curfile,atcursor,buf54,word)
  58.                 updateDisplay
  59.             }
  60.         }
  61.     }
  62.     putMsg(" ")
  63.     freeBuf(buf54)
  64.     while (inputKey(n54)) nothing
  65.     if (mouseDown) while (not inputWaiting) {
  66.         if (not mouseDown) return
  67.         inputKey(n54)
  68.     }
  69. >
  70.  
  71. Spell-check from cursor fwd.  Mark bad words with "@".
  72. <rAmiga-m:
  73.     if (not runKey(rAmiga-u)) returnFalse
  74.     putMsg("Spell checking ... abort with Amiga-ESC")
  75.     while (not spell(" ",curFile)) insertChar(curFile,"@") >
  76.  
  77. Force file saving to finish so buffer is unlocked
  78. <104: while (getStackSize(n99,n99,n98) & gtNum(n98,0)) delay(5) >
  79.  
  80. Load supplemental dictionary & spell from cursor fwd.  Add to supplement.
  81. <rAmiga-l:
  82.     if (not runKey(rAmiga-u)) returnFalse
  83.     equateNum(n54,curFile)
  84.     putMsg("Dict supplement to use (pmESC = UdSupplement)")
  85.     freebuf(buf54)
  86.     equateNum(n99,0)
  87.     if (inputString(buf54))  {
  88.        if (not loadFile(buf54)) goto label(3)
  89.     } else {
  90. label(3)
  91.         if (not loadFile("UdSupplement")) {
  92.             if (not newFile) {
  93.                 putMsg("Close a file for me!")
  94.                 returnFalse
  95.             }
  96.             setFileName(curfile,"UdSupplement")
  97.         }
  98.     }
  99.     putMsg("Spell checking ... abort with Amiga-ESC")
  100.     if (getFlag(curFile,searchCaps)) flipFlag(curFile,searchCaps)
  101. label(0)
  102.     while (not spell(" ",buf[n54])) {
  103.         moveCursor(buf[n54],sWord)
  104.         freeBuf(buf54)
  105.         insertRgn(buf54,eFile,buf[n54],word)
  106.         moveCursor(buf[n54],eWord)
  107.         moveCursor(buf54,sFile)
  108.         if (not is(buf54,"'") & not is(buf54,alpha)) goto label(0)
  109.         moveCursor(buf54,eFile)
  110.         putMsg(buf54)                               .. remove for faster speed
  111.         insertChar(buf54,eLine)
  112.         moveCursor(curFile,eFile)
  113. label(4)             .. could remove this block but it helps hugely in speed.
  114.         setSearch(buf54)
  115.         if (search(curFile,locA,locB,-1)) {
  116.             if (is(curFile,sWord)) goto label(0)
  117.             moveCursor(curFile,sWord)
  118.             goto label(4)
  119.         }
  120.         moveCursor(buf54,sChar)
  121.         clearChar(buf54)                                      .. remove eline
  122.  
  123.         ..  this sect for speed
  124.         moveCursor(buf54,sFile)
  125.         copyChar(buf54,n47)                          .. copy 1st char of word
  126.         freeBuf(buf52)
  127.         insertChar(buf52,eLine)                      .. load in eline-1stchar
  128.         insertChar(buf52,n47)
  129.         moveCursor(curFile,eFile)                 .. search for starting place
  130.         setSearch(buf52)
  131.         search(curfile,locA,locB,-1)
  132.         moveCursor(curFile,eWord)                  .. move fwd, so sWord works
  133.         if (is(curFile,sFile)) goto label(1)
  134.         while (nothing) {
  135.             moveCursor(curFile,sWord)
  136.             freeBuf(buf53)
  137.             insertRgn(buf53,eFile,curFile,word)
  138.             stringComp(n53,buf54,buf53,1)                       .. ignore case
  139.             if (eqNum(n53,0)) goto label(0)             .. found it, continue
  140.             if (gtNum(n53,0)) {
  141.  label(1)
  142.                 moveCursor(curFile,eWord)
  143.                 moveCursor(curFile,eChar)
  144.  label(2)
  145.                 insertRgn(curFile,atCursor,buf54,all)
  146.                 insertChar(curFile,eLine)
  147.                 updateDisplay                       .. remove for faster speed
  148.                 incNum(n99)
  149.                 if (gtNum(n99,19)) {
  150.                     fileSize(curFile,n99)              .. force buffer packing
  151.                     equateNum(n99,0)
  152.                 }
  153.                 goto label(0)
  154.             }
  155.             if (is(curFile,sFile)) goto label(2)
  156.         }
  157.     }
  158.     moveCursor(curFile,sFile)
  159.     putMsg("These words weren't in dictionary")
  160.     .. stopSpell                               .. use if want speller removed
  161.     >
  162.  
  163. Merge dict supplement with dict-files.  dict.A-Z must be in Current Directory.
  164. <rAmiga-d:
  165.     if (isEmpty(curFile)) returnFalse
  166.     moveCursor(curFile,sFile)
  167.     freeBuf(buf52)
  168.     freeBuf(buf54)
  169.     insertRgn(buf54,eFile,"dh0:spell/private/dict. ",all)
  170.     if (getFlag(curFile,searchCaps)) flipFlag(curFile,searchCaps)
  171.     equateNum(n50,0)
  172.     while (nothing) {
  173.         moveCursor(curFile,eWord)
  174.         moveCursor(curFile,sWord)
  175.         freeBuf(buf53)
  176.         if (not insertRgn(buf53,eFile,curFile,word)) {
  177. label(6)    if (getFlag(buf52,changed)) saveFile(buf52)
  178.             runKey(104)                             .. force save to complete
  179.             goto label(0)
  180.         }
  181.         moveCursor(buf53,sFile)
  182.         toUpper(buf53)
  183.         copyChar(buf53,n54)                    .. copy 1st letter of word A-Z
  184.         toLower(buf53)
  185.         if (eqNum(n54,39)) equateNum(n54,65)             .. apost becomes 'A'
  186.         else {
  187.             if (gtNum(n54,90)) goto label(1)                   .. must be A-Z
  188.             if (gtNum(65,n54)) goto label(1)
  189.         }
  190.         moveCursor(buf54,eFile)
  191.         moveCursor(buf54,sChar)
  192.         swapChar(buf54,n54)                          .. make it "dict.A" etc.
  193.  
  194.         if (not eqNum(n54,n50)) {
  195.             if (not eqNum(n50,0)
  196.                 & getFlag(buf52,changed)) saveFile(buf52)
  197.             runKey(104)                             .. force save to complete
  198.             clearRgn(buf52,all)
  199.             fileSize(buf52,n49)                        .. make it pack buffer
  200.             if (not insertFile(buf52,eFile,buf54)) {
  201.                 putMsg("Can't find dict.A-Z!")
  202.                 returnFalse
  203.             }
  204.             setFileName(buf52,buf54)
  205.             if (getFlag(buf52,changed)) flipFlag(buf52,changed)
  206.             equateNum(n50,n54)                            .. save dict-letter
  207.         }
  208.         .. put word in dict.
  209.         moveCursor(buf53,eFile)
  210.         putMsg(buf53)
  211.         insertChar(buf53,eLine)
  212.         moveCursor(buf52,eFile)
  213. label(2)
  214.         setSearch(buf53)
  215.         if (search(buf52,locA,locB,-1)) {
  216.             if (is(buf52,sWord)) goto label(1)
  217.             goto label(2)                                .. continue searching
  218.         }
  219.         .. didn't find it.  Do the slow scan & insert the word.
  220.         moveCursor(buf53,eFile)
  221.         moveCursor(buf53,sChar)
  222.         clearChar(buf53)                                      .. remove eLine
  223.         moveCursor(buf52,eFile)
  224.         equateNum(n49,1)
  225. label(4)
  226.         while (nothing) {
  227.             if (eqNum(n49,1)) do(n48,1,40) moveCursor(buf52,sWord)
  228.             moveCursor(buf52,sWord)
  229.             freeBuf(buf51)
  230.             insertRgn(buf51,eFile,buf52,word)
  231.             stringComp(n53,buf53,buf51,1)                       .. ignore case
  232.             if (eqNum(n53,0)) goto label(1)             .. found it, continue
  233.             if (gtNum(n53,0)) {
  234.                 if (eqNum(n49,1)) goto label(5)
  235.                 moveCursor(buf52,eWord)
  236.                 moveCursor(buf52,eChar)
  237. label(3)
  238.                 insertRgn(buf52,atCursor,buf53,all)
  239.                 insertChar(buf52,eLine)
  240.                 goto label(1)
  241.             }
  242.             if (is(buf52,sFile)) {
  243.                 if (eqNum(n49,1)) {
  244. label(5)
  245.                     equateNum(n49,0)
  246.                     do (n48,1,41) moveCursor(buf52,eWord)
  247.                     goto label(4)
  248.                 }
  249.                 goto label(3)
  250.             }
  251.         }
  252.  
  253. label(1) .. next word
  254.         moveCursor(curFile,eLine)
  255.         moveCursor(curFile,eChar)
  256.         updateDisplay
  257.         if (is(curFile,eFile)) goto label(6)
  258.     }
  259. label(0)
  260.     putMsg("Done.  Run Udbuild to rebuild working dict & table")
  261.     freeBuf(buf52)
  262. >
  263.  
  264. Remove words from dict-files.  dict.A-Z must be in Current Directory.
  265. <rAmiga-e:
  266.     if (isEmpty(curFile)) returnFalse
  267.     moveCursor(curFile,sFile)
  268.     freeBuf(buf52)
  269.     freeBuf(buf54)
  270.     insertRgn(buf54,eFile,"dicts/dict. ",all)
  271.     if (getFlag(curFile,searchCaps)) flipFlag(curFile,searchCaps)
  272.     equateNum(n50,0)
  273.     while (nothing) {
  274.         moveCursor(curFile,eWord)
  275.         moveCursor(curFile,sWord)
  276.         freeBuf(buf53)
  277.         if (not insertRgn(buf53,eFile,curFile,word)) {
  278. label(6)
  279.                 if (getFlag(buf52,changed)) saveFile(buf52)
  280.                 runKey(104)                         .. force save to complete
  281.                 goto label(0)
  282.         }
  283.         moveCursor(buf53,sFile)
  284.         toUpper(buf53)
  285.         copyChar(buf53,n54)                    .. copy 1st letter of word A-Z
  286.         toLower(buf53)
  287.         if (eqNum(n54,"'")) equateNum(n54,"A")           .. apost becomes 'A'
  288.         else {
  289.             if (gtNum(n54,"Z")) goto label(1)                   .. must be A-Z
  290.             if (gtNum(65,n54)) goto label(1)
  291.         }
  292.         moveCursor(buf54,eFile)
  293.         moveCursor(buf54,sChar)
  294.         swapChar(buf54,n54)                          .. make it "dict.A" etc.
  295.  
  296.         if (not eqNum(n54,n50)) {
  297.             if (not eqNum(n50,0) & getFlag(buf52,changed)) saveFile(buf52)
  298.             runKey(104)                             .. force save to complete
  299.             clearRgn(buf52,all)
  300.             fileSize(buf52,n49)                        .. make it pack buffer
  301.             if (not insertFile(buf52,eFile,buf54)) {
  302.                 putMsg("Can't find dict.A-Z!")
  303.                 returnFalse
  304.             }
  305.             setFileName(buf52,buf54)
  306.             if (getFlag(buf52,changed)) flipFlag(buf52,changed)
  307.             equateNum(n50,n54)                            .. save dict-letter
  308.         }
  309.         .. remove word from dict.
  310.         moveCursor(buf53,eFile)
  311.         putMsg(buf53)
  312.         insertChar(buf53,eLine)
  313.         moveCursor(buf52,eFile)
  314. label(2)
  315.         setSearch(buf53)
  316.         if (search(buf52,locA,locB,-1)) {
  317.             if (is(buf52,sWord)) {
  318.                 clearRgn(buf52,loc)
  319.                 goto label(1)                                     .. next word
  320.             }
  321.             goto label(2)                                .. continue searching
  322.         }
  323.  
  324. label(1) .. next word
  325.         moveCursor(curFile,eLine)
  326.         moveCursor(curFile,eChar)
  327.         if (is(curFile,eFile)) goto label(6)
  328.         updateDisplay
  329.     }
  330. label(0)
  331.     putMsg("Done.  Run Udbuild to rebuild working dict & table")
  332.     freeBuf(buf52)
  333. >
  334.  
  335. Stop spell-checking mode.  (Frees up about 12k of memory.)
  336. <rAmiga-f: if (spellerUp) { stopSpell putMsg("Speller removed") } >
  337.  
  338. ========== Split Windows =========
  339.  
  340. Remove current split window
  341. <lAmiga-0: splitWindow(curFile,0)>
  342.  
  343. Split window to show current file
  344. <lAmiga-c: splitWindow(curFile,splitSize)>
  345.  
  346. Split window to show Undo buffer
  347. <lAmiga-1: splitWindow(buf45,splitSize)>
  348.  
  349. Split window to show search buffer
  350. <lAmiga-2: splitWindow(buf49,splitSize)>
  351.  
  352. Split window to show replace buffer
  353. <lAmiga-3: splitWindow(buf48,splitSize)>
  354.  
  355. Split window to show copied-hilite buffer
  356. <lAmiga-4: splitWindow(buf47,splitSize)>
  357.  
  358. Split window to show copied-invert buffer
  359. <lAmiga-5: splitWindow(buf46,splitSize)>
  360.  
  361. Split window to show copied-columnar buffer
  362. <lAmiga-6: splitWindow(buf37,splitSize)>
  363.  
  364. Split window to show directory names
  365. <lAmiga-7: splitWindow(buf38,splitSize) >
  366.  
  367. Set split window size
  368. <lAmiga-8:
  369.     putMsg("# lines in split window (2 or more):")
  370.     if (inputNum(n54) & geNum(n54,2)) equateNum(splitSize,n54)
  371.     putMsg(" ")>
  372.  
  373. Switch to next window split
  374. <lAmiga-9: toggle(windowSplit)>
  375.  
  376.