home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 365.lha / VSnap / snap.doc < prev    next >
Text File  |  1990-04-10  |  18KB  |  457 lines

  1.                      Snap 1.4
  2.                      ========
  3.                © Mikael Karlsson 1989
  4.       Keymap inverting courtesy of Jim Mackraz
  5.       IFF picture saving to clipboard by Stephen Vermeulen
  6.  
  7. Is it Public Domain?
  8.  
  9.   Snap is NOT Public Domain. Snap is 'Freely distributable
  10.   copyrighted software with a shareware option'.
  11.  
  12.   "Permission is hereby granted to copy Snap provided that
  13.    the copyright notice and this document is left intact.
  14.    Copies may not be made for profit."
  15.  
  16.   I don't know if the above should hold in court but what
  17.   I mean is: Copy Snap if you want to but don't make a
  18.   business of it. It is of course free to include it on
  19.   public domain disks or putting it on a BBS.
  20.   If you find Snap useful, please feel free to send a
  21.   donation ($10 is a nice round number) or a nice program (PD).
  22.   Or you can buy me a beer or two when we meet.
  23.   If you wish to include Snap with a commercial product,
  24.   please contact me first. I just want to make sure that
  25.   my ego can stand for it. Of course it would also be nice
  26.   with a registred copy of the product.
  27.   (How about including it with a '030 card?)
  28.  
  29.   Also read this message that Jim Mackraz sent to me regarding
  30.   some code used in Snap:
  31.  
  32.   "You may use ikm.c in your product Snap.
  33.    You may not distribute the source to ikm.c for profit,
  34.    and any distribution of ikm.c must retain the original
  35.    copyright message.
  36.  
  37.    You should also be warned that IKM() has not been
  38.    substantially verified in either design or implementation,
  39.    and that it will be made obsolete in version V1.4 by a
  40.    new OS function call.
  41.  
  42.    There is no explicit or implied guarantee that ikm.c contains
  43.    only supported algorithms.  It may have problems in a future
  44.    release of the system.
  45.  
  46.       jimm
  47.  
  48.    Jim Mackraz
  49.    Aug 18, 1989"
  50.  
  51. ---------------------------------------------------------------------
  52.  
  53. New addition to make this 1.4:  by Stephen Vermeulen
  54.                                    P.O. Box 3295, Station B
  55.                                    Calgary, Alberta,
  56.                                    CANADA, T2M 4L8
  57.  
  58.                                    (403) 282-7990
  59.  
  60.    I found that after playing with snap's cut out graphics feature
  61.    that I wanted it to save those pictures to the clipboard as propper
  62.    IFF FORM ILBMs so that I could use the "Open Clipboard" feature
  63.    of Express Paint 3.0.60 and higher to paste these into drawings.
  64.    To this end I looked through SNAP 1.3, found the routine which
  65.    handled the picture snapping and added one line of code to SNAPGFX.C
  66.    which is:
  67.  
  68.     if (goodsnap) save_bm(&MyBM, theScreen);  /* write it to clipboard */
  69.  
  70.    and then I added the file "IFFPIC.C" which contains the necessary
  71.    code to save pictures to the clipboard.  This file contains some
  72.    duplication of functionality when compared with the original snap
  73.    code as I was too lazy to either modify the existing routines or
  74.    change my routines to suit the requirements of snap...
  75.  
  76.    I also added one line "SetRast(&MyRP, 0L);" to SnapGfx.c to clear the
  77.    raster that contains the snapped image before the image is put
  78.    there to eliminate some crud on the right hand edge...
  79.  
  80.    To round out the changes I modified the make file to include the new
  81.    C file and the dependencies on the pre-compiled includes, as well
  82.    I wrote up a source file "SYMBOLS.Y" for the predefined include
  83.    file.  And last I added a "CLEAN" entry to the makefile so now you
  84.    can:
  85.  
  86.      make clean
  87.  
  88.    to nuke all the object modules except for "detach.o" which is suppied
  89.    by Manx.
  90.  
  91.    Just about forgot, I added "packer.c" which comes with the IFF
  92.    examples.
  93.  
  94.    From the user's point of view all that happens is each time that
  95.    a graphic image is "snapped" a new snap window appears on the WorkBench
  96.    screen (as before) and the contents of that window are posted to
  97.    the clipboard as an IFF FORM ILBM (a standard IFF picture or brush)
  98.    replacing the previous cut on the clipboard.
  99.  
  100. -----------------------  Now back to SNAP 1.3 docs ---------------------
  101.  
  102.  
  103. What is it?
  104.  
  105.   Snap is the perfect tool for the lazy typer. Isn't it
  106.   irritating when you look at something on the screen
  107.   and think: "That is what I'm going to type."?
  108.   What if you could just point at it and get the computer to
  109.   type it for you? That's where Snap comes to the rescue.
  110.   Another thing that irritates me is that I'm sitting in
  111.   front of THE computer and still I must have pen and
  112.   paper available to scribble down something from the screen
  113.   that I know I will need later. Snap provides a solution
  114.   to that problem also. Just frame it and Snap creates a
  115.   window with a copy of the screen contents. Perfect for
  116.   snapping text from later on. This is another idea borrowed
  117.   from the computer scientists at Xerox Palo Alto Research
  118.   Center (you know, the ones who invented the mouse, windows,
  119.   icons and stuff like that).
  120.  
  121.  
  122. Why use Snap instead?
  123.  
  124.    a. Snap finds out the character coordinates automatically.
  125.    b. Snap uses the RastPort's current font, not just Topaz 8.
  126.    c. Snap was written by me.
  127.    d. Snap supports all fixed width fonts with width and height<16.
  128.    e. Snap supports accented characters (128-255).
  129.    f. Snap supports keymaps, thanks to Jim Mackraz.
  130.    g. Snap does both column and text oriented snapping.
  131.    h. Snap snaps graphics.
  132.    i. Snap uses the clipboard, making it compatible with TxED (and NotePad).
  133.    j. Snap understands inverted characters.
  134.    k. Snap understands bold characters.
  135.    l. Snap does word oriented snapping.
  136.    m. Snap has ants.
  137.    n. Snap has a key combination to do insert.
  138.    o. Snap supports Xerox style snapping with immediate insert.
  139.  
  140.  
  141. Starting and Stopping
  142.  
  143.    Start Snap with 'snap'. That's it. Snap detaches itself
  144.    from the CLI, making it possible to close the CLI.
  145.    Make sure that you have 'clipboard.device' in devs:.
  146.    To get rid of Snap, execute Snap again.
  147.    Note that you can't remove Snap if you have any 'snapped'
  148.    windows left.
  149.    Snap accepts a couple of command line arguments.
  150.    XX is hex. NN is decimal.
  151.      -pNN    where NN is the priority to use when installing
  152.              the input handler. Default is 51.
  153.      -tXX    where XX is the text qualifier to use in text
  154.              operations. Default is the left Amiga key.
  155.      -gXX    where XX is the graphics qualifier to use in
  156.              graphics operations. Default is the right Amiga key.
  157.      -iXX    where XX is the raw key code for the key to be used
  158.              together with the left Amiga key as insert key.
  159.              Use 0 to disable. Default is 17 ("I").
  160.      -cNN    where NN is the amount of time that Snap should
  161.              wait after each character inserted into the input
  162.              stream. Default is 0.
  163.      -lNN    where NN is the amount of time that Snap should
  164.              wait after each carriage return inserted into the
  165.              input stream. Default is 0.
  166.      -aXXXX  where XXXX is a 16 bit number that specifies the
  167.              pattern for the crawling ants. Use FFFF to turn
  168.              the crawling off. Default is 7777.
  169.      -x      tells Snap to use Xerox style snapping instead.
  170.              The snapped text is inserted immediately it has
  171.              been snapped.
  172.      -uN     tells Snap which unit to use when you start snapping.
  173.              0 is rectangular snapping (FRAME).
  174.              1 is character snapping (CHAR). Default is 0.
  175.      -bXX    where XX is the bit plane mask used when drawing the
  176.              selection frame for character snapping. This does not
  177.              affect graphics snapping. Default is 1.
  178.  
  179. QUALIFIERS (always entered in HEX)  (This list borrowed from Matt Dillon)
  180.  
  181.     0001    Left Shift
  182.     0002    Right Shift
  183.     0004    Caps Lock
  184.     0008    Control
  185.     0010    Left Alt
  186.     0020    Right Alt
  187.     0040    Left Amiga Key
  188.     0080    Right Amiga Key
  189.     0100    Numeric Key Pad Key (not useful)
  190.     0200    Repeat              (not useful)
  191.     0400    Interrupt           (not useful)
  192.     0800    Multibroadcast      (not useful)
  193.     1000    Middle Mouse Button (not normally implemented by intuition)
  194.     2000    Right Mouse Button
  195.     4000    Left Mouse Button
  196.  
  197.     Note: Combinations are allowed, in which case any one of the
  198.           elected qualifiers along with the left, right mouse button
  199.           will cause the appropriate action to occur.
  200.  
  201.    Some useful raw key codes:
  202.     17 I    seems to become the Amiga standard
  203.     34 V    for you Macintosh freaks
  204.     15 Y    good ol' Emacs
  205.  
  206.    Note that you can't change parameters while Snap is running.
  207.    You have to remove and restart Snap to change anything.
  208.    The character and line delay may be necessary with some
  209.    programs that can't handle the amount of characters the Snap
  210.    insert into the input stream. CygnusEd is known to have problems
  211.    with this. TxED handles inserted characters very nicely.
  212.    The delay is specified in ticks, 50 ticks per second.
  213.  
  214.  
  215. Snapping
  216.  
  217.    Snapping comes in two flavors; characters and graphics.
  218.    Snapping graphics simply means that you can frame an
  219.    area on screen and that area is copied into a window.
  220.    Character snapping can be made in four different ways:
  221.    * rectangular snapping
  222.    * character oriented snapping
  223.    * word oriented snapping
  224.    * line oriented snapping
  225.  
  226.    Rectangular snapping makes it possible to snap a column
  227.    of text. A carriage return is inserted after each row,
  228.    except the last one.
  229.  
  230.    Line oriented snapping is much the same as rectangular
  231.    snapping, except that the width of the rectangle is the
  232.    width of the window.
  233.  
  234.    Character oriented snapping is much harder to explain than
  235.    to use. Character oriented snapping starts at one character,
  236.    extends to the right edge of the window, goes on with
  237.    complete lines, and ends at another character. The select box
  238.    can look like this: ________________________
  239.     __________________|                        |
  240.    |                                           |
  241.    |                 __________________________|
  242.    |________________|
  243.  
  244.    or like this:                      _________
  245.     _____                            |_________|
  246.    |_____|
  247.  
  248.    and of course like this:    ________________
  249.                               |________________|
  250.  
  251.    Word oriented snapping works the same way as character
  252.    oriented, except that you can only extend the selection
  253.    word by word. A word is defined as non-blanks surrounded
  254.    by blanks.
  255.  
  256.  
  257.    Let's define some actions used when controlling snap.
  258.  
  259.    CLICK
  260.       1. Press the mouse button.
  261.       2. Release the mouse button.
  262.  
  263.    MOVE
  264.       1. Move the mouse.
  265.  
  266.    PREPARE_TEXT
  267.       1. If you are using Xerox style snapping, make sure that your
  268.          intended destination window is active.
  269.       2. Press and hold the text qualifier (Default: Left Amiga key).
  270.       3. MOVE to the first character you want to copy.
  271.  
  272.    PREPARE_GFX
  273.       1. Press and hold the graphics qualifier (Default: Right Amiga key).
  274.       2. MOVE to the upper left corner of the area you want to copy
  275.  
  276.    EXTEND
  277.       1. MOVE
  278.       5. (Press and) Release the mouse button.
  279.  
  280.    END
  281.       1. Release the mouse button.
  282.       2. Release the qualifier.
  283.  
  284.    CANCEL
  285.       1. Release the qualifier.
  286.       2. Release the mouse button.
  287.  
  288.  
  289.    Ways to use these actions:
  290.    This is with starting unit FRAME. Selecting starting unit CHAR will
  291.    skip rectangular snapping and take you directly to character oriented
  292.    snapping. To do rectangular snapping you have to click through char,
  293.    word and line oriented back to rectangular snapping.
  294.  
  295.    To do rectangular snapping:
  296.     1. PREPARE_TEXT.
  297.     2. Press the left mouse button.
  298.     3. MOVE.
  299.     4. EXTEND until satisfied.
  300.     5. END or CANCEL.
  301.  
  302.    To do character oriented snapping
  303.     1. PREPARE_TEXT.
  304.     2. CLICK the left mouse button.
  305.     3. EXTEND until satisfied.
  306.     4. END or CANCEL.
  307.  
  308.    To do word oriented snapping
  309.     1. PREPARE_TEXT.
  310.     2. Double-CLICK left mouse button.
  311.     3. EXTEND until satisfied.
  312.     4. END or CANCEL.
  313.  
  314.    To do line oriented snapping
  315.     1. PREPARE_TEXT.
  316.     2. Triple-CLICK left mouse button.
  317.     3. EXTEND until satisfied.
  318.     4. END or CANCEL.
  319.  
  320.    To insert snapped characters (BKSYSBUF "You know ;-)")
  321.     1. PREPARE_TEXT.
  322.     2. CLICK the right mouse button.
  323.    or
  324.     1. Press and hold the left amiga key.
  325.     2. Type the insert key as specified with -i (Default "I").
  326.  
  327.    To abort insertion
  328.     1. CLICK the left mouse button.
  329.  
  330.    To snap graphics
  331.     1. PREPARE_GFX.
  332.     2. Press the left mouse button.
  333.     3. MOVE.
  334.     4. EXTEND until satisfied.
  335.     5. END or CANCEL.
  336.  
  337.    When snapping text you can go directly from snapping to
  338.    inserting by replacing "END or CANCEL" above with
  339.    "Release left mouse button - CLICK right mouse button".
  340.    If you are using Xerox style snapping, the snapped text
  341.    will be inserted as soon as you END.
  342.    When selecting snapping unit a fourth click takes you
  343.    back to character oriented snapping. Each click steps
  344.    one unit. Note that rectangular snapping only is available
  345.    if you MOVE before you release the mouse button.
  346.    Another thing: You must always start snapping at a character,
  347.    otherwise Snap won't get the coordinates right. This applies
  348.    to all kinds of snapping including line snapping.
  349.    Trailing blanks are removed on each line when you're snapping
  350.    characters, words or lines.
  351.    Windows with graphic snaps are always opened on the Workbench
  352.    screen.
  353.  
  354.  
  355. Compiling
  356.  
  357.    A 'makefile' is provided for Manx-Aztec users. Note the
  358.    use of a precompiled header file containing all amiga-specific
  359.    include files.
  360.    Conversion to Lattice shouldn't be to hard, I hope.
  361.  
  362.  
  363. Some things to remember
  364.  
  365.    a. The text is sent to the active window. Make sure that
  366.       the correct window is active.
  367.    b. Don't interfere when the text is being inserted. Any key
  368.       pressed by you will be inserted in the middle of the text
  369.       being inserted.
  370.    c. Snap begins with an attempt to find the character coordinates.
  371.       Therefore if you begin snapping on a space, Snap will almost
  372.       certainly get the wrong coordinates.
  373.    d. To be able to do Xerox style snapping, Snap disables
  374.       ActivateWindow when the text qualifier is held down.
  375.       By doing this Snap makes sure that the destination window
  376.       remains active when you move out of it, even if you are
  377.       using DMouse or another Sun mouse utility.
  378.  
  379.  
  380. Bugs
  381.  
  382.    Of course, what did you think. Well, as far as I know there
  383.    are no explicit bugs. Oh yes, there is one that I don't know
  384.    how to solve. The problem is that some font editors optimize
  385.    the character image data. The result is that two characters
  386.    with the same image (e.g. I and l in some fonts) uses the
  387.    same image data, thereby making it impossible for Snap to
  388.    determine which character was printed in the first place.
  389.    This can be solved by editing the font so that each character
  390.    is unique.
  391.    It seems like there is a problem with JRComm. Any spaces snapped
  392.    using JRComm's internal font are interpreted as ascii 0. The
  393.    problem doesn't occur when you use an external font.
  394.  
  395.  
  396. Changes
  397.  
  398.   Björn Knutsson pointed out that it wasn't possible to Snap
  399.   the rightmost characters in a borderless window. Now I look
  400.   at the window flags for border and resize gadget, instead
  401.   of just subtracting.
  402.   Ants! I've always thought that the Macintosh's crawling ants
  403.   were neat. Here it is. New option: -aXXXX  - Ants.
  404.   You still can't shrink the selection down to one line. Sorry.
  405.   Björn Knutsson also had some problems when trying to start
  406.   snapping at the leftmost character in a window. A couple of
  407.   small changes has been made to simplify this.
  408.   Major: At last I got rid of the 8-point-wide limit. Thanks to
  409.   Michel Denber for pushing me over the edge on that one.
  410.   Lost and found accented chars 128-255. Watch out for signed tests.
  411.   A key combination for insert is now available.
  412.   Bold characters are now supported. Combinations (bold+inverted)
  413.   are not supported. And Björn Knutsson keeps telling me that
  414.   he wants underlined too. Sigh. Some people are never satisfied.
  415.   Combinations are a potential problem. I'm afraid that implementing
  416.   all combinations will make the character recognition too slow.
  417.   Handler code cleaned up.
  418.   Better gfx snapping, similar to rect snapping. Change corner,
  419.   ants (crawling the other way :-), better edge checking.
  420.   Xerox style snapping with immediate insert. Option -x.
  421.   Stricter control in the input handler. Unused button events when
  422.   snapping are IECLASS_NULLed without mercy.
  423.   Made it possible to shrink the selection back to one line and char.
  424.   Added the option to select char or frame snapping as startint unit.
  425.   Option to select bit planes to draw selection frame into.
  426.  
  427.  
  428. Improvements
  429.  
  430.    I've been thinking about adding a way for programs to "register"
  431.    their windows with Snap so that Snap can let the program handle
  432.    the snapping by itself. As an example: Snapping an icon as text
  433.    doesn't make much sense, so the program displaying the icon
  434.    could take over and put the name of the file in the clipboard.
  435.    A character-mapped window could also benefit from this.
  436.    Another obvious improvement is to make Snap recognize proportional
  437.    fonts. Don't hold your breath.
  438.    The ability to save snapped graphics as an IFF-file? Tell me if you
  439.    want it. It will cost some memory though. Perhaps if I could find
  440.    a good iff.library?
  441.    Built-in help? Naah...
  442.    Converting to one loader and one handler.
  443.    Prepending and appending characters.
  444.  
  445.  
  446. s-mail: Mikael Karlsson
  447.         Lövsättersvägen 10
  448.         S-585 98  LINKÖPING
  449.         SWEDEN
  450.  
  451. e-mail: micke@slaka.sirius.se
  452.         micke@slaka.UUCP
  453.         {mcvax|munnari|seismo}!enea!liuida!slaka!micke
  454.  
  455. Phone:  +46-13 50479
  456.         +46-431 50623 (in the summer)
  457.