home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Corel Draw 3
/
CorelDRAW-v3.0.iso
/
draw2.mst
< prev
next >
Wrap
Text File
|
1992-10-25
|
28KB
|
769 lines
'' $Keywords: draw2.mst 2.22 15Oct92 11:43am$ $nokeywords$
'**
'** Purpose:
'** Adds the specified option files to the copy list.
'** Arguments:
'** ftype% - type of files to add, one of the following:
'** DRAW, CHART, SHOW, PHOTO, TRACE, MOSAIC or FONTSYM
'** Returns:
'** none.
'*************************************************************************
SUB AddOptFilesToCopyList (ftype%) STATIC
fState% = afState(ftype%)
IF fState% <> NONE THEN
SELECT CASE ftype%
CASE DRAW
IF fState% = ALL OR GetListItem( OPTS(DRAW), 1 ) = "ON" THEN
AddRedistSection "DrawDLL", bInstallWinDLL%, FALSE
AddSectionFilesToCopyList "DrawDLL", SrcDir$, DIR(DRAW)
AddSectionFilesToCopyList "DrawDraw", SrcDir$, DIR(DRAW)
AddSectionFilesToCopyList "DrawEhandler", SrcDir$, MakePath(DIR(DRAW),TR_EHANDLER)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(DRAW), 2 ) = "ON" THEN
AddSectionFilesToCopyList "DrawHelp", SrcDir$, DIR(DRAW)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(DRAW), 3 ) = "ON" THEN
AddSectionFilesToCopyList "DrawSamples", SrcDir$, MakePath(DIR(DRAW),TR_SAMPLES)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(DRAW), 5 ) = "ON" THEN
AddSectionFilesToCopyList "DrawTutorial", SrcDir$, DIR(DRAW)
ENDIF
'$IFNDEF INSTALLCD
IF fState% = ALL OR GetListItem( OPTS(DRAW), 6 ) = "ON" THEN
AddSectionFilesToCopyList "ArtAircraft", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_AIRCRAFT)
AddSectionFilesToCopyList "ArtBird", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_BIRD)
AddSectionFilesToCopyList "ArtCelebrat", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_CELEBRAT)
AddSectionFilesToCopyList "ArtDental", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_DENTAL)
AddSectionFilesToCopyList "ArtEmergenc", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_EMERGENC)
AddSectionFilesToCopyList "ArtEquipmen", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_EQUIPMEN)
AddSectionFilesToCopyList "ArtFlag", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_FLAG)
AddSectionFilesToCopyList "ArtFood", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_FOOD)
AddSectionFilesToCopyList "ArtIcon", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_ICON)
AddSectionFilesToCopyList "ArtMammal", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MAMMAL)
AddSectionFilesToCopyList "ArtMan", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MAN)
AddSectionFilesToCopyList "ArtMap", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MAP)
AddSectionFilesToCopyList "ArtMedical", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MEDICAL)
AddSectionFilesToCopyList "ArtMisc", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MISC)
AddSectionFilesToCopyList "ArtMoney", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MONEY)
AddSectionFilesToCopyList "ArtPolitica", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_POLITICA)
AddSectionFilesToCopyList "ArtSign", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_SIGN)
AddSectionFilesToCopyList "ArtSports", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_SPORTS)
AddSectionFilesToCopyList "ArtTheme_bo", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_THEME_BO)
AddSectionFilesToCopyList "ArtWoman", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_WOMAN)
ENDIF
'$ENDIF
CASE CHART
IF fState% = ALL OR GetListItem( OPTS(CHART), 1 ) = "ON" THEN
IF bInstallNet% THEN
AddSectionFilesToCopyList "ChartIni", SrcDir$, DIR(CHART)
ELSE
AddSectionFilesToCopyList "ChartIni", SrcDir$, WINDIR$
ENDIF
AddSectionFilesToCopyList "ChartDLL", SrcDir$, DIR(CHART)
AddSectionFilesToCopyList "ChartChart", SrcDir$, DIR(CHART)
AddSectionFilesToCopyList "Chart3driser", SrcDir$, MakePath(DIR(CHART),TR_3DRISER)
AddSectionFilesToCopyList "Chart3dscat", SrcDir$, MakePath(DIR(CHART),TR_3DSCAT)
AddSectionFilesToCopyList "ChartArea", SrcDir$, MakePath(DIR(CHART),TR_AREA)
AddSectionFilesToCopyList "ChartBar", SrcDir$, MakePath(DIR(CHART),TR_BAR)
AddSectionFilesToCopyList "ChartBitmaps", SrcDir$, MakePath(DIR(CHART),TR_BITMAPS)
AddSectionFilesToCopyList "ChartEffects", SrcDir$, MakePath(DIR(CHART),TR_EFFECTS)
AddSectionFilesToCopyList "ChartHilo", SrcDir$, MakePath(DIR(CHART),TR_HILO)
AddSectionFilesToCopyList "ChartHist", SrcDir$, MakePath(DIR(CHART),TR_HIST)
AddSectionFilesToCopyList "ChartLine", SrcDir$, MakePath(DIR(CHART),TR_LINE)
AddSectionFilesToCopyList "ChartPie", SrcDir$, MakePath(DIR(CHART),TR_PIE)
AddSectionFilesToCopyList "ChartPicto", SrcDir$, MakePath(DIR(CHART),TR_PICTO)
AddSectionFilesToCopyList "ChartScatter", SrcDir$, MakePath(DIR(CHART),TR_SCATTER)
AddSectionFilesToCopyList "ChartSpectral", SrcDir$, MakePath(DIR(CHART),TR_SPECTRAL)
AddSectionFilesToCopyList "ChartTable", SrcDir$, MakePath(DIR(CHART),TR_TABLE)
AddSectionFilesToCopyList "ChartVectors", SrcDir$, MakePath(DIR(CHART),TR_VECTORS)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(CHART), 2 ) = "ON" THEN
AddSectionFilesToCopyList "ChartHelp", SrcDir$, DIR(CHART)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(CHART), 3 ) = "ON" THEN
AddSectionFilesToCopyList "ChartSamples", SrcDir$, MakePath(DIR(CHART),TR_SAMPLES)
ENDIF
CASE SHOW
IF fState% = ALL OR GetListItem( OPTS(SHOW), 1 ) = "ON" THEN
AddRedistSection "ShowDLL", bInstallWinDLL%, FALSE
AddSectionFilesToCopyList "ShowDLL", SrcDir$, DIR(SHOW)
AddSectionFilesToCopyList "ShowShow", SrcDir$, DIR(SHOW)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(SHOW), 2 ) = "ON" THEN
AddSectionFilesToCopyList "ShowHelp", SrcDir$, DIR(SHOW)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(SHOW), 3 ) = "ON" THEN
AddSectionFilesToCopyList "ShowSamples", SrcDir$, MakePath(DIR(SHOW),TR_SAMPLES)
AddSectionFilesToCopyList "ShowFlics", SrcDir$, MakePath(DIR(SHOW),TR_FLICS)
AddSectionFilesToCopyList "ShowBackgrds", SrcDir$, MakePath(DIR(SHOW),TR_BACKGRDS)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(SHOW), 4 ) = "ON" THEN
AddSectionFilesToCopyList "ShowShowrun", SrcDir$, MakePath(DIR(SHOW),TR_SHOWRUN)
ENDIF
CASE PHOTO
IF fState% = ALL OR GetListItem( OPTS(PHOTO), 1 ) = "ON" THEN
AddRedistSection "PhotoDLL", bInstallWinDLL%, FALSE
AddSectionFilesToCopyList "PhotoDLL", SrcDir$, DIR(PHOTO)
AddSectionFilesToCopyList "PhotoPhoto", SrcDir$, DIR(PHOTO)
AddSectionFilesToCopyList "PhotoTiles", SrcDir$, MakePath(DIR(PHOTO),TR_TILES)
AddSectionFilesToCopyList "PhotoPalettes", SrcDir$, MakePath(DIR(PHOTO),TR_PALETTES)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(PHOTO), 2 ) = "ON" THEN
AddSectionFilesToCopyList "PhotoHelp", SrcDir$, DIR(PHOTO)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(PHOTO), 3 ) = "ON" THEN
AddSectionFilesToCopyList "PhotoSamples", SrcDir$, MakePath(DIR(PHOTO),TR_SAMPLES)
ENDIF
CASE TRACE
IF fState% = ALL OR GetListItem( OPTS(TRACE), 1 ) = "ON" THEN
AddRedistSection "TraceDLL", bInstallWinDLL%, FALSE
AddSectionFilesToCopyList "TraceDLL", SrcDir$, DIR(TRACE)
AddSectionFilesToCopyList "TraceTrace", SrcDir$, DIR(TRACE)
ENDIF
IF fState% = ALL OR GetListItem( OPTS(TRACE), 2 ) = "ON" THEN
AddSectionFilesToCopyList "TraceHelp", SrcDir$, DIR(TRACE)
ENDIF
CASE MOSAIC
IF fState% = ALL THEN
AddRedistSection "MosaicDLL", bInstallWinDLL%, FALSE
AddSectionFilesToCopyList "MosaicDLL", SrcDir$, DIR(MOSAIC)
AddSectionFilesToCopyList "MosaicMosaic", SrcDir$, DIR(MOSAIC)
AddSectionFilesToCopyList "MosaicHelp", SrcDir$, DIR(MOSAIC)
ENDIF
CASE AGRAPHIX
IF fState% = ALL THEN
AddSectionFilesToCopyList "AgraphixAgraphix", SrcDir$, DIR(AGRAPHIX)
AddSectionFilesToCopyList "AgraphixPrinters", SrcDir$, MakePath(DIR(AGRAPHIX),TR_PRINTERS)
AddSectionFilesToCopyList "AgraphixToagx", SrcDir$, MakePath(DIR(AGRAPHIX),TR_TOAGX)
ENDIF
CASE FONTSYM
IF fstate% = ALL THEN
AddSectionFilesToCopyList "Fonts", SrcDir$, szFontDir$
AddSectionFilesToCopyList "WFN", SrcDir$, DIR(FONTSYM)
ELSE
''Add all the fonts specified using SelectFonts
NeedsList$ = GetSymbolValue( FONTLIST2$ )
nIndex% = 0
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WHILE nIndexInc% > 0
AddSectionKeyFileToCopyList "Fonts", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, szFontDir$
nIndex% = nIndex% + nIndexInc%
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WEND
''Add all the symbols specified using SelectSymbols or default
NeedsList$ = GetSymbolValue( SYMBOLLIST2$ )
nIndex% = 0
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WHILE nIndexInc% > 0
AddSectionKeyFileToCopyList "WFN", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, DIR(FONTSYM)
nIndex% = nIndex% + nIndexInc%
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WEND
ENDIF
CASE MAIN
bAddOptFiles% = FALSE
FOR i% = DRAW TO PHOTO STEP 1
IF afState(i%) = ALL THEN
bAddOptFiles% = TRUE
ELSEIF afState(i%) = SOME AND GetListItem( OPTS(i%), 1 ) = "ON" THEN
bAddOptFiles% = TRUE
ENDIF
NEXT i%
IF bAddOptFiles% THEN
AddRedistSection "Win31Exe", TRUE, TRUE
ENDIF
'' Add winhelp.exe and redistributable dlls if necessary
bAddOptFiles% = FALSE
bAddOptFiles2% = FALSE
IF afState(MOSAIC) = ALL THEN
bAddOptFiles% = TRUE
bAddOptFiles2% = TRUE
ELSE
FOR i% = DRAW TO TRACE STEP 1
IF afState(i%) = ALL THEN
bAddOptFiles% = TRUE
bAddOptFiles2% = TRUE
ELSEIF afState(i%) = SOME THEN
IF GetListItem( OPTS(i%), 1 ) = "ON" THEN
bAddOptFiles% = TRUE
ENDIF
IF GetListItem( OPTS(i%), 2 ) = "ON" THEN
bAddOptFiles2% = TRUE
ENDIF
ENDIF
NEXT i%
ENDIF
IF WinMinor% = 0 THEN
Win30% = TRUE
ELSE
Win30% = FALSE
ENDIF
IF bAddOptFiles% THEN
AddRedistSection "Win30DLL", Win30%, TRUE
ENDIF
IF bAddOptFiles2% THEN
AddRedistSection "WinHelp", Win30%, TRUE
ENDIF
IF bInstallNet% AND (bAddOptFiles% OR bAddOptFiles2%) THEN
AddSectionFilesToCopyList "NetInf", SrcDir$, MakePath(DIR(MAIN),TR_REDIST)
ENDIF
''Add all necessary import filters
bAddOptFiles% = FALSE
bAddedFilters% = FALSE
IF afState(DRAW) = ALL OR afState(CHART) = ALL OR afState(TRACE) = ALL THEN
AddSectionFilesToCopyList "ImpFilters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
AddSectionFilesToCopyList "Filters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
bAddedFilters% = TRUE
ELSEIF afState(DRAW) = SOME AND GetListItem( OPTS(DRAW), 4 ) = "ON" THEN
bAddOptFiles% = TRUE
ELSEIF afState(CHART) = SOME AND GetListItem( OPTS(CHART), 4 ) = "ON" THEN
bAddOptFiles% = TRUE
ELSEIF afState(TRACE) = SOME AND GetListItem( OPTS(TRACE), 3 ) = "ON" THEN
bAddOptFiles% = TRUE
ELSEIF afState(DRAW) = SOME AND GetListItem( OPTS(DRAW), 1 ) = "ON" THEN
AddSectionFilesToCopyList "Filters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
ENDIF
IF bAddOptFiles% THEN
bAddedFilters% = TRUE
AddSectionFilesToCopyList "Filters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
''Add all the import filters specified using SelectFilters or default
NeedsList$ = GetSymbolValue( IMPFILTERLIST2$ )
nIndex% = 0
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WHILE nIndexInc% > 0
AddSectionKeyFileToCopyList "ImpFilters", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
nIndex% = nIndex% + nIndexInc%
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WEND
ENDIF
''Add all necessary export filters
bAddOptFiles% = FALSE
IF afState(DRAW) = ALL OR afState(CHART) = ALL THEN
AddSectionFilesToCopyList "ExpFilters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
ELSEIF afState(DRAW) = SOME AND GetListItem( OPTS(DRAW), 4 ) = "ON" THEN
bAddOptFiles% = TRUE
ELSEIF afState(CHART) = SOME AND GetListItem( OPTS(CHART), 4 ) = "ON" THEN
bAddOptFiles% = TRUE
ENDIF
IF bAddOptFiles% THEN
''Add all the export filters specified using SelectFilters or default
NeedsList$ = GetSymbolValue( EXPFILTERLIST2$ )
nIndex% = 0
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WHILE nIndexInc% > 0
AddSectionKeyFileToCopyList "ExpFilters", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
nIndex% = nIndex% + nIndexInc%
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WEND
ENDIF
IF bInstallNet% THEN
'' Add net install files
FOR i% = 1 TO NUMGROUPS STEP 1
IF afState(i%) <> NONE THEN
AddSectionFilesToCopyList "NetInf", SrcDir$, DIR(i%)
ENDIF
NEXT i%
AddSectionFilesToCopyList "NetInst", SrcDir$, MakePath(DIR(MAIN),TR_SETUP)
AddSectionFilesToCopyList "NetInf", SrcDir$, MakePath(DIR(MAIN),TR_SETUP)
IF afState(CHART) <> NONE THEN
AddSectionFilesToCopyList "NetInf", SrcDir$, MakePath(DIR(CHART),TR_EFFECTS)
ENDIF
ENDIF
END SELECT
'' NeedsList$ = ""
ENDIF
END SUB
'**
'** Purpose:
'** Recalculates disk space for the given option files and sets
'** the status info symbol "StatusItemsText".
'** Arguments:
'** ftype% - type of files to add, one of the following:
'** DRAW, CHART, SHOW, PHOTO, TRACE, MOSAIC, FONTSYM, MAIN
'** Returns:
'** none.
'*************************************************************************
SUB RecalcOptFiles (ftype%) STATIC
ClearCopyList
AddOptFilesToCopyList ftype%
bExtra% = FALSE
ndrive% = ASC(UCASE$(WINDRIVE$)) - ASC("A") + 1
IF ftype% = MAIN THEN
''Add extra cost to Windows drive for logfile.txt + ini/progman, etc.
ReplaceListItem EXTRACOSTS$, ndrive%, "250000"
bExtra% = TRUE
ELSEIF WinMinor% > 0 AND ftype% = FONTSYM AND afState(FONTSYM) <> NONE AND bInstallNet% = FALSE THEN
''Add extra cost to Windows drive for .fot files
'' - calculate how much space is needed for each .fot file
minfilesize& = GetMinFileSize( ndrive% )
filesize& = minfilesize&
WHILE filesize& < 1350
filesize& = filesize& + minfilesize&
WEND
filesize& = filesize& + 100
IF afState(FONTSYM) = ALL THEN
'$IFDEF INSTALLCD
lSpace& = filesize& * 256
'$ELSE
lSpace& = filesize& * 154
'$ENDIF
ELSE
lSpace& = filesize& * GetListLength(FONTLIST2$)
ENDIF
'' Add to EXTRACOSTS$
lSpace& = lSpace& + VAL(GetListItem(EXTRACOSTS$,ndrive%))
ReplaceListItem EXTRACOSTS$, ndrive%, STR$(lSpace&)
bExtra% = TRUE
ENDIF
''Get symbol to store space requirements for drives 'A' - 'Z'
ListSym$ = aszNEEDS(ftype%)
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
'' Sum the costs for drives 'A' - 'Z' and store in STATUSTEXT$
'' - This might be faster if we only add the cost of the given drive and
'' windows drive together.
cost& = 0
NeedsList$ = GetSymbolValue( ListSym$ )
nIndex% = 0
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WHILE nIndexInc% > 0
cost& = cost& + VAL( MID$(NeedsList$, nIndex%+3, nIndexInc%-3) )
nIndex% = nIndex% + nIndexInc%
nIndexInc% = WrapScanList(NeedsList$,nIndex%)
WEND
ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
IF bExtra% THEN
ReplaceListItem EXTRACOSTS$, ndrive%, "0"
ENDIF
'' ListSym$ = ""
'' NeedsList$ = ""
END SUB
'**
'** Purpose:
'** Recalculates disk space and sets option status info according
'** to the current destination path.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB RecalcPath STATIC
FOR i% = 1 TO NUMGROUPS STEP 1
RecalcOptFiles i%
NEXT i%
END SUB
'**
'** Purpose:
'** Sets drive status info according to latest disk space calcs.
'** Checks that enough space is available on all drives.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB SetDriveStatus STATIC
DIM alCosts(26) AS LONG
''Calculate total costs for each drive
FOR i% = 1 TO 26 STEP 1
alCosts(i%) = 0
NEXT i%
FOR i% = 1 to NUMGROUPS STEP 1
drive$ = MID$(DIR(i%), 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
alCosts(ndrive%) = alCosts(ndrive%) + VAL(GetListItem(aszNEEDS(i%), ndrive%))
IF drive$ <> WINDRIVE$ THEN
ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
alCosts(ndrive%) = VAL(GetListItem(aszNEEDS(i%), ndrive%)) + alCosts(ndrive%)
ENDIF
NEXT i%
''Store the costs and free space for the first five drives used
j% = 0
bTooBig% = FALSE
FOR i% = 1 TO 26 STEP 1
if alCosts(i%) > 0 THEN
j% = j% + 1
drive$ = CHR$( i% - 1 + ASC("A") )
free& = GetFreeSpaceForDrive(drive$)
IF free& < alCosts(i%) THEN
bTooBig% = TRUE
ENDIF
IF j% < 6 THEN
ReplaceListItem DRIVETEXT$, j%*3-2, drive$ + ":"
ReplaceListItem DRIVETEXT$, j%*3-1, STR$(alCosts(i%) / 1024) + " K"
ReplaceListItem DRIVETEXT$, j%*3, STR$(free& / 1024) + " K"
ENDIF
ENDIF
NEXT i%
''wipe clean all remaining directory information
FOR i% = j%*3+1 TO 15 STEP 1
ReplaceListItem DRIVETEXT$, i%, ""
NEXT i%
'' drive$ = ""
END SUB
'**
'** Purpose:
'** Removes the optional trailing "\"
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** Returns:
'** szDir$ without a trailing "\"
'*************************************************************************
FUNCTION MakeDir (szDir$) STATIC AS STRING
IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakeDir = MID$( szDir$, 1, LEN(szDir$) - 1 )
ELSE
MakeDir = szDir$
ENDIF
END FUNCTION
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
MakePath = MakeDir(szDir$) + "\" + szFile$
END FUNCTION
'** This sub converts the symbol "InstallDirs" into the DIR array
'** and the symbol "InstallState" into the afState array,
'** recalculating disk usage if anything has changed.
'** NOTE: this a only a simulated subroutine because we want to be
'** able to GOSUB BADPATH from inside it.
'*************************************************************************
SetDirFromSymbol:
'' Convert "InstallState" into the afState array
bRecalcMain% = FALSE
FOR i% = 1 TO NUMCUST STEP 1
fNewState% = ASC( GetListItem("InstallState",i%) ) - ASC("1") + 1
IF fNewState% <> afState(i%) THEN
afState(i%) = fNewState%
RecalcOptFiles i%
IF fNewState% <> 2 THEN
bRecalcMain% = TRUE
ENDIF
ENDIF
NEXT i%
IF bRecalcMain% THEN
RecalcOptFiles MAIN
ENDIF
'' Convert "InstallDir" into the DIR array
szList$ = GetSymbolValue("InstallDirs")
nIndex% = 0
nIndexInc% = WrapScanList(szList$,nIndex%)
i% = 1
WHILE nIndexInc% > 0
szDir$ = MakeDir(MID$(szList$, nIndex%+3, nIndexInc%-3))
'' If the directory is not writable, tell the user and don't update it.
IF IsDirWritable( szDir$ ) = 0 THEN
Dialog% = BADPATH
GOSUB INFO
GOTO CUSTINSTL1
ENDIF
'' If the directory has changed - recalculate disk usage
IF DIR(i%) <> szDir$ THEN
DIR(i%) = szDir$
IF i% = MAIN AND bInstallWinDLL% AND bInstallNet% THEN
WaitOnBig
RecalcPath
ELSE
RecalcOptFiles i%
ENDIF
ENDIF
i% = i% + 1
nIndex% = nIndex% + nIndexInc%
nIndexInc% = WrapScanList(szList$, nIndex%)
WEND
'' szDir$ = ""
'' szList$ = ""
RETURN
'** This sub contains all joint setup code for a mininstall/fullinstall
'*************************************************************************
SUB PrepInstall STATIC
''Set directories to default
SetDirectories
''Sets options to all on
SetSymbolValue OPTS(CHART), "{""ON"",""ON"",""ON"",""ON""}"
SetSymbolValue OPTS(SHOW), "{""ON"",""ON"",""ON"",""ON""}"
SetSymbolValue OPTS(PHOTO), "{""ON"",""ON"",""ON""}"
SetSymbolValue OPTS(TRACE), "{""ON"",""ON"",""ON""}"
''Prepare lists for customized selection of filters, fonts and symbols
SetSymbolValue IMPFILTERLIST1$, "{}"
SetSymbolValue EXPFILTERLIST1$, "{}"
SetSymbolValue SYMBOLLIST1$, "{}"
MakeListFromSectionKeys SYMBOLLIST2$, "WFN"
END SUB
'** This sub sets all files to load - sets directory structure to default
'*************************************************************************
SUB FullInstall STATIC
PrepInstall
''Set all sections to install
FOR i% = DRAW TO NUMGROUPS STEP 1
afState(i%) = ALL
NEXT i%
'' Set FONTSYM to SOME to handle TTF under Windows 3.0
IF WinMinor% = 0 THEN
afState(FONTSYM) = SOME
ENDIF
'$IFDEF INSTALLCD
SetSymbolValue OPTS(DRAW), "{""ON"",""ON"",""ON"",""ON"",""ON""}"
'$ELSE
SetSymbolValue OPTS(DRAW), "{""ON"",""ON"",""ON"",""ON"",""ON"",""ON""}"
'$ENDIF
MakeListFromSectionKeys EXPFILTERLIST2$, "ExpFilters"
MakeListFromSectionKeys IMPFILTERLIST2$, "ImpFilters"
IF WinMinor% = 0 THEN
SetSymbolValue FONTLIST2$, "{}"
MakeListFromSectionKeys FONTLIST1$, "Fonts"
ELSE
SetSymbolValue FONTLIST1$, "{}"
MakeListFromSectionKeys FONTLIST2$, "Fonts"
ENDIF
END SUB
'** This sub sets only a minimal set of files to load
'** - sets directory structure to default
'*************************************************************************
SUB MinInstall STATIC
PrepInstall
''Set draw, fonts and symbols only to install
afState(DRAW) = SOME
FOR i% = CHART TO AGRAPHIX STEP 1
afState(i%) = NONE
NEXT i%
afState(FONTSYM) = SOME
afState(MAIN) = ALL
'$IFDEF INSTALLCD
SetSymbolValue OPTS(DRAW), "{""ON"",""OFF"",""OFF"",""ON"",""OFF""}"
'$ELSE
SetSymbolValue OPTS(DRAW), "{""ON"",""OFF"",""OFF"",""ON"",""OFF"",""OFF""}"
'$ENDIF
'' Set minimal font selection
SetSymbolValue IMPFILTERLIST2$, TR_MINIMUM_IMPORT_FILTERS
SetSymbolValue EXPFILTERLIST2$, TR_MINIMUM_EXPORT_FILTERS
SetSymbolValue FONTLIST1$, "{}"
IF WinMinor% = 0 THEN
SetSymbolValue FONTLIST2$, "{}"
ELSE
MakeListFromSectionKeys FONTLIST2$, "MinFonts"
ENDIF
END SUB
'** Set the subdirectories to their default values.
'*************************************************************************
SUB SetDirectories STATIC
DIR(DRAW) = MakePath( DEST$, TR_DRAW )
DIR(CHART) = MakePath( DEST$, TR_CHART )
DIR(SHOW) = MakePath( DEST$, TR_SHOW )
DIR(PHOTO) = MakePath( DEST$, TR_PHOTOPNT )
DIR(TRACE) = MakePath( DEST$, TR_DRAW )
DIR(MOSAIC) = MakePath( DEST$, TR_DRAW )
DIR(AGRAPHIX) = MakePath( DEST$, TR_AGRAPHIX )
DIR(FONTSYM) = MakePath( DEST$, TR_FONTS )
DIR(MAIN) = DEST$
SetFontRedistDir
END SUB
'** Set the custom progman groups (aszGroups()) to all be TOOLGROUP$
'****************************************************************************
SUB SetProgmanGroups STATIC
FOR i% = DRAW to MOSAIC STEP 1
aszGroups(i%) = TOOLGROUP$
NEXT i%
END SUB
'** Make sure that the long wait dialog is displayed and the hourglass cursor
'** are being used
'*************************************************************************
SUB WaitOnBig STATIC
IF nWaiting% = 0 THEN
CursorSave% = ShowWaitCursor()
ENDIF
IF nWaiting% <> 2 THEN
sz$ = UIStartDlg("mscuistf.dll", WAIT, "FModelessDlgProc", 0, "")
ENDIF
nWaiting% = 2
END SUB
'** Make sure that the hourglass cursor is being used
'*************************************************************************
SUB WaitOn STATIC
IF nWaiting% = 0 THEN
CursorSave% = ShowWaitCursor()
nWaiting% = 1
ENDIF
END SUB
'** Remove the long wait dialog if it is being displayed and reset the cursor
'** back to normal if it was set to the hourglass icon
'*************************************************************************
SUB WaitOff STATIC
IF nWaiting% = 2 THEN
UIPop 1
ENDIF
IF nWaiting% <> 0 THEN
RestoreCursor CursorSave%
ENDIF
nWaiting% = 0
END SUB
'** Set the directories for the fonts and redistributable files
'*************************************************************************
SUB SetFontRedistDir STATIC
IF bInstallNet% THEN
szFontDir$ = MakePath( DIR(FONTSYM), TR_TTF )
szWWinDir$ = WINSYSDIR$
ELSE
IF bWindowsIsNetworked% THEN
szFontDir$ = WINDIR$
szWWinDir$ = WINDIR$
ELSE
szFontDir$ = WINSYSDIR$
szWWinDir$ = WINSYSDIR$
ENDIF
ENDIF
END SUB
'** Add Redistributable files to the correct directory(s) in the copy list
'*************************************************************************
SUB AddRedistSection( szSection$, bInstallRedist%, bRedistFiles% ) STATIC
IF bInstallRedist% THEN
IF bWindowsIsNetworked% OR bInstallNet% = FALSE THEN
'' Copy the redistributable files and dlls to windir or winsysdir
AddSectionFilesToCopyList szSection$, SrcDir$, szWWinDir$
ENDIF
ENDIF
IF bInstallNet% AND bRedistFiles% THEN
'' Store the redistributable files in REDIST until user installs
AddSectionFilesToCopyList szSection$, SrcDir$, MakePath(DIR(MAIN),TR_REDIST)
ENDIF
END SUB
'** Wrapper function - should reduce size of code segment.
'**
'** FileChangeString replaces szString1$ in szFile1$ with szString2$.
'** szFile2$ is a temporary file name.
'*************************************************************************
SUB WrapFileChangeString( szFile1$, szFile2$, szString1$, szString2$ ) STATIC
FileChangeString szFile1$, szFile2$, szString1$, szString2$
END SUB
'** Wrapper function - should reduce size of code segment.
'**
'** ExecCommand calls WinExec with szCommand$
'*************************************************************************
SUB WrapExecCommand( szCommand$ ) STATIC
ExecCommand szCommand$
END SUB
'** Wrapper function - should reduce size of code segment.
'**
'** CommentIniSection checks to see whether or not the files mentioned in
'** szSection$ can be found in directory szPath$. If not, it sticks a ';'
'** in front of that line of the ini file. Otherwise it makes sure there
'** is not semi-colon commenting out that line.
'** Note: this function is heavily dependent on the format of coreldrw.ini
'*************************************************************************
SUB WrapCommentIniSection( szFileName$, szTempFile$, szSection$, szPath$ ) STATIC
CommentIniSection szFileName$, szTempFile$, szSection$, szPath$
END SUB
'** Wrapper function - should reduce size of code segment.
'**
'** ScanList is used to efficiently, sequentially access all of the elements
'** in a symbol list. See install.c for more details.
'*************************************************************************
FUNCTION WrapScanList(NeedsList$,nIndex%) STATIC AS INTEGER
WrapScanList = ScanList(NeedsList$,nIndex%)
END FUNCTION
'** If the second file does not exist, backup szFile1$ as szFile2$
'*************************************************************************
SUB CheckBackupFile( szFile1$, szFile2$ ) STATIC
IF DoesFileExist(szFile2$,femExists) = 0 AND DoesFileExist(szFile1$,femExists) THEN
CopyFile szFile1$, szFile2$, cmoNone, 0
ENDIF
END SUB
'*************************************************************************
FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC AS INTEGER
szItemNew$ = szItem$
IF szOther$ <> "" THEN
szItemNew$ = szItem$ + "," + szOther$
END IF
IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN
CreateProgmanItem = 1
ELSE
CreateProgmanItem = 0
END IF
END FUNCTION