home *** CD-ROM | disk | FTP | other *** search
- /* An simple HDF image viewer
- 4/26/91 Richard A. Gerber
- */
-
- #include <exec/types.h>
- #include <exec/memory.h>
- #include <exec/ports.h>
- #include <intuition/intuition.h>
- #include <libraries/dos.h>
- #include <graphics/gfxbase.h>
- #include <graphics/gfxmacros.h>
-
- #include <proto/exec.h>
- #include <proto/intuition.h>
- #include <proto/dos.h>
- #include <proto/graphics.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <math.h>
-
- #include <libraries/asl.h>
- #include <iff/iff.h>
-
-
- #include "hame_pragmas.h"
- #include "HameStruct.h"
- #include "HameProtos.h"
- #include "HameRev.h"
-
- #include "View_define.h"
- #include "View_screen.h"
- #include "View_window.h"
- #include "ViewProtos.h"
- #include "ViewRequester.h"
- #include "globals.h"
-
- VOID main(int argc, char *argv[])
- {
- UBYTE done = 0;
- setGlobalColors();
-
- mode=COLORS_LACE_32;
- getDefPal(NULL); /* 32 color mode */
- openGraphics();
- creditScreen();
- Delay(1*50);
-
- gadgetScreen();
-
- newscreen.Height = HEIGHT;
- newscreen.Width = WIDTH;
- newscreen.TopEdge = S_TOPEDGE;
- newscreen.LeftEdge = S_LEFTEDGE;
- newscreen.ViewModes = NULL;
- newscreen.Depth = 5;
- mode=COLORS_32;
-
- while (!done) /* Wait for IDCMP messages */
- {
- signals = Wait(signalmask);
- if (signals & signalmask)
- done = handleIDCMP();
- };
-
- myExit(NULL);
-
- }
-
-
-
-
- /* Exit program, returning all resources to the system */
-
- VOID myExit (text)
- char *text;
- {
- char fullmsg[81];
-
- if (imageWindow) closeWind( imageWindow );
- if(sw) closeWind(sw);
- if(credwin) closeWind(credwin);
- if(gWindow) closeWind(gWindow);
-
- if ( messagePort ) DeletePort(messagePort);
-
-
- if (hamePort) HAME_Dispose(hamePort);
- if (imageScreen) CloseScreen( imageScreen );
- if (gScreen) CloseScreen( gScreen );
-
- if (IntuitionBase) CloseLibrary( (struct Library *)IntuitionBase );
- if (GfxBase) CloseLibrary( (struct Library *)GfxBase );
- if (HameBase) CloseLibrary( (struct Library *)HameBase );
- if (IFFBase) CloseLibrary( (struct Library *)IFFBase );
- if (AslBase) CloseLibrary( (struct Library *)AslBase );
-
-
- if(image)
- FreeMem(image,width*height*sizeof(char));
-
- if(text) {
- sprintf(fullmsg,"Program ending. Problem with: %s.",text);
- request(fullmsg,NULL);
- }
- exit(0);
- }
-
-
- /* Another in the very useful RKM routines. Closes down a window
- in a nice manner while leaving a shared message port intact.
- */
- VOID
- closeWind(struct Window *w)
- {
- struct IntuiMessage *msg, *succ;
-
- Forbid();
-
- msg = (struct IntuiMessage *)messagePort->mp_MsgList.lh_Head;
-
- while(succ = (struct IntuiMessage *)msg->ExecMessage.mn_Node.ln_Succ)
- {
- if(msg->IDCMPWindow == w)
- {
- Remove((struct Node*)msg);
- ReplyMsg((struct Message*)msg);
- }
- msg = succ;
- }
-
- w->UserPort = NULL;
- ModifyIDCMP(w,0);
- Permit();
- CloseWindow(w);
- }
-
-
-
-
-