home *** CD-ROM | disk | FTP | other *** search
- '***********************************************************************
- ' FormDev: MenuFile.RLZ
- '
- ' Copyright ⌐ 1991-1992 Computer Associates International, Inc.
- ' All rights reserved.
- '
- '***********************************************************************
-
- FUNC FDParseFN (str, extension, dirPart, filePart)
- 'Sets dirPart and filePart if successful. Otherwise, does not touch them.
- 'If extension is specified, succeed only if that extension is in str.
- 'Also, if extension is specified, the extension is stripped from filePart.
- LOCAL s1, oldCS, any, J
-
- IF str = "" THEN
- RETURN 0
- END IF
- s1 = FileQ(str, _Name) ' into a local copy
- IF extension <> "" THEN
- oldCS = QSys(_CaseSensitive)
- SetSys(_CaseSensitive, 0)
- J = InStr(s1, extension)
- SetSys(_CaseSensitive, oldCS)
- ELSE
- J = 1
- END IF
- IF J THEN
- J = 0
- any = InStr(s1, "\", J + 1)
- WHILE any
- J = any
- any = InStr(s1, "\", J + 1)
- END WHILE
- IF J THEN
- dirPart = LEFT$(s1, J)
- filePart = RIGHT$(str, LEN(s1) - J)
- IF extension <> "" THEN
- filePart = LEFT$(filePart, LEN(filePart) - LEN(extension))
- END IF
- END IF
- ELSE
- J = 0
- END IF
- IF NOT J THEN
- IF extension <> "" THEN
- s1 = extension + " "
- ELSE
- s1 = ""
- END IF
- INPUT "Invalid " + s1 + "filename: """ + str + """.", "FormDev";
- RETURN 0
- END IF
- RETURN 1
- END FUNC
-
-
- PROC menuprocFile(params)
- LOCAL rm, fdFileName
-
- SELECT CASE params[_ItemNum]
- CASE 100 ' New Form.
- IF SaveIfChanged("Save current form before creating new form?") = _Cancel THEN
- EXIT PROC
- END IF
- IF FormQ(_Exists; fdMain) THEN
- lastFrameNum = 0
- FormSelect(fdMain)
- FormControl(_Close)
- END IF
- MainFormNew
- MainFormCreate
- fdChanged = 0
- fdFormSaved = 0
- FormSelect(fdMain)
- FormControl(_Show)
-
- CASE 110 ' Open Form
- IF SaveIfChanged("Save current form before opening new form?") = _Cancel THEN
- EXIT PROC
- END IF
- IF NOT FDParseFN(StdOpen(fdOpenPath + "*.rfd"), ".RFD", fdOpenPath, theform.name) THEN
- EXIT PROC
- END IF
-
- IF FormQ(_Exists; fdMain) THEN
- lastFrameNum = 0
- FormSelect(fdMain)
- FormControl(_Close)
- END IF
-
- SetHourglass
-
- ' Load in form.
- fdFileName = theform.name
- CLEAR form
- FileImport(fdOpenPath + fdFileName + ".RFD", _Realizer, _Named)
- IF NOT QVar(theform.font) THEN
- theform.font = 0
- theform.fldC = ColorPack(_White)
- theform.txtC = ColorPack(_Black)
- END IF
-
- FdFontLoadAll
- RecalcPixelsFromRaw
- MainClientLocate
- ItemsIntoPixels
-
- MainFormCreate
- FOR i = 1 TO fdNumItems
- SafeSetObject(i, 0)
- NEXT i
- FormControl(_Show)
- fdChanged = 0
- fdFormSaved = 1
-
- ResetHourglass
-
- CASE 130 ' Save Form
- rm = SaveForm(NOT fdFormSaved)
-
- CASE 140 ' Save As Form
- rm = SaveForm(1)
-
- CASE 190 ' Exit
- FDShutdown
- END SELECT
- END PROC
-