/*
Auto:		smake ForceIcon
*/


/* $Revision Header built automatically *************** (do not edit) ************
**
** © Copyright by GuntherSoft
**
** File             : SnakeSYS:CPrgs/Utils/ForceIcon/ForceIcon.h
** Created on       : Wednesday, 20.10.93 17:19:27
** Created by       : Kai Iske
** Current revision : V1.6
**
**
** Purpose
** -------
**   - ForceIcon Header file
**
** Revision V1.6
** --------------
** created on Tuesday, 31.05.94 00:36:05  by  Kai Iske.   LogMessage :
**  -*-  changed on Freitag, 19.08.94 00:59:59  by  Kai Iske.   LogMessage :
**   - Using ForceIcon you may even "SnapShot" Disk icons now.
**     Use SnapShot and then select SAVE from the Prefs program
**  -*-  changed on Donnerstag, 18.08.94 19:31:04  by  Kai Iske.   LogMessage :
**   - No more quit requesters will be shown
**     (Requested by : Bernhard Moellemann)
**  -*-  changed on Donnerstag, 18.08.94 19:12:10  by  Kai Iske.   LogMessage :
**   - You may now even enter relative coordinates (relative to
**     Workbench Screen`s width/height) for the icon`s position.
**     This is accomplished through negative values for
**     IconX/IconY
**     (Requested by : Bernhard Moellemann)
**  -*-  changed on Donnerstag, 18.08.94 18:46:52  by  Kai Iske.   LogMessage :
**   - IconPosition window is smaller now
**     (Requested by : Bernhard Moellemann)
**  -*-  created on Tuesday, 31.05.94 00:36:05  by  Kai Iske.   LogMessage :
**   - Sort routine could create enforcer hits!
**
** Revision V1.5
** --------------
** created on Wednesday, 13.04.94 15:15:29  by  Kai Iske.   LogMessage :
**  -*-  changed on Tuesday, 24.05.94 15:02:04  by  Kai Iske.   LogMessage :
**   - Width/Height for Drawer window were handled the
**     wrong way. (Swapped)
**     (Reported by : Juergen Zeschky)
**  -*-  changed on Tuesday, 24.05.94 14:59:44  by  Kai Iske.   LogMessage :
**   - The Drawer window wasn`t updated, when one changed the
**     Integer gadgets
**  -*-  changed on Tuesday, 24.05.94 14:58:44  by  Kai Iske.   LogMessage :
**   - When opening the Position window, it`s position was always
**     set to the position which was specified when the EditEntry
**     window was opened, thus no intermediate changes were
**     reflected. Same applied to the Drawer window
**     (Reported by : Michael 'Mick' Hohmann)
**  -*-  changed on Wednesday, 13.04.94 15:25:11  by  Kai Iske.   LogMessage :
**   - Added note about AmiCDROM 1.9 to the docs
**     (Suggested by : Manuel Fischer)
**  -*-  changed on Wednesday, 13.04.94 15:21:25  by  Kai Iske.   LogMessage :
**   - Added note to docs about disks not containing a Disk.info
**     file. READ THIS!
**  -*-  created on Wednesday, 13.04.94 15:15:29  by  Kai Iske.   LogMessage :
**   - Position window wasn`t moved, when user changed the
**     contents of the integer gadgets (IconX/IconY)
**
** Revision V1.4
** --------------
** created on Saturday, 19.02.94 01:27:31  by  Kai Iske.   LogMessage :
**  -*-  changed on Thursday, 24.03.94 16:43:23  by  Kai Iske.   LogMessage :
**   - EditEntry window`s cycle gadgets (IconPos, UseIcon etc..)
**     are volume type senstive now, ie Ignore,Use,Inherit will be
**     available when Type is set to "Volume",  while Ignore and
**     Use are available when editing a device.
**     (Suggested by : Christopher A. Wichura)
**  -*-  changed on Wednesday, 23.03.94 12:49:17  by  Kai Iske.   LogMessage :
**   - Inheritance of device settings is individually controlled
**     for every entry through a cycle gadget, so that you may
**     tell which items to inherit and which to ignore, or use.
**     (Requested by : Christopher A. Wichura)
**  -*-  changed on Tuesday, 22.03.94 23:19:46  by  Kai Iske.   LogMessage :
**   - You may now force Window size/position and flags
**     (display flags)
**     (Requested by : Christopher A. Wichura)
**  -*-  changed on Tuesday, 22.03.94 18:32:58  by  Kai Iske.   LogMessage :
**   - The ListViews will show volumes in white color now, so
**     that you may distinguish whether an entry is a Volume or a
**     Device
**  -*-  changed on Saturday, 19.03.94 17:58:56  by  Kai Iske.   LogMessage :
**   - Diskobject for Iconify Gadget will obtained from the
**     program`s icon
**  -*-  changed on Saturday, 19.03.94 17:52:54  by  Kai Iske.   LogMessage :
**   - Added online-help support
**  -*-  changed on Saturday, 19.03.94 17:17:15  by  Kai Iske.   LogMessage :
**   - Made behaviour of obtaining settings from a device entry
**     for a volume entry switchable from ToolTypes/commandline
**     options.
**  -*-  changed on Saturday, 19.03.94 16:24:58  by  Kai Iske.   LogMessage :
**   - ForceIcon will use memory pools for allocations now.
**  -*-  changed on Saturday, 19.03.94 16:23:41  by  Kai Iske.   LogMessage :
**   - For volumes, for which some flags aren`t set (like IconPos or
**     UseIcon) ForceIcon will take the settings of the device
**     the volume resides in as long as it is a) defined and b)
**     the missing flag is set there.
**     (Suggested by : Christopher A. Wichura)
**  -*-  changed on Saturday, 19.03.94 15:43:18  by  Kai Iske.   LogMessage :
**   - DiskChanges on startup protected by Semaphore
**     (Suggested by: Christopher A. Wichura)
**  -*-  changed on Saturday, 19.03.94 15:42:06  by  Kai Iske.   LogMessage :
**   - LoadPrefs() protected by Semaphore
**     (Suggested by: Christopher A. Wichura)
**  -*-  changed on Thursday, 17.03.94 18:24:44  by  Kai Iske.   LogMessage :
**   - If you quit the EditEntry window using "OK", ForceIcon_Prefs
**     will send a disk change to the device in question...
**   - Improved semaphore locking mechanism. Chris didn`t like it,
**     so I changed it, even though I can`t see his point (for now)
**     (Requested by : Christopher A. Wichura)
**  -*-  changed on Wednesday, 16.03.94 22:23:30  by  Kai Iske.   LogMessage :
**   - Added FlushMemory switch/tooltype
**   - Only devices in the list (or their volumes) will get a 
**     disk change on startup now
**     (Requested by : Christopher A. Wichura)
**  -*-  changed on Wednesday, 16.03.94 22:22:13  by  Kai Iske.   LogMessage :
**   - Added server prefs concept. ForceIcon is a simple program
**     now, w/o any GUI. A seperate Prefs Editor has been added
**     (using MUI) to configure ForceIcon.
**   - Rearrangement of List after editing an entry didn`t work
**  -*-  changed on Saturday, 12.03.94 19:32:33  by  Kai Iske.   LogMessage :
**   - Again changed the routine for getting the list of available
**     volumes/devices
**     (Suggestions by : Ralph Babel)
**  -*-  changed on Saturday, 12.03.94 19:31:48  by  Kai Iske.   LogMessage :
**   - Didn`t convert a string to upper-case before calling
**     ParsePatternNoCase(). This has to be done for OS 37
**     Systems.
**     (Reported by : Christopher A. Wichura)
**  -*-  changed on Saturday, 12.03.94 14:23:12  by  Kai Iske.   LogMessage :
**   - Added special code to check for block mounted devices.
**     (Supplied by : Christopher A. Wichura. Thanks Chris)
**  -*-  changed on Thursday, 10.03.94 14:23:11  by  Kai Iske.   LogMessage :
**   - When adding a new item to the list, another entry could
**     loose the settings for the IconPos gadget. This was due to a
**     bug in the sorting routine. Fixed
**     (Reported by : Mark 'TheMug' Rose)
**  -*-  changed on Thursday, 10.03.94 14:02:35  by  Kai Iske.   LogMessage :
**   - Patterns for Volumes and Devices supported now
**  -*-  changed on Sunday, 06.03.94 17:38:53  by  Kai Iske.   LogMessage :
**   - When launched ForceIcon will now make all connected disks
**     disk change, in order to reposition the icons. This way you
**     may launch ForceIcon from within your WBStartUp now
**     (Requested by : Henning Schmiedehausen)
**  -*-  changed on Sunday, 06.03.94 17:20:31  by  Kai Iske.   LogMessage :
**   - Enforcer Hit for illegal Locks fixed
**     (Changed by : Henning Schmiedehausen)
**   - Windows will pop up on default PubScreen now
**     (Changed by : Henning Schmiedehausen)
**  -*-  changed on Sunday, 27.02.94 17:52:56  by  Kai Iske.   LogMessage :
**   - More security checks when removing patches
**     (Requested/Changed by : Henning Schmiedehausen)
**  -*-  created on Saturday, 19.02.94 01:27:31  by  Kai Iske.   LogMessage :
**   - ForceIcon didn`t clone all of the window`s flags
**   - For some icon-substitutes, ForceIcon didn`t clone anything
**     (Reported by : Michael 'Mick' Hohmann)
**
** Revision V1.3
** --------------
** created on Sunday, 02.01.94 15:31:32  by  Kai Iske.   LogMessage :
**   - Code cleanup
**   - Partial rewrite of docs
**
** Revision V1.2
** --------------
** created on Tuesday, 07.12.93 18:10:09  by  Kai Iske.   LogMessage :
**   - Entries may be copied now
**
** Revision V1.1
** --------------
** created on Tuesday, 02.11.93 23:11:14  by  Kai Iske.   LogMessage :
**  -*-  changed on Saturday, 27.11.93 02:12:59  by  Kai Iske.   LogMessage :
**   - Recompiled using SAS 6.50
**  -*-  changed on Saturday, 20.11.93 18:14:21  by  Kai Iske.   LogMessage :
**   - ForceIcon will adopt the orig. window position and size now.
**     (Suggested by : Michael 'Mick' Hohmann and me)
**  -*-  changed on Saturday, 20.11.93 18:03:08  by  Kai Iske.   LogMessage :
**   - Icons weren`t positions as set with the Position window.
**     (Reported by : Michael 'Mick' Hohmann)
**   - Misleading explanation removed from docs
**     (Reported by : Michael 'Mick' Hohmann)
**  -*-  changed on Saturday, 20.11.93 17:33:51  by  Kai Iske.   LogMessage :
**   - The X/Y coordinates may be set manually, now.
**     (Requested by : Michael 'Mick' Hohmann)
**  -*-  changed on Saturday, 20.11.93 17:24:20  by  Kai Iske.   LogMessage :
**   - Edit Entry window`s gadget used 'I' twice
**     (Reported by : Michael 'Mick' Hohmann)
**  -*-  changed on Thursday, 11.11.93 18:43:27  by  Kai Iske.   LogMessage :
**   - You may now tell ForceIcon not to patch the position, but
**     rather let WB chose a good place. (Good when importing
**     volumes via network)
**  -*-  changed on Tuesday, 02.11.93 23:23:00  by  Kai Iske.   LogMessage :
**   - ListView gadgets weren`t adjusted for OS 2.x. - Should check
**     for OS 2.x sometime ;)
**     (Reported by : Bernhard Moellemann)
**   - Changed needed Versions of some libraries from 37 to 36
**  -*-  created on Tuesday, 02.11.93 23:11:14  by  Kai Iske.   LogMessage :
**   - If there wasn`t a filename for the Icon-File the
**     FileRequester sometimes showed a weird Drawer-Name
**     (Reported by : Dirk Federlein)
**
** Revision V1.0
** --------------
** created on Wednesday, 20.10.93 17:19:27  by  Kai Iske.   LogMessage :
**  -*-  changed on Thursday, 28.10.93 17:35:28  by  Kai Iske.   LogMessage :
**   - Suggestions for device dependancy by Ralph Babel
**   - Bug "found" by Ralph Babel
**   - Pos window used to open on default pubscreen, not on WB.
**     (Reported by : Bernhard Moellemann)
**  -*-  created on Wednesday, 20.10.93 17:19:27  by  Kai Iske.   LogMessage :
**     --- Initial release ---
**
*********************************************************************************/
#define REVISION "1.6"
#define REVDATE  "19.08.94"
#define REVTIME  "00:59:59"
#define AUTHOR   "Kai Iske"
#define VERNUM   1
#define REVNUM   6


/**********************************************************************/
/*                   Prototype for serial debugging                   */
/**********************************************************************/
void KPrintF(char *, ...);



/**********************************************************************/
/*                   Prototypes for Pool functions                    */
/**********************************************************************/
APTR	__asm AsmCreatePool(register __d0 ULONG, register __d1 ULONG, register __d2 ULONG, register __a6 struct ExecBase *);
void	__asm AsmDeletePool(register __a0 APTR, register __a6 struct ExecBase *);
APTR	__asm AsmAllocPooled(register __a0 APTR, register __d0 ULONG, register __a6 struct ExecBase *);
void	__asm AsmFreePooled(register __a0 APTR, register __a1 APTR, register __d0 ULONG, register __a6 struct ExecBase *);



/**********************************************************************/
/*                              Defines                               */
/**********************************************************************/
enum{
	ERR_OPEN,
	ERR_NOMEM,
	ERR_NOTALL,
	ERR_ABOUT,
	ERR_EXISTS,
	ERR_PATCH,
	ERR_SNAPEDICON,
	ERR_NO_APP
};



/**********************************************************************/
/*                        Nodes for Guide file                        */
/**********************************************************************/
#define	NODE_MAIN		"Usage"
#define	NODE_LEFT		"Left part"
#define	NODE_RIGHT		"Right part"
#define	NODE_EDIT		"EditEntry"
#define	NODE_MANUAL		"ManualInput"



/**********************************************************************/
/*                    This is our rendezvous Port                     */
/**********************************************************************/
struct FIconSema
{
	struct	SignalSemaphore	FIconSema;		// Our semaphore

	ULONG			UseCount;		// Use count of semaphore
	char	Name[44];				// Name of semaphore

	struct	List		VolumeList;		// List of volumes
	struct	Task		*ServerTask;		// Address of ServerTask
	struct	Task		*PrefsTask;		// Address of PrefsTask

	APTR			FIconPool;		// Pool for allocations

	UWORD			FlushMemory;		// Flushmemory ???
	UWORD			ObtainFromDev;		// Get settings from device when not set for volume ???
};





/**********************************************************************/
/*                         Structure defines                          */
/**********************************************************************/
struct VolEntry
{
	struct	Node	Link;
	char		VolName[130];
	char		IconName[256];
	WORD		Left;
	WORD		Top;
	UWORD		UseAlt;
	UWORD		IconPos;
	UWORD		UseWin;
	WORD		WinX;
	WORD		WinY;
	WORD		WinWidth;
	WORD		WinHeight;
	UWORD		UseFlags;
	UWORD		WinFlags;
	UWORD		Pad[25];		// For future expansions
	WORD		LeftEdge;		// These are only used during runtime
	WORD		TopEdge;
	WORD		Width;
	WORD		Height;
	LONG		CurrentX;
	LONG		CurrentY;
	ULONG		Flags;
	UWORD		ViewMode;
	struct	MsgPort	*DriverTask;
};



/**********************************************************************/
/*                        Defines for windows                         */
/**********************************************************************/
enum {
	ID_DUMMY,

	ID_USEDLIST,			// Main window
	ID_EDITENTRY,
	ID_COPYENTRY,
	ID_REMOVEENTRY,
	ID_AVAILLIST,
	ID_ADDENTRY,
	ID_ADDENTRYMAN,
	ID_RESCANLIST,
	ID_SAVE,
	ID_USE,
	ID_ABOUT,
	ID_HIDE,
	ID_QUIT,

	ID_EDITOK,			// Edit window
	ID_EDITCANCEL,
	ID_ICONX,
	ID_ICONY,
	ID_POSITION,
	ID_DRAWER,
	ID_WINX,
	ID_WINY,
	ID_WINWIDTH,
	ID_WINHEIGHT,

	ID_MANOK,			// Man window
	ID_MANCANCEL
};




/**********************************************************************/
/*                         Modes for settings                         */
/**********************************************************************/
enum {
	MODE_IGNORE,
	MODE_USE,
	MODE_INHERIT
};
