home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT070.ZIP / MENUS.EXE / NOVTRANS.MNU < prev    next >
Text File  |  1991-04-12  |  22KB  |  638 lines

  1. Comment
  2. ========================================================================
  3.  
  4. Novell to MarxMenu Translator:
  5.  
  6. Copyright 1989-91 by Marc Perkel * All rights reserved.
  7.  
  8. Usage: MARXMENU NOVTRANS <novell menu>
  9.  
  10. This program was written to translate Novell menus to MarxMenus. It is
  11. not an exact translation, but does the bulk of the work. It is up to you
  12. to edit the output file and tune the menu the way you want.
  13.  
  14. I have made no attempt to copy color information. I am not presenting
  15. selections in sorted order, but in the order in which they are defined.
  16.  
  17. The program creates a MarxMenu file names <menu>.TMP where <menu> is the
  18. name of your Novell menu file. Then it compiles <menu>.TMP into
  19. <menu>.MRX file that should be ready to run. if the menu needs to be
  20. altered, you will have to rename the <menu>.TMP file to a MNU file and
  21. then you can work with it like any other MarxMenu source file.
  22.  
  23. ========================================================================
  24. EndComment
  25.  
  26. Var
  27.    NovLines Menus Tmp MenuPtr ChoicePtr CommandPtr LinePtr
  28.    BoxDim X Y Z VarNum PromptLine Out Cap InputAVar NovellFileName
  29.    MarxMenuFileName NovellTempFileName
  30.  
  31. ;------ Translator Messages
  32.  
  33. Const
  34.    TopMessage = "Joe Blow's Master Menu"
  35.    BottomMessage = "*-<< Acme Manufacturing Company >>-*"
  36.  
  37. ;------ Array Positions
  38.  
  39. Qualifier MenuName YPos XPos MenuColor MenuChoices
  40. Qualifier ChoiceName ChoiceCmd
  41.  
  42. Comment
  43. ========================================================================
  44.  
  45. This is the main body of the NovTrans Program.
  46.  
  47. ========================================================================
  48. EndComment
  49.  
  50. if not NetWorkVersion
  51.    ClearScreen
  52.    Writeln
  53.    Writeln 'This translator requires the network version of MarxMenu to Run!'
  54. endif
  55.  
  56. PreAmble
  57. PrepareFiles
  58. Header
  59. Parse
  60. WriteOutMenus
  61. WriteOutProcedures
  62. UseCommand Yes
  63. ClearScreenFirst No
  64. Execute 'MARXCOMP.EXE ' + MarxMenuFileName
  65.  
  66. Writeln
  67. Writeln 'Done!'
  68.  
  69. Comment
  70. =====================================
  71.  
  72. Subroutine area.
  73.  
  74. =====================================
  75. EndComment
  76.  
  77. ;----- Initilize Variables and Environment
  78.  
  79. Procedure PreAmble
  80.   ClearScreenOnExit Off
  81.   StandardIO
  82.   Writeln
  83.   NovellFileName = UpperCase(ParamStr(2))
  84.   Usage
  85. EndProc
  86.  
  87. ;------ Proper Usage Procedure
  88.  
  89. Procedure Usage
  90.   if NovellFileName = ''
  91.     Writeln('Usage: MarxMenu NovTrans <menu>')
  92.     Writeln('Converts Novell menus to MarxMenus.')
  93.     Writeln('Be sure to backup your original menus before running!!')
  94.     ExitMenu
  95.   endif
  96. EndProc
  97.  
  98. ;----- Create FileNames and open Files
  99.  
  100. Procedure PrepareFiles
  101.   if pos('.',NovellFileName) > 0
  102.     NovellFileName = left(NovellFileName,pred(pos('.',NovellFileName)))
  103.   endif
  104.  
  105.   NovellTempFileName = NovellFileName + '.MNU'
  106.   MarxMenuFileName = ForceExtension(NovellTempFileName,'TMP')
  107.  
  108.   ReadTextFile NovellTempFileName NovLines
  109.   Writeln 'Creating ' MarxMenuFileName
  110.  
  111.   FileAssign(Out,MarxMenuFileName)
  112.   FileCreate(Out)
  113. EndProc
  114.  
  115.  
  116. Procedure BlankLine
  117.    FileWriteln(Out,'')
  118. EndProc
  119.  
  120. ;----- Write out the MarxMenu Source Header
  121.  
  122. Procedure Header
  123.   FileWriteln(Out,'Comment')
  124.   FileWriteln(Out,'==========================================================')
  125.   BlankLine
  126.   FileWriteln(Out,'This File was converted from Novell Menu: ',NovellTempFileName)
  127.   BlankLine
  128.   FileWriteln(Out,'It should behave in a similar way to the original menu but')
  129.   FileWriteln(Out,'not necessarilly exactly the same. It will be close enough')
  130.   FileWriteln(Out,'for you to fine tune it the way you want.')
  131.   BlankLine
  132.   FileWriteln(Out,'To add a choice to a menu simply create another array element')
  133.   FileWriteln(Out,'to Choices, then add the appropiate Onkey statement.')
  134.   FileWriteln(Out,'The menu will make the size adjustments accordinaly.')
  135.   BlankLine
  136.   FileWriteln(Out,'  Example:')
  137.   FileWriteln(Out,'      Choices[10] = "Print Console" ')
  138.   FileWriteln(Out,'      ... ')
  139.   FileWriteln(Out,'      ... ')
  140.   FileWriteln(Out,'      OnKey "K" ')
  141.   FileWriteln(Out,'        PConsole ')
  142.   FileWriteln(Out,'      ...')
  143.   BlankLine
  144.   FileWriteln(Out,"If you want to change the menu's center, pass the XY")
  145.   FileWriteln(Out,"coordinates to menu's MakeBox() procedure.")
  146.   BlankLine
  147.   FileWriteln(Out,'   Example:')
  148.   FileWriteln(Out,'      MakeBox("Menu Header",10,10,CenterXY)')
  149.   BlankLine
  150.   FileWriteln(Out,'This will cause the menu to center at Col 10, Row 10')
  151.   BlankLine
  152.   FileWriteln(Out,'Once you are satisfied with the translation you can copy the TMP file')
  153.   FileWriteln(Out,'over the old Novell MNU file and just work with the MarxMenu version.')
  154.   BlankLine
  155.   FileWriteln(Out,'=========================================================')
  156.   FileWriteln(Out,'EndComment')
  157.   BlankLine
  158.   FileWriteln(Out,';------ Create Variables')
  159.   BlankLine
  160.   FileWriteln(Out,'var')
  161.   FileWriteln(Out,'  VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"')
  162.   FileWriteln(Out,'  %NovVar1 %NovVar2 %NovVar3 %NovVar4 %NovVar5')
  163.   FileWriteln(Out,'  %NovVar6 %NovVar7 %NovVar8 %NovVar9 %NovVar10')
  164.   FileWriteln(Out,'  Choices')
  165.   FileWriteln(Out,'  MenuTitle')
  166.   FileWriteln(Out,'  StatusLineText')
  167.   BlankLine
  168.   FileWriteln(Out,';----- Color Variables')
  169.   BlankLine
  170.   FileWriteln(Out,'var')
  171.   FileWriteln(Out,'  BackGroundFG     BackGroundBG')
  172.   FileWriteln(Out,'  TitleBoxBorderFG TitleBoxBG')
  173.   FileWriteln(Out,'  TitleBoxInsideFG')
  174.   FileWriteln(Out,'  ClockColorFG')
  175.   FileWriteln(Out,'  StatusLineFG     StatusLineBG')
  176.   FileWriteln(Out,'  MenuInsideFG     MenuBG')
  177.   FileWriteln(Out,'  MenuHeaderFG')
  178.   FileWriteln(Out,'  MenuBorderFG')
  179.   FileWriteln(Out,'  MenuVertLinesFG')
  180.   FileWriteln(Out,'  MenuInverseFG    MenuInverseBG')
  181.   FileWriteln(Out,'  MenuCapColorFG')
  182.   BlankLine
  183.   FileWriteln(Out,';------ Create Constants')
  184.   BlankLine
  185.   FileWriteln(Out,'Const')
  186.   FileWriteln(Out,'  CornerXY = 1')
  187.   FileWriteln(Out,'  CenterXY = 0')
  188.   BlankLine
  189.   FileWriteln(Out,';------ Here is where you add you own menu title and status line message')
  190.   BlankLine
  191.   FileWriteln(Out,'MenuTitle      = "',TopMessage,'"')
  192.   FileWriteln(Out,'StatusLineText = "',BottomMessage,'"')
  193.   BlankLine
  194.   FileWriteln(Out,'SavePosition On')
  195.   BlankLine
  196.   FileWriteln(Out,';------ This is where you can change the colors to suit your taste.')
  197.   BlankLine
  198.   FileWriteln(Out,'if ColorScreen')
  199.   FileWriteln(Out,'   BackGroundFG     = Cyan')
  200.   FileWriteln(Out,'   BackGroundBG     = Blue')
  201.   FileWriteln(Out,'   TitleBoxBG       = Brown')
  202.   FileWriteln(Out,'   TitleBoxBorderFG = White')
  203.   FileWriteln(Out,'   TitleBoxInsideFG = Yellow')
  204.   FileWriteln(Out,'   ClockColorFG     = Yellow')
  205.   FileWriteln(Out,'   StatusLineFG     = Yellow')
  206.   FileWriteln(Out,'   StatusLineBG     = Mag')
  207.   FileWriteln(Out,'   MenuBG           = Blue')
  208.   FileWriteln(Out,'   MenuInsideFG     = Yellow')
  209.   FileWriteln(Out,'   MenuBorderFG     = Yellow')
  210.   FileWriteln(Out,'   MenuHeaderFG     = LCyan')
  211.   FileWriteln(Out,'   MenuVertLinesFG  = LGreen')
  212.   FileWriteln(Out,'   MenuInverseFG    = White')
  213.   FileWriteln(Out,'   MenuInverseBG    = Mag')
  214.   FileWriteln(Out,'   MenuCapColorFG   = White')
  215.   FileWriteln(Out,'else')
  216.   FileWriteln(Out,'   BackGroundFG     = Grey')
  217.   FileWriteln(Out,'   BackGroundBG     = Black')
  218.   FileWriteln(Out,'   TitleBoxBG       = Grey')
  219.   FileWriteln(Out,'   TitleBoxBorderFG = Black')
  220.   FileWriteln(Out,'   TitleBoxInsideFG = Black')
  221.   FileWriteln(Out,'   ClockColorFG     = Black')
  222.   FileWriteln(Out,'   StatusLineFG     = Black')
  223.   FileWriteln(Out,'   StatusLineBG     = Grey')
  224.   FileWriteln(Out,'   MenuBG           = Black')
  225.   FileWriteln(Out,'   MenuInsideFG     = Grey')
  226.   FileWriteln(Out,'   MenuBorderFG     = Grey')
  227.   FileWriteln(Out,'   MenuHeaderFG     = White')
  228.   FileWriteln(Out,'   MenuVertLinesFG  = White')
  229.   FileWriteln(Out,'   MenuInverseFG    = Black')
  230.   FileWriteln(Out,'   MenuInverseBG    = Grey')
  231.   FileWriteln(Out,'   MenuCapColorFG   = White')
  232.   FileWriteln(Out,'endif')
  233.   BlankLine
  234.   FileWriteln(Out,';------ Clear the screen with a textured background')
  235.   BlankLine
  236.   FileWriteln(Out,'TextColor BackGroundFG BackGroundBG')
  237.   FileWriteln(Out,'ClearScreen 176')
  238.   BlankLine
  239.   FileWriteln(Out,';------ Draw Status Line')
  240.   BlankLine
  241.   FileWriteln(Out,'GotoXY(1,ScreenHeight)')
  242.   FileWriteln(Out,'TextColor(StatusLineFG,StatusLineBG)')
  243.   FileWriteln(Out,'ClearLine')
  244.   FileWriteln(Out,'WriteCenter(StatusLineText)')
  245.   BlankLine
  246.   FileWriteln(Out,';------ Draw the Title Box')
  247.   BlankLine
  248.   FileWriteln(Out,'SingleLineBox')
  249.   FileWriteln(Out,'Explode Off')
  250.   FileWriteln(Out,'BoxInsideColor TitleBoxInsideFG TitleBoxBG')
  251.   FileWriteln(Out,'BoxBorderColor TitleBoxBorderFG TitleBoxBG')
  252.   FileWriteln(Out,'DrawBox 1 1 ScreenWidth 3')
  253.   FileWriteln(Out,'GotoXY(ScreenWidth - Length(MenuTitle) - 3,1)')
  254.   FileWriteln(Out,'Write MenuTitle')
  255.   BlankLine
  256.   FileWriteln(Out,';------ Display the clock')
  257.   BlankLine
  258.   FileWriteln(Out,'ClockColor ClockColorFG TitleBoxBG')
  259.   FileWriteln(Out,'ClockPos 3 2')
  260.   BlankLine
  261.   FileWriteln(Out,';------ Set up the blank screen message if you want one.')
  262.   BlankLine
  263.   FileWriteln(Out,'BlankMessage = ""')
  264.   BlankLine
  265.   FileWriteln(Out,';------ Change BlankTime to 0 if you do not want to blank the screen.')
  266.   BlankLine
  267.   FileWriteln(Out,'BlankTime = 10')
  268.   BlankLine
  269.   FileWriteln(Out,';------ Change LogoffTime to 0 if you do not want timed Logoff.')
  270.   BlankLine
  271.   FileWriteln(Out,'LogoffTime = 60')
  272.   BlankLine
  273.   FileWriteln(Out,'Comment')
  274.   FileWriteln(Out,'=================================')
  275.   BlankLine
  276.   FileWriteln(Out,'Here is where menus are created.')
  277.   BlankLine
  278.   FileWriteln(Out,'=================================')
  279.   FileWriteln(Out,'EndComment')
  280.   BlankLine
  281.   FileFlush(Out);
  282. EndProc
  283.  
  284.  
  285. ;----- Delete all spaces in a string to make them a valid MarxMenu label
  286. ;      Returns a string
  287.  
  288. Procedure DeleteSpaces(St)
  289.    while Pos(' ',St) > 0
  290.       Delete(St,Pos(' ',St),1)
  291.    endwhile
  292.    while Pos('-',St) > 0
  293.       Delete(St,Pos('-',St),1)
  294.    endwhile
  295.    while Pos('.',St) > 0
  296.       Delete(St,Pos('.',St),1)
  297.    endwhile
  298.    if (Mid(St,2,1) >= '0') and (Mid(St,2,1) <= '9')
  299.       Insert('X',St,2)
  300.    endif
  301.    Return St
  302. EndProc
  303.  
  304. ;----- Parse Novell Source into MenuName, MenuChoices, MenuCommands
  305. ;----- Returns a integer pointing to the end of the menu prompt
  306.  
  307. Procedure FindEndOfMenuPrompt(St)
  308. Var CommaPos Tail
  309.  
  310.   CommaPos = Pos(',',St)
  311.   if CommaPos = 0 Then Return Length(St) + 1
  312.   Tail = Mid(St,CommaPos + 1,255)
  313.   loop(Length(Tail))
  314.     if Pos(Mid(Tail,LoopIndex,1), '0123456789,') = 0
  315.       Writeln
  316.       Writeln('Error : There must not be any embedded commas in menu title!')
  317.       Writeln(St)
  318.       Writeln
  319.       ExitMenu
  320.     endif
  321.   endloop
  322.   Return CommaPos
  323. EndProc
  324.  
  325. ;------ Preprocess Lines
  326.  
  327. Procedure Parse
  328. Var TotalLines
  329.   TotalLines = NumberOfElements(NovLines)
  330.   Writeln('Parsing Novell Menu source code ...')
  331.   MenuPtr = 0
  332.   loop(TotalLines)
  333.      if (LoopIndex Mod 10 = 0) or (LoopIndex = TotalLines)
  334.        GotoXY(1,WhereY)
  335.        Write('Processing Line # ',LoopIndex,' of ',TotalLines)
  336.        ClearLine
  337.      endif
  338.      if left(NovLines[LoopIndex],1) = '%'
  339.         ChoicePtr = 0
  340.         CommandPtr = 0
  341.         MenuPtr = MenuPtr + 1
  342.         Tmp = mid(NovLines[LoopIndex],2,255)
  343.         X = FindEndOfMenuPrompt(Tmp)
  344.         Menus[MenuPtr].MenuName = ':' + left(Tmp,X - 1)
  345.         Tmp = mid(Tmp,X + 1,255)
  346.         Menus[MenuPtr].YPos = value(NextWord(Tmp))
  347.         Menus[MenuPtr].XPos = value(NextWord(Tmp))
  348.         Menus[MenuPtr].MenuColor = value(NextWord(Tmp))
  349.      else
  350.         if left(NovLines[LoopIndex],1) > ' '
  351.            CommandPtr = 0
  352.            ChoicePtr = ChoicePtr + 1
  353.            Trim(NovLines[LoopIndex])
  354.            if Mid(NovLines[LoopIndex], 2, 1) = '.'
  355.              Delete(NovLines[LoopIndex],1,2)
  356.              Trim(NovLines[LoopIndex])
  357.            endif
  358.            Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceName = NovLines[LoopIndex]
  359.         else
  360.            if ChoicePtr = 0
  361.               Writeln
  362.               Writeln 'Error in menu line: ' LoopIndex
  363.               ExitMenu
  364.            endif
  365.            CommandPtr = CommandPtr + 1
  366.            Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceCmd[CommandPtr] = NovLines[LoopIndex]
  367.         endif
  368.      endif
  369.   endloop
  370. EndProc
  371.  
  372. ;------ Create the Menu Choices Array
  373.  
  374. Procedure WriteOutMenuChoices
  375.   Writeln('Translating: ' + mid(Menus[MenuPtr].MenuName,2,255))
  376.   BlankLine
  377.   FileWriteln(Out,';------ Translating: ' + mid(Menus[MenuPtr].MenuName,2,255))
  378.   BlankLine
  379.   if MenuPtr > 1
  380.      Tmp = Menus[MenuPtr].MenuName
  381.      Tmp = DeleteSpaces(Tmp)
  382.      FileWriteln(Out,Tmp)
  383.   endif
  384.   FileWriteln(Out,'Dispose Choices')
  385.   BlankLine
  386.   loop(NumberOfElements(Menus[MenuPtr].MenuChoices))
  387.      FileWriteln(Out,'  Choices[' + Str(LoopIndex) + '] = "' + Menus[MenuPtr].MenuChoices[LoopIndex].ChoiceName + '"')
  388.   endloop
  389.   BlankLine
  390.   FileWriteln(Out,'MakeBox("' + Mid(Menus[MenuPtr].MenuName,2,255) + '",' + Str(Menus[MenuPtr].YPos) + ',' + Str(Menus[MenuPtr].XPos) + ',CenterXY)');
  391.   BlankLine
  392. EndProc
  393.  
  394. ;------ Create the Onkey Statements
  395.  
  396. Procedure WriteOutOnkeyChoices
  397.   loop(NumberOfElements(Menus[MenuPtr].MenuChoices))
  398.     ChoicePtr = LoopIndex
  399.     Tmp = Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceName
  400.     FileWriteln(Out,'OnKey "' + Char(64 + ChoicePtr) + '"')
  401.     loop(NumberOfElements(Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceCmd))
  402.       CommandPtr = LoopIndex
  403.       Tmp = Menus[MenuPtr].MenuChoices[ChoicePtr].ChoiceCmd[CommandPtr]
  404.       Trim(Tmp)
  405.       if UpperCase(Tmp) = '!LOGOUT' then Tmp = '|Logoff'
  406.       if Left(Tmp,1) = '%'
  407.         Tmp = DeleteSpaces(Tmp)
  408.         Tmp = '^' + Mid(Tmp,2,255)
  409.       endif
  410.       if (pos('@',Tmp) > 0) And (Pos('@ECHO',UpperCase(Tmp)) = 0)
  411.         X = 1
  412.         while X <= length(Tmp)
  413.           while (X <= length(Tmp)) and (mid(Tmp,X,1) <> '@')
  414.              X = X + 1
  415.           endwhile
  416.           Z[1] = mid(Tmp,X,1)
  417.           Z[2] = mid(Tmp,X + 1,1)
  418.           if (Z[1] = '@') and (((Z[2] > '0') and (Z[3] <= '9')) or (Z[2] = '"'))
  419.             if Z[2] = '"'
  420.               insert(' ',Tmp,X + 1)
  421.               VarNum = 10
  422.             else
  423.               VarNum = ord(Z[2]) - 48
  424.             endif
  425.             InputAVar = mid(Tmp,X + 2,1) = '"'
  426.             if InputAVar
  427.               Y = X + 3
  428.               while (mid(Tmp,Y,1) <> '"') and (Y <= length(Tmp))
  429.                 Y = Y + 1
  430.               endwhile
  431.               PromptLine = mid(Tmp,X + 3,Y - (X + 3))
  432.             else
  433.               Y = X + 1
  434.             endif
  435.           delete(Tmp,X,Y - X + 1)
  436.           insert('%NovVar' + Str(VarNum)  ,Tmp,X)
  437.           if InputAVar
  438.             FileWriteln(Out,'   |%NovVar',Str(VarNum), ' = ReadTextLine("' + PromptLine + '")')
  439.           endif
  440.         endif
  441.       endwhile
  442.     endif
  443.       FileWriteln(Out,'   ' + Tmp)
  444.     endloop
  445.     BlankLine
  446.   endloop
  447. EndProc
  448.  
  449. ;------ Create the Menus
  450.  
  451. Procedure WriteOutMenus
  452. Var LoopCount
  453.   Writeln
  454.   LoopCount = MenuPtr
  455.   loop(LoopCount)
  456.      MenuPtr = LoopIndex
  457.      WriteOutMenuChoices
  458.      WriteOutOnkeyChoices
  459.      if MenuPtr = 1
  460.         FileWriteln(Out,'OnKey ESC')
  461.         FileWriteln(Out,'   ^Leave')
  462.         BlankLine
  463.      endif
  464.   endloop
  465. EndProc
  466.  
  467. ;------ Create the support procedures
  468.  
  469. Procedure WriteOutProcedures
  470.   BlankLine
  471.   FileWriteln(Out,'Comment')
  472.   FileWriteln(Out,'=================================')
  473.   BlankLine
  474.   FileWriteln(Out,'Here are the support subroutines.')
  475.   BlankLine
  476.   FileWriteln(Out,'=================================')
  477.   FileWriteln(Out,'EndComment')
  478.   BlankLine
  479.   BlankLine
  480.   FileWriteln(Out,';------ Read a Text Line Procedure')
  481.   BlankLine
  482.   FileWriteln(Out,'Procedure ReadTextLine(St)')
  483.   FileWriteln(Out,'var AnswerLine')
  484.   FileWriteln(Out,'   Dispose Choices')
  485.   FileWriteln(Out,'   Choices[1] = "" ')
  486.   FileWriteln(Out,'   MakeBox("User Input",21,0,CenterXY)')
  487.   FileWriteln(Out,'   Write " " St " "')
  488.   FileWriteln(Out,'   TextColor(MenuCapColorFG,MenuBG)')
  489.   FileWriteln(Out,'   AnswerLine = Readln')
  490.   FileWriteln(Out,'   EraseTopWindow')
  491.   FileWriteln(Out,'   Return AnswerLine ')
  492.   FileWriteln(Out,'EndProc')
  493.   BlankLine
  494.   FileWriteln(Out,';------ MenuExit Procedure')
  495.   BlankLine
  496.   FileWriteln(Out,':Leave')
  497.   FileWriteln(Out,'   Explode On')
  498.   FileWriteln(Out,'   DoubleLineBox')
  499.   FileWriteln(Out,'   DrawBox ScreenWidth / 2 - 4 ScreenHeight / 2 - 1 13 6')
  500.   FileWriteln(Out,'   TextColor LCyan Blue')
  501.   FileWriteln(Out,'   WriteCenter "Exit Menu"')
  502.   FileWriteln(Out,'   TextColor LGreen Blue')
  503.   FileWriteln(Out,'   Writeln')
  504.   FileWriteln(Out,'   ClearLine 196')
  505.   FileWriteln(Out,'   GotoXY 2 2')
  506.   FileWriteln(Out,'   WriteVertical mid(VertLine,1,3)')
  507.   FileWriteln(Out,'   Explode Off')
  508.   FileWriteln(Out,'   NoBoxBorder')
  509.   FileWriteln(Out,'   Window ScreenWidth / 2 - 1 ScreenHeight / 2 + 2 9 2')
  510.   FileWriteln(Out,'   CapsColor(MenuCapColorFG,MenuBG)')
  511.   FileWriteln(Out,'   Writeln " Yes"')
  512.   FileWriteln(Out,'   Write   " No"')
  513.   FileWriteln(Out,'   DoubleLineBox')
  514.   FileWriteln(Out,'   OnKey "Y"')
  515.   FileWriteln(Out,'      |ExitMenu')
  516.   BlankLine
  517.   FileWriteln(Out,'   OnKey "N"')
  518.   FileWriteln(Out,'      |LastKey = Esc')
  519.   BlankLine
  520.   FileWriteln(Out,';------ This draws a menu similiar to the Novell menus')
  521.   FileWriteln(Out,';------ An 0 for Row And/Or Col, and the menu will get centered respectifly')
  522.   BlankLine
  523.   FileWriteln(Out,'Procedure MakeBox(HeaderST,Row,Col,XYOrgin)')
  524.   FileWriteln(Out,'var NumElem Height Width')
  525.   BlankLine
  526.   FileWriteln(Out,'   Width = Length(HeaderSt)')
  527.   FileWriteln(Out,'   NumElem = NumberOfElements(Choices)')
  528.   BlankLine
  529.   FileWriteln(Out,'     ;Get the widest element in the Choices Array')
  530.   BlankLine
  531.   FileWriteln(Out,'   if Length(Choices[1]) > 0 ')
  532.   FileWriteln(Out,'      loop NumElem')
  533.   FileWriteln(Out,'         Trim(Choices[LoopIndex])')
  534.   FileWriteln(Out,'         Choices[LoopIndex] = " " + Char(64 + LoopIndex) + ". " + Choices[LoopIndex]')
  535.   FileWriteln(Out,'         Width = Max(Width,Length(Choices[LoopIndex]))')
  536.   FileWriteln(Out,'      endloop')
  537.   FileWriteln(Out,'   else')
  538.   FileWriteln(Out,'      Width = 72 ')
  539.   FileWriteln(Out,'   endif')
  540.   FileWriteln(Out,'   Height = NumElem + 4')
  541.   FileWriteln(Out,'   Width = Width + 5')
  542.   FileWriteln(Out,'   if XYOrgin = CenterXY')
  543.   FileWriteln(Out,'      if Row = 0')
  544.   BlankLine
  545.   FileWriteln(Out,'         ;Center window verticaly')
  546.   BlankLine
  547.   FileWriteln(Out,'         Row = ((ScreenHeight - Height) / 2) + 2')
  548.   FileWriteln(Out,'      else')
  549.   BlankLine
  550.   FileWriteln(Out,'         ;Center window with X Coordinate')
  551.   BlankLine
  552.   FileWriteln(Out,'         Row = (Row - (Height / 2) + 1)')
  553.   FileWriteln(Out,'      endif')
  554.   FileWriteln(Out,'      if Col = 0')
  555.   BlankLine
  556.   FileWriteln(Out,'         ;Center window horizonitly')
  557.   BlankLine
  558.   FileWriteln(Out,'         Col = (ScreenWidth - Width) / 2')
  559.   FileWriteln(Out,'      else')
  560.   BlankLine
  561.   FileWriteln(Out,'         ;Center window with Y Coordinate')
  562.   BlankLine
  563.   FileWriteln(Out,'         Col = (Col - (Width / 2) + 1)')
  564.   FileWriteln(Out,'      endif')
  565.   FileWriteln(Out,'   endif')
  566.   BlankLine
  567.   FileWriteln(Out,'     ;Make Sure Row and Col are within their range')
  568.   BlankLine
  569.   FileWriteln(Out,'   while Row <= 4')
  570.   FileWriteln(Out,'      Row = Row + 1')
  571.   FileWriteln(Out,'   endwhile')
  572.   BlankLine
  573.   FileWriteln(Out,'   while ((Row + Height) > (ScreenHeight - 1))')
  574.   FileWriteln(Out,'      Row = Row - 1')
  575.   FileWriteln(Out,'   endwhile')
  576.   BlankLine
  577.   FileWriteln(Out,'   while Col <= 1')
  578.   FileWriteln(Out,'      Col = Col + 1')
  579.   FileWriteln(Out,'   endwhile')
  580.   BlankLine
  581.   FileWriteln(Out,'   while ((Col + Width) > ScreenWidth)')
  582.   FileWriteln(Out,'      Col = Col - 1')
  583.   FileWriteln(Out,'   endwhile')
  584.   BlankLine
  585.   FileWriteln(Out,'   CreateXYBox(Col,Row,Width,Height,HeaderSt,NumElem)')
  586.   FileWriteln(Out,'EndProc')
  587.   BlankLine
  588.   BlankLine
  589.   FileWriteln(Out,';------ Draw the Box')
  590.   BlankLine
  591.   FileWriteln(Out,'Procedure CreateXYBox(Col,Row,Width,Height,HeaderSt,NumElem)')
  592.   BlankLine
  593.   FileWriteln(Out,'     ;Draw the main window')
  594.   BlankLine
  595.   FileWriteln(Out,'   Explode On')
  596.   FileWriteln(Out,'   DoubleLineBox')
  597.   FileWriteln(Out,'   InactiveBox SingleLineBox')
  598.   FileWriteln(Out,'   BoxInsideColor(MenuInsideFG,MenuBG)')
  599.   FileWriteln(Out,'   BoxBorderColor(MenuBorderFG,MenuBG)')
  600.   FileWriteln(Out,'   DrawBox(Col, Row, Width, Height)')
  601.   BlankLine
  602.   FileWriteln(Out,'     ;Write the header')
  603.   BlankLine
  604.   FileWriteln(Out,'   TextColor(MenuHeaderFG,MenuBG)')
  605.   FileWriteln(Out,'   WriteCenter(HeaderSt)')
  606.   BlankLine
  607.   FileWriteln(Out,'     ;Write the vertical lines')
  608.   BlankLine
  609.   FileWriteln(Out,'   TextColor(MenuVertLinesFG,MenuBG)')
  610.   FileWriteln(Out,'   Writeln')
  611.   FileWriteln(Out,'   ClearLine 196')
  612.   FileWriteln(Out,'   GotoXY 2 2')
  613.   FileWriteln(Out,'   WriteVertical mid(VertLine,1,Height - 3)')
  614.   BlankLine
  615.   FileWriteln(Out,'     ;Draw the menu text box')
  616.   BlankLine
  617.   FileWriteln(Out,'   if Choices[1] > "" ')
  618.   FileWriteln(Out,'      CapsColor(MenuCapColorFG,MenuBG)')
  619.   FileWriteln(Out,'   else')
  620.   FileWriteln(Out,'      CapsColor(Black,Black) ')
  621.   FileWriteln(Out,'   endif')
  622.   FileWriteln(Out,'   InverseColor(MenuInverseFG,MenuInverseBG)')
  623.   FileWriteln(Out,'   Explode Off')
  624.   FileWriteln(Out,'   NoBoxBorder')
  625.   FileWriteln(Out,'   Window(Col + 3, Row + 3, Width - 4, Height - 4)')
  626.   BlankLine
  627.   FileWriteln(Out,'    ;Write the menu choices')
  628.   BlankLine
  629.   FileWriteln(Out,'   loop(NumElem - 1)')
  630.   FileWriteln(Out,'      Writeln(Choices[LoopIndex])')
  631.   FileWriteln(Out,'   endloop')
  632.   BlankLine
  633.   FileWriteln(Out,'   Write Choices[NumElem]')
  634.   FileWriteln(Out,'   UseArrows On')
  635.   FileWriteln(Out,'EndProc ')
  636.   FileClose(Out)
  637. EndProc
  638.