#define COPYRIGHT   "Copyright 1989 by Davide P. Cervone, all rights reserved" 

#define PORTNAME        "Zoom-Daemon-Port"


/*
 *  Zoom Gadget GadgetID
 */

#define ZOOMGADG        (('Z'<<8)|('M'))

/*
 *  Zoom Gadget sizes
 */

#define ZOOMWIDTH       27
#define ZOOMHEIGHT      10
#define ZOOMDEPTH       2
#define ZOOMWORDS       2

#define LRZOOMWIDTH     19
#define LRZOOMHEIGHT    10
#define LRZOOMDEPTH     2
#define LRZOOMWORDS     2


/*
 *  Used to define flag bits
 */

#define     BIT(x)      (1<<(x))

/*
 *  Extended gadget structure:
 *     pointers for linked list og Zoom Gadgets
 *     pointer to window that has this zoom gadget
 *     window's un-zoomed size
 *     flags for this window/gadget
 *     copy of the ZoomGadget used by this window
 */

struct ExtGadget
{
   struct ExtGadget *Next,*Prev;
   struct Window *Window;
   WORD x,y,w,h;
   UWORD Flags;
      #define EG_ZOOMEDOUT  BIT(0)
      #define EG_ZOOMEDIN   BIT(1)
      #define EG_ZOOMED     (EG_ZOOMEDOUT|EG_ZOOMEDIN)
   struct Gadget Gadget;
};
#define EXTGADGETSIZE   (sizeof(struct ExtGadget))


/*
 *  Zoom_HandlerInfo
 *
 *  The data structure shared between the handler and the loader
 *  the loader sets some of these variables on behalf of the handler,
 *  in order to keep the handler as small as possible.  The handler
 *  passes information that the loader needs (like the pointers to 
 *  the routines for SetFunction) via this structure
 */

struct Zoom_HandlerInfo
{
   struct MsgPort Zoom_Port;                /* port used to store this info */
   short MajVers,MinVers, MinLoadVers;      /* version of handler and loader */
   long Segment;                            /* SegList loaded by loader */
   struct IntuitionBase **IntuitionBase;
   struct SysBase **SysBase;
   
   /*
    *  This is the Interrupt structure used to add the handler into the
    *  Input Device chain of handlers
    */

   struct Interrupt *Zoom_Interrupt;

   /*
    *  These are the routines replaced by SetFunction()
    */
   
   void (*aOpenWindow)();
   void (*aCloseWindow)();
   void (*aAddGadget)();
   void (*aAddGList)();
   
   long *OldOpenWindow;
   long *OldCloseWindow;
   long *OldAddGadget;
   long *OldAddGList;
   
   /*
    *  These are the structures used by Zoom-Handler for set-up and clean-up
    */
    
   void (*SetupWindow)();
   struct ExtGadget **FirstZoom;
};


/*
 *  Macros to make using Zoom_HandlerInfo easy
 */

#define VAR(x)      (*(Zoom_HandlerData->x))
#define var(x)      (Zoom_HandlerData->x)
