home *** CD-ROM | disk | FTP | other *** search
- #include <exec/types.h>
- #include <scan/modall.h>
- #include <scan/loadsave.h>
-
-
- /**********************************************************************\
-
- Language Indexes
-
- \**********************************************************************/
-
- #define TXT(i) GetStr((i), Default_Strings[(i)])
-
- enum {
- TXT_Msg1 = 0, /* This example doesn't render */
- TXT_ModuleName, /* Skeleton */
- TXT_RenderLabel, /* Render */
- TXT_ModuleLabel, /* Module: */
- TXT_COUNT
- };
-
- char *Default_Strings[] = {
- "This example doesn't render.",
- "Skeleton",
- "Render",
- "Module:"
- };
-
- /**********************************************************************\
-
- GED Gadget Functions
-
- \**********************************************************************/
-
- /*
- * This function will be called when the user clicks on the Render
- * button. Normally one would find the current image buffer and
- * then do whatever it takes to render a display.
- *
- */
- int __saveds RenderCode (GedButtonProto)
- {
- InfoRequest(TXT(TXT_Msg1));
- return(0);
- }
-
- /**********************************************************************\
-
- GED GUI Description
-
- \**********************************************************************/
-
- enum {
- ID_Module = 1,
- ID_Render
- };
-
- struct NewGad newGads[] = {
- /* button to change the render module */
- { Button_ID, ID_Module, 16,24,102,12, TXT_ModuleName, ChangeRender,0, NULL, 0,'\0',NULL,0 },
- /* button to initiate rendering */
- { Button_ID,ID_Render, 16,62,102,12, TXT_RenderLabel, RenderCode,0, NULL, 0,'\0',NULL,0 },
- /* text labelling the change-module gadget above */
- { Text_ID, 0, 67,15,0,0, TXT_ModuleLabel, NULL,0,NULL, 2,0,2,0 },
- { End_ID }
- };
-
- /**********************************************************************\
-
- Housekeeping
-
- \**********************************************************************/
-
- BOOL clear_text = FALSE;
-
- /*
- * RM_Init()
- *
- * Module initialization function. ImageFX will call this function
- * when the module is first loaded into memory (once). Return TRUE
- * if all goes well or FALSE on failure.
- *
- * We need to do a little bit of voodoo magic with the text strings
- * to make the Ged stuff work right.
- *
- */
- int __saveds RM_Init (void)
- {
- if (ModuleBase->Text == NULL) {
- clear_text = TRUE;
- ModuleBase->Text = Default_Strings;
- }
- return(TRUE);
- }
-
- /*
- * RM_Cleanup()
- *
- * Cleanup any and all resources, memory, or whatever allocated
- * in the RM_Init() function above. ImageFX will call this function
- * just before unloading the module.
- *
- */
- void __saveds RM_Cleanup (void)
- {
- if (clear_text) ModuleBase->Text = NULL;
- }
-
- /*
- * RM_Show()
- *
- * This function is called when ImageFX displays this module's
- * GUI onscreen. This can be used as an indicator of when the
- * user "enters" this module (to bring up additional screens or
- * whatever).
- *
- * The window argument is a pointer to ImageFX's main window
- * (where all of this module's gadgets have been added).
- *
- * Return TRUE on success or FALSE on failure.
- *
- */
- int __saveds __asm RM_Show (register __a0 struct Window *window)
- {
- return(TRUE);
- }
-
- /*
- * RM_Clear()
- *
- * This function is called when ImageFX is removing this module's
- * GUI from the display. This can be used as an indicator of when
- * the user "leaves" this module. Generally you should 'undo' whatever
- * it is you did in the RM_Show() function above.
- *
- * The window argument is a pointer to ImageFX's main window
- * (where all of this module's gadgets have been added).
- *
- */
- void __saveds __asm RM_Clear (register __a0 struct Window *window)
- {
- }
-
- /**********************************************************************\
-
- Rendered Screen Handling
-
- \**********************************************************************/
-
- BOOL image_is_rendered = FALSE;
-
- /*
- * RM_GetRendered()
- *
- * Fill in the supplied MappedImage structure (see scan/loadsave.h)
- * with information describing the current rendered image. If
- * no image is rendered, return 0. Otherwise, return non-zero.
- *
- * Note that it is legal for ImageFX to pass a NULL MappedImage
- * pointer; in this case, ImageFX is just trying to find out if
- * there is a rendered image or not and you should just return
- * zero or non-zero.
- *
- */
- int __saveds __asm RM_GetRendered (register __a0 struct MappedImage *img)
- {
- if (image_is_rendered) {
- if (img) {
- /*
- * fill in MappedImage structure here.
- */
- }
- return(TRUE);
- }
- return(FALSE);
- }
-
- /**********************************************************************\
-
- Preferences Handling
-
- \**********************************************************************/
-
- /*
- * This structure defines the format for your preferences. ImageFX
- * will store this structure in the user's prefs files.
- */
- struct MyPrefs {
- short Stuff[4];
- LONG Reserved[8]; /* Always a good idea to reserve some space */
- };
-
- /*
- * RM_LoadPrefs()
- *
- * Configure your module based on the settings in the supplied
- * preferences structure. Note that your module does not necessarily
- * have to be displayed for this function to be called, so make sure
- * that your gadgets exist before fiddling with them. Return TRUE
- * on success, or FALSE on failure.
- *
- */
- BOOL __saveds __asm RM_LoadPrefs (register __a0 struct MyPrefs *prefs)
- {
- return(TRUE);
- }
-
- /*
- * RM_SavePrefs()
- *
- * Store your current module configuration into the supplied
- * preferences structure. ImageFX will then save it to disk.
- *
- */
- BOOL __saveds __asm RM_SavePrefs (register __a0 struct MyPrefs *prefs)
- {
- return(TRUE);
- }
-
- /**********************************************************************\
-
- Miscellaneous
-
- \**********************************************************************/
-
- /*
- * RM_HandleMMove()
- *
- * Called whenever a MOUSEMOVE event is received by ImageFX that it
- * does not understand. You can use this to process events for your
- * own windows that you open.
- *
- * The message passed to you is a copy, DO NOT REPLY TO IT!
- *
- * You should return 1 if you knew how to deal with the event, or
- * 0 if you ignored it.
- *
- * You must set the XF_MOUSETRAP flag in your ModuleBase's ExtFlags
- * field (in the UserOpen function below) to use this feature.
- *
- */
- int __saveds __asm RM_HandleMMove (register __a0 struct IntuiMessage *msg)
- {
- return(0);
- }
-
- /*
- * RM_HandleMButton()
- *
- * Called whenever a MOUSEBUTTON event is received by ImageFX that it
- * does not understand. You can use this to process events for your
- * own windows that you open.
- *
- * The message passed to you is a copy, DO NOT REPLY TO IT!
- *
- * You should return 1 if you knew how to deal with the event, or
- * 0 if you ignored it.
- *
- * You must set the XF_MOUSETRAP flag in your ModuleBase's ExtFlags
- * field (in the UserOpen function below) to use this feature.
- *
- */
- int __saveds __asm RM_HandleMButton (register __a0 struct IntuiMessage *msg)
- {
- return(0);
- }
-
- /*
- * RM_ChangeNotify()
- *
- * Called whenever the main buffer in ImageFX changes (eg. when the
- * user loads or creates a new image). This can be used to update
- * display fields that depend on the image in some way.
- *
- * You must set the XF_LOADNOTIFY flag in your ModuleBase's ExtFlags
- * field (in the UserOpen function below) to use this feature.
- *
- * (Requires ImageFX 1.50 or later.)
- *
- */
- void __saveds RM_ChangeNotify (void)
- {
- }
-
- /**********************************************************************\
-
- Arexx Functions
-
- \**********************************************************************/
-
- /*
- * Sample Arexx command handler. All render modules should have a
- * command that starts rendering. This one simply calls the Render
- * gadget's code handler to do the render.
- */
- static int __saveds __stdargs Arexx_Go (ArexxProto)
- {
- RenderCode(NULL, NULL, 0);
- return(0);
- }
-
- /*
- * This table defines all the Arexx commands we understand. The
- * user sends us Arexx commands via. the ImageFX "RENDER" command.
- * We must supply a pointer to this table in the UserOpen()
- * function below.
- */
- static RXCMD MyRexxCommands[] = {
- { "GO", Arexx_Go, "" },
- { NULL }
- };
-
-
- /**********************************************************************\
-
- Standard Module Stuff
-
- \**********************************************************************/
-
-
- /*
- * Function table. Referenced in "lib.o".
- *
- * The first four entries are the standard library vectors, defined
- * in "lib.o", the remaining entries define functions specific to
- * this module.
- *
- * The table ends with -1.
- *
- */
- ULONG FuncTable[] = {
- (ULONG) LibOpen,
- (ULONG) LibClose,
- (ULONG) LibExpunge,
- (ULONG) LibNull,
-
- (ULONG) RM_Init,
- (ULONG) RM_Cleanup,
- (ULONG) RM_Show,
- (ULONG) RM_Clear,
- (ULONG) 0, /* unused */
- (ULONG) RM_GetRendered,
- (ULONG) 0, /* unused */
- (ULONG) RM_LoadPrefs,
- (ULONG) RM_SavePrefs,
- (ULONG) 0, /* unused */
- (ULONG) 0, /* unused */
-
- (ULONG) RM_HandleMMove,
- (ULONG) RM_HandleMButton,
-
- (ULONG) RM_ChangeNotify,
-
- (ULONG) 0, /* reserved */
- (ULONG) 0, /* reserved */
- (ULONG) 0, /* reserved */
-
- (ULONG) -1L
- };
-
- /*
- * ID string for this module. References in "lib.o".
- *
- * Should be given in the standard 2.0 version string style.
- */
- UBYTE LibraryID[] = "$VER: Untitled 1.00.00 (19.6.92)";
-
- /*
- * Type of module. Referenced in "lib.o".
- *
- * Should be one of the NT_* defines in <scan/mod.h>
- *
- */
- UBYTE LibraryType = NT_RENDER;
-
- /*
- * Module initialization code. Referenced by "lib.o".
- *
- * This is where you would initialize the ModuleBase structure that
- * is passed to you.
- *
- * Returns TRUE if all went well, or FALSE if something went wrong and
- * the module open should fail.
- *
- */
- LONG __saveds __stdargs UserOpen (struct ModuleBase *modbase)
- {
- modbase->NewGad = newGads; /* GUI */
- modbase->Language = "Render_Skeleton"; /* Language tag */
- modbase->LangCount = TXT_COUNT; /* Number of texts */
- modbase->CmdTable = MyRexxCommands; /* Arexx cmd table */
- modbase->PrefID = 'RSKL'; /* Preferences tag */
- modbase->PrefLen = sizeof(struct MyPrefs); /* Size of prefs data */
- return(TRUE);
- }
-
- /*
- * Module cleanup code. Referenced by "lib.o".
- *
- * This should cleanup anything you allocated or opened in UserOpen()
- * above.
- *
- * Always return TRUE.
- *
- */
- LONG __saveds __stdargs UserClose (struct ModuleBase *modbase)
- {
- return(TRUE);
- }
-
-