home *** CD-ROM | disk | FTP | other *** search
- /* window.c */
- /* Copyright 1990 Thomas E. Janzen All Rights Reserved */
- /*
- ** FACILITY:
- **
- ** AlgoRhythms music improviser on Commodore (TM) Amiga (TM)
- ** compiled with Lattice (TM) C 5.05
- **
- ** ABSTRACT:
- **
- ** Algorhythms improvises music over the MIDI serial port.
- **
- ** AUTHORS: Thomas E. Janzen
- **
- ** CREATION DATE: 26-MAR-1990
- **
- ** MODIFICATION HISTORY:
- ** DATE NAME DESCRIPTION
- **--
- */
- #include <exec/types.h>
- #include <exec/nodes.h>
- #include <exec/lists.h>
- #include <intuition/intuition.h>
- #include <graphics/text.h>
- #include <proto/exec.h>
- #include <proto/graphics.h>
- #include <proto/intuition.h>
- #include <proto/dos.h>
- #include <proto/mathffp.h>
- #include <math.h>
- #include <stdlib.h>
-
- void OpenWind(void);
- void OpenLibs(void);
- void CloseLibs(void);
- void OpenWind(void);
- void MakeWindow(void);
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
- struct DOSBase *DOSBase;
- struct MathBase *MathBase;
-
- ULONG class,classb; /* Intu Event class */
- USHORT code,codeb; /* Intu Event code */
-
- /*WINDOW*/
- struct Window *w;
- struct RastPort *rp;
- struct ViewPort *vp;
- struct IntuiMessage *message;
-
- void MakeWindow(void) {
- OpenLibs();
- OpenWind();
- }
-
- void OpenWind(void) {
- struct NewWindow nw = {
- 0,10,400,100, /* Left, Top, Width, height */
- 2,1, /* detail, block pens */
- NEWSIZE|CLOSEWINDOW|MENUPICK|GADGETUP|REQCLEAR, /* IDCMP flags */
- WINDOWSIZING|WINDOWDRAG|SMART_REFRESH|WINDOWDEPTH|
- WINDOWCLOSE|GIMMEZEROZERO,
- NULL, /* Pointer to first gadget */
- NULL, /* Pointer to checkmark */
- "AlgoRhythms", /* title */
- NULL, /* screen pointer */
- NULL, /* bitmap pointer */
- 400,100,640,190, /* window not sized */
- WBENCHSCREEN /* type of screen */
- };
- w = OpenWindow(&nw);
- rp = w->RPort; /* Get the raster port pointer */
- vp = &w->WScreen->ViewPort; /* Get the view port pointer */
- }
-
- void OpenLibs(void) {
- if(!(IntuitionBase=
- (struct IntuitionBase *)OpenLibrary("intuition.library",0L))) {
- CloseLibs();
- exit(FALSE);
- }
- if(!(GfxBase =
- (struct GfxBase *)OpenLibrary("graphics.library",0L))) {
- CloseLibs();
- exit(FALSE);
- }
- if(!(MathBase =
- (struct MathBase *)OpenLibrary("mathffp.library",0L))) {
- CloseLibs();
- exit(FALSE);
- }
- if(!(DOSBase =
- (struct DOSBase *)OpenLibrary("dos.library",0L))) {
- CloseLibs();
- exit(FALSE);
- }
- }
-
- void CloseLibs(void) {
- if(GfxBase) CloseLibrary(GfxBase);
- if(IntuitionBase) CloseLibrary(IntuitionBase);
- if(MathBase) CloseLibrary(MathBase);
- if(DOSBase) CloseLibrary(DOSBase);
- }
-
- void ShutWindow(void) {
- CloseLibs();
- CloseWindow(w);
- }
-