Routine MENUBAR.CTL Given FIELD.ID and FORM Yielding STATUS

  '' Goldmine Simulation                                       August 2, 1988
  '' CACI Products Company


  Define DIALOG as a pointer variable
  Define FIELD.ID as text variable
  Define FORM as pointer variable
  Define ICONS as a 1-dim text array
  Define STATUS as integer variable
  ''define SAVEXFORM as an integer variable

  ''Let SAVEXFORM = VXFORM.V
  ''Let VXFORM.V = 0

  ''If the menubar was selected, then find out which button on the bar or
  ''a pulldown was pressed.

  If FIELD.ID eq "MENU"
    Let FIELD.ID = DTVAL.A(DFIELD.F("MENU",FORM))
  Endif

  Select case FIELD.ID
   Case "INITIALIZE"

   Case "BACKGROUND"
    ''Put away any pulldown which may be down
    Let DIVAL.A(DFIELD.F("MENU",FORM)) = 0
    Display DFIELD.F("MENU",FORM)

   Case "QUIT"
    Let STATUS = 1

   Case "OPTIONS"

   Case "ICONS"

   Case "LIFT CAP"
     Show DIALOG with "liftcap.frm"
     Let DDVAL.A(DFIELD.F("CAPACITY",DIALOG)) = LIFT.CAPACITY

     Let FIELD.ID = ACCEPT.F(DIALOG,0)

     If FIELD.ID ne "CANCEL"
       Let LIFT.CAPACITY = DDVAL.A(DFIELD.F("CAPACITY",DIALOG))
     Endif

   Case "ARRIVAL 1"
     Show DIALOG with "arrive.frm"
     Let DDVAL.A(DFIELD.F("ARRIVE",DIALOG)) = MEAN.RATE(1)

     Let FIELD.ID = ACCEPT.F(DIALOG,0)

     If FIELD.ID ne "CANCEL"
       Let MEAN.RATE(1) = DDVAL.A(DFIELD.F("ARRIVE",DIALOG))
     Endif

   Case "ARRIVAL 2"
     Show DIALOG with "arrive.frm"
     Let DDVAL.A(DFIELD.F("ARRIVE",DIALOG)) = MEAN.RATE(2)

     Let FIELD.ID = ACCEPT.F(DIALOG,0)

     If FIELD.ID ne "CANCEL"
       Let MEAN.RATE(2) = DDVAL.A(DFIELD.F("ARRIVE",DIALOG))
     Endif

   Case "TIME"
     Show DIALOG with "time.frm"
     Let DDVAL.A(DFIELD.F("SCALE",DIALOG)) = SCALER
     let DDVAL.A(DFIELD.F("LENGTH",DIALOG)) = STOP.TIME

     Let FIELD.ID = ACCEPT.F(DIALOG,0)

     If FIELD.ID ne "CANCEL"
       Let SCALER = DDVAL.A(DFIELD.F("SCALE",DIALOG))
       Let TIMESCALE.V = SCALER*100/60.0   ''clock ticks (1/100 sec) /  unit
       let STOP.TIME = DDVAL.A(DFIELD.F("LENGTH",DIALOG))  ''hours
     Endif

   Case "QUEUE 1"
     Show DIALOG with "icon.frm"
     Reserve ICONS as 3
     Let ICONS(1) = "trace1.grf"
     Let ICONS(2) = "level1.grf"
     Let ICONS(3) = "dial1.grf"
     Let DARY.A(DFIELD.F("PICK",DIALOG)) = ICONS(*)

     Let FIELD.ID = ACCEPT.F(DIALOG,0)

     If FIELD.ID ne "CANCEL" and DDVAL.A(DFIELD.F("PICK",DIALOG)) ne 0
       Let ICONS(*) = DARY.A(DFIELD.F("PICK",DIALOG))
       Let QUEUE.ICON(1) = ICONS(DDVAL.A(DFIELD.F("PICK",DIALOG)))

       ''Load the new graph
       Display N.LOAD.QUEUE(1) with QUEUE.ICON(1)
     Endif

   Case "QUEUE 2"
     Show DIALOG with "icon.frm"
     Reserve ICONS as 3
     Let ICONS(1) = "trace2.grf"
     Let ICONS(2) = "level2.grf"
     Let ICONS(3) = "dial2.grf"
     Let DARY.A(DFIELD.F("PICK",DIALOG)) = ICONS(*)

     Let FIELD.ID = ACCEPT.F(DIALOG,0)

     If FIELD.ID ne "CANCEL" and DDVAL.A(DFIELD.F("PICK",DIALOG)) ne 0
       Let ICONS(*) = DARY.A(DFIELD.F("PICK",DIALOG))
       Let QUEUE.ICON(2) = ICONS(DDVAL.A(DFIELD.F("PICK",DIALOG)))

       ''Load the new graph
       Display N.LOAD.QUEUE(2) with QUEUE.ICON(2)
     Endif

   Default
  Endselect

  ''let VXFORM.V = SAVEXFORM


End ''MENUBAR.CTL
