home *** CD-ROM | disk | FTP | other *** search
/ Atari FTP / ATARI_FTP_0693.zip / ATARI_FTP_0693 / Mint / toswin14.zoo / toswin.doc < prev    next >
Text File  |  1992-10-27  |  16KB  |  393 lines

  1. TOSWIN: a background program accessory for MiNT
  2. Written by Eric R. Smith (eric.smith@uwo.ca)
  3.  
  4. This version of TOSWIN is copyright 1992 Eric R. Smith. All rights
  5. reserved.
  6.  
  7. TOSWIN is a simple accessory that gives an easy way of running
  8. TOS programs in the background of a GEM session. Selecting this accessory
  9. pops up a window with a scrapbook icon and a menu bar. The menu bar
  10. contains drop down menus; to open a window, select "Open Std Window"
  11. or "Open Alt Window" from the "File" menu. This will pop up a file
  12. selector box; use this box to select the program you want to run. Of
  13. course, this should *not* be a GEM program; you already have a GEM program
  14. running, or you wouldn't be able to get to the accessory. GEM will likely
  15. become horribly confused if there are two programs making GEM calls
  16. simultaneously.
  17.  
  18. Closing the TOSWIN window has the effect of closing the accessory, so
  19. that all windows are hidden. They will all re-appear when "TOS programs"
  20. is selected again from the DESK menu.
  21.  
  22. Closing any other window kills all the programs running in that window.
  23. Be careful!
  24.  
  25. Note that TOSWIN may also be run as an ordinary program; to do this,
  26. just change the extension from '.acc' to '.prg'.
  27.  
  28. MENUS
  29.  
  30. File:
  31.     Open Std Window
  32.     Opens a standard size (i.e. the same size as the line A variables)
  33.     window.
  34.     Open Alt Window
  35.     Opens a different size window. The size defaults to 80x50, but
  36.     this may be changed with the "Set Alt Window Size..." Global
  37.     menu entry.
  38.     Close
  39.     Closes the topmost window.
  40.     Load Config...
  41.     Loads a configuration file previously saved by Save Config...
  42.     TOSWIN looks for a config file called TOSWIN.CNF when starting
  43.     up, and loads it automatically if found.
  44.     Save Config...
  45.     Save the current menu settings and position of the scrapbook icon
  46.     in a file. The user is prompted for whether or not to save
  47.     window positions.
  48.     Set Menu Keys...
  49.     Allows keyboard equivalents to be established for any menu entries.
  50.     Any key (except spacebar) may be used as a menu equivalent, although
  51.     obviously the use of standard ASCII codes would be undesirable :-(.
  52.  
  53.     Quit
  54.     Exit TOSWIN after sending SIGHUP to all child processes.
  55.  
  56. Edit:
  57.     Copy
  58.     Copies the currently selected region in the top window to the
  59.         scrapbook.
  60.     Paste
  61.     Pastes the contents of the scrapbook into the top window.
  62.     Paste Options...
  63.     Controls how data is copied and pasted; for example, whether end
  64.     of line should be sent to applications as a carriage return,
  65.     line feed, or combination.
  66.  
  67. Global:
  68.     Align Windows
  69.     If this is set, TOSWIN will adjust all windows so that the text
  70.     inside them falls on a byte boundary. This should speed up
  71.     the VDI output a bit, at least for fixed width fonts that are
  72.     8 pixels wide.
  73.     Application Menus
  74.     If this option is set, and a window is opened for which an associated
  75.     .MNU file is found, then the application's menu will be loaded and
  76.     displayed in the status line of the window.
  77.     Autoclose
  78.     If this option is set, windows are automatically closed when no more
  79.     processes can send data to them. Otherwise, the string <EXITED>
  80.     is written to the window and it remains open until the user closes
  81.     it manually.
  82.     Flourishes
  83.     If set, grow/shrink boxes appear for windows and dialog boxes.
  84.     Point to type
  85.         If set, input is sent to whatever window the mouse pointer is
  86.     currently over (so you only have to point at a window to type
  87.     into it). Otherwise, input always goes to the top window.
  88.     Smooth Scrolling
  89.     Causes the window contents to be updated more often (after every line)
  90.     if set.
  91.     Set Std Window Size...
  92.     Sets the number of rows and columns for windows opened with the
  93.     "Open Std Window" menu option, or which are run via TOSRUN.
  94.     This option also changes the line A variables to reflect the
  95.     new "standard" size. When specifying a window's rows and
  96.     columns, you may also specify a "scrollback" size. This many rows
  97.     of data are kept around even after they scroll off the top of
  98.     the window, and may be accessed via the vertical scroll bar and
  99.     scroll arrows (or via any keys assigned to the "Gadgets/Scroll Up"
  100.     and "Gadgets/Scroll Down" menu items).
  101.     Set Alt Window Size...
  102.     Sets the number of rows and columns for windows opened with the
  103.     "Open Alt Window"
  104.     Set Default Font...
  105.     Sets the default font for new windows. Any GDOS font may be used
  106.     in a window (this assumes, of course, that you're running GDOS!).
  107.     Even proportional fonts may be used, although they may produce
  108.     strange looking results if used with certain programs :-).
  109.     Set Default Gadgets...
  110.     Sets the default gadgets for new windows. Windows may have no
  111.     gadgets, a title bar (including closer and fuller), or a full
  112.     complement of gadgets including sizer, sliders, arrow, and title
  113.     bar. Windows may also have a menu bar; if a .MNU file is found
  114.     that goes with the program being started in the window, it may
  115.     be loaded and displayed. If no .MNU is found, no menu is displayed
  116.     for this window.
  117.     Environment...
  118.     Instructs TOSWIN about how to set up the environment for new
  119.     processes. The default setting (use ARGV, and set TERM, TERMCAP,
  120.     LINES, and COLUMNS) is the one usually desired.
  121.     Redraw Screen
  122.     Sends a redraw message to all windows, and re-draws the menu
  123.     bar as well.
  124.  
  125. The "Window" and "Gadgets" menus are only applicable to the topmost window,
  126. and since the topmost window is the "TOSWIN" window when the menu is
  127. active, they items in these menus cannot be accessed directly. Instead, you
  128. must use the "Set Menu Keys" option to assign keyboard equivalents for
  129. the menu items below:
  130.  
  131. Window:
  132.  
  133.     Bury Window
  134.         If more than one TOSWIN window is open on screen, a new window
  135.     (i.e. not the current top one) is brought to the top. Repeated
  136.     application will cycle through all open windows.
  137.     Iconify Window
  138.     Make the window small and put it "out of the way". Iconified windows
  139.     may be dragged around without making them bigger; they are
  140.     expanded again by a single click.
  141.     Send Character
  142.     The next character typed will be sent to the application running
  143.     in the top window, regardless of whether the key is a menu
  144.         equivalent or not.
  145.     Set Window Size...
  146.     Change the number of rows and columns for the top window; this probably
  147.     won't change the appearance on screen (unless the new size is
  148.     radically smaller). It will, however, make more or less space available
  149.     via the sliders. Changing the window size causes a SIGWINCH signal
  150.     to be sent to the process group running in the window.
  151.     Set Font...
  152.     Change the font of the top window.
  153.     Set Gadgets...
  154.     Change the gadgets (slider, title, etc.) showing on the top
  155.     window.
  156.  
  157. Gadgets:
  158.  
  159.     Toggle Full
  160.     Has the same effect as clicking on the "full" box of a window.
  161.     Move Window
  162.     A pointing finger appears; move this to the location to which
  163.     you want the window moved, and click the mouse.
  164.     Scroll Up
  165.     Has the same effect as the "up arrow" gadget of a window.
  166.     Scroll Down
  167.     Has the same effect as the "down arrow" gadget of a window.
  168.     Scroll Left
  169.     Has the same effect as the "left arrow" gadget of a window.
  170.     Scroll Right
  171.     Has the same effect as the "right arrow" gadget of a window.
  172.  
  173. WINDOWS
  174.  
  175. Text in a window may be selected by the usual operation of holding down
  176. the mouse button and sweeping out a region. Single clicking on a window
  177. will unselect any text previously selected. Selected text appears in
  178. inverse video. A block of selected text may be dragged to another
  179. (or the same) window; when this is done, the effect is as though
  180. the user typed the selected text at the keyboard while the target window
  181. was on top. Selected text may also be dragged to the clipboard icon to
  182. paste it to the clipboard. Dragging the clipboard icon to a window pastes
  183. the contents of the clipboard into the window.
  184.  
  185. Windows may be resized, moved, etc. with the normal window gadgets, or
  186. with the mouse if the control key is held down. To resize a window without
  187. a sizer box, hold down the control key and press the left mouse button
  188. at the lower right hand corner of the window. To "full" the window do
  189. the same thing at the upper right hand corner; and to move the window
  190. hold down the control key and press the left mouse button anywhere else
  191. in the window. Scrolling of a window without scroll bars may be done
  192. via the Gadgets menu.
  193.  
  194. Closing a window sends a SIGHUP signal to the process group running in
  195. the window. Pressing CTRL-C or CTRL-\ sends a SIGINT or SIGQUIT
  196. signal to the process group in the current top window.
  197.  
  198. APPLICATION MENUS
  199.  
  200. When a new window is opened, TOSWIN looks for a file with the same path
  201. and name as the program being executed, but with a .MNU extension instead
  202. of the program's extension (e.g. if C:\MINT\TOP.TTP is being launched,
  203. TOSWIN looks for C:\MINT\TOP.MNU). If found, this .MNU file is loaded and
  204. the menu described therein is displayed whenever the given window is the
  205. top one and the "Application Menus" option is set. This allows .TOS and
  206. .TTP programs to have a simple menu driven interface provided for them
  207. with little effort.
  208.  
  209. The format of the .MNU file is quite straightforward. Lines beginning
  210. in the first column (i.e. no leading white space) are menu titles.
  211. Lines beginning with white space represent menu entries. The first
  212. word (sequence of non-white space characters, or characters between
  213. double quote marks) is the menu entry itself. The second word represents
  214. a string which will be sent to the application when this menu is
  215. selected. The characters of the string are represented by the 4
  216. hexadecimal digits which make up their VDI key codes, e.g. 6100
  217. is the UNDO key. The final word in the line is a keyboard equivalent
  218. for this menu item; 0000 means no equivalent is provided.
  219.  
  220. If the menu entry string begins with a minus sign '-', then it will
  221. be disabled. If it consists of nothing but '-' characters, then it
  222. will be expanded to stretch across the full length of the menu.
  223.  
  224. TERMINAL EMULATION
  225.  
  226. TOSWIN tries hard to make windows look like a regular ST console. For
  227. example, the shift key status and scan codes are sent when keys are typed
  228. in a window, and the "Standard" window size matches what the line A says
  229. is the size of a window. All the VT52 escape codes are interpreted. One
  230. oddity is that ESC-b and ESC-c (set foreground and background colors) use
  231. VDI colors instead of line-A colors; but unlike MW, different colored
  232. characters can appear on the screen together. Also, note that only 16 different
  233. text colors are supported.
  234.  
  235. TOSWIN extensions to the ST's terminal emulation ( (MW) indicates that
  236. the extension is shared by Allan Pratt's MW window manager as well ).
  237.  
  238. ESC Q        Quote next character; the next character is output
  239.         without any control character interpretation taking
  240.         place. (MW)
  241. ESC R        Set window size; the next text should be an ASCII
  242.         string representing (in decimal) the number of
  243.         columns the window should have, followed by a comma
  244.         and the number of rows the window should have, and
  245.         terminated by a carriage return. For example, the
  246.         command:
  247.             Cconws("\033R132,50\r");
  248.         will cause the window to be resized to 132 columns by
  249.         50 rows. If either the columns or rows is missing (or
  250.         zero) then it is left unchanged.
  251. ESC S        Set title bar; text up to the next carriage return
  252.         is placed in the window's title bar. (MW)
  253. ESC T        Send TERMCAP string. A TERMCAP description for the
  254.         window is sent just as though the user had typed it.
  255.         The string begins with TERMCAP= and ends with a
  256.         carriage return.
  257. ESC a        Delete the character at the current cursor position. (MW)
  258. ESC h        Enter insert mode. (MW)
  259. ESC i        Leave insert mode. (MW)
  260. ESC t <C>    Set cursor flash timer. The next character, <C>, is
  261.         the number of 50 ms intervals that should pass before
  262.         the cursor flashes, plus 32. (That is, an interval of
  263.         n * 50 is represented by (' '+n).) If the interval is
  264.         0 (i.e. the character <C> is a space) then the cursor
  265.         does not flash.
  266. ESC y <C>    Set text effects. The low 5 bits of the next character
  267.         (<C>) are used to determine which text effects should
  268.         be turned on:
  269.         0x0001: Bold text
  270.         0x0002: Dim text
  271.         0x0004: Slanted text
  272.         0x0008: Underlined text
  273.         0x0010: Reverse video
  274. ESC z <C>    Clear text effects. The low 5 bits of the next character
  275.         are used to determine which effects should be turned off.
  276.         See the description of ESC y for more details.
  277.  
  278.  
  279. ENVIRONMENT
  280.  
  281. TOSWIN will put several variables into the environment of the top level
  282. process in a new window, including:
  283.  
  284. LINES=        POSIX's way of telling how many lines and columns a
  285. COLUMNS=    window has
  286.  
  287. TERMCAP=    A complete termcap style description of the terminal
  288.         capabilities.
  289. TERM=tw52    Goes with the TERMCAP= above.
  290.  
  291. The Atari standard ARGV= argument passing mechanism is also used by
  292. TOSWIN, so ARGV= and arguments are put into the environment.
  293.  
  294. Besides the environment variables, TOSWIN also uses the TIOCSWINSZ
  295. Fcntl option on the pseudo-terminal associated with a window. Whenever
  296. a window's size is changed, a new TIOCSWINSZ call is made and also
  297. a SIGWINCH signal is sent to the process group running in the window.
  298. tcsh, for example, notices this and updates its environment variables
  299. accordingly.
  300.  
  301.  
  302. BUGS
  303.  
  304. Things to do/known bugs:
  305.  
  306. (1) Italic text isn't always redrawn correctly (it can be chopped
  307.     off on the left by the cursor).
  308. (2) TOSWIN doesn't know that bold text can be wider than normal
  309.     text, and so again redraws get messed up (this mostly happens
  310.     with proportional text).
  311. (3) The "Copy" and "Paste" menu items should be disabled when
  312.     there is no data available on the clipboard.
  313. (4) TOSWIN chokes on 0 width characters in proportional fonts. (Well, OK,
  314.     it doesn't choke on them -- but the screen display can get quite messed
  315.     up if 0 width characters are showing!).
  316. (5) There should be a program to make .MNU files.
  317. (6) More flexible .MNU files would be nice (e.g. the entries in
  318.     the "Toggles" menu for top should actually toggle in appearance,
  319.     and ways should be provided to check or disable application
  320.     menus.
  321.  
  322.  
  323. APPENDIX: Launching programs in a TOSWIN window
  324.  
  325. Here's a short sample application that can be used to launch
  326. programs in a TOSWIN window, using the pipe that TOSWIN
  327. opens (u:\pipe\tosrun).
  328.  
  329. /*
  330.  * runtos: a small program that will launch a TOS or TTP program
  331.  * in a TOSWIN window.
  332.  * To compile:
  333.  *     gcc -O -mshort -o runtos.prg runtos.c -lgem16
  334.  * To run:
  335.  *     runtos someprog.tos arg1 arg2 arg3
  336.  * OR
  337.  *     Using the desktop, do an "Install Application" on runtos.prg.
  338.  *     For "document type", use .TOS. Now, double clicking on a TOS
  339.  *     program will automatically start it up in a TOSWIN window.
  340.  *     (unfortunately, it will also cause all TOSWIN windows to be
  341.  *     hidden -- you'll have to select "TOS programs" from the DESK
  342.  *     menu to get them back again).
  343.  * BUGS
  344.  *     See above. Also, it would be nice to have a "runttp.prg"
  345.  *     that would prompt for .TTP arguments. This is left as an
  346.  *     exercise for the interested reader.
  347.  *
  348.  * "runtos" was written by Eric R. Smith and is hereby placed in
  349.  * the public domain.
  350.  */
  351.  
  352. #include <minimal.h>
  353.  
  354. long _stksize = 2*1024;
  355.  
  356. int
  357. main(int argc, char **argv)
  358. {
  359. /* BUG: shouldn't have a fixed size buffer */
  360.     static char buf[1024];
  361.     char *where = buf;
  362.     int i, fd;
  363.     long r;
  364.  
  365.     if (!argv[1]) return 2;
  366.  
  367. /* first, put the path */
  368.     *where++ = Dgetdrv() + 'A';
  369.     *where++ = ':';
  370.     Dgetpath(where, 0);
  371.     if (!*where) *where = '\\';
  372.     strcat(where, " ");
  373.  
  374. /* next, put the program */
  375.     strcat(where, argv[1]);
  376.  
  377. /* finally, put the arguments */
  378.     for (i = 2; argv[i]; i++) {
  379.         strcat(where, " ");
  380.         strcat(where, argv[i]);
  381.     }
  382.  
  383.     fd = Fopen("U:\\PIPE\\TOSRUN", 2);
  384.     if (fd < 0) return 1;
  385.  
  386.     r = strlen(buf) + 1;
  387.  
  388.     if (Fwrite(fd, r, buf) != r)
  389.         return 1;
  390.  
  391.     return 0;
  392. }
  393.