home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d9xx
/
d912
/
yak.lha
/
Yak
/
Source
/
Source.lha
/
icon.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-31
|
2KB
|
117 lines
/*
* Routines dealing with processing of Yak's icon
* (be they for tooltypes or AppIcon purposes).
*
* MWS, Tuesday 13-Oct-92
*/
#include <exec/types.h>
#include <dos/dos.h>
#include <workbench/startup.h>
#include <workbench/workbench.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/wb.h>
#include <proto/icon.h>
#include <string.h>
#include "icon.h"
static struct DiskObject *diskobj;
BOOL __regargs
GetOurIcon(struct WBStartup *WBenchMsg)
{
if (WBenchMsg)
diskobj = GetDiskObject(WBenchMsg->sm_ArgList->wa_Name);
return (BOOL)(diskobj ? TRUE : FALSE);
}
/* can cope with multiple calls */
void
FreeOurIcon()
{
if (diskobj)
{
FreeDiskObject(diskobj);
diskobj = NULL;
}
}
/* like ArgString() */
char __regargs *
TTString(char *name, char *def)
{
char *what;
if (diskobj)
if (what = FindToolType(diskobj->do_ToolTypes, name))
return what;
return def;
}
/* like ArgInt() */
LONG __regargs
TTInt(char *name, LONG def)
{
char *what;
if (diskobj)
if (what = FindToolType(diskobj->do_ToolTypes, name))
StrToLong(what, &def);
return def;
}
/* simple extension to ArgXXX routines */
BOOL __regargs
TTBool(char *name, BOOL def)
{
char *s;
s = TTString(name, def ? "YES" : "NO");
return (BOOL)(((strcmp(s, "YES") == 0) ||
(strcmp(s, "TRUE") == 0) ||
(strcmp(s, "ON") == 0)) ? TRUE : FALSE);
}
#ifndef NO_APPICON
LONG appsigflag;
static struct AppIcon *appicon;
static struct MsgPort *appport;
/* create our AppIcon */
BOOL __regargs
MakeOurAppIcon(char *name)
{
if (diskobj)
if (appport = CreateMsgPort())
{
diskobj->do_CurrentX = TTInt("ICONXPOS", NO_ICON_POSITION);
diskobj->do_CurrentY = TTInt("ICONYPOS", NO_ICON_POSITION);
if (appicon = AddAppIconA(0,0L,name,appport,0L,diskobj,0L))
{
appsigflag = 1 << appport->mp_SigBit;
return TRUE;
}
else DeleteMsgPort(appport);
}
return FALSE;
}
/* bye bye icon... */
void
RemoveOurAppIcon()
{
if (appicon) RemoveAppIcon(appicon);
if (appport) DeleteMsgPort(appport);
}
/* just clear the port */
void
RespondToAppIcon()
{
struct Message *msg;
while (msg = GetMsg(appport))
ReplyMsg(msg);
}
#endif /* !NO_APPICON */