home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
601-625
/
apd616
/
source
/
requester_proc_addon.amos
/
requester_proc_addon.amosSourceCode
Wrap
AMOS Source Code
|
1994-06-03
|
7KB
|
371 lines
'
' *** Insert These Lines After The SET VARIABLES & STRINGS Heading.
'
_MAX_LIST=200
Dim FILE$(_MAX_LIST,1)
CPATH$="Ram Disk:"
POS=0
PATH$="Ram:"
WILD$="**"
'
' *** Insert This Line After The SET GLOBAL VARIABLES & STRINGS heading.
'
Global _MAX_LIST,PATH$,CPATH$,POS,FILE$(),FIL$,FILES,DEVS,WILD$
'
' *** File Requester Procedure.
'
Procedure _FILEREQUESTER[T$]
'
' T$ - This contains the title displayed at the top of the requester.
'
' *** Backup Dialog & Font Info.
'
B_DLG$=_DIALOGBUTTON$
B_FNT$=_FONTNAME$
B_FS=_FONTSIZE
_DIALOGBUTTON$=""
'
' *** Open Screen.
'
_OPENDIALOGSCREEN[7,110,50]
_DRAWTITLEBAR[T$]
'
' *** Set Font.
'
_SETFONT["Topaz",8]
'
' *** Draw Surrounding Box.
'
_DRAW3DBOX[0,11,639,108,"",1,,_COLOUR]
_DRAW3DBOX[8,13,334,106,"",1,,_BACK]
'
' *** Draw Slider & Arrows.
'
_ADDBUTTON[337,89,352,97,"(S)UAR",-7]
_DRAW3DBOX[337,13,352,87,"",1,0,_BACK]
_ADDBUTTON[337,98,352,106,"(S)DAR",-8]
'
' *** Draw File & Path Box.
'
_DRAW3DBOX[356,45,440,59,"File",1,_TEXT,_BACK]
_ADDINPUTBUTTON[45,8,FIL$,31,31,2]
_DRAW3DBOX[356,13,440,27,"Drawer",1,_TEXT,_BACK]
_ADDINPUTBUTTON[45,4,PATH$+WILD$,31,120,1]
'
' *** Draw Buttons.
'
_ADDBUTTON[356,77,490,91,"Parent",5]
_ADDBUTTON[356,92,490,106,"Volumes",6]
_ADDBUTTON[497,77,631,91,"Cancel",3]
_ADDBUTTON[497,92,631,106,"OK",4]
'
' *** Set Requester Variables.
'
FIL$=""
SWITCH=0
'
' *** Check For Different Directory.
'
If PATH$<>CPATH$
Gosub _GET_DIR
End If
'
' *** Get List Of Devices.
'
Gosub _GET_DEV
'
' *** Display List, Filename & Path.
'
Gosub _DISPLAY_LIST
Gosub _DISPLAY_FILE
Gosub _DISPLAY_PATH
'
' *** MAIN LOOP.
'
Do
'
' *** Check Dialog Buttons.
'
_CHECKBUTTONS
_BUTTONZONE=Param
'
' *** Scroll Up A File.
'
If _BUTTONZONE=7 and POS>0
Dec POS
Gosub _DISPLAY_LIST
End If
'
' *** Scroll Down A File.
'
If _BUTTONZONE=8 and POS<FILES-10
Inc POS
Gosub _DISPLAY_LIST
End If
'
' *** Select File.
'
LOP=0
While LOP<11
_CHECKZONE[8+2,13+(LOP*8)+3,334-2,13+(LOP*8)+10,1]
If Param
FIL$=FILE$(POS+LOP,SWITCH)
Gosub _CUT_FIL
Gosub _DISPLAY_FILE
End If
Inc LOP
Wend
'
' *** Grab Slider.
'
_GRABVERTICALSLIDER[337,13,352,87,Min(FILES,FILES-11),POS+1,""]
If Param>0
POS=Param-1
Gosub _DISPLAY_LIST
End If
'
' *** Ok Button.
'
If _BUTTONZONE=4
FIL$=PATH$+FIL$
Goto FIN
End If
'
' *** Parent Button.
'
If _BUTTONZONE=5
Gosub _PARENT
Gosub _DISPLAY_PATH
End If
'
' *** Cancel
'
If _BUTTONZONE=3
FIL$=""
Goto FIN
End If
'
' *** Volumes Button.
'
If _BUTTONZONE=6 and SWITCH=0
SWITCH=1
Gosub _GET_DEV
FILES=DEVS
Gosub _DISPLAY_LIST
Gosub _DISPLAY_PATH
Gosub _DISPLAY_FILE
End If
'
' *** Edit Path.
'
If _BUTTONZONE=1
_ADDINPUTBUTTON[45,4,PATH$+WILD$,31,120,0]
PATH$=Param$
Gosub _CUT_WILD
If(Right$(PATH$,1)<>"/") and(Right$(PATH$,1)<>":")
PATH$=PATH$+"/"
End If
Gosub _GET_DIR
Gosub _DISPLAY_LIST
Gosub _DISPLAY_FILE
Gosub _DISPLAY_PATH
End If
'
' *** Edit Filename.
'
If _BUTTONZONE=2
_ADDINPUTBUTTON[45,8,FIL$,31,31,0]
FIL$=Param$
Gosub _DISPLAY_FILE
End If
'
Loop
'
' *** Get Parent Directory.
'
_PARENT:
If Len(PATH$)>2
LOP=Len(PATH$)-1
While LOP>1
A$=Mid$(PATH$,LOP,1)
If(A$="/") or(A$=":")
PATH$=Left$(PATH$,LOP)
Gosub _GET_DIR
Gosub _DISPLAY_LIST
Exit
End If
Dec LOP
Wend
End If
Return
'
' *** Cut Up Path & Wildcard.
'
_CUT_WILD:
LOP=Len(PATH$)
While LOP>1
A$=Mid$(PATH$,LOP,1)
If(A$=":") or(A$="/")
WILD$=Right$(PATH$,Len(PATH$)-LOP)
PATH$=Left$(PATH$,LOP)
Exit
End If
Dec LOP
Wend
Return
'
' *** Tidy Up Selected Name.
'
_CUT_FIL:
'
LOP=30
While LOP>1
If Mid$(FIL$,LOP,1)<>" "
FIL$=Left$(FIL$,LOP)
Exit
End If
Dec LOP
Wend
'
A$=Left$(FIL$,1)
FIL$=Mid$(FIL$,2)
'
If A$="*"
PATH$=PATH$+FIL$+"/"
Gosub _GET_DIR
End If
'
If Right$(FIL$,1)=":"
PATH$=FIL$
Gosub _GET_DIR
End If
'
Gosub _DISPLAY_LIST
Gosub _DISPLAY_FILE
Gosub _DISPLAY_PATH
'
Return
'
' *** Get List Of Files.
'
_GET_DIR:
'
If Not Exist(PATH$)
PATH$=CPATH$
SWITCH=0
Gosub _GET_DEV
Gosub _DISPLAY_PATH
Return
End If
'
LOP=0
While LOP<_MAX_LIST-1
FILE$(LOP,0)=""
Inc LOP
Wend
'
Set Dir 31
'
FILES=0
FILE$(FILES,0)=Dir First$(PATH$+WILD$)
'
While FILE$(FILES,0)<>"" and FILES<_MAX_LIST
If Mid$(FILE$(FILES,0),1,1)="*"
Mid$(FILE$(FILES,0),31,5)="(Dir)"
End If
Inc FILES
FILE$(FILES,0)=Dir Next$
Wend
Dec FILES
'
If FILES<0
FILES=0
End If
'
CPATH$=PATH$
'
FIL$=""
POS=0
SWITCH=0
'
Gosub _GET_DEV
'
Return
'
' *** Get List Of Devices.
'
_GET_DEV:
'
LOP=0
While LOP<_MAX_LIST-1
FILE$(LOP,1)=""
Inc LOP
Wend
'
Set Dir 31
'
DEVS=0
FILE$(DEVS,1)=Dev First$("**")
'
While FILE$(DEVS,1)<>""
Mid$(FILE$(DEVS,1),31,5)="(Dev)"
Inc DEVS
FILE$(DEVS,1)=Dir Next$
Wend
Dec DEVS
'
If DEVS<0
DEVS=0
End If
'
FIL$=""
POS=0
'
Return
'
' *** Display Path.
'
_DISPLAY_PATH:
Pen _TEXT
Print At(45,4)+Space$(31);
Print At(45,4)+Left$(PATH$+WILD$,31);
Return
'
' *** Display Filename.
'
_DISPLAY_FILE:
Pen _TEXT
Print At(45,8)+Space$(31);
Print At(45,8)+Left$(FIL$,31);
Return
'
' *** Display File List & Slider.
'
_DISPLAY_LIST:
'
LOP=POS
While LOP<POS+11
Locate 2,LOP-POS+2
If FILE$(LOP,SWITCH)<>""
If Left$(FILE$(LOP,SWITCH),1)="*"
Pen _LIGHT
Else
Pen _TEXT
End If
Print FILE$(LOP,SWITCH);
Else
Print Space$(38);
End If
Inc LOP
Wend
'
_VERTICALSLIDER[337,13,352,87,Min(FILES,FILES-11),POS+1,""]
'
Return
'
FIN:
Screen Close 7
_DIALOGBUTTON$=B_DLG$
_SETFONT[B_FNT$,B_FS]
'
End Proc[FIL$]