#ifndef BAREED_DAC_H
	#define BAREED_DAC_H
/*
	BAREED_DAC

	(C) Copyright 2001 J.v.d.Loo

	Any declared pointer (below) is only readable because it points to a BareED intern variable!
	Never change it!!!

	Any DAC-application can be compiled for a 68020 CPU since BareED itself presupposes it!	
*/

#ifndef EXEC_LIBARIES_H
	#include <exec/libraries.h>
#endif

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

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

#ifndef INTUITION_SCREENS_H
	#include <intuition/screens.h>
#endif

#ifndef WORKBENCH_STARTUP_H
	#include <workbench/startup.h>
#endif


/* Returned by "pm_CreateProgressBar()" - see below.
   Don't assume anything about the ProgressBar more than here stated -
   in real it has got much more items!
*/
struct ProgressBar
{
	struct Window *pb_Window;
};


struct PseudoMsg
{
	/* Normal start-up-message, with one argument (path & filename)
	   ln_Name points to "BAREED"
	   ln_Pri set to zero (= version of this structure - 0 means beta)
	*/
	struct WBStartup 	 pm_Startup;

	/* Following is private, do not read or modify! */
	BPTR				 pm_Lock;
	unsigned char		*pm_Name;
	unsigned char		 pm_FileName[108];
	unsigned char		 pm_Dir[256];

	/* Library bases (assume at least all are v36, except: Asl v38, Icon & Diskfont v33, Locale v1) */
	struct GfxBase		*pm_GfxBase;
	struct IntuitionBase *pm_IntuitionBase;
	struct Library		*pm_GadToolsBase;
	struct Library		*pm_DiskfontBase;
	struct Library		*pm_AslBase;
	struct Library		*pm_IconBase;
	struct Library		*pm_LocaleBase;
	struct Library		*pm_WorkbenchBase;

	/* If you have to do own rendering using GadTools, these two may help you.
	   But beware of releasing them - BareED is the owner!
	*/
	void				*VisualInfo;			/* Never release it! */
	struct DrawInfo		*DrawInfo;				/* Never release it! */

	/* Storage (buffer) start and size */
	unsigned char		*pm_RegionStart;
	unsigned int		 pm_RegionSize;

	/* Archive start and end */
	unsigned char		*pm_TextStart;
	unsigned char		*pm_TextEnd;

	/* Application was started with this marked block */
	unsigned char		*pm_BlockStart;
	unsigned char		*pm_BlockEnd;

	/* Editor is using this attribute for the used font */
	struct TextAttr		*pm_FontAttr;

	/* By editor used font */
	struct TextFont		*pm_Font;

	/* The editor's surrounding */
	struct Window		*pm_EdWindow;

	/* How wide is a tab character in pixels */
	unsigned int		 pm_TabWidth;

	/* A tab stop occurs every 'n' characters (almost!) */
	unsigned int		 pm_TabStops;

	/* Rightmost offset set to 'n' characters (may zero!!!) */
	unsigned int		 pm_RightMargin;

	/* Pointer to 256 bytes - same order like LATIN-1 char-set - where each byte holds
	   the width of the concerned character, e. g. at offset 32 the width of the SPACE-
	   character can be found
	*/
	unsigned char		*pm_CharSpace;			/* Pointer to the character-spaces of the used font */

	/* Currently, following two function pointers are out of order (they are empty!!!)
	   To check if the current BareED version support those two, check them against zero!
	*/
	void				(*pm_GetAttr)( struct TagItem *taglist);
	void				(*pm_ChangeAttr)( struct TagItem *taglist);

	/* Two functions to permit/allow modifications through user-interface --- NOTE:
	   Since BareED protects the archive against modification (user/Arexx) there is no need to
	   call these functions - furthermore - even if you call AllowInput() it will not turn off
	   the protection - it only allows the user to scroll around in the text-file (for example)
	   which is anyway the defaulted mode!
	*/
	void				(*pm_BlockInput)( void);
	void				(*pm_AllowInput)( void);

	/* Display a simple text-requester whithout inhibiting the user from changing BareED's
	   interface. You could call BlockInput() first...
	*/
	void				(*pm_Tell)( STRPTR str);


	/* Display a simple text-requester without inhibiting the user from changing BareED's
	   interface. The user can react on the requester with "YES" or "NO".
	*/
	unsigned int		(*pm_CaseTell)( STRPTR str);

	/* Display a simple number-requester with inhibiting the user from changing BareED's
	   interface!
		initial	 = intial number for the string-gadget that may be changed by the user later on
		winname  = title of the requester
		hailtext = the text displayed as body
		gadtext  = there is only one bool-gadget in this requester, this is the string for it
		zero	 = must be set to zero!
	   Returns NULL if user abandoned or the entered number
	*/
	unsigned int		(*pm_RequestNumber)( unsigned int initial, STRPTR winname, STRPTR hailtext, STRPTR gadtext, BOOL zero);

	/* Four functions - please refere to the DAC-guide for function-reference */
	unsigned int		(*pm_StrPixelLen)( unsigned char *start, unsigned char *end);
	void				(*pm_DumpStrLine)( unsigned char *start, unsigned char *end, struct RastPort *rp, unsigned int x, unsigned int y);
	unsigned int		(*pm_WidestStrLen)( unsigned char *text, unsigned char *stop, unsigned int (*inform_code)( unsigned int len, unsigned int line), unsigned int inform);
	void				(*pm_DumpStrings)( struct RastPort *rp, unsigned int (*dump_code)( unsigned int len, unsigned int line), unsigned char *text, unsigned char *stop);

	/* Functions attached to the progress-bar - refere to DAC-guide... */
	void				(*pm_FreeProgressBar)( struct ProgressBar *pb);
	struct ProgressBar *(*pm_CreateProgressBar)( STRPTR wintitle, STRPTR hail, STRPTR stop, STRPTR cont, STRPTR cancel);
	unsigned int		(*pm_PullPBarEvent)( struct ProgressBar *pb);
	void				(*pm_ChangePBarIndicator)( struct ProgressBar *pb, unsigned int percent, STRPTR hail);

	/* <<< Following does not work properly yet - so don't use! >>>
	*/
	void				(*pm_TogglePBarGad)( struct ProgressBar *pb);

};

#endif
