home *** CD-ROM | disk | FTP | other *** search
/ Corel Draw 3 / CorelDRAW-v3.0.iso / draw2.mst < prev    next >
Text File  |  1992-10-25  |  28KB  |  769 lines

  1. '' $Keywords: draw2.mst 2.22 15Oct92 11:43am$ $nokeywords$
  2. '**
  3. '** Purpose:
  4. '**     Adds the specified option files to the copy list.
  5. '** Arguments:
  6. '**     ftype%  - type of files to add, one of the following:
  7. '**             DRAW, CHART, SHOW, PHOTO, TRACE, MOSAIC or FONTSYM
  8. '** Returns:
  9. '**     none.
  10. '*************************************************************************
  11. SUB AddOptFilesToCopyList (ftype%) STATIC
  12.  
  13.     fState% = afState(ftype%)
  14.     IF fState% <> NONE THEN
  15.         
  16.         SELECT CASE ftype%
  17.         CASE DRAW
  18.             IF fState% = ALL OR GetListItem( OPTS(DRAW), 1 ) = "ON" THEN
  19.                 AddRedistSection "DrawDLL", bInstallWinDLL%, FALSE
  20.                 AddSectionFilesToCopyList "DrawDLL", SrcDir$, DIR(DRAW)
  21.                 AddSectionFilesToCopyList "DrawDraw", SrcDir$, DIR(DRAW)
  22.                 AddSectionFilesToCopyList "DrawEhandler", SrcDir$, MakePath(DIR(DRAW),TR_EHANDLER)
  23.             ENDIF
  24.             IF fState% = ALL OR GetListItem( OPTS(DRAW), 2 ) = "ON" THEN
  25.                 AddSectionFilesToCopyList "DrawHelp", SrcDir$, DIR(DRAW)
  26.             ENDIF
  27.             IF fState% = ALL OR GetListItem( OPTS(DRAW), 3 ) = "ON" THEN
  28.                 AddSectionFilesToCopyList "DrawSamples", SrcDir$, MakePath(DIR(DRAW),TR_SAMPLES)
  29.             ENDIF
  30.             IF fState% = ALL OR GetListItem( OPTS(DRAW), 5 ) = "ON" THEN
  31.                 AddSectionFilesToCopyList "DrawTutorial", SrcDir$, DIR(DRAW)
  32.             ENDIF
  33.             '$IFNDEF INSTALLCD
  34.                 IF fState% = ALL OR GetListItem( OPTS(DRAW), 6 ) = "ON" THEN
  35.                     AddSectionFilesToCopyList "ArtAircraft", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_AIRCRAFT)
  36.                     AddSectionFilesToCopyList "ArtBird", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_BIRD)
  37.                     AddSectionFilesToCopyList "ArtCelebrat", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_CELEBRAT)
  38.                     AddSectionFilesToCopyList "ArtDental", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_DENTAL)
  39.                     AddSectionFilesToCopyList "ArtEmergenc", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_EMERGENC)
  40.                     AddSectionFilesToCopyList "ArtEquipmen", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_EQUIPMEN)
  41.                     AddSectionFilesToCopyList "ArtFlag", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_FLAG)
  42.                     AddSectionFilesToCopyList "ArtFood", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_FOOD)
  43.                     AddSectionFilesToCopyList "ArtIcon", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_ICON)
  44.                     AddSectionFilesToCopyList "ArtMammal", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MAMMAL)
  45.                     AddSectionFilesToCopyList "ArtMan", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MAN)
  46.                     AddSectionFilesToCopyList "ArtMap", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MAP)
  47.                     AddSectionFilesToCopyList "ArtMedical", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MEDICAL)
  48.                     AddSectionFilesToCopyList "ArtMisc", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MISC)
  49.                     AddSectionFilesToCopyList "ArtMoney", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_MONEY)
  50.                     AddSectionFilesToCopyList "ArtPolitica", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_POLITICA)
  51.                     AddSectionFilesToCopyList "ArtSign", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_SIGN)
  52.                     AddSectionFilesToCopyList "ArtSports", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_SPORTS)
  53.                     AddSectionFilesToCopyList "ArtTheme_bo", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_THEME_BO)
  54.                     AddSectionFilesToCopyList "ArtWoman", SrcDir$, MakePath(DIR(DRAW),TR_CLIPART+"\"+TR_WOMAN)
  55.                 ENDIF
  56.             '$ENDIF
  57.             
  58.         CASE CHART
  59.             IF fState% = ALL OR GetListItem( OPTS(CHART), 1 ) = "ON" THEN
  60.                 IF bInstallNet% THEN
  61.                     AddSectionFilesToCopyList "ChartIni", SrcDir$, DIR(CHART)
  62.                 ELSE
  63.                     AddSectionFilesToCopyList "ChartIni", SrcDir$, WINDIR$
  64.                 ENDIF
  65.                 AddSectionFilesToCopyList "ChartDLL", SrcDir$, DIR(CHART)
  66.                 AddSectionFilesToCopyList "ChartChart", SrcDir$, DIR(CHART)
  67.                 AddSectionFilesToCopyList "Chart3driser", SrcDir$, MakePath(DIR(CHART),TR_3DRISER)
  68.                 AddSectionFilesToCopyList "Chart3dscat", SrcDir$, MakePath(DIR(CHART),TR_3DSCAT)
  69.                 AddSectionFilesToCopyList "ChartArea", SrcDir$, MakePath(DIR(CHART),TR_AREA)
  70.                 AddSectionFilesToCopyList "ChartBar", SrcDir$, MakePath(DIR(CHART),TR_BAR)
  71.                 AddSectionFilesToCopyList "ChartBitmaps", SrcDir$, MakePath(DIR(CHART),TR_BITMAPS)
  72.                 AddSectionFilesToCopyList "ChartEffects", SrcDir$, MakePath(DIR(CHART),TR_EFFECTS)
  73.                 AddSectionFilesToCopyList "ChartHilo", SrcDir$, MakePath(DIR(CHART),TR_HILO)
  74.                 AddSectionFilesToCopyList "ChartHist", SrcDir$, MakePath(DIR(CHART),TR_HIST)
  75.                 AddSectionFilesToCopyList "ChartLine", SrcDir$, MakePath(DIR(CHART),TR_LINE)
  76.                 AddSectionFilesToCopyList "ChartPie", SrcDir$, MakePath(DIR(CHART),TR_PIE)
  77.                 AddSectionFilesToCopyList "ChartPicto", SrcDir$, MakePath(DIR(CHART),TR_PICTO)
  78.                 AddSectionFilesToCopyList "ChartScatter", SrcDir$, MakePath(DIR(CHART),TR_SCATTER)
  79.                 AddSectionFilesToCopyList "ChartSpectral", SrcDir$, MakePath(DIR(CHART),TR_SPECTRAL)
  80.                 AddSectionFilesToCopyList "ChartTable", SrcDir$, MakePath(DIR(CHART),TR_TABLE)
  81.                 AddSectionFilesToCopyList "ChartVectors", SrcDir$, MakePath(DIR(CHART),TR_VECTORS)
  82.             ENDIF
  83.             IF fState% = ALL OR GetListItem( OPTS(CHART), 2 ) = "ON" THEN
  84.                 AddSectionFilesToCopyList "ChartHelp", SrcDir$, DIR(CHART)
  85.             ENDIF
  86.             IF fState% = ALL OR GetListItem( OPTS(CHART), 3 ) = "ON" THEN
  87.                 AddSectionFilesToCopyList "ChartSamples", SrcDir$, MakePath(DIR(CHART),TR_SAMPLES)
  88.             ENDIF
  89.             
  90.         CASE SHOW
  91.             IF fState% = ALL OR GetListItem( OPTS(SHOW), 1 ) = "ON" THEN
  92.                 AddRedistSection "ShowDLL", bInstallWinDLL%, FALSE
  93.                 AddSectionFilesToCopyList "ShowDLL", SrcDir$, DIR(SHOW)
  94.                 AddSectionFilesToCopyList "ShowShow", SrcDir$, DIR(SHOW)
  95.             ENDIF
  96.             IF fState% = ALL OR GetListItem( OPTS(SHOW), 2 ) = "ON" THEN
  97.                 AddSectionFilesToCopyList "ShowHelp", SrcDir$, DIR(SHOW)
  98.             ENDIF
  99.             IF fState% = ALL OR GetListItem( OPTS(SHOW), 3 ) = "ON" THEN
  100.                 AddSectionFilesToCopyList "ShowSamples", SrcDir$, MakePath(DIR(SHOW),TR_SAMPLES)
  101.                 AddSectionFilesToCopyList "ShowFlics", SrcDir$, MakePath(DIR(SHOW),TR_FLICS)
  102.                 AddSectionFilesToCopyList "ShowBackgrds", SrcDir$, MakePath(DIR(SHOW),TR_BACKGRDS)
  103.             ENDIF
  104.             IF fState% = ALL OR GetListItem( OPTS(SHOW), 4 ) = "ON" THEN
  105.                 AddSectionFilesToCopyList "ShowShowrun", SrcDir$, MakePath(DIR(SHOW),TR_SHOWRUN)
  106.             ENDIF
  107.             
  108.         CASE PHOTO
  109.             IF fState% = ALL OR GetListItem( OPTS(PHOTO), 1 ) = "ON" THEN
  110.                 AddRedistSection "PhotoDLL", bInstallWinDLL%, FALSE
  111.                 AddSectionFilesToCopyList "PhotoDLL", SrcDir$, DIR(PHOTO)
  112.                 AddSectionFilesToCopyList "PhotoPhoto", SrcDir$, DIR(PHOTO)
  113.                 AddSectionFilesToCopyList "PhotoTiles", SrcDir$, MakePath(DIR(PHOTO),TR_TILES)
  114.                 AddSectionFilesToCopyList "PhotoPalettes", SrcDir$, MakePath(DIR(PHOTO),TR_PALETTES)
  115.             ENDIF
  116.             IF fState% = ALL OR GetListItem( OPTS(PHOTO), 2 ) = "ON" THEN
  117.                 AddSectionFilesToCopyList "PhotoHelp", SrcDir$, DIR(PHOTO)
  118.             ENDIF
  119.             IF fState% = ALL OR GetListItem( OPTS(PHOTO), 3 ) = "ON" THEN
  120.                 AddSectionFilesToCopyList "PhotoSamples", SrcDir$, MakePath(DIR(PHOTO),TR_SAMPLES)
  121.             ENDIF
  122.             
  123.         CASE TRACE
  124.             IF fState% = ALL OR GetListItem( OPTS(TRACE), 1 ) = "ON" THEN
  125.                 AddRedistSection "TraceDLL", bInstallWinDLL%, FALSE
  126.                 AddSectionFilesToCopyList "TraceDLL", SrcDir$, DIR(TRACE)
  127.                 AddSectionFilesToCopyList "TraceTrace", SrcDir$, DIR(TRACE)
  128.             ENDIF
  129.             IF fState% = ALL OR GetListItem( OPTS(TRACE), 2 ) = "ON" THEN
  130.                 AddSectionFilesToCopyList "TraceHelp", SrcDir$, DIR(TRACE)
  131.             ENDIF
  132.             
  133.         CASE MOSAIC
  134.             IF fState% = ALL THEN
  135.                 AddRedistSection "MosaicDLL", bInstallWinDLL%, FALSE
  136.                 AddSectionFilesToCopyList "MosaicDLL", SrcDir$, DIR(MOSAIC)
  137.                 AddSectionFilesToCopyList "MosaicMosaic", SrcDir$, DIR(MOSAIC)
  138.                 AddSectionFilesToCopyList "MosaicHelp", SrcDir$, DIR(MOSAIC)
  139.             ENDIF
  140.             
  141.         CASE AGRAPHIX
  142.             IF fState% = ALL THEN
  143.                 AddSectionFilesToCopyList "AgraphixAgraphix", SrcDir$, DIR(AGRAPHIX)
  144.                 AddSectionFilesToCopyList "AgraphixPrinters", SrcDir$, MakePath(DIR(AGRAPHIX),TR_PRINTERS)
  145.                 AddSectionFilesToCopyList "AgraphixToagx", SrcDir$, MakePath(DIR(AGRAPHIX),TR_TOAGX)
  146.             ENDIF
  147.             
  148.         CASE FONTSYM
  149.             IF fstate% = ALL THEN
  150.                 AddSectionFilesToCopyList "Fonts", SrcDir$, szFontDir$
  151.                 AddSectionFilesToCopyList "WFN", SrcDir$, DIR(FONTSYM)
  152.             ELSE
  153.                 ''Add all the fonts specified using SelectFonts
  154.                 NeedsList$ = GetSymbolValue( FONTLIST2$ )
  155.                 nIndex% = 0
  156.                 nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  157.                 WHILE nIndexInc% > 0
  158.                     AddSectionKeyFileToCopyList "Fonts", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, szFontDir$
  159.                     nIndex% = nIndex% + nIndexInc%
  160.                     nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  161.                 WEND
  162.                 ''Add all the symbols specified using SelectSymbols or default
  163.                 NeedsList$ = GetSymbolValue( SYMBOLLIST2$ )
  164.                 nIndex% = 0
  165.                 nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  166.                 WHILE nIndexInc% > 0
  167.                     AddSectionKeyFileToCopyList "WFN", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, DIR(FONTSYM)
  168.                     nIndex% = nIndex% + nIndexInc%
  169.                     nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  170.                 WEND
  171.             ENDIF
  172.             
  173.         CASE MAIN
  174.         
  175.             bAddOptFiles% = FALSE
  176.             FOR i% = DRAW TO PHOTO STEP 1
  177.                 IF afState(i%) = ALL THEN
  178.                     bAddOptFiles% = TRUE
  179.                 ELSEIF afState(i%) = SOME AND GetListItem( OPTS(i%), 1 ) = "ON" THEN
  180.                     bAddOptFiles% = TRUE
  181.                 ENDIF
  182.             NEXT i%
  183.             IF bAddOptFiles% THEN
  184.                 AddRedistSection "Win31Exe", TRUE, TRUE
  185.             ENDIF
  186.             
  187.             '' Add winhelp.exe and redistributable dlls if necessary
  188.             bAddOptFiles% = FALSE
  189.             bAddOptFiles2% = FALSE
  190.             IF afState(MOSAIC) = ALL THEN
  191.                 bAddOptFiles% = TRUE
  192.                 bAddOptFiles2% = TRUE
  193.             ELSE
  194.                 FOR i% = DRAW TO TRACE STEP 1
  195.                     IF afState(i%) = ALL THEN
  196.                         bAddOptFiles% = TRUE
  197.                         bAddOptFiles2% = TRUE
  198.                     ELSEIF afState(i%) = SOME THEN
  199.                         IF GetListItem( OPTS(i%), 1 ) = "ON" THEN
  200.                             bAddOptFiles% = TRUE
  201.                         ENDIF
  202.                         IF GetListItem( OPTS(i%), 2 ) = "ON" THEN
  203.                             bAddOptFiles2% = TRUE
  204.                         ENDIF
  205.                     ENDIF
  206.                 NEXT i%
  207.             ENDIF
  208.             IF WinMinor% = 0 THEN
  209.                 Win30% = TRUE
  210.             ELSE
  211.                 Win30% = FALSE
  212.             ENDIF
  213.             IF bAddOptFiles% THEN
  214.                 AddRedistSection "Win30DLL", Win30%, TRUE
  215.             ENDIF
  216.             IF bAddOptFiles2% THEN
  217.                 AddRedistSection "WinHelp", Win30%, TRUE
  218.             ENDIF
  219.             IF bInstallNet% AND (bAddOptFiles% OR bAddOptFiles2%) THEN
  220.                 AddSectionFilesToCopyList "NetInf", SrcDir$, MakePath(DIR(MAIN),TR_REDIST)
  221.             ENDIF
  222.             
  223.             ''Add all necessary import filters
  224.             bAddOptFiles% = FALSE
  225.             bAddedFilters% = FALSE
  226.             IF afState(DRAW) = ALL OR afState(CHART) = ALL OR afState(TRACE) = ALL THEN
  227.                 AddSectionFilesToCopyList "ImpFilters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
  228.                 AddSectionFilesToCopyList "Filters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
  229.                 bAddedFilters% = TRUE
  230.             ELSEIF afState(DRAW) = SOME AND GetListItem( OPTS(DRAW), 4 ) = "ON" THEN
  231.                 bAddOptFiles% = TRUE
  232.             ELSEIF afState(CHART) = SOME AND GetListItem( OPTS(CHART), 4 ) = "ON" THEN
  233.                 bAddOptFiles% = TRUE
  234.             ELSEIF afState(TRACE) = SOME AND GetListItem( OPTS(TRACE), 3 ) = "ON" THEN
  235.                 bAddOptFiles% = TRUE
  236.             ELSEIF afState(DRAW) = SOME AND GetListItem( OPTS(DRAW), 1 ) = "ON" THEN
  237.                 AddSectionFilesToCopyList "Filters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
  238.             ENDIF
  239.             IF bAddOptFiles% THEN
  240.                 bAddedFilters% = TRUE
  241.                 AddSectionFilesToCopyList "Filters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
  242.                 ''Add all the import filters specified using SelectFilters or default
  243.                 NeedsList$ = GetSymbolValue( IMPFILTERLIST2$ )
  244.                 nIndex% = 0
  245.                 nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  246.                 WHILE nIndexInc% > 0
  247.                     AddSectionKeyFileToCopyList "ImpFilters", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
  248.                     nIndex% = nIndex% + nIndexInc%
  249.                     nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  250.                 WEND
  251.             ENDIF
  252.  
  253.             ''Add all necessary export filters
  254.             bAddOptFiles% = FALSE
  255.             IF afState(DRAW) = ALL OR afState(CHART) = ALL THEN
  256.                 AddSectionFilesToCopyList "ExpFilters", SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
  257.             ELSEIF afState(DRAW) = SOME AND GetListItem( OPTS(DRAW), 4 ) = "ON" THEN
  258.                 bAddOptFiles% = TRUE
  259.             ELSEIF afState(CHART) = SOME AND GetListItem( OPTS(CHART), 4 ) = "ON" THEN
  260.                 bAddOptFiles% = TRUE
  261.             ENDIF
  262.             IF bAddOptFiles% THEN
  263.                 ''Add all the export filters specified using SelectFilters or default
  264.                 NeedsList$ = GetSymbolValue( EXPFILTERLIST2$ )
  265.                 nIndex% = 0
  266.                 nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  267.                 WHILE nIndexInc% > 0
  268.                     AddSectionKeyFileToCopyList "ExpFilters", MID$(NeedsList$, nIndex%+3, nIndexInc%-3), SrcDir$, MakePath(DIR(MAIN),TR_FILTERS)
  269.                     nIndex% = nIndex% + nIndexInc%
  270.                     nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  271.                 WEND
  272.             ENDIF
  273.             
  274.             IF bInstallNet% THEN
  275.                 '' Add net install files
  276.                 FOR i% = 1 TO NUMGROUPS STEP 1
  277.                     IF afState(i%) <> NONE THEN
  278.                         AddSectionFilesToCopyList "NetInf", SrcDir$, DIR(i%)
  279.                     ENDIF
  280.                 NEXT i%
  281.                 AddSectionFilesToCopyList "NetInst", SrcDir$, MakePath(DIR(MAIN),TR_SETUP)
  282.                 AddSectionFilesToCopyList "NetInf", SrcDir$, MakePath(DIR(MAIN),TR_SETUP)
  283.                 IF afState(CHART) <> NONE THEN
  284.                     AddSectionFilesToCopyList "NetInf", SrcDir$, MakePath(DIR(CHART),TR_EFFECTS)
  285.                 ENDIF
  286.             ENDIF
  287.  
  288.         END SELECT
  289.         
  290. ''        NeedsList$ = ""
  291.     ENDIF
  292.  
  293. END SUB
  294.  
  295.  
  296. '**
  297. '** Purpose:
  298. '**     Recalculates disk space for the given option files and sets
  299. '**     the status info symbol "StatusItemsText".
  300. '** Arguments:
  301. '**     ftype% - type of files to add, one of the following:
  302. '**             DRAW, CHART, SHOW, PHOTO, TRACE, MOSAIC, FONTSYM, MAIN
  303. '** Returns:
  304. '**     none.
  305. '*************************************************************************
  306. SUB RecalcOptFiles (ftype%) STATIC
  307.     ClearCopyList
  308.     AddOptFilesToCopyList ftype%
  309.     bExtra% = FALSE
  310.     ndrive% = ASC(UCASE$(WINDRIVE$)) - ASC("A") + 1
  311.     IF ftype% = MAIN THEN
  312.         ''Add extra cost to Windows drive for logfile.txt + ini/progman, etc.
  313.         ReplaceListItem EXTRACOSTS$, ndrive%, "250000"
  314.         bExtra% = TRUE
  315.     ELSEIF WinMinor% > 0 AND ftype% = FONTSYM AND afState(FONTSYM) <> NONE AND bInstallNet% = FALSE THEN
  316.         ''Add extra cost to Windows drive for .fot files
  317.         '' - calculate how much space is needed for each .fot file
  318.         minfilesize& = GetMinFileSize( ndrive% )
  319.         filesize& = minfilesize&
  320.         WHILE filesize& < 1350
  321.             filesize& = filesize& + minfilesize&
  322.         WEND
  323.         filesize& = filesize& + 100
  324.         IF afState(FONTSYM) = ALL THEN
  325.             '$IFDEF INSTALLCD
  326.                 lSpace& = filesize& * 256
  327.             '$ELSE
  328.                 lSpace& = filesize& * 154
  329.             '$ENDIF
  330.         ELSE
  331.             lSpace& = filesize& * GetListLength(FONTLIST2$)
  332.         ENDIF
  333.         '' Add to EXTRACOSTS$
  334.         lSpace& = lSpace& + VAL(GetListItem(EXTRACOSTS$,ndrive%))
  335.         ReplaceListItem EXTRACOSTS$, ndrive%, STR$(lSpace&)
  336.         bExtra% = TRUE
  337.     ENDIF
  338.     
  339.     ''Get symbol to store space requirements for drives 'A' - 'Z'
  340.     ListSym$ = aszNEEDS(ftype%)
  341.  
  342.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  343.  
  344.     '' Sum the costs for drives 'A' - 'Z' and store in STATUSTEXT$
  345.     '' - This might be faster if we only add the cost of the given drive and
  346.     ''   windows drive together.
  347.     cost& = 0
  348.     NeedsList$ = GetSymbolValue( ListSym$ )
  349.     nIndex% = 0
  350.     nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  351.     WHILE nIndexInc% > 0
  352.         cost&  = cost& + VAL( MID$(NeedsList$, nIndex%+3, nIndexInc%-3) )
  353.         nIndex% = nIndex% + nIndexInc%
  354.         nIndexInc% = WrapScanList(NeedsList$,nIndex%)
  355.     WEND
  356.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  357.  
  358.     IF bExtra% THEN
  359.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  360.     ENDIF
  361. ''    ListSym$ = ""
  362. ''    NeedsList$ = ""
  363. END SUB
  364.  
  365.  
  366. '**
  367. '** Purpose:
  368. '**     Recalculates disk space and sets option status info according
  369. '**     to the current destination path.
  370. '** Arguments:
  371. '**     none.
  372. '** Returns:
  373. '**     none.
  374. '*************************************************************************
  375. SUB RecalcPath STATIC
  376.     FOR i% = 1 TO NUMGROUPS STEP 1
  377.         RecalcOptFiles i%
  378.     NEXT i%
  379. END SUB
  380.  
  381.  
  382. '**
  383. '** Purpose:
  384. '**     Sets drive status info according to latest disk space calcs.
  385. '**     Checks that enough space is available on all drives.
  386. '** Arguments:
  387. '**     none.
  388. '** Returns:
  389. '**     none.
  390. '*************************************************************************
  391. SUB SetDriveStatus STATIC
  392.  
  393.     DIM alCosts(26) AS LONG
  394.     
  395.     ''Calculate total costs for each drive
  396.     
  397.     FOR i% = 1 TO 26 STEP 1
  398.         alCosts(i%) = 0
  399.     NEXT i%
  400.     
  401.     FOR i% = 1 to NUMGROUPS STEP 1
  402.         drive$ = MID$(DIR(i%), 1, 1)
  403.         ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  404.         alCosts(ndrive%) = alCosts(ndrive%) + VAL(GetListItem(aszNEEDS(i%), ndrive%))
  405.         IF drive$ <> WINDRIVE$ THEN
  406.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  407.             alCosts(ndrive%) = VAL(GetListItem(aszNEEDS(i%), ndrive%)) + alCosts(ndrive%)
  408.         ENDIF
  409.   NEXT i%
  410.     
  411.     ''Store the costs and free space for the first five drives used
  412.     j% = 0
  413.     bTooBig% = FALSE
  414.     FOR i% = 1 TO 26 STEP 1
  415.         if alCosts(i%) > 0 THEN
  416.             j% = j% + 1
  417.             drive$ = CHR$( i% - 1 + ASC("A") )
  418.             free& = GetFreeSpaceForDrive(drive$)
  419.             IF free& < alCosts(i%) THEN
  420.                 bTooBig% = TRUE
  421.             ENDIF
  422.             IF j% < 6 THEN
  423.                 ReplaceListItem DRIVETEXT$, j%*3-2, drive$ + ":"
  424.                 ReplaceListItem DRIVETEXT$, j%*3-1, STR$(alCosts(i%) / 1024) + " K"
  425.                 ReplaceListItem DRIVETEXT$, j%*3, STR$(free& / 1024) + " K"
  426.             ENDIF
  427.         ENDIF
  428.     NEXT i%
  429.     ''wipe clean all remaining directory information
  430.     FOR i% = j%*3+1 TO 15 STEP 1
  431.         ReplaceListItem DRIVETEXT$, i%, ""
  432.     NEXT i%
  433. ''    drive$ = ""
  434.  
  435. END SUB
  436.  
  437.  
  438. '**
  439. '** Purpose:
  440. '**     Removes the optional trailing "\"
  441. '** Arguments:
  442. '**     szDir$  - full directory path (with optional ending "\")
  443. '** Returns:
  444. '**     szDir$ without a trailing "\"
  445. '*************************************************************************
  446. FUNCTION MakeDir (szDir$) STATIC AS STRING
  447.     IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  448.         MakeDir = MID$( szDir$, 1, LEN(szDir$) - 1 )
  449.     ELSE
  450.         MakeDir = szDir$
  451.     ENDIF
  452. END FUNCTION
  453.  
  454.  
  455. '**
  456. '** Purpose:
  457. '**     Appends a file name to the end of a directory path,
  458. '**     inserting a backslash character as needed.
  459. '** Arguments:
  460. '**     szDir$  - full directory path (with optional ending "\")
  461. '**     szFile$ - filename to append to directory
  462. '** Returns:
  463. '**     Resulting fully qualified path name.
  464. '*************************************************************************
  465. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  466.     MakePath = MakeDir(szDir$) + "\" + szFile$
  467. END FUNCTION
  468.  
  469.  
  470. '** This sub converts the symbol "InstallDirs" into the DIR array
  471. '** and the symbol "InstallState" into the afState array, 
  472. '** recalculating disk usage if anything has changed.
  473. '** NOTE: this a only a simulated subroutine because we want to be
  474. '**       able to GOSUB BADPATH from inside it.
  475. '*************************************************************************
  476. SetDirFromSymbol:
  477.     '' Convert "InstallState" into the afState array
  478.     bRecalcMain% = FALSE
  479.     FOR i% = 1 TO NUMCUST STEP 1
  480.         fNewState% = ASC( GetListItem("InstallState",i%) ) - ASC("1") + 1
  481.         IF fNewState% <> afState(i%) THEN
  482.             afState(i%) = fNewState%
  483.             RecalcOptFiles i%
  484.             IF fNewState% <> 2 THEN
  485.                 bRecalcMain% = TRUE
  486.             ENDIF
  487.         ENDIF
  488.     NEXT i%
  489.     IF bRecalcMain% THEN
  490.         RecalcOptFiles MAIN
  491.     ENDIF
  492.     
  493.     '' Convert "InstallDir" into the DIR array
  494.     szList$ = GetSymbolValue("InstallDirs")
  495.     nIndex% = 0
  496.     nIndexInc% = WrapScanList(szList$,nIndex%)
  497.     i% = 1
  498.     WHILE nIndexInc% > 0
  499.         szDir$ = MakeDir(MID$(szList$, nIndex%+3, nIndexInc%-3))
  500.         '' If the directory is not writable, tell the user and don't update it.
  501.         IF IsDirWritable( szDir$ ) = 0 THEN
  502.             Dialog% = BADPATH
  503.             GOSUB INFO
  504.             GOTO CUSTINSTL1
  505.         ENDIF
  506.         '' If the directory has changed - recalculate disk usage
  507.         IF DIR(i%) <> szDir$ THEN
  508.             DIR(i%) = szDir$
  509.             IF i% = MAIN AND bInstallWinDLL% AND bInstallNet% THEN 
  510.                 WaitOnBig
  511.                 RecalcPath
  512.             ELSE
  513.                 RecalcOptFiles i%
  514.             ENDIF
  515.         ENDIF
  516.         i% = i% + 1
  517.         nIndex% = nIndex% + nIndexInc%
  518.         nIndexInc% = WrapScanList(szList$, nIndex%)
  519.     WEND
  520. ''    szDir$ = ""
  521. ''    szList$ = ""
  522. RETURN
  523.  
  524.  
  525. '** This sub contains all joint setup code for a mininstall/fullinstall
  526. '*************************************************************************
  527. SUB PrepInstall STATIC
  528.     ''Set directories to default
  529.     SetDirectories
  530.     
  531.     ''Sets options to all on
  532.     SetSymbolValue OPTS(CHART), "{""ON"",""ON"",""ON"",""ON""}"
  533.     SetSymbolValue OPTS(SHOW), "{""ON"",""ON"",""ON"",""ON""}"
  534.     SetSymbolValue OPTS(PHOTO), "{""ON"",""ON"",""ON""}"
  535.     SetSymbolValue OPTS(TRACE), "{""ON"",""ON"",""ON""}"
  536.     
  537.     ''Prepare lists for customized selection of filters, fonts and symbols
  538.     SetSymbolValue IMPFILTERLIST1$, "{}"
  539.     SetSymbolValue EXPFILTERLIST1$, "{}"
  540.     SetSymbolValue SYMBOLLIST1$, "{}"
  541.     MakeListFromSectionKeys SYMBOLLIST2$, "WFN"
  542.     
  543. END SUB
  544.  
  545. '** This sub sets all files to load - sets directory structure to default
  546. '*************************************************************************
  547. SUB FullInstall STATIC
  548.     PrepInstall
  549.     
  550.     ''Set all sections to install
  551.     FOR i% = DRAW TO NUMGROUPS STEP 1
  552.         afState(i%) = ALL
  553.     NEXT i%
  554.     '' Set FONTSYM to SOME to handle TTF under Windows 3.0
  555.     IF WinMinor% = 0 THEN
  556.         afState(FONTSYM) = SOME
  557.     ENDIF
  558.  
  559.     '$IFDEF INSTALLCD
  560.         SetSymbolValue OPTS(DRAW), "{""ON"",""ON"",""ON"",""ON"",""ON""}"
  561.     '$ELSE
  562.         SetSymbolValue OPTS(DRAW), "{""ON"",""ON"",""ON"",""ON"",""ON"",""ON""}"
  563.     '$ENDIF
  564.     
  565.     MakeListFromSectionKeys EXPFILTERLIST2$, "ExpFilters"
  566.     MakeListFromSectionKeys IMPFILTERLIST2$, "ImpFilters"
  567.     IF WinMinor% = 0 THEN
  568.         SetSymbolValue FONTLIST2$, "{}"
  569.         MakeListFromSectionKeys FONTLIST1$, "Fonts"
  570.     ELSE
  571.         SetSymbolValue FONTLIST1$, "{}"
  572.         MakeListFromSectionKeys FONTLIST2$, "Fonts"
  573.     ENDIF
  574. END SUB
  575.  
  576.  
  577. '** This sub sets only a minimal set of files to load
  578. '**   - sets directory structure to default
  579. '*************************************************************************
  580. SUB MinInstall STATIC
  581.     PrepInstall
  582.     
  583.     ''Set draw, fonts and symbols only to install
  584.     afState(DRAW) = SOME
  585.     FOR i% = CHART TO AGRAPHIX STEP 1
  586.         afState(i%) = NONE
  587.     NEXT i%
  588.     afState(FONTSYM) = SOME
  589.     afState(MAIN) = ALL
  590.     
  591.     '$IFDEF INSTALLCD
  592.         SetSymbolValue OPTS(DRAW), "{""ON"",""OFF"",""OFF"",""ON"",""OFF""}"
  593.     '$ELSE
  594.         SetSymbolValue OPTS(DRAW), "{""ON"",""OFF"",""OFF"",""ON"",""OFF"",""OFF""}"
  595.     '$ENDIF
  596.     
  597.     '' Set minimal font selection
  598.     SetSymbolValue IMPFILTERLIST2$, TR_MINIMUM_IMPORT_FILTERS
  599.     SetSymbolValue EXPFILTERLIST2$, TR_MINIMUM_EXPORT_FILTERS
  600.     SetSymbolValue FONTLIST1$, "{}"
  601.     IF WinMinor% = 0 THEN
  602.         SetSymbolValue FONTLIST2$, "{}"
  603.     ELSE
  604.         MakeListFromSectionKeys FONTLIST2$, "MinFonts"
  605.     ENDIF
  606. END SUB
  607.  
  608.  
  609. '** Set the subdirectories to their default values.
  610. '*************************************************************************
  611. SUB SetDirectories STATIC
  612.     DIR(DRAW) = MakePath( DEST$, TR_DRAW )
  613.     DIR(CHART) = MakePath( DEST$, TR_CHART )
  614.     DIR(SHOW) = MakePath( DEST$, TR_SHOW )
  615.     DIR(PHOTO) = MakePath( DEST$, TR_PHOTOPNT )
  616.     DIR(TRACE) = MakePath( DEST$, TR_DRAW )
  617.     DIR(MOSAIC) = MakePath( DEST$, TR_DRAW )
  618.     DIR(AGRAPHIX) = MakePath( DEST$, TR_AGRAPHIX )
  619.     DIR(FONTSYM) = MakePath( DEST$, TR_FONTS )
  620.     DIR(MAIN) = DEST$
  621.     SetFontRedistDir
  622. END SUB
  623.  
  624.  
  625. '** Set the custom progman groups (aszGroups()) to all be TOOLGROUP$
  626. '****************************************************************************
  627. SUB SetProgmanGroups STATIC
  628.     FOR i% = DRAW to MOSAIC STEP 1
  629.         aszGroups(i%) = TOOLGROUP$
  630.     NEXT i%
  631. END SUB
  632.  
  633.  
  634. '** Make sure that the long wait dialog is displayed and the hourglass cursor
  635. '** are being used
  636. '*************************************************************************
  637. SUB WaitOnBig STATIC
  638.     IF nWaiting% = 0 THEN
  639.         CursorSave% = ShowWaitCursor()
  640.     ENDIF
  641.     IF nWaiting% <> 2 THEN
  642.         sz$ = UIStartDlg("mscuistf.dll", WAIT, "FModelessDlgProc", 0, "")
  643.     ENDIF
  644.     nWaiting% = 2
  645. END SUB
  646.  
  647.  
  648. '** Make sure that the hourglass cursor is being used
  649. '*************************************************************************
  650. SUB WaitOn STATIC
  651.     IF nWaiting% = 0 THEN
  652.         CursorSave% = ShowWaitCursor()
  653.         nWaiting% = 1
  654.     ENDIF
  655. END SUB
  656.  
  657.  
  658. '** Remove the long wait dialog if it is being displayed and reset the cursor
  659. '** back to normal if it was set to the hourglass icon
  660. '*************************************************************************
  661. SUB WaitOff STATIC
  662.     IF nWaiting% = 2 THEN
  663.         UIPop 1
  664.     ENDIF
  665.     IF nWaiting% <> 0 THEN
  666.         RestoreCursor CursorSave%
  667.     ENDIF
  668.     nWaiting% = 0
  669. END SUB
  670.  
  671.  
  672. '** Set the directories for the fonts and redistributable files
  673. '*************************************************************************
  674. SUB SetFontRedistDir STATIC
  675.     IF bInstallNet% THEN
  676.         szFontDir$ = MakePath( DIR(FONTSYM), TR_TTF )
  677.         szWWinDir$ = WINSYSDIR$
  678.     ELSE
  679.         IF bWindowsIsNetworked% THEN
  680.             szFontDir$ = WINDIR$
  681.             szWWinDir$ = WINDIR$
  682.         ELSE
  683.             szFontDir$ = WINSYSDIR$
  684.             szWWinDir$ = WINSYSDIR$
  685.         ENDIF
  686.     ENDIF
  687. END SUB
  688.  
  689.  
  690. '** Add Redistributable files to the correct directory(s) in the copy list
  691. '*************************************************************************
  692. SUB AddRedistSection( szSection$, bInstallRedist%, bRedistFiles% ) STATIC
  693.     IF bInstallRedist% THEN
  694.         IF bWindowsIsNetworked% OR bInstallNet% = FALSE THEN
  695.             '' Copy the redistributable files and dlls to windir or winsysdir
  696.             AddSectionFilesToCopyList szSection$, SrcDir$, szWWinDir$
  697.         ENDIF
  698.     ENDIF
  699.     IF bInstallNet% AND bRedistFiles% THEN
  700.         '' Store the redistributable files in REDIST until user installs
  701.         AddSectionFilesToCopyList szSection$, SrcDir$, MakePath(DIR(MAIN),TR_REDIST)
  702.     ENDIF
  703. END SUB
  704.  
  705.  
  706. '** Wrapper function - should reduce size of code segment.
  707. '**
  708. '** FileChangeString replaces szString1$ in szFile1$ with szString2$.
  709. '** szFile2$ is a temporary file name.
  710. '*************************************************************************
  711. SUB    WrapFileChangeString( szFile1$, szFile2$, szString1$, szString2$ ) STATIC
  712.     FileChangeString szFile1$, szFile2$, szString1$, szString2$
  713. END SUB
  714.  
  715.  
  716. '** Wrapper function - should reduce size of code segment.
  717. '**
  718. '** ExecCommand calls WinExec with szCommand$
  719. '*************************************************************************
  720. SUB    WrapExecCommand( szCommand$ ) STATIC
  721.     ExecCommand szCommand$
  722. END SUB
  723.  
  724.  
  725. '** Wrapper function - should reduce size of code segment.
  726. '**
  727. '** CommentIniSection checks to see whether or not the files mentioned in
  728. '** szSection$ can be found in directory szPath$. If not, it sticks a ';'
  729. '** in front of that line of the ini file. Otherwise it makes sure there
  730. '** is not semi-colon commenting out that line.
  731. '** Note: this function is heavily dependent on the format of coreldrw.ini
  732. '*************************************************************************
  733. SUB    WrapCommentIniSection( szFileName$, szTempFile$, szSection$, szPath$ ) STATIC
  734.     CommentIniSection szFileName$, szTempFile$, szSection$, szPath$
  735. END SUB
  736.  
  737.  
  738. '** Wrapper function - should reduce size of code segment.
  739. '**
  740. '** ScanList is used to efficiently, sequentially access all of the elements
  741. '** in a symbol list. See install.c for more details.
  742. '*************************************************************************
  743. FUNCTION WrapScanList(NeedsList$,nIndex%) STATIC AS INTEGER
  744.     WrapScanList = ScanList(NeedsList$,nIndex%)
  745. END FUNCTION
  746.  
  747.  
  748. '** If the second file does not exist, backup szFile1$ as szFile2$
  749. '*************************************************************************
  750. SUB CheckBackupFile( szFile1$, szFile2$ ) STATIC
  751.     IF DoesFileExist(szFile2$,femExists) = 0 AND DoesFileExist(szFile1$,femExists) THEN
  752.         CopyFile szFile1$, szFile2$, cmoNone, 0
  753.     ENDIF
  754. END SUB
  755.  
  756. '*************************************************************************
  757. FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC AS INTEGER
  758.   szItemNew$ = szItem$
  759.   IF szOther$ <> "" THEN
  760.     szItemNew$ = szItem$ + "," + szOther$
  761.   END IF
  762.  
  763.   IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN
  764.         CreateProgmanItem = 1
  765.     ELSE
  766.         CreateProgmanItem = 0
  767.   END IF
  768. END FUNCTION
  769.