home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 113 / EnigmaAmiga113CD.iso / software / utilities / bareed / rexx / layout.rx < prev    next >
Encoding:
Text File  |  2000-02-27  |  2.4 KB  |  77 lines

  1. /* Set layout to block format in an AmigaGuide compatible fashion with leading user's layout for 640 pixel wide screens*/
  2.  
  3. BAREED_HOST = GetClip('BAREED')
  4.  
  5. IF BAREED_HOST = '' THEN DO
  6.     CALL SetClip('BAREED')    /* Remove from ClipNode */
  7.     EXIT 5
  8.     END
  9.  
  10. ADDRESS VALUE BAREED_HOST
  11.  
  12. CALL SetClip('BAREED')        /* Remove from ClipNode */
  13.  
  14. OPTIONS RESULTS
  15.  
  16. /* ------------------- MAIN ---------------- */
  17.  
  18. /* Layout is set here to 640 pixel per line (VGA) */
  19.  
  20. 'Set Error Off'            /* Turn off BareED's trap handling */
  21. 'Set Echo Off'            /* Turn off BareED's I/O reports */
  22.  
  23. leftmost = 640
  24.  
  25. leftmost = leftmost  - 4    /* Left window border has got 4 pixels */
  26. leftmost = leftmost - 18    /* Right window border has got 18 pixels */
  27. leftmost = leftmost - 2        /* BareED reserves 1 pixel in front and one pixel behind a text line */
  28. Get Charwidth ' '        /* Get width of a space in number of pixels */
  29. space = RESULT        /* We now have got the amount of space characters a line can contain */
  30. leftmost = leftmost - space    /* Due to uncoform AmigaGuide layout */
  31.  
  32. numchars = leftmost % space    /* Get amount of space characters that fit into a line */
  33.  
  34. Set Margin Right numchars    /* Set rightmost position */
  35.  
  36. Get Current Char        /* Try to get an ASCII character */
  37. currchar = RESULT
  38. textline = ''            /* An empty line! */
  39.  
  40. /* Fill up empty line with white spaces and other layout characteristics */
  41. DO WHILE currchar < 33
  42.     textline = textline || currchar
  43.     Move Cursor Right
  44.     Get Current Char
  45.     currchar = RESULT
  46.     END
  47.  
  48. terminate = 0
  49. len = LENGTH( textline)        /* Length in number of characters */
  50.  
  51. /* Make the layout but care about a user's own made (for example a tab in front of a line) */
  52. DO WHILE terminate = 0
  53.     Layout Guide            /* Layout current line */
  54.     Move Cursor Down        /* Move cursor to next line */
  55.     Move Cursor Linestart    /* Move cursor to line start */
  56.  
  57.     Get Current Line        /* Get contents of the existing line */
  58.     terminate = RC            /* Check for error */
  59.     IF terminate ~= 0 THEN    /* If error (linefeed or archive's end) then */
  60.         BREAK            /* break */
  61.  
  62.     /* Else drop user's line intro */
  63.     DO i = 1 TO len
  64.         c = SUBSTR( textline, i, 1)
  65.         Put Char c
  66.         END
  67.     END
  68.  
  69. EXIT
  70.  
  71. /* Demo line - point cursor to the first character of the "       This is a ...." and watch what BareED does .....
  72.                                           ^
  73.  
  74.        This is a very loooooong line used as a simple example for BareED's layout mechanism and the button interface (knob-bank)
  75. of BareED which can be used to use this script as an example.
  76.  
  77. demo line end */