/*
** MUI-Main.h - allgemeine Daten für die ganzen MUI-Sourcen
**
** Copyright (C) 1996 by Stefan Scherer.
**
** Permission to use, copy, modify, and distribute this software and its
** documentation for non-commerical use and without fee is hereby granted,
** provided that the above copyright notice appear in all copies and that
** both that copyright notice and this permission notice appear in
** supporting documentation.  This software is provided "as is" without
** express or implied warranty.
*/

#ifndef MUI_MAIN_H
#define MUI_MAIN_H

/*************************************************************/
/* Includes and other common stuff for the MUI demo programs */
/*************************************************************/

/* MUI */
#include <libraries/mui.h>

/* System */
#include <dos/dos.h>
#include <graphics/gfxmacros.h>
#include <workbench/workbench.h>
#include <libraries/iffparse.h>

/* Prototypes */
#include <clib/alib_protos.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>
#include <clib/icon_protos.h>
#include <clib/graphics_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/utility_protos.h>
#include <clib/asl_protos.h>
#include <clib/muimaster_protos.h>

#include <intuition/icclass.h>
#include <gadgets/textfield.h>
#include <proto/textfield.h>
#include <proto/iffparse.h>

/* ANSI C */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>


/* number of years for cycle gadget (1993..1993+MAX_YEARS) */
#define MAX_YEARS 20

/* Compiler specific stuff */

#ifdef _DCC

#define REG(x) __ ## x
#define ASM
#define SAVEDS __geta4

#else

#define REG(x) register __ ## x

#ifdef __MAXON__
#define ASM
#define SAVEDS
#else
#define ASM    __asm
#define SAVEDS __saveds
#endif

#include <pragmas/exec_pragmas.h>
#include <pragmas/dos_pragmas.h>
#include <pragmas/icon_pragmas.h>
#include <pragmas/graphics_pragmas.h>
#include <pragmas/intuition_pragmas.h>
#include <pragmas/gadtools_pragmas.h>
#include <pragmas/utility_pragmas.h>
#include <pragmas/asl_pragmas.h>
#include <pragmas/muimaster_pragmas.h>

extern struct Library *SysBase, *UtilityBase, *IconBase;
extern struct IntuitionBase *IntuitionBase;
extern struct DosLibrary *DOSBase;
extern struct GfxBase *GfxBase;
extern struct Library *MUIMasterBase;

#endif

#include "Rechnungen.h"
#include "Kunden.h"
#include "LocaleSupport.h"
#include "Briefe.h"
#include "Artikel.h"
#include "Auftrag.h"
#include "AuftragsListe.h"
#include "RechnungsListe.h"
#include "BriefListe.h"
#include "MUI-Rechnung_rev.h"
#include "Config.h"
#include "Print.h"
#include "MiscSupport.h"
#include "LocaleSupport.h"
#include <intuition/sghooks.h>

#include "MUI_Rechnung.h"
#include "MUI_Auftrag.h"
#include "MUI_Brief.h"


/* gesetzt, damit das Stringgadget ST_A_EKeinzel eingebunden wird. */
/* momentan entfernt... */
//#define ORDER_EK

/* um die Oberfläche mit Demodaten zu füllen */
//#define DEMO_INVOICE


/* ------------------------------------------------------------------
   ** Test: ShowDVI auf dem MUI-PublicScreen öffnen für Vorschau
 */

#define SHOW_DVI


#define KeyMonetaryString(contents,maxlen,controlchar)\
	StringObject,\
		StringFrame,\
		MUIA_ControlChar    , controlchar,\
		MUIA_String_MaxLen  , maxlen,\
		MUIA_String_Contents, contents,\
		End

#define KeyZuschlagString(contents,maxlen,controlchar)\
	StringObject,\
		StringFrame,\
		MUIA_ControlChar    , controlchar,\
		MUIA_String_MaxLen  , maxlen,\
		MUIA_String_Contents, contents,\
		MUIA_String_Accept  , "0123456789,.%- ",\
		End

#define KeyDateString(contents,maxlen,controlchar)\
	StringObject,\
		StringFrame,\
		MUIA_ControlChar    , controlchar,\
		MUIA_String_MaxLen  , maxlen,\
		MUIA_String_Contents, contents,\
		MUIA_String_Accept  , "0123456789.",\
		End

/* aus dem Sourcecode Benutzer.a sind zwei externe Variablen, die für
   ** die Registrierung benötigt werden.
 */

extern char Benutzer[];
extern char Keyfile[];
extern ULONG oldchecksum;
extern void DecodeString (STRPTR);
extern BOOL CheckSum (STRPTR, ULONG);


/*
   ** Die Event-Codes werden grob eingeteilt.
 */

#define ID_IL_BASE 1000
#define ID_OL_BASE 2000
#define ID_LL_BASE 3000



/* globale Zeiger für MUI */

extern APTR app, WI_customer, WI_order, WI_invoice, WI_article, WI_main;
extern APTR WI_config, WI_letlist, WI_invlist, WI_ordlist, WI_letter;


extern char *CYA_MwSt[];
extern char *CYA_BruttoNetto[];

extern struct MinCustomer cashcust;

/* Kunde */

BOOL C_CheckAbort (BOOL);
void InitCustomerWin (UWORD number);

extern UWORD closeCustomerAction;
enum
  {
    CCA_MAIN,			/* Kundenliste aus dem Hauptfenster öffnen */
    CCA_ORDER,			/* Kunde für Auftrag auswählen */
    CCA_INVOICE,		/* Kunde für Rechnung auswählen */
    CCA_LABEL,			/* Kunde für Etikett auswählen */
    CCA_LETTER,			/* Kunde für Brief auswählen */
  };

/* Artikel */

BOOL A_CheckAbort (BOOL);
void InitArticleWin (void);

extern APTR REG_A_mode;

extern UWORD closeArticleAction;
enum
  {
    CAA_MAIN,			/* Artikelliste aus dem Hauptfenster öffnen */
    CAA_ORDER,			/* Artikel für Auftrag auswählen */
    CAA_INVOICE,		/* Artikel für Rechnung auswählen */
    CAA_LETTER,			/* Artikel für Brief auswählen */
  };


extern struct Library *TextFieldBase;
extern Class *TextFieldClass;
extern struct ClipboardHandle *clip_handle;
extern struct ClipboardHandle *undo_handle;

#endif /* MUI_MAIN_H */
