home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of A1200
/
World_Of_A1200.iso
/
programs
/
disk
/
misc
/
dcmp
/
source
/
source.lha
/
cdglue.c
next >
Wrap
C/C++ Source or Header
|
1993-01-17
|
5KB
|
174 lines
/* $Id: cdglue.c,v 1.3 92/08/31 15:42:40 tf Exp $ © Tobias Ferber */
#include <exec/types.h>
#include <exec/memory.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
extern struct IntuitionBase *IntuitionBase;
/* stuff for the req.library */
#include <libraries/dosextens.h>
#include <libraries/reqbase.h>
extern struct ReqLib *ReqBase;
extern struct Process *MyProcess;
extern APTR OldWindowPtr;
/* stuff for the reqtools.library */
#include <libraries/reqtools.h>
#include <proto/reqtools.h>
extern struct ReqToolsBase *ReqToolsBase;
BOOL a_Requester(char *body, char *pos, char *neg)
{ if(IntuitionBase)
{ char *okay_text=(char *)NULL;
if(!(pos && *pos))
{ if(neg && *neg)
okay_text = neg;
else
okay_text = "Resume";
}
else if(!(neg && *neg))
okay_text = pos;
if(ReqToolsBase)
{ if(okay_text)
return rtEZRequest(body,okay_text,NULL,NULL);
else
{ char *response[256];
sprintf(response,"%s|%s",pos,neg);
return rtEZRequest(body,response,NULL,NULL);
}
}
else if(ReqBase)
{ if(okay_text)
return SimpleRequest(body);
else
return TwoGadRequest(body);
}
else
{ struct IntuiText BodyText, PosText, NegText;
struct TextAttr TextAttr;
TextAttr.ta_Name = "topaz.font";
TextAttr.ta_YSize = 8;
TextAttr.ta_Style = FS_NORMAL;
TextAttr.ta_Flags = FPF_ROMFONT;
BodyText.FrontPen = 0;
BodyText.BackPen = 1;
BodyText.DrawMode = JAM2;
BodyText.LeftEdge = 10;
BodyText.TopEdge = 10;
BodyText.ITextFont = &TextAttr;
BodyText.IText = (UBYTE *)body;
BodyText.NextText = NULL;
PosText.FrontPen = 0;
PosText.BackPen = 1;
PosText.DrawMode = JAM2;
PosText.LeftEdge = 6;
PosText.TopEdge = 3;
PosText.ITextFont = &TextAttr;
PosText.IText = (UBYTE *)(okay_text)?(okay_text):(pos);
PosText.NextText = NULL;
NegText.FrontPen = 0;
NegText.BackPen = 1;
NegText.DrawMode = JAM2;
NegText.LeftEdge = 6;
NegText.TopEdge = 3;
NegText.ITextFont = &TextAttr;
NegText.IText = (UBYTE *)(okay_text)?(okay_text):(neg);
NegText.NextText = NULL;
return
AutoRequest(NULL, &BodyText, &PosText, &NegText, 0L, 0L, 320L, 60L);
}
}
return(FALSE); /* => requester was [Cancel]ed */
}
BOOL a_GetLongRequester(long *value, char *title, long min, long max)
{ if(IntuitionBase)
{ if(ReqToolsBase)
{
return rtGetLong(value, title, NULL, RTGL_ShowDefault, FALSE, TAG_END);
}
else if(ReqBase)
{ struct GetLongStruct req_gls;
req_gls.titlebar = title;
req_gls.defaultval = *value;
req_gls.minlimit = min;
req_gls.maxlimit = max;
req_gls.window = (struct Window *)NULL;
req_gls.versionnumber = REQVERSION;
req_gls.flags = 0;
req_gls.rfu2 = 0;
if(GetLong(&req_gls))
{ *value = req_gls.result;
return(TRUE);
}
return(FALSE);
}
else
{
a_Requester("No get number requester available","Cancel",NULL);
}
}
return(FALSE);
}
void a_FileRequester(char *fname, char *title)
{ if(IntuitionBase)
{ static char file[256], dir[256];
stcgfp(dir,fname);
stcgfn(file,fname);
if(ReqToolsBase)
{ struct rtFileRequester *rt_filereq;
if(rt_filereq = rtAllocRequest(RT_FILEREQ, NULL))
{ rtChangeReqAttr(rt_filereq,RTFI_Dir,dir);
if(rtFileRequest(
rt_filereq,
file,
title,
TAG_END))
{ /* glue path + node => make filename /w path */
strmfp(fname, rt_filereq->Dir, file);
}
rtFreeRequest(rt_filereq);
}
else rtEZRequest("Out of memory!","Shit",NULL,NULL,NULL);
}
else if(ReqBase)
{ struct ReqFileRequester *req_filereq;
req_filereq = (struct ReqFileRequester *)
AllocMem(sizeof(struct ReqFileRequester),MEMF_CLEAR);
if(req_filereq)
{ req_filereq->Title = title;
req_filereq->Dir = dir;
req_filereq->File = file;
req_filereq->PathName = fname;
req_filereq->Window = IntuitionBase->ActiveWindow;
req_filereq->Flags = FRQCACHINGM|FRQINFOGADGETM;
req_filereq->dirnamescolor = 2;
req_filereq->devicenamescolor = 2;
req_filereq->VersionNumber = REQVERSION;
FileRequester(req_filereq);
PurgeFiles(req_filereq); /* FRQCACHINGM ! */
FreeMem(req_filereq, sizeof(struct ReqFileRequester));
}
}
else
{
a_Requester("No file requester available","Cancel",NULL);
}
}
}