home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT070.ZIP / MENUS.EXE / LEVEL1.MNU < prev    next >
Text File  |  1991-04-24  |  49KB  |  1,955 lines

  1. Comment
  2. =======================================
  3. Lite Menu
  4.  
  5. Lite Menu requires a data file, in which it stores information about
  6. the choices. It has password capabilites to keep the user Out of the
  7. modify and exit to dos choices.
  8.  
  9. * Warning * Messing with the *.dat file will mess up your program !!!!
  10.  
  11. (C) CopyRight 1990-91 by Marc Perkel * All rights Reserved
  12. (417)866-1222
  13.  
  14. Programmed by Kevin Moore and Marc Perkel
  15.  
  16. =======================================
  17. EndComment
  18.  
  19. Var
  20.    MenuInverseForeColor MenuInverseBackColor MainScreenForeColor
  21.    Menu                 NewProgram           Subs
  22.    TotalSubs            LongestSubLine       MenuHeader
  23.    MenuTitle            ModifyPassWord       ExitToDosPassWord
  24.    ChoicePtr            Offset               %ThisDirectory
  25.    LongestItem          FileSaved            MenuForeColor
  26.    MenuBackColor        MenuBorderForeColor  MenuBorderBackColor
  27.    MenuHeaderForeColor  MenuHeaderBackColor  ExplodeStatus
  28.    ShadowStatus         SoundStatus          Index
  29.    I                    In                   TmpSt
  30.    BorderStyle          BottomOfScreenText   MainScreenBackColor
  31.    TmpWd                Height               Width
  32.    ScreenArr            ClockForeColor       ClockBackColor
  33.  
  34. Var
  35.    TitleRow             MsgRow               BatEditor
  36.    Count                DosUtilPassWord      %ThisDrive
  37.    UtilPassWord         MenuName             UtilForeColor
  38.    UtilBackColor        UtilBorderForeColor  UtilBorderBackColor
  39.    UtilInverseForeColor UtilInverseBackColor UtilHeaderForeColor
  40.    UtilHeaderBackColor  TitleForeColor       TitleBackColor
  41.    TitleBorderForeColor TitleBorderBackColor TitleInverseForeColor
  42.    TitleInverseBackColor TitleHeaderForeColor TitleHeaderBackColor
  43.    BackDropCharacter    TitleExplodeStatus   TitleShadowStatus
  44.    TitleSoundStatus     UtilExplodeStatus    UtilShadowStatus
  45.    UtilSoundStatus      UtilBorderStyle      TitleBorderStyle
  46.    ConBlankTime         ConLockword          ConBlankMessage
  47.    VerNo                MMActive             sdf
  48.    SubListName          DirScanProg          PickProg
  49.  
  50. Const
  51.    None = 1  Single = 2 Double = 3 Block = 4
  52.    Larr = 19 Rarr   = 4 Uarr   = 5 Darr  = 24
  53.    Version      = 'Version 1.7'
  54.    ProgramName  = 'Lite Menu '
  55.    CopyRightMsg = '(C) CopyRight 1990-91 by Computer Tyme * All rights reserved.'
  56.    MMenu = 1  Util = 2 Title = 3
  57.  
  58. Qualifier
  59.    InUse Description Path Name PassWord Parameters Pause
  60.  
  61.  
  62. Initialize
  63.  
  64. Cursor Off
  65.  
  66. %ThisDrive = left(path,2)
  67.  
  68. LoadData
  69.  
  70. ShadowColor (grey, black)
  71.  
  72. DrawTop
  73. DrawBottom ('F1 - Help  *  F2 - Save  *  F3 - Utilities  *  F10 - Setup')
  74.  
  75. While ChoicePtr = 0
  76.    NoChoices
  77. EndWhile
  78.  
  79.  
  80. Draw
  81. Main
  82.  
  83.  
  84. ;------ Show Item for Debugging
  85.  
  86. Procedure ShowItem (Item)
  87.    DrawBox 1 23 79 3
  88.    Write ' >' Item '<'
  89.    Wait 250
  90.    EraseTopWindow
  91. EndProc ;ShowItem
  92.  
  93. ;------ Uses same name as Pick Directory
  94.  
  95. Procedure GetSubListName
  96. var SearchSt W
  97.    if SubListName > '' then Return (SubListName)
  98.    if ExistDir 'C:\'
  99.       SubListName = 'C:\PD.PIC'
  100.    else
  101.       SubListName = CleanFileName('PD.PIC')
  102.    endif
  103.    SearchSt = ReadEnv('PD.EXE')
  104.    if SearchSt > ''
  105.       W = pos('/$',SearchSt)
  106.       if W > 0
  107.          SearchSt = Mid(SearchSt,W + 2,255)
  108.          SubListName = NextWord(SearchSt)
  109.          if Left(SearchSt,1) = '.'
  110.             delete(SearchSt,1,1)
  111.             SubListName = SubListName + '.' + NextWord(SearchSt)
  112.          endif
  113.       endif
  114.    endif
  115.    if not ExistFile(SubListName) then ScanDirectories
  116.    Return (SubListName)
  117. EndProc
  118.  
  119. ;------ This finds the program to use for the subdirectory pick file.
  120.  
  121. Procedure SetScanPrograms
  122.    PickProg = ExistOnPath('PD.EXE')
  123.    if PickProg > ''
  124.       DirScanProg = PickProg + '/F'
  125.    endif
  126.    if DirScanProg = ''
  127.       DirScanProg = ExistOnPath('PIPEDIR.EXE')
  128.       if DirScanProg = ''
  129.          DirScanProg = ExistOnPath('WHEREIS.EXE');
  130.          if DirScanProg = ''
  131.             Abort('You will need WHEREIS.EXE or PIPEDIR.EXE from the DOS TOOLBOX to run this program!')
  132.          endif
  133.       endif
  134.       DirScanProg = DirScanProg + '/T'
  135.       if pos('PIPEDIR',DirScanProg) > 0 then DirScanProg = DirScanProg + '/W'
  136.       DirScanProg = DirScanProg + '>' + GetSubListName
  137.    endif
  138. EndProc ;SetScanPrograms
  139.  
  140.  
  141. Procedure ScanDirectories
  142.    MessageBox( '','Scanning Directories', 0, 0)
  143.    if DirScanProg = '' then SetScanPrograms
  144.    ClearScreenFirst Off
  145.    Execute (DirScanProg)
  146.    EraseTopWindow
  147.    TotalSubs = 0
  148. EndProc ; ScanDirectories
  149.  
  150. ;---
  151.  
  152.  
  153. Procedure ReadDirectories
  154.    if TotalSubs > 0 then return
  155.    Dispose Subs
  156.    ReadTextFile(GetSubListName,Subs)
  157.    TotalSubs = NumberOfElements(Subs)
  158.    LongestSubLine = LongestLine
  159. EndProc ;ReadDirectories
  160.  
  161.  
  162. Procedure AdvancedOptions
  163. Var  Select
  164.  
  165.    MakeBox('Advanced Options', 0, 10, 29, 8, Util)
  166.  
  167.    Writeln("  A - PassWord")
  168.    Writeln("  B - Parameters")
  169.    Writeln("  C - Pause after execute")
  170.    Writeln("  D - Path")
  171.    Writeln("  E - Program")
  172.    Write  ("  F - Create/Edit Bat File")
  173.    UseArrows On
  174.  
  175.  
  176.    Repeat
  177.       Select = GetKey
  178.       if Select = 'A'
  179.          FileSaved = False
  180.          Menu[Index].PassWord = ReadTextLine('PassWord', Menu[Index].PassWord, 35, 16)
  181.       endif
  182.       if Select = 'B'
  183.          FileSaved = False
  184.          Menu[Index].Parameters = ReadTextLine('Program Parameters', Menu[Index].Parameters, 60, 16)
  185.       endif
  186.       if Select = 'C'
  187.          FileSaved = False
  188.          if AskYesNo('Pause after execute?', 16)
  189.             Menu[Index].Pause = True
  190.          else
  191.             Menu[Index].Pause = False
  192.          endif
  193.       endif
  194.       if Select = 'D' then Menu[Index].Path = ReadTextLine('Edit Path', Menu[Index].Path, 50, 16)
  195.       if Select = 'E' then Menu[Index].Name = ReadTextLine('Edit Program', Menu[Index].Name, 50, 16)
  196.  
  197.       if Select = 'F' then EditBat
  198.    Until Select = ESC
  199.  
  200.    EraseTopWindow
  201.  
  202. EndProc ;AdvancedOptions
  203.  
  204. ;---
  205.  
  206. Procedure Backup
  207. Var Select BackUpPath
  208.  
  209.    MakeBox('Backup Hard Disk', 26, 17, 30, 4, Util)
  210.    Writeln('  A - Entire Disk')
  211.    Write  ('  B - One Directory')
  212.  
  213.    Repeat
  214.       Select = GetKey
  215.       if Select = 'A'
  216.          ChDir('\')
  217.          Execute('BACKUP C: A: /S')
  218.       endif
  219.       if Select = 'B'
  220.          BackupPath = ChooseDirectory
  221.          Chdir(BackUpPath)
  222.          Execute('BACKUP C: A:')
  223.       endif
  224.       if Select = F1 then Help
  225.    Until Select = ESC
  226.  
  227.    EraseTopWindow
  228.  
  229. EndProc ;BackUp
  230.  
  231. ;---
  232.  
  233. Procedure Colors (WinNum)
  234. Var Select
  235.  
  236.    MakeBox('Colors', 36, 11, 17, 6, Util)
  237.    Writeln("  A - Inside ")
  238.    Writeln("  B - Border ")
  239.    Writeln("  C - Header ")
  240.    Write  ("  D - Inverse ")
  241.  
  242.    Repeat
  243.       Select = GetKey
  244.       if Select = 'A'
  245.           if WinNum = MMenu then ChooseColors (MenuForeColor , MenuBackColor, 1)
  246.           if WinNum = Util  then ChooseColors (UtilForeColor, UtilBackColor, 9)
  247.           if WinNum = Title then ChooseColors (TitleForeColor, TitleBackColor, 13)
  248.       endif
  249.       if Select = 'B'
  250.           if WinNum = MMenu then ChooseColors (MenuBorderForeColor, MenuBorderBackColor, 2)
  251.           if WinNum = Util  then ChooseColors (UtilBorderForeColor, UtilBorderBackColor, 10)
  252.           if WinNum = Title then ChooseColors (TitleBorderForeColor, TitleBorderBackColor, 14)
  253.       endif
  254.       if Select = 'C'
  255.           if WinNum = MMenu then ChooseColors (MenuHeaderForeColor, MenuHeaderBackColor, 4)
  256.           if WinNum = Util  then ChooseColors (UtilHeaderForeColor, UtilHeaderBackColor, 12)
  257.           if WinNum = Title then ChooseColors (TitleHeaderForeColor, TitleHeaderBackColor, 16)
  258.       endif
  259.       if Select = 'D'
  260.           if WinNum = MMenu then ChooseColors (MenuInverseForeColor, MenuInverseBackColor, 3)
  261.           if WinNum = Util  then ChooseColors (UtilInverseForeColor, UtilInverseBackColor, 11)
  262.           if WinNum = Title then ChooseColors (TitleInverseForeColor, TitleInverseBackColor, 15)
  263.       endif
  264.    Until Select = ESC
  265.  
  266.    EraseTopWindow
  267.  
  268. EndProc ;ColorsMenu
  269.  
  270. ;---
  271.  
  272. Procedure DosUtilities
  273. Var
  274.    Select Parm
  275.  
  276.    ClearScreenFirst On
  277.    ClearScreenOnExit On
  278.  
  279.    MakeBox('Dos Utilities', 5, 8, 25, 11, Util)
  280.    Writeln('  A - Format Floppies')
  281.    Writeln('  B - Directory')
  282.    Writeln('  C - Free')
  283.    Writeln('  D - Backup Hard Disk')
  284.    Writeln('  E - Directory Master')
  285.    Writeln('  F - Pick Directory')
  286.    Writeln('  G - Whereis')
  287.    Writeln('  H - DOS Shell')
  288.    Write  ('  I - DOS command')
  289.  
  290.  
  291.    Repeat
  292.       Select = GetKey
  293.       if Select = 'A' then Format
  294.       if Select = 'B'
  295.          Parm = ReadTextLine('Directory Mask', path + '\*.*', 60, 10)
  296.          if Parm = '' then Parm = path + '\*.*'
  297.          if LastKey = Char(13)
  298.             if ExistOnPath('D.EXE') > ''
  299.                Execute('D ' + Parm + ' /W')
  300.             else
  301.                Execute('DIR ' + Parm + ' | more')
  302.             endif
  303.          endif
  304.       endif
  305.       if Select = 'C'
  306.          Parm = ReadTextLine('Drive', left(path,2), 60, 10)
  307.          if LastKey = char(13)
  308.             if ExistonPath('FREE.EXE') > ''
  309.                Execute('FREE ' + Parm + ' | More')
  310.             else
  311.                Execute('Chkdsk ' + Parm + ' | More')
  312.             endif
  313.          endif
  314.       endif
  315.       if Select = 'D' then BackUp
  316.       if Select = 'E'
  317.          if ExistOnPath('DM.COM') > ''
  318.             Execute('DM')
  319.          else
  320.             Error('Could not find Directory Master!')
  321.          endif
  322.       endif
  323.       if Select = 'F'
  324.          if ExistOnPath('PD.EXE') > ''
  325.             Execute('PD')
  326.          else
  327.             Error('Could not find Pick Directory!')
  328.          endif
  329.       endif
  330.       if Select = 'G'
  331.          if DirScanProg > ''
  332.             Parm = ReadTextLine(' Mask (*.doc) ', '', 60, 10)
  333.             if Lastkey = Char(13) then Execute('WHEREIS ' + Parm + ' | more ')
  334.          else
  335.             Error('Could not find Whereis!')
  336.          endif
  337.       endif
  338.       if Select = 'H'
  339.          if ExistOnPath('DOLIST.EXE') > ''
  340.             Execute('DOLIST')
  341.          else
  342.             Execute('COMMAND')
  343.          endif
  344.       endif
  345.  
  346.       if Select = 'I'
  347.          Parm = ReadTextLine('DOS Command', '', 60, 10)
  348.          if LastKey = Char(13)
  349.             Execute(Parm)
  350.          endif
  351.       endif
  352.    Until Select = ESC
  353.  
  354.    EraseTopWindow
  355.  
  356. EndProc ;DosUtilities
  357.  
  358. ;---
  359.  
  360. Procedure Edit
  361. Var
  362.    x y spc = '                               ' Select
  363.  
  364.    FileSaved = False
  365.  
  366.    if ExplodeStatus then Explode Off
  367.    DrawBottom ('ESC - Main Screen * F4 - Utilities')
  368.    if ExplodeStatus then Explode On
  369.  
  370.    RedrawSelections
  371.  
  372.    Repeat
  373.       Select = GetKey
  374.       if (Select >= 'A') and (Select <= 'Z')
  375.          ChoicePtr = ChoicePtr + 1
  376.          ModifyMenuChoice (Select)
  377.          if Select < 'N'
  378.             GotoXY(6, (Ord(Select) - 64))
  379.             Write(spc)
  380.             GotoXY(6, (Ord(Select) - 64))
  381.          else
  382.             GotoXY(42, (Ord(Select) - 77))
  383.             Write(spc)
  384.             GotoXY(42, (Ord(Select) - 77))
  385.          endif
  386.          Write(Mid(Menu[(Ord(Select) - 64)].Description,4,255))
  387.       endif
  388.       if Select = F4
  389.          if EnterPassWord(UtilPassWord, 19)
  390.             EditUtilities
  391.          endif
  392.       endif
  393.    Until Select = ESC
  394.  
  395.    UpDate
  396.  
  397.    EraseTopWindow
  398.    EraseTopWindow
  399.    UseArrows On
  400.  
  401. EndProc ;Edit
  402.  
  403. ;---
  404.  
  405. Procedure Format
  406. Var Select
  407.  
  408.    MakeBox( 'Format Floppy Disk Menu', 0, 10, 44, 6, Util)
  409.    Writeln '  1 - Format 360      5 - Format /S 360'
  410.    Writeln '  2 - Format 1.2M     6 - Format /S 1.2M'
  411.    Writeln '  3 - Format 720      7 - Format /S 720'
  412.    Write   '  4 - Format 1.4M     8 - Format /S 1.4M'
  413.  
  414.    Repeat
  415.       Select = GetKey
  416.       if Select = '1' then Format2('/4')
  417.       if Select = '2' then Format2('')
  418.       if Select = '3' then Format2('/N:9/T:80')
  419.       if Select = '4' then Format2('/N:18/T:80')
  420.       if Select = '5' then Format2('/4/S')
  421.       if Select = '6' then Format2('/S')
  422.       if Select = '7' then Format2('/N:9/T:80/S')
  423.       if Select = '8' then Format2('/N:18/T:80/S')
  424.       if Select = F1 then Help
  425.    Until Select = ESC
  426.  
  427.    EraseTopWindow
  428.  
  429. EndProc ;Format
  430.  
  431. ;---
  432.  
  433. Procedure Main
  434. Var
  435.    Select
  436.  
  437.    MMActive = True
  438.    %ThisDirectory = Path
  439.    BlankTime      = 0
  440.    UseCommand On
  441.    NoExit
  442.    SavePosition On
  443.    FileSaved      = True
  444.  
  445.    UseArrows
  446.  
  447.    Repeat
  448.       Select = GetKey
  449.       if (Select >= 'A') and (Select <= 'Z')
  450.          Index = (Ord(Select) - 64)
  451.          if Menu[Index].Inuse
  452.             Trim(Menu[Index].Name)
  453.             if Menu[Index].Name > ''
  454.                BuildBat (Index)
  455.             else
  456.                Error('You have not selected a program for this menu choice!!')
  457.             endif
  458.          endif
  459.       endif
  460.       if Select = F10
  461.          EraseTopWindow
  462.          MMActive = False
  463.          Edit
  464.          UpdateScreen
  465.          MMActive = True
  466.       endif
  467.       if Select = F3
  468.          if EnterPassWord (DosUtilPassWord, 19)
  469.             MMActive = False
  470.             DosUtilities
  471.             MMActive = True
  472.             EraseTopWindow
  473.             Draw
  474.          endif
  475.       endif
  476.       if Select = F4
  477.          if EnterPassWord (UtilPassWord, 19)
  478.             MMActive = False
  479.             EditUtilities
  480.             UpDateScreen
  481.             MMActive = True
  482.          endif
  483.       endif
  484.       if Select = (Char(0) + Char(31)) ;SetUp
  485.          Setup
  486.       endif
  487.       if Select = ESC then Leave
  488.    Until Select = alt0
  489.  
  490. EndProc ;MainMenu
  491.  
  492. ;---
  493.  
  494. Procedure MenuBorderStyle (WinNum)
  495. Var
  496.    Select
  497.  
  498.    FileSaved = False
  499.  
  500.    MakeBox( 'Menu Border Style', 0, 0, 30, 5, Util)
  501.    Writeln("  A - Single Line Border " + Char(196))
  502.    Writeln("  B - Double Line Border " + Char(205))
  503.    Write  ("  C - Block Box Border   " + Char(219))
  504.  
  505.    Select = GetKey
  506.    While Select <> ESC
  507.       if Select = 'A'
  508.          if WinNum = MMenu then BorderStyle = Single
  509.          if WinNum = Util  then UtilBorderStyle = Single
  510.          if WinNum = Title then TitleBorderStyle = Single
  511.          EraseTopWindow
  512.          Return
  513.       endif
  514.       if Select = 'B'
  515.          if WinNum = MMenu then BorderStyle = Double
  516.          if WinNum = Util  then UtilBorderStyle = Double
  517.          if WinNum = Title then TitleBorderStyle = Double
  518.          EraseTopWindow
  519.          Return
  520.       endif
  521.       if Select = 'C'
  522.          if WinNum = MMenu then BorderStyle = Block
  523.          if WinNum = Util then UtilBorderStyle = Block
  524.          if WinNum = Title then TitleBorderStyle = Block
  525.          EraseTopWindow
  526.          Return
  527.       endif
  528.       if Select = F1 then Help
  529.       Select = GetKey
  530.    EndWhile
  531.  
  532.    EraseTopWindow
  533.  
  534. EndProc ;MenuBorderStyle
  535.  
  536. ;---
  537.  
  538. Procedure BackDrop
  539. Var
  540.    Select
  541.  
  542.    FileSaved = False
  543.  
  544.    MakeBox( '', 37, 10, 15, 7, Util)
  545.    Writeln("  A - " + Char(176))
  546.    Writeln("  B - " + Char(177))
  547.    Writeln("  C - " + Char(178))
  548.    Writeln("  D - " + Char(185))
  549.    Write  ("  E - Blank")
  550.  
  551.    Select = GetKey
  552.    While Select <> ESC
  553.       if Select = 'A'
  554.          BackDropCharacter = 176
  555.          EraseTopWindow
  556.          Return
  557.       endif
  558.       if Select = 'B'
  559.          BackDropCharacter = 177
  560.          EraseTopWindow
  561.          Return
  562.       endif
  563.       if Select = 'C'
  564.          BackDropCharacter = 178
  565.          EraseTopWindow
  566.          Return
  567.       endif
  568.       if Select = 'D'
  569.          BackDropCharacter = 185
  570.          EraseTopWindow
  571.          Return
  572.       endif
  573.       if Select = 'E'
  574.          BackDropCharacter = 32
  575.          EraseTopWindow
  576.       endif
  577.       if Select = F1 then Help
  578.       Select = GetKey
  579.    EndWhile
  580.  
  581.    EraseTopWindow
  582.  
  583. EndProc ;MenuBorderStyle
  584.  
  585. ;---
  586.  
  587. Procedure WhichWindow
  588. Var Select, RC = 0
  589.  
  590.    MakeBox( '', 47, 8, 27, 6, Util)
  591.    Writeln( "  A - Main Menu Window" )
  592.    Writeln( "  B - Title Window" )
  593.    Writeln( "  C - Utility Window" )
  594.    Write  ( "  D - Global Settings" )
  595.    Repeat
  596.       Select = GetKey
  597.       if Select = 'A' Then RC = MMenu
  598.       if Select = 'B' Then RC = Title
  599.       if Select = 'C' Then RC = Util
  600.       if Select = 'D' Then RC = 99
  601.    Until ((Select = Esc) or (Rc > 0))
  602.    EraseTopWindow
  603.    Return RC
  604.  
  605. EndProc  ;WhichWin
  606.  
  607. ;---
  608.  
  609. Procedure Global
  610. Var Select
  611.  
  612.    MakeBox( 'Global', 47, 8, 30, 7, Util)
  613.    Writeln("  A - Menu Title")
  614.    Writeln("  B - Menu Header")
  615.    Writeln("  C - Bottom of screen text")
  616.    Writeln("  D - BackDrop Character")
  617.    Write  ("  E - BackDrop Color")
  618.  
  619.    Repeat
  620.       Select = GetKey
  621.       FileSaved = False
  622.       if Select = 'A'
  623.          MenuTitle = ReadTextLine('Menu Title', MenuTitle, 60, 11)
  624.          if Not (MenuTitle > '') then MenuTitle = 'Your Name Here'
  625.          Trim(MenuTitle)
  626.       endif
  627.       if Select = 'B' then MenuHeader = ReadTextLine('Menu Header', MenuHeader, 30, 11)
  628.       if Select = 'C'
  629.          BottomOfScreenText = ReadTextLine('Bottom of screen text', BottomOfScreenText, 60, 11)
  630.          if Not (BottomOfScreenText > '') Then BottomOfScreenText = CopyrightMsg
  631.       endif
  632.       if Select = 'D' then BackDrop
  633.       if Select = 'E' then ChooseColors (MainScreenForeColor, MainScreenBackColor, 5)
  634.    Until Select = Esc
  635.    EraseTopWindow
  636.  
  637. EndProc ;Global
  638.  
  639. ;---
  640.  
  641. Procedure Setup
  642. Var Select CurrWin TmpBool
  643.  
  644.    CurrWin = WhichWindow
  645.    if CurrWin = 99
  646.       Global
  647.       Return
  648.    endif
  649.    MakeBox( 'Setup', 47, 8, 29, 7, Util)
  650.    Writeln("  A - Colors")
  651.    Writeln("  B - Menu Border Style")
  652.    Writeln("  C - Exploding Windows")
  653.    Writeln("  D - Shadows")
  654.    Write  ("  E - Sound")
  655.  
  656.    Repeat
  657.       Select = GetKey
  658.       FileSaved = False
  659.       if Select = 'A' then Colors (CurrWin)
  660.       if Select = 'B' then MenuBorderStyle (CurrWin)
  661.       if Select = 'C'
  662.          TmpBool = AskYesNo('Use exploding windows ?', 0)
  663.          if CurrWin = MMenu then ExplodeStatus = TmpBool
  664.          if CurrWin = Util  then UtilExplodeStatus = TmpBool
  665.          if CurrWin = Title then TitleExplodeStatus = TmpBool
  666.       endif
  667.       if Select = 'D'
  668.          TmpBool =  AskYesNo('Use window shadowing ?', 0)
  669.          if CurrWin = MMenu then ShadowStatus = TmpBool
  670.          if CurrWin = Util  then UtilShadowStatus = TmpBool
  671.          if CurrWin = Title then TitleShadowStatus = TmpBool
  672.       endif
  673.       if Select = 'E'
  674.          TmpBool = AskYesNo('Use sound effects ?', 0)
  675.          if CurrWin = MMenu then SoundStatus = TmpBool
  676.          if CurrWin = Util  then UtilSoundStatus = TmpBool
  677.          if CurrWin = Title then TitleSoundStatus = Tmpbool
  678.       endif
  679.    Until Select = Esc
  680.    EraseTopWindow
  681.  
  682. EndProc ;Setup
  683.  
  684. ;---
  685.  
  686. Procedure EditUtilities
  687. Var
  688.    Select
  689.  
  690.    MakeBox( 'Utilities', 6, 8, 36, 11, Util)
  691.  
  692.    Writeln("  A - ReScan Subdirectories")
  693.    Writeln("  B - Password to edit menu")
  694.    Writeln("  C - Password to exit to DOS")
  695.    Writeln("  D - Password for DOS Utilities")
  696.    Writeln("  E - Password for Utilites")
  697.    Writeln("  F - View current setup")
  698.    Writeln("  G - Batch File Editor")
  699.    Writeln("  H - Main Screen Setup")
  700.    Write  ("  I - Save Changes")
  701.  
  702.  
  703.    UseArrows On
  704.  
  705.    Select = GetKey
  706.    While Select <> ESC
  707.       if Select = 'A' then ScanDirectories
  708.       if Select = 'B'
  709.          FileSaved = False
  710.          ModifyPassWord = ReadTextLine('PassWord to edit menu', ModifyPassWord, 29, 10)
  711.       endif
  712.       if Select = 'C'
  713.          FileSaved = False
  714.          ExitToDosPassWord = ReadTextLine('PassWord to Exit to DOS',ExitToDosPassWord, 31, 10)
  715.       endif
  716.       if Select = 'D'
  717.          FileSaved = False
  718.          DosUtilPassWord = ReadTextLine('PassWord for Dos Utilities', DosUtilPassWord, 32, 10)
  719.       endif
  720.       if Select = 'E'
  721.          FileSaved = False
  722.          UtilPassWord = ReadTextLine('Password for Utilities', UtilPassWord, 30, 10)
  723.       endif
  724.       if Select = 'F' then ViewCurrentStatus
  725.       if Select = 'G' then BatEditor = ReadTextLine('Bat file Editor', BatEditor, 23, 10)
  726.       if Select = 'H' then Setup
  727.       if Select = 'I' then SaveChanges
  728.       if Select = F1 then Help
  729.       Select = GetKey
  730.    EndWhile
  731.  
  732.    EraseTopWindow
  733.  
  734. EndProc ;EditUtilities
  735.  
  736. ;---
  737.  
  738. { END MENUS }
  739.  
  740.  
  741. { File I/O                }
  742. { Save and Load Menu Data }
  743.  
  744. Procedure LoadData
  745.  
  746.    if MenuName = ''
  747.       MenuName = ReadEnv('MENU')
  748.       if MenuName = '' then MenuName = ExistOnPath('LITE.DAT')
  749.       if MenuName = '' then MenuName = CleanFileName('LITE.DAT')
  750.    endif
  751.  
  752.    if not ExistFile(MenuName)
  753.       InitilizeData
  754.       Return
  755.    endif
  756.  
  757.    FileAssign(In, MenuName)
  758.    FileOpen(In)
  759.  
  760.    VerNo                 = FileReadln(In)
  761.    LongestItem           = Value(FileReadln(In))
  762.    Width                 = Value(FileReadln(In))
  763.    Height                = Value(FileReadln(In))
  764.    MenuTitle             = FileReadln(In)
  765.    ModifyPassWord        = FileReadln(In)
  766.    ExitToDosPassWord     = FileReadln(In)
  767.    ChoicePtr             = Value(FileReadln(In))
  768.    MenuHeader            = FileReadln(In)
  769.    BottomOfScreenText    = FileReadln(In)
  770.    BorderStyle           = Value(FileReadln(In))
  771.    UtilBorderStyle       = Value(FileReadln(In))
  772.    TitleBorderStyle      = Value(FileReadln(In))
  773.    MenuForeColor         = Value(FileReadln(In))
  774.    MenuBackColor         = Value(FileReadln(In))
  775.    MenuBorderForeColor   = Value(FileReadln(In))
  776.    MenuBorderBackColor   = Value(FileReadln(In))
  777.    MenuInverseForeColor  = Value(FileReadln(In))
  778.    MenuInverseBackColor  = Value(FileReadln(In))
  779.    MenuHeaderForeColor   = Value(FileReadln(In))
  780.    MenuHeaderBackColor   = Value(FileReadln(In))
  781.    MainScreenForeColor   = Value(FileReadln(In))
  782.    MainScreenBackColor   = Value(FileReadln(In))
  783.    UtilForeColor         = Value(FileReadln(In))
  784.    UtilBackColor         = Value(FileReadln(In))
  785.    UtilHeaderForeColor   = Value(FileReadln(In))
  786.    UtilHeaderBackColor   = Value(FileReadln(In))
  787.    UtilBorderForeColor   = Value(FileReadln(In))
  788.    UtilBorderBackColor   = Value(FileReadln(In))
  789.    UtilInverseForeColor  = Value(FileReadln(In))
  790.    UtilInverseBackColor  = Value(FileReadln(In))
  791.    TitleForeColor        = Value(FileReadln(In))
  792.    TitleBackColor        = Value(FileReadln(In))
  793.    TitleHeaderForeColor  = Value(FileReadln(In))
  794.    TitleHeaderBackColor  = Value(FileReadln(In))
  795.    TitleBorderForeColor  = Value(FileReadln(In))
  796.    TitleBorderBackColor  = Value(FileReadln(In))
  797.    TitleInverseForeColor = Value(FileReadln(In))
  798.    TitleInverseBackColor = Value(FileReadln(In))
  799.    TitleRow              = Value(FileReadln(In))
  800.    MsgRow                = Value(FileReadln(In))
  801.    ExplodeStatus         = FileReadln(In) = "TRUE"
  802.    ShadowStatus          = FileReadln(In) = "TRUE"
  803.    SoundStatus           = FileReadln(In) = "TRUE"
  804.    UtilExplodeStatus     = FileReadln(In) = "TRUE"
  805.    UtilShadowStatus      = FileReadln(In) = "TRUE"
  806.    UtilSoundStatus       = FileReadln(In) = "TRUE"
  807.    TitleExplodeStatus    = FileReadln(In) = "TRUE"
  808.    TitleShadowStatus     = FileReadln(In) = "TRUE"
  809.    TitleSoundStatus      = FileReadln(In) = "TRUE"
  810.  
  811.    i = 1
  812.    While i <= ChoicePtr
  813.       TmpSt = FileReadln(In)
  814.       Index = Ord(Left(TmpSt,1)) - 64
  815.  
  816.       ScreenArr[i] = TmpSt
  817.  
  818.       Menu[Index].Description = TmpSt
  819.       Menu[Index].InUse       = TRUE
  820.       Menu[Index].Path        = FileReadln(In)
  821.       Menu[Index].name        = FileReadln(In)
  822.       Menu[Index].PassWord    = FileReadln(In)
  823.       Menu[Index].Parameters  = FileReadln(In)
  824.       Menu[Index].Pause       = FileReadln(In) = "TRUE"
  825.  
  826.       i = i + 1
  827.    EndWhile
  828.  
  829.    BatEditor         = FileReadln(In)
  830.    DosUtilPassWord   = FileReadln(In)
  831.    UtilPassWord      = FileReadLn(In)
  832.    BackDropCharacter = Value(FileReadLn(In))
  833.  
  834.   FileClose(In)
  835.  
  836.   SetEnv('MENU=' + MenuName)
  837.  
  838. EndProc ;LoadData
  839.  
  840. ;---
  841.  
  842. Procedure SaveChanges
  843. Var tmparr, i, x, Out
  844.  
  845.    FileSaved = TRUE
  846.    UseArrows Off
  847.  
  848.    MessageBox('','Saving...',60,6)
  849.  
  850.    ReadTextFile(MenuName, tmparr)
  851.  
  852.    UpDate
  853.  
  854.    FileAssign(Out, MenuName)
  855.    FileCreate(Out)
  856.  
  857.    FileWriteln(Out, VerNo)
  858.    FileWriteln(Out, Str(LongestItem))
  859.    FileWriteln(Out, Str(Width))
  860.    FileWriteln(Out, Str(Height))
  861.    FileWriteln(Out, MenuTitle)
  862.    FileWriteln(Out, ModifyPassWord)
  863.    FileWriteln(Out, ExitToDosPassWord)
  864.    FileWriteln(Out, Str(ChoicePtr))
  865.    FileWriteln(Out, MenuHeader)
  866.    FileWriteln(Out, BottomOfScreenText)
  867.    FileWriteln(Out, Str(BorderStyle))
  868.    FileWriteln(Out, Str(UtilBorderStyle))
  869.    FileWriteln(Out, Str(TitleBorderStyle))
  870.    FileWriteln(Out, Str(MenuForeColor))
  871.    FileWriteln(Out, Str(MenuBackColor))
  872.    FileWriteln(Out, Str(MenuBorderForeColor))
  873.    FileWriteln(Out, Str(MenuBorderBackColor))
  874.    FileWriteln(Out, Str(MenuInverseForeColor))
  875.    FileWriteln(Out, Str(MenuInverseBackColor))
  876.    FileWriteln(Out, Str(MenuHeaderForeColor))
  877.    FileWriteln(Out, Str(MenuHeaderBackColor))
  878.    FileWriteln(Out, Str(MainScreenForeColor))
  879.    FileWriteln(Out, Str(MainScreenBackColor))
  880.    FileWriteln(Out, Str(UtilForeColor))
  881.    FileWriteln(Out, Str(UtilBackColor))
  882.    FileWriteln(Out, Str(UtilHeaderForeColor))
  883.    FileWriteln(Out, Str(UtilHeaderBackColor))
  884.    FileWriteln(Out, Str(UtilBorderForeColor))
  885.    FileWriteln(Out, Str(UtilBorderBackColor))
  886.    FileWriteln(Out, Str(UtilInverseForeColor))
  887.    FileWriteln(Out, Str(UtilInverseBackColor))
  888.    FileWriteln(Out, Str(TitleForeColor))
  889.    FileWriteln(Out, Str(TitleBackColor))
  890.    FileWriteln(Out, Str(TitleHeaderForeColor))
  891.    FileWriteln(Out, Str(TitleHeaderBackColor))
  892.    FileWriteln(Out, Str(TitleBorderForeColor))
  893.    FileWriteln(Out, Str(TitleBorderBackColor))
  894.    FileWriteln(Out, Str(TitleInverseForeColor))
  895.    FileWriteln(Out, Str(TitleInverseBackColor))
  896.    FileWriteln(Out, Str(TitleRow))
  897.    FileWriteln(Out, Str(MsgRow))
  898.  
  899.    if ExplodeStatus
  900.       FileWriteln(Out, 'TRUE')
  901.    else
  902.       FileWriteln(Out, 'FALSE')
  903.    endif
  904.  
  905.    if ShadowStatus
  906.       FileWriteln(Out, "TRUE")
  907.    else
  908.       FileWriteln(Out, "FALSE")
  909.    endif
  910.  
  911.    if SoundStatus
  912.       FileWriteln(Out, "TRUE")
  913.    else
  914.       FileWriteln(Out, "FALSE")
  915.    endif
  916.  
  917.    if UtilExplodeStatus
  918.       FileWriteln(Out, 'TRUE')
  919.    else
  920.       FileWriteln(Out, 'FALSE')
  921.    endif
  922.  
  923.    if UtilShadowStatus
  924.       FileWriteln(Out, "TRUE")
  925.    else
  926.       FileWriteln(Out, "FALSE")
  927.    endif
  928.  
  929.    if UtilSoundStatus
  930.       FileWriteln(Out, "TRUE")
  931.    else
  932.       FileWriteln(Out, "FALSE")
  933.    endif
  934.  
  935.    if TitleExplodeStatus
  936.       FileWriteln(Out, 'TRUE')
  937.    else
  938.       FileWriteln(Out, 'FALSE')
  939.    endif
  940.  
  941.    if TitleShadowStatus
  942.       FileWriteln(Out, "TRUE")
  943.    else
  944.       FileWriteln(Out, "FALSE")
  945.    endif
  946.  
  947.    if TitleSoundStatus
  948.       FileWriteln(Out, "TRUE")
  949.    else
  950.       FileWriteln(Out, "FALSE")
  951.    endif
  952.  
  953.    i = 1
  954.    While i <= 27
  955.       if Menu[i].Inuse
  956.          Trim(Menu[I].Description)
  957.          Trim(Menu[I].PassWord)
  958.          FileWriteln(Out, Menu[I].Description)
  959.          FileWriteln(Out, Menu[I].Path)
  960.          FileWriteln(Out, Menu[I].name)
  961.          FileWriteln(Out, Menu[I].PassWord)
  962.          FileWriteln(Out, Menu[I].Parameters)
  963.          if Menu[I].Pause
  964.             FileWriteln(Out, 'TRUE')
  965.          else
  966.             FileWriteln(Out, 'FALSE')
  967.          endif
  968.       endif
  969.       i = i + 1
  970.    EndWhile
  971.  
  972.    FileWriteln(Out, BatEditor)
  973.    FileWriteln(Out, DosUtilPassWord)
  974.    FileWriteln(Out, UtilPassWord)
  975.    FileWriteln(Out, Str(BackDropCharacter))
  976.  
  977.    FileClose(Out)
  978.  
  979.    SetEnv('MENU=' + MenuName)
  980.  
  981.    EraseTopWindow
  982.  
  983.    UseArrows On
  984.  
  985. EndProc ;SaveChanges
  986.  
  987. ;---
  988.  
  989.  
  990. { END of FILE I/O }
  991.  
  992.  
  993.  
  994. { Utilities }
  995.  
  996. Procedure Abort ( ErrMsg )
  997.  
  998.   ClearScreen
  999.   ClearScreenOnExit Off
  1000.   WriteLn("Error :")
  1001.   Writeln( ErrMsg )
  1002.   ExitMenu
  1003.  
  1004. EndProc ;Abort
  1005.  
  1006. ;---
  1007.  
  1008. Procedure AskYesNo (Question, Row)
  1009. var YesNo
  1010.  
  1011.    MakeBox( '',(34 - (Length(Question) / 2)), Row, Length(Question) + 14, 3)
  1012.    UseArrows Off
  1013.    Write ' ',Question,' (Y/N) '
  1014.    YesNo = GetKey
  1015.    YesNo = YesNo = 'Y'
  1016.    if YesNo
  1017.       Write 'Yes'
  1018.    else
  1019.       Write 'No'
  1020.    endif
  1021.    Wait 50
  1022.    EraseTopWindow
  1023.    UseArrows On
  1024.    Return YesNo
  1025.  
  1026. EndProc ;AskYesNo
  1027.  
  1028. ;---
  1029.  
  1030. Procedure ChooseColors (OrigX, OrigY, VType)
  1031. Var X Y Ch
  1032.  
  1033.    UseArrows Off
  1034.    MakeBox( 'Pick Color', 13 , 13, 20, 12)
  1035.    Y = 0
  1036.    While Y < 8
  1037.       X = 0
  1038.       While X < 16
  1039.          if (X = OrigX) and (Y = OrigY)
  1040.             Ch = 254
  1041.          else
  1042.             Ch = 4
  1043.          endif
  1044.  
  1045.          WriteColor(Ch, X, Y)
  1046.  
  1047.          X = X + 1
  1048.       EndWhile
  1049.       Y = Y + 1
  1050.    EndWhile
  1051.  
  1052.    X = OrigX
  1053.    Y = OrigY
  1054.  
  1055.    repeat
  1056.      ; WriteColor(15,X,Y)
  1057.       GotoXY(X + 2, Y + 2)
  1058.       Ch = GetKey
  1059.  
  1060.       if (X = OrigX) and (Y = OrigY)
  1061.          WriteColor(254,X,Y)
  1062.       else
  1063.          WriteColor(4,X,Y)
  1064.       endif
  1065.  
  1066.       if Ch = Char(Larr) then X = ((X + 15) mod 16)
  1067.       if Ch = Char(Rarr) then X = ((X + 1)  mod 16)
  1068.       if Ch = Char(Uarr) then Y = ((Y + 7)  mod 8)
  1069.       if Ch = Char(Darr) then Y = ((Y + 1)  mod 8)
  1070.  
  1071.       if Ch = Esc
  1072.          X = OrigX
  1073.          Y = OrigY
  1074.       endif
  1075.  
  1076.    until ((Ch = Esc) or (Ch = Char(13)))
  1077.    EraseTopWindow
  1078.  
  1079.    if VType = 1
  1080.       MenuForeColor = X
  1081.       MenuBackColor = Y
  1082.    endif
  1083.    if VType = 2
  1084.       MenuBorderForeColor = X
  1085.       MenuBorderBackColor = Y
  1086.    endif
  1087.    if Vtype = 3
  1088.       MenuInverseForeColor = X
  1089.       MenuInverseBackColor = Y
  1090.    endif
  1091.    if Vtype = 4
  1092.       MenuHeaderForeColor = X
  1093.       MenuHeaderBackColor = Y
  1094.    endif
  1095.    if Vtype = 5
  1096.       MainScreenForeColor = X
  1097.       MainScreenBackColor = Y
  1098.    endif
  1099.    if Vtype = 6
  1100.       ClockForeColor = X
  1101.       ClockBackColor = Y
  1102.    endif
  1103.    if Vtype = 9
  1104.       UtilForeColor = X
  1105.       UtilBackColor = Y
  1106.    endif
  1107.    if Vtype = 10
  1108.       UtilBorderForeColor = X
  1109.       UtilBorderBackColor = Y
  1110.    endif
  1111.    if Vtype = 11
  1112.       UtilInverseForeColor = X
  1113.       UtilInverseBackColor = Y
  1114.    endif
  1115.    if Vtype = 12
  1116.       UtilHeaderForeColor = X
  1117.       UtilHeaderBackColor = Y
  1118.    endif
  1119.    if Vtype = 13
  1120.       TitleForeColor = X
  1121.       TitleBackColor = Y
  1122.    endif
  1123.    if Vtype = 14
  1124.       TitleBorderForeColor = X
  1125.       TitleBorderBackColor = Y
  1126.    endif
  1127.    if Vtype = 15
  1128.       TitleInverseForeColor = X
  1129.       TitleInverseBackColor = Y
  1130.    endif
  1131.    if Vtype = 16
  1132.       TitleHeaderForeColor = X
  1133.       TitleHeaderBackColor = Y
  1134.    endif
  1135.  
  1136.    UseArrows On
  1137.  
  1138. EndProc ;ChooseColors
  1139.  
  1140. ;---
  1141.  
  1142. Procedure ChooseDirectory
  1143. var BoxDim SubChoice OldPath
  1144.  
  1145.    if ExistOnPath( 'PD.EXE' ) > ''
  1146.       OldPath = Path
  1147.       ClearScreenFirst Off
  1148.       PauseAfterExecute Off
  1149.       Execute( 'PD.EXE /E' )
  1150.       ClearScreenFirst
  1151.       SubChoice = Path
  1152.       ChDir( OldPath )
  1153.       Return SubChoice
  1154.    endif
  1155.    ReadDirectories
  1156.    if TotalSubs > 1
  1157.       BoxDim[3] = Min(LongestSubLine + 6,ScreenWidth - 6)
  1158.       BoxDim[4] = Min(TotalSubs + 2,ScreenHeight - 6)
  1159.       BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1)
  1160.       BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),4)
  1161.       MakeBox( '', BoxDim[1], BoxDim[2], BoxDim[3], BoxDim[4])
  1162.       SubChoice = PickOne Subs
  1163.       EraseTopWindow
  1164.    endif
  1165.    if TotalSubs = 1 then SubChoice = Subs[1]
  1166.    Return SubChoice
  1167.  
  1168. EndProc ;ChooseDirectory
  1169.  
  1170. ;---
  1171.  
  1172. Procedure ChooseProgram (SubDir)
  1173. var BoxDim Progs ProgChoice TotalProgs LongestProgLine TmpSt
  1174.  
  1175.    TmpSt = ' D ' + SubDir + ' /F/R/O > PROGS.PIC'
  1176.    MessageBox( '', 'Scanning Programs', 35,0)
  1177.    ClearScreenFirst Off
  1178.    UseCommand On
  1179.    Execute TmpSt
  1180.    ReadTextFile 'PROGS.PIC' Progs
  1181.    DelFile 'PROGS.PIC'
  1182.    TotalProgs = NumberOfElements(Progs)
  1183.    LongestProgLine = LongestLine
  1184.    EraseTopWindow
  1185.    if TotalProgs > 0
  1186.       BoxDim[3] = Min(LongestProgLine + 6,ScreenWidth - 6)
  1187.       BoxDim[4] = Min(TotalProgs + 2,ScreenHeight - 4)
  1188.       BoxDim[1] = Max(Min(45,ScreenWidth - BoxDim[3]),1)
  1189.       BoxDim[2] = Max(Min(7,ScreenHeight - BoxDim[4]),4)
  1190.       DrawBox BoxDim[1] BoxDim[2] BoxDim[3] BoxDim[4]
  1191.       ProgChoice = PickOne Progs
  1192.       EraseTopWindow
  1193.    endif
  1194.    Return ProgChoice
  1195.  
  1196. EndProc ;ChooseProgram
  1197.  
  1198. ;---
  1199.  
  1200. Procedure EditBat
  1201. Var %Exec
  1202.  
  1203.    ClearScreenOnExit On
  1204.    ClearScreenFirst  On
  1205.  
  1206.    {Check to See if user has already specified bat file }
  1207.    if Not (Right(Menu[Index].Name, 3) = "BAT")
  1208.       Menu[Index].Name = UpperCase(ReadTextLine('Enter BAT File Name', Menu[Index].Name, 50, 16))
  1209.    endif
  1210.  
  1211.    if LastKey <> Esc
  1212.       %Exec = BatEditor + " " + Menu[Index].Name
  1213.       Execute(%Exec)
  1214.    endif
  1215.  
  1216. EndProc ;EditBat
  1217.  
  1218. ;---
  1219.  
  1220. Procedure EnterPassWord (pass, row)
  1221. Var LY TX RY BX TmpSt
  1222.  
  1223.    Trim(Pass)
  1224.    if Not (Length(pass)  > 0) then Return true
  1225.  
  1226.    Security On
  1227.    if Length(pass) < 20
  1228.       RY = 21
  1229.    else
  1230.       RY = Length(pass) + 1
  1231.    endif
  1232.  
  1233.    TX = 6
  1234.    LY = 3
  1235.    BX = 3
  1236.  
  1237.    MakeBox( 'PassWord', LY, TX, RY, BX, Util)
  1238.    Write ' '
  1239.    TmpSt = Readln
  1240.  
  1241.    Security Off
  1242.  
  1243.    EraseTopWindow
  1244.  
  1245.    if TmpSt = pass
  1246.       Return True
  1247.    else
  1248.       Return False
  1249.    endif
  1250.  
  1251. EndProc ;EnterPassWord
  1252.  
  1253. ;---
  1254.  
  1255.  
  1256. Procedure Error (ErrMsg)
  1257.   BoxHeaderColor White Blue
  1258.   BoxBorderColor White Red
  1259.   BoxInsideColor White Red
  1260.   BoxHeader = " Error "
  1261.   DoubleLineBox
  1262.   DrawBox (80 - Length(ErrMsg) /2) 10 (Length(ErrMsg) + 4) 3
  1263.   WriteCenter (ErrMsg)
  1264.   Write(char(7))
  1265.   Wait(250)
  1266.   EraseTopWindow
  1267.   SingleLineBox
  1268. EndProc ;Error
  1269.  
  1270. ;---
  1271.  
  1272. Procedure MainColors
  1273.  
  1274.    Explode ExplodeStatus
  1275.    Sound   SoundStatus
  1276.    Shadow  ShadowStatus
  1277.  
  1278.    if BorderStyle = None   then NoBoxBorder
  1279.    if BorderStyle = Single then SingleLineBox
  1280.    if BorderStyle = Double then DoubleLineBox
  1281.    if BorderStyle = Block  then BlockBox
  1282.  
  1283.    InverseColor   MenuInverseForeColor MenuInverseBackColor
  1284.    BoxHeaderColor MenuHeaderForeColor  MenuHeaderBackColor
  1285.    BoxInsideColor MenuForeColor        MenuBackColor
  1286.    BoxBorderColor MenuBorderForeColor  MenuBorderBackColor
  1287.  
  1288. EndProc ;MainColors
  1289.  
  1290. ;---
  1291.  
  1292. Procedure UtilColors
  1293.  
  1294.    Explode UtilExplodeStatus
  1295.    Sound   UtilSoundStatus
  1296.    Shadow  UtilShadowStatus
  1297.  
  1298.    if UtilBorderStyle = None   then NoBoxBorder
  1299.    if UtilBorderStyle = Single then SingleLineBox
  1300.    if UtilBorderStyle = Double then DoubleLineBox
  1301.    if UtilBorderStyle = Block  then BlockBox
  1302.  
  1303.    InverseColor   UtilInverseForeColor UtilInverseBackColor
  1304.    BoxHeaderColor UtilHeaderForeColor  UtilHeaderBackColor
  1305.    BoxInsideColor UtilForeColor        UtilBackColor
  1306.    BoxBorderColor UtilBorderForeColor  UtilBorderBackColor
  1307.  
  1308. EndProc ;UtilColors
  1309.  
  1310. ;---
  1311.  
  1312. Procedure TitleColors
  1313.  
  1314.    Explode TitleExplodeStatus
  1315.    Sound   TitleSoundStatus
  1316.    Shadow  TitleShadowStatus
  1317.  
  1318.    if TitleBorderStyle = None   then NoBoxBorder
  1319.    if TitleBorderStyle = Single then SingleLineBox
  1320.    if TitleBorderStyle = Double then DoubleLineBox
  1321.    if TitleBorderStyle = Block  then BlockBox
  1322.  
  1323.    InverseColor   TitleInverseForeColor  TitleInverseBackColor
  1324.    BoxHeaderColor TitleHeaderForeColor   TitleHeaderBackColor
  1325.    BoxInsideColor TitleForeColor         TitleBackColor
  1326.    BoxBorderColor TitleBorderForeColor   TitleBorderBackColor
  1327.  
  1328. EndProc ;TitleColors
  1329.  
  1330. ;---
  1331.  
  1332. Procedure MakeBox(Header, Col, Row, Wid, Depth, ColorSet)
  1333.  
  1334.    {0 for Col will center box horizontaly}
  1335.    if Col = 0 then Col = (80 - (Wid - 2)) /2
  1336.    {0 for Row will center box vertically}
  1337.    if Row = 0 then Row = ((25 - Depth) /2) + 1
  1338.  
  1339.    if Header > '' then BoxHeader = Char(221) + ' ' + Header + ' ' + char(222)
  1340.  
  1341.    if ColorSet = MMenu
  1342.       MainColors
  1343.    else
  1344.       if ColorSet = Util
  1345.          UtilColors
  1346.       else
  1347.           if ColorSet = Title
  1348.              TitleColors
  1349.           endif
  1350.       endif
  1351.    endif
  1352.  
  1353.    DrawBox(Col, Row, Wid, Depth)
  1354.  
  1355. EndProc ;MakeBox
  1356.  
  1357. ;---
  1358.  
  1359. Procedure MessageBox(Header, Message, Col, Row)
  1360.  
  1361.    MakeBox(Header, Col, Row, (Length(Message) + 4), 3, Util)
  1362.    WriteCenter(Message)
  1363.  
  1364. EndProc ;MessageBox
  1365.  
  1366. ;---
  1367.  
  1368. Procedure ReadTextLine (Header, Suggestion, MaxAnswerLength, Row)
  1369. var St
  1370.  
  1371.    Trim(Header)
  1372.    MakeBox( Header, 0, Row, (MaxAnswerLength + 2), 3, Util)
  1373.    Write ' '
  1374.    Cursor
  1375.    InputString = Suggestion
  1376.    St = Readln
  1377.    EraseTopWindow
  1378.    if LastKey <> Char(13)
  1379.       Return Suggestion
  1380.    else
  1381.       Return St
  1382.    endif
  1383.  
  1384. EndProc ;ReadTextLine
  1385.  
  1386. ;---
  1387.  
  1388. Procedure RedrawSelections
  1389. Var x
  1390.  
  1391.    MakeBox( 'Edit', 0, 6, 78, 15, Util)
  1392.    UseArrows On
  1393.  
  1394.    x = 1
  1395.    While x < 14
  1396.       GotoXY(1, x)
  1397.       if Menu[x].InUse
  1398.          Write('  ',Menu[x].Description)
  1399.       else
  1400.          Write("  " , Char(x + 64) , " - ")
  1401.       endif
  1402.       GotoXY(39,x)
  1403.       if Menu[x + 13].InUse
  1404.          Write(Menu[x + 13].Description)
  1405.       else
  1406.          Write(Char(x + 77) , " - ")
  1407.       endif
  1408.       x = x + 1
  1409.    EndWhile
  1410.  
  1411. EndProc ;RedrawSelections
  1412.  
  1413. ;---
  1414.  
  1415. Procedure Update
  1416.  
  1417.    ChoicePtr = 0
  1418.    LongestItem = 0
  1419.    I = 1
  1420.    While I < 27
  1421.       if Menu[I].InUse
  1422.          ChoicePtr = ChoicePtr + 1
  1423.          if Length(Menu[I].Description) > LongestItem
  1424.             LongestItem = Length(Menu[I].Description)
  1425.          endif
  1426.          ScreenArr[ChoicePtr] = Menu[I].Description
  1427.       endif
  1428.       I = I + 1
  1429.    EndWhile
  1430.  
  1431.    if ChoicePtr < 10
  1432.       Height = ChoicePtr + 2
  1433.       Width  = LongestItem + 6
  1434.    else
  1435.       Height = (((ChoicePtr / 2) + (ChoicePtr Mod 2)) + 2)
  1436.       Width  = (LongestItem * 2) + 8
  1437.    endif
  1438.    TitleRow = (((25 - Height) / 2) - 3)
  1439.    MsgRow = ((TitleRow + 5) + Height)
  1440.  
  1441. EndProc ;Update
  1442.  
  1443. ;---
  1444.  
  1445. Procedure WriteColor (Ch, X, Y)
  1446.  
  1447.    TextColor(X, Y)
  1448.    GotoXY(X + 2, Y + 2)
  1449.    Write(Char(Ch))
  1450.  
  1451. EndProc ;WriteColor
  1452.  
  1453. ;---
  1454.  
  1455. Procedure WriteStatus (Msg, Row)
  1456.  
  1457.    GotoXY(1, Row)
  1458.    Write(Msg)
  1459.    GotoXY(67, Row)
  1460.    Write("]")
  1461.  
  1462. EndProc ;WriteStatus
  1463.  
  1464. ;---
  1465.  
  1466. { ENd of Utilites }
  1467.  
  1468.  
  1469.  
  1470. { Support Routines }
  1471.  
  1472. Procedure BuildBat (Num)
  1473. Var
  1474.    B, I, Ptr, FP
  1475.  
  1476.    if Not FileSaved
  1477.       if AskYesNo("Menu not saved! Save Changes?", 0) then SaveChanges
  1478.    endif
  1479.  
  1480.    if EnterPassWord (Menu[Num].PassWord, 19)
  1481.       if left(Menu[Num].Name,1) = '^'
  1482.          ClearScreenFirst Off
  1483.          ClearScreenOnExit Off
  1484.          B = 'SET MENU=' + Right(Menu[Num].Name, Length(Menu[Num].Name) - 1)
  1485.          Bat(B)
  1486.          Bat('MARX LEVEL2')
  1487.          Exitmenu
  1488.       endif
  1489.       Bat ('CD ' + Menu[Num].Path)
  1490.       B = Menu[Num].Name + " " + Menu[Num].Parameters
  1491.       Bat(B)
  1492.       if Menu[Num].Pause Then Bat("Pause")
  1493.       B = %ThisDrive
  1494.       Bat(B)
  1495.       B = "CD " + %ThisDirectory
  1496.       Bat(B)
  1497.       ExitMenu
  1498.    endif
  1499.  
  1500. EndProc ;BuildBat
  1501.  
  1502. ;---
  1503.  
  1504. Procedure DrawTop
  1505.  
  1506.    ClockPos 0, 0
  1507.  
  1508.    TextColor MainScreenForeColor MainScreenBackColor
  1509.    if ColorScreen
  1510.       ClearScreen BackDropCharacter
  1511.    else
  1512.       ClearScreen BackDropCharacter
  1513.    endif
  1514.    TextColor UtilForeColor UtilBackColor
  1515.  
  1516.    MakeBox( '', 1, 1, 80, 4, Title)
  1517.    ClockColor TitleForeColor TitleBackColor
  1518.    ClockPos 3, 2
  1519.    GotoXY 53, 1
  1520.    Write(ProgramName, Version)
  1521.    Writeln
  1522.    WriteCenter(MenuTitle)
  1523.  
  1524. EndProc ;DrawTop
  1525.  
  1526. ;---
  1527.  
  1528. Procedure DrawBottom (s)
  1529.  
  1530.    MakeBox( '', 1, 22, 80, 4, Title)
  1531.    WriteCenter(s)
  1532.    Writeln
  1533.    WriteCenter BottomOfScreenText
  1534.  
  1535. EndProc ;DrawBottom
  1536.  
  1537. ;---
  1538.  
  1539. Procedure Draw
  1540. Var
  1541.    I, J, Indent
  1542.  
  1543.    MainColors
  1544.  
  1545.    MakeBox( MenuHeader, 0, 0, Width, Height, MMenu)
  1546.  
  1547.    if ChoicePtr < 10
  1548.       I = 1
  1549.       While I < ChoicePtr
  1550.          Writeln('  ', ScreenArr[I])
  1551.          I = I + 1
  1552.       EndWhile
  1553.       Write('  ', ScreenArr[I])
  1554.    else
  1555.       I = 1
  1556.       J = ChoicePtr + 1 / 2 + 1
  1557.       Indent = LongestItem + 5
  1558.  
  1559.       While I <= (ChoicePtr + 1 / 2)
  1560.          Write '  ' ScreenArr[I]
  1561.          GotoXY(Indent,I)
  1562.          Write ScreenArr[J]
  1563.          if I <> (ChoicePtr + 1 / 2) then Writeln
  1564.          I = I + 1
  1565.          J = J + 1
  1566.       EndWhile
  1567.    endif
  1568.  
  1569.    UseArrows On
  1570.  
  1571. EndProc ;Draw
  1572.  
  1573. ;---
  1574.  
  1575. Procedure Help
  1576. Var Key HelpFile
  1577.  
  1578.    UseArrows Off
  1579.    HelpFile = ExistOnPath 'LITE.HLP'
  1580.    if HelpFile > ''
  1581.       MakeBox( '* Help *', 5, 8, 70, 12, Util)
  1582.       ViewTextFile HelpFile
  1583.    else
  1584.       KeyHelp
  1585.    endif
  1586.  
  1587.    UseArrows On
  1588.  
  1589. EndProc ;Help
  1590.  
  1591. ;---
  1592.  
  1593. Procedure InitilizeData
  1594.  
  1595.    VerNo                 = Version
  1596.    ChoicePtr             = 0
  1597.    Width                 = 25
  1598.    Height                = 3
  1599.    ExplodeStatus         = False
  1600.    ShadowStatus          = False
  1601.    SoundStatus           = False
  1602.    TitleExplodeStatus    = False
  1603.    TitleShadowStatus     = False
  1604.    TitleSoundStatus      = False
  1605.    UtilExplodeStatus     = False
  1606.    UtilShadowStatus      = False
  1607.    UtilSoundStatus       = False
  1608.    BorderStyle           = Block
  1609.    TitleBorderStyle      = Block
  1610.    UtilBorderStyle       = Block
  1611.    BottomOfScreenText    = CopyRightMsg
  1612.    MenuHeader            = ''
  1613.    MenuTitle             = 'Your Company Title Here'
  1614.    ModifyPassWord        = ''
  1615.    ExitToDosPassWord     = ''
  1616.    DosUtilPassWord       = ''
  1617.    UtilPassWord          = ''
  1618.    BorderStyle           = Block
  1619.    MenuForeColor         = Grey
  1620.    MenuBackColor         = Blue
  1621.    MenuBorderForeColor   = Cyan
  1622.    MenuBorderBackColor   = Blue
  1623.    MenuInverseForeColor  = Yellow
  1624.    MenuInverseBackColor  = Mag
  1625.    MenuHeaderForeColor   = White
  1626.    MenuHeaderBackColor   = Mag
  1627.    MainScreenForeColor   = Red
  1628.    MainScreenBackColor   = Blue
  1629.    UtilForeColor         = Yellow
  1630.    UtilBackColor         = Brown
  1631.    UtilBorderForeColor   = LRed
  1632.    UtilBorderBackColor   = Brown
  1633.    UtilInverseForeColor  = White
  1634.    UtilInverseBackColor  = Green
  1635.    UtilHeaderForeColor   = Yellow
  1636.    UtilHeaderBackColor   = Mag
  1637.    TitleForeColor        = Yellow
  1638.    TitleBackColor        = Brown
  1639.    TitleBorderForeColor  = Green
  1640.    TitleBorderBackColor  = Brown
  1641.    TitleInverseForeColor = Yellow
  1642.    TitleInverseBackColor = Red
  1643.    TitleHeaderForeColor  = White
  1644.    TitleHeaderBackColor  = Mag
  1645.    TitleRow              = 3
  1646.    MsgRow                = 20
  1647.    BatEditor             = 'me.exe'
  1648.    BackDropCharacter     = 178
  1649.    ConBlankTime          = 3
  1650.    ConLockWord           = ''
  1651.    ConBlankMessage       = ""
  1652.  
  1653. EndProc ;InitilizeData
  1654.  
  1655. ;---
  1656.  
  1657. Procedure Format2 (%Parm)
  1658. Var Select
  1659.  
  1660.    MakeBox( 'Drive', 55, 14, 11, 4, Util)
  1661.    Writeln '   A:'
  1662.    Write   '   B:'
  1663.  
  1664.    Select = GetKey
  1665.    while Select <> ESC
  1666.       if Select = 'A'
  1667.          Execute('FORMAT A: ' + %Parm)
  1668.          EraseTopWindow
  1669.          Return
  1670.       endif
  1671.       if Select = 'B'
  1672.          Execute('Format B: ' + %Parm)
  1673.          EraseTopWindow
  1674.          Return
  1675.       endif
  1676.       Select = GetKey
  1677.    EndWhile
  1678.  
  1679.    EraseTopWindow
  1680.  
  1681. EndProc ; Format
  1682.  
  1683. ;---
  1684.  
  1685. Procedure Leave
  1686.  
  1687.    if Not FileSaved
  1688.       if AskYesNo("Menu not saved! Save Changes?", 0)
  1689.          SaveChanges
  1690.       endif
  1691.    endif
  1692.  
  1693.    if ExitToDosPassWord > ''
  1694.       if EnterPassWord (ExitToDosPassWord, 19) then ExitMenu
  1695.    else
  1696.       if AskYesNo('Exit to DOS?', 0) then ExitMenu
  1697.    endif
  1698.  
  1699. EndProc ;Leave
  1700.  
  1701. ;---
  1702.  
  1703. Procedure ModifyMenuChoice (choice)
  1704. Var Select NewChoice Response
  1705.  
  1706.    FileSaved = False
  1707.  
  1708.    Index = ord(choice) - 64
  1709.    if Not Menu[index].InUse
  1710.       Menu[index].Description = ''
  1711.       Menu[index].Path        = ''
  1712.       Menu[index].Name        = ''
  1713.       Menu[index].Password    = ''
  1714.       Menu[index].Parameters  = ''
  1715.       Menu[index].Pause       = False
  1716.    endif
  1717.  
  1718.    if Index < 14
  1719.       MakeBox( 'Edit Menu Item', 46, 8, 26, 6, Util)
  1720.    else
  1721.       MakeBox( 'Edit Menu Item', 9, 8, 26, 6, Util)
  1722.    endif
  1723.    Writeln("  A - Screen Text")
  1724.    Writeln("  B - Program")
  1725.    Writeln("  C - Delete choice")
  1726.    Write  ("  D - Advanced Options")
  1727.  
  1728.    UseArrows On
  1729.  
  1730.    Select = GetKey
  1731.    While Select <> ESC
  1732.       if Select = 'A'
  1733.          FileSaved = False
  1734.          if Not Menu[Index].Inuse
  1735.             NewChoice = True
  1736.          else
  1737.             NewChoice = False
  1738.          endif
  1739.          Response = Menu[Index].Description
  1740.          Delete(Response,1,4)
  1741.          Response = ReadTextLine('Screen Text', Response, 30, 10)
  1742.          Trim(Response)
  1743.          Menu[Index].Description = Choice + " - " + Response
  1744.          if Response > ''
  1745.             Menu[Index].InUse = True
  1746.             if (Length(Menu[Index].Description) > LongestItem)
  1747.                LongestItem = Length(Menu[Index].Description)
  1748.             endif
  1749.             if NewChoice
  1750.                Menu[Index].Path = ChooseDirectory
  1751.                if Length(Menu[Index].Path) > 0
  1752.                   Menu[Index].Name = ChooseProgram (Menu[Index].Path)
  1753.                endif
  1754.             endif
  1755.          else
  1756.             Menu[Index].InUse = False
  1757.          endif
  1758.       endif
  1759.       if Select = 'B'
  1760.          FileSaved = False
  1761.          Menu[Index].Path = ChooseDirectory
  1762.          if Length(Menu[Index].Path) > 0
  1763.             Menu[Index].Name = ChooseProgram (Menu[Index].Path)
  1764.          endif
  1765.       endif
  1766.       if Select = 'C'
  1767.          if AskYesNo('Are you sure?', 0)
  1768.             FileSaved = False
  1769.             Menu[Index].InUse = False
  1770.             Menu[index].Description = ''
  1771.             Menu[index].Path        = ''
  1772.             Menu[index].Name        = ''
  1773.             Menu[index].Password    = ''
  1774.             Menu[index].Parameters  = ''
  1775.             Menu[index].Pause       = False
  1776.             EraseTopWindow
  1777.             Return
  1778.          endif
  1779.       endif
  1780.       if Select = 'D' then AdvancedOptions
  1781.       Select = GetKey
  1782.    EndWhile
  1783.  
  1784.    EraseTopWindow
  1785.  
  1786. EndProc ; Modify
  1787.  
  1788. ;---
  1789.  
  1790. Procedure NoChoices
  1791. Var Select
  1792.  
  1793.    FileSaved = False
  1794.  
  1795.    MakeBox( '', 0, 0, 50, 8, MMenu)
  1796.    WriteCenter('You have no menu choices available!')
  1797.    Writeln
  1798.    Writeln
  1799.    WriteCenter('Press F10 to setup your menu.')
  1800.    Writeln
  1801.    Writeln
  1802.    WriteCenter('Press ESC to exit to DOS.')
  1803.  
  1804.    UseArrows Off
  1805.    Select = ReadKey
  1806.  
  1807.    While (Select <> F10) or (Select <> ESC)
  1808.       if Select = F10
  1809.          EraseTopWindow
  1810.          Edit
  1811.          Return
  1812.       endif
  1813.       if Select = ESC then Exitmenu
  1814.       Select = ReadKey
  1815.    EndWhile
  1816.  
  1817.    EraseTopWindow
  1818.  
  1819. EndProc ;NoChoices
  1820.  
  1821. ;---
  1822.  
  1823. Procedure UpdateScreen
  1824.  
  1825.    EraseTopWindow
  1826.    EraseTopWindow
  1827.    EraseTopwindow
  1828.    DrawTop
  1829.    DrawBottom ('F1 - Help * ? - Mini Help')
  1830.    Draw
  1831.  
  1832. EndProc ;UpdateScreen
  1833.  
  1834. ;---
  1835.  
  1836. Procedure ViewCurrentStatus
  1837. Var Key
  1838.  
  1839.    UseArrows Off
  1840.  
  1841.    MakeBox('Current Status', 0, 8, 70, 8, Util)
  1842.  
  1843.    WriteStatus(" Password to edit menu...................[" + ModifyPassWord, 1)
  1844.    WriteStatus(" Password to exit to DOS.................[" + ExitToDosPassWord,2)
  1845.    WriteStatus(" Password for DOS utilities..............[" + DosUtilPassWord,3)
  1846.    WriteStatus(" Batch File Editor.................................[" + BatEditor,4)
  1847.    Writeln
  1848.    Writeln
  1849.    WriteCenter("<*> Press any key to continue <*>")
  1850.  
  1851.    Key = GetKey
  1852.  
  1853.    EraseTopWindow
  1854.  
  1855.    UseArrows ON
  1856.  
  1857. EndProc ;ViewCurrentStatus
  1858.  
  1859. ;---
  1860.  
  1861. Procedure GetKey
  1862. Var Tmp
  1863.    Repeat
  1864.       Tmp = UpperCase(ReadKey)
  1865.       if Tmp = '?'   then KeyHelp
  1866.       if Tmp = F1
  1867.          Help
  1868.       else
  1869.          if (Tmp = F2)
  1870.             SaveChanges
  1871.             if MMActive
  1872.                EraseTopWindow
  1873.                Draw
  1874.             endif
  1875.          else
  1876.             if Tmp = (Char(0) + '-')
  1877.                if EnterPassWord(ExitToDosPassWord, 6)
  1878.                   ExitMenu
  1879.                else
  1880.                   if MMActive
  1881.                      EraseTopWindow
  1882.                      Draw
  1883.                   endif
  1884.                endif
  1885.             else
  1886.                Return Tmp
  1887.             endif
  1888.          endif
  1889.       endif
  1890.       Tmp = ''
  1891.    Until Tmp > ''
  1892.  
  1893. EndProc
  1894.  
  1895. ;---
  1896.  
  1897. Procedure KeyHelp
  1898.  
  1899.    MakeBox(' Mini Help ', 0, 0, 31, 14, Util)
  1900.  
  1901.    Writeln
  1902.    Writeln('  F1    | Help')
  1903.    Writeln('  F2    | Save')
  1904.    Writeln('  F3    | Dos Utilities')
  1905.    Writeln('  F4    | Menu Utilities')
  1906.    Writeln('  F10   | Modify Menu')
  1907.    Writeln('  Alt S | Screen Setup')
  1908.    Writeln('  Alt X | Immediate Exit')
  1909.    Writeln('  ?     | This help screen')
  1910.    Writeln
  1911.    Write  ('   <*> Press any key <*>')
  1912.  
  1913.    WaitOrKbdReady (4500)
  1914.  
  1915.    EraseTopWindow
  1916.  
  1917.    if MMActive
  1918.       EraseTopWindow
  1919.       Draw
  1920.    endif
  1921.  
  1922. EndProc ;KeyHelp
  1923.  
  1924.  
  1925. Procedure Initialize
  1926. var BatFile MenuPath BatName
  1927.    if pos('MARXMENU',ParamStr(0)) > 0 then return
  1928.    if ParamStr(2) <> 'RUN.BAT'
  1929.       if ExistOnPath 'MENU.BAT' = ''
  1930.          MenuPath = PathPart(ParamStr(0))
  1931.          BatName = CleanFileName(MenuPath + '\' + 'MENU.BAT')
  1932.          FileAssign(BatFile,BatName)
  1933.          FileCreate(BatFile)
  1934.          if DosVersionString >= '3.30
  1935.             FileWriteln(BatFile,'@ECHO OFF')
  1936.          else
  1937.             FileWriteln(BatFile,'ECHO OFF')
  1938.          endif
  1939.          FileWriteln(BatFile,ParamStr(0) + ' RUN.BAT')
  1940.          FileWriteln(BatFile,'IF ERRORLEVEL 253 GOTO E')
  1941.          if DosVersionString >= '3.30
  1942.             FileWriteln(BatFile,'CALL RUN')
  1943.          else
  1944.             FileWriteln(BatFile,'COMMAND /C RUN')
  1945.          endif
  1946.          FileWriteln(BatFile,BatName)
  1947.          FileWriteln(BatFile,':E')
  1948.          FileClose(BatFile)
  1949.       endif
  1950.       StuffKBD = 'MENU' + CR
  1951.       exitmenu
  1952.    endif
  1953. EndProc
  1954.  
  1955.