home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT070.ZIP / MENUS.EXE / QUICK.MNU < prev    next >
Text File  |  1991-03-31  |  10KB  |  439 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Copyright 1990-91 by Marc Perkel * All right reserved.
  5.  
  6. This file is a quick menu system for you to get going with MarxMenu
  7. quickly and esilly. It is written not only to be useful to us but to be
  8. an example of what can be done with MarxMenu.
  9.  
  10. =========================================================
  11. EndComment
  12.  
  13. ;------ Create Variables
  14.  
  15. Var
  16.   VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"
  17.   VertLine2 = "││││││││││││││││││││"
  18.   VertLine3 = "┌─┴┴┴┴─┐"
  19.   VertLine4 = "└─┬┬┬┬─┘"
  20.   MainChoices
  21.   DosChoices
  22.   AppChoices
  23.   MenuChoices
  24.   TitleBackColor
  25.   TitleInsideColor
  26.   BottomMessage
  27.   TopMessage
  28.  
  29. ;------ Personalize Your Screen Messages
  30.  
  31. BottomMessage = '*-<< Acme Manufacturing Company >>-*'
  32. TopMessage    = "Joe Blow's Master Menu"
  33.  
  34. LockWord = ''        ;locks keyboard
  35. BlankTime = 10       ;blank screen time
  36. BlankMessage = ''    ;message for screen blanker
  37.  
  38. ;------ Select colors and prepare screen
  39.  
  40. SavePosition
  41. OnScreenOnly
  42. TitleBackColor = Brown
  43. TitleInsideColor = Yellow
  44. if ColorScreen
  45.    TextColor Cyan Blue
  46.    ClearScreen 176
  47.    GotoXY 1 25
  48.    TextColor Yellow Mag
  49.    ClearLine
  50.    WriteCenter BottomMessage
  51.    TextColor Blue Green
  52.    GotoXY 4,4
  53.    WriteVertical VertLine2
  54.    GotoXY 5,4
  55.    WriteVertical VertLine2
  56.    GotoXY 6,4
  57.    WriteVertical VertLine2
  58.    GotoXY 7,4
  59.    WriteVertical VertLine2
  60.    GotoXY 74,4
  61.    WriteVertical VertLine2
  62.    GotoXY 75,4
  63.    WriteVertical VertLine2
  64.    GotoXY 76,4
  65.    WriteVertical VertLine2
  66.    GotoXY 77,4
  67.    WriteVertical VertLine2
  68.    GotoXY 2,4
  69.    Write VertLine4
  70.    GotoXY 72,4
  71.    Write VertLine4
  72.    GotoXY 2,24
  73.    Write VertLine3
  74.    GotoXY 72,24
  75.    Write VertLine3
  76.    BoxBorderColor White TitleBackColor
  77.    BoxInsideColor TitleInsideColor TitleBackColor
  78.    ClockColor TitleInsideColor TitleBackColor
  79.    TextColor TitleInsideColor TitleBackColor
  80. else
  81.    ClearScreen 176
  82.    TextColor Black Grey
  83.    GotoXY 1 25
  84.    ClearLine
  85.    ClearLine
  86.    WriteCenter BottomMessage
  87.    BoxBorderColor Black Grey
  88.    BoxInsideColor Black Grey
  89.    ClockColor Black Grey
  90. endif
  91. SingleLineBox
  92. Explode Off
  93. DrawBox 1 1 80 3
  94. GotoXY (77 - length(TopMessage),1)
  95. Write TopMessage
  96. ClockPos 3 2
  97. DoubleLineBox
  98. ResetColors
  99.  
  100. UseArrows
  101.  
  102. Comment
  103. ==========================================================
  104.  
  105. I have defined a couple of procedures called CenterStretchWindow and
  106. CornerStretchWindow which takes as parameters a menu title, array of
  107. choices, and the XY coordinants of the center of the window. It then
  108. displays all the choices and numbers them. This method allows you to
  109. update the menu more quickly.
  110.  
  111. ==========================================================
  112. EndComment
  113.  
  114. ;----- Main Menu
  115.  
  116. MainChoices[1]  = 'Applications Menu'
  117. MainChoices[2]  = 'Dos Menu'
  118. MainChoices[3]  = 'Format Disk Menu'
  119. MainChoices[4]  = 'Dos Command Line'
  120. MainChoices[5]  = 'Menu Utilities'
  121.  
  122. CornerStretchWindow ('Main Menu',MainChoices,11,6)
  123.  
  124. OnKey 'A'
  125.   ^Apps
  126.  
  127. OnKey 'B'
  128.   ^Dos
  129.  
  130. OnKey 'C'
  131.   |SelectFormat
  132.   |LastKey = ' '
  133.  
  134. OnKey 'D'
  135.   |if ExistOnPath('DOLIST.EXE') > ''
  136.      DropTo DoList
  137.   |else
  138.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  139.   |endif
  140.  
  141. OnKey 'E'
  142.   ^MenuUtils
  143.  
  144. OnKey Esc
  145.    ^Leave
  146.  
  147. ;----- Applications Menu
  148.  
  149. :Apps
  150.  
  151. AppChoices[1] = 'Word Processing'
  152. AppChoices[2] = 'Database'
  153. AppChoices[3] = 'Accounting'
  154. AppChoices[4] = 'Communications'
  155. AppChoices[5] = 'Time Manager'
  156.  
  157. CornerStretchWindow ('Apps Menu',AppChoices,43,6)
  158.  
  159. OnKey 'A'
  160.  
  161. OnKey 'B'
  162.  
  163. OnKey 'C'
  164.  
  165. OnKey 'D'
  166.  
  167. OnKey 'E'
  168.  
  169. ;----- Dos Menu
  170.  
  171. :Dos
  172.  
  173. DosChoices[1] = 'Memory Map'
  174. DosChoices[2] = 'Free Space'
  175. DosChoices[3] = 'Show Directory'
  176. DosChoices[4] = 'Pick Directory'
  177. DosChoices[5] = 'Directory Master'
  178. DosChoices[6] = 'Backup Hard Disk'
  179. DosChoices[7] = 'Run a Program'
  180.  
  181. CornerStretchWindow ('DOS Menu',DosChoices,43,6)
  182.  
  183. OnKey 'A'
  184.    RamMap
  185.    Pause
  186.  
  187. OnKey 'B'
  188.    Free
  189.    Pause
  190.  
  191. OnKey 'C'
  192.    D/W
  193.  
  194. OnKey 'D'
  195.    PD
  196.  
  197. OnKey 'E'
  198.   |if ExistOnPath('DM3.EXE') > ''
  199.      DropTo DM3
  200.   |else
  201.      DropTo DM
  202.   |endif
  203.  
  204. OnKey 'F'
  205.   CD\
  206.   BACKUP C: A: /S
  207.   |Bat 'CD ' + Path
  208.  
  209. OnKey 'G'
  210.   |Bat SelectFile (ProgType)
  211.  
  212. ;----- Menu Utils
  213.  
  214. :MenuUtils
  215.  
  216. MenuChoices[1] = 'Edit this Menu'
  217. MenuChoices[2] = 'Edit another Menu'
  218. MenuChoices[3] = 'Run a Menu'
  219.  
  220. CornerStretchWindow ('Apps Menu',MenuChoices,43,6)
  221.  
  222. OnKey 'A'
  223.   ME %MenuFileName
  224.  
  225. OnKey 'B'
  226.   |Bat 'ME ' + SelectFile ('*.MNU')
  227.  
  228. OnKey 'C'
  229.   |SavePosition Off
  230.   |Bat 'MARX ' + SelectFile ('*.MNU')
  231.  
  232. ;----- This routines selects floppy disk format
  233.  
  234. Procedure SelectFormat
  235. var Ch Message Option BoxDim
  236.    BoxDim[1] = 30
  237.    BoxDim[2] = 12
  238.    BoxDim[3] = 37
  239.    BoxDim[4] = 4
  240.    DrawStretchWindow('Format Floppy Disk Menu',BoxDim)
  241.    Writeln ' 1 - Format 360    5 - Format /S 360'
  242.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  243.    Writeln ' 3 - Format 720    7 - Format /S 720'
  244.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  245.    Ch = ReadKey
  246.    if Ch = '1'
  247.       Message = '360k Format with no System Files.'
  248.       Option = '/4'
  249.    endif
  250.    if Ch = '2'
  251.       Message = '1.2m Format with no System Files.'
  252.       Option = ''
  253.    endif
  254.    if Ch = '3'
  255.       Message = '720k Format with no System Files.'
  256.       Option = '/N:9/T:80'
  257.    endif
  258.    if Ch = '4'
  259.       Message = '1.4m Format with no System Files.'
  260.       Option = '/N:18/T:80'
  261.    endif
  262.    if Ch = '5'
  263.       Message = '360k Format with System Files.'
  264.       Option = '/4/S'
  265.    endif
  266.    if Ch = '6'
  267.       Message = '1.2m Format with System Files.'
  268.       Option = '/S'
  269.    endif
  270.    if Ch = '7'
  271.       Message = '720k Format with System Files.'
  272.       Option = '/N:9/T:80/S'
  273.    endif
  274.    if Ch = '8'
  275.       Message = '1.4m Format with System Files.'
  276.       Option = '/N:18/T:80/S'
  277.    endif
  278.    if Message = '' then Return
  279.    if DosVersionString >= '5.00' then Option = Option + '/U'
  280.    BoxDim[1] = 56
  281.    BoxDim[2] = 18
  282.    BoxDim[3] = 5
  283.    BoxDim[4] = 2
  284.    DrawStretchWindow('Drive',BoxDim)
  285.    Writeln '  A:'
  286.    Write   '  B:'
  287.    Ch = ReadKey
  288.    if Ch = Esc then Return
  289.    if Ch = 'A'
  290.       Bat '@Echo Formatting Drive A: ' + Message
  291.       Bat '@Echo To abort, press CTRL-C.'
  292.       Bat '@Echo .'
  293.       Bat 'FORMAT A:' + Option
  294.    endif
  295.    if Ch = 'B'
  296.       Bat '@Echo Formatting Drive B: ' + Message
  297.       Bat '@Echo To abort, press CTRL-C.'
  298.       Bat '@Echo .'
  299.       Bat 'FORMAT B:' + Option
  300.    endif
  301. EndProc
  302.  
  303.  
  304. ;------ Reset Colors Procedure
  305.  
  306. Procedure ResetColors
  307.    if ColorScreen
  308.       BoxBorderColor Yellow Blue
  309.       BoxInsideColor Yellow Blue
  310.       CapsColor White Blue
  311.       InverseColor White Mag
  312.    else
  313.       BoxBorderColor Grey Black
  314.       BoxInsideColor Grey Black
  315.       CapsColor White Black
  316.    endif
  317. EndProc
  318.  
  319. ;----- This routines is used to actually draw the stretch window
  320.  
  321. Procedure DrawStretchWindow (Title,BoxDim)
  322.    Explode On
  323.    DoubleLineBox
  324.    InactiveBox SingleLineBox
  325.    DrawBox (BoxDim[1] - 2, BoxDim[2] - 3 ,BoxDim[3] + 6, BoxDim[4] + 4)
  326.    TextColor LCyan Blue
  327.    WriteCenter Title
  328.    TextColor LGreen Blue
  329.    Writeln
  330.    ClearLine 196
  331.    GotoXY 2 2
  332.    WriteVertical mid(VertLine,1,BoxDim[4] + 1)
  333.    ResetColors
  334.    Explode Off
  335.    NoBoxBorder
  336.    Window (BoxDim[1] + 1, BoxDim[2], BoxDim[3] + 2, BoxDim[4])
  337.    DoubleLineBox
  338.    Explode On
  339. EndProc
  340.  
  341. ;----- The X Y parameters are the center of the box
  342.  
  343. Procedure CenterStretchWindow (Title, Choices, X, Y)
  344. var Longest BoxDim NumElem C
  345.    Longest = length(Title) - 2
  346.    NumElem = NumberOfElements(Choices)
  347.    C = 64
  348.    Loop NumElem
  349.       Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex]
  350.       Longest = Max(Longest,length(Choices[LoopIndex]))
  351.    EndLoop
  352.    BoxDim[1] = X - (Longest / 2) - 1
  353.    BoxDim[2] = Y - (NumElem / 2) + 1
  354.    BoxDim[3] = Longest
  355.    BoxDim[4] = NumElem
  356.    DrawStretchWindow(Title,BoxDim)
  357.    Loop NumElem
  358.       Write ' ' Choices[LoopIndex]
  359.       if LoopIndex < NumElem then Writeln
  360.    EndLoop
  361. EndProc
  362.  
  363. ;----- The X Y parameters are the corner of the box
  364.  
  365. Procedure CornerStretchWindow (Title, Choices, X, Y)
  366. var Longest BoxDim NumElem C
  367.    Longest = length(Title) - 2
  368.    NumElem = NumberOfElements(Choices)
  369.    C = 64
  370.    Loop NumElem
  371.       Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex]
  372.       Longest = Max(Longest,length(Choices[LoopIndex]))
  373.    EndLoop
  374.    BoxDim[1] = X + 2
  375.    BoxDim[2] = Y + 3
  376.    BoxDim[3] = Longest
  377.    BoxDim[4] = NumElem
  378.    DrawStretchWindow(Title,BoxDim)
  379.    Loop NumElem
  380.       Write ' ' Choices[LoopIndex]
  381.       if LoopIndex < NumElem then Writeln
  382.    EndLoop
  383. EndProc
  384.  
  385. ;------ MenuExit Procedure
  386.  
  387. :Leave
  388.    Explode On
  389.    DrawBox 36 11 13 6
  390.    TextColor LCyan Blue
  391.    WriteCenter "Exit Menu"
  392.    TextColor LGreen Blue
  393.    Writeln
  394.    ClearLine 196
  395.    GotoXY 2 2
  396.    WriteVertical mid(VertLine,1,3)
  397.    ResetColors
  398.    Explode Off
  399.    NoBoxBorder
  400.    Window 39 14 9 2
  401.    Writeln " Yes"
  402.    Write   " No"
  403.    DoubleLineBox
  404.    OnKey "Y"
  405.       |ExitMenu
  406.  
  407.    OnKey "N"
  408.       |LastKey = Esc
  409.  
  410.  
  411. ;------ Select a File
  412.  
  413. Procedure SelectFile (Mask)
  414.   if Mask = '' then Return ''
  415.   Return PickFile Mask 29 9 14
  416. EndProc
  417.  
  418.  
  419. ;------ Choose Program Type
  420.  
  421. Procedure ProgType
  422. var Progs
  423.    Progs[1] = 'COM File'
  424.    Progs[2] = 'EXE File'
  425.    Progs[3] = 'BAT File'
  426.  
  427.    CornerStretchWindow ('Program Type',Progs,11,16)
  428.  
  429.    OnScreenOnly On
  430.    LastKey = ReadKey
  431.  
  432.    if LastKey = 'A' then Return '*.COM'
  433.    if LastKey = 'B' then Return '*.EXE'
  434.    if LastKey = 'C' then Return '*.BAT'
  435.    if LastKey = Esc then Return ''
  436.  
  437. EndProc
  438.  
  439.