home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d551 / toolmanager.lha / ToolManager / Source / ToolManager.h < prev   
C/C++ Source or Header  |  1991-10-28  |  8KB  |  212 lines

  1. /*
  2.  * ToolManager.h   V1.5
  3.  *
  4.  * main include file
  5.  *
  6.  * (c) 1991 by Stefan Becker
  7.  *
  8.  */
  9. #include <exec/types.h>
  10. #define abs
  11. #include <stdlib.h>
  12. #include <stdio.h>
  13. #include <string.h>
  14. #include <ctype.h>
  15. #include <exec/libraries.h>
  16. #include <exec/memory.h>
  17. #include <dos/dostags.h>
  18. #include <graphics/gfxbase.h>
  19. #include <intuition/gadgetclass.h>
  20. #include <libraries/iffparse.h>
  21. #include <workbench/icon.h>
  22. #include <workbench/startup.h>
  23.  
  24. /* Prototypes for system functions */
  25. #include <clib/alib_protos.h>
  26. #include <clib/asl_protos.h>
  27. #include <clib/commodities_protos.h>
  28. #include <clib/dos_protos.h>
  29. #include <clib/exec_protos.h>
  30. #include <clib/gadtools_protos.h>
  31. #include <clib/graphics_protos.h>
  32. #include <clib/icon_protos.h>
  33. #include <clib/iffparse_protos.h>
  34. #include <clib/intuition_protos.h>
  35. #include <clib/layers_protos.h>
  36. #include <clib/wb_protos.h>
  37. #undef HotKey /* Needed for -mRR */
  38. __stkargs CxObj *HotKey(UBYTE *, struct MsgPort *, long);
  39.  
  40. /* Version number & dates */
  41. #define TM_VERSION "1.5"
  42. #define TM_CRYEAR "1991"
  43. #define TM_DATE "10.10.1991"
  44.  
  45. /* Buffer lenghts */
  46. #define BUFLEN  100 /* Buffer length for one config line */
  47. #define NAMELEN 256 /* Buffer length for a file name */
  48.  
  49. /* Data for one config file entry */
  50. struct ConfigBlock {
  51.                     UWORD cb_Type;                /* Type of tool (s. below) */
  52.                     UWORD cb_Flags;               /* Flags (see below) */
  53.                     ULONG cb_Stack;               /* Stack size */
  54.                     ULONG cb_IconX;               /* Icon X Position */
  55.                     ULONG cb_IconY;               /* Icon Y Position */
  56.                     char  cb_Alias[BUFLEN];       /* Alias name */
  57.                     char  cb_RealName[BUFLEN];    /* Real name */
  58.                     char  cb_WorkDir[BUFLEN];     /* Current directory */
  59.                     char  cb_Path[BUFLEN];        /* Path string (CLI) */
  60.                     char  cb_OutFile[BUFLEN];     /* Output file name (CLI) */
  61.                     char  cb_HotKey[BUFLEN];      /* HotKey description */
  62.                     char  cb_IconFile[BUFLEN];    /* Icon file name */
  63.                     char  cb_DockFile[BUFLEN];    /* Dock image file name */
  64.                     char  cb_TempLine[BUFLEN+20]; /* temporary line */
  65.                    };
  66.  
  67. /* Entry for tool list */
  68. struct ToolNode {
  69.                  struct Node         tn_Node;     /* Node, contains name */
  70.                  UWORD               tn_Type;     /* Type of tool (s. below) */
  71.                  UWORD               tn_Flags;    /* Flags (see below) */
  72.                  char               *tn_RealName; /* Real name of tool */
  73.                  char               *tn_WorkDir;  /* Name of current dir. */
  74.                  BPTR                tn_DirLock;  /* Directory lock */
  75.                  char               *tn_Path;     /* Path string (CLI) */
  76.                  char               *tn_OutFile;  /* Output file name (CLI) */
  77.                  ULONG               tn_Stack;    /* Stack size */
  78.                  struct AppMenuItem *tn_MenuItem; /* Pointer to WB menu item */
  79.                  char               *tn_IconFile; /* Name of icon file */
  80.                  struct DiskObject  *tn_Icon;     /* Pointer to icon data */
  81.                  struct AppIcon     *tn_AppIcon;  /* Pointer to WB icon */
  82.                  char               *tn_HotKey;   /* HotKey description */
  83.                  CxObj              *tn_CxObj;    /* HotKey's CX Object */
  84.                  char               *tn_DockFile; /* Name of dock image file */
  85.                  struct DiskObject  *tn_Dock;     /* Pointer to dock data */
  86.                 };
  87.  
  88. /* Constants for tn_Type */
  89. #define TNTYPE_DUMMY 0  /* Non-functional dummy tool */
  90. #define TNTYPE_CLI   1  /* CLI tool */
  91. #define TNTYPE_WB    2  /* WB tool */
  92.  
  93. /* Flags for tn_Flags */
  94. #define TNFLAGS_MENU 0x0001 /* Tool has a WB menu item */
  95. #define TNFLAGS_ICON 0x0002 /* Tool has a WB icon */
  96. #define TNFLAGS_DOBJ 0x0004 /* The WB icon is a DiskObject */
  97. #define TNFLAGS_NNAM 0x0008 /* The AppIcon has no name */
  98. #define TNFLAGS_NARG 0x0010 /* Start tool with NO paramters */
  99. #define TNFLAGS_COUT 0x0020 /* Start tool with output file (CLI tools) */
  100. #define TNFLAGS_WBTF 0x0040 /* Workbench Screen to front before starting tool */
  101. #define TNFLAGS_DOCK 0x0080 /* Tool has a dock */
  102. #define TNFLAGS_SICN 0x0100 /* Dock icon same as WB icon */
  103. #define TNFLAGS_DDOB 0x0200 /* The dock icon is a DiskObject */
  104.  
  105. /* Prototypes for library functions */
  106. void NewList(struct List *);
  107. struct ToolNode *GetHead(struct List *);
  108. struct ToolNode *GetPred(struct ToolNode *);
  109. struct ToolNode *GetSucc(struct ToolNode *);
  110.  
  111. /* Prototypes for program functions */
  112. /* config.c */
  113. void SetConfigFileName(char *);
  114. void InitConfigBlock(struct ConfigBlock *);
  115. void ReadConfigFile(char *, BOOL);
  116. BOOL WriteConfigFile(struct Window *w, BOOL);
  117. /* dockwindow.c */
  118. void OpenDockWindow(void);
  119. void CloseDockWindow(void);
  120. void HandleDockWinEvent(void);
  121. BOOL AddDock(struct ToolNode *);
  122. void RemDock(struct ToolNode *);
  123. void SelectDock(struct ToolNode *, WORD, WORD, BOOL);
  124. struct ToolNode *FindDock(WORD, WORD);
  125. /* editwindow.c */
  126. void OpenEditWindow(ULONG, ULONG, ULONG, struct ToolNode *);
  127. void CloseEditWindow(void);
  128. void HandleEditWinEvent(void);
  129. /* filreq.c */
  130. BOOL ShowFileRequester(struct Window *, char *, char **, int);
  131. BOOL ShowSaveConfigRequester(struct Window *);
  132. /* hotkeyswindow.c */
  133. void OpenHotKeysWindow(ULONG, ULONG);
  134. void CloseHotKeysWindow(void);
  135. void HandleHotKeysWinEvent(void);
  136. void RefreshHotKeysWindow(struct ToolNode *, BOOL);
  137. /* ifficon.c */
  138. struct DiskObject *LoadIFFIcon(char *);
  139. void FreeIFFIcon(struct DiskObject *);
  140. /* mainloop.c */
  141. void SetQuitFlag(void);
  142. void mainloop(void);
  143. /* starttools.c */
  144. void StartTool(struct ToolNode *, struct AppMessage *);
  145. /* statuswindow.c */
  146. void OpenStatusWindow(BOOL);
  147. void CloseStatusWindow(void);
  148. void HandleStatWinEvent(void);
  149. void RefreshStatusWindow(void);
  150. void SetBrokerState(BOOL);
  151. void AttachToolList(void);
  152. void DetachToolList(void);
  153. void StatWinEndEditing(void);
  154. void StatWinDockState(BOOL);
  155. struct ToolNode *FindTool(void);
  156. /* toollist.c */
  157. BOOL WBAddToolNode(struct WBArg *, int);
  158. BOOL AddToolNode(struct ConfigBlock *,BPTR);
  159. void RemToolNode(struct ToolNode *tn);
  160. void RemoveTools(void);
  161. /* toolmanager.c */
  162. void cleanup(int);
  163.  
  164. /* Global variables */
  165. extern struct MsgPort *MyMP;
  166. extern BPTR StartupCD;
  167. extern BOOL ShowQuitReq;
  168. extern BOOL running;
  169. extern struct List ToolList;
  170. extern UWORD ToolCount;
  171. extern ULONG wbactive;
  172. extern char MyName[];
  173. extern UBYTE CopyrightNote[];
  174. extern struct DiskObject *MyIcon;
  175. extern LONG IconXPos,IconYPos;
  176. extern BOOL ShowIcon;
  177. extern char *IconName;
  178. extern struct AppIcon *MyAppIcon;
  179. extern struct AppMenuItem *OTWAppMenuItem;
  180. extern char WBScreenName[];
  181. extern char *ConfigName;
  182. extern BOOL ConfigChanged;
  183. extern struct EasyStruct SaveES;
  184. extern BOOL ShowStatusWindow;
  185. extern UWORD DockCount;
  186. extern BOOL ShowDock;
  187. extern ULONG globalsigs;
  188. extern ULONG statwinsig;
  189. extern ULONG editwinsig;
  190. extern ULONG hkeywinsig;
  191. extern ULONG dockwinsig;
  192. extern struct MsgPort *MyBrokerPort;
  193. extern struct Broker *MyBroker;
  194. extern char DefaultPopUpHotKey[];
  195. extern char *PopUpHotKey;
  196. extern char DefaultCLIOutputFile[];
  197. extern char *CLIOutputFile;
  198. extern char *GlobalPath;
  199.  
  200. /* Global defines */
  201. #define STACKMIN       4096                   /* default stack */
  202. #define DEFPROGNAME    "ToolManager"          /* default program name */
  203. #define DEFCONFIGNAME  "S:ToolManager.config" /* default config file name */
  204. #define DEFPOPUPHOTKEY "rcommand help"        /* default pop up hot key */
  205. #define WDRAGBARLEN 60 /* Width of Close & Drag gadget */
  206. #define STATWINAPPID   1 /* Status window AppWindow ID */
  207. #define DOCKWINAPPID   2 /* Dock window AppWindow ID */
  208. #define FREQ_SAVE      1 /* File requester types */
  209. #define FREQ_FILE      2
  210. #define FREQ_DIRS      3
  211. #define FREQ_ICON      4
  212.