home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / batch / mxmnu233.zip / NOVELL.INC < prev    next >
Text File  |  1991-09-29  |  7KB  |  327 lines

  1. Comment
  2. ==========================================================
  3.  
  4. This include file exports definitions that create a Novell menu look and
  5. feel. This is one of several look and feel files that export the same
  6. procedures.
  7.  
  8. Useful Routines Exported:
  9.  
  10. LookSetup
  11.    Call this to initialize the screen. Set MenuTitle and StatusLineText
  12.    before calling this routine.
  13.  
  14. CornerStretchBox (Header,Col,Row)
  15.    Creates a window from the array Choices with the upper left corner at
  16.    Row/Col. LastKey is set to the letter that is chosen.
  17.  
  18. CenterStretchBox (Header,Col,Row)
  19.    Creates a window from the array Choices with the center at Row/Col.
  20.    if a 0 is passed for either the Row or Col then the center of the
  21.    screen is assumed. LastKey is set to the letter that is chosen.
  22.  
  23. Leave
  24.    Puts up an exit box.
  25.  
  26.  
  27. ==========================================================
  28. EndComment
  29.  
  30.  
  31. var
  32.   VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"
  33.   VertLine2 = "││││││││││││││││││││"
  34.   VertLine3 = "┌─┴┴┴┴─┐"
  35.   VertLine4 = "└─┬┬┬┬─┘"
  36.   Choices
  37.   MenuTitle
  38.   StatusLineText
  39.   HeightDifference
  40.   Greek = False
  41.  
  42. var
  43.   BackGroundFG
  44.   BackGroundBG
  45.   TitleBoxBorderFG
  46.   TitleBoxBG
  47.   TitleBoxInsideFG
  48.   ClockColorFG
  49.   StatusLineFG
  50.   StatusLineBG
  51.   MenuInsideFG
  52.   MenuBG
  53.   MenuHeaderFG
  54.   MenuBorderFG
  55.   MenuVertLinesFG
  56.   MenuInverseFG
  57.   MenuInverseBG
  58.   MenuCapColorFG
  59.   ConsoleInsideFG
  60.   GreekFG
  61.   GreekBG
  62.  
  63. ;------ This is where you set your favorite colors.
  64.  
  65. Procedure SetColors
  66.    if ColorScreen
  67.       BackGroundFG     = Cyan
  68.       BackGroundBG     = Blue
  69.       TitleBoxBG       = Brown
  70.       TitleBoxBorderFG = White
  71.       TitleBoxInsideFG = Yellow
  72.       ClockColorFG     = Yellow
  73.       StatusLineFG     = Yellow
  74.       StatusLineBG     = Mag
  75.       MenuBG           = Blue
  76.       MenuInsideFG     = Yellow
  77.       MenuBorderFG     = Yellow
  78.       MenuHeaderFG     = LCyan
  79.       MenuVertLinesFG  = LGreen
  80.       MenuInverseFG    = White
  81.       MenuInverseBG    = Mag
  82.       MenuCapColorFG   = White
  83.       ConsoleInsideFG  = White
  84.       GreekFG          = Blue
  85.       GreekBG          = Green
  86.       BoxHeaderColor Yellow Green
  87.    else
  88.       BackGroundFG     = Grey
  89.       BackGroundBG     = Black
  90.       TitleBoxBG       = Grey
  91.       TitleBoxBorderFG = Black
  92.       TitleBoxInsideFG = Black
  93.       ClockColorFG     = Black
  94.       StatusLineFG     = Black
  95.       StatusLineBG     = Grey
  96.       MenuBG           = Black
  97.       MenuInsideFG     = Grey
  98.       MenuBorderFG     = Grey
  99.       MenuHeaderFG     = White
  100.       MenuVertLinesFG  = White
  101.       MenuInverseFG    = Black
  102.       MenuInverseBG    = Grey
  103.       MenuCapColorFG   = White
  104.       ConsoleInsideFG  = Grey
  105.       GreekFG          = Black
  106.       GreekBG          = Grey
  107.       BoxHeaderColor Black Grey
  108.    endif
  109. EndProc
  110.  
  111. ;------ Sets up main window to Novell look.
  112.  
  113. Procedure LookSetup
  114.    if MenuInsideFG = 0 then SetColors
  115.    NoExit
  116.  
  117.    ;------ Clear the screen with a textured background
  118.  
  119.    TextColor BackGroundFG BackGroundBG
  120.    ClearScreen 176
  121.  
  122.    ;------ If Greek is true then draw greek columns
  123.  
  124.    if Greek then GreekColumns
  125.  
  126.    ;------ Draw Status Line
  127.  
  128.    NoBoxBorder
  129.    Explode Off
  130.    BoxInsideColor StatusLineFG StatusLineBG
  131.    DrawBox 1 25 ScreenWidth 1
  132.    WriteCenter(StatusLineText)
  133.  
  134.    ;------ Draw the Title Box
  135.  
  136.    SingleLineBox
  137.    BoxInsideColor TitleBoxInsideFG TitleBoxBG
  138.    BoxBorderColor TitleBoxBorderFG TitleBoxBG
  139.    DrawBox 1 1 ScreenWidth 3
  140.    GotoXY(ScreenWidth - Length(MenuTitle) - 3,1)
  141.    Write MenuTitle
  142.  
  143.    ;------ Display the clock
  144.  
  145.    ClockColor ClockColorFG TitleBoxBG
  146.    ClockPos 3 2
  147.  
  148.    ;------ Setup Console
  149.  
  150.    ConsolePos 42 5
  151.    ConsoleHeaderColor MenuInverseFG MenuInverseBG
  152.    ConsoleInsideColor ConsoleInsideFG MenuBG
  153.  
  154.    HeightDifference = 4
  155. EndProc
  156.  
  157.  
  158. Procedure CenterStretchBox (Header,Col,Row)
  159.    MakeBox(Header,Col,Row,True)
  160. EndProc
  161.  
  162.  
  163. Procedure CornerStretchBox (Header,Col,Row)
  164.    MakeBox(Header,Col,Row,False)
  165. EndProc
  166.  
  167.  
  168. Procedure MakeBox(Header,Col,Row,Center)
  169. var NumElem Height Width
  170.  
  171.    Width = Length(Header) - 1
  172.    NumElem = NumberOfElements(Choices)
  173.  
  174.      ;Get the widest element in the Choices Array
  175.  
  176.    if Length(Choices[1]) > 0
  177.       loop NumElem
  178.          Trim(Choices[LoopIndex])
  179.          Choices[LoopIndex] = " " + Char(64 + LoopIndex) + ". " + Choices[LoopIndex]
  180.          Width = Max(Width,Length(Choices[LoopIndex]))
  181.       endloop
  182.    else
  183.       Width = 73
  184.    endif
  185.    Height = NumElem + 2
  186.    if Header > '' then Height = NumElem + 4
  187.    Width = Width + 5
  188.    if Center
  189.       if Row = 0
  190.  
  191.          ;Center window verticaly
  192.  
  193.          Row = ((ScreenHeight - Height) / 2) + 2
  194.       else
  195.  
  196.          ;Center window with X Coordinate
  197.  
  198.          Row = (Row - (Height / 2) + 1)
  199.       endif
  200.       if Col = 0
  201.  
  202.          ;Center window horizonitly
  203.  
  204.          Col = (ScreenWidth - Width) / 2 + 1
  205.       else
  206.  
  207.          ;Center window with Y Coordinate
  208.  
  209.          Col = (Col - (Width / 2) + 1)
  210.       endif
  211.    endif
  212.  
  213.    ;Make Sure Row and Col are within their range
  214.  
  215.    Row = Max(Row,5)
  216.    Row = Min(Row,ScreenHeight - Height - 1)
  217.    Col = Max(Col,2)
  218.    Col = Min(Col,ScreenWidth - Width)
  219.  
  220.    DrawTheBox(Col,Row,Width,Height,Header)
  221.  
  222.      ;Write the menu choices
  223.  
  224.    loop(NumElem - 1)
  225.       Writeln(Choices[LoopIndex])
  226.    endloop
  227.  
  228.    Write Choices[NumElem]
  229.    UseArrows On
  230.    Dispose(Choices)
  231. EndProc
  232.  
  233. ;------ Draw the Box
  234.  
  235. Procedure DrawTheBox (Col,Row,Width,Height,Header)
  236.  
  237.      ;Draw the main window
  238.  
  239.    DoubleLineBox
  240.    InactiveBox SingleLineBox
  241.    BoxInsideColor(MenuInsideFG,MenuBG)
  242.    BoxBorderColor(MenuBorderFG,MenuBG)
  243.    DrawBox(Col, Row, Width, Height)
  244.  
  245.    if Header > ''
  246.  
  247.      ;Write the header
  248.  
  249.       TextColor(MenuHeaderFG,MenuBG)
  250.       WriteCenter(Header)
  251.  
  252.      ;Write the vertical lines
  253.  
  254.       TextColor(MenuVertLinesFG,MenuBG)
  255.       Writeln
  256.       ClearLine 196
  257.       GotoXY 2 2
  258.       WriteVertical mid(VertLine,1,Height - 3)
  259.  
  260.      ;Draw the menu text box
  261.  
  262.       CapsColor(MenuCapColorFG,MenuBG)
  263.       InverseColor(MenuInverseFG,MenuInverseBG)
  264.       Window(Col + 3, Row + 3, Width - 4, Height - 4)
  265.    else
  266.       CapsColor Black Black
  267.    endif
  268. EndProc
  269.  
  270. ;------ MenuExit Procedure
  271.  
  272. Procedure LeaveMenu
  273.    DrawTheBox (ScreenWidth / 2 - 4,ScreenHeight / 2 - 1,13,6,'Exit Menu')
  274.    Writeln " Yes"
  275.    Write   " No"
  276.  
  277.    OnKey "Y"
  278.       |ExitMenu
  279.  
  280.    OnKey "N"
  281.       |LastKey = Esc
  282.  
  283. EndProc
  284.  
  285. ;------ Read a Text Line Procedure
  286.  
  287. Procedure ReadTextLine(St,Header,Col,Row)
  288. var AnswerLine
  289.    Choices[1] = ""
  290.    CenterStretchBox(Header,Col,Row)
  291.    Write " " St " "
  292.    TextColor(MenuCapColorFG,MenuBG)
  293.    AnswerLine = Readln
  294.    EraseTopWindow
  295.    Dispose Choices
  296.    Return AnswerLine
  297. EndProc
  298.  
  299.  
  300. Procedure GreekColumns
  301.    TextColor GreekFG GreekBG
  302.    GotoXY 4,4
  303.    WriteVertical VertLine2
  304.    GotoXY 5,4
  305.    WriteVertical VertLine2
  306.    GotoXY 6,4
  307.    WriteVertical VertLine2
  308.    GotoXY 7,4
  309.    WriteVertical VertLine2
  310.    GotoXY 74,4
  311.    WriteVertical VertLine2
  312.    GotoXY 75,4
  313.    WriteVertical VertLine2
  314.    GotoXY 76,4
  315.    WriteVertical VertLine2
  316.    GotoXY 77,4
  317.    WriteVertical VertLine2
  318.    GotoXY 2,4
  319.    Write VertLine4
  320.    GotoXY 72,4
  321.    Write VertLine4
  322.    GotoXY 2,24
  323.    Write VertLine3
  324.    GotoXY 72,24
  325.    Write VertLine3
  326. EndProc
  327.