home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d1xx / d179 / tsnip.lha / TSnip / TSnip.doc < prev    next >
Text File  |  1989-02-25  |  30KB  |  641 lines

  1.  
  2. TSNIP - 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 finally seen the program which
  6.         inspired TSnip (by reputation), but I find TSnip in its
  7.         current incarnation far more useful.
  8.  
  9. Usage: tsnip [-p] [-c] [-s] [-k] [-K] [-a] [-m] [-e] [x_offset y_offset]
  10.              [-f <font>] [-o <filename>] [on <screenname> or on -null]
  11.              [-z or -vt100] [-emacs or -vi]
  12.  
  13. Or click on its icon from the Workbench, after customizing the tooltypes
  14. field if you like. See the Workbench support section for the details on
  15. that.
  16.  
  17. Whew!
  18.  
  19. 0.  Intro.
  20. 1.  Output Destination.
  21. 2.  Command line options.
  22. 3.  Workbench Support.
  23. 4.  Interaction (keyboard/mouse control).
  24. 5.  Where the TSnip window opens.
  25. 6.  What to do with the PIPE: file.
  26. 7.  Problem windows.
  27. 8.  Handler-commands file.
  28. 9.  Control panel.
  29. 10. Syntax & Examples.
  30. 11. Added bonus for users of the 'vi' and 'emacs' editors.
  31. 12. Credits.
  32.  
  33.  
  34. 0. Intro.
  35.  
  36.     Note the new name... this is to avoid confusion with Digital Dynamics'
  37. signal-processing program Snip. I now refer to the whole group of
  38. programs in the distribution as CATSnip (Computer Aided Text Snip)
  39. and this program as TSnip (Text Snip). How do you pronounce TSnip?
  40. You could pronounce it like you do T-bone, or with a silent T. Just so long
  41. as you know which is which.
  42.  
  43. Copyright 1988 John Russell     Freely redistributable
  44.  
  45. If you found the old Snip even marginally useful, you'll find TSnip V1.4
  46. ten times better! If you had no use whatsoever for the old Snip but you
  47. do use vi, either over a terminal program or as the Manx Z editor, you'll
  48. get a lot better use from your editor if you run it in conjunction with
  49. TSnip. This version, V1.4a, includes support for the emacs editor in
  50. addition to vi.
  51.  
  52. The latest version (1.4a) has proven to be so much more useful than 1.3
  53. that I'd be remiss not to encourage small donations ($5 or $10) if you're
  54. so inclined :-).
  55.  
  56. John Russell
  57. 5 Alderdice Place
  58. St. John's, Newfoundland
  59. Canada  A1B 2P8
  60. (709) 726-7847
  61.  
  62. E-mail: john13@garfield.uucp    (...utai!garfield!john13)
  63.  
  64. Features:
  65.     - area to be cut is outlined during cutting
  66.     - text in target area prevented from scrolling while cut going on
  67.     - for non-standard windows, you can tweak placement of the 8x8
  68.       regions with command line arguments or via key commands
  69.     - multiple save formats; the layout of the program makes it simple
  70.       to add in your own if it isn't supported
  71.     - recognize text in any colour, or combination of colours
  72.     - recognize any 8x8 font; you must create special files using
  73.       TSnipGen for fonts other than the default Topaz 8 (see docs for
  74.       that program for more details)
  75.     - control panel for mouse interaction, step-by-step explanations,
  76.       and changing options
  77.     - can operate on any screen, and move from one screen to another
  78.     - co-operates with mouse handler programs like DMouse
  79.     - startable from CLI or Workbench; options can all be specified for
  80.       either environment
  81.     - comes with source, support programs, and a selection of fonts
  82.     - supports CLI "break" command for termination
  83.  
  84.     - enhances the functionality of vi or emacs if you use either of those
  85.       editors
  86.  
  87. Currently supported:
  88.      - print text to standard output
  89.         - standard output sent to any file
  90.         - change output file at any time
  91.      - save text to PIPE: file
  92.      - save text to clipboard
  93.      - have text echoed as if typed
  94.         - with carriage returns after each line
  95.         - as one long unbroken line
  96.  
  97. TSnip is a program I wrote for three reasons:
  98.  
  99. 1) I needed something like it.
  100. 2) I had heard there was a program to do it and wondered how it would be
  101.    possible to "read" text from a window, since once the letters are plotted
  102.    there's no record of them anywhere except as pixels on the screen.
  103. 3) As a spinoff of some of the ideas I had in writing TSnip the vi-controller
  104.    was started as a seperate program. I've decided to incorporate it into
  105.    this and future versions of TSnip since it only adds about 1.5k.
  106.  
  107. Using TSnip
  108. -----------
  109.  
  110. 1. Output Destination
  111.  
  112.     The main consideration when using TSnip is deciding how you want the text
  113. you "cut" from a window to be saved. Since I couldn't find any one way which
  114. was good enough for all cases, I allowed 5 alternatives, and made it
  115. possible to switch between them at any time.
  116.  
  117. Print to standard output - this is the default if you don't specify anything
  118.     else from the CLI. If you want to direct output to a file, use this mode
  119.     along with the -o option, instead of using ">file" redirection. In this
  120.     mode, multiple writes can be done to a single file which is closed when
  121.     the program exits. All error messages are also sent to standard output.
  122.  
  123. Write to pipe: file - I don't know about anyone else, but I find a pipe
  124.     facility very useful; I imagine it's also very under-used, so if you
  125.     don't have either of the two PD or one commercial implementations
  126.     available I advise you to look into getting one. Basically a pipe is a
  127.     file you can read and write simultaneously. Only some small amount of
  128.     space is used at a time (typically 4K) so you can send a 500K output
  129.     file from one program as input to another program without ever having
  130.     to save anything to disk. Once the last of the data has been read, the
  131.     file disappears. Thus any editor or other program that accepts straight
  132.     ASCII input can process text you save to a pipe.
  133.  
  134. NB: V1.4 corrects a bug which sent a null character at the end of each line
  135.     of output to a pipe or stdout file and caused problems for some programs
  136.     (like DME) that don't like nulls in their text.
  137.  
  138. Paste to Clipboard - this is another under-used feature of the Amiga, sadly
  139.     most editors don't use the clipboard for their cut and paste buffers.
  140.     If they did you would be able to cut a section of text in, say,
  141.     AmigaBasic, and paste it into another editor, or vice versa. Complete
  142.     interchangeability, in the same vein as IFF.
  143.  
  144. NB: I've implemented the clipboard section, however aside from verifying that
  145.     the data is written and seems to be in correct format I don't know of
  146.     anything I have that will read it, so that part can't be tested.
  147.  
  148. Keyboard - the program which inspired this one (if only by reputation) pastes
  149.     its data this way, by fooling your computer into thinking you had re-
  150.     typed the text you snipped. This is extremely useful, so I implemented it
  151.     for V1.2. I also give two different sub-options here... you can have the
  152.     text printed as a column, eg line1 <cr> line2 <cr> etc, or as one long
  153.     line. The first example allows you to import a section of text unaltered
  154.     into something like a word-processor, the second allows you to do
  155.     something like type 'delete' and snip a bunch of filenames which will be
  156.     pasted back into the command line. When either of these output modes are
  157.     selected, the next window to be activated after some text is cut will
  158.     receive the text. If you want to make multiple snips in this mode, the
  159.     -a option may be handy, it prevents you from having to manually click on
  160.     the TSnip window after each paste operation. The keyboard option with
  161.     carriage returns is the default if you start TSnip from the Workbench
  162.     and don't specify a different paste method in the icon tooltypes.
  163.  
  164.  
  165. 2. Command line options.
  166.  
  167.     TSnip features about a gazillion command line options. As new features
  168. get added I'm sure more will follow. To get the most from the program you
  169. will need to know what they all do. Nearly all of them can be turned on or
  170. off from within the program itself, but once you know how you want the
  171. program to operate it's faster to do all the setup as you run it (especially
  172. if you define an alias within a shell to run it with all your favourite
  173. options).
  174.  
  175.     Output
  176.     ------
  177.  
  178.     -s: output text goes to standard output, which is the CLI window or
  179.         a file like PRT: or RAM:file. Under the 1.3 system software you
  180.         can use the SPEAK: device as the destination to have the text
  181.         read to you from the screen!
  182.  
  183.     -c: output text goes to the clipboard
  184.  
  185.     -p: output text goes to the file PIPE:tsnip (requires the pipe: device)
  186.  
  187.     -k: output text goes, as if typed, into the next window to be
  188.         activated; each line is terminated by a return
  189.  
  190.     -K: output text is handled identically to -k except it is pasted as
  191.         one long line using spaces instead of returns
  192.  
  193.     Window Activation
  194.     -----------------
  195.  
  196.     -a: when output is going to keyboard, re-activate the TSnip window
  197.         after each paste finishes
  198.  
  199.     -m: co-operate with a mouse handler, like DMouse or QMouse; when the
  200.         TSnip window is activated or deactivated a command will be executed
  201.         to change the options for the handler, so that you can have auto-
  202.         activation of windows disabled only while it's necessary for TSnip
  203.         to function. The file handler-commands in your S: directory holds
  204.         the two commands which change these options.
  205.  
  206.     Offsets
  207.     -------
  208.  
  209.     any two numbers: these will be taken as an offset to be used in
  210.         positioning the text-recognition box; negative numbers should
  211.         be preceded by a negative sign, positive numbers don't need a
  212.         sign. TSnip by default recognizes text which is positioned in
  213.         windows at the same position as used by console windows. However
  214.         programs that don't use the console can plot text at any pixel
  215.         position they like (for instance VT100 plots text at an offset
  216.         of 0 & -1 from the default). If you don't know the offset
  217.         beforehand you can find it by trial and error while TSnip is
  218.         running; see the section on interaction for details on that.
  219.  
  220.     Editor control
  221.     --------------
  222.  
  223.     -e: go straight into editor mode; instead of cutting text TSnip will
  224.         let you use the mouse for cursor positioning in an editor which
  225.         doesn't already use the mouse
  226.  
  227.     -vi: set up TSnip to send vi cursor-position commands; doesn't set
  228.          editor mode automatically
  229.  
  230.     -emacs: TSnip will send emacs cursor-position commands while in editor
  231.             mode
  232.  
  233.     -z: use this option if you are using the Aztec Z editor (a vi clone);
  234.         it corrects a bug in Z's positioning commands. This option sets
  235.         the -vi option too.
  236.  
  237.     -vt100: if you will be doing your editing in VT100 this sets the right
  238.             offsets for doing cursor positioning in that window
  239.  
  240.     NB: The -vi, -emacs, -z and -vt100 options are "hints" to TSnip. You
  241.         should use whatever combination best applies to you, for instance
  242.         I always use -vi and -vt100... even if I don't expect to need to
  243.         use the edit-control mode.
  244.  
  245.     Miscellaneous
  246.     -------------
  247.  
  248.     -f <fontname>: recognize text in a particular font; you must use
  249.         TSnipGen to create a bitmap file for that font, and put the
  250.         bitmap file (with a .fontdef extension) in your S: directory.
  251.  
  252.     -o <filename>: text which is pasted to standard output will be directed
  253.         into the named file. This could be a disk file, or the printer,
  254.         or to any other more permanent storage spot than the CLI window.
  255.  
  256.     on <screenname>: open the TSnip window on the named screen; the details
  257.         of this process, such as dealing with screens that have no title,
  258.         are covered later on in this document.
  259.  
  260.  
  261. 3. Workbench Support.
  262.  
  263.     This version is the first to support the Workbench. When you run TSnip
  264. from its icon, without any tooltypes set up, it's the equivalent of
  265. running: "tsnip -k -a" (since standard output isn't too useful from the
  266. Workbench unless you specify an output file).
  267.  
  268.     All command line options may be specified via the tooltypes field of
  269. the icon, and all are optional. The way to make TSnip recognize your
  270. favourite set of options is to single click on the TSnip icon, select
  271. the "Info" menu item of Workbench, and when the Info window opens press the
  272. button marked "add" and type into the corresponding string gadget a line of
  273. the form "KEYWORD=OPTION" for each option you wish to set.
  274.  
  275. The options supported are:
  276.  
  277. FILE=output filename for pasting to stdout
  278. PASTE=STDOUT, CLIP, PIPE, KEY, or KEYNOCR
  279. REACTIVATE=TRUE or FALSE
  280. MOUSECONTROL=TRUE or FALSE
  281. FONT=fontname
  282. SCREEN=screenname or "-null" if the screen is untitled
  283. XOFFSET=offset value
  284. YOFFSET=offset value
  285. EDITMODE=TRUE or FALSE
  286. EDITWINDOW=z or vt100
  287. EDITOR=vi or emacs
  288.  
  289. Notes - If you specify one offset the other must be given too.
  290.         The fontname is given as for instance "topaz" or "pearl", no ".font".
  291.  
  292.  
  293. 4. Interaction (keyboard/mouse control).
  294.  
  295.     When the TSnip window is active, the RIGHT mouse button can be used to
  296. outline a rectangular area of text within whichever window the mouse is
  297. currently over. After the text of the area has been interpreted the area
  298. will flash to let you know it is done. While you are operating on the window
  299. it will not change (eg scroll).
  300.  
  301.     When the special edit mode is enabled, the right button is used to
  302. position the cursor within an editor that doesn't have mouse control. You
  303. can tell when edit mode is turned on by looking at the TSnip window's
  304. title which changes to reflect the mode. In edit mode, you click the
  305. right mouse button once directly over the cursor's current position and
  306. once over the desired new position. TSnip then sends the proper keystrokes
  307. to the window to move the cursor there. Editors currently supported are
  308. vi and emacs.
  309.  
  310.     Most command-line options can be changed by using the keyboard while TSnip
  311. is the active window. The current key commands are:
  312.  
  313.     - s: change output destination to standard output (usually the CLI
  314.          window)
  315.     - p: direct output to the file pipe:tsnip
  316.     - c: direct output to the clipboard
  317.     - k: direct output to the keyboard
  318.     - K: same as k except text is pasted as one long line
  319.  
  320.     - a: toggle automatic window activation when k/K selected
  321.  
  322.     - u: move the expected location of characters in a window UP by 1 pixel
  323.     - d: move the expected location of characters in a window DOWN 1 pixel
  324.     - l: move the expected location of characters in a window LEFT 1 pixel
  325.     - r: move the expected location of characters in a window RIGHT 1 pixel
  326.     - <return>: reset the offset back to (0,0), the default for console
  327.                 windows
  328.  
  329. NB: while in edit mode, toggled by the e key, the above 5 keys affect the
  330.     position at which TSnip considers a row or column to start. That is
  331.     there is a seperate 'cursor position' offset in addition to the one
  332.     used for the text recognition box.
  333.  
  334.     - q: print the colour (as pen #) of the pixel directly below the mouse.
  335.          Mnemonic is "query". Useful for diagnosing problems in windows.
  336.  
  337.     - <space>: close one or both TSnip windows and re-open them on the next
  338.                screen down. Brings that screen to the front.
  339.  
  340.     - m: issue commands to enable or disable mouse handler programs when the
  341.          TSnip window becomes active or inactive. See the section on the
  342.          handler-commands file.
  343.  
  344.     - e: toggle edit mode. In edit mode the mouse is used for cursor
  345.          positioning. When edit mode is turned off, the mouse functions
  346.          to cut and paste text as usual.
  347.  
  348. 5. Where the TSnip window opens.
  349.  
  350.     The "on" option lets you select the screen upon which TSnip opens a
  351. window. The default is the Workbench screen, as if you had entered
  352. "TSnip on Workbench". There is some flexibility in the way you specify the
  353. window -- upper and lower case is not significant, and only the first word
  354. of the title is considered. So if a program has a screen opened called
  355. "MY PROGRAM'S SCREEN © 1988" you'd only need to say "tsnip on my" to select
  356. that screen. Also, since many screens open without any title, entering "-null"
  357. instead of a regular title causes TSnip to use the first untitled screen it
  358. comes across. Some screens may cause difficulties in determining their
  359. title, so I included a short program called "Menu" that I wrote way back in
  360. the dark ages. It'll print out all screen titles, in context, with <NULL>
  361. for untitled screens.
  362.  
  363.     When the TSnip window is open on a screen other than the Workbench,
  364. please use extreme caution to avoid having that screen close. Either kill
  365. TSnip first or move it to a different screen.
  366.  
  367. 6. What to do with the PIPE: file.
  368.  
  369.     What I personally do is to create a macro within text editors to insert
  370. the text straight into the editor window, or use the "insert file" option
  371. from a menu, with filename pipe:tsnip. In DME this can be done by:
  372.  
  373. map s-f1 `insfile pipe:tsnip'
  374.  
  375.     You may wish to surround the new area with blank lines or do some more
  376. formatting on it, but just the command to "read the file pipe:tsnip into the
  377. editor window" should work with _any_ word-processor or editor that supports
  378. such an operation (almost all). If your editor doesn't or you don't have a
  379. pipe: device, you can use the keyboard output option to achieve essentially
  380. the same result.
  381.  
  382.     BTW, this allows me to use "cut and paste" between multiple windows in
  383. editors that don't have built-in support for it, or between different
  384. editors.
  385.  
  386.     It's slightly more convenient to use a pipe than a regular file in many
  387. cases, since when output is to a file you must close the file (by selecting
  388. a different filename on the control panel, or clearing the filename gadget)
  389. before you can read it. The pipe file can be opened for reading (multiple
  390. times if you like) without needing to close it first.
  391.  
  392.  
  393. 7. Problem windows.
  394.  
  395.     Some windows appear to yield nothing but unrecognized text. If this
  396. happens you can almost certainly remedy the problem by using the u, d, l
  397. and r keys while TSnip is running to move the text-outline box to the exact
  398. position required by that particular window. "Blitz" and "Keep" are two
  399. programs that open troublesome windows, but they can be TSnipped from OK
  400. with a bit of experimentation. Once you have found the proper offsets for
  401. a particular window you can give them as command line arguments to avoid
  402. any hassles in the future.
  403.  
  404.     Large areas of reversed text, or green-on-purple on some multicolour
  405. screen, will likely be tough to tsnip from. However you can use the control
  406. panel to do it like this:
  407.  
  408.     - activate the TSnip window, and open the control panel
  409.     - position the mouse pointer over the window you want to get text from,
  410.       directly above an area in the same colour as the text
  411.     - press 'q' to query the pixel colour below the mouse. It will be
  412.       displayed on the status line of the control panel. This is the colour
  413.       the text is drawn in, and should be between 0 and 31.
  414.     - enter that number in the "textpen" string gadget of the control panel
  415.  
  416.     Now only text in that colour will be recognized, but the background
  417. will be ignored no matter what colour it is. If you erase the number in
  418. the textpen gadget TSnip will again recognize text in any colour, but only
  419. against a background in colour #0 (the standard background).
  420.  
  421.  
  422. 8. Handler-commands file.
  423.  
  424.     This can be located in your current directory or, preferably, in S:.
  425. The first line should be the command used by your favourite input handler
  426. (mine is DMouse) to turn OFF window auto-activation. The second line
  427. should be the command to turn it back ON. I recommend using an explicit
  428. path for the commands, otherwise you may get a requester asking you to
  429. put back the disk from which you ran TSnip.
  430.  
  431. My handler-commands file looks like this (note that the first command should
  432. be on the VERY FIRST line of the file):
  433.  
  434. c:dmouse -A0 -c2
  435. c:dmouse -A3 -c2
  436.  
  437.     When using this option you must have the regular AmigaDOS Run command in
  438. your C: directory (as opposed to the ARP Arun). It's a really good idea to
  439. have addbuffers or FaccII running, or the necessary commands in a ramdisk.
  440. This is because a command will be run each time the main TSnip window
  441. is activated or inactivated while the -m option is in effect.
  442.  
  443. 9. Control panel.
  444.  
  445.     This is a tremendously useful addition. The initial TSnip window is
  446. only a strip so as not to clutter your screen. If you need some features
  447. or extra information, you can click on the "Panel" gadget and open a second
  448. window with gadgets galore. Hitting that gadget again, or the close box
  449. of the new window, gets rid of the control panel without terminating TSnip.
  450.  
  451.     Your current output destination will be highlighted. You can change it
  452. by clicking on any of the other output gadgets or via the keyboard
  453. equivalents. The File gadget holds the name of the file you may have
  454. specified in the -o command line option. You can change this at any time,
  455. and the old file will be closed and the new one opened. If you erase the
  456. filename entirely, output will be printed on the screen (to stdout for you
  457. C people).
  458.  
  459.     The font currently being recognized is named by the Font gadget. This
  460. must be an 8x8 font for which you have a .fontdef file in your current
  461. directory or in S:. These special files are created by the TSNIPGEN program
  462. that should be included as part of this distribution. If there is no file
  463. named in the Font gadget TSnip will use an internal bitmap of the topaz 8
  464. font in Kickstart 1.2. You can change the font at any time, or erase the
  465. contents of the gadget to go back to the default font.
  466.  
  467.     Most text can be read without concern for its colour. But some text,
  468. for instance text in the titlebars of most windows, is not plotted against
  469. a clear background and confuses TSnip. If you want to read some text that
  470. is like this, use the "q" key to determine what colour the _text_ is in
  471. that area, by moving the mouse above the text and pressing "q" while the
  472. TSnip window is active. You will see a message in the control panel telling
  473. you what colour the text is in. Then type the number which corresponds to the
  474. text colour into the TextPen gadget.
  475.  
  476.     If you are at all unsure how TSnip is working, look at the bottom line
  477. of the control panel. As TSnip does its work it prints plain English
  478. descriptions of the steps it takes here. Helpful information is present
  479. for almost any action you take.
  480.  
  481.     Other features may be added to the control panel as I think of them or
  482. as people suggest them.
  483.  
  484.  
  485. 10. Syntax & Examples.
  486.  
  487. tsnip             <-  program will print all messages to the CLI (default)
  488. tsnip -s          <-  identical to above
  489.  
  490. tsnip -o prt:     <-  redirect output to the printer. You can cut
  491.                       multiple pieces of text and have them all
  492.                       printed this way.
  493.  
  494. tsnip -o df0:file <-  same deal, except text is all saved in a file
  495.  
  496. tsnip -p          <-  text is written to a file called "pipe:tsnip".
  497.                       If you don't have a pipe device, you can re-
  498.                       assign pipe: to somewhere else, although this
  499.                       is less convenient.
  500.  
  501. tsnip -c          <-  text is written to the clipboard, unit #0
  502.  
  503. tsnip -k          <-  text written to keyboard when next window activated
  504. tsnip -K          <-  same as above, but text written as one long line
  505.  
  506. tsnip 2 1         <-  to snip text from a non-standard (ie non-console)
  507.                       window, you can specify an (x,y) offset from the
  508.                       normal cut position within the window. For
  509.                       instance, many versions of VT100 require that you
  510.                       give an offset of (0,-1) to work properly. If you
  511.                       specify one offset, you must specify both. Note
  512.                       that you can also use the keyboard to adjust the
  513.                       exact positioning of characters within a window.
  514.  
  515. tsnip -k 0 -1     <-  combination of an output option with x,y offsets
  516.  
  517. tsnip -f pearl    <-  use file "pearl.fontdef" or "s:pearl.fontdef" so
  518.                       as to recognize text in the pearl 8 font
  519.  
  520. tsnip -a          <-  when using output to keyboard, the TSnip window will
  521.                       be re-activated once the text is pasted to the
  522.                       output window
  523.  
  524. tsnip -m          <-  use file "handler-commands" or "s:handler-commands"
  525.                       to control a mouse utility program
  526.  
  527. tsnip -e          <-  set edit mode, in which the mouse lets you move the
  528.                       cursor in vi
  529.  
  530. tsnip on workbench  <-  open window on Workbench screen, the default
  531.  
  532. tsnip -a -K 0 -1 on VT100   <- going whole hog here, output is to keyboard
  533.                                without linefeeds, the TSnip window will
  534.                                automatically re-activate itself after each
  535.                                snip, it will open its window on the custom
  536.                                screen of VT100, and the character location
  537.                                will be offset the right amount to recognize
  538.                                text on that screen
  539.  
  540. My standard usage is "tsnip -a -k -m -o prt: -vt100 -vi", and I use keyboard
  541. controls and the control panel to set other options as I need them, such as
  542. moving to the VT100 screen or recognizing a different font. The option
  543. -vt100 means that if I need to make use of the vi cursor-positioning
  544. capabilities, I will be using the VT100 window. The alternatives to this
  545. option are -z (when using the Manx Z editor), or no specification at all.
  546.  
  547.  
  548. 11. Added bonus for users of the 'vi' or 'emacs' editors.
  549.  
  550.     I frequently make use of the Unix editor 'vi' when I'm telecommunicating.
  551. Many other Amiga users do too, and a number also use the vi-clone 'Z' that
  552. comes with the high-end version of the Aztec compiler. Now vi is a great
  553. editor for getting things done... except in the area of cursor controls!
  554. Finding your way around the screen is a very arduous task indeed. The same
  555. is true of emacs -- I mean, using ^P, ^N, ^F and ^B for cursor movements???
  556.  
  557.     But no more! If you are running TSnip 1.4 you have, in addition to a
  558. cut and paste utility, a cursor-controller for use with these editors which
  559. will let you move the cursor around with the mouse; this lets you position
  560. the cursor or delete a range of lines very easily.
  561.  
  562.     The editor control in TSnip is a seperate mode: while it's turned on you
  563. won't be able to cut and paste. But you can toggle the 'edit' feature
  564. by using the e key, or by giving the option -e from the CLI. If you
  565. use Workbench, you can make edit mode the default by adding the tooltype
  566. EDITMODE=TRUE to the TSnip icon. At any time when in edit mode, the e key
  567. will flip you back to regular cut and paste operation.
  568.  
  569.     You position the cursor in edit mode using the right mouse button while
  570. the small TSnip window is active. First put the pointer above the window
  571. which contains your terminal program or the Z editor, directly over the
  572. cursor. Click the RMB once. Now position the pointer over the spot you want
  573. to move to and click. Voila! There's the cursor.
  574.  
  575.     Deleting lines in vi will also be enhanced using TSnip. If you want to
  576. delete either forward or backward over a specified range of lines, put the
  577. cursor on either the first or last line of the range. Enter "d" _in the
  578. editor window_ (not the TSnip window), then go through the procedure for
  579. cursor positioning to move the cursor to the other end of the range. All
  580. lines including the ones delimiting the range will be deleted. If you want
  581. to yank a range of lines, again you can do it the same way by entering the
  582. initial "y" command in the editor window then positioning the cursor.
  583.  
  584.     I'm not familiar enough with emacs to say whether you can do similar
  585. tricks there too. But I expect inventive minds will find some :-).
  586.  
  587.     There are some things you must know in order for the process to go
  588. smoothly. First, TSnip needs to know where you're running the editor since
  589. you might be doing it local or in a terminal window. There are 4 command
  590. line options defined that TSnip can use to tell exactly how it should act
  591. in edit mode. These are:
  592.  
  593.     - from CLI: inform TSnip about special editor windows with -z or -vt100
  594.                 tell TSnip what editor you will be using with -vi or -emacs
  595.  
  596.     - from Workbench: a tooltype EDITWINDOW=z or vt100
  597.                       a tooltype EDITOR=vi or emacs
  598.  
  599.     It's especially important if you're using Z, due to a bug in Z's
  600. cursor positioning routine (it thinks column numbers start at 0 when using
  601. the | position command). If you omit these specifications, cursor movement
  602. will still work but you may need to use u, d, l, and r keys while in edit
  603. mode to position the 8 x 8 hitbox TSnip uses to tell where a row or
  604. column starts. These offsets are seperate from those used when snipping
  605. text.
  606.  
  607. NOTE:   There is no reliable way to deal with lines longer than 80 columns
  608.         which wrap on the screen. If you move the cursor across one of
  609.         these lines the cursor will end up one row off from your intended
  610.         destination (still much better than the clumsy manual method of
  611.         positioning).
  612.  
  613.     If anyone wishes to add similar routines for other editors like
  614. EDT, etc. please do so and send them to me. I will incorporate them
  615. into future versions of TSnip.
  616.  
  617.  
  618. 12. Credits.
  619.  
  620.     Window-locating routine by
  621.         Davide P. Cervone
  622.     Bug fix for setting/restoring drawmodes suggested by
  623.         Leo Schwab
  624.     Idea for improving efficiency via ModifyIDCMP from
  625.         Bryce Nesbitt
  626.     Several who responded with the idea of using a union to achieve about
  627.         a 200% speed increase in text recognition
  628.     Clipboard code from an example by
  629.         Andy Finkel and Bob "Kodiak" Burns
  630.     Code to send events to the input device adapted from "Ping" by
  631.         Chris Saulit
  632.     A timely reminder when I had quite forgotten about Snip from
  633.         Phil Kasten
  634.     SetFont, the program which makes the font options worthwhile, by
  635.         Dave Haynie
  636.     Greatly helpful feedback and suggestions, plus uploading to PLink, from
  637.         Cas Borkowski (PLink SRU885)
  638.     Workbench support code taken from CMD by
  639.         Carolyn Scheppner
  640.  
  641.