home *** CD-ROM | disk | FTP | other *** search
- #include "mpp.h"
- extern UBYTE ModePro[];
- extern STRPTR MiscText[];
- extern UBYTE filename[513];
- extern struct FileRequester *BackdropFileReq;
- extern struct TextAttr *TAttr;
-
- #define PATH_SIZE 512
-
- BOOL SelectBackdropFile(UBYTE *title,struct Window *Parent,STRPTR OldFile)
- {
- WORD width;
- char path[PATH_SIZE],*file,*p2;
-
-
-
- if(OldFile)
- {
- file=FilePart(OldFile);
- strncpy(path,OldFile,PATH_SIZE);
- path[PATH_SIZE-1]=0;
- if(p2=PathPart(path))
- {
- *p2=0;
- }
- }
- else
- {
- file=0;
- path[0]=0;
- }
-
- if(!BackdropFileReq)
- {
- width=Parent->Width/2;
- BackdropFileReq=(struct FileRequester *)AllocAslRequestTags(ASL_FileRequest,
- ASLFR_TextAttr, TAttr,
- ASLFR_InitialTopEdge, Parent->TopEdge+8,
- ASLFR_InitialLeftEdge, Parent->LeftEdge+width/2,
- ASLFR_InitialWidth, width,
- ASLFR_InitialHeight, Parent->Height-16,
-
- ASLFR_DoPatterns , TRUE,
- ASLFR_InitialPattern, "~(#?.info)",
- ASLFR_PrivateIDCMP, TRUE,
- TAG_DONE);
- }
- if(BackdropFileReq)
- {
- if(AslRequestTags(BackdropFileReq,
- ASLFR_Window , Parent,
- ASLFR_SleepWindow , TRUE,
- ASLFR_TitleText, title,
- TAG_SKIP, (file?0:2), // if no file skip the next 2
- ASLFR_InitialFile, file,
- ASLFR_InitialDrawer, path,
- TAG_DONE))
- {
- strncpy(filename,BackdropFileReq->fr_Drawer,512);
- if(AddPart(filename,BackdropFileReq->fr_File,512))
- {
- BPTR l;
- if(l=Lock(filename,ACCESS_READ))
- {
- NameFromLock(l,filename,512);
- UnLock(l);
- }
- return(TRUE);
- }
- }
- }
- return(FALSE);
- }
-
-
-