home *** CD-ROM | disk | FTP | other *** search
/ Software Collection (I) / TOOLS.iso / b23 / font1 / fntsetup.mst < prev    next >
Encoding:
Text File  |  1994-05-05  |  18.9 KB  |  675 lines

  1. '**************************************************************************
  2. '*                       FONT setup application 
  3. '**************************************************************************
  4.  
  5. '$DEFINE DEBUG  ''Define for script development/debugging
  6.  
  7. '$INCLUDE 'setupapi.inc'
  8. '$INCLUDE 'msdetect.inc'
  9.  
  10. ''Dialog ID's
  11. CONST ASKQUIT      = 200
  12. CONST DESTPATH     = 300
  13. CONST EXITFAILURE  = 400
  14. CONST EXITQUIT     = 600
  15. CONST EXITSUCCESS  = 700
  16. CONST OPTIONS      = 800
  17. CONST APPHELP      = 900
  18. CONST CUSTINST     = 6200
  19. CONST TOOBIG       = 6300
  20. CONST BADPATH      = 6400
  21.  
  22. ''Bitmap ID
  23. CONST LOGO         = 1
  24.  
  25. ''File Types
  26. CONST OPTFILES1    = 1
  27. CONST OPTFILES2    = 2
  28. CONST OPTFILES3       = 3
  29. CONST OPTFILES4       = 4
  30.  
  31. '' these constants for windows maximize
  32. CONST WS_VISIBLE = &H10000000
  33. CONST WS_BORDER = &H00800000
  34. CONST WS_CLIPCHILDREN = &H02000000
  35. CONST GWL_STYLE = -16
  36. CONST SW_SHOWMAXIMIZED = 3
  37.  
  38. GLOBAL DEST$        ''Default destination directory.
  39. GLOBAL WINDRIVE$    ''Windows drive letter.
  40. GLOBAL OPT1OPT$     ''Option selection from OptFiles1 option dialog.
  41. GLOBAL OPT2OPT$     ''Option selection from OptFiles2 option dialog.
  42. GLOBAL OPT3OPT$        ''Option selection from OptFiles3 option dialog.
  43. GLOBAL OPT4OPT$        ''Option selection from OptFiles4 option dialog.
  44.  
  45. ''CustInst list symbol names
  46. GLOBAL OPT1NEEDS$   ''Option list costs per drive
  47. GLOBAL OPT2NEEDS$
  48. GLOBAL OPT3NEEDS$
  49. GLOBAL OPT4NEEDS$
  50.  
  51. GLOBAL EXTRACOSTS$  ''List of extra costs to add per drive
  52. GLOBAL BIGLIST$     ''List of option files cost calc results (boolean)
  53. GLOBAL FILENAME$    '' THE FILENAME OF SELECTED FILE
  54.  
  55. ''Dialog list symbol names
  56. GLOBAL CHECKSTATES$
  57. GLOBAL STATUSTEXT$
  58. GLOBAL DRIVETEXT$
  59.  
  60. DECLARE SUB AddOptFilesToCopyList (ftype%)
  61. DECLARE SUB RecalcOptFiles (ftype%)
  62. DECLARE SUB RecalcPath
  63. DECLARE SUB SetDriveStatus
  64. DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
  65.  
  66. '' the functions declare for font install to system
  67. GLOBAL Para1%
  68. GLOBAL Para2$
  69. GLOBAL Para3$
  70. GLOBAL Para4$
  71. DECLARE FUNCTION CreateScalableFontResource LIB "gdi.exe"(Para1%, Para2$, Para3$, Para4$) AS INTEGER
  72. DECLARE FUNCTION AddFontResource LIB "gdi.exe"(OPT1OPT$) AS INTEGER
  73. DECLARE FUNCTION AddSelectedFontToSystem LIB "mscuistf.dll"(Para1%, Para3$, Para2$, Para4$) AS INTEGER
  74.  
  75. DECLARE FUNCTION ShowWindow LIB "user.exe" (hWnd%, iShow%) AS INTEGER
  76. DECLARE FUNCTION SetWindowLong LIB "user.exe" (hWnd%, offset%, style&) AS LONG
  77.  
  78.  
  79. INIT:
  80.     CUIDLL$ = "mscuistf.dll"            ''custom user interface dll
  81.     HELPPROC$ = "FHelpDlgProc"          ''Help dialog procedure
  82.  
  83.     SetBitmap CUIDLL$, LOGO
  84. ''    SetTitle "Chinese FONT Setup"
  85.     SetTitle "╓╨╬─╫╓╠σ░▓╫░"
  86.  
  87.     szInf$ = GetSymbolValue("STF_SRCINFPATH")
  88.     IF szInf$ = "" THEN
  89.         szInf$ = GetSymbolValue("STF_CWDDIR") + "FntSetup.INF"
  90.     END IF
  91.     ReadInfFile szInf$
  92.  
  93.     WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
  94.     DEST$ = GetWindowsSysDir()
  95.     WINSYSPATH$ = GetWindowsSysDir()
  96. ''    DEST$ = WINDRIVE$ + DEST$
  97.  
  98.     ''CustInst list symbols
  99.     CHECKSTATES$ = "CheckItemsState"
  100.     STATUSTEXT$  = "StatusItemsText"
  101.     DRIVETEXT$   = "DriveStatusText"
  102.     FILENAME$ = "FileName"
  103.  
  104.     '' generate SYMBOL LIST 
  105.     FOR i% = 1 TO 4 STEP 1
  106.         AddListItem CHECKSTATES$, "ON"
  107.     NEXT i%
  108.  
  109.     FOR i% = 1 TO 4 STEP 1
  110.         AddListItem STATUSTEXT$, ""
  111.     NEXT i%
  112.  
  113.     FOR i% = 1 TO 7 STEP 1
  114.         AddListItem DRIVETEXT$, ""
  115.     NEXT i%
  116.     ReplaceListItem DRIVETEXT$, 7, DEST$
  117.  
  118.     FOR i% = 1 TO 4 STEP 1
  119.         AddListItem FILENAME$, ""
  120.     NEXT i%
  121.     '' fill symbol list by the name of TTF files
  122.     ReplaceListItem FILENAME$, 1, "kai-ti.ttf"
  123.     ReplaceListItem FILENAME$, 2, "fangs-ti.ttf"
  124.     ReplaceListItem FILENAME$, 3, "yuang1.ttf"
  125.     ReplaceListItem FILENAME$, 4, "lis1.ttf"
  126.  
  127.     ''Disk cost list symbols
  128.     OPT1NEEDS$  = "Opt1Needs"
  129.     OPT2NEEDS$    = "Opt2Needs"
  130.     OPT3NEEDS$    = "Opt3Needs"
  131.     OPT4NEEDS$    = "Opt4Needs"
  132.     EXTRACOSTS$ = "ExtraCosts"
  133.     BIGLIST$    = "BigList"
  134.  
  135.     FOR i% = 1 TO 4 STEP 1
  136.         AddListItem BIGLIST$, ""
  137.     NEXT i%
  138.     FOR i% = 1 TO 26 STEP 1
  139.         AddListItem EXTRACOSTS$, "0"
  140.     NEXT i%
  141.  
  142.     ''File Option Variables
  143.     OPT1OPT$ = "1"
  144.     OPT2OPT$ = "1"
  145.     OPT3OPT$ = "1"
  146.     OPT4OPT$ = "1"
  147.  
  148.     RecalcPath
  149.     SetDriveStatus
  150.  
  151. '$IFDEF DEBUG
  152.     i% = SetSizeCheckMode(scmOnIgnore)    '' could use scmOff; def = scmOnFatal
  153. '$ENDIF ''DEBUG
  154.  
  155.     '' MAXIMIZED THE WINDOW
  156.     hWnd% = HwndFrame()
  157.     il& = SetWindowLong(hWnd%, GWL_STYLE, WS_VISIBLE + WS_BORDER + WS_CLIPCHILDREN)
  158.     jl% = ShowWindow(hWnd%, SW_SHOWMAXIMIZED)
  159.  
  160. CUSTINST:
  161.     '' main dialog box message process
  162.     sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
  163.  
  164.     IF sz$ = "CONTINUE" THEN
  165.         ''Install only if it will fit.
  166.     FOR i% = 1 TO 4 STEP 1
  167.             IF GetListItem(BIGLIST$, i%) <> "" THEN
  168.                 GOSUB TOOBIG
  169.                 GOTO CUSTINST
  170.             END IF
  171.         NEXT i%
  172.         UIPop 1
  173.         GOTO INSTALL
  174.     ELSEIF sz$ = "PATH" THEN
  175.         GOTO GETPATH
  176.     ELSEIF sz$ = "CHK1" THEN
  177.     RecalcOptFiles OPTFILES1
  178.         SetDriveStatus
  179.         GOTO CUSTINST
  180.     ELSEIF sz$ = "CHK2" THEN
  181.     RecalcOptFiles OPTFILES2
  182.         SetDriveStatus
  183.         GOTO CUSTINST
  184.     ELSEIF sz$ = "CHK3" THEN
  185.     RecalcOptFiles OPTFILES3
  186.         SetDriveStatus
  187.     GOTO CUSTINST
  188.     ELSEIF sz$ = "CHK4" THEN
  189.     RecalcOptFiles OPTFILES4
  190.     SetDriveStatus
  191.     GOTO CUSTINST
  192.     ELSEIF sz$ = "REACTIVATE" THEN
  193.         RecalcPath
  194.         SetDriveStatus
  195.         GOTO CUSTINST
  196.     ELSE
  197.         GOSUB ASKQUIT
  198.         GOTO CUSTINST
  199.     END IF
  200.  
  201.  
  202.  
  203. INSTALL:
  204.     '' copy all selected file item into copy list
  205.     ClearCopyList
  206.     AddOptFilesToCopyList OPTFILES1
  207.     AddOptFilesToCopyList OPTFILES2
  208.     AddOptFilesToCopyList OPTFILES3
  209.     AddOptFilesToCopyList OPTFILES4
  210.  
  211.     CreateDir DEST$, cmoNone
  212.     CopyFilesInCopyList
  213.  
  214.  
  215.     '' modify the system setting for use the installed fonts
  216. ''    Para1% = 0
  217.     thefilename$ = ""
  218.     Para4$ = ""
  219.     k% = LEN(DEST$)
  220.  
  221.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  222.     thefilename$ = GetListItem(FILENAME$, OPTFILES1)
  223.     t% = LEN(thefilename$)
  224.  
  225.     IF (MID$(DEST$, k%, 1) = "\") THEN
  226.            Para3$ = DEST$ + thefilename$
  227.     ELSE
  228.         Para3$ = DEST$ + "\" + thefilename$
  229.         END IF
  230.  
  231.     Para2$ = WINSYSPATH$ + MID$(thefilename$, 1, (t% - 3)) + "fot"
  232.     t% = AddSelectedFontToSystem(OPTFILES1, Para2$, Para3$, Para4$)
  233.         IF t% = 0 then
  234.             GOTO ERRQUIT
  235.         END IF
  236.     END IF
  237.     IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
  238.         thefilename$ = GetListItem(FILENAME$, OPTFILES2) 
  239.         t% = LEN(thefilename$) 
  240.  
  241.     IF (MID$(DEST$, k%, 1) = "\") THEN
  242.            Para3$ = DEST$ + thefilename$
  243.     ELSE
  244.         Para3$ = DEST$ + "\" + thefilename$
  245.         END IF
  246.  
  247.     Para2$ = WINSYSPATH$ + MID$(thefilename$, 1, (t% - 3)) + "fot"
  248.         t% = AddSelectedFontToSystem(OPTFILES2, Para2$, Para3$, Para4$)
  249.         IF t% = 0 then
  250.             GOTO ERRQUIT
  251.         END IF
  252.     END IF
  253.     IF GetListItem(CHECKSTATES$, 3) = "ON" THEN
  254.         thefilename$ = GetListItem(FILENAME$, OPTFILES3) 
  255.         t% = LEN(thefilename$) 
  256.  
  257.     IF (MID$(DEST$, k%, 1) = "\") THEN
  258.            Para3$ = DEST$ + thefilename$
  259.     ELSE
  260.         Para3$ = DEST$ + "\" + thefilename$
  261.         END IF
  262.  
  263.     Para2$ = WINSYSPATH$ + MID$(thefilename$, 1, (t% - 3)) + "fot"
  264.         t% = AddSelectedFontToSystem(OPTFILES3, Para2$, Para3$, Para4$)
  265.         IF t% = 0 then
  266.             GOTO ERRQUIT
  267.         END IF
  268.     END IF
  269.     IF GetListItem(CHECKSTATES$, 4) = "ON" THEN
  270.         thefilename$ = GetListItem(FILENAME$, OPTFILES4) 
  271.         t% = LEN(thefilename$) 
  272.  
  273.     IF (MID$(DEST$, k%, 1) = "\") THEN
  274.            Para3$ = DEST$ + thefilename$
  275.     ELSE
  276.         Para3$ = DEST$ + "\" + thefilename$
  277.         END IF
  278.  
  279.     Para2$ = WINSYSPATH$ + MID$(thefilename$, 1, (t% - 3)) + "fot"
  280.         t% = AddSelectedFontToSystem(OPTFILES4, Para2$, Para3$, Para4$)
  281.         IF t% = 0 then
  282.             GOTO ERRQUIT
  283.         END IF
  284.     END IF    
  285.  
  286.  
  287. QUIT:
  288.     ON ERROR GOTO ERRQUIT
  289.  
  290.     IF ERR = 0 THEN
  291.         dlg% = EXITSUCCESS
  292.     ELSEIF ERR = STFQUIT THEN
  293.         dlg% = EXITQUIT
  294.     ELSE
  295.         dlg% = EXITFAILURE
  296.     END IF
  297. QUITL1:
  298.     sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
  299.     IF sz$ = "REACTIVATE" THEN
  300.         GOTO QUITL1
  301.     END IF
  302.     UIPop 1
  303.  
  304.     END
  305.  
  306. ERRQUIT:
  307.     i% = DoMsgBox("░▓╫░╩º░▄ú¼╟δ╙δ╙╨╣╪│º╔╠┴¬╧╡íú", "╓╨╬─╫╓╠σ░▓╫░│╠╨≥┤φ╬≤╨┼╧ó", MB_OK+MB_TASKMODAL+MB_ICONHAND)
  308.     END
  309.  
  310.  
  311.  
  312. GETPATH:
  313.     SetSymbolValue "EditTextIn", DEST$
  314.     SetSymbolValue "EditFocus", "END"
  315. GETPATHL1:
  316.     sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
  317.  
  318.     IF sz$ = "CONTINUE" THEN
  319.         olddest$ = DEST$
  320.         DEST$ = GetSymbolValue("EditTextOut")
  321.  
  322.         ''Validate new path.
  323.         IF IsDirWritable(DEST$) = 0 THEN
  324.             GOSUB BADPATH
  325.             GOTO GETPATHL1
  326.         END IF
  327.         UIPop 1
  328.  
  329.         ''Truncate display if too long.
  330.         IF LEN(DEST$) > 23 THEN
  331.             ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
  332.         ELSE
  333.             ReplaceListItem DRIVETEXT$, 7, DEST$
  334.         END IF
  335.  
  336.         ''Recalc if path changed.
  337.         IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
  338.             RecalcPath
  339.             SetDriveStatus
  340.         END IF
  341.  
  342.         olddest$ = ""
  343.         GOTO CUSTINST
  344.     ELSEIF sz$ = "REACTIVATE" THEN
  345.         RecalcPath
  346.         SetDriveStatus
  347.         GOTO GETPATHL1
  348.     ELSEIF sz$ = "EXIT" THEN
  349.         GOSUB ASKQUIT
  350.         GOTO GETPATHL1
  351.     ELSE
  352.         UIPop 1
  353.         GOTO CUSTINST
  354.     END IF
  355.  
  356.  
  357. TOOBIG:
  358.     sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
  359.     IF sz$ = "REACTIVATE" THEN
  360.         RecalcPath
  361.         SetDriveStatus
  362.         GOTO TOOBIG
  363.     END IF
  364.     UIPop 1
  365.     RETURN
  366.  
  367.  
  368. BADPATH:
  369.     sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
  370.     IF sz$ = "REACTIVATE" THEN
  371.         RecalcPath
  372.         SetDriveStatus
  373.         GOTO BADPATH
  374.     END IF
  375.     UIPop 1
  376.     RETURN
  377.  
  378.  
  379.  
  380. ASKQUIT:
  381.     sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
  382.  
  383.     IF sz$ = "EXIT" THEN
  384.         UIPopAll
  385.         ERROR STFQUIT
  386.     ELSEIF sz$ = "REACTIVATE" THEN
  387.         GOTO ASKQUIT
  388.     ELSE
  389.         UIPop 1
  390.     END IF
  391.     RETURN
  392.  
  393.  
  394.  
  395. '**
  396. '** Purpose:
  397. '**     Adds the specified option files to the copy list.
  398. '** Arguments:
  399. '**     ftype%  - type of files to add, one of the following:
  400. '**             OPTFILES1, OPTFILES2, OPTFILES3, OPTFILES4
  401. '** Returns:
  402. '**     none.
  403. '*************************************************************************
  404. SUB AddOptFilesToCopyList (ftype%) STATIC
  405.  
  406.     '' read the INF file for each item of install file
  407.     IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
  408.     SrcDir$ = GetSymbolValue("STF_SRCDIR")
  409.  
  410.     IF ftype% = OPTFILES1 THEN
  411.           AddSectionKeyFileToCopyList "OptFiles1", OPT1OPT$, SrcDir$, DEST$
  412.     ELSEIF ftype% = OPTFILES2 THEN
  413.           AddSectionKeyFileToCopyList "OptFiles2", OPT2OPT$, SrcDir$, DEST$
  414.     ELSEIF ftype% = OPTFILES3 THEN
  415.           AddSectionKeyFileToCopyList "OptFiles3", OPT3OPT$, SrcDir$, DEST$
  416.     ELSEIF ftype% = OPTFILES4 THEN
  417.           AddSectionKeyFileToCopyList "OptFiles4", OPT4OPT$, SrcDir$, DEST$
  418.         END IF
  419.         SrcDir$ = ""
  420.     END IF
  421. END SUB
  422.  
  423.  
  424. '**
  425. '** Purpose:
  426. '**     Recalculates disk space for the given option files and sets
  427. '**     the status info symbol "StatusItemsText".
  428. '** Arguments:
  429. '**     ftype% - type of files to add, one of the following:
  430. '**             OPTFILES1, OPTFILES2, OPTFILES3, OPTFILES4
  431. '** Returns:
  432. '**     none.
  433. '*************************************************************************
  434. SUB RecalcOptFiles (ftype%) STATIC
  435.     CursorSave% = ShowWaitCursor()
  436.     ClearCopyList
  437.  
  438.     '' read the INF files for symbol list
  439.     AddOptFilesToCopyList ftype%
  440.  
  441.     '' be changed for FONT 1
  442.     fExtra% = 0
  443.     IF ftype% = OPTFILES1 THEN
  444.     ListSym$ = OPT1NEEDS$
  445.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  446.             ''Add extra cost to Windows drive for ini/progman, etc.
  447.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  448.             ReplaceListItem EXTRACOSTS$, ndrive%, "1024"
  449.             fExtra% = 1
  450.         END IF
  451.     END IF
  452.  
  453.     '' be changed for FONT 2
  454.     IF ftype% = OPTFILES2 THEN
  455.     ListSym$ = OPT2NEEDS$
  456.     IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
  457.             ''Add extra cost to Windows drive for ini/progman, etc.
  458.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  459.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  460.             fExtra% = 1
  461.         END IF
  462.     END IF
  463.  
  464.     '' be changed for FONT 3
  465.     IF ftype% = OPTFILES3 THEN
  466.     ListSym$ = OPT3NEEDS$
  467.     IF GetListItem(CHECKSTATES$, OPTFILES3) = "ON" THEN
  468.             ''Add extra cost to Windows drive for ini/progman, etc.
  469.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  470.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  471.             fExtra% = 1
  472.         END IF
  473.     END IF
  474.  
  475.     '' be changed for FONT 4
  476.     IF ftype% = OPTFILES4 THEN
  477.     ListSym$ = OPT4NEEDS$
  478.     IF GetListItem(CHECKSTATES$, OPTFILES4) = "ON" THEN
  479.             ''Add extra cost to Windows drive for ini/progman, etc.
  480.             ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  481.             ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
  482.             fExtra% = 1
  483.         END IF
  484.     END IF
  485.  
  486.     '' here is important to calculate the bytes of files
  487.     StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
  488.  
  489. '    cost& = 0
  490. '    temp& = 0
  491. '    FOR i% = 1 TO 26 STEP 1
  492. '        IF VAL(GetListItem(ListSym$, i%)) > 0 THEN
  493. '            temp& = VAL(GetListItem(ListSym$, i%))
  494. '        ELSE
  495. '            temp& = -VAL(GetListItem(ListSym$, i%))
  496. '        END IF
  497.  
  498. '        cost&  = cost& + temp&
  499. '    NEXT i%
  500.  
  501.     IF ftype% = OPTFILES1 THEN
  502.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  503.             cost& = 2378374
  504.         ELSE
  505.             cost& = 0
  506.         END IF
  507.     ELSEIF ftype% = OPTFILES2 THEN
  508.     IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
  509.             cost& = 2375999
  510.         ELSE
  511.             cost& = 0
  512.         END IF
  513.     ELSEIF ftype% = OPTFILES3 THEN
  514.     IF GetListItem(CHECKSTATES$, OPTFILES3) = "ON" THEN
  515.             cost& = 2497124
  516.         ELSE
  517.             cost& = 0
  518.         END IF
  519.     ELSEIF ftype% = OPTFILES4 THEN
  520.     IF GetListItem(CHECKSTATES$, OPTFILES4) = "ON" THEN
  521.             cost& = 3152996
  522.         ELSE
  523.             cost& = 0
  524.         END IF
  525.     END IF
  526.  
  527.     ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
  528.  
  529.     IF StillNeed& > 0 THEN
  530.         ReplaceListItem BIGLIST$, ftype%, "YES"
  531.     ELSE
  532.         ReplaceListItem BIGLIST$, ftype%, ""
  533.     END IF
  534.  
  535.     IF fExtra% THEN
  536.         ReplaceListItem EXTRACOSTS$, ndrive%, "0"
  537.     END IF
  538.     RestoreCursor CursorSave%
  539.     ListSym$ = ""
  540. END SUB
  541.  
  542.  
  543. '**
  544. '** Purpose:
  545. '**     Recalculates disk space and sets option status info according
  546. '**     to the current destination path.
  547. '** Arguments:
  548. '**     none.
  549. '** Returns:
  550. '**     none.
  551. '*************************************************************************
  552. SUB RecalcPath STATIC
  553.  
  554.     CursorSave% = ShowWaitCursor()
  555.  
  556.     RecalcOptFiles OPTFILES1
  557.     RecalcOptFiles OPTFILES2
  558.     RecalcOptFiles OPTFILES3
  559.     RecalcOptFiles OPTFILES4
  560.  
  561.     RestoreCursor CursorSave%
  562. END SUB
  563.  
  564.  
  565. '**
  566. '** Purpose:
  567. '**     Sets drive status info according to latest disk space calcs.
  568. '** Arguments:
  569. '**     none.
  570. '** Returns:
  571. '**     none.
  572. '*************************************************************************
  573. SUB SetDriveStatus STATIC
  574.  
  575.     drive$ = MID$(DEST$, 1, 1)
  576.     ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
  577.  
  578.     '' here be changed for FONTs
  579.     '' so stupid for avoid number error
  580. '    if VAL(GetListItem(OPT1NEEDS$, ndrive%)) > 0 then 
  581. '        space1& = VAL(GetListItem(OPT1NEEDS$, ndrive%))
  582. '    else
  583. '        space1& = -VAL(GetListItem(OPT1NEEDS$, ndrive%))
  584. '    end if
  585. '    if VAL(GetListItem(OPT2NEEDS$, ndrive%)) > 0 then 
  586. '        space2& = VAL(GetListItem(OPT2NEEDS$, ndrive%))
  587. '    else
  588. '        space2& = -VAL(GetListItem(OPT2NEEDS$, ndrive%))
  589. '    end if
  590. '    if VAL(GetListItem(OPT3NEEDS$, ndrive%)) > 0 then 
  591. '        space3& = VAL(GetListItem(OPT3NEEDS$, ndrive%))
  592. '    else
  593. '        space3& = -VAL(GetListItem(OPT3NEEDS$, ndrive%))
  594. '    end if
  595. '    if VAL(GetListItem(OPT4NEEDS$, ndrive%)) > 0 then 
  596. '        space4& = VAL(GetListItem(OPT4NEEDS$, ndrive%))
  597. '    else
  598. '        space4& = -VAL(GetListItem(OPT4NEEDS$, ndrive%))
  599. '    end if
  600.  
  601.  
  602.     IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
  603.             space1& = 2378374
  604.         ELSE
  605.             space1& = 0
  606.         END IF
  607.     IF GetListItem(CHECKSTATES$, OPTFILES2) = "ON" THEN
  608.             space2& = 2375999
  609.         ELSE
  610.             space2& = 0
  611.         END IF
  612.     IF GetListItem(CHECKSTATES$, OPTFILES3) = "ON" THEN
  613.             space3& = 2497124
  614.         ELSE
  615.             space3& = 0
  616.         END IF
  617.     IF GetListItem(CHECKSTATES$, OPTFILES4) = "ON" THEN
  618.             space4& = 3152996
  619.         ELSE
  620.             space4& = 0
  621.         END IF
  622.  
  623.     cost& = space1& + space2& + space3& + space4&
  624.     free& = GetFreeSpaceForDrive(drive$)
  625.  
  626.     ReplaceListItem DRIVETEXT$, 1, DEST$
  627.     ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
  628.     ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
  629.  
  630. '    IF drive$ = WINDRIVE$ THEN
  631.         ReplaceListItem DRIVETEXT$, 4, ""
  632.         ReplaceListItem DRIVETEXT$, 5, ""
  633.         ReplaceListItem DRIVETEXT$, 6, ""
  634. '    ELSE
  635. '        ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
  636. ''      cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%))
  637. '
  638. '    '' here be changed for FONTs
  639. '    cost& = VAL(GetListItem(OPT1NEEDS$, ndrive%)) + VAL(GetListItem(OPT2NEEDS$, ndrive%)) + VAL(GetListItem(OPT3NEEDS$, ndrive%)) + VAL(GetListItem(OPT4NEEDS$, ndrive%))
  640. '        IF cost& = 0 THEN
  641. '            ReplaceListItem DRIVETEXT$, 4, ""
  642. '            ReplaceListItem DRIVETEXT$, 5, ""
  643. '            ReplaceListItem DRIVETEXT$, 6, ""
  644. '        ELSE
  645. '            free& = GetFreeSpaceForDrive(WINDRIVE$)
  646. '            ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
  647. '            ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
  648. '            ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
  649. '        END IF
  650. '    END IF
  651. END SUB
  652.  
  653.  
  654. '**
  655. '** Purpose:
  656. '**     Appends a file name to the end of a directory path,
  657. '**     inserting a backslash character as needed.
  658. '** Arguments:
  659. '**     szDir$  - full directory path (with optional ending "\")
  660. '**     szFile$ - filename to append to directory
  661. '** Returns:
  662. '**     Resulting fully qualified path name.
  663. '*************************************************************************
  664. FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
  665.     IF szDir$ = "" THEN
  666.         MakePath = szFile$
  667.     ELSEIF szFile$ = "" THEN
  668.         MakePath = szDir$
  669.     ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
  670.         MakePath = szDir$ + szFile$
  671.     ELSE
  672.         MakePath = szDir$ + "\" + szFile$
  673.     END IF
  674. END FUNCTION
  675.