#!/bin/sh
# Define which version of the sequencer to use \
  exec seqWish "$0"  ${1+"$@"}
#
#*************************************************************
# E.S.O. - VLT project
#
# "@(#) $Id$" 
#
# waEi.pan
#
# This file has been produced by the panel editor
#   version: panel.tcl,v 4.16
#   date   : Thu Apr 22 11:36:34 METDST 1999
#
#      !!!!!!!!!!  DO NOT MANUALLY EDIT THIS FILE  !!!!!!!!! 
#
#--------------------------------------------------------------
#
global par gvar cv bcv actAreaHeight shArea panClassLib 
global geoCmdReply panClassLib panUsrProcs panUsrLib
global argv0 env panWidget panWidgetHlp panDbData cwp ckHeartBeat
global menu menuBar menuHelp ckMenuBar ckActBut ckShHelp ckCCS
# 
#  Get directory root of VLT, integration, current module. 
global VLTROOT INTROOT HOME

if {[catch {set VLTROOT $env(VLTROOT)}]} {set VLTROOT dummy}
if {[catch {set INTROOT $env(INTROOT)}]} {set INTROOT dummy}
if {[catch {set HOME    $env(HOME)}   ]} {set HOME    dummy}
# 
# Set auto_path 
# 

if { [file exist ../lib/libpanPublic.tcl] } { 
   lappend auto_path ../lib/libpanPublic.tcl
} elseif { [file exist $INTROOT/lib/libpanPublic.tcl ] } { 
   lappend auto_path $INTROOT/lib/libpanPublic.tcl
} elseif { [file exist $VLTROOT/lib/libpanPublic.tcl ] } { 
   lappend auto_path $VLTROOT/lib/libpanPublic.tcl 
} else {
   puts stderr "panel EXITS : Tcl library libpanPublic.tcl not found " 
   exit 1
}

#
# Link panel to user libraries 
#
set panUsrLib   {}  
set panClassLib {}

panSetAutoPath  $panUsrLib $panClassLib 

if {[info exists EDITING]} { 
   set panRoot .waEi 
   set panUsrProcs {}
   set argc 0 ; set argv {}
} else {
   set par(MY_NAME) [file tail $argv0] 
   set EDITING 0
   set tk_strictMotif 0
   setPublicVar
   set panRoot . 
}

#
#-----------------------------------------------
#            Widget Definition  
#-----------------------------------------------
# 

set ckHeartBeat   1 ;# Enable Heart-beat
set ckShHelp      1 ;# Set Short Help
set ckActBut      0 ;# Set Action Button Area
set ckMenuBar     1 ;# Setup Menu Bar
set ckCCS         1 ;# Initialize CCS
set ckCmdReply    1 ;# Display Cmd. Reply
set cwp           "" ;# Set Current Working Point
set par(sizeCmdReply) 1 ;# Size of reply window
set actAreaHeight 5; # Set height of action area 

panReadOption winter
panCreateFrame waEi ;# Create empty frame
panGetCvNames  waEi cv bcv ;# Get Canvas Names
panInit        $argc $argv waEi ;# Initialization



UifEntry           $cv.in -canvasAnchor nw -default 0 -label {New position} \
                   -labelFont -Adobe-helvetica-medium-r-normal--14* \
                   -labelWidth 0 -maxVal 60000 -minVal -40000 -units Encoder \
                   -variable gvar(setValue) -width 10
UifButton          $cv.waEi-wdg1 -canvasAnchor nw \
                   -command {set gvar(setValReply) [panSendCommand $env(RTAPENV) waSetValueEvh SETVAL CHECK_ALL 50000 $gvar(setValue)]} \
                   -initialState normal -label SETVAL -popup 0 \
                   -stateVar gvar(waEi-wdg11Var) -width 0
UifButton          $cv.waEi-wdg2 -canvasAnchor nw \
                   -command {panSendCommand $env(RTAPENV) waSetValueEvh ONLINE CHECK_ALL 50000 ""} \
                   -initialState normal -label ONLINE -popup 0 \
                   -stateVar gvar(waEi-wdg11Var) -width 0
UifButton          $cv.waEi-wdg3 -canvasAnchor nw \
                   -command {panSendCommand $env(RTAPENV) waSetValueEvh STANDBY CHECK_ALL 50000 ""} \
                   -initialState normal -label STANDBY -popup 0 \
                   -stateVar gvar(waEi-wdg11Var) -width 0
UifOutputString    $cv.waEi-wdg4 -anchor center -canvasAnchor nw \
                   -dbMode dbEvent -evtFilter {"w"} \
                   -evtScript {panEvtDbUpdate waEi-wdg4 %A %T %D %Q} \
                   -font -Adobe-courier-medium-r-normal--14* -frame 1 \
                   -label State: \
                   -labelFont -Adobe-helvetica-medium-r-normal--14* \
                   -labelWidth 12 -listColors {Red Red Blue Blue LimeGreen} \
                   -listStrings {Unknown Off Loaded Standby Online} \
                   -listValues {0 1 2 3 4} \
                   -variable gvar(:Appl_data:setValue.state) -width 10
UifOutput          $cv.waEi-wdg5 -anchor w -canvasAnchor nw -color Black \
                   -dbMode dbPoll -evtFilter {"w"} \
                   -evtScript {panEvtDbUpdate waEi-wdg5 %A %T %D %Q} \
                   -font -Adobe-courier-medium-r-normal--14* -frame 1 \
                   -label {Motor position:} \
                   -labelFont -Adobe-helvetica-medium-r-normal--14* \
                   -labelWidth 12 -units Deg \
                   -variable gvar(:Appl_data:setValue.position) -width 5
UifOutput          $cv.waEi-wdg6 -anchor w -canvasAnchor nw -color Black \
                   -dbMode dbPoll -evtFilter {"w"} \
                   -evtScript {panEvtDbUpdate waEi-wdg6 %A %T %D %Q} \
                   -font -Adobe-courier-medium-r-normal--14* -frame 1 \
                   -label {Motor position:} \
                   -labelFont -Adobe-helvetica-medium-r-normal--14* \
                   -labelWidth 12 -units Encoder \
                   -variable gvar(:Appl_data:setValue:lcu.position) -width 5
UifOutput          $cv.waEi-wdg7 -anchor w -canvasAnchor nw -color Black \
                   -dbMode dbPoll -evtFilter {"w"} \
                   -evtScript {panEvtDbUpdate waEi-wdg7 %A %T %D %Q} \
                   -font -Adobe-courier-medium-r-normal--14* -frame 1 \
                   -label {Motor error:} \
                   -labelFont -Adobe-helvetica-medium-r-normal--14* \
                   -labelWidth 12 -units Encoder \
                   -variable gvar(:Appl_data:setValue:lcu.followingErr) \
                   -width 5
UifButton          $cv.waEi-wdg8 -canvasAnchor nw \
                   -command {set gvar(getValReply) [panSendCommand $env(RTAPENV) waSetValueEvh GETVAL CHECK_ALL 50000 ""]} \
                   -initialState normal -label GETVAL -popup 0 \
                   -stateVar gvar(waEi-wdg11Var) -width 0
UifButton          $cv.waEi-wdg9 -canvasAnchor nw \
                   -command {set gvar(testReply) [panSendCommand $env(RTAPENV) waSetValueEvh TEST CHECK_ALL 50000 $gvar(testValue)]} \
                   -initialState normal -label TEST -popup 0 \
                   -stateVar gvar(waEi-wdg11Var) -width 0
UifEntry           $cv.waEi-wdg10 -canvasAnchor nw -default 0 \
                   -label {Test string} \
                   -labelFont -Adobe-helvetica-medium-r-normal--14* \
                   -labelWidth 0 -maxVal 60000 -minVal -40000 \
                   -variable gvar(testValue) -width 10

#
#  Canvas Items
#


#
# Set Widget Configuration
#
set panWidget(in)  {UifEntry 108.0 136.0 1 0 0 0 0 setValue 0 N -40000 60000 0 0 0 0}
set panWidget(waEi-wdg1)  {UifButton 8.0 136.0 1 0 0 0 0 {} 0 {}}
set panWidget(waEi-wdg10)  {UifEntry 108.0 208.0 1 0 0 0 0 testValue 0 N -40000 60000 0 0 0 0}
set panWidget(waEi-wdg2)  {UifButton 404 4 1 0 0 0 0 {} 0 {}}
set panWidget(waEi-wdg3)  {UifButton 404 40 1 0 0 0 0 {} 0 {}}
set panWidget(waEi-wdg4)  {UifOutputString 8 4 1 1 0 0 0 :Appl_data:setValue.state 0 {}}
set panWidget(waEi-wdg5)  {UifOutput 8 36 1 1 0 0 0 :Appl_data:setValue.position 0 %3.3f 3}
set panWidget(waEi-wdg6)  {UifOutput 8 64 1 1 0 0 0 :Appl_data:setValue:lcu.position 0 %3.3f 3}
set panWidget(waEi-wdg7)  {UifOutput 8 92 1 1 0 0 0 :Appl_data:setValue:lcu.followingErr 0 %3.3f 3}
set panWidget(waEi-wdg8)  {UifButton 8 172 1 0 0 0 0 {} 0 {}}
set panWidget(waEi-wdg9)  {UifButton 8 208 1 0 0 0 0 {} 0 {}}

#
# Set Database Configuration
#
set panDbData(waEi-wdg4)  [list out local :Appl_data:setValue.state 0 0 0 0 0 0 0 {}]
set panDbData(waEi-wdg5)  [list out local :Appl_data:setValue.position 0 0 0 0 0 0 1 {}]
set panDbData(waEi-wdg6)  [list out local :Appl_data:setValue:lcu.position 0 0 0 0 0 0 1 {}]
set panDbData(waEi-wdg7)  [list out local :Appl_data:setValue:lcu.followingErr 0 0 0 0 0 0 1 {}]

#
# Set Short Help for each widget
#

#
#-----------------------------------------------
#           Menu Bar Definition  
#-----------------------------------------------
# 

set menu(0) {File 1 file}
set menu(1) {{Std. Options} 0 stdoptions}
set menu(2) {Help 1 help}


# Add MenuButton < File > 

set mb [addMenuButton $menuBar file " File " -1 left]

# Menu  

addMenuCmd $mb "Quit" 0 {panClosePanel}

# Add MenuButton < Std. Options > 

set mb [addMenuButton $menuBar stdoptions " Std. Options " -1 left]

# Menu  

addMenuCmd $mb "Refresh Database values" 0 {global cv; panUpdateOutput $cv}
addMenuCmd $mb "Re-Start DataBase Events" 0 {global cv ; panEvtDbOperation $cv RESTART all }

# Add MenuButton < Help > 

set mb [addMenuButton $menuBar help " Help " -1 right]

# Menu  

addMenuCmd $mb "Extended Help" 0 {puts "Not Implemented"}

#
#-----------------------------------------------
#           Menu Help Definition  
#-----------------------------------------------
# 


#
#-----------------------------------------------
#            Create the Panel  
#-----------------------------------------------
#

wm geometry  $panRoot 547x418
wm title     $panRoot "Workshop Demo"
set par(TITLE) "Workshop Demo" 

panMainStart  waEi $argc $argv

#--------------------    End of Main   --------------------

