home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
new
/
amigalibdisks
/
d984
/
forceicon
/
source
/
ficonprefs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-04
|
59KB
|
2,375 lines
/*
Auto: smake FIconPrefs
*/
/* $Revision Header built automatically *************** (do not edit) ************
**
** © Copyright by GuntherSoft
**
** File : SnakeSYS:CPrgs/ForceIcon2/FIconPrefs.c
** Created on : Wednesday, 16.03.94 16:19:51
** Created by : Kai Iske
** Current revision : V1.0
**
**
** Purpose
** -------
** - Prefs Editor for ForceIcon
**
** Revision V1.0
** --------------
** created on Wednesday, 16.03.94 16:19:51 by Kai Iske. LogMessage :
** --- Initial release ---
**
*********************************************************************************/
/**********************************************************************/
/* Define for DisplayError() */
/**********************************************************************/
#define PREFSRUN
/**********************************************************************/
/* Routines for this module */
/**********************************************************************/
static BOOL OpenAll(void);
static void CloseAll(void);
static struct FIconSema *FindFIconSema(void);
static void RemoveFIconSema(struct FIconSema *FIconSema);
static BOOL InitApp(void);
static void RemoveApp(void);
static ULONG __saveds __asm DispViewFunc(register __a0 struct Hook *MyHook, register __a2 char **array, register __a1 struct VolEntry *Data);
static ULONG __saveds __asm DisableFunc(register __a0 struct Hook *MyHook, register __a2 APTR Obj, register __a1 APTR *Data);
static ULONG __saveds __asm PageChangeFunc(register __a0 struct Hook *MyHook, register __a2 APTR Obj, register __a1 APTR *Data);
static struct VolEntry *AddNewVolume(char *Name, ULONG Type, struct VolEntry *CopyPtr);
static BOOL CheckExists(char *Name);
static BOOL SavePrefs(BOOL EnvMode);
static void DskChange(struct VolEntry *ListEntry);
/**********************************************************************/
/* Functions of files included */
/**********************************************************************/
// LoadPrefs.h
static void LoadPrefs(struct FIconSema *FIconSema);
// VolList.h
static BOOL GetDevVolList(struct List *VolList);
static BOOL GetDosEntries(struct List *VolList, ULONG Mode);
static void FreeDevVolList(struct List *VolList);
static void SortList(struct List *VolList, BOOL DisplayType);
static void SortPartialList(struct List *VolList, UWORD Left, UWORD Right);
static APTR GetListEntry(struct List *List, WORD EntryNum);
static BOOL MyStrCmp(char *FromName, char *ToName);
// Error.h
static void __stdargs DisplayError(LONG ErrCode, ULONG Arg1, ...);
// CheckToolTypes.h
static void CheckToolTypes(struct WBStartup *WBenchMsg);
// PoolVec.h
static APTR AllocVecPool(struct FIconSema *FIconSema, ULONG Size);
static void FreeVecPool(struct FIconSema *FIconSema, APTR Addr);
/**********************************************************************/
/* Library bases */
/**********************************************************************/
struct ExecBase *SysBase;
struct IntuitionBase *IntuitionBase = NULL;
struct DosLibrary *DOSBase = NULL;
struct Library *IconBase = NULL;
struct Library *UtilityBase = NULL;
struct Library *IFFParseBase = NULL;
struct Library *MUIMasterBase = NULL;
/**********************************************************************/
/* "No-StartUp vars" */
/**********************************************************************/
#define MUIVERS "$VER:ForceIcon_Prefs "REVISION" ("REVDATE")"
char _ProgramName[] = "ForceIconPrefs";
LONG _OSERR = 0;
/**********************************************************************/
/* Our variables */
/**********************************************************************/
static struct FIconSema *FIconSema = NULL; // Pointer to our rendezvous semaphore
static struct List AvailableList;
static UWORD FlushMemory = FALSE;
/**********************************************************************/
/* Application and window definitions */
/**********************************************************************/
static struct DiskObject *DObj = NULL;
static APTR AppObject = NULL;
static APTR MainWindow = NULL;
static APTR UsedList;
static APTR EditEntry;
static APTR CopyEntry;
static APTR RemoveEntry;
static APTR AvailList;
static APTR AddEntry;
static APTR AddEntryMan;
static APTR RescanList;
static APTR SaveObj;
static APTR UseObj;
static APTR AboutObj;
static APTR HideObj;
static APTR QuitObj;
static APTR EditWindow;
static APTR VolumeName;
static APTR VolumeType;
static APTR IconPosGroup;
static APTR IconPos[2];
static APTR IconX;
static APTR IconY;
static APTR Position;
static APTR UseIconGroup;
static APTR UseIcon[2];
static APTR IconName;
static APTR UseWindowGroup;
static APTR UseWindow[2];
static APTR WinX;
static APTR WinY;
static APTR WinWidth;
static APTR WinHeight;
static APTR LookWin;
static APTR UseFlagsGroup;
static APTR UseFlags[2];
static APTR FlagModes;
static APTR EditOkObj;
static APTR EditCancelObj;
static APTR ManWindow;
static APTR ManVolName;
static APTR ManVolType;
static APTR ManOkObj;
static APTR ManCancelObj;
/**********************************************************************/
/* Strings for Cycle gadgets */
/**********************************************************************/
static const char *TypeEntries[] =
{
"Volume",
"Device",
NULL
};
static const char *ModeEntriesVol[] =
{
"Ignore",
"Use",
"Inherit",
NULL
};
static const char *ModeEntriesDev[] =
{
"Ignore",
"Use",
NULL
};
static const char *PositionEntries[] =
{
"Open position window",
"Close position window",
NULL
};
static const char *LookWinEntries[] =
{
"Open window",
"Close window",
NULL
};
static const char *FlagModesEntries[] =
{
"only icons + view by icon",
"only icons + view by name",
"only icons + view by date",
"only icons + view by size",
"all files + view by icon",
"all files + view by name",
"all files + view by date",
"all files + view by size",
NULL
};
/**********************************************************************/
/* Display Hook */
/**********************************************************************/
static struct Hook DispViewHook =
{
{NULL},
(APTR)DispViewFunc,
NULL,
NULL
};
static struct Hook DisableHook =
{
{NULL},
(APTR)DisableFunc,
NULL,
NULL
};
static struct Hook PageChangeHook =
{
{NULL},
(APTR)PageChangeFunc,
NULL,
NULL
};
/**********************************************************************/
/* This is our main program */
/**********************************************************************/
ULONG __saveds main(void)
{
struct Process *MyProc;
struct WBStartup *WBenchMsg = NULL;
struct VolEntry *EditEntryPtr = NULL;
struct Window *PosWindow = NULL,
*DrawerWindow = NULL;
ULONG MySig,
ReturnID;
BOOL GoOn = TRUE;
// Get SysBase
SysBase = *((struct ExecBase **)0x4L);
// Get address of our process
MyProc = (struct Process *)FindTask(NULL);
// Determine where we were started from
if(!MyProc->pr_CLI)
{
WaitPort(&MyProc->pr_MsgPort);
WBenchMsg = (struct WBStartup *)GetMsg(&MyProc->pr_MsgPort);
}
// Don`t run under OS < 37
if(((struct Library *)SysBase)->lib_Version >= 37)
{
// Open libraries
if(OpenAll())
{
if((FIconSema = FindFIconSema()))
{
// Check for ToolTypes/commandline options
CheckToolTypes(WBenchMsg);
if(InitApp())
{
while(GoOn)
{
switch(ReturnID = DoMethod(AppObject, MUIM_Application_Input, &MySig))
{
// Handle MAINWINDOW
// Save ?!?!
case ID_SAVE :
{