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

  1. '' $Keywords: cdrom.mst 2.15 14Nov92 02:01pm$ $nokeywords$
  2. '**************************************************************************
  3. '*                       CorelTools setup script
  4. '**************************************************************************
  5. ''    Date         Name                Reason
  6. ''-------------------------------------------------------------------------
  7. '' Feb 25 1992  Randall Mack    Modified from sample2.mst provided with
  8. ''                              Windows SDK 3.1 Beta.
  9. '' Jun  1 1992  Randall Mack    Modified from draw.mst and draw2.mst to
  10. ''                              serve as a net install
  11.  
  12. '$INCLUDE 'setupapi.inc'
  13.  
  14. ''C functions
  15. DECLARE SUB                InitializeInstall LIB "mscuistf.dll" (hInstance%, hMainWind% )
  16. DECLARE SUB                ShutDownInstall LIB "mscuistf.dll"
  17. DECLARE SUB                RegisterFont LIB "mscuistf.dll" (szFOTName$, szTTFName$) 
  18. DECLARE SUB                FileChangeString LIB "mscuistf.dll" (szFile1$, szFile2$, szString1$, szString2$)
  19. DECLARE SUB                ExecCommand LIB "mscuistf.dll" (szCommand$)
  20. DECLARE SUB                InitPrintTestFile LIB "mscuistf.dll"
  21. DECLARE SUB                ShutDownPrintTestFile LIB "mscuistf.dll"
  22. DECLARE FUNCTION    PrintTestFile LIB "mscuistf.dll" (szFilename$, bLast% ) AS INTEGER
  23. DECLARE FUNCTION    ScanList LIB "mscuistf.dll" (szSymbol$, nIndex%) AS INTEGER
  24. DECLARE FUNCTION    GetFilenameFromPath LIB "mscuistf.dll" (szPath$) AS INTEGER
  25. DECLARE FUNCTION    IsTTFEnabled LIB "mscuistf.dll" AS INTEGER
  26. DECLARE FUNCTION    GetMinFileSize LIB "mscuistf.dll" (szDrive%) AS INTEGER
  27. DECLARE FUNCTION    TestDoUpgrade LIB "mscuistf.dll" (szDir$) AS INTEGER
  28.  
  29. '$INCLUDE 'translat.inc'
  30.  
  31. ''Strings for loading string resources
  32. GLOBAL szString$
  33. CONST     STRINGLEN =    66
  34. szString$ = string$( STRINGLEN+1, 32 )
  35.  
  36. ''setup main window
  37. CONST LOGO                            = 9100            ''must match the constant in dialogs.h
  38. SetTitle TR_TITLE
  39. InitializeInstall hinstFrame(), HwndFrame()        ''corel style buttons; max window
  40. SetBitmap "mscuistf.dll", LOGO
  41.  
  42. '$INCLUDE 'msdetect.inc'
  43.  
  44. '$DEFINE DEBUG  ''Define for script development/debugging
  45.  
  46. ''Dialog ID's
  47. ''Note: These constants MUST match the constants in dialogs.h
  48. CONST WELCOME            = 9900
  49. CONST ASKQUIT            = 9901
  50. CONST DESTPATH           = 9902
  51. CONST EXITFAILURE        = 9903
  52. CONST EXITQUIT           = 9904
  53. CONST EXITSUCCESS        = 9905
  54. CONST TOOBIG             = 9908
  55. CONST BADPATH            = 9909
  56. CONST WAIT                    = 9919
  57. CONST ASKINSTALL        = 9922
  58. CONST BILLBOARD            = 9926
  59. CONST UPDATEDAUTOEXEC    = 9930
  60. CONST UPDATEAUTOEXEC    = 9931
  61. CONST WAITREGISTER    = 9932
  62. CONST BADGROUP            = 9933
  63. CONST LOCPATH                = 9934
  64. CONST WRONGDIR            = 9935
  65. CONST CDGETPATH            = 9936
  66. CONST PRINTTEST            = 9937
  67. CONST SUCCESS                = 9938
  68. CONST CDTOOBIG            = 9940
  69. CONST CDWELCOME            = 9941
  70. CONST CHECKUPGRADE    = 9945
  71. CONST CHECKUPGRADEFAIL    = 9946
  72. CONST NETADDITEMFAILED    = 9949
  73. CONST CDBASEDABOUT    = 9952
  74. CONST WELCOMEHELP        = 9800
  75. CONST GETPATHHELP   = 9802
  76. CONST ASKINSTALLHELP        = 9808
  77. CONST CDGETPATHHELP    = 9810
  78. CONST PRINTTESTHELP        = 9811
  79. CONST CHECKUPGRADEHELP    = 9812
  80.  
  81. ''Constants representing each line in the custinst dialog
  82. CONST DRAW          = 1
  83. CONST CHART         = 2
  84. CONST SHOW            = 3
  85. CONST PHOTO            = 4
  86. CONST TRACE            = 5
  87. CONST MOSAIC        = 6
  88. CONST FONTSYM        = 7
  89. CONST NUMCUST      = FONTSYM
  90. CONST MAIN            = NUMCUST + 1
  91. CONST NUMGROUPS    = MAIN
  92.  
  93. CONST FALSE    = 0
  94. CONST TRUE    = 1
  95.  
  96. GLOBAL FONTLIST2$
  97. FONTLIST2$        = "FontList2"
  98. ''used as a parm to GetCopyListCost only
  99. GLOBAL EXTRACOSTS$
  100. EXTRACOSTS$ = "ExtraCosts"
  101. GLOBAL bTooBig%
  102. bTooBig% = FALSE
  103. GLOBAL fInstallATM$            '' Should the type 1 fonts be installed?
  104. GLOBAL bInstallWinDLL%    '' Should the dlls be copied to the windows system dir?
  105.                                                 '' Note: redists are always copied under win 3.0
  106. bInstallWinDLL% = FALSE
  107. '$UNDEF UPGRADE  ''When this is set, Draw will only install as an upgrade
  108.  
  109. ''list of sections (1..NUMGROUPS)
  110. GLOBAL DIR(NUMGROUPS) AS STRING        ''list of directories for main options
  111.  
  112. GLOBAL WINDIR$        ''Windows directory.
  113. GLOBAL WINSYSDIR$    ''Windows directory.
  114. GLOBAL WINDRIVE$    ''Windows drive letter.
  115. GLOBAL DEST$        ''destination directory.
  116. GLOBAL LOCATION$     ''location of network files to install
  117.  
  118. GLOBAL TOOLGROUP$                    '' Group in which tools are to be installed
  119.  
  120. ''Windows version number
  121. GLOBAL WinMinor%
  122.  
  123. ''Variables to fake subroutines with parameters
  124. GLOBAL Dialog%
  125.  
  126. ''Globals for WaitOn and WaitOff
  127. GLOBAL nWaiting%
  128. GLOBAL CursorSave%
  129.  
  130. GLOBAL bLogging%            ''If set then the logfile has been opened
  131.  
  132. Global bPathAltered%    '' If set then autoexec.bat has been changed
  133.  
  134. ''local MSTest functions
  135. DECLARE SUB WaitOnBig
  136. DECLARE SUB WaitOn
  137. DECLARE SUB WaitOff
  138. DECLARE SUB SetDirectories
  139. DECLARE SUB RecalcAll
  140. DECLARE SUB TestWriteToLogFile (szMsg$)
  141. DECLARE    SUB    CheckBackupFile( szFile1$, szFile2$ )
  142. DECLARE FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) AS INTEGER
  143. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  144. DECLARE FUNCTION MakeDir (szDir$) AS STRING
  145.  
  146. INIT:
  147.     '' set waiting cursor
  148.     nWaiting% = 0
  149.     WaitOn
  150.     
  151.     ''Set default directory names
  152.     WINDIR$ = GetWindowsDir
  153.     WINSYSDIR$ = GetWindowsSysDir
  154.     '' If net windows then all the files we would put in system go in root
  155.     IF IsDriveNetwork( MID$(WINSYSDIR$,1,1) ) THEN
  156.         WINSYSDIR$ = WINDIR$
  157.     ENDIF
  158.     WINDRIVE$ = MID$(WINDIR$, 1, 1)
  159.     DEST$ = WINDRIVE$ + ":\"+TR_CORELDRW
  160.     LOCATION$ = GetSymbolValue("STF_SRCDIR")
  161.     SetSymbolValue EXTRACOSTS$, "{""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0"",""0""}"
  162.  
  163.     OpenLogfile MakePath(WINDIR$, TR_LOGFILE), 0
  164.     bLogging% = TRUE
  165.  
  166.     ''find and read .inf file
  167.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  168.     IF szInf$ = "" THEN
  169.         szInf$ = GetSymbolValue("STF_CWDDIR")
  170.     ENDIF
  171.     szInf$ = MakePath( szInf$, "cdrom.inf" )
  172.     ReadInfFile szInf$
  173.     szInf$ = ""
  174.  
  175.     ''Set windows version - for use with installing windows 3.1 DLL's
  176.     WinMinor% = GetWindowsMinorVersion
  177.     IF WinMinor% = 0 THEN
  178.         bInstallWinDLL% = TRUE
  179.     ENDIF
  180.     
  181.     ''set the default progman group to put everything in
  182.     TOOLGROUP$    = TR_TOOLGROUP
  183.  
  184.  
  185. '' Put up the Welcome dialog
  186. WELCOME:
  187.     WaitOff
  188.     sz$ = UIStartDlg( "mscuistf.dll", CDWELCOME, "FInfoDlgProc", WELCOMEHELP, "FHelpDlgProc" )
  189.     SELECT CASE sz$
  190.     CASE "CONTINUE"
  191.         UIPop 1
  192.     CASE "ABOUT"
  193.         Dialog% = CDBASEDABOUT
  194.         GOSUB INFO
  195.         GOTO WELCOME
  196.     CASE "REACTIVATE"
  197.         GOTO WELCOME
  198.     CASE ELSE
  199.         GOSUB ASKQUIT
  200.         GOTO WELCOME
  201.     END SELECT
  202.  
  203. '$ifdef UPGRADE
  204.     WriteToLogFile TR_UPGRADING
  205.     WriteToLogFile ""
  206.     SetSymbolValue "EditTextIn", DEST$
  207.     SetSymbolValue "EditFocus", "END"
  208. CHECKUPGRADE:
  209.     WaitOff
  210.     sz$ = UIStartDlg("mscuistf.dll", CHECKUPGRADE, "FEditDlgProc", CHECKUPGRADEHELP, "FHelpDlgProc")
  211.     SELECT CASE sz$
  212.     CASE "CONTINUE"
  213.         WaitOn
  214.         IF TestDoUpgrade( MakeDir(GetSymbolValue("EditTextOut")) ) = 0 THEN
  215.             Dialog% = CHECKUPGRADEFAIL
  216.             GOSUB INFO
  217.             GOTO CHECKUPGRADE
  218.         ENDIF
  219.     CASE "REACTIVATE"
  220.         bRecalc% = TRUE
  221.         GOTO CHECKUPGRADE
  222.     CASE ELSE
  223.         GOSUB ASKQUIT
  224.         GOTO CHECKUPGRADE
  225.     END SELECT
  226.     UIPop 1
  227. '$endif ''UPGRADE
  228.  
  229. '' fall through from WELCOME
  230.     SetDirectories        '' Set DIR(..) to the location of the files on the network
  231. '' select destination directory for files
  232. GETDEST:
  233.     EditDir$ = DEST$
  234.     Dialog% = CDGETPATH
  235.     GOSUB GETPATH
  236.     DEST$ = EditDir$
  237.     TestWriteToLogFile TR_BASEDIR + DEST$
  238.     TestWriteToLogFile ""
  239.     
  240. '' fall through from selecting destination directory
  241. INSTALL:
  242.     WaitOn
  243.     ''Make sure there is enough space for CorelDRAW!
  244.      RecalcAll
  245.     IF bTooBig% = TRUE THEN
  246.         Dialog% = CDTOOBIG
  247.         GOSUB INFO
  248.         GOTO GETDEST
  249.     ENDIF
  250.     
  251.     ''Create all directories needed
  252.     CreateDir MakeDir(DEST$), cmoNone
  253.     CreateDir MakePath(DEST$,TR_EFFECTS), cmoNone
  254.     CreateDir MakePath(DEST$,TR_AUTOBACK), cmoNone
  255.     CreateDir MakePath(DEST$,TR_TEMP), cmoNone
  256.     
  257.     '' Backup files to *.cor - do not overwrite
  258.     CheckBackupFile MakePath(WINDIR$,"win.ini"), MakePath(WINDIR$,"win.cor")
  259.     CheckBackupFile MakePath(WINDIR$,"reg.dat"), MakePath(WINDIR$,"reg.cor")
  260.     CheckBackupFile MakePath(WINDIR$,"progman.ini"), MakePath(WINDIR$,"progman.cor")
  261.     
  262.      '' Add billboards
  263.     AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
  264.     AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
  265.     AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
  266.     AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
  267.     AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
  268.     AddToBillBoardList "mscuistf.dll", BILLBOARD, "FModelessBitmapDlgProc", 10
  269.     
  270.     '' Disable size checking so I don't have to update the inf file
  271.     temp% = SetSizeCheckMode( scmOff )
  272.     ''Copy all the files over
  273.     WaitOff
  274.     CopyFilesInCopyList
  275.     WaitOn
  276.     
  277.     '' Register all the ttf fonts with Windows
  278.     IF WinMinor% > 0 THEN
  279.         IF IsTTFEnabled = 1 THEN
  280.             sz$ = UIStartDlg("mscuistf.dll", WAITREGISTER, "FModelessDlgProc", 0, "")
  281.             MakeListFromSectionKeys FONTLIST2$, "Fonts"
  282.             NeedsList$ = GetSymbolValue( FONTLIST2$ )
  283.             nIndex% = 0
  284.             nIndexInc% = ScanList(NeedsList$,nIndex%)
  285.             WHILE nIndexInc% > 0
  286.                 szFilename$ = GetSectionKeyFilename( "Fonts", MID$(NeedsList$, nIndex%+3, nIndexInc%-3) )
  287.                 index% = GetFilenameFromPath( szFilename$ )
  288.                 szFilename2$ = MID$( szFilename$, index%, LEN(szFilename$) - index% + 1 )
  289.                 szFilename$ = MID$(LOCATION$,1,2)+"\"+TR_FONTS+"\"+TR_TTF+"\"+szFilename2$
  290.                 szFOTName$ = MID$(szFilename2$,1,LEN(szFilename2$)-3) + "fot"
  291.                 RegisterFont MakePath(WINSYSDIR$,szFOTName$), szFilename$
  292.                 temp% = GetTypeFaceNameFromTTF( szFilename$, szString$, STRINGLEN )
  293.                 CreateIniKeyValue TR_WIN_INI, "fonts", szString$+" "+TR_TRUETYPE, UCASE$(szFOTName$), cmoOverWrite
  294.                 nIndex% = nIndex% + nIndexInc%
  295.                 nIndexInc% = ScanList(NeedsList$,nIndex%)
  296.             WEND
  297.             UIPop 1
  298.         ENDIF
  299.     ENDIF
  300.     szFilename$ = ""
  301.     szFilename2$ = ""
  302.     szFOTName$ = ""
  303.  
  304.     nAddItemFailed% = 0
  305.     
  306.     '' setup coreldrw.reg
  307.     FileChangeString MakePath(DEST$,TR_CORELDRW_REG), MakePath(DEST$,"___temp_"), TR_CORELDRW_EXE, MakePath(DIR(DRAW),TR_CORELDRW_EXE)
  308.     ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELDRW_REG)
  309.             
  310.     ini$ = MakePath(DEST$, TR_CORELDRW_INI)
  311.     CreateIniKeyValue TR_WIN_INI, "Extensions", "cdr", MakePath(DIR(DRAW),TR_CORELDRW_EXE+" ^.cdr"), cmoOverWrite
  312.     CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "DrawDir", MakeDir(DEST$), cmoOverWrite
  313.     CreateIniKeyValue ini$, "CDrawConfig", "Applic", MakeDir(DIR(DRAW)), cmoOverwrite
  314.     CreateIniKeyValue ini$, "CDrawConfig", "ConfigDir", MakeDir(DEST$), cmoOverwrite
  315.     CreateIniKeyValue ini$, "CDrawConfig", "FontsDir", MakeDir(DIR(FONTSYM)), cmoOverwrite
  316.     CreateIniKeyValue ini$, "CDrawConfig", "CorelFiltersDir", MakePath(DIR(MAIN),TR_FILTERS), cmoOverwrite
  317.     CreateIniKeyValue ini$, "CDrawConfig", "AutoBackupDir", MakePath(DEST$,TR_AUTOBACK), cmoOverwrite
  318.     CreateIniKeyValue ini$, "Mosaic", "Applic", MakePath(DIR(MOSAIC),TR_CORELMOS_EXE), cmoOverwrite
  319.     
  320.     CreateProgmanGroup TOOLGROUP$, "", cmoNone
  321.     ShowProgmanGroup  TOOLGROUP$, 1, cmoNone
  322.     nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_RELEASENOTES, TR_NOTEPAD_EXE + " " + MakePath(DIR(MAIN),TR_README_TXT), "", cmoOverwrite)
  323.      nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELDRAW, MakePath(DIR(DRAW),TR_CORELDRW_EXE),"", cmoOverwrite)
  324.     IF WinMinor% = 0 THEN
  325.         nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELDRAW+" "+TR_TUTORIAL, MakePath(WINSYSDIR$,TR_WINHELP)+" "+MakePath(DIR(DRAW),TR_TUTORIAL_HLP), "", cmoOverwrite)
  326.     ELSE
  327.         nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELDRAW+" "+TR_TUTORIAL, TR_WINHELP+" "+MakePath(DIR(DRAW),TR_TUTORIAL_HLP), "", cmoOverwrite)
  328.     ENDIF
  329.  
  330.     '' setup corelcht.reg
  331.     FileChangeString MakePath(DEST$,TR_CORELCHT_REG), MakePath(DEST$,"___temp_"), TR_CORELCHT_EXE, MakePath(DIR(CHART),TR_CORELCHT_EXE)
  332.     ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELCHT_REG)
  333.     
  334.     CreateIniKeyValue TR_WIN_INI, "Extensions", "cch", MakePath(DIR(CHART),TR_CORELCHT_EXE+" ^.cch"), cmoOverWrite
  335.     CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "ChartDir", MakeDir(DEST$), cmoOverWrite
  336.     ini$ = MakePath(WINDIR$, "CORELCHT.INI")
  337.     CreateIniKeyValue ini$, "CorelChart", "GATO_PATH", MakeDir(DIR(CHART)), cmoOverwrite
  338.     CreateIniKeyValue ini$, "CorelChart", "F3DF_3DRISER", MakePath(DIR(CHART),TR_3DRISER), cmoOverwrite
  339.     CreateIniKeyValue ini$, "CorelChart", "F3DF_3DSCAT", MakePath(DIR(CHART),TR_3DSCAT), cmoOverwrite
  340.     CreateIniKeyValue ini$, "CorelChart", "F3DF_AREA", MakePath(DIR(CHART),TR_AREA), cmoOverwrite
  341.     CreateIniKeyValue ini$, "CorelChart", "F3DF_BAR", MakePath(DIR(CHART),TR_BAR), cmoOverwrite
  342.     CreateIniKeyValue ini$, "CorelChart", "F3DF_HILO", MakePath(DIR(CHART),TR_HILO), cmoOverwrite
  343.     CreateIniKeyValue ini$, "CorelChart", "F3DF_HIST", MakePath(DIR(CHART),TR_HIST), cmoOverwrite
  344.     CreateIniKeyValue ini$, "CorelChart", "F3DF_LINE", MakePath(DIR(CHART),TR_LINE), cmoOverwrite
  345.     CreateIniKeyValue ini$, "CorelChart", "F3DF_PICTO", MakePath(DIR(CHART),TR_PICTO), cmoOverwrite
  346.     CreateIniKeyValue ini$, "CorelChart", "F3DF_PIE", MakePath(DIR(CHART),TR_PIE), cmoOverwrite
  347.     CreateIniKeyValue ini$, "CorelChart", "F3DF_SCATTER", MakePath(DIR(CHART),TR_SCATTER), cmoOverwrite
  348.     CreateIniKeyValue ini$, "CorelChart", "F3DF_SPECTRAL", MakePath(DIR(CHART),TR_SPECTRAL), cmoOverwrite
  349.     CreateIniKeyValue ini$, "CorelChart", "F3DF_TABLE", MakePath(DIR(CHART),TR_TABLE), cmoOverwrite
  350.     CreateIniKeyValue ini$, "CorelChart", "F3FX_EFFECTS", MakePath(DEST$,TR_EFFECTS), cmoOverwrite
  351.     CreateIniKeyValue ini$, "CorelChart", "F3FX_FILTERS", MakePath(DIR(MAIN),TR_FILTERS), cmoOverwrite
  352.     CreateIniKeyValue ini$, "CorelChart", "F3FX_TEMPDIR", MakePath(DEST$,TR_TEMP), cmoOverwrite
  353.     CreateIniKeyValue ini$, "CorelChart", "F3FX_PICTIONARY", MakePath(DIR(CHART),TR_BITMAPS), cmoOverwrite
  354.     CreateIniKeyValue ini$, "CorelChart", "Vector_path", MakePath(DIR(CHART),TR_VECTORS), cmoOverwrite
  355.   nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELCHART, MakePath(DIR(CHART),TR_CORELCHT_EXE), "", cmoOverwrite)
  356.  
  357.     '' setup corelshw.reg
  358.     FileChangeString MakePath(DEST$,TR_CORELSHW_REG), MakePath(DEST$,"___temp_"),TR_CORELSHW_EXE, MakePath(DIR(SHOW),TR_CORELSHW_EXE)
  359.     ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELSHW_REG)
  360.     
  361.     CreateIniKeyValue TR_WIN_INI, "Extensions", "shw", MakePath(DIR(SHOW),TR_CORELSHW_EXE+" ^.shw"), cmoOverWrite
  362.     CreateIniKeyValue TR_WIN_INI, "Extensions", "shb", MakePath(DIR(SHOW),TR_CORELSHW_EXE+" ^.shb"), cmoOverWrite
  363.     CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "ShowDir", MakeDir(DEST$), cmoOverWrite
  364.     CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "WaveAudio", "c,522", cmoOverWrite
  365.     CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "Sequencer", "x,523", cmoOverWrite
  366.     CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "FullScreen", "AAVGA.DLL", cmoOverWrite
  367.     CreateIniKeyValue TR_WIN_INI, "AAPLAY Animation", "DualScreen", "no", cmoOverWrite
  368.     ini$ = MakePath(DEST$, TR_CORELSHW_INI)
  369.     CreateIniKeyValue ini$, "CShowConfig", "ConfigDir", MakeDir(DIR(SHOW)), cmoOverWrite
  370.     CreateIniKeyValue ini$, "MasterBackGround", "defaultfile", MakePath(DIR(SHOW),TR_BACKGRDS+"\"+TR_SAMPLE_SHB), cmoOverwrite
  371.   nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELSHOW, MakePath(DIR(SHOW),TR_CORELSHW_EXE), "", cmoOverwrite)
  372.     nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELSHOW_RUNTIME_PLAYER, MakePath(DIR(SHOW),TR_SHOWRUN+"\"+TR_SHOWRUN_EXE), "", cmoOverwrite)
  373.  
  374.     '' Register photo with OLE
  375.     FileChangeString MakePath(DEST$,TR_CORELPNT_REG), MakePath(DEST$,"___temp_"),TR_CORELPNT_EXE, MakePath(DIR(PHOTO),TR_CORELPNT_EXE)
  376.     ExecCommand TR_REGLOAD_S + " " + MakePath(DEST$,TR_CORELPNT_REG)
  377.  
  378.     CreateIniKeyValue TR_WIN_INI, "Extensions", "pcx", MakePath(DIR(PHOTO),TR_CORELPNT_EXE+" ^.pcx"), cmoOverWrite
  379.     CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "PhotoPaintDir", MakeDir(DEST$), cmoOverWrite
  380.     ini$ = MakePath(DEST$,TR_CORELPNT_INI)
  381.     CreateIniKeyValue ini$, "CorelPaintDll", "PCX 16 Color/Gray", MakePath(DIR(PHOTO),"pcx16.dll,*.pcx"), cmoOverWrite
  382.     nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELPHOTO, MakePath(DIR(PHOTO),TR_CORELPNT_EXE), "", cmoOverwrite)
  383.     nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CCAPTURE, MakePath(DIR(PHOTO),TR_CCAPTURE_EXE), "", cmoOverwrite)
  384.     
  385.     CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "TraceDir", MakeDir(DEST$), cmoOverWrite
  386.     ini$ = MakePath(DEST$,TR_CORELTRC_INI)
  387.     CreateIniKeyValue ini$, "CorelTrace", "OutPath", MakePath(WINDIR$,""), cmoOverWrite
  388.     CreateIniKeyValue ini$, "CorelTrace", "InPath", MakePath(WINDIR$,""), cmoOverWrite
  389.     CreateIniKeyValue ini$, "CorelTrace", "ApplPath", MakeDir(DIR(TRACE)), cmoOverWrite
  390.     CreateIniKeyValue ini$, "CorelTrace", "TraceFiltersDir", MakePath(DIR(MAIN),TR_FILTERS+"\"), cmoOverWrite
  391.     nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELTRACE, MakePath(DIR(TRACE),TR_CORELTRC_EXE), "", cmoOverwrite)
  392.     
  393.     CreateIniKeyValue TR_WIN_INI, "CorelDraw3", "MosaicDir", MakeDir(DEST$), cmoOverwrite
  394.     nAddItemFailed% = nAddItemFailed% + CreateProgmanItem( TOOLGROUP$, TR_CORELMOSAIC, MakePath(DIR(MOSAIC),TR_CORELMOS_EXE), "", cmoOverwrite)
  395.     ini$ = ""
  396.     
  397.     IF nAddItemFailed% > 0 THEN
  398.         Dialog% = NETADDITEMFAILED
  399.         GOSUB INFO
  400.     ENDIF
  401.     
  402.     '' Prepend the chart directory to the users path if possible
  403.     IF WinMinor% = 0 THEN
  404.         bPathAltered% = FALSE
  405.         IF DoesFileExist("C:\"+TR_AUTOEXEC_BAT,femWrite) = 1 AND DoesFileExist("C:\"+TR_AUTOEXEC_BAK,femRead) = 0 THEN
  406.             szPath$ = GetEnvVariableValue( "path" )
  407.             IF LEN( szPath$ ) + LEN( MakeDir(DIR(CHART)) ) < 128 THEN
  408.                 RenameFile "C:\"+TR_AUTOEXEC_BAT, TR_AUTOEXEC_BAK
  409.                 PrependToPath "C:\"+TR_AUTOEXEC_BAK, "C:\"+TR_AUTOEXEC_BAT, MakeDir(DIR(CHART)), cmoNone
  410.                 bPathAltered% = TRUE
  411.             ENDIF
  412.         ENDIF
  413.         '' Display the info dialog telling the user what we did
  414.         IF bPathAltered% = TRUE THEN
  415.             Dialog% = UPDATEDAUTOEXEC
  416.             GOSUB INFO
  417.         ELSE
  418.             Dialog% = UPDATEAUTOEXEC
  419.             GOSUB INFO
  420.         ENDIF
  421.     ENDIF
  422.  
  423. '' ask the user whether or not to print the test samples
  424. PRINTTEST:
  425.     WaitOff
  426.     sz$ = UIStartDlg( "mscuistf.dll", PRINTTEST, "FButtonsDlgProc", PRINTTESTHELP, "FHelpDlgProc" )
  427.     SELECT CASE sz$
  428.     CASE "P"
  429.         UIPop(1)
  430.         ini$ = MakePath(DEST$, TR_CORELDRW_INI)
  431.         CreateIniKeyValue ini$, "CDrawConfig", "MaximizeCDraw", "1", cmoOverwrite
  432.         InitPrintTestFile
  433.         IF PrintTestFile( MakePath( DIR(DRAW), TR_SAMPLES+"\"+TR_SCREENS_CDR ), FALSE ) = TRUE THEN
  434.             bTemp% = PrintTestFile( MakePath( DIR(DRAW), TR_SAMPLES+"\"+TR_COLORBAR_CDR ), TRUE )
  435.         ENDIF
  436.         CreateIniKeyValue ini$, "CDrawConfig", "MaximizeCDraw", "0", cmoOverwrite
  437.         ShutDownPrintTestFile
  438.     CASE "D"
  439.         UIPop(1)
  440.     CASE ELSE
  441.         GOTO PRINTTEST
  442.     END SELECT
  443.  
  444. '' User has completed run of setup or has unconditionally decided to quit
  445. QUIT:
  446.     WaitOff
  447.     '' On MSTest errors report "setup file corrupted" and abort
  448.     ON ERROR GOTO ERRQUIT
  449.  
  450.     IF ERR = 0 THEN
  451.         sz$ = UIStartDlg("mscuistf.dll", SUCCESS, "FSuccessBitmapDlgProc", 0, "")
  452.         dlg% = EXITSUCCESS
  453.         szDlgProc$ = "FInfo075DlgProc"
  454.         TestWriteToLogfile TR_SETUPSUCCEEDED
  455.         TestWriteToLogfile ""
  456.     ELSEIF ERR = STFQUIT THEN
  457.         dlg% = EXITQUIT
  458.         szDlgProc$ = "FInfo0DlgProc"
  459.         TestWriteToLogfile TR_SETUPQUIT
  460.         TestWriteToLogfile ""
  461.     ELSE
  462.         dlg% = EXITFAILURE
  463.         szDlgProc$ = "FInfo0DlgProc"
  464.         TestWriteToLogfile TR_SETUPFAILED
  465.         TestWriteToLogfile ""
  466.     ENDIF
  467.     
  468.  
  469. '' Put up one of the exit message dialog boxes
  470. QUITL1:
  471.     sz$ = UIStartDlg("mscuistf.dll", dlg%, szDlgProc, 0, "")
  472.     IF sz$ = "REACTIVATE" THEN
  473.         GOTO QUITL1
  474.     ENDIF
  475.     UIPopAll
  476.     ShutDownInstall
  477.     CloseLogFile
  478.     END
  479.  
  480.  
  481. '' An error has occurred in MSTest. Tell the user and abort.
  482. ERRQUIT:
  483.     i% = DoMsgBox( TR_ERRQUIT, TR_SETUPMESSAGE, MB_OK+MB_TASKMODAL+MB_ICONHAND)
  484.     TestWriteToLogfile TR_SETUPCORRUPTED
  485.     TestWriteToLogfile ""
  486.     ShutDownInstall
  487.     CloseLogFile
  488.     END
  489.  
  490.  
  491. '' Display an information dialog
  492. '' Uses the global Dialog% to identify which dialog to display
  493. INFO:
  494.     WaitOff
  495.     sz$ = UIStartDlg( "mscuistf.dll", Dialog%, "FInfo0DlgProc", 0, "" )
  496.     SELECT CASE sz$
  497.     CASE "CONTINUE"
  498.         ''Do nothing
  499.     CASE "REACTIVATE"
  500.         bRecalc% = TRUE
  501.         GOTO INFO
  502.     CASE "EXIT"
  503.         GOSUB ASKQUIT
  504.         GOTO INFO
  505.     END SELECT
  506.     UIPop 1
  507. RETURN
  508.  
  509.  
  510. '' Get the base directory under which CorelDRAW! will be installed
  511. GETPATH:
  512.     SetSymbolValue "EditTextIn", EditDir$
  513.     SetSymbolValue "EditFocus", "END"
  514. GETPATHL1:
  515.     WaitOff
  516.     sz$ = UIStartDlg("mscuistf.dll", Dialog%, "FEditDlgProc", CDGETPATHHELP, "FHelpDlgProc")
  517.     SELECT CASE sz$
  518.     CASE "CONTINUE"
  519.         WaitOn
  520.         olddir$ = EditDir$
  521.         EditDir$ = GetSymbolValue("EditTextOut")
  522.  
  523.         ''Validate new path.
  524.         IF IsDirWritable(EditDir$) = 0 THEN
  525.             oldDialog% = Dialog%
  526.             Dialog% = BADPATH
  527.             GOSUB INFO
  528.             Dialog% = oldDialog%
  529.             GOTO GETPATHL1
  530.         ENDIF
  531.  
  532.         ''Set Recalc and change subdirectories if EditDir$ changed
  533.         IF (olddir$ <> EditDir$) AND (olddir$ <> EditDir$+"\") AND (olddir$+"\" <> EditDir$) THEN
  534.             bRecalc% = TRUE
  535.         ENDIF
  536.         olddir$ = ""
  537.         
  538.     CASE "REACTIVATE"
  539.         GOTO GETPATHL1
  540.     CASE "CANCEL", "BACK"
  541.         UIPop 1
  542.         GOTO WELCOME
  543.     CASE ELSE
  544.         GOSUB ASKQUIT
  545.         GOTO GETPATHL1
  546.     END SELECT
  547.     UIPop 1
  548. RETURN
  549.  
  550.  
  551. '' The user has asked to quit - confirm his decision
  552. ASKQUIT:
  553.     WaitOff
  554.     sz$ = UIStartDlg("mscuistf.dll", ASKQUIT, "FQuitDlgProc", 0, "")
  555.     SELECT CASE sz$
  556.     CASE "EXIT"
  557.         UIPopAll
  558.         ERROR STFQUIT
  559.     CASE "REACTIVATE"
  560.         GOTO ASKQUIT
  561.     CASE ELSE
  562.         ''Do nothing
  563.     END SELECT
  564.     UIPop 1
  565. RETURN
  566.  
  567.  
  568. '**
  569. '** Purpose:
  570. '**     Recalculates disk space required to install all net files. Also
  571. '**     sets the copy list to contain all files.
  572. '** Arguments:
  573. '**     none
  574. '** Returns:
  575. '**     none
  576. '*************************************************************************
  577. SUB RecalcAll STATIC
  578.     ClearCopyList
  579.     AddSectionFilesToCopyList "Main", LOCATION$, MakeDir(DEST$)
  580.     AddSectionFilesToCopyList "Effects", LOCATION$, MakePath(DEST$,TR_EFFECTS)
  581.     AddSectionFilesToCopyList "WinDir", LOCATION$, WINDIR$
  582.     AddSectionFilesToCopyList "WinSysDir", LOCATION$, WINSYSDIR$
  583.     IF WinMinor% = 0 THEN
  584.         AddSectionFilesToCopyList "Win30SysDir", LOCATION$, WINSYSDIR$
  585.     ENDIF
  586.     ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  587.     IF WinMinor% > 0 THEN
  588.         '' Add extra cost to Windows drive for .fot files + logfile.txt, etc.
  589.         ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  590.         '' calculate how much space is needed for each .fot file
  591.         minfilesize% = GetMinFileSize( ndrive% )
  592.         filesize% = minfilesize%
  593.         WHILE filesize% < 1350
  594.             filesize% = filesize% + minfilesize%
  595.         WEND
  596.         filesize% = filesize% + 100
  597.         lSpace& = filesize% * 256 + 250000
  598.         ReplaceListItem EXTRACOSTS$, ndrive%, STR$(lSpace&)
  599.     ELSE
  600.     ''Add extra cost to Windows drive for logfile.txt + ini/progman, etc.
  601.         ReplaceListItem EXTRACOSTS$, ndrive%, "250000"
  602.     ENDIF
  603.     
  604.     StillNeed& = GetCopyListCost(EXTRACOSTS$, "temp", "")
  605.     ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  606.     RemoveSymbol( "temp" )
  607.     IF StillNeed& > 0 THEN
  608.         bTooBig% = TRUE
  609.     ELSE
  610.         bTooBig% = FALSE
  611.     ENDIF
  612. END SUB
  613.  
  614.  
  615. '**
  616. '** Purpose:
  617. '**     Removes the optional trailing "\"
  618. '** Arguments:
  619. '**     szDir$  - full directory path (with optional ending "\")
  620. '** Returns:
  621. '**     szDir$ without a trailing "\"
  622. '*************************************************************************
  623. FUNCTION MakeDir (szDir$) STATIC AS STRING
  624.     IF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  625.         MakeDir = MID$( szDir$, 1, LEN(szDir$) - 1 )
  626.     ELSE
  627.         MakeDir = szDir$
  628.     ENDIF
  629. END FUNCTION
  630.  
  631.  
  632. '**
  633. '** Purpose:
  634. '**     Appends a file name to the end of a directory path,
  635. '**     inserting a backslash character as needed.
  636. '** Arguments:
  637. '**     szDir$  - full directory path (with optional ending "\")
  638. '**     szFile$ - filename to append to directory
  639. '** Returns:
  640. '**     Resulting fully qualified path name.
  641. '*************************************************************************
  642. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  643.     IF szDir$ = "" THEN
  644.         MakePath = szFile$
  645.     ELSEIF szFile$ = "" THEN
  646.         MakePath = szDir$
  647.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  648.         MakePath = szDir$ + szFile$
  649.     ELSE
  650.         MakePath = szDir$ + "\" + szFile$
  651.     ENDIF
  652. END FUNCTION
  653.  
  654.  
  655. ''** If the logfile is open, write szMsg$ to it.
  656. '*************************************************************************
  657. SUB TestWriteToLogfile (szMsg$) STATIC
  658.     IF bLogging% THEN
  659.         WriteToLogfile szMsg$
  660.     ENDIF
  661. END SUB
  662.  
  663.  
  664. '** Set the subdirectories to their default values.
  665. '*************************************************************************
  666. SUB SetDirectories STATIC
  667.     DIR(DRAW) = MakePath( MID$(LOCATION$,1,2), TR_DRAW+"\" )
  668.     DIR(CHART) = MakePath( MID$(LOCATION$,1,2), TR_CHART+"\" )
  669.     DIR(SHOW) = MakePath( MID$(LOCATION$,1,2), TR_SHOW+"\" )
  670.     DIR(PHOTO) = MakePath( MID$(LOCATION$,1,2), TR_PHOTOPNT+"\" )
  671.     DIR(TRACE) = MakePath( MID$(LOCATION$,1,2), TR_TRACE+"\" )
  672.     DIR(MOSAIC) = MakePath( MID$(LOCATION$,1,2), TR_MOSAIC+"\" )
  673.     DIR(FONTSYM) = MakePath( MID$(LOCATION$,1,2), TR_FONTS+"\"+"wfn"+"\" )
  674.     DIR(MAIN) = MakeDir( MID$(LOCATION$,1,2) )
  675. END SUB
  676.  
  677.  
  678. '** Make sure that the long wait dialog is displayed and the hourglass cursor
  679. '** are being used
  680. '*************************************************************************
  681. SUB WaitOnBig STATIC
  682.     IF nWaiting% = 0 THEN
  683.         CursorSave% = ShowWaitCursor()
  684.         sz$ = UIStartDlg("mscuistf.dll", WAIT, "FModelessDlgProc", 0, "")
  685.         nWaiting% = 2
  686.     ELSEIF nWaiting% = 1 THEN
  687.         sz$ = UIStartDlg("mscuistf.dll", WAIT, "FModelessDlgProc", 0, "")
  688.         nWaiting% = 2
  689.     ENDIF
  690. END SUB
  691.  
  692.  
  693. '** Make sure that the hourglass cursor is being used
  694. '*************************************************************************
  695. SUB WaitOn STATIC
  696.     IF nWaiting% = 0 THEN
  697.         CursorSave% = ShowWaitCursor()
  698.         nWaiting% = 1
  699.     ENDIF
  700. END SUB
  701.  
  702.  
  703. '** Remove the long wait dialog if it is being displayed and reset the cursor
  704. '** back to normal if it was set to the hourglass icon
  705. '*************************************************************************
  706. SUB WaitOff STATIC
  707.     IF nWaiting% = 2 THEN
  708.         UIPop 1
  709.         RestoreCursor CursorSave%
  710.         nWaiting% = 0
  711.     ELSEIF nWaiting% = 1 THEN
  712.         RestoreCursor CursorSave%
  713.         nWaiting% = 0
  714.     ENDIF
  715. END SUB
  716.  
  717.  
  718. '** If the second file does not exist, backup szFile1$ as szFile2$
  719. '*************************************************************************
  720. SUB CheckBackupFile( szFile1$, szFile2$ ) STATIC
  721.     IF DoesFileExist(szFile2$,femExists) = 0 AND DoesFileExist(szFile1$,femExists) THEN
  722.         CopyFile szFile1$, szFile2$, cmoNone, 0
  723.     ENDIF
  724. END SUB
  725.  
  726. '*************************************************************************
  727. FUNCTION CreateProgmanItem (szGroup$, szItem$, szCmd$, szOther$, cmo%) STATIC AS INTEGER
  728.   szItemNew$ = szItem$
  729.   IF szOther$ <> "" THEN
  730.     szItemNew$ = szItem$ + "," + szOther$
  731.   END IF
  732.  
  733.   IF FCreateProgManItem(szGroup$, szItemNew$, szCmd$, cmo%) = 0 THEN
  734.         CreateProgmanItem = 1
  735.     ELSE
  736.         CreateProgmanItem = 0
  737.   END IF
  738.   szItemNew$ = ""
  739. END FUNCTION
  740.