/* $Revision Header *** Header built automatically - do not edit! ***********
 *
 *	(C) Copyright 1990 by MXM
 *
 *	Name .....: mxmbase.h
 *	Created ..: Saturday 06-Jan-90 23:27
 *	Revision .: 7
 *
 *	Date            Author          Comment
 *	=========       ========        ====================
 *	01-Apr-90	Olsen		Rework for Aztec 5.0
 *	25-Feb-90	Olsen		Changes in structures/functions
 *	08-Feb-90	Olsen		Changes in structures/functions
 *	14-Jan-90	Olsen		Renamed to mxm.library
 *	08-Jan-90       Olsen           Added new functions
 *	08-Jan-90       Olsen           Added PrinterSupport & Joystick
 *	06-Jan-90       Olsen           Created this file!
 *
 * $Revision Header ********************************************************/

#ifndef _MXMBASE_H
#define _MXMBASE_H 1

#ifndef INTUITION_INTUITIONBASE_H
#include <intuition/intuitionbase.h>
#endif	/* !INTUITION_INTUITIONBASE_H */

#ifndef LIBRARIES_DOSEXTENS_H
#include <libraries/dosextens.h>
#endif	/* !LIBRARIES_DOSEXTENS_H */

#ifndef GRAPHICS_GFXBASE_H
#include <graphics/gfxbase.h>
#endif	/* !GRAPHICS_GFXBASE_H */

#ifndef DEVICES_CONSOLE_H
#include <devices/console.h>
#endif	/* !DEVICES_CONSOLE_H */

#ifndef DEVICES_PRINTER_H
#include <devices/printer.h>
#endif	/* !DEVICES_PRINTER_H */

#ifndef DEVICES_PRTBASE_H
#include <devices/prtbase.h>
#endif	/* !DEVICES_PRTBASE_H */

#ifndef DEVICES_KEYMAP_H
#include <devices/keymap.h>
#endif	/* !DEVICES_KEYMAP_H */

#ifndef DEVICES_TIMER_H
#include <devices/timer.h>
#endif	/* !DEVICES_TIMER_H */

#ifndef DEVICE_INPUT_H
#include <devices/input.h>
#endif	/* !DEVICE_INPUT_H */

#ifndef EXEC_MEMORY_H
#include <exec/memory.h>
#endif	/* !EXEC_MEMORY_H */

	/* This will get along with some misnamed structure tags. */

#define TimeVal		timeval
#define TimeRequest	timerequest

	/* The base structure of mxm.library. */

struct MXMBase
{
	struct Library	LibNode;

		/* These pointers may be used by any program
		 * opening the library.
		 */

	APTR		IntuitionBase;
	APTR		GfxBase;
	APTR		LayersBase;
	APTR		DOSBase;
	APTR		ConsoleDevice;
};

	/* Support structure for PopRequest. */

struct PopSupport
{
	ULONG	ps_Flags;
	LONG	ps_TimeOut;
};

	/* Private structure to support the Raw->ANSI translation. */

struct KeyEquivalent
{
	UBYTE	ke_Normal;
	UBYTE	ke_Shift;
	UBYTE	ke_Control;
	UBYTE	ke_Alternate;
};

	/* Support structure for RastPort-dump. */

struct PrinterSupport
{
	struct IODRPReq			*ps_PrinterIO;
	struct MsgPort			*ps_PrinterPort;

	struct PrinterData		*ps_PrinterData;
	struct PrinterExtendedData	*ps_PrinterExtended;
	struct Preferences		*ps_Preferences;
};

	/* Private support structures for Disable/EnableWindow(). */

struct DisInfo
{
	struct Gadget	*di_Gadget;
	USHORT		 di_Flags;
};

struct DisableSupport
{
	ULONG		 ds_WindowFlags;

	struct DisInfo	*ds_Gadgets;
	LONG		 ds_NumGadgets;
};

	/* Definitions for the single keycodes returned by KeyConvert
	 * and which are not in the standard ASCII char list.
	 */

#define KC_SHIFT	16	/* Key pressed together with shift. */

#define KC_CURSORUP	140	/* Looks like a cursor key. */
#define KC_CURSORDOWN	141
#define KC_CURSORRIGHT	142
#define KC_CURSORLEFT	143

#define KC_FKEY1	129	/* The function keys. */
#define KC_FKEY2	130
#define KC_FKEY3	131
#define KC_FKEY4	132
#define KC_FKEY5	133
#define KC_FKEY6	134
#define KC_FKEY7	135
#define KC_FKEY8	136
#define KC_FKEY9	137
#define KC_FKEY10	138

#define KC_HELP		139	/* Hit the help key. */

	/* Flags for the PopSupport-structure. */

#define PS_CENTER	0x00000001	/* Center the requester. */
#define PS_TIMEOUT	0x00000002	/* Close after timeout. */
#define PS_DONTMOVE	0x00000004	/* Don't put the pointer on a gadget. */
#define PS_BEEP		0x00000008	/* Send a display beep on open. */
#define PS_STAYACTIVE	0x00000010	/* Stay active. */
#define PS_ANNOUNCE	0x00000020	/* New beep. */

	/* Definitions for pop-up-menus. */

#define POPTITLEHEIGHT 10	/* Standard height of the menu title. */

	/* These flags have to be incorporated into the Flags entry
	 * of the Menu-structure.
	 */

#define POPVERIFY	0x0002	/* Reserved. */
#define POPRELEASE	0x0004	/* Reserved. */
#define POPTIDY		0x0008	/* Menu has to appear entirely. */
#define POPPOINTREL	0x0010	/* Menu appears relative to pointer. */
#define POPWINREL	0x0020	/* Menu appears relative to window. */
#define POPREMEMBER	0x0040	/* NOT SUPPORTED! */
#define POPUSED		0x0080	/* NOT SUPPORTED! */
#define POPMOVEPOINTER	0x0200	/* Reserved. */
#define POPLEFTBUTTON	0x1000	/* Menu activated by left button. */
#define POPRIGHTBUTTON	0x2000	/* Menu activated by right button. */
#define POPTRIGGERDOWN	0x4000	/* Reserved. */
#define POPTRIGGERUP	0x8000	/* Reserved. */

	/* InvertKey-Kommandos. */

#define IK_NOSPECIAL	0	/* No fancy action. */
#define IK_BUILDLIST	1	/* Build conversion list. */
#define IK_USEIKM	2	/* Use Jimm's IKM routines. */
#define IK_USELIST	4	/* Use list conversion. */

	/* Some special macros. */

#define byte(Width)	(((Width + 15) >> 4) << 1)
#define LOCAL		static
#define AllocItem(i)	((VOID *)AllocMem(sizeof(i),MEMF_PUBLIC | MEMF_CLEAR))
#define FreeItem(i)	(i ? FreeMem(i,sizeof(i)) : 0)
#define AllocPub(s)	(AllocRem(s,MEMF_PUBLIC | MEMF_CLEAR))
#define AllocChip(s)	(AllocRem(s,MEMF_PUBLIC | MEMF_CHIP | MEMF_CLEAR))

	/* Library tags. */

#define MXM_NAME	"mxm.library"
#define MXM_VERSION	34L

	/* Use this rather than MXM_VERSION to open mxm.library. */

#define MXM_MINIMUM	34L

#endif	/* _MXMBASE_H */
