home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frostbyte's 1980s DOS Shareware Collection
/
floppyshareware.zip
/
floppyshareware
/
GLEN
/
NRFACE.ZIP
/
IPDEMO.BAS
< prev
next >
Wrap
BASIC Source File
|
1990-05-08
|
55KB
|
2,745 lines
DEFINT A-Z
DIM drive$(8)
'============================== Define Types ================================
'======Needed for mouse, memory size, and screen print
TYPE register 'for CALL INTERRUPT
ax AS INTEGER
bx AS INTEGER
cx AS INTEGER
dx AS INTEGER
bp AS INTEGER
si AS INTEGER
di AS INTEGER
flags AS INTEGER
ds AS INTEGER
es AS INTEGER
END TYPE
DIM regs AS register
'===================== Declare Procedures and Functions =====================
DECLARE SUB MouseBar.Menu (sel, sel$(), fg, bg, pchar, msg$, topline, submenu, mouse$)
DECLARE SUB Interrupt (intnum AS INTEGER, inreg AS register, outreg AS register)
DECLARE SUB MouseDriver (m0%, m1%, m2%, m3%)
DECLARE SUB MouseInit (mouse$)
DECLARE SUB MouseOn ()
DECLARE SUB MouseOff ()
DECLARE SUB MouseGetInfo (mousex, mousey, isbutton$, mouse$, a$)
DECLARE SUB MakeBox (title$, uly, ulx, bwide, bhigh, linesty, fg, bg, pchar)
DECLARE SUB MoveMouse (mmousey, mmousex)
DECLARE SUB SetMemDta (memdta$)
DECLARE SUB FirstFile (filespec$, filename$)
DECLARE SUB NextFile (filename$)
DECLARE SUB MakeName (fullname$)
DECLARE SUB WhatKey (keypress$)
DECLARE SUB WaitaBit (hold!)
DECLARE SUB GetVer (version)
'=========================== Main Control Program ===========================
'Initialization routine -- runs only once
'====================DO NOT REMOVE THIS LINE!=============================
IFaceCopyRight$ = "Interface Plus -- Copyright 1990 by George Campbell"
'=====IT MUST BE IN ALL PROGRAMS USING THIS INTERFACE --NEVER DISPLAYS====
DIM sel$(7, 10)
ON ERROR GOTO GetError
GOSUB ParseCommandLine
GOSUB GetEnvir
GOSUB GetConfig
GOSUB ColorInit
GOSUB GetOldDir
GOSUB ScreenTest
GOSUB MemSize
CALL GetVer(version)
'=====SEE THE DOCS REGARDING THE DRIVETEST ROUTINE, WHICH
'=====MAY LEAVE FILES BEHIND ON SOME LOGICAL DRIVES. NO
'=====HARM IS DONE BY THESE FILES, BUT YOU MAY DECIDE TO
'=====ELIMINATE THIS ROUTINE FROM YOUR PROGRAMS. I HAVE
'=====REMMED THEM OUT.
REM GOSUB InputBox
REM LOCATE 16, 24
REM PRINT "Setting up .... Please wait!"
REM GOSUB DriveTest
CALL MouseInit(mouse$)
'=====Random Shareware Screen Displayer
RANDOMIZE TIMER
x = INT(RND * 4) + 1
IF x = 2 THEN GOSUB ShareInfo
'=====Starts the menu presentation. GOTOs in the SELECT CASE
'=====sections return to this point.
BEGIN:
WIDTH 80
a$ = ""
generrorflag = 0
isbutton$ = ""
'====== Define the Main Menu titles
'====== Should have different first letters
'====== You can include more main entries, but you must change
'====== the DIM sel() line above to add.
sel$(0, 0) = " F)ile "
sel$(1, 0) = " P)rinter "
sel$(2, 0) = " E)xamples "
sel$(3, 0) = " S)etup "
sel$(4, 0) = " T)ools "
sel$(5, 0) = " D)emos "
sel$(6, 0) = " H)elp "
'===== Define Help messages for line 25
'======Up to 80 characters -- truncates if longer
sel$(0, 10) = "Perform file and DOS operations"
sel$(1, 10) = "Printer control tools"
sel$(2, 10) = "Examples of Interface Plus Power"
sel$(3, 10) = "Set Program parameters and defaults"
sel$(4, 10) = "More Interface Plus demos"
sel$(5, 10) = "Demonstrate Interface Plus tools"
sel$(6, 10) = "Help with this program"
'===== Define Submenu titles For "File" (0,0)
sel$(0, 1) = " Display directory of files " + "[" + UCASE$(newdir$) + "]"
IF newmask$ = "" AND version > 2 THEN mask$ = "*.*"
IF newmask$ = "" AND version < 3 THEN mask$ = "????????.???"
IF NOT newmask$ = "" THEN mask$ = newmask$
sel$(0, 2) = " Select file mask " + "[" + UCASE$(mask$) + "]"
sel$(0, 3) = " Change directory "
sel$(0, 4) = " Select A File " + "[" + RTRIM$(filechoice$) + "]"
sel$(0, 5) = " This Space Available"
sel$(0, 6) = " Shell to DOS "
sel$(0, 7) = " Quit program "
sel$(0, 8) = ""
'===== Define Submenu titles For "Printer" (1,0)
sel$(1, 1) = " This Space Available"
sel$(1, 2) = " Send Formfeed to printer "
sel$(1, 3) = " Send Reset to printer "
sel$(1, 4) = " This space available "
sel$(1, 5) = " This space available "
sel$(1, 6) = " Print the screen "
sel$(1, 7) = " This space available"
sel$(1, 8) = ""
'==== Define Submenu titles for "Examples" (2,0)
sel$(2, 1) = " Demo of Menu Intelligence"
sel$(2, 2) = " Demo Mouse Positioning"
sel$(2, 3) = " This Space available"
sel$(2, 4) = " This Space available"
sel$(2, 5) = " This Space available"
sel$(2, 6) = " This Space Available"
sel$(2, 7) = " This Space available"
sel$(2, 8) = ""
'Define Submenu titles for "Setup" (3,0)
sel$(3, 1) = " This Space available"
sel$(3, 2) = " This Space available"
sel$(3, 3) = " This Space available"
sel$(3, 4) = " Set screen colors"
sel$(3, 5) = " This Space available"
sel$(3, 6) = " Save configuration (becomes default)"
sel$(3, 7) = " Delete old configuration file"
sel$(3, 8) = ""
'Define Submenu titles for "Tools" (4,0)
sel$(4, 1) = " GETFILES"
sel$(4, 2) = " What Interface PLUS Knows"
sel$(4, 3) = " Demo Key Identification Routine"
sel$(4, 4) = " This Space available"
sel$(4, 5) = " This Space available"
sel$(4, 6) = " This Space available"
sel$(4, 7) = " Back to Intelligent Menu Demo"
sel$(4, 8) = ""
'Define Submenu titles for "Demos" (5,0)
sel$(5, 1) = " Demo MakeBox SUB"
sel$(5, 2) = " Demo ASCII File Display "
sel$(5, 3) = " Registration Information "
sel$(5, 4) = " Display System Memory"
sel$(5, 5) = " Demo moveable Y/N button"
sel$(5, 6) = " Demo fixed Y/N button"
sel$(5, 7) = " Demo moveable OK button"
sel$(5, 8) = ""
'Define Submenu titles for "Help" (6,0)
sel$(6, 1) = " Command line options "
sel$(6, 2) = " Read manual "
sel$(6, 3) = " This Space available"
sel$(6, 4) = " This Space available"
sel$(6, 5) = " This Space available"
sel$(6, 6) = " This Space available"
sel$(6, 7) = " This Space available"
sel$(6, 8) = ""
'===== Define Top Row Message
msg$ = "╡ Use Mouse/Cursor/Letter/Number Keys To Make Selections ╞"
'===== Make Call to MouseBar.Menu and Restart Selection Routine========
MoveMouse mmousey + 1, mmousex + 1
IF mmousey = 0 THEN
MoveMouse 12, 40
END IF
REM KEY(1) OFF
CALL MouseBar.Menu(sel, sel$(), fg, bg, pchar, msg$, topline, submenu, mouse$)
'===== Do the desired Selection
MouseOff
'===== The next set of routines are the calls to your routines,
'===== based on the choice made in MouseBar.Menu.
SELECT CASE sel
CASE 1
GOSUB GetFiles
topline = 0
submenu = 1
GOTO BEGIN
CASE 2
GOSUB GetMask
help$ = "MASK"
topline = 0
submenu = 1
GOTO BEGIN
CASE 3
GOSUB GetDir
topline = 0
submenu = 1
GOTO BEGIN
CASE 4
chooseone$ = "Y"
GOSUB GetFiles
topline = 0
submenu = 1
GOTO BEGIN
CASE 5
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 6
GOSUB ShellOut
topline = 0
submenu = 1
GOTO BEGIN
CASE 7
GOSUB InputBox
LOCATE 16, 12
PRINT "Are you sure you want to quit (Y/N)? ";
LOCATE 18, 12
PRINT "Press Y or N or click with mouse."
GOSUB YesNoButton
IF NOT response$ = "Y" THEN
topline = 0
submenu = 1
GOTO BEGIN
END IF
COLOR fg, bg
GOSUB quit
CLS
END
CASE 11
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 12
ON ERROR GOTO noprint
LPRINT CHR$(12)
ON ERROR GOTO 0
topline = 0
submenu = 1
GOTO BEGIN
CASE 13
ON ERROR GOTO noprint
LPRINT reset$
ON ERROR GOTO 0
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 14
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 15
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 16
topline = 0
submenu = 1
CALL Interrupt(5, regs, regs)
'below needed only for HPLJ
LPRINT CHR$(12)
GOTO BEGIN
CASE 17
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 21
topline = 4
submenu = 7
mmousey = 11
mmousex = 40
GOSUB InputBox
LOCATE 16, 12
PRINT "This interface has intelligence. You supply"
LOCATE 17, 12
PRINT "jump points to the next logical menu item."
LOCATE 18, 12
PRINT "Click [OK] for a demo."
GOSUB OkButton
GOTO BEGIN
CASE 22
topline = 0
submenu = 1
GOSUB InputBox
LOCATE 16, 12
PRINT "Interface Plus can position the mouse cursor anywhere"
LOCATE 17, 12
PRINT "you like. You simply supply screen coordinates. WATCH!"
LOCATE 18, 12
PRINT "Moving mouse cursor to coordinates:"
COLOR fg, bg
MouseOn
FOR x = 15 TO 60
MoveMouse 15, x
LOCATE 18, 48
PRINT 15, x
NEXT
GOSUB OkButton
GOTO BEGIN
CASE 23
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 24
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 25
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 26
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 27
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 31
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 32
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 33
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 34
GOSUB ColorSet
topline = 0
submenu = 1
GOTO BEGIN
CASE 35
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 36
'It's up to you to establish the variables you want to save in a file.
'I like to keep my color data in a separate file. This command should
'be used to save other setup data. I suggest a subroutine call here to
'go to your data saving routine.
GOSUB InputBox
LOCATE 16, 12
PRINT "This saves a special configuration. You should test"
LOCATE 17, 12
PRINT "your figures thoroughly before saving."
LOCATE 18, 12
PRINT "Press or click on Y to save....any other to exit"
GOSUB YesNoButton
saveit$ = response$
IF UCASE$(saveit$) = "Y" THEN
LOCATE 18, 12
PRINT "File would be saved here"
END IF
topline = 0
submenu = 1
MouseOff
GOTO BEGIN
CASE 37
'Be sure to choose a new name for config file
GOSUB InputBox
LOCATE 16, 12
PRINT "Delete old configuration (Y/N)? ";
LOCATE 16, 12
PRINT "Press or click Y to delete -- any other aborts"
GOSUB YesNoButton
ON ERROR GOTO nofile
IF response$ = "Y" THEN
kil$ = envpath$ + "IFACE.CFG"
KILL kil$
END IF
finished:
topline = 0
submenu = 1
ON ERROR GOTO 0
MouseOff
GOTO BEGIN
nofile:
GOSUB InputBox
LOCATE 16, 12
PRINT "No configuration file found...."
LOCATE 17, 12
PRINT "Click OK or press a key to continue"
GOSUB OkButton
RESUME finished
CASE 41
topline = 0
submenu = 1
GOSUB GetFiles
oky = 20
okx = 75
GOTO BEGIN
CASE 42
topline = 0
submenu = 1
GOSUB ShowStuff
GOTO BEGIN
CASE 43
topline = 0
submenu = 1
GOSUB InputBox
begincheck:
keypress$ = INKEY$
WhatKey keypress$
LOCATE 16, 12
PRINT "This routine identifies special and Function keys"
LOCATE 17, 12
PRINT "You pressed: ";
IF NOT keypress$ = "" THEN PRINT keypress$; " ";
LOCATE 18, 12
PRINT "Press any key for demo or <Alt>-<F10> to exit"
IF NOT keypress$ = "AF10" THEN GOTO begincheck
GOTO BEGIN
CASE 44
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 45
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 46
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 47
topline = 2
submenu = 1
mmousey = 5
mmousex = 19
GOSUB InputBox
LOCATE 16, 12
PRINT "See...when you finished with one operation, the"
LOCATE 17, 12
PRINT "program took you to the next logical operation."
LOCATE 18, 12
PRINT "Now...click [OK] to go back to the original."
GOSUB OkButton
GOTO BEGIN
CASE 51
topline = 0
submenu = 1
MakeBox "BoxTest", 6, 6, 31, 10, 2, 15, 0, pchar
LOCATE 8, 7
PRINT "These boxes are sizable."
LOCATE 9, 7
PRINT "You control:"
LOCATE 10, 7
PRINT "Size, Position, Borders,"
LOCATE 11, 7
PRINT "Color, and more."
LOCATE 14, 7
PRINT "Click [OK] for more!"
oky = 18
okx = 18
GOSUB MoveOkButton
MakeBox "Another Box", 17, 1, 80, 6, 1, 15, 4, pchar
LOCATE 19, 6
PRINT "You can do just about anything you want"
LOCATE 20, 6
PRINT "With these boxes. They're a valuable tool"
LOCATE 21, 6
PRINT "For your programs. It's easy!"
oky = 18
okx = 60
GOSUB MoveOkButton
GOTO BEGIN
CASE 52
GOSUB InputBox
LOCATE 18, 12
IF filechoice$ <> "" THEN
PRINT "Press <Enter> to view: "; filechoice$
LOCATE 17, 12
PRINT " -or-"
END IF
LOCATE 16, 12
INPUT "Enter a filename to view: ", ViewFile$
IF ViewFile$ = "" THEN ViewFile$ = filechoice$
GOSUB ViewFile
GOSUB InputBox
LOCATE 16, 12
PRINT "The Viewfile routine is one-way, moving down"
LOCATE 17, 12
PRINT "Through the file -- intended for a quick look."
LOCATE 18, 12
PRINT "Filename is stored in viewfile$"
GOSUB OkButton
GOTO BEGIN
CASE 53
'Demo of using the MakeBox routine with text
GOSUB ShareInfo
topline = 0
submenu = 1
GOTO BEGIN
CASE 54
'DEMO of routine to get system memory
topline = 0
submenu = 1
GOSUB MemSize
GOSUB InputBox
LOCATE 16, 12
PRINT "This routine gets total system memory"
LOCATE 18, 12
PRINT "TOTAL MEMORY IS: "; sizeram; "K"
GOSUB OkButton
GOTO BEGIN
CASE 55
'Demo of moveable Yes/No button
topline = 0
submenu = 1
ynoy = 6
ynox = 34
GOSUB InputBox
LOCATE 17, 12
PRINT "This routine accepts a mouse click or keystroke"
LOCATE 18, 12
PRINT "Button may be placed anywhere on screen."
GOSUB MoveYesNoButton
LOCATE 16, 27
PRINT "Response$ returned: ";
COLOR bg, fg
PRINT " "; response$; " "
COLOR fg, bg
GOSUB OkButton
GOTO BEGIN
CASE 56
'=====Demonstrates call to fixed Y/N button
MouseOff
topline = 0
submenu = 1
GOSUB InputBox
LOCATE 17, 12
PRINT "GOSUB YesNoButton to get a user confirmation"
LOCATE 18, 12
PRINT "Y or N returned in response$ by click or keypress"
GOSUB YesNoButton
LOCATE 16, 30
PRINT "RESPONSE WAS: ";
COLOR bg, fg
PRINT " "; response$; " "
COLOR fg, bg
GOSUB OkButton
'INSERT ACTION HERE. RESPONSE$ CAN BE 'Y' 'N' OR NUL
GOTO BEGIN
CASE 57
topline = 0
submenu = 1
'define upper left corner
oky = 10
okx = 20
GOSUB InputBox
LOCATE 16, 12
PRINT "This OK button can be placed anywhere on screen,"
LOCATE 17, 12
PRINT "including inside moveable boxes. RETURN on keypress"
LOCATE 18, 12
PRINT "or mouse click on button."
GOSUB MoveOkButton
GOTO BEGIN
CASE 61
GOSUB InputBox
LOCATE 16, 12
PRINT "Interface PLUS has a command line parser, which can read"
LOCATE 17, 12
PRINT "3 parameters or you can add more. Current parameters:"
LOCATE 18, 12
PRINT command1$, command2$, command3$
GOSUB OkButton
topline = 0
submenu = 1
MouseOff
GOTO BEGIN
CASE 62
readit$ = envpath$ + "IFACE.COM"
COLOR fg, bg
CLS
SHELL readit$
topline = 0
submenu = 1
GOTO BEGIN
CASE 63
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 64
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 65
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 66
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE 67
topline = 0
submenu = 1
GOSUB OkButton
GOTO BEGIN
CASE ELSE
topline = 0
submenu = 1
GOTO BEGIN
END SELECT
'PLACE ALL GOSUB SUBROUTINES BELOW THIS LINE!
'============================================================
DriveTest:
'===== Checks for available disk drives
ON ERROR GOTO driverror
atest:
flag = 0
OPEN "A:~test~.tst" FOR OUTPUT AS #1
IF flag = 1 THEN GOTO btest
drive$(1) = "Y"
CLOSE #1
KILL "a:~test~.tst"
btest:
flag = 0
OPEN "B:~test~.tst" FOR OUTPUT AS #1
IF flag = 1 THEN GOTO ctest
drive$(2) = "Y"
CLOSE #1
KILL "B:~test~.tst"
ctest:
flag = 0
OPEN "C:~test~.tst" FOR OUTPUT AS #1
IF flag = 1 THEN GOTO dtest
drive$(3) = "Y"
CLOSE #1
KILL "C:~test~.tst"
dtest:
flag = 0
OPEN "D:~test~.tst" FOR OUTPUT AS #1
IF flag = 1 THEN GOTO etest
drive$(4) = "Y"
CLOSE #1
KILL "D:~test~.tst"
etest:
flag = 0
OPEN "E:~test~.tst" FOR OUTPUT AS #1
IF flag = 1 THEN GOTO ftest
drive$(5) = "Y"
CLOSE #1
KILL "E:~test~.tst"
ftest:
flag = 0
OPEN "f:~test~.tst" FOR OUTPUT AS #1
IF flag = 1 THEN GOTO gtest
drive$(6) = "Y"
CLOSE #1
KILL "f:~test~.tst"
gtest:
flag = 0
OPEN "g:~test~.tst" FOR OUTPUT AS #1
IF flag = 1 THEN GOTO htest
drive$(7) = "Y"
CLOSE #1
KILL "f:~test~.tst"
htest:
flag = 0
OPEN "h:~test~.tst" FOR OUTPUT AS #1
IF NOT flag = 1 THEN
drive$(8) = "Y"
END IF
CLOSE #1
KILL "f:~test~.tst"
RETURN
driverror:
flag = 1
RESUME NEXT
ParseCommandLine:
'===== You can add additional parameters by simply copying the
'===== IF...END IF blocks, changing the variables.
command1$ = LEFT$(COMMAND$, INSTR(COMMAND$, " "))
IF INSTR(COMMAND$, " ") = 0 THEN
command1$ = COMMAND$
RETURN
END IF
remainder$ = MID$(COMMAND$, (INSTR(COMMAND$, " ") + 1))
command2$ = LEFT$(remainder$, INSTR(remainder$, " "))
IF INSTR(remainder$, " ") = 0 THEN
command2$ = remainder$
RETURN
END IF
remainder$ = MID$(remainder$, (INSTR(remainder$, " ") + 1))
command3$ = LEFT$(remainder$, INSTR(remainder$, " "))
IF INSTR(remainder$, " ") = 0 THEN
command3$ = remainder$
RETURN
END IF
RETURN
GetMask:
'=====Since the INTERRUPT call here is version specific, you must
'=====keep the DOS 2.x stuff in here.
GOSUB InputBox
IF version > 2 THEN
COLOR fg, bg
LOCATE 18, 12
PRINT "Use normal DOS wildcards (? and *)..."
LOCATE 17, 12
PRINT "Press <Enter> for *.* default."
LOCATE 16, 12
INPUT ; "Enter new file mask: ", newmask$
END IF
IF version < 3 THEN
COLOR fg, bg
LOCATE 18, 12
PRINT "Use only the '?' wildcard for DOS 2.x"
LOCATE 17, 12
PRINT "Press <Enter> for ????????.??? default"
LOCATE 16, 12
INPUT ; "Enter new file mask: ", newmask$
IF INSTR(newmask$, "*") THEN GOTO GetMask
END IF
RETURN
GetDir:
newdir$ = ""
GOSUB InputBox
ON ERROR GOTO direrr
COLOR fg, bg
LOCATE 18, 12
PRINT "Include drive information if needed..."
LOCATE 17, 12
PRINT "Press <Enter> for "; originaldir$
LOCATE 16, 12
INPUT ; "Enter new directory: ", newdir$
newdir$ = UCASE$(newdir$)
IF newdir$ = "" THEN
newdir$ = olddir$
GOTO BEGIN
END IF
IF NOT LEN(newdir$) = 3 THEN
IF RIGHT$(newdir$, 1) = "\" THEN
newdir$ = LEFT$(newdir$, (LEN(newdir$) - 1))
END IF
END IF
CHDIR newdir$
ON ERROR GOTO 0
RETURN
direrr:
LOCATE 17, 12
SOUND 1000, 1
PRINT "Invalid directory....press a key";
a$ = INPUT$(1)
newdir$ = ""
RESUME GetDir
ShellOut:
COLOR fg, bg
GOSUB InputBox
LOCATE 17, 12
PRINT "Enter a DOS command or press Enter for DOS prompt."
LOCATE 18, 12
PRINT "Enter EXIT to return to program."
LOCATE 16, 12
INPUT "Command to Execute: ", doscmd$
IF UCASE$(doscmd$) = "EXIT" THEN RETURN
CLS
LOCATE 1, 1
PRINT "Enter Exit to return to Interface Plus"
SHELL doscmd$
oky = 21
okx = 75
GOSUB MoveOkButton
RETURN
YesNoButton:
response$ = ""
isbutton$ = ""
COLOR fg, bg
LOCATE 15, 69
PRINT "╦═══╗";
LOCATE 16, 70
COLOR bg, fg
PRINT "YES";
COLOR fg, bg
PRINT "║";
LOCATE 17, 69
PRINT "╠═══╣";
LOCATE 18, 70
COLOR bg, fg
PRINT " NO";
COLOR fg, bg
PRINT "║";
LOCATE 19, 69
PRINT "╩═══╝";
MoveMouse 16, 70
WHILE NOT isbutton$ = "DOWN"
response$ = UCASE$(INKEY$)
IF response$ <> "" THEN RETURN
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
WEND
IF mousex = 69 OR mousex = 70 OR mousex = 71 THEN
IF mousey = 15 THEN
response$ = "Y"
CALL WaitaBit(.15)
isbutton$ = ""
RETURN
ELSEIF mousey = 17 THEN
response$ = "N"
CALL WaitaBit(.15)
isbutton$ = ""
RETURN
ELSE
response$ = ""
GOTO YesNoButton
END IF
END IF
isbutton$ = ""
IF response$ = "" THEN GOTO YesNoButton
RETURN
MoveYesNoButton:
response$ = ""
isbutton$ = ""
COLOR fg, bg
LOCATE ynoy, ynox
PRINT "╔═══╗";
LOCATE ynoy + 1, ynox
PRINT "║";
COLOR bg, fg
PRINT "YES";
COLOR fg, bg
PRINT "║";
LOCATE ynoy + 2, ynox
PRINT "╠═══╣";
LOCATE ynoy + 3, ynox
PRINT "║";
COLOR bg, fg
PRINT " NO";
COLOR fg, bg
PRINT "║";
LOCATE ynoy + 4, ynox
PRINT "╚═══╝";
MoveMouse ynoy + 1, ynox + 1
REM mouseon
WHILE NOT isbutton$ = "DOWN"
response$ = UCASE$(INKEY$)
IF response$ <> "" THEN RETURN
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
WEND
IF mousex = ynox OR mousex = ynox + 1 OR mousex = ynox + 2 THEN
IF mousey = ynoy THEN
response$ = "Y"
CALL WaitaBit(.15)
RETURN
ELSEIF mousey = ynoy + 2 THEN
response$ = "N"
CALL WaitaBit(.15)
RETURN
ELSE
response$ = ""
GOTO MoveYesNoButton
END IF
END IF
isbutton$ = ""
IF response$ = "" THEN GOTO MoveYesNoButton
RETURN
MoveOkButton:
response$ = ""
OK$ = ""
COLOR fg, bg
LOCATE oky, okx
PRINT "╔════╗";
LOCATE oky + 1, okx
PRINT "║";
COLOR bg, fg
PRINT " OK ";
COLOR fg, bg
PRINT "║";
LOCATE oky + 2, okx
PRINT "╚════╝";
MoveMouse oky + 1, okx + 1
REM mouseon
WHILE NOT isbutton$ = "DOWN"
OK$ = INKEY$
IF OK$ <> "" THEN
MouseOff
CALL WaitaBit(.15)
RETURN
END IF
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
WEND
IF mousey = oky THEN
IF mousex = okx OR mousex = okx + 1 OR mousex = okx + 2 OR mousex = okx + 3 THEN
MouseOff
CALL WaitaBit(.15)
RETURN
END IF
END IF
isbutton$ = ""
GOTO MoveOkButton
MouseOff
CALL WaitaBit(.15)
RETURN
OkButton:
response$ = ""
OK$ = ""
COLOR fg, bg
LOCATE 15, 69
PRINT "╦════╗";
LOCATE 16, 70
COLOR bg, fg
PRINT " ";
COLOR fg, bg
PRINT "║";
LOCATE 17, 69
PRINT "║";
COLOR bg, fg
PRINT " OK ";
COLOR fg, bg
PRINT "║";
LOCATE 18, 70
COLOR bg, fg
PRINT " ";
COLOR fg, bg
PRINT "║";
LOCATE 19, 69
PRINT "╩════╝";
MoveMouse 16, 70
WHILE NOT isbutton$ = "DOWN"
OK$ = INKEY$
IF OK$ <> "" THEN
MouseOff
CALL WaitaBit(.15)
RETURN
END IF
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
WEND
IF mousey = 15 OR mousey = 16 OR mousey = 17 THEN
IF mousex = 69 OR mousex = 70 OR mousex = 71 OR mousex = 72 THEN
MouseOff
CALL WaitaBit(.15)
RETURN
END IF
END IF
isbutton$ = ""
GOTO OkButton
MouseOff
CALL WaitaBit(.15)
RETURN
InputBox:
'Draws box on screen for input or messages
COLOR fg, bg
LOCATE 15, 10
PRINT "╔";
FOR topx = 1 TO 58
PRINT "═";
NEXT topx
PRINT "╗"
LOCATE 16, 10: PRINT "║"; SPACE$(58); "║"
LOCATE 17, 10: PRINT "║"; SPACE$(58); "║"
LOCATE 18, 10: PRINT "║"; SPACE$(58); "║"
LOCATE 19, 10
PRINT "╚";
FOR bottomx = 1 TO 58
PRINT "═";
NEXT bottomx
PRINT "╝";
RETURN
GetFiles:
fileflag = 0
COLOR fg, bg
memdta$ = SPACE$(43)
IF RIGHT$(newdir$, 1) <> "\" THEN filespec$ = newdir$ + "\" + mask$
IF RIGHT$(newdir$, 1) = "\" THEN filespec$ = newdir$ + mask$
CALL SetMemDta(memdta$)
CALL FirstFile(filespec$, filename$)
title$ = "File Listing for " + UCASE$(filespec$)
MakeBox title$, 4, 1, 82, 22, 4, fg, bg, pchar
VIEW PRINT 6 TO 23
LOCATE 6, 1
filecount = 1
IF filename$ <> "" THEN
PRINT filename$,
DO
CALL NextFile(filename$)
IF filename$ <> "" THEN
PRINT filename$,
filecount = filecount + 1
END IF
IF filecount = 75 THEN
IF chooseone$ = "Y" THEN
LOCATE 21, 45
COLOR bg, fg
PRINT "MORE -- Choose a file here?";
COLOR fg, bg
ynoy = 18
ynox = 75
GOSUB MoveYesNoButton
IF response$ = "Y" THEN
MouseOff
FOR x = 18 TO 22
LOCATE x, 75
PRINT " ";
NEXT x
LOCATE 21, 45
PRINT SPACE$(30);
MouseOn
filecount = 1
skipok = 1
GOSUB ChooseFile
ELSE
MouseOff
FOR x = 18 TO 22
LOCATE x, 75
PRINT " ";
NEXT x
LOCATE 21, 45
PRINT SPACE$(30);
filecount = 75
END IF
END IF
GOSUB GetMoreFiles
IF response$ <> "Y" THEN
MouseOff
filename$ = ""
END IF
END IF
LOOP UNTIL filename$ = ""
ELSE
PRINT "no files match"
END IF
IF chooseone$ = "Y" THEN
skipok = 1
GOSUB ChooseFile
END IF
MouseOff
IF NOT skipok = 1 THEN
LOCATE 21, 54
COLOR bg, fg
oky = 20
okx = 75
PRINT "Return to main menu.";
COLOR fg, bg
MouseOn
GOSUB MoveOkButton
END IF
MouseOff
response$ = ""
isbutton$ = ""
VIEW PRINT 1 TO 25
skipok = 0
RETURN
GetMoreFiles:
IF fileflag = 1 THEN RETURN
LOCATE 21, 55
COLOR bg, fg
PRINT "Look at more files?";
COLOR fg, bg
ynoy = 18
ynox = 75
GOSUB MoveYesNoButton
IF response$ = "Y" THEN
MouseOff
FOR x = 18 TO 22
LOCATE x, 75
PRINT " ";
NEXT x
LOCATE 21, 55
PRINT " "
CLS
MouseOn
filecount = 1
ELSE
chooseone$ = ""
MouseOff
FOR x = 18 TO 22
LOCATE x, 75
PRINT " ";
NEXT x
LOCATE 21, 30
PRINT SPACE$(48);
filecount = 75
response$ = ""
MouseOn
END IF
RETURN
ChooseFile:
outofrange = 0
ON ERROR GOTO 0
IF mouse$ = "YES" THEN
LOCATE 23, 37
COLOR bg, fg
PRINT " CANCEL ";
LOCATE 25, 1
COLOR bg, fg
PRINT SPACE$(80);
LOCATE 25, 1
PRINT "Click on your choice...Press any key to enter file manually";
COLOR fg, bg
filechoice$ = ""
isbutton$ = ""
bldfile$ = ""
fileflag = 0
pressed = 0
WHILE isbutton$ <> "DOWN"
IF INKEY$ <> "" THEN
pressed = 1
GOSUB manual
RETURN
END IF
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
WEND
IF mousey < 5 OR mousey > 21 THEN outofrange = 1
mousex = mousex + 1
IF mousex >= 1 AND mousex <= 12 AND outofrange = 0 THEN
isbutton$ = ""
LOCATE mousey + 1, 1
FOR x = 1 TO 12
partfile = SCREEN(mousey + 1, x)
bldfile$ = bldfile$ + CHR$(partfile)
NEXT
LOCATE mousey + 1, 1
COLOR bg, fg
MouseOff
PRINT RTRIM$(bldfile$)
filechoice$ = RTRIM$(bldfile$)
fileflag = 1
oldy = mousey + 1
oldx = 1
ELSEIF mousex >= 15 AND mousex <= 26 AND outofrange = 0 THEN
isbutton$ = ""
LOCATE mousey + 1, 15
FOR x = 15 TO 26
partfile = SCREEN(mousey + 1, x)
bldfile$ = bldfile$ + CHR$(partfile)
NEXT
LOCATE mousey + 1, 15
COLOR bg, fg
MouseOff
PRINT RTRIM$(bldfile$)
filechoice$ = RTRIM$(bldfile$)
fileflag = 1
oldy = mousey + 1
oldx = 15
ELSEIF mousex >= 29 AND mousex <= 40 AND outofrange = 0 THEN
isbutton$ = ""
LOCATE mousey + 1, 29
FOR x = 29 TO 40
partfile = SCREEN(mousey + 1, x)
bldfile$ = bldfile$ + CHR$(partfile)
NEXT
LOCATE mousey + 1, 29
COLOR bg, fg
MouseOff
PRINT RTRIM$(bldfile$)
filechoice$ = RTRIM$(bldfile$)
fileflag = 1
oldy = mousey + 1
oldx = 29
ELSEIF mousex >= 43 AND mousex <= 54 AND outofrange = 0 THEN
isbutton$ = ""
LOCATE mousey + 1, 43
FOR x = 43 TO 54
partfile = SCREEN(mousey + 1, x)
bldfile$ = bldfile$ + CHR$(partfile)
NEXT
LOCATE mousey + 1, 43
COLOR bg, fg
MouseOff
PRINT RTRIM$(bldfile$)
filechoice$ = RTRIM$(bldfile$)
fileflag = 1
oldy = mousey + 1
oldx = 43
ELSEIF mousex >= 57 AND mousex <= 68 AND outofrange = 0 THEN
isbutton$ = ""
LOCATE mousey + 1, 57
FOR x = 57 TO 68
partfile = SCREEN(mousey + 1, x)
bldfile$ = bldfile$ + CHR$(partfile)
NEXT
LOCATE mousey + 1, 57
COLOR bg, fg
MouseOff
PRINT RTRIM$(bldfile$)
filechoice$ = RTRIM$(bldfile$)
fileflag = 1
oldy = mousey + 1
oldx = 57
ELSE
filechoice$ = ""
END IF
IF RIGHT$(newdir$, 1) <> "\" THEN filechoice$ = newdir$ + "\" + filechoice$
IF RIGHT$(newdir$, 1) = "\" THEN filechoice$ = newdir$ + filechoice$
IF RTRIM$(bldfile$) = "" THEN filechoice$ = ""
END IF
nomouse:
IF mouse$ <> "YES" THEN
pressed = 1
manual:
filechoice$ = ""
ON ERROR GOTO 0
LOCATE 22, 35
INPUT ; "Enter the filename: ", filechoice$
IF filechoice$ <> "" THEN
IF RIGHT$(newdir$, 1) <> "\" THEN
filechoice$ = newdir$ + "\" + UCASE$(filechoice$)
END IF
IF RIGHT$(newdir$, 1) = "\" THEN
filechoice$ = newdir$ + filechoice$
END IF
filechoice$ = UCASE$(filechoice$)
ON ERROR GOTO wrongfile
OPEN filechoice$ FOR INPUT AS #7
CLOSE #7
LOCATE 22, 35
PRINT SPACE$(44);
fileflag = 1
END IF
END IF
checkchoice:
chooseone$ = ""
ynoy = 18
ynox = 75
LOCATE 21, 55 - LEN(filechoice$)
IF filechoice$ = "" THEN
PRINT " No File, Correct? "
ELSE
PRINT " "; filechoice$; ", Correct? "
END IF
GOSUB MoveYesNoButton
IF response$ <> "N" THEN
MouseOff
FOR y = 18 TO 22
LOCATE y, 75
PRINT " "
NEXT y
LOCATE 21, 30
COLOR fg, bg
PRINT SPACE$(48);
response$ = ""
RETURN
END IF
IF response$ = "N" THEN
IF mouse$ = "YES" AND pressed = 0 THEN
MouseOff
FOR y = 18 TO 22
LOCATE y, 75
PRINT " "
NEXT
LOCATE 21, 20
COLOR fg, bg
PRINT SPACE$(58);
response$ = ""
IF oldy < 6 THEN oldy = 6
IF oldy > 23 THEN oldy = 23
LOCATE oldy, oldx
PRINT RTRIM$(bldfile$);
MoveMouse oldy, oldx
ELSE
MouseOff
FOR y = 18 TO 22
LOCATE y, 75
PRINT " "
NEXT
LOCATE 21, 20
COLOR fg, bg
PRINT SPACE$(58);
response$ = ""
END IF
GOTO ChooseFile
END IF
wrongfile:
SOUND 1000, 1
LOCATE 22, 35
PRINT SPACE$(40);
LOCATE 22, 35
PRINT "INVALID FILENAME -- Try again"
WaitaBit 2
LOCATE 22, 35
PRINT SPACE$(40);
RESUME ChooseFile
ViewFile:
IF ViewFile$ = "" THEN RETURN
LOCATE 4, 1
PRINT STRING$(80, CHR$(pchar));
viewing$ = "Viewing: " + ViewFile$
LOCATE 4, (80 - LEN(viewing$)) / 2
COLOR bg, fg
PRINT viewing$;
COLOR fg, bg
VIEW PRINT 5 TO 25
CLS
ON ERROR GOTO viewerror
IF MID$(ViewFile$, 2, 1) = ":" THEN
ViewFile$ = ViewFile$
ELSEIF LEFT$(ViewFile$, 1) = "\" THEN
ViewFile$ = ViewFile$
ELSE
ViewFile$ = newdir$ + "\" + ViewFile$
END IF
viewit = FREEFILE
OPEN ViewFile$ FOR INPUT AS #viewit
moreread:
FOR lineread = 1 TO 18
IF EOF(viewit) THEN
LOCATE 24, 26
SOUND 1000, 1
COLOR bg, fg
PRINT "END OF FILE! Press <Esc>...";
COLOR fg, bg
EXIT FOR
END IF
LINE INPUT #viewit, view$
PRINT view$
NEXT lineread
LOCATE 25, 1
COLOR 15, fg
PRINT SPACE$(80);
LOCATE 25, 1
PRINT "Viewing "; UCASE$(ViewFile$); ". Any key for more or <Esc> for menu.";
COLOR fg, bg
continue$ = INPUT$(1)
CLS
IF continue$ = CHR$(27) THEN
ON ERROR GOTO 0
CLOSE #viewit
VIEW PRINT 1 TO 25
RETURN
END IF
continue$ = ""
CALL WaitaBit(.15)
GOTO moreread
goback:
ON ERROR GOTO 0
CLOSE #viewit
VIEW PRINT 1 TO 25
RETURN
viewerror:
LOCATE 25, 1
COLOR 15, fg
SOUND 1000, 1
PRINT SPACE$(80);
LOCATE 25, 20
PRINT "Invalid file name --- Press a key";
COLOR fg, bg
RESUME goback
GetError:
'===== Non-specific error handler. You can use this one to handle
'===== user errors by coping with the problem in the line after the
'===== potential error. IF generrorflag = 1 THEN.......
generrorflag = 1
RESUME NEXT
GetEnvir:
'Get data from system environment.
'This sample gets the variable envpath$ from the enviroment.
'If no environment variable exists, the value is the nul string.
'You can add other variables if you wish.
IF ENVIRON$("IFACE") = "" THEN
envpath$ = ""
RETURN
END IF
envpath$ = ENVIRON$("IFACE")
IF NOT RIGHT$(envpath$, 1) = "\" THEN
envpath$ = envpath$ + "\"
END IF
RETURN
ColorInit:
'Gets color information from data file
fg = 7
bg = 0
ON ERROR GOTO 433
colorfile$ = envpath$ + "MCOLOR.DAT"
OPEN colorfile$ FOR INPUT AS #4
INPUT #4, fg
INPUT #4, bg
INPUT #4, pchar
CLOSE #4
COLOR fg, bg
CLS
434 ON ERROR GOTO 0: RETURN
433 RESUME 434
quit:
MouseOff
GOSUB ShareInfo
CHDIR olddir$
CLS
COLOR fg, bg
END
RETURN
noprint:
GOSUB InputBox
LOCATE 16, 12
SOUND 1000, 1
PRINT "TURN YOUR PRINTER ON OR CORRECT OTHER PRINTER PROBLEM!";
LOCATE 18, 12
PRINT "PRESS ANY KEY TO CONTINUE."
WHILE INKEY$ = "": WEND
RESUME NEXT
ColorSet:
isbutton$ = ""
CALL WaitaBit(.15)
MouseOff
10000 COLOR 7, 0: CLS
COLOR 7, 0: PRINT : PRINT
PRINT " [ 0 ] "; : COLOR 0, 7: PRINT "BLACK";
COLOR 7, 0: PRINT " Foreground Colors"
PRINT
FOR c = 1 TO 5
COLOR c, 0: PRINT " ["; c; "] █████";
NEXT
PRINT : PRINT
FOR c = 6 TO 9
COLOR c, 0: PRINT " ["; c; "] █████";
NEXT
COLOR 10, 0: PRINT " [10 ] █████"
PRINT
FOR c = 11 TO 15
COLOR c, 0: PRINT " ["; c; "] █████";
NEXT
PRINT : COLOR 7, 0
PRINT
PRINT " [ 0 ]"; : COLOR 0, 7: PRINT "BLACK";
COLOR 7, 0
PRINT " Background Colors"
PRINT
FOR c = 1 TO 7
COLOR c, 0: PRINT " ["; c; "]█████";
NEXT
PRINT : PRINT
COLOR 7, 0
'routine to pick foreground color
IF mouse$ <> "YES" THEN
GOSUB InputBox
IF scrtype$ = "MONO" THEN
LOCATE 18, 12
PRINT "MONOCHROME -- Choose 7 or 0 only."
END IF
LOCATE 16, 12
INPUT "Enter the number for the foreground color (0-15):", fg
END IF
IF mouse$ = "YES" THEN
GOSUB InputBox
LOCATE 16, 12
PRINT "Click on your choice of foreground colors"
IF scrtype$ = "MONO" THEN
LOCATE 18, 12
PRINT "MONOCHROME -- Choose 7 (white) or 0 (black) only."
END IF
DO
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
LOOP UNTIL isbutton$ = "DOWN"
raw = SCREEN(mousey + 1, mousex + 1, 1)
GOSUB figurecolor
fg = fixed
fixed = 0
MouseOff
CALL WaitaBit(.15)
END IF
IF fg = 0 THEN bg = 7
isbutton$ = "UP"
'routine to pick background color
IF mouse$ <> "YES" THEN
GOSUB InputBox
LOCATE 18, 12
PRINT "MONOCHROME -- Choose 7 or 0 only"
LOCATE 16, 12
INPUT "Enter the number for the background color (0-7):", bg
END IF
IF mouse$ = "YES" THEN
GOSUB InputBox
LOCATE 16, 12
PRINT "Click on your choice of background colors"
LOCATE 18, 12
PRINT "MONOCHROME -- Choose 7(white) or 0(black) only."
MouseOn
DO
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
LOOP UNTIL isbutton$ = "DOWN"
raw = SCREEN(mousey + 1, mousex + 1, 1)
GOSUB figurecolor
bg = fixed
fixed = 0
MouseOff
CALL WaitaBit(.15)
END IF
isbutton$ = "UP"
IF fg = bg THEN
fg = 7
bg = 0
GOTO ColorSet
END IF
GOSUB InputBox
LOCATE 16, 30
COLOR fg, bg
PRINT "NORMAL ";
COLOR bg, fg
PRINT "REVERSED";
IF mouse$ <> "YES" THEN
LOCATE 18, 24: COLOR fg, bg
INPUT "This is your choice. OK? (Y/N): ", ans$
END IF
IF mouse$ = "YES" THEN
LOCATE 18, 28
COLOR fg, bg
PRINT "This is your choice. OK?"
GOSUB YesNoButton
ans$ = LEFT$(response$, 1)
response$ = ""
MouseOff
CALL WaitaBit(.15)
END IF
IF UCASE$(ans$) = "N" THEN
fg = 7
bg = 0
GOTO ColorSet
END IF
'Routine to pick background paint character
COLOR fg, bg
CLS
'display background paint characters
LOCATE 4, 21
PRINT "BACKGROUND CHARACTERS FOR MENU SCREEN"
LOCATE 7, 1
PRINT " 0 1 2 3"
PRINT
PRINT " ░░░░░░░ ▒▒▒▒▒▒▒ ▓▓▓▓▓▓▓"
PRINT " ░░░░░░░ ▒▒▒▒▒▒▒ ▓▓▓▓▓▓▓"
PRINT " ░░░░░░░ ▒▒▒▒▒▒▒ ▓▓▓▓▓▓▓"
PRINT " ░░░░░░░ ▒▒▒▒▒▒▒ ▓▓▓▓▓▓▓"
PRINT " ░░░░░░░ ▒▒▒▒▒▒▒ ▓▓▓▓▓▓▓"
backchar:
IF mouse$ <> "YES" THEN
GOSUB InputBox
LOCATE 18, 12
PRINT "Enter 0 for no background"
LOCATE 16, 12
INPUT "Enter the number for the background character (0-3):", paintchar
IF paintchar = 0 THEN pchar = 32
IF paintchar = 1 THEN pchar = 176
IF paintchar = 2 THEN pchar = 177
IF paintchar = 3 THEN pchar = 178
END IF
IF mouse$ = "YES" THEN
GOSUB InputBox
LOCATE 16, 12
PRINT "Click on your choice of background characters"
LOCATE 18, 12
PRINT "Click under 0 for no background character"
MouseOn
DO
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
LOOP UNTIL isbutton$ = "DOWN"
pchar = SCREEN(mousey + 1, mousex + 1)
MouseOff
CALL WaitaBit(.15)
END IF
isbutton$ = "UP"
GOSUB InputBox
LOCATE 16, 24
PRINT "Save this color set to disk?"
GOSUB YesNoButton
save$ = LEFT$(response$, 1)
response$ = ""
MouseOff
CALL WaitaBit(.15)
IF save$ = "Y" THEN
colorfile$ = envpath$ + "MCOLOR.DAT"
OPEN colorfile$ FOR OUTPUT AS #1
PRINT #1, fg
PRINT #1, bg
PRINT #1, pchar
CLOSE #1
END IF
MouseOff
RETURN
figurecolor:
IF raw = 7 THEN fixed = 0
IF raw = 118 THEN fixed = 1
IF raw = 117 THEN fixed = 2
IF raw = 116 THEN fixed = 3
IF raw = 115 THEN fixed = 4
IF raw = 114 THEN fixed = 5
IF raw = 113 THEN fixed = 6
IF raw = 112 THEN fixed = 7
IF raw = 127 THEN fixed = 8
IF raw = 126 THEN fixed = 9
IF raw = 125 THEN fixed = 10
IF raw = 124 THEN fixed = 11
IF raw = 123 THEN fixed = 12
IF raw = 122 THEN fixed = 13
IF raw = 121 THEN fixed = 14
IF raw = 120 THEN fixed = 15
RETURN
GetConfig:
'Here you read in any variables you've saved. It's up to you.
ON ERROR GOTO configerr
confignum = FREEFILE
configa$ = envpath$ + "IFACE.CFG"
OPEN configa$ FOR INPUT AS #confignum
REM INPUT #confignum, variable1
REM INPUT #confignum, variable2
REM INPUT #confignum, variable3
REM INPUT #confignum, variable4
CLOSE #confignum
noerror:
CLOSE #confignum
ON ERROR GOTO 0
RETURN
configerr:
configflag = 1
RESUME noerror
ShareInfo:
MakeBox "SHAREWARE INFORMATION", 9, 2, 78, 15, 1, fg, bg, pchar
LOCATE 10, 3
PRINT " Interface PLUS Registration"
LOCATE 12, 5
PRINT "This is a shareware program. If you use it to create other programs,"
LOCATE 13, 5
PRINT "you must register your copy. Registration fees vary according to the"
LOCATE 14, 5
PRINT "way you use the program. You may use it for personal programs at no"
LOCATE 15, 5
PRINT "charge. If you use it to create a shareware program, the one-time fee"
LOCATE 16, 5
PRINT "is $60.00. If you use it to create a commercial program, the fee is"
LOCATE 17, 5
PRINT "$1000. No royalties are required in either case. You may alter the"
LOCATE 18, 5
PRINT "source code, but must not remove the copyright notice."
LOCATE 20, 33
PRINT "George Campbell"
LOCATE 21, 32
PRINT "1472 Sixth Street"
LOCATE 22, 31
PRINT "Los Osos, CA 93402"
oky = 20
okx = 60
GOSUB MoveOkButton
RETURN
GetOldDir:
COLOR bg, bg
CLS
SHELL "dir >direct~.txt"
OPEN "direct~.txt" FOR INPUT AS #1
DO
LINE INPUT #1, test$
LOOP UNTIL INSTR(test$, ":")
location = INSTR(test$, ":")
originaldir$ = MID$(test$, (location - 1))
CLOSE #1
olddir$ = originaldir$
newdir$ = olddir$
KILL "direct~.txt"
RETURN
ScreenTest:
'Checks for type of graphic card and monitor installed
vgatest:
scrtype$ = ""
ON ERROR GOTO novga
SCREEN 12
scrtype$ = "VGA"
GOTO goagain
novga:
RESUME mcgatest
mcgatest:
ON ERROR GOTO nomcga
SCREEN 13
scrtype$ = "MCGA"
GOTO goagain
nomcga:
RESUME egatest
egatest:
ON ERROR GOTO noega
SCREEN 9
scrtype$ = "EGA"
GOTO goagain
noega:
RESUME cgatest
cgatest:
ON ERROR GOTO nocga
SCREEN 2
scrtype$ = "CGA"
SCREEN 0
WIDTH 80
GOTO goagain
nocga:
scrtype$ = "MONO"
RESUME goagain
goagain:
SCREEN 0
WIDTH 80
ON ERROR GOTO 0
RETURN
ShowStuff:
MakeBox "What Interface PLUS Knows", 4, 1, 80, 20, 1, fg, bg, pchar
LOCATE 6, 3
PRINT "Video Type (scrtype$): "; scrtype$
LOCATE 7, 3
PRINT "Mouse available (mouse$): "; mouse$
LOCATE 8, 3
PRINT "Current Path (newdir$): "; newdir$
LOCATE 9, 3
PRINT "Original Path (originaldir$): "; originaldir$
LOCATE 10, 3
PRINT "Datapath (envpath$): "; envpath$
LOCATE 11, 3
PRINT "Current active drive: "; LEFT$(newdir$, 2)
LOCATE 12, 3
PRINT "File mask (mask$): "; mask$
LOCATE 13, 3
PRINT "Current foreground color: "; fg
LOCATE 14, 3
PRINT "Current background color: "; bg
LOCATE 15, 3
PRINT "File loaded (filechoice$): "; filechoice$
LOCATE 16, 3
GOSUB MemSize
PRINT "Memory size (sizeram): "; sizeram; "K"
LOCATE 17, 3
PRINT "Drives Currently Active: ";
IF drive$(1) = "Y" THEN PRINT "A: ";
IF drive$(2) = "Y" THEN PRINT "B: ";
IF drive$(3) = "Y" THEN PRINT "C: ";
IF drive$(4) = "Y" THEN PRINT "D: ";
IF drive$(5) = "Y" THEN PRINT "E: ";
IF drive$(6) = "Y" THEN PRINT "F: ";
IF drive$(7) = "Y" THEN PRINT "G: ";
IF drive$(8) = "Y" THEN PRINT "H: ";
LOCATE 18, 3
PRINT "Command line parameters(3): "; command1$, command2$, command3$
LOCATE 19, 3
PRINT "DOS version:"; version; "+"
oky = 20
okx = 74
GOSUB MoveOkButton
RETURN
MemSize:
CALL Interrupt(18, regs, regs)
sizeram = regs.ax
RETURN
'==================================================================
'The section below contains CALLed subroutines. It's best
'to keep only those routines here. QB will handle it automatically.
'==================================================================
SUB FirstFile (filespec$, filename$)
filespec$ = filespec$ + CHR$(0)
DIM inreg AS register, outreg AS register
inreg.ax = &H4E00
inreg.dx = SADD(filespec$)
inreg.ds = VARSEG(filespec$)
inreg.cx = 0
CALL Interrupt(&H21, inreg, outreg)
IF (outreg.flags AND 1) = 0 THEN
CALL MakeName(filename$)
ELSE
filename$ = ""
END IF
END SUB
SUB GetVer (version)
DIM regs AS register
regs.ax = &H3000
CALL Interrupt(&H21, regs, regs)
IF regs.ax AND &HFF = 0 THEN regs.ax = &H1
version = regs.ax AND &HFF
END SUB
SUB MakeBox (title$, uly, ulx, bwide, bhigh, linesty, fg, bg, pchar)
SELECT CASE linesty
CASE 1
ulc$ = "╔"
blc$ = "╚"
urc$ = "╗"
brc$ = "╝"
hc$ = "═"
vc$ = "║"
CASE 2
ulc$ = "┌"
blc$ = "└"
urc$ = "┐"
brc$ = "┘"
hc$ = "─"
vc$ = "│"
CASE 3
ulc$ = "╒"
blc$ = "╘"
urc$ = "╕"
brc$ = "╛"
hc$ = "═"
vc$ = "│"
CASE 4
ulc$ = CHR$(pchar)
urc$ = CHR$(pchar)
blc$ = CHR$(pchar)
brc$ = CHR$(pchar)
hc$ = CHR$(pchar)
vc$ = " "
CASE ELSE
ulc$ = " "
blc$ = " "
urc$ = " "
brc$ = " "
hc$ = " "
vc$ = " "
END SELECT
IF (uly + bhigh) > 24 THEN bhigh = 24 - uly
IF (ulx + bwide) > 81 THEN bwide = 81 - ulx
IF (ulx + bwide) < 80 THEN shadow$ = "GC21"
COLOR fg, bg
LOCATE uly, ulx
PRINT ulc$; STRING$(bwide - 2, hc$); urc$
FOR x = 1 TO bhigh - 2
LOCATE , ulx
PRINT vc$; SPACE$(bwide - 2); vc$
NEXT
LOCATE , ulx
PRINT blc$; STRING$(bwide - 2, hc$); brc$;
IF LEN(title$) > bwide - 2 THEN title$ = ""
IF NOT title$ = "" THEN
LOCATE uly, ulx + ((bwide - 2) / 2) - (LEN(title$)) / 2
COLOR bg, fg
PRINT " "; title$; " "
COLOR fg, bg
END IF
END SUB
SUB MakeName (fullname$)
SHARED memdta$
endofstr% = INSTR(31, memdta$, CHR$(0))
fullname$ = MID$(memdta$, 31, endofstr% - 31)
END SUB
SUB MouseBar.Menu (sel, sel$(), fg, bg, pchar, msg$, topline, submenu, mouse$)
DIM a(20)
s$ = ""
a = 0
'===== Clear Screen
COLOR fg, bg
FOR i = 1 TO 25
LOCATE i, 1
PRINT STRING$(80, CHR$(pchar));
NEXT
'===== Clear line 25
LOCATE 25, 1
COLOR 15, fg
PRINT SPACE$(80);
COLOR fg, bg
'====== Create Program Logo
'====== Insert your own program info here
LOCATE 15, 10
PRINT "╔";
FOR topx = 1 TO 58
PRINT "═";
NEXT topx
PRINT "╗"
LOCATE 16, 10: PRINT "║"; SPACE$(58); "║"
LOCATE 17, 10: PRINT "║"; SPACE$(58); "║"
LOCATE 18, 10: PRINT "║"; SPACE$(58); "║"
LOCATE 19, 10
PRINT "╚";
FOR bottomx = 1 TO 58
PRINT "═";
NEXT bottomx
PRINT "╝";
title$ = "Interface PLUS"
CopyRight$ = "Copyright, 1990, by George Campbell"
heading$ = "The Intelligent Front End for your Programs"
LOCATE 16, (80 - LEN(title$)) / 2
PRINT title$
LOCATE 18, (80 - LEN(heading$)) / 2
PRINT heading$
LOCATE 17, (80 - LEN(CopyRight$)) / 2
PRINT CopyRight$
'===== Get the length of each sel$,
'===== then get the 1st character of each sel$ and build a string of them
'===== this string is used to select based on letters.
'===== Finish when sel$=""
i = -1
DO
i = i + 1
a(i) = LEN(sel$(i, 0))
z$ = LTRIM$(sel$(i, 0))
s$ = s$ + UCASE$(LEFT$(z$, 1))
LOOP WHILE sel$(i, 0) <> ""
'===== Establish the right number of menu titles
sel = i - 1
'==== Print the top line message.
LOCATE 1, 1
COLOR fg, bg
t = INT((78 - LEN(msg$)) / 2)
IF t * 2 + LEN(msg$) < 78 THEN f$ = STRING$((78 - (t * 2 + LEN(msg$))), "═") ELSE f$ = ""
PRINT "╔" + STRING$(t, "═") + msg$ + f$ + STRING$(t, "═") + "╗";
'===== Print blank line on middle row
PRINT "║" + SPACE$(78) + "║";
'===== Print menu titles on middle row
LOCATE 2, 2
FOR i = 0 TO sel
PRINT sel$(i, 0);
NEXT
'===== Print bottom row of box
LOCATE 3, 1
PRINT "╚" + STRING$(78, "═") + "╝";
'===== Choose the menu entry to be displayed
subsel = 1
IF submenu <> 0 THEN subsel = submenu
subnum = 1
zold = 2
s = 0
IF topline <> 0 THEN s = topline
x = 2
'===== Display submenu
GOSUB dis.sub
'
'===== Highlight menu selection
'
lp:
oldx = x
x = 2
'===== Calculate cursor position
FOR i = 0 TO s
x = x + LEN(sel$(i, 0))
NEXT
'===== Set cursor position to start of selection string
x = x - LEN(sel$(i - 1, 0))
'===== Put OLD selection back to original color
COLOR fg, bg
LOCATE 2, oldx
PRINT sel$(olds, 0);
'===== Select NEW selection with highlite color
IF mouse$ = "YES" THEN MouseOff
COLOR 15, fg
LOCATE 2, x
PRINT RTRIM$(sel$(s, 0)) + " ";
'===== Print sel$(s,10) 'message string' on line 25
t = INT((80 - LEN(sel$(s, 10))) / 2)
IF t * 2 + LEN(sel$(s, 10)) < 78 THEN f$ = STRING$((78 - (t * 2 + LEN(sel$(s, 10)))), "═") ELSE f$ = ""
LOCATE 25, 1
COLOR 15, fg
PRINT SPACE$(t) + sel$(s, 10) + f$ + SPACE$(t);
COLOR fg, bg
'
'===== Wait for keypress or mouse click
get.key:
DO
IF UCASE$(mouse$) = "YES" THEN
CALL MouseGetInfo(mousex, mousey, isbutton$, mouse$, a$)
IF UCASE$(isbutton$) = "DOWN" THEN
GOSUB checkmouse
END IF
END IF
IF NOT UCASE$(isbutton$) = "DOWN" THEN a$ = INKEY$
LOOP UNTIL a$ <> ""
isbutton$ = ""
'
'===== Check for cursor keys
IF LEN(a$) > 1 THEN GOTO get.curkey
'===== Make the key Upper Case
a$ = UCASE$(a$)
'===== Check for escape key
IF a$ = CHR$(27) THEN sel = -1: EXIT SUB
'
'===== If key is <ENTER> then return with selection number in sel
'
ret: IF a$ <> CHR$(13) GOTO test.num
sel = (s * 10) + subnum: EXIT SUB
'===== Test for number key
test.num:
q = VAL(a$)
IF q >= 1 AND q <= cv AND q <= 9 AND q > 0 THEN
subsel = q
GOSUB update.sub
a$ = CHR$(13): GOTO ret
END IF
'====== Test for first letter key
'===== If c<>0 then add 1 to c and test for match
'===== this allows multiple selections with the same letter
'===== round-robin type
'
test.ltr:
IF c <> 0 THEN
c = c + 1
c = INSTR(c, s$, a$)
IF c <> 0 GOTO tr
END IF
c = INSTR(s$, a$)
IF c = 0 THEN GOTO get.key
tr:
olds = s
s = c - 1
subsel = 1
subnum = 1
GOSUB dis.sub
GOTO lp
'===== Identify cursor keys
get.curkey:
a = ASC(RIGHT$(a$, 1))
IF a <> 77 AND a <> 75 AND a <> 72 AND a <> 80 GOTO get.key
olds = s
IF a <> 77 AND a <> 75 GOTO get.updnkey
IF a = 77 THEN s = s + 1
IF a = 75 THEN s = s - 1
IF s > sel THEN s = 0
IF s < 0 THEN s = sel
c = s
subsel = 1
subnum = 1
GOSUB dis.sub
GOTO lp
get.updnkey:
IF a = 80 THEN subsel = subsel + 1
IF a = 72 THEN subsel = subsel - 1
GOSUB update.sub
GOTO lp
'
'===== Display the submenu box
'
dis.sub:
i = 0
a = 0
xtemp = x
COLOR fg, bg
FOR i = 1 TO cv + 2
LOCATE 3 + i, zold - 1
PRINT STRING$(aold + 6, CHR$(pchar))
NEXT
'===== Get the length of the longest string
'===== to be displayed
i = 0
DO
i = i + 1
IF LEN(sel$(s, i)) > a THEN a = LEN(sel$(s, i))
LOOP WHILE sel$(s, i) <> "" AND i < 10
cv = 0
IF i = 1 THEN RETURN
aold = a
cvold = cv
cv = i - 1
cvold = cv
'===== Calculate cursor position
x = 2
FOR i = 0 TO s
x = x + LEN(sel$(i, 0))
NEXT
'===== Set cursor on start of selection string
x = x - LEN(sel$(i - 1, 0))
'===== If starting position + longest string found > 80 then adjust start pos.
'===== If starting pos. < 2 then set it to 2.
IF x + a > 78 THEN z = 76 - a ELSE z = x - 5
IF z < 2 THEN z = 2
zold = z
LOCATE 3, 1
PRINT "╚" + STRING$(78, "═") + "╝";
LOCATE 3, x: PRINT "╗";
PRINT SPACE$(LEN(RTRIM$(sel$(s, 0))) - 1);
PRINT "╔";
LOCATE 4, z - 1: PRINT "╔" + STRING$(x - z, "═");
LOCATE 4, x: PRINT "╝";
PRINT SPACE$(LEN(RTRIM$(sel$(s, 0))) - 1);
PRINT "╚";
b = x + LEN(sel$(s, 0)) - 1
n = z + a + 4
PRINT STRING$((n) - b, "═") + "╗";
FOR i = 1 TO cv
LOCATE i + 4, z - 1: PRINT "║";
PRINT LTRIM$(STR$(i)) + ". " + sel$(s, i) + SPACE$(a - (LEN(sel$(s, i)) - 1)) + "║";
NEXT
LOCATE i + 4, z - 1: PRINT "╚" + STRING$(a + 4, "═") + "╝";
x = xtemp
'===== Display the selection in the submenu
update.sub:
IF cv = 0 THEN RETURN
IF subsel > cv THEN subsel = 1
IF subsel < 1 THEN subsel = cv
LOCATE subnum + 4, z
PRINT LTRIM$(STR$(subnum)) + ". " + sel$(s, subnum);
LOCATE subsel + 4, z
COLOR 15, fg
PRINT LTRIM$(STR$(subsel)) + ". " + sel$(s, subsel);
subnum = subsel
RETURN
'===== Identify menu item chosen by mouse click
checkmouse:
LOCATE 24, 12
IF mousey > 3 OR mousey < 11 THEN
IF SCREEN(mousey + 1, mousex + 1) <> pchar THEN
a$ = LTRIM$(STR$(mousey - 3))
END IF
END IF
IF mousey = 1 THEN
realx = mousex + 1
realy = 2
IF NOT SCREEN(realy, realx) = 32 THEN
testx = realx
DO
getchar = SCREEN(realy, testx - 1)
testx = testx - 1
LOOP WHILE getchar <> 32
menuchar = SCREEN(realy, testx + 1)
a$ = CHR$(menuchar)
END IF
END IF
RETURN
END SUB
SUB MouseDriver (m0, m1, m2, m3) STATIC
'============================================================================
' MouseDriver uses interrupt 51 to invoke mouse functions.
'============================================================================
DIM regs AS register
regs.ax = m0
regs.bx = m1
regs.cx = m2
regs.dx = m3
Interrupt 51, regs, regs
m0 = regs.ax
m1 = regs.bx
m2 = regs.cx
m3 = regs.dx
END SUB
SUB MouseGetInfo (mousex, mousey, isbutton$, mouse$, a$)
'============================================================================
' MouseGetInfo returns the mouse coordinates and button status
' as mousex, mousey, and isbutton$
'============================================================================
DIM Buffer(4000)
isbutton$ = "UP"
CALL WaitaBit(.15)
IF mouse$ = "YES" THEN MouseOn
m1 = 3 'Mouse function 3, Get Button Status and Mouse Position
MouseDriver m1, m2, m3, m4
mousex = m3 \ 8
mousey = m4 \ 8
IF (m2 AND 1) = 1 OR (m2 AND 2) = 2 OR m2 = 3 THEN isbutton$ = "DOWN" ELSE isbutton$ = "UP"
END SUB
SUB MouseInit (mouse$)
'============================================================================
' MouseInit checks, then initializes the mouse
'============================================================================
DIM Buffer(4000)
COLOR 7, 0 'FOREGROUND = white, BACKGROUND = black
m1 = 0
MouseDriver m1, m2, m3, m4
IF NOT m1 THEN
mouse$ = "NO"
ELSE
mouse$ = "YES"
END IF
END SUB
SUB MouseOff
'============================================================================
' MouseOff turns the mouse cursor off.
'============================================================================
m1 = 2
MouseDriver m1, m2, m3, m4
END SUB
SUB MouseOn
'============================================================================
'MouseOn turns the mouse cursor on.
'============================================================================
m1 = 1
MouseDriver m1, m2, m3, m4
END SUB
'===============================================
'Moves mouse cursor to specific screen location.
'===============================================
SUB MoveMouse (mmousey, mmousex)
DIM regs AS register
regs.ax = 4
regs.cx = (mmousex - 1) * 8
regs.dx = (mmousey - 1) * 8
WaitaBit .15
Interrupt 51, regs, regs
END SUB
SUB NextFile (filename$)
DIM inreg AS register, outreg AS register
inreg.ax = &H4F00
CALL Interrupt(&H21, inreg, outreg)
IF (outreg.flags AND 1) = 0 THEN
CALL MakeName(filename$):
ELSE
filename$ = ""
END IF
END SUB
SUB SetMemDta (memdta$)
DIM inreg AS register, outreg AS register
inreg.dx = SADD(memdta$)
inreg.ds = VARSEG(memdta$)
inreg.ax = &H1A00
CALL Interrupt(&H21, inreg, outreg)
END SUB
'
'===== hold! is measured in seconds. Accurate to .01 sec.
'
SUB WaitaBit (hold!)
delay! = TIMER + hold!
WHILE TIMER < delay!: WEND
END SUB
'
'=====Passes keystroke through a filter. If it's a special key
'=====the name of the key is returned. Else the keystroke returns.
'=====This routine is fast enough for any typing speed.
'
SUB WhatKey (keypress$)
IF LEN(keypress$) = 1 THEN
IF ASC(keypress$) = 13 THEN keypress$ = "ENTER"
IF ASC(keypress$) = 9 THEN keypress$ = "TAB"
IF ASC(keypress$) = 8 THEN keypress$ = "BACK"
IF ASC(keypress$) = 27 THEN keypress$ = "ESC"
END IF
IF LEN(keypress$) = 2 THEN
second$ = RIGHT$(keypress$, 1)
SELECT CASE second$
CASE "H"
keypress$ = "CRSUP"
CASE "P"
keypress$ = "CRSDOWN"
CASE "K"
keypress$ = "LEFT"
CASE "M"
keypress$ = "RIGHT"
CASE "G"
keypress$ = "HOME"
CASE "O"
keypress$ = "END"
CASE "R"
keypress$ = "INS"
CASE "S"
keypress$ = "DEL"
CASE "I"
keypress$ = "PGUP"
CASE "Q"
keypress$ = "PGDN"
CASE CHR$(15)
keypress$ = "SHFTTAB"
CASE "w"
keypress$ = "CTRLHOME"
CASE "u"
keypress$ = "CTRLEND"
CASE "s"
keypress$ = "CTRLLEFT"
CASE "t"
keypress$ = "CTRLRIGHT"
CASE "v"
keypress$ = "CTRLPGDN"
CASE CHR$(132)
keypress$ = "CTRLPGUP"
CASE ";"
keypress$ = "F1"
CASE "<"
keypress$ = "F2"
CASE "="
keypress$ = "F3"
CASE ">"
keypress$ = "F4"
CASE "?"
keypress$ = "F5"
CASE "@"
keypress$ = "F6"
CASE "A"
keypress$ = "F7"
CASE "B"
keypress$ = "F8"
CASE "C"
keypress$ = "F9"
CASE "D"
keypress$ = "F10"
CASE "à"
keypress$ = "F11"
CASE "å"
keypress$ = "F12"
CASE "h"
keypress$ = "AF1"
CASE "i"
keypress$ = "AF2"
CASE "j"
keypress$ = "AF3"
CASE "k"
keypress$ = "AF4"
CASE "l"
keypress$ = "AF5"
CASE "m"
keypress$ = "AF6"
CASE "n"
keypress$ = "AF7"
CASE "o"
keypress$ = "AF8"
CASE "p"
keypress$ = "AF9"
CASE "q"
keypress$ = "AF10"
CASE "ï"
keypress$ = "AF11"
CASE "î"
keypress$ = "AF12"
CASE "T"
keypress$ = "SF1"
CASE "U"
keypress$ = "SF2"
CASE "V"
keypress$ = "SF3"
CASE "W"
keypress$ = "SF4"
CASE "X"
keypress$ = "SF5"
CASE "Y"
keypress$ = "SF6"
CASE "Z"
keypress$ = "SF7"
CASE "["
keypress$ = "SF8"
CASE "\"
keypress$ = "SF9"
CASE "]"
keypress$ = "SF10"
CASE "ç"
keypress$ = "SF11"
CASE "ê"
keypress$ = "SF12"
CASE "^"
keypress$ = "CF1"
CASE "_"
keypress$ = "CF2"
CASE "`"
keypress$ = "CF3"
CASE "a"
keypress$ = "CF4"
CASE "b"
keypress$ = "CF5"
CASE "c"
keypress$ = "CF6"
CASE "d"
keypress$ = "CF7"
CASE "e"
keypress$ = "CF8"
CASE "f"
keypress$ = "CF9"
CASE "g"
keypress$ = "CF10"
CASE "ë"
keypress$ = "CF11"
CASE "è"
keypress$ = "CF12"
END SELECT
END IF
END SUB