home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 145.lha / Snip_v1.2 / snip.doc < prev    next >
Encoding:
Text File  |  1986-11-21  |  11.4 KB  |  248 lines

  1.  
  2. SNIP - this is my own implementation of "cutting" text from _any_
  3.        window. I understand there is another program available to do
  4.        the same thing; therefore I will do a better job on this than
  5.        if there wasn't :-). BTW, I've yet to see this other program,
  6.        named "Snipit" if I'm not mistaken. (This is _still_ true as of
  7.        the Snip 1.2 release, 04-26-88).
  8.  
  9. Usage: snip [-p] [-c] [-s] [-k] [-K] [x_offset y_offset] [-f <fontname>]
  10.  
  11. Copyright 1988 John Russell     Freely redistributable
  12.  
  13. The latest version (1.2) has proven to be so useful that I'd be remiss
  14. not to encourage small donations ($5 or $10) if you're so inclined :-).
  15.  
  16. 5 Alderdice Place
  17. St. John's, Newfoundland
  18. Canada  A1B 2P8
  19. (709) 726-7847
  20.  
  21. E-mail: john13@garfield.uucp    (...utai!garfield!john13)
  22.  
  23. Features:
  24.  
  25.     - area to be cut is outlined during cutting
  26.     - text in target area prevented from scrolling while cut going on
  27.     - for non-standard windows, you can tweak placement of the 8x8
  28.       regions with command line arguments or via key commands
  29.     - multiple save formats; the layout of the program makes it simple
  30.       to add in your own if it isn't supported
  31.  
  32.     Currently supported:
  33.      - print text to standard output
  34.      - save text to PIPE: file
  35.      - save text to clipboard
  36.      - have text echoed as if typed, with or without carriage returns
  37.        between lines
  38.  
  39. ** New features in 1.2 **
  40.  
  41.     - new save formats (clipboard and two methods for redirection into the
  42.       input stream)
  43.         - the "-c" option now works, and causes text to be written to the
  44.           clipboard
  45.         - new options "-k" and "-K" allow you to paste text back into any
  46.           window that you would normally type into. "-k" writes the block of
  47.           text back using carriage returns to terminate each line, "-K"
  48.           writes the text back as one long line.
  49.         - new key commands 'k' and 'K' allow you to select the equivalent
  50.           output options at any time
  51.     - support for *any* 8 x 8 font (see SNIPGEN.DOC for details on -f option)
  52.     - supplied program to generate font definition files for new fonts
  53.     - extended help message
  54.     - now detaches from CLI window so you don't need to 'run' it, and never
  55.       eats more than 4K stack
  56.  
  57. Bugs/caveats:
  58.  
  59.     - Heliosmouse/Sunmouse type utilities hamper the operation of SNIP; you
  60.       should disable them when SNIP is in use
  61.     - Certain operations, such as window depth-arranging or the appearance
  62.       of requesters, have caused me lockups in the past if they occur
  63.       while an area of text is being outlined (since I lock the layers of
  64.       a window which may be on the WB screen). Note that this will be an
  65.       exceptional case since the mouse will be operating SNIP. I don't know
  66.       about interaction with programs that use window-to-front to keep
  67.       themselves on top of the display.
  68.     - Outlining of text must be from top-left to bottom-right, although the
  69.       box will follow the mouse correctly in all directions.
  70.     - Unrecognized characters are signalled by a '?'. These will be those
  71.       in reverse, bold, italics, or underline or special accented characters
  72.     - the method of inserting rawkey events into the input stream may not
  73.       work with different keymaps; I don't know how to get around this
  74.       short of altering the internal tables I use; if I can find a way I
  75.       will make it fully keymap-compatible
  76.     - the new -k and -K options may overflow the output buffer of some
  77.       programs, for instance if you paste a large section of text into a
  78.       terminal program operating at 1200 baud. If this turns out to be a
  79.       big problem I'll allow some form of delay in the output, but that's
  80.       the only scenario I've been able to cause any problems in so far.
  81.  
  82. SNIP is a program I wrote for two reasons:
  83.  
  84. 1) I needed something like it
  85. 2) I had heard there was a program to do it and wondered how it would be
  86.    possible to "read" text from a window, since once the letters are plotted
  87.    there's no record of them anywhere except as pixels on the screen
  88.  
  89. Using SNIP
  90. ----------
  91.  
  92. 1. Output Destination
  93.  
  94.     The main consideration when using SNIP is deciding how you want the text
  95. you "cut" from a window to be saved. Since I couldn't find any one way which
  96. was good enough for all cases, I allowed 5 alternatives, and made it
  97. possible to switch between them at any time.
  98.  
  99. Print to standard output - this is the default if you don't specify anything
  100.     else. You may of course redirect standard output any way you like. In
  101.     this mode, multiple writes can be done to a single file which is closed
  102.     when the program exits. All error messages are also sent to standard
  103.     output.
  104.  
  105. Write to pipe: file - I don't know about anyone else, but I find a pipe
  106.     facility very useful; I imagine it's also very under-used, so if you
  107.     don't have either of the two PD or one commercial implementations
  108.     available I advise you to look into getting one. Basically a pipe is a
  109.     file you can read and write simultaneously. Only some small amount of
  110.     space is used at a time (typically 4K) so you can send a 500K output
  111.     file from one program as input to another program without ever having
  112.     to save anything to disk. Once the last of the data has been read, the
  113.     file disappears.
  114.  
  115.     Thus any editor or other program that accepts straight ASCII input can
  116.     process text you save to a pipe. This is the most common way for me to
  117.     use SNIP - I see some interesting text on the screen, perhaps I can't
  118.     re-display it in order to save it, and so I use SNIP to write it to a
  119.     pipe file. Then I can copy it to disk, read it into DME, send it to the
  120.     printer, or whatever I want.
  121.  
  122. **  In release 1.2 the pipe: I use behaves oddly. Some programs like 'type'
  123.     read data from it correctly, but at least DME only reads the first line.
  124.     However the new output options can be used to import text into a word-
  125.     processor if you like. See below.
  126.  
  127. Paste to Clipboard - this is another under-used feature of the Amiga, sadly
  128.     most editors don't use the clipboard for their cut and paste buffers.
  129.     If they did you would be able to cut a section of text in, say,
  130.     AmigaBasic, and paste it into another editor, or vice versa. Complete
  131.     interchangeability, in the same vein as IFF.
  132.  
  133. **  I've implemented the clipboard section however aside from verifying that
  134.     the data is written and seems to be in correct format I don't know of
  135.     anything I have that will read it, so that part can't be tested.
  136.  
  137. Keyboard - the program which inspired this one (if only by reputation) pastes
  138.     its data this way, by fooling your computer into thinking you had re-
  139.     typed the text you snipped. This is extremely useful, so I implemented it
  140.     for V1.2. I also give two different sub-options here... you can have the
  141.     text printed as a column, eg line1 <cr> line2 <cr> etc, or as one long
  142.     line. The first example allows you to import a section of text unaltered
  143.     into something like a word-processor, the second allows you to do
  144.     something like type 'delete' and snip a bunch of filenames which will be
  145.     pasted back into the command line. When either of these output modes are
  146.     selected, the next window to be activated after some text is cut will
  147.     receive the text.
  148.  
  149. 2. Interaction (keyboard/mouse control).
  150.  
  151.     When the SNIP window is active, the RIGHT mouse button can be used to
  152. outline a rectangular area of text within whichever window the mouse is
  153. currently over. After the text of the area has been interpreted the area
  154. will flash to let you know it is done. While you are operating on the window
  155. it will not change (eg scroll).
  156.  
  157.     Due to the need to move the mouse among many windows, utilities such as
  158. Heliosmouse must be disabled while running SNIP. I have an idea which may
  159. let Heliosmouse run as normal _except_ when SNIP is operating, and this
  160. will probably be the next addition I make. Sorry, I've been busy and only
  161. spent the last day updating SNIP after a few months away from it.
  162.  
  163.     All command-line options can be changed by using the keyboard while SNIP
  164. is the active window, except the font selection. The current key commands are:
  165.  
  166.     - s: change output destination to standard output (usually the CLI window)
  167.     - p: change output to the file pipe:snip
  168.     - c: change output to the clipboard (currently only prints a warning
  169.          message)
  170.     - k: change output to the keyboard
  171.     - K: same as k except text is pasted as one long line
  172.  
  173.     - u: move the expected location of characters in a window UP by 1 pixel
  174.     - d: move the expected location of characters in a window DOWN 1 pixel
  175.     - l: move the expected location of characters in a window LEFT 1 pixel
  176.     - r: move the expected location of characters in a window RIGHT 1 pixel
  177.  
  178. 3. What to do with the PIPE: file.
  179.  
  180.     What I personally do is to create a macro within my favourite text editor
  181. (DME) to insert the text straight into the editor window. Here is the DME
  182. syntax:
  183.  
  184.     map s-f1 `insfile pipe:snip'
  185.  
  186.     You may wish to surround the new area with blank lines or do some more
  187. formatting on it, but just the command to "read the file pipe:snip into the
  188. editor window" will work with _any_ word-processor or editor that supports
  189. such an operation (almost all).
  190.  
  191.     BTW, this allows me to use "cut and paste" between multiple windows in
  192. editors that don't have built-in support for it, like, what a coincidence,
  193. the version of DME that I use :-) !
  194.  
  195. ** In V1.2 DME behaves oddly using the above example, but some other programs
  196.    don't so it's still quite useful.
  197.  
  198. Syntax & Examples
  199. -----------------
  200.  
  201. snip              <-  program will print all messages to the CLI (default)
  202.  
  203. snip >prt:        <-  redirect output to the printer. You can cut
  204.                       multiple pieces of text and have them all
  205.                       printed this way.
  206.  
  207. snip >df0:file    <-  same deal, except text is all saved in a file
  208.  
  209. snip -p           <-  text is written to a file called "pipe:snip".
  210.                       If you don't have a pipe device, you can re-
  211.                       assign pipe: to somewhere else, although this
  212.                       is less convenient.
  213.  
  214. snip -c           <-  text is written to the clipboard, unit #0
  215.  
  216. snip 2 1          <-  to snip text from a non-standard (ie non-console)
  217.                       window, you can specify an (x,y) offset from the
  218.                       normal cut position within the window. For
  219.                       instance, many versions of VT100 require that you
  220.                       give an offset of (0,-1) to work properly. If you
  221.                       specify one offset, you must specify both. Note
  222.                       that you can also use the keyboard to adjust the
  223.                       exact positioning of characters within a window.
  224.  
  225. snip -k 0 -1      <-  combination of an output option with x,y offsets
  226.  
  227. snip -f pearl     <-  use file "pearl.fontdef" or "s:pearl.fontdef" so
  228.                       as to recognize text in the pearl 8 font
  229.  
  230. Credits
  231. -------
  232.  
  233.     Window-locating routine by
  234.         Davide P. Cervone
  235.     Bug fix for setting/restoring drawmodes suggested by
  236.         Leo Schwab
  237.     Idea for improving efficiency via ModifyIDCMP from
  238.         Bryce Nesbitt
  239.     Several who responded with the idea of using a union
  240.         to align a byte-array and achieve a speed increase.
  241.     Clipboard code from an example by
  242.         Andy Finkel and Bob "Kodiak" Burns
  243.     Code to send events to the input device adapted from "Ping" by
  244.         Chris Saulit
  245.     A timely reminder when I had quite forgotten about SNIP from
  246.         Phil Kasten
  247.     SetFont by Dave Haynie
  248.