/* main.h -- Amiga specific includes, defines, types and prototypes
 * Copyright (C) 1994  Torsten Klein
 *
 * This file is part of ASpringies, a mass and spring simulation system for the Amiga
 *
 * ASpringies is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 1, or (at your option)
 * any later version.
 *
 * ASpringies is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with ASpringies; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * $Id: main.h,v 2.9 1994/08/19 11:51:25 Torsten_Klein Exp $
 */

#include "defs.h"

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

/* System */
#define ASL_V38_NAMES_ONLY

#include <dos.h>
#include <dos/dos.h>
#include <graphics/gfxmacros.h>
#include <workbench/workbench.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/layers_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/muimaster_protos.h>
#include <clib/asl_protos.h>

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

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

#define REG(x) register __ ## x
#define ASM    __asm
#define SAVEDS __saveds

#ifndef MAKE_ID
#define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 \
			  | (ULONG) (d))
#endif

#define FAILOPEN(what, command) \
  if (!(command)) main_fail(what, __FILE__, __LINE__);

#define HELP_FILE "PROGDIR:ASpringies.guide"
#define ANIM_BUFS 2

extern void main_fail(char *what, char *where, int whatline);
extern void FileIO(int command);
extern void DoInfo(void);
extern void ShowView(int n);
extern void OpenAnimDisplay(boolean request);
extern void CloseAnimDisplay(void);

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

extern struct RastPort      *anim_rport[ANIM_BUFS];
extern struct Window        *anim_wnd;
extern struct Screen        *anim_scr;

/* from SetUpMui.c 
 */
void SetUpMui(void);

enum ids { 
  ID_RA_Mode = 1,

  ID_CK_DrawSpr,    ID_CK_Action,       ID_CK_FixedMass,    ID_CK_AdaptTStep,
  ID_CK_GravActive, ID_CK_CenterActive, ID_CK_PtAttrActive, ID_CK_WallFActive,
  ID_CK_WallTop,    ID_CK_WallLeft,     ID_CK_WallRight,    ID_CK_WallBottom,

  ID_BT_SelAll,     ID_BT_SetRLen,      ID_BT_SetCenter,

  ID_SL_Grid,

  ID_ST_Mass,       ID_ST_Elas,         ID_ST_Kspr,         ID_ST_Kdmp,  
  ID_ST_Visc,       ID_ST_Stic,         ID_ST_Step,         ID_ST_Prec,
  ID_ST_GravGrav,   ID_ST_GravDir,      ID_ST_CenterMagn,   ID_ST_CenterDamp,
  ID_ST_PtAttrMagn, ID_ST_PtAttrExpo,   ID_ST_WallFMagn,    ID_ST_WallFExpo,

  ID_TX_Fps,

  ID_ME_About,      ID_ME_Load,  ID_ME_Insert, ID_ME_Save,      ID_ME_SaveAs,
  ID_ME_ScreenMode, ID_ME_Quit,  ID_ME_DupSel, ID_ME_DeleteSel, ID_ME_Restore,
  ID_ME_Snapshot,   ID_ME_Reset, ID_ME_Help,

  ID_KY_AnimToFront
  };

extern APTR 
  AP_ASpringies,
  WI_ASpringies,
  RA_Mode,
  CY_Force,
  PG_Force,

  CK_DrawSpr,    CK_Action,       CK_FixedMass,    CK_AdaptTStep,
  CK_GravActive, CK_CenterActive, CK_PtAttrActive, CK_WallFActive,
  CK_WallTop,    CK_WallLeft,     CK_WallRight,    CK_WallBottom,

  BT_SelAll,     BT_SetRLen,      BT_SetCenter,

  SL_Grid,

  ST_Mass,       ST_Elas,         ST_Kspr,         ST_Kdmp,
  ST_Visc,       ST_Stic,         ST_Step,         ST_Prec, 
  ST_GravGrav,   ST_GravDir,      ST_CenterMagn,   ST_CenterDamp, 
  ST_PtAttrMagn, ST_PtAttrExpo,   ST_WallFMagn,    ST_WallFExpo,

  TX_Fps;
