home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / gfx / misc / imagefx_sdk / sas / examples / preview / skeleton.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-02  |  22.0 KB  |  794 lines

  1. #include <exec/types.h>
  2. #include <intuition/intuition.h>
  3. #include <clib/graphics_protos.h>
  4. #include <scan/modall.h>
  5. #include <scan/prev.h>
  6.  
  7.  
  8. /**********************************************************************\
  9.  
  10.                 Language Indexes For Preview Options Window
  11.  
  12. \**********************************************************************/
  13.  
  14. /*
  15.  * Index numbers for text strings.
  16.  *
  17.  */
  18. enum {
  19.  
  20.    TXT_Hello,
  21.    TXT_Goodbye,
  22.  
  23.    TXT_COUNT
  24.  
  25. };
  26.  
  27. /*
  28.  * Default text strings.
  29.  *
  30.  */
  31. char *Default_Strings[] = {
  32.  
  33.    "Hello",
  34.    "Goodbye",
  35.  
  36. };
  37.  
  38.  
  39. /*
  40.  * Get a text string at a certain index.  Uses GetStr(), which will
  41.  * grab strings from an external text file if one is available.
  42.  *
  43.  */
  44. #define TXT(i)    GetStr((i), Default_Strings[i])
  45.  
  46.  
  47. /**********************************************************************\
  48.  
  49.                           Housekeeping Functions
  50.  
  51. \**********************************************************************/
  52.  
  53.  
  54. static struct ViewPort *vport;
  55. static struct RastPort *rport;
  56.  
  57.  
  58. /*
  59.  * VM_InitNS()
  60.  *
  61.  * Prepare the NewScreen structure that ImageFX is about to open for the
  62.  * preview display.
  63.  *
  64.  *    ns = pointer to NewScreen structure to be initialized
  65.  *    swid = source buffer width, in pixels
  66.  *    sht = source buffer height, in pixels
  67.  *    sdepth = source buffer depth, in 8-bit planes (1 or 3)
  68.  *    vwid = where to store pixel width of preview (number of pixels shown)
  69.  *    vht = where to store pixel height of preview (number of pixels shown)
  70.  *
  71.  * NOTE:
  72.  *
  73.  *    If you are opening a screen with a 2.0 mode ID (eg. SUPER72),
  74.  *    you need to pass this mode ID back to ImageFX in a special way
  75.  *    so that the screen is opened properly (the NewScreen->ViewModes
  76.  *    field is only a UWORD).  ImageFX checks the NewScreen->Gadgets
  77.  *    field for a non-zero value; if it is non-zero, it is assumed to
  78.  *    be a screen mode ID, which it uses to open the screen.  This only
  79.  *    works with ImageFX 1.50 and above.
  80.  *
  81.  */
  82. BOOL __saveds __asm VM_InitNS (register __a0 struct NewScreen *ns,
  83.                                register __d0 short swid,
  84.                                register __d1 short sht,
  85.                                register __d2 short sdepth,
  86.                                register __a1 short *vwid,
  87.                                register __a2 short *vht)
  88. {
  89.    /* our example is a lores greyscale only preview */
  90.  
  91.    ns->Width = 320;
  92.    ns->Height = 200;
  93.    ns->Depth = 4;
  94.    ns->ViewModes = 0;
  95.  
  96.    *vwid = 320;
  97.    *vht = 200;
  98.  
  99.    /*
  100.     * We don't really need to do this in this case, but just as an
  101.     * example of how to pass the mode ID back to ImageFX:
  102.     */
  103.    ns->Gadgets = (struct Gadget *)LORES_KEY;
  104.  
  105.    return(TRUE);
  106. }
  107.  
  108. static BOOL clear_text = FALSE;
  109.  
  110. /*
  111.  * VM_Init()
  112.  *
  113.  * Initialize preview display after the preview screen and window have been
  114.  * opened.
  115.  *
  116.  *    screen = pointer to preview screen.
  117.  *    window = pointer to preview window.
  118.  *
  119.  */
  120. BOOL __saveds __asm VM_Init (register __a0 struct Screen *screen,
  121.                              register __a1 struct Window *window)
  122. {
  123.    if (ModuleBase->Text == NULL) {
  124.       clear_text = TRUE;
  125.       ModuleBase->Text = Default_Strings;
  126.    }
  127.  
  128.    vport = &screen->ViewPort;
  129.    rport = &screen->RastPort;
  130.  
  131.    return(TRUE);
  132. }
  133.  
  134. /*
  135.  * VM_Cleanup()
  136.  *
  137.  * Cleanup your preview display before ImageFX closes the screen and window.
  138.  *
  139.  *    screen = pointer to preview screen.
  140.  *    window = pointer to preview window.
  141.  *
  142.  */
  143. void __saveds __asm VM_Cleanup (register __a0 struct Screen *screen,
  144.                                 register __a1 struct Window *window)
  145. {
  146.    if (clear_text) ModuleBase->Text = NULL;
  147. }
  148.  
  149. /*
  150.  * VM_Clear()
  151.  *
  152.  * Clear preview display to black.
  153.  *
  154.  */
  155. void __saveds VM_Clear (void)
  156. {
  157.    SetRast(rport, 0);
  158. }
  159.  
  160. /*
  161.  * VM_Palette()
  162.  *
  163.  * Set the colors used in your preview display.  24-bit previews shouldn't have
  164.  * to do anything here.
  165.  *
  166.  */
  167. void __saveds __asm VM_Palette (register __d0 short type)
  168. {
  169.    int i;
  170.  
  171.    /* our example just sets a greyscale palette no matter what */
  172.    for (i = 0; i < 16; i++) SetRGB4(vport, i, i, i, i);
  173. }
  174.  
  175. /*
  176.  * VM_InitBrushEncode()
  177.  *
  178.  * ImageFX calls this when redrawing a brush.  It should do any special
  179.  * initialization that needs to be done for brushes on your preview.
  180.  * ImageFX calls the same functions for rendering to the preview display
  181.  * and the brush, so you can use this function to set a flag to know when
  182.  * ImageFX is rendering to a brush.
  183.  *
  184.  *    clip = pointer to Clip structure describing brush.
  185.  *
  186.  */
  187. BOOL __saveds __asm VM_InitBrushEncode (register __a0 struct Clip *clip)
  188. {
  189.    /* our example needs no special setup */
  190.    return(TRUE);
  191. }
  192.  
  193. /*
  194.  * VM_CleanupBrushEncode()
  195.  *
  196.  * Cleanup after rendering a brush.
  197.  *
  198.  *    clip = pointer to Clip structure describing the brush.
  199.  *
  200.  */
  201. void __saveds __asm VM_CleanupBrushEncode (register __a0 struct Clip *clip)
  202. {
  203. }
  204.  
  205. /*
  206.  * VM_MapCoordsFrom()
  207.  *
  208.  * Convert screen coordinates into actual preview coordinates.  This should
  209.  * be used if your preview display uses more than one pixel to represent
  210.  * each pixel the user sees (eg. the HAM-E uses 2 hires pixels to display
  211.  * 1 lores 8-bit pixel).  This can also be used to take into account any
  212.  * "magic cookies" built into the bitmap.
  213.  *
  214.  *    x, y = pointer to X and Y coordinates to modify
  215.  *    clip = if TRUE, we're asking about a brush and not the preview screen.
  216.  *
  217.  */
  218. void __saveds __asm VM_MapCoordsFrom (register __a0 short *x,
  219.                                       register __a1 short *y,
  220.                                       register __d0 BOOL clip)
  221. {
  222. }
  223.  
  224. /*
  225.  * VM_MapCoordsTo()
  226.  *
  227.  * Convert preview coordinates into actual screen pixel coordinates.  The
  228.  * exact opposite of VM_MapCoordsFrom().
  229.  *
  230.  *    x, y = pointer to X and Y coordinates to modify
  231.  *    clip = if TRUE, we're asking about a brush and not the preview screen.
  232.  *
  233.  */
  234. void __saveds __asm VM_MapCoordsTo (register __a0 short *x,
  235.                                     register __a1 short *y,
  236.                                     register __d0 BOOL clip)
  237. {
  238. }
  239.  
  240. /*****************************************************************************\
  241.  
  242.                                Palette Functions
  243.  
  244. \*****************************************************************************/
  245.  
  246. static struct ViewPort *palvport;
  247. static struct RastPort *palrport;
  248.  
  249. /*
  250.  * VM_PalInitNS ()
  251.  *
  252.  * Initialize a NewScreen structure to open a palette on for this device.
  253.  * Returns the width of the viewable area (in terms of the display device
  254.  * pixels) for the screen.  Sets the top offset from the top of the screen
  255.  * to the beginning of the palette color data (to account for magic cookies
  256.  * and such).
  257.  */
  258. int __saveds __asm VM_PalInitNS (register __a0 struct NewScreen *ns,
  259.                                  register __a1 short *top)
  260. {
  261.    ns->Width = 320;
  262.    ns->Depth = 4;
  263.    ns->ViewModes = 0;
  264.  
  265.    *top = 1;
  266.  
  267.    return(320);
  268. }
  269.  
  270. /*
  271.  * VM_PalInit ()
  272.  *
  273.  * Called after the palette screen is open to setup whatever is necessary
  274.  * to show a palette on this display device.  Entirely for the module's use.
  275.  */
  276. void __saveds __asm VM_PalInit (register __a0 struct Screen *screen)
  277. {
  278.    int i;
  279.  
  280.    palvport = &screen->ViewPort;
  281.    palrport = &screen->RastPort;
  282.  
  283.    for (i = 0; i < 16; i++) SetRGB4(palvport, i, i, i, i);
  284. }
  285.  
  286. /*
  287.  * VM_PalCleanup ()
  288.  *
  289.  * Called before closing the palette screen to cleanup whatever was
  290.  * done by the VM_PalInit() function above.  Entirely for the module's use.
  291.  */
  292. void __saveds __asm VM_PalCleanup (register __a0 struct Screen *screen)
  293. {
  294. }
  295.  
  296. /*
  297.  * VM_PalSetRGB8 (reg, r, g, b, le, te, w, h)
  298.  *
  299.  * Set the color of the given register; if this display device does not
  300.  * support a palette (ie. 24-bit displays), then simply draw the color
  301.  * at the given location.  This is called as the user adjust RGB sliders,
  302.  * and should be as fast as humanly possible.  Coordinates given are
  303.  * in terms of the display device pixels.
  304.  */
  305. void __saveds __asm VM_PalSetRGB8 (register __a0 struct Screen *screen,
  306.                                    register __d0 short reg,
  307.                                    register __d1 short r,
  308.                                    register __d2 short g,
  309.                                    register __d3 short b,
  310.                                    register __d4 short le,
  311.                                    register __d5 short te,
  312.                                    register __d6 short w,
  313.                                    register __d7 short h)
  314. {
  315.    /* our example only shows in greyscale */
  316.    int v = ((r + g + b) / 3) >> 4;
  317.    SetDrMd(palrport, JAM1);
  318.    SetAPen(palrport, v);
  319.    RectFill(palrport, le, te, le + w - 1, te + h - 1);
  320. }
  321.  
  322. /*
  323.  * VM_PalDraw (reg, r, g, b, le, te, w, h)
  324.  *
  325.  * Draw a box in the given color at the given location.  For palette mapped
  326.  * devices, the register is used to index the colormap; for 24-bit devices
  327.  * the actual RGB value is used.  This is usually called for palette
  328.  * initialization.  Coordinates given are in terms of the display device
  329.  * pixels.
  330.  */
  331. void __saveds __asm VM_PalDraw (register __a0 struct Screen *screen,
  332.                                 register __d0 short reg,
  333.                                 register __d1 short r,
  334.                                 register __d2 short g,
  335.                                 register __d3 short b,
  336.                                 register __d4 short le,
  337.                                 register __d5 short te,
  338.                                 register __d6 short w,
  339.                                 register __d7 short h)
  340. {
  341.    int v = ((r + g + b) / 3) >> 4;
  342.    SetDrMd(palrport, JAM1);
  343.    SetAPen(palrport, v);
  344.    RectFill(palrport, le, te, le + w - 1, te + h - 1);
  345. }
  346.  
  347. /*
  348.  * VM_PalBox (highlight, le, te, w, h)
  349.  *
  350.  * Draw a box (presumabely) around a palette color.  If highlight is TRUE,
  351.  * then the box should be drawn, otherwise, the box should be erased.
  352.  * Called when the user selects and unselects palette colors... also
  353.  * used to show palette ranges (by erasing boxes in the midst of palette
  354.  * colors).  Coordinates given are in terms of the display device pixels.
  355.  */
  356. void __saveds __asm VM_PalBox (register __a0 struct Screen *screen,
  357.                                register __d0 BOOL highlight,
  358.                                register __d1 short le,
  359.                                register __d2 short te,
  360.                                register __d3 short w,
  361.                                register __d4 short h)
  362. {
  363.    SetAPen(palrport, highlight ? 15 : 0);
  364.    SetDrMd(palrport, JAM1);
  365.  
  366.    Move(palrport, le, te);
  367.    Draw(palrport, le + w - 1, te);
  368.    Draw(palrport, le + w - 1, te + h - 1);
  369.    Draw(palrport, le, te + h - 1);
  370.    Draw(palrport, le, te);
  371. }
  372.  
  373. /*
  374.  * VM_PalRange (le, te, w, h)
  375.  *
  376.  * Used to show a color as being part of a range.
  377.  *
  378.  */
  379. void __saveds __asm VM_PalRange (register __a0 struct Screen *screen,
  380.                                  register __d0 short le,
  381.                                  register __d1 short te,
  382.                                  register __d2 short w,
  383.                                  register __d3 short h)
  384. {
  385.    SetAPen(palrport, 0);
  386.    SetDrMd(palrport, JAM1);
  387.    RectFill(palrport, le + 1, te + 1, le + w - 2, te + h - 2);
  388. }
  389.  
  390.  
  391. /*****************************************************************************\
  392.  
  393.                                Miscellaneous functions
  394.  
  395. \*****************************************************************************/
  396.  
  397. void __saveds __asm VM_InitStencil (register __a0 short *wid,
  398.                                     register __a1 short *ht,
  399.                                     register __a2 UBYTE *initmask,
  400.                                     register __a3 short *shift)
  401. {
  402.    *initmask = 0x80;
  403.    *shift = 1;
  404. }
  405.  
  406.  
  407. /*
  408.  * VM_Hide()
  409.  *
  410.  * Called by ImageFX when the user pushes the ImageFX screen to the back.
  411.  * You can use this to do any special code to turn off the preview
  412.  * display, if necessary (like turning off genlocking or whatever).
  413.  *
  414.  */
  415. void __saveds VM_Hide (void)
  416. {
  417. }
  418.  
  419. /*
  420.  * VM_Show()
  421.  *
  422.  * Called by ImageFX when the user brings ImageFX back to the front.
  423.  *
  424.  */
  425. void __saveds VM_Show (void)
  426. {
  427. }
  428.  
  429. /*
  430.  * VM_Pause()
  431.  *
  432.  * This is used to avoid contention between a render module and a preview
  433.  * module on a display output that is exclusive access.  The render module
  434.  * will signal ImageFX that it is about to open a display on a certain
  435.  * hardware device, and ImageFX will call the VM_Pause vector of the
  436.  * current preview module with the 4-byte key of the hardware that the
  437.  * render module is about to use.  If the preview module recognizes that
  438.  * the key is what *it* is also using, it should shut down its access to
  439.  * the hardware while the render module shows the picture.
  440.  *
  441.  */
  442. void __saveds __asm VM_Pause (register __d0 ULONG key)
  443. {
  444.    if (key == 'GREY') {
  445.       /* shut us down - this example doesn't need to though */
  446.    }
  447. }
  448.  
  449. /*
  450.  * VM_Resume()
  451.  *
  452.  * Restore access to the preview display hardware.
  453.  *
  454.  */
  455. void __saveds __asm VM_Resume (register __d0 ULONG key)
  456. {
  457.    if (key == 'GREY') {
  458.       /* restore us - this example doesn't need to though */
  459.    }
  460. }
  461.  
  462. void __saveds __asm VM_Identification (register __a0 struct PreviewInfo *pi)
  463. {
  464.    /*
  465.     * You should set the pixel aspect ratio for your preview display,
  466.     * so that the aspect lock is as accurate as possible.
  467.     */
  468.    pi->AspectX = 44;
  469.    pi->AspectY = 52;
  470. }
  471.  
  472. /**********************************************************************\
  473.  
  474.                               Pixel Output
  475.  
  476. \**********************************************************************/
  477.  
  478. static struct RastPort temprp;
  479.  
  480. void __saveds __asm VM_OutputRow24 (register __a0 struct BitMap *bm,
  481.                                     register __a1 UBYTE *outpix,
  482.                                     register __d0 int row,
  483.                                     register __d1 int leftedge,
  484.                                     register __d2 int width)
  485. {
  486.    int i, c;
  487.  
  488.    /* this example just writes grey lines very slowly... */
  489.    for (i = 0; i < width; i++) {
  490.       c = ((outpix[0] + outpix[1] + outpix[2]) / 3) >> 4;
  491.       SetAPen(&temprp, c);
  492.       WritePixel(&temprp, i + leftedge, row);
  493.       outpix += 3;
  494.    }
  495. }
  496.  
  497. void __saveds __asm VM_OutputRow8 (register __a0 struct BitMap *bm,
  498.                                    register __a1 UBYTE *outpix,
  499.                                    register __d0 int row,
  500.                                    register __d1 int leftedge,
  501.                                    register __d2 int width)
  502. {
  503.    int i;
  504.  
  505.    /* this example just writes grey lines very slowly... */
  506.    for (i = 0; i < width; i++) {
  507.       SetAPen(&temprp, (*outpix++) >> 4);
  508.       WritePixel(&temprp, i + leftedge, row);
  509.    }
  510. }
  511.  
  512. void __saveds __asm VM_InitUpdate (register __a0 struct BitMap *bm,
  513.                                    register __d0 int leftedge,
  514.                                    register __d1 int topedge,
  515.                                    register __d2 int width,
  516.                                    register __d3 int height)
  517. {
  518.    InitRastPort(&temprp);
  519.    temprp.BitMap = bm;
  520. }
  521.  
  522. void __saveds __asm VM_CleanupUpdate (register __a0 struct BitMap *bm)
  523. {
  524. }
  525.  
  526. /**********************************************************************\
  527.  
  528.                           Preferences Handling
  529.  
  530. \**********************************************************************/
  531.  
  532. /*
  533.  * This structure defines the format for your preferences.  ImageFX
  534.  * will store this structure in the user's prefs files.
  535.  */
  536. struct MyPrefs {
  537.    UBYTE    Stuff[4];
  538.    UBYTE    Reserved[12];
  539. };
  540.  
  541. /*
  542.  * VM_SavePrefs()
  543.  *
  544.  * Store your current module configuration into the supplied
  545.  * preferences structure.  ImageFX will then save it to disk.
  546.  *
  547.  */
  548. BOOL __saveds __asm VM_SavePrefs (register __a0 struct MyPrefs *prefs)
  549. {
  550.    /* no prefs in this example */
  551.    return(TRUE);
  552. }
  553.  
  554. /*
  555.  * VM_LoadPrefs()
  556.  *
  557.  * Configure your module based on the settings in the supplied
  558.  * preferences structure.  Note that your module does not necessarily
  559.  * have to be displayed for this function to be called, so make sure
  560.  * that your gadgets exist before fiddling with them.  Return TRUE
  561.  * on success, or FALSE on failure.
  562.  *
  563.  */
  564. BOOL __saveds __asm VM_LoadPrefs (register __a0 struct MyPrefs *prefs)
  565. {
  566.    /* no prefs in this example */
  567.    return(TRUE);
  568. }
  569.  
  570.  
  571. /**********************************************************************\
  572.  
  573.                            New to ImageFX 1.50
  574.  
  575. \**********************************************************************/
  576.  
  577. /*
  578.  * VM_MoveMenu()
  579.  *
  580.  * Called by ImageFX whenever the menu panel is moved up or down,
  581.  * or popped to the back or front.  Can be use for special tricks
  582.  * involving whatever display you're using.
  583.  *
  584.  * This function is only called when you set the XF_MOVEMENU flag
  585.  * in the ModuleBase's ExtFlags field (in UserOpen below).
  586.  *
  587.  * (This requires ImageFX 1.50.)
  588.  *
  589.  * Inputs:
  590.  *
  591.  *    scr      - pointer to the menu Screen
  592.  *    hidden   - TRUE if menu is hidden, FALSE if it's visible
  593.  *
  594.  *
  595. void __saveds __asm VM_MoveMenu (register __a0 struct Screen *scr,
  596.                                  register __d0 BOOL hidden)
  597. {
  598. }
  599.  
  600. UWORD pattern[] = { 0x5555, 0xAAAA };
  601.  
  602. /*
  603.  * VM_Ghost()
  604.  *
  605.  * Called by ImageFX whenever areas of the screen need to be
  606.  * "ghosted".  Ghosted areas are used to denote portions of the
  607.  * screen outside the image, when the aspect lock is on.  You should
  608.  * try to pick some kind of ghosting that looks, well, ghosted.
  609.  *
  610.  * This function is only called when you set the XF_GHOST flag
  611.  * in the ModuleBase's ExtFlags field (in UserOpen below).  You
  612.  * should always provide a VM_Ghost vector, otherwise the display
  613.  * will probably not look too hot when the user has aspect lock on.
  614.  *
  615.  * (This requires ImageFX 1.50.)
  616.  *
  617.  * Inputs:
  618.  *
  619.  *    left, top, right, bottom
  620.  *             - area to ghost, in preview pixels.  You should
  621.  *               check to make sure the area isn't zero width
  622.  *               or height.
  623.  *
  624.  */
  625. void __saveds __asm VM_Ghost (register __d0 int left,
  626.                               register __d1 int top,
  627.                               register __d2 int right,
  628.                               register __d3 int bottom)
  629. {
  630.    if ((right - left >= 0) && (bottom - top) >= 0) {
  631.       SetAPen(rport, 15);
  632.       SetBPen(rport, 0);
  633.       SetDrMd(rport, JAM2);
  634.       SetAfPt(rport, pattern, 1);
  635.       RectFill(rport, left, top, right, bottom);
  636.    }
  637. }
  638.  
  639. /*
  640.  * VM_ExtendedInit()
  641.  *
  642.  * Extended initialization function.  This is called by ImageFX after
  643.  * your preview screen (or whatever) has been opened.  It can be used
  644.  * to further initialize values that are based on the screen (a good
  645.  * example is setting the AspectX and AspectY values in the PreviewInfo
  646.  * based on the screen's DimensionInfo).
  647.  *
  648.  * This function is only called when you set the XF_EXTENDEDINIT flag
  649.  * in the ModuleBase's ExtFlags field (in UserOpen below).
  650.  *
  651.  * (This requires ImageFX 1.50.)
  652.  *
  653.  * Inputs:
  654.  *
  655.  *    pi    - pointer to a PreviewInfo which you may modify as
  656.  *            required (esp. aspect ratio).
  657.  *    scr   - pointer to your preview screen.
  658.  *
  659.  */
  660. BOOL __saveds __asm VM_ExtendedInit (register __a0 struct PreviewInfo *pi,
  661.                                      register __a1 struct Screen *scr)
  662. {
  663. }
  664.  
  665. /**********************************************************************\
  666.  
  667.                          Standard Module Stuff
  668.  
  669. \**********************************************************************/
  670.  
  671.  
  672. /*
  673.  * Function table.  Referenced in "lib.o".
  674.  *
  675.  * The first four entries are the standard library vectors, defined
  676.  * in "lib.o", the remaining entries define functions specific to
  677.  * this module.
  678.  *
  679.  * The table ends with -1.
  680.  *
  681.  */
  682. ULONG FuncTable[] = {
  683.    (ULONG) LibOpen,
  684.    (ULONG) LibClose,
  685.    (ULONG) LibExpunge,
  686.    (ULONG) LibNull,
  687.  
  688.    (ULONG) VM_ExtendedInit,   /* new for 1.50 */
  689.    (ULONG) VM_InitNS,
  690.    (ULONG) VM_Init,
  691.    (ULONG) VM_Cleanup,
  692.    (ULONG) VM_Clear,
  693.    (ULONG) VM_Palette,
  694.    (ULONG) 0,                 /* unused */
  695.    (ULONG) 0,                 /* unused */
  696.    (ULONG) 0,                 /* unused */
  697.    (ULONG) 0,                 /* unused */
  698.    (ULONG) VM_MapCoordsFrom,
  699.    (ULONG) VM_MapCoordsTo,
  700.  
  701.    (ULONG) VM_PalInit,
  702.    (ULONG) VM_PalCleanup,
  703.    (ULONG) VM_PalInitNS,
  704.    (ULONG) VM_PalSetRGB8,
  705.    (ULONG) VM_PalDraw,
  706.    (ULONG) VM_PalBox,
  707.    (ULONG) VM_PalRange,
  708.  
  709.    (ULONG) 0,                 /* unused */
  710.    (ULONG) VM_InitBrushEncode,
  711.    (ULONG) VM_CleanupBrushEncode,
  712.    (ULONG) VM_InitStencil,
  713.    (ULONG) 0,                 /* unused */
  714.    (ULONG) 0,                 /* unused */
  715.    (ULONG) 0,                 /* unused */
  716.    (ULONG) VM_Ghost,          /* new for 1.50 */
  717.  
  718.    (ULONG) VM_Hide,
  719.    (ULONG) VM_Show,
  720.    (ULONG) VM_Pause,
  721.    (ULONG) VM_Resume,
  722.    (ULONG) VM_SavePrefs,
  723.    (ULONG) VM_LoadPrefs,
  724.  
  725.    (ULONG) VM_OutputRow24,
  726.    (ULONG) VM_OutputRow8,
  727.    (ULONG) VM_InitUpdate,
  728.    (ULONG) VM_CleanupUpdate,
  729.  
  730.    (ULONG) VM_Identification,
  731.  
  732.    (ULONG) VM_MoveMenu,       /* new for 1.50 */
  733.  
  734.    (ULONG) 0,                 /* reserved */
  735.    (ULONG) 0,                 /* reserved */
  736.    (ULONG) 0,                 /* reserved */
  737.    (ULONG) 0,                 /* reserved */
  738.    (ULONG) 0,                 /* reserved */
  739.  
  740.    (ULONG) -1L
  741. };
  742.  
  743. /*
  744.  * ID string for this module.  References in "lib.o".
  745.  *
  746.  * Should be given in the standard 2.0 version string style.
  747.  */
  748. UBYTE LibraryID[] = "$VER: Untitled 1.00.00 (19.6.92)";
  749.  
  750. /*
  751.  * Type of module.  Referenced in "lib.o".
  752.  *
  753.  * Should be one of the NT_* defines in <scan/mod.h>
  754.  *
  755.  */
  756. UBYTE LibraryType = NT_PREVIEW;
  757.  
  758. /*
  759.  * Module initialization code.  Referenced by "lib.o".
  760.  *
  761.  * This is where you would initialize the ModuleBase structure that
  762.  * is passed to you.
  763.  *
  764.  * Returns TRUE if all went well, or FALSE if something went wrong and
  765.  * the module open should fail.
  766.  *
  767.  */
  768. LONG __saveds __stdargs UserOpen (struct ModuleBase *modbase)
  769. {
  770. // modbase->NewWin = newWindow;                 /* Preview Options window */
  771. // modbase->NewGad = newGads;                   /* GUI for Preview Options */
  772.    modbase->Language = "Preview_Skeleton";      /* Language tag */
  773.    modbase->LangCount = TXT_COUNT;              /* Number of texts */
  774.    modbase->PrefID = 'PSKL';                    /* Preferences tag */
  775.    modbase->PrefLen = sizeof(struct MyPrefs);   /* Size of prefs data */
  776.    modbase->ExtFlags = XF_GHOST;
  777.    return(TRUE);
  778. }
  779.  
  780. /*
  781.  * Module cleanup code.  Referenced by "lib.o".
  782.  *
  783.  * This should cleanup anything you allocated or opened in UserOpen()
  784.  * above.
  785.  *
  786.  * Always return TRUE.
  787.  *
  788.  */
  789. LONG __saveds __stdargs UserClose (struct ModuleBase *modbase)
  790. {
  791.    return(TRUE);
  792. }
  793.  
  794.