;+
; PROJECT
;           SOLARB EIS
;
; NAME
;           EIS_CPT_GUI__DEFINE
;
; PURPOSE
;           eis_cpt_gui class definition
;
; NOTES
;           The
;
; CATEGORY
;           EIS timeline planning
;
; WRITTEN
;           John A Rainne RAL
;
; VERSION
;           v0.1 JAR 2-Apr-2007
;               Corrected raster data volume calculation to take account
;               of compression.
;           v0.2 JAR 3-Apr-2007
;               Added eis_plan summary to create a file listing a detailed
;               summary of the plan - useful for co-observing.
;           v0.3 JAR 4-Apr-2007
;               Made message widget_text a scrollable area.
;           v0.4 JAR 18-Apr-2007
;               Added a check to ensure each entry sequence_id is unique.
;               If not, just complain for now.
;           v0.5 JAR 30-Apr-2007
;                Added an extra 5% onto the calculated data rate. This
;                was at Hiro's request.
;           v0.6 JAR 15-Jun-2007
;                Large update due to requests from Daves who wanted CPT
;                gui time text-boxes to respond to all events (NOT just
;                hitting return). This required eliminating the datetime
;                objects - and introducing regular widgets for this case.
;                As a consequence, however, we've lost the ability to plot
;                the CPT period on the timeline display.
;                Also, renaming output DR and eis_plan files based on
;                date from UPLOAD TIME
;           v0.7 JAR 29-Jun-2007
;                Added text-box for Pass ID
;           v0.8 JAR 4-Jul-2007
;                Introduced a facility to change the cpt_output_dir
;                environment variable - so that the output files can
;                be saved anywhere.
;                Also now save PT files (dr and eis_plan) to that directory.
;                Also tidied the message window.
;           v0.9 JAR 5-Jul-2007
;                Introduced a text-box for "OBSTBL Upload Pass No". Current
;                Pass ID text-box has been renamed "OP/OG Upload Pass No".
;                The latter number is associated with all the output files
;                except the obstbl.
;          v1.0 JAR 30-Aug-2007
;                Check for recursive studies. For DR file creation, if found
;                then set ra_stop timeline as start_time of the next study.
;          v1.1 JAR 10-Sep-2007
;              For RECURSIVE studies - list study as a single line.
;          v1.2 JAR 20-Sep-2007
;              Fixed bug where I was supplying eis_cpt with the wrong date
;          v1.3 JAR 4-Mar-2008
;              Updated eis_upload structure tags to include opog_pass_id and
;              orl_upload_id.
;          v1.4 JAR 27-Mar-2008
;              Added tStartID and tStopID to setProperty method
;          v1.5 JAR 19-May-2008
;               Removed Sub-Tohban (Tohban_2) field as requested
;          v1.6 JAR 27-May-2008
;               Now use tlc method "create_dr_output" to make contents of
;               dr file.
;          v1.7 JAR 28-May-2008
;               Added "CPT started at" + time string to output
;          v1.8 JAR 19-Jun-2008
;               Copy DR file to $CMDPLN/latest directory
;          v1.9 JAR 25-Jun-2008
;               Integrated cpt_str structure to remember CPT fields
;          v2.0 JAR 25-Sep-2008
;               Save CPT data (start_time, stop_time, pass IDs, planners,
;               etc) to a file when testing/running CPT. This can then be
;               used for running the command line CPT.
;          v2.1 JAR 13-Feb-2009
;               Delete contents of /remote_planning/eisco/cmdpln/latest
;               directory
;          v2.2 JAR 5-Mar-2009
;               Read timeline entries from database, NOT tlc!
;               (cf: eis_rp_cpt__define.pro)
;          v2.3 JAR 9-Mar-2009
;               Added functionality to produce pointing image output
;          v2.4 JAR 5-Aug-2009
;               Count number of time-tagged studies
;          v2.5 JAR 14-Jun-2010
;               Ensure only 1 event study is appended to eis_study_detail
;               structure, regardless of how many times the trigger is
;               enabled. Previously, if 2 Eis Event BP hunters existed,
;               then 2 event tables were added.
;          v2.6 JAR 18-Jun-2010
;               Save Planner party details to Timeline DB
;          v2.7 JAR 9-Dec-2010. Changed EIS pixel size to 1 arcsecond.
;               Was 115. On advice from Martin and Khalid after testing
;               EIS Flare trigger at MSSL on 8-Dec-2010
;          v2.8 JAR 12-Apr-2011
;               Added "revised_plan" (exclusive) radio button to gui. Then
;               pass in a "revised_plan" (0/1) keyword to eis_cpt.
;          v2.9 JAR 18-Apr-2011
;               Added "revised_plan" handling.
;          v3.0 JAR 08-Sep-2011
;               IF invalid trigger tables, then issue warning + bail out
;          v3.1 JAR 24-Jul-2012
;               Changed the value of the tag from 1 to 3
;               "eis_eng_props.xrt_flare_parameters.eis_fov_flag"
;               Also, if x0 or y0 are zero, then subtract off an offset
;          v3.2 JAR 09-Sep-2014
;               Added a reminder to run the backup script upon closing the
;               CPT tool.
;          v3.3 JAR 03-Dec-2014
;               Updated EIS Flare trigger handling. Nice.
;
;
;
;------------------------------------------------------------------------------;
FUNCTION eis_cpt_gui::Init , parentClass

Self.parentClass  = parentClass
Self.group_leader = parentClass->tlbID()

; Get tStart and tStop
Self.parentClass->getProperty , tl_graphics = tl_graphics
Self.tl_graphics = tl_graphics
;-------------------create the main base---------------------------------------;
pt_version = eis_get_pt_version_number()
widTitle = "EIS CPT" + pt_version
TLB_EVENT                   = {eis_cpt_gui_Event}
TLB_EVENT.eis_cpt_gui       = Self
TLB_EVENT.Type              = "TLB"
Self.tlbID                  = WIDGET_BASE(                                  $
                                    TITLE       = widTitle,                 $
                                    COLUMN      = 1,                        $
                                    /FLOATING      ,                        $
                                    ;/MODAL         ,                        $
                                    GROUP_LEADER = Self.group_leader ,      $
                                    UValue      = TLB_EVENT)
;
;-------------------create the GUI------------------------------;
Self->createGUI

RETURN, 1

END
;______________________________________________________________________________
;
;______________________________________________________________________________
PRO eis_cpt_gui::createGUI




; ; ______________________________________________________________________
; ;
; ; OP Period BASE
; ;
; ; ______________________________________________________________________
; Self.parentClass->getProperty , opev = opev
; IF (N_TAGS((*opev)[0]) NE 0) THEN BEGIN
;
;     opBase                  = WIDGET_BASE(Self.tlbID   ,                    $
;                                     ROW         = 1    ,                    $
;                                     /FRAME)
;
;     IF (N_ELEMENTS(*opev) GT 0) THEN BEGIN
;         value = Self->create_droplist_value(opev)
;     ENDIF
;     OP_EVENT                = {eis_cpt_gui_Event}
;     OP_EVENT.eis_cpt_gui    = Self
;     OP_EVENT.Type           = "OP"
;     ramIDButtonID           = WIDGET_DROPLIST(opBase       ,                $
;                                     value       = value        ,            $
;                                     title       = 'OP Period:  '  ,         $
;                                     Event_Pro   = 'eis_cpt_gui_EV',         $
;                                     uValue      = OP_EVENT)
;
; ENDIF

Self.parentClass->getProperty , cpt_str = cpt_str

; ______________________________________________________________________
;
; Time base
;
; ______________________________________________________________________
cpttimeBase                 = WIDGET_BASE(Self.tlbID ,                      $
                                    COLUMN     = 1  ,                      $
                                    FRAME       = 1 )
timeBase                    = WIDGET_BASE(cpttimeBase ,                      $
                                    ROW         = 1 )

;---------------------------------------------------------------------------
;
; Time START
;
;---------------------------------------------------------------------------
startBase                   = WIDGET_BASE(timeBase ,                        $
                                    ROW         = 1)

aLabel                      = WIDGET_LABEL(startBase ,                      $
                                    value       = 'Start Time:'    ,        $
                                    /ALIGN_RIGHT ,                          $
                                    xSize       = 150)


; ; Get tStart and tStop
; Self.parentClass->getProperty , tl_graphics = tl_graphics
; Ok, get display start time (TAI) in UTC
tStart_tai   = Self.tl_graphics.axes.x_axis_day_tai

startTime    = anytim2utc(Self.tl_graphics.axes.x_axis_day_tai)
; Convert hours (cursor position, event.x) into UTC
tLength      = sec2utc(Self.tl_graphics.axes.x_axis_length * 60. * 60.)

tStop        = startTime
tStop.mjd    = startTime.mjd  + tLength.mjd
tStop.time   = startTime.time + tLength.time
tStop_tai    = utc2tai(tStop)

tStart_string  = ANYTIM2UTC(tStart_tai          , /STIME , /TRUNCATE)
tStop_string   = ANYTIM2UTC(tStop_tai           , /STIME , /TRUNCATE)
tUpload_string = ANYTIM2UTC(tStart_tai - 1000.  , /STIME , /TRUNCATE)

TSTART_EVENT                = {eis_cpt_gui_Event}
TSTART_EVENT.eis_cpt_gui    = Self
TSTART_EVENT.Type           = "TSTART"
Self.tStartID               = WIDGET_TEXT(startBase  ,                      $
                                    value       = tStart_string      ,      $
                                    /EDITABLE                        ,      $
                                    ;/ALL_EVENTS                      ,      $
                                    uValue      = TSTART_EVENT       ,      $
                                    xSize       = 22)

;---------------------------------------------------------------------------
;
; Time END
;
;---------------------------------------------------------------------------
stopBase                    = WIDGET_BASE(timeBase ,                        $
                                    ROW         = 1)

aLabel                      = WIDGET_LABEL(stopBase  ,                      $
                                    value       = 'Stop Time: '    ,         $
                                    /ALIGN_LEFT )

TSTOP_EVENT                 = {eis_cpt_gui_Event}
TSTOP_EVENT.eis_cpt_gui     = Self
TSTOP_EVENT.Type            = "TSTOP"
Self.tStopID                = WIDGET_TEXT(stopBase   ,                      $
                                    value       = tStop_string       ,      $
                                    /EDITABLE                        ,      $
                                    ;/ALL_EVENTS                      ,      $
                                    uValue      = TSTOP_EVENT        ,      $
                                    xSize       = 22)

value = 'Set times by right-clicking on the'       +     $
        ' timeline plot, and select from the list.'
aLabel                     = WIDGET_LABEL(cpttimeBase                ,     $
                                   value       = value               ,     $
                                   /ALIGN_LEFT)

;---------------------------------------------------------------------------
;
; UPLOAD TIME
;
;---------------------------------------------------------------------------
uploadBase                  = WIDGET_BASE(Self.tlbID ,                      $
                                    ROW         = 1  ,                      $
                                    /FRAME)

;---------------------------------------------------------------------------
;
; UPLOAD TIME BASE
;
;---------------------------------------------------------------------------
uploadTimeBase              = WIDGET_BASE(uploadBase ,                      $
                                    ROW         = 1)


aLabel                      = WIDGET_LABEL(uploadTimeBase  ,                $
                                    value       = 'Upload Time:'    ,       $
                                    /ALIGN_RIGHT,                           $
                                    xSize       = 150)



TUPLOAD_EVENT               = {eis_cpt_gui_Event}
TUPLOAD_EVENT.eis_cpt_gui   = Self
TUPLOAD_EVENT.Type          = "TUPLOAD"
Self.tUploadID              = WIDGET_TEXT(uploadTimeBase   ,                $
                                    value       = tUpload_string     ,      $
                                    /EDITABLE                        ,      $
                                    /ALL_EVENTS                      ,      $
                                    uValue      = TUPLOAD_EVENT      ,      $
                                    xSize       = 22)

value = "        "
aLabel                     = WIDGET_LABEL(uploadTimeBase             ,     $
                                   value       = value)
; ______________________________________________________________________
;
; Revised Plan base
;
; ______________________________________________________________________
RevisedPlanBase            = WIDGET_BASE(uploadTimeBase ,                      $
                                    ROW         = 1  ,                      $
                                    FRAME       = 1)

RevisedPlanBaseExc         = WIDGET_BASE(RevisedPlanBase ,                      $
                                    ROW         = 1  ,                      $
                                    FRAME       = 0  ,                      $
                                    /NONEXCLUSIVE)


REVISED_EVENT              = {eis_cpt_gui_Event}
REVISED_EVENT.eis_cpt_gui  = Self
REVISED_EVENT.Type         = "REVISED"
value = 'This is a REVISED plan'
Self.revisedButtonID       = WIDGET_BUTTON(RevisedPlanBaseExc,                     $
                                    value       = value        ,            $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = REVISED_EVENT)

REVISEDINFO_EVENT          = {eis_cpt_gui_Event}
REVISEDINFO_EVENT.eis_cpt_gui = Self
REVISEDINFO_EVENT.Type     = "REVISEDINFO"
REVISEDINFObutton          = WIDGET_BUTTON(RevisedPlanBase,                     $
                                    value       = ' ? ',              $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = REVISEDINFO_EVENT)

;---------------------------------------------------------------------------
;
; PASS ID BASE
;
;---------------------------------------------------------------------------
passIDBase                  = WIDGET_BASE(Self.tlbID ,                      $
                                    ROW         = 1  ,                      $
                                    /FRAME)


;---------------------------------------------------------------------------
;
; OP/OG Upload PASS ID
;
;---------------------------------------------------------------------------
OPOGpassIDBase              = WIDGET_BASE(passIDBase ,                      $
                                    ROW         = 1)

value = 'OP/OG Upload Pass No:'
aLabel                      = WIDGET_LABEL(OPOGpassIDBase  ,                $
                                    value       = value                ,    $
                                    /ALIGN_RIGHT,                           $
                                    xSize       = 150)

OPOG_EVENT                  = {eis_cpt_gui_Event}
OPOG_EVENT.eis_cpt_gui      = Self
OPOG_EVENT.Type             = "OPOGPASSID"
value = STRING(format='(I04)',cpt_str.opogPassNum)
Self.opogPassNumID          = WIDGET_TEXT(OPOGpassIDBase   ,                $
                                    value       = value              ,      $
                                    /EDITABLE                        ,      $
                                    /ALL_EVENTS                      ,      $
                                    uValue      = OPOG_EVENT      ,      $
                                    xSize       = 22)
;---------------------------------------------------------------------------
;
; OP/OG Upload PASS ID
;
;---------------------------------------------------------------------------
OBSTBLpassIDBase            = WIDGET_BASE(passIDBase ,                      $
                                    ROW         = 1)

value = ' OBSTBL (EIS Table) Upload Pass No:'
aLabel                      = WIDGET_LABEL(OBSTBLpassIDBase  ,              $
                                    value       = value                ,    $
                                    /ALIGN_RIGHT,                           $
                                    xSize       = 230)

OBSTBL_EVENT                = {eis_cpt_gui_Event}
OBSTBL_EVENT.eis_cpt_gui    = Self
OBSTBL_EVENT.Type           = "OBSTBLPASSID"
value = STRING(format='(I04)',cpt_str.obstblPassNum)
Self.obstblPassNumID        = WIDGET_TEXT(OBSTBLpassIDBase   ,              $
                                    value       = value           ,      $
                                    /EDITABLE                        ,      $
                                    /ALL_EVENTS                      ,      $
                                    uValue      = OBSTBL_EVENT       ,      $
                                    xSize       = 22)
; ______________________________________________________________________
;
; J-Side BASE
;
; ______________________________________________________________________
jsideBase                   = WIDGET_BASE(Self.tlbID  ,                     $
                                    COLUMN      = 1   ,                     $
                                    /FRAME)

; ______________________________________________________________________
;
; Planning Party
;
; ______________________________________________________________________
observerBase                = WIDGET_BASE(jsideBase   ,                     $
                                    ROW         = 1 )

value = 'EIS CO:'
aLabel                      = WIDGET_LABEL(observerBase  ,                  $
                                    /ALIGN_LEFT                       ,     $
                                    /DYNAMIC_RESIZE                   ,     $
                                    value       = value)

OBSERVER_EVENT             = {eis_cpt_gui_Event}
OBSERVER_EVENT.eis_cpt_gui = Self
OBSERVER_EVENT.Type        = "OBSERVER"
list = eis_read_study_lists(/OBSERVER)
Self.observerComboID       = WIDGET_COMBOBOX(observerBase            ,     $
                                    value       = list               ,     $
                                    /EDITABLE                        ,     $
                                    uValue      = OBSERVER_EVENT)
index_list = WHERE(cpt_str.observer EQ list , count)
CASE (count GE 1) OF
   1    : index = index_list[0]
   ELSE : index = 0
ENDCASE
WIDGET_CONTROL , Self.observerComboID , set_combobox_select = index

;
; Chief Planner CP
;
value = '  CP:'
aLabel                      = WIDGET_LABEL(observerBase  ,                  $
                                    /ALIGN_LEFT                       ,     $
                                    /DYNAMIC_RESIZE                   ,     $
                                    value       = value)

CP_EVENT                   = {eis_cpt_gui_Event}
CP_EVENT.eis_cpt_gui       = Self
CP_EVENT.Type              = "CP"
list = eis_read_study_lists(/PLANNER)
Self.cpComboID             = WIDGET_COMBOBOX(observerBase            ,     $
                                    value       = list               ,     $
                                    /EDITABLE                        ,     $
                                    uValue      = CP_EVENT)
index_list = WHERE(cpt_str.planner EQ list , count)
CASE (count GE 1) OF
   1    : index = index_list[0]
   ELSE : index = 0
ENDCASE
WIDGET_CONTROL , Self.cpComboID , set_combobox_select = index

;
; TohBan
;
value = '  Chief Tohban:'
aLabel                      = WIDGET_LABEL(observerBase  ,                  $
                                    /ALIGN_LEFT                       ,     $
                                    /DYNAMIC_RESIZE                   ,     $
                                    value       = value)

TOHBAN_EVENT                   = {eis_cpt_gui_Event}
TOHBAN_EVENT.eis_cpt_gui       = Self
TOHBAN_EVENT.Type              = "TOHBAN"
list = eis_read_study_lists(/TOHBAN)
Self.tohbahComboID             = WIDGET_COMBOBOX(observerBase            ,     $
                                    value       = list               ,     $
                                    /EDITABLE                        ,     $
                                    uValue      = TOHBAN_EVENT)
index_list = WHERE(cpt_str.tohban EQ list , count)
CASE (count GE 1) OF
   1    : index = index_list[0]
   ELSE : index = 0
ENDCASE
WIDGET_CONTROL , Self.tohbahComboID , set_combobox_select = index
; ; ______________________________________________________________________
; ;
; ; Output DIR Base
; ;
; ; ______________________________________________________________________
; outputDirBase               = WIDGET_BASE(Self.tlbID ,                      $
;                                     ROW         = 1  ,                      $
;                                     FRAME       = 1 )
;
; value = 'Output Dir:'
; aLabel                      = WIDGET_LABEL(outputDirBase              ,     $
;                                     /ALIGN_LEFT                       ,     $
;                                     xSize       = 100                 ,     $
;                                     value       = value)
;
; Self.outputDirID            = WIDGET_LABEL(outputDirBase ,                  $
;                                     xSize       = 300    ,                  $
;                                     /ALIGN_LEFT)
;
; pathName = EXPAND_PATH(GETENV('cpt_output_dir'))
; WIDGET_CONTROL , Self.outputDirID , set_value = pathName
;
; SETOPDIR_EVENT              = {eis_cpt_gui_Event}
; SETOPDIR_EVENT.eis_cpt_gui  = Self
; SETOPDIR_EVENT.Type         = "SETOPDIR"
; SETOPDIRButtonID            = WIDGET_BUTTON(outputDirBase     ,             $
;                                     value       = ' Modify... '   ,         $
;                                     Event_Pro   = 'eis_cpt_gui_EV',         $
;                                     uValue      = SETOPDIR_EVENT)


; ______________________________________________________________________
;
; Output Base
;
; ______________________________________________________________________
outputBase                  = WIDGET_BASE(Self.tlbID ,                      $
                                    COLUMN      = 1  ,                      $
                                    FRAME       = 1 )

Self.outputTextID           = WIDGET_TEXT(outputBase ,                      $
                                    ySize       = 18 ,                      $
                                    xSize       = 120,/SCROLL)


; ______________________________________________________________________
;
; Parameters base
;
; ______________________________________________________________________
parametersBase              = WIDGET_BASE(Self.tlbID ,                      $
                                    COLUMN      = 1  ,                      $
                                    FRAME       = 1 )

;
; RESET
;
resetBase                   = WIDGET_BASE(parametersBase ,                  $
                                    ROW         = 1)

resetBaseNonExc             = WIDGET_BASE(resetBase ,                  $
                                    ROW         = 1 ,                       $
                                    /NONEXCLUSIVE)

RESET_EVENT                 = {eis_cpt_gui_Event}
RESET_EVENT.eis_cpt_gui     = Self
RESET_EVENT.Type            = "RESET"
value = 'Reset'
Self.resetButtonID          = WIDGET_BUTTON(resetBaseNonExc,                $
                                    value       = value   ,                 $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = RESET_EVENT)


Self.resetBaseID            = WIDGET_BASE(resetBase ,                       $
                                    ROW         = 1 ,                       $
                                    SENSITIVE   = 0 ,                       $
                                    /EXCLUSIVE)

SOFT_EVENT                  = {eis_cpt_gui_Event}
SOFT_EVENT.eis_cpt_gui      = Self
SOFT_EVENT.Type             = "SOFT"
value = 'Soft - only OBSTBL map'
Self.softButtonID           = WIDGET_BUTTON(Self.resetBaseID,                   $
                                    value       = value   ,                 $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = SOFT_EVENT)
WIDGET_CONTROL , Self.softButtonID , set_button = 1

HARD_EVENT                  = {eis_cpt_gui_Event}
HARD_EVENT.eis_cpt_gui      = Self
HARD_EVENT.Type             = "HARD"
value = 'Hard - OBSTBL and map'
buttonID                    = WIDGET_BUTTON(Self.resetBaseID,                   $
                                    value       = value   ,                 $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = HARD_EVENT)

; ______________________________________________________________________
;
; Options base
;
; ______________________________________________________________________
optionsBase                 = WIDGET_BASE(Self.tlbID ,                      $
                                    COLUMN      = 1  ,                      $
                                    FRAME       = 0)

; EMERGENCY_EVENT             = {eis_cpt_gui_Event}
; EMERGENCY_EVENT.eis_cpt_gui = Self
; EMERGENCY_EVENT.Type        = "EMERGENCY"
; value = 'Append Default study'
; Self.emergencyButtonID           = WIDGET_BUTTON(optionsBase,                    $
;                                     value       = value   ,            $
;                                     Event_Pro   = 'eis_cpt_gui_EV',         $
;                                     uValue      = EMERGENCY_EVENT)
; WIDGET_CONTROL , Self.emergencyButtonID , set_button = 1

MSSLBase                   = WIDGET_BASE(optionsBase ,                      $
                                    COLUMN      = 1  ,                      $
                                    FRAME       = 0  ,                      $
                                    /NONEXCLUSIVE)

MSSL_EVENT                  = {eis_cpt_gui_Event}
MSSL_EVENT.eis_cpt_gui      = Self
MSSL_EVENT.Type             = "MSSL"
value = 'EGSE output (ASCII) - produce sequence and linelist tables' +      $
        ' containing MSSL command mnemonics'
Self.msslButtonID           = WIDGET_BUTTON(MSSLBase,                    $
                                    value       = value   ,            $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = MSSL_EVENT)

INTEL_EVENT                 = {eis_cpt_gui_Event}
INTEL_EVENT.eis_cpt_gui     = Self
INTEL_EVENT.Type            = "INTEL"
value = 'EGSE output (Intel Hex) - produce sequence and linelist tables'
Self.intelButtonID          = WIDGET_BUTTON(MSSLBase,                    $
                                    value       = value        ,            $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = INTEL_EVENT)

QUIET_EVENT                 = {eis_cpt_gui_Event}
QUIET_EVENT.eis_cpt_gui     = Self
QUIET_EVENT.Type            = "QUIET"
value = 'No printout to terminal window'
Self.quietButtonID          = WIDGET_BUTTON(MSSLBase,                    $
                                    value       = value        ,            $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = QUIET_EVENT)


; ______________________________________________________________________
;
; Bottom base
;
; ______________________________________________________________________
bottomBase                  = WIDGET_BASE(Self.tlbID ,                      $
                                    ROW         = 1  ,                      $
                                    /FRAME           ,                      $
                                    /GRID_LAYOUT)

Self.parentClass->getProperty , rpmode = rpmode
IF (rpmode EQ 0) THEN BEGIN
   APPLY_EVENT             = {eis_cpt_gui_Event}
   APPLY_EVENT.eis_cpt_gui = Self
   APPLY_EVENT.Type        = "APPLY"
   APPLYbutton             = WIDGET_BUTTON(bottomBase,                     $
                                    value       = ' Run CPT ',              $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = APPLY_EVENT)
ENDIF

TESTCPT_EVENT               = {eis_cpt_gui_Event}
TESTCPT_EVENT.eis_cpt_gui   = Self
TESTCPT_EVENT.Type          = "TESTCPT"
TESTCPTbutton               = WIDGET_BUTTON(bottomBase,                     $
                                    value       = ' Test CPT ',              $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = TESTCPT_EVENT)


QUIT_EVENT                  = {eis_cpt_gui_Event}
QUIT_EVENT.eis_cpt_gui      = Self
QUIT_EVENT.Type             = "QUIT"
quitbutton                  = WIDGET_BUTTON(bottomBase,                     $
                                    value       = ' Quit ',              $
                                    Event_Pro   = 'eis_cpt_gui_EV',         $
                                    uValue      = QUIT_EVENT)


END

;______________________________________________________________________________
;
;______________________________________________________________________________
PRO eis_cpt_gui_Cleanup , wid

WIDGET_CONTROL , wid , get_uvalue = eis_cpt_gui_Event
OBJ_DESTROY    , eis_cpt_gui_Event.eis_cpt_gui

END
;______________________________________________________________________________
; Cleanup
;______________________________________________________________________________
PRO eis_cpt_gui::CleanUp

OBJ_DESTROY , Self.tlc
PTR_FREE    , Self.dr_output
print,'Shutting down CPT GUI'

END
;______________________________________________________________________________
;
;______________________________________________________________________________
PRO eis_cpt_gui::setProperty, author_struct = author_struct    ,           $
                              tStartID      = tStartID         ,           $
                              tStopID       = tStopID

IF (N_ELEMENTS(tStartID) GT 0) THEN BEGIN

   new_value = anytim2utc(tStartID , /STIME , /TRUNCATE)
   WIDGET_CONTROL , Self.tStartID  , set_value = new_value

ENDIF
IF (N_ELEMENTS(tStopID) GT 0) THEN BEGIN

   new_value = anytim2utc(tStopID , /STIME , /TRUNCATE)
   WIDGET_CONTROL , Self.tStopID  , set_value = new_value

ENDIF

End
;______________________________________________________________________________
;
;______________________________________________________________________________
PRO eis_cpt_gui::GetProperty, tlbID      = tlbID                     ,     $
                              start_time = start_time                ,     $
                              stop_time  = stop_time                 ,     $
                              tl_graphics = tl_graphics

tlbID      = Self.tlbID
start_time = Self->get_start_time()
stop_time  = Self->get_stop_time()
tl_graphics = Self.tl_graphics

END
;______________________________________________________________________________
; Return widget id
;______________________________________________________________________________
FUNCTION eis_cpt_gui::tlbID

RETURN , Self.tlbID

END
;______________________________________________________________________________
; Widget_Control wrapper
;______________________________________________________________________________
PRO eis_cpt_gui::Control, _Ref_Extra=Widget_Control_Keywords

WIDGET_CONTROL , Self.tlbID, _Extra=Widget_Control_Keywords

END
;______________________________________________________________________________
; Widget_Info wrapper
;______________________________________________________________________________
FUNCTION eis_cpt_gui::Info, _Ref_Extra=Widget_Info_Keywords

RETURN , Widget_Info(Self.tlbID, _Extra=Widget_Info_Keywords)

END
;______________________________________________________________________________
; Realize wrapper
;______________________________________________________________________________
PRO eis_cpt_gui::Realize

WIDGET_CONTROL , Self.tlbID, /Realize

END
;______________________________________________________________________________
; XManager wrapper
;______________________________________________________________________________
PRO eis_cpt_gui::XManager;,group=group

XMANAGER , "eis_cpt_gui" ,   Self.tlbID ,                                 $
    Event_Handler  = "eis_cpt_gui_EV",                                    $
    cleanup        = "eis_cpt_gui_Cleanup",                               $
    GROUP_LEADER   = Self.group_leader ,                                    $
    /NO_BLOCK

END
;______________________________________________________________________________
;
;______________________________________________________________________________
PRO eis_cpt_gui_Event__Define

    struct = {  eis_cpt_gui_Event,                                              $
                Type            : "",        $ ;Unique identifier for event
                eis_cpt_gui   : OBJ_NEW(), $ ;Reference to object passed
                extra           : 0          $ ;to - often object associated
             }
END
;______________________________________________________________________________
; Event Handler wrapper
;______________________________________________________________________________
PRO eis_cpt_gui_EV , Event

;Get event handler structure containing eis_cpt_gui type object
Widget_CONTROL,Event.ID,get_uvalue = eis_cpt_gui_Event
;If a WIDGET_TAB event , just quit
IF (TAG_NAMES(event, /STRUCTURE_NAME) EQ 'WIDGET_TAB') THEN BEGIN
    ;print,'tab event'
    RETURN
ENDIF

;Call eis_cpt_gui's class member procedure "Handler"
eis_cpt_gui_Event.eis_cpt_gui->Handler,Event

END
;______________________________________________________________________________
;
; * THIS is the routine for putting in event handling NOT eis_cpt_gui_Ev above.
;
; Event Handler - handle events.  Derived classes must
; contain their own implementation in order to handle events or else pass in an
; procedure name/function name using the Event_Pro/Event_Func keywords to
; CWidget::Init()
;______________________________________________________________________________
PRO eis_cpt_gui::Handler, Event

WIDGET_CONTROL, Event.ID, Get_UValue = eis_cpt_gui_Event
CASE eis_cpt_gui_Event.Type OF
    "QUIT"         : Self->quit
    "SOFT"         :
    "HARD"         :
    "MSSL"         :
    "INTEL"        :
    "QUIET"        :
    "EMERGENCY"    : ;stop
    "RESET"        : Self->reset
    "APPLY"        : Self->apply
    "TESTCPT"      : Self->testCPT
    "TSTART"       : Self->initialize_plot
    "TSTOP"        : Self->initialize_plot
    "REVISED"      : Self->revised_plan
    "REVISEDINFO"  : Self->revised_plan_info
    "TUPLOAD"      : ;print,'tupload'
    "OPOGPASSID"   :
    "OBSTBLPASSID" :
    "SETOPDIR"     : Self->update_cpt_output_dir
    "OBSERVER"     :
    "CP"           :
    "TOHBAN"       :
    ELSE           : print,eis_cpt_gui_Event.Type
ENDCASE
END
;______________________________________________________________________________
; Show Revised Plan info
;______________________________________________________________________________
PRO eis_cpt_gui::revised_plan_info

mText = ["line 1"   , $
         "line 2"   , $
         "line 3"]
title = "Revised Plan Info"

xpopup , mText , title = title ; , group = Self.tlbID

END
;______________________________________________________________________________
; Un/Select Revised Plan Option
;______________________________________________________________________________
PRO eis_cpt_gui::revised_plan

; Get state of Revised Plan button
button_on = WIDGET_INFO(Self.revisedButtonID , /BUTTON_SET)

IF (button_on EQ 1) THEN BEGIN
   mText = "Are you sure you want to do this?"
   question  = DIALOG_MESSAGE( mText                                ,       $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /QUESTION )

IF (question EQ 'No') THEN $
   WIDGET_CONTROL , Self.revisedButtonID , set_button = 0

ENDIF


END
;______________________________________________________________________________
; Read Plan from Database
;______________________________________________________________________________
PRO eis_cpt_gui::readPlanFromDatabase

print,"Reading Timeline Database..."
IF (OBJ_VALID(Self.tlc) EQ 1) THEN OBJ_DESTROY , Self.tlc
; Read database
start_time = Self->get_start_time()
stop_time  = Self->get_stop_time()
IF (start_time EQ 0) OR (stop_time EQ 0) THEN RETURN
timeline = eis_get_timeline_entries(start_time, stop_time, /ALL)
;
; Remove entries that don't have an entry_type = 'S' or 'E'
;
IF (N_TAGS(timeline[0]) NE 0) THEN BEGIN

    entry_type = timeline[*].entry_type
    valid_tl   = WHERE(entry_type EQ 'S' OR entry_type EQ 'E' , valid_count)
    IF (valid_count NE 0) THEN timeline   = timeline[valid_tl]

ENDIF

;
; IF no entries are found then tlc->clear_all, zero widgets and bail out
;
IF (N_TAGS(timeline[0]) EQ 0) THEN BEGIN

    print,"No timeline entries found. Aborting CPT"
    RETURN

ENDIF ELSE BEGIN

    ; Create the tlc object
    Self.tlc = OBJ_NEW("eis_timeline_container" , Self)
    Self.tlc->read_database, timeline

ENDELSE

END
;______________________________________________________________________________
; Initialise Plot
;______________________________________________________________________________
PRO eis_cpt_gui::initialize_plot

Self.parentClass->getProperty , o_eis_timeline_plot_gui = o_eis_timeline_plot_gui
o_eis_timeline_plot_gui->initialize_plot

END
;______________________________________________________________________________
; Get CPT stop_time
;______________________________________________________________________________
FUNCTION eis_cpt_gui::get_stop_time

;
; Check tStop is valid
;
WIDGET_CONTROL , Self.tStopID , get_value = tStop
stopTime = tStop[0]
time_valid = valid_time(stopTime)
IF (time_valid NE 1) THEN BEGIN
   stop_time = 0.D
ENDIF ELSE BEGIN
   stop_time = anytim2tai(stopTime)
ENDELSE

RETURN , stop_time

END
;______________________________________________________________________________
; Get CPT start_time
;______________________________________________________________________________
FUNCTION eis_cpt_gui::get_start_time

;
; Check tStart is valid
;
WIDGET_CONTROL , Self.tStartID , get_value = tStart
startTime = tStart[0]
time_valid = valid_time(startTime)
IF (time_valid NE 1) THEN BEGIN
   start_time = 0.D
ENDIF ELSE BEGIN
   start_time = anytim2tai(startTime)
ENDELSE

RETURN , start_time

END
;______________________________________________________________________________
; Update cpt_output_dir
;______________________________________________________________________________
PRO eis_cpt_gui::update_cpt_output_dir

old_pathName = EXPAND_PATH(GETENV('cpt_output_dir'))

; Get new directory
title        = 'Select new cpt_output directory'
new_pathName = DIALOG_PICKFILE(path = old_pathName         ,                $
                           dialog_parent     = Self.tlbID  ,                $
                           /DIRECTORY                      ,                $
                           title = title)

IF (STRLEN(new_pathName[0]) EQ '') THEN RETURN

; Reset environment variable
SETENV,STRJOIN(['cpt_output_dir=',new_pathName],/SINGLE)

; Reset widget label
WIDGET_CONTROL , Self.outputDirID , set_value = new_pathName

END
;______________________________________________________________________________
; Quit
;______________________________________________________________________________
PRO eis_cpt_gui::quit

; Update parentClass's cpt_str structure
Self.parentClass->getProperty , cpt_str = cpt_str

WIDGET_CONTROL , Self.opogPassNumID   , get_value =  opogPassNum
WIDGET_CONTROL , Self.obstblPassNumID , get_value =  obstblPassNum
; Set planning party values
obs = WIDGET_INFO(Self.observerComboID , /COMBOBOX_GETTEXT)
cp  = WIDGET_INFO(Self.cpComboID       , /COMBOBOX_GETTEXT)
tbn = WIDGET_INFO(Self.tohbahComboID   , /COMBOBOX_GETTEXT)

cpt_str.observer      = obs
cpt_str.planner       = cp
cpt_str.tohban        = tbn
cpt_str.opogPassNum   = opogPassNum[0]
cpt_str.obstblPassNum = obstblPassNum[0]
Self.parentClass->setProperty , cpt_str = cpt_str
Self.parentClass->getProperty , eis_mk_plan_ini = eis_mk_plan_ini
eis_mk_plan_ini->update_ini_file

; JAR 09-Sep-2014
; Added a reminder to run the backup script upon closing the CPT tool.
mText    = "Please run the backup script (db_backup.sh)"
reminder = DIALOG_MESSAGE(mText                                        ,   $
                          /INFORMATION                                 ,   $
                          DIALOG_PARENT = Self.tlbID)

; Now kill GUI
Self.parentClass->kill_cpt_gui

END
;______________________________________________________________________________
; Create values for op droplist widget
;______________________________________________________________________________
FUNCTION eis_cpt_gui::create_droplist_value , opev

op = (*opev)[WHERE((*opev).name EQ 'op' , count)]
IF (count EQ 0) THEN stop
value = STRARR(count)
FOR i = 0, count -1 DO BEGIN

    start_time = anytim2utc(op[i].start_time , /STIME , /TRUNCATE)
    stop_time  = anytim2utc(op[i].stop_time  , /STIME , /TRUNCATE)
    value[i]   = STRJOIN([start_time,'  to  ',stop_time],/SINGLE)

ENDFOR

RETURN , value

END
;______________________________________________________________________________
; Reset
;______________________________________________________________________________
PRO eis_cpt_gui::reset

; Is reset button selected - ON
reset_on = WIDGET_INFO(Self.resetButtonID , /BUTTON_SET)
; Sensitize exclusive buttons accordingly
WIDGET_CONTROL , Self.resetBaseID , sensitive = reset_on

END
;______________________________________________________________________________
; Test CPT
;______________________________________________________________________________
PRO eis_cpt_gui::testCPT

Self->runCPT , jside = 2

END
;______________________________________________________________________________
; RUN CPT
;______________________________________________________________________________
PRO eis_cpt_gui::apply


Self->runCPT , jside = 1

END
;______________________________________________________________________________
; Run CPT
;______________________________________________________________________________
PRO eis_cpt_gui::runCPT , JSIDE = JSIDE

; JAR 13-Feb-2009. Friday the 13th.
; Valentine's Day tomorrow. Aaaahhhh!! Which is scarier?
; Delete existing files in /remote_planning/eisco/cmdpln/latest
pathName = STRJOIN([GETENV('CMDPLN_EISCO'),'latest'],/SINGLE,PATH_SEP())
IF (FILE_TEST(pathName , /DIRECTORY) EQ 1) THEN BEGIN
   files = FILE_SEARCH(pathName , '*' , count = count)
   IF (count GT 0) THEN FILE_DELETE , files , /QUIET
ENDIF
;
; Test cpt_output_dir is valid n, intel_tables, mssl_tables,
; and contains all the appropriate
; subdirectories, data_rate, dr, eis_plan, intel_tables, mssl_tables,
; obstbl, obstbl_map and orl
;
pathName      = EXPAND_PATH(GETENV('cpt_output_dir'))
subdirs       = ['data_rate','dr','eis_plan','intel_tables','mssl_tables',  $
                 'obstbl','obstbl_map','orl']
full_subdirs  = CONCAT_DIR(pathName,subdirs)
;
; Check directories exist
;
valid_op = FILE_TEST(full_subdirs)
; If failure, then bail out
IF (TOTAL(valid_op) NE N_ELEMENTS(full_subdirs)) THEN BEGIN
    BEEP
    transpose_subdir = TRANSPOSE(subdirs)
    mText1   = ['CPT Output Directory is invalid!'                ,         $
                ''                                                ,         $
                'Check it contains the following subdirectories;   '  ,     $
                '']
    mText2   = REFORM(transpose_subdir)
    mText3   = ['' , 'Aborting!']

    mText    = [mText1,mText2,mText3]

    complain = DIALOG_MESSAGE( mText                                ,       $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF

;
; Check directories are writable
;
valid_op = FILE_TEST(full_subdirs , /WRITE)
; If failure, then bail out
IF (TOTAL(valid_op) NE N_ELEMENTS(full_subdirs)) THEN BEGIN
    BEEP
    mText    = 'CPT Output Directory is invalid - there appears to be ' +   $
               'a write-access issue. Aborting!'
    complain = DIALOG_MESSAGE( mText                                ,       $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF

;
; Check tStart is valid
;
WIDGET_CONTROL , Self.tStartID , get_value = tStart
startTime = tStart[0]
time_valid = valid_time(startTime)
IF (time_valid NE 1) THEN BEGIN
    BEEP
    complain = DIALOG_MESSAGE( 'Start Time is not valid. Aborting!' ,       $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF
datetime_start = anytim2tai(startTime)
;
; Check tStop is valid
;
WIDGET_CONTROL , Self.tStopID , get_value = tStop
stopTime = tStop[0]
time_valid = valid_time(stopTime)
IF (time_valid NE 1) THEN BEGIN
    BEEP
    complain = DIALOG_MESSAGE( 'Stop Time is not valid. Aborting!'  ,       $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF
datetime_stop = anytim2tai(stopTime)

;
; Check tUpload is valid
;
WIDGET_CONTROL , Self.tUploadID , get_value = tUpload
time_valid = valid_time(tUpload[0])
IF (time_valid NE 1) THEN BEGIN
    BEEP
    complain = DIALOG_MESSAGE( 'Upload Time is not valid. Aborting!' ,      $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF
datetime_upload = anytim2tai(tUpload[0])

;
; Check OP/OG Pass ID is valid
;
WIDGET_CONTROL , Self.opogPassNumID , get_value = opog_pass_id
time_valid = valid_time(opog_pass_id[0])
IF (time_valid NE 1) THEN BEGIN
    BEEP
    complain = DIALOG_MESSAGE( 'Pass ID is not valid. Aborting!' ,      $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF
opog_pass_id_string = STRING(format='(I04)',FIX(opog_pass_id[0]))

;
; Check OBSTBL Pass ID is valid
;
WIDGET_CONTROL , Self.obstblPassNumID , get_value = obstbl_pass_id
time_valid = valid_time(obstbl_pass_id[0])
IF (time_valid NE 1) THEN BEGIN
    BEEP
    complain = DIALOG_MESSAGE( 'Pass ID is not valid. Aborting!' ,      $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF
obstbl_pass_id_string = STRING(format='(I04)',FIX(obstbl_pass_id[0]))

;
; Check stopTime > startTime
IF (datetime_start GE datetime_stop) THEN BEGIN
    BEEP
    mText = "D'OH! Stop Time > Start Time. Aborting!"
    complain = DIALOG_MESSAGE( mText                                 ,      $
                     DIALOG_PARENT = Self.tlbID,                            $
                     /ERROR )
    RETURN
ENDIF

;print,anytim2utc(datetime_start ,/stime,/truncate)
;print,anytim2utc(datetime_stop  ,/stime,/truncate)
;print,anytim2utc(datetime_upload,/stime,/truncate)

WIDGET_CONTROL , /HOURGLASS


;
; OK, 'cos we're reading an extended range of the database, we've probably
; got some entries that lie outside the CPT time range!
;
; What about entries that cross the CPT time range?????
;
; Read timeline database
Self->readPlanFromDatabase
IF (OBJ_VALID(Self.tlc) NE 1) THEN BEGIN
    BEEP
    mText = 'There are NO entries in this time range. Aborting!'
    complain = DIALOG_MESSAGE( mText       ,                        $
                         DIALOG_PARENT = Self.tlbID,                $
                         /ERROR )
    RETURN
ENDIF

;
; How many time-tagged studies do we have??????
;
tlc_info = Self.tlc->get_tlc_info()
tt_list  = WHERE(tlc_info[*].tt_list EQ 1 , tt_count)



all_tlc_entries = Self.tlc->get(/ALL)
;
; Loop over entries, weeding out those that are NOT within the
; CPT time range
;
; Make a temporary IDL_CONTAINER - and populate it with just
; those entries that are within the CPT time range
;
cpt_tlc = OBJ_NEW('EIS_TIMELINE_CONTAINER' , Self)
FOR i = 0 , Self.tlc->count() -1 DO BEGIN

    s = all_tlc_entries[i]->get()

    IF (s.time_component.start_time LE datetime_stop  ) AND                 $
       (s.time_component.start_time GE datetime_start ) THEN BEGIN

        IF (s.time_component.entry_type EQ 'S') OR                          $
           (s.time_component.entry_type EQ 'E') THEN BEGIN

            ; Set planning party values
            obs = WIDGET_INFO(Self.observerComboID , /COMBOBOX_GETTEXT)
            cp  = WIDGET_INFO(Self.cpComboID       , /COMBOBOX_GETTEXT)
            tbn = WIDGET_INFO(Self.tohbahComboID   , /COMBOBOX_GETTEXT)
            s.science_component.observer   = obs
            s.science_component.planner    = cp
            s.science_component.tohbans[0] = tbn
            ;s.science_component.tohbans[1] = Self.tohban_2
            all_tlc_entries[i]->set , s
            ; If within CPT time range, then save to cpt_tlc
            cpt_tlc->add , all_tlc_entries[i]

            ;
            ; JAR 18-Jun-2010
            ; Save Planner party details to Timeline DB
            ; Open database
            status  = eis_open_db(/SCIENCE,/UPDATE)
            dbput, 'OBSERVER' , obs      , s.time_component.sequence_id
            dbput, 'PLANNER'  , cp       , s.time_component.sequence_id
            dbput, 'TOHBANS'  , [tbn,''] , s.time_component.sequence_id
            dbclose

        ENDIF

    ENDIF

ENDFOR

count = cpt_tlc->count()
IF (count LT 1) THEN BEGIN
    BEEP
    mText = 'There are NO entries in this time range. Aborting!'
    complain = DIALOG_MESSAGE( mText       ,                        $
                         DIALOG_PARENT = Self.tlbID,                $
                         /ERROR )
    RETURN
ENDIF

; OK, make sure we have read all of the science components
FOR i = 0 , count -1 DO BEGIN

    temp = cpt_tlc->get(POSITION = i)
    temp->getProperty , seq_id = seq_id
    print,'CPTing seq_id = ' + STRCOMPRESS(seq_id,/REMOVE_ALL)
    tl   = temp->get()
    tc   = tl.time_component
    IF (tc.read_all NE 1) THEN temp->get_all_info

ENDFOR

;
; JAR 18-Apr-2007
; Added a little test to check whether seq_ids are unique.
; There have been instances where entries have been duplicated
; in the ORL files. This will catch it - if it is a Planning
; Tools bug!
;
seq_id_list = cpt_tlc->get_seq_id_list()
unique      = seq_id_list[UNIQ(seq_id_list, SORT(seq_id_list))]
IF (N_ELEMENTS(unique) NE count) THEN BEGIN

    BEEP
    mText = ['There are duplicate seq_ids. This is bad!'  ,                 $
             ''                                           ,                 $
             'Please report this to John Rainnie'         ,                 $
             ''                                           ,                 $
             'Continuing anyway!'                                           $
            ]
    complain = DIALOG_MESSAGE( mText       ,                        $
                         DIALOG_PARENT = Self.tlbID,                $
                         /ERROR )

ENDIF






;______________________________________________________________________________
;
; Get an array of the entry details
;
;______________________________________________________________________________
;
; Create a list (array of structures) of each timeline entry
;
eis_study_detail  = eis_list_timeline_entries(cpt_tlc)

;______________________________________________________________________________
;
; Event Trigger Studies
;
;______________________________________________________________________________
; OK, are there any event triggers? If so, then check all event control
; tables are valid, and that there is only 1 unique table

; Get verify_fov, x0 and y0 values. These need to go into
; eis_eng_props.xrt_flare_parameters structure.
; Need to set default values whether XRT flare trigger used or not!
; If an xrtf trigger is used, these variables will be updated.
verify_fov = 1
x0y0       = eis_get_default_x0y0()
x0         = x0y0[0]
y0         = x0y0[1]

triggers = cpt_tlc->detect_trigger_studies(/QUIET)
; If so, check them
IF (N_TAGS(triggers[0]) NE 0) THEN BEGIN

   ; Instantiate eis_response_obj object and check event tables
   eis_response_obj = OBJ_NEW("eis_response_obj" , cpt_tlc , triggers)
   valid = eis_response_obj->check_is_valid()

   IF (valid EQ 1) THEN BEGIN
       print,''
       print,'Trigger/Response Events are Valid....continuing with CPT'
       print,'********************************************************'
   ENDIF ELSE BEGIN
       line_0 = ''
       line_1 = 'Trigger/Response Events are NOT Valid!'
       line_2 = 'CPT cannot be continued until the they are valid!'
       line_3 = 'Bye'

       ; JAR 08-Sep-2011
       ; IF invalid trigger tables, then issue warning + bail out
       ; 1. Need to invoke a dialog message saying that the event table
       ;    is invalid.
       BEEP
       mText = [line_0 , line_1 , line_2 , line_3]
       gurn = DIALOG_MESSAGE( mText       ,                        $
                         DIALOG_PARENT = Self.tlbID,                $
                         /ERROR )
      ; 2. Cleanup cpt_tlc
      cpt_tlc->REMOVE , /ALL
      OBJ_DESTROY , cpt_tlc
      ; 3. Cleanup eis_response_obj
      OBJ_DESTROY , eis_response_obj
      ; 4. Cleanup triggers - don't need cleanup
      ; 5. And finally.....bail out!!
      RETURN

   ENDELSE

   ; Call eis_response_obj method to create the eis_control structure
   eis_control = eis_response_obj->get_eis_control()

   ; Finally, destroy Object
   OBJ_DESTROY , eis_response_obj

   eise_all        = 0
   eisf_all        = 0
   xrtf_all        = 0
   xrtf_filler_all = 0

   ; Get study details for response and filler studies
   FOR i = 0 , N_ELEMENTS(triggers) - 1 DO BEGIN

       trigger = triggers[i]

       ; OK, what type of response study are we dealing with here?
       eebp_event = STRMATCH(trigger.type,'eebp',/FOLD_CASE)
       IF (eebp_event EQ 1) THEN BEGIN
           eise = eis_get_eis_event_study_details(trigger.st_id_response)
           CASE N_TAGS(eise_all[0]) OF
               0    : eise_all =  eise
               ELSE : eise_all = [eise_all , eise]
           ENDCASE
       ENDIF

       eisf_event = STRMATCH(trigger.type,'eisf',/FOLD_CASE)
       IF (eisf_event EQ 1) THEN BEGIN

           ; 01-Dec-2014 JAR
           ; Get response study ID from the response DB
           ;stop
           ;status         = eis_open_db(/RESPONSE)
           response_st_id = trigger.st_id_response
           ;print,response_st_id
           ;dbclose
           eisf = eis_get_eis_flare_study_details(response_st_id)
           CASE N_TAGS(eisf_all[0]) OF
               0    : eisf_all =  eisf
               ELSE : eisf_all = [eisf_all , eisf]
           ENDCASE
       ENDIF

       xrtf_event = STRMATCH(trigger.type,'xrtf',/FOLD_CASE)
       IF (xrtf_event EQ 1) THEN BEGIN
           ; 26-Jun-2013 JAR
           ; Get response and filler study IDs from the response DB
           status         = eis_open_db(/RESPONSE)
           response_st_id = dbval(trigger.resp_id, 'RESPONSE_ST_ID')
           filler_st_id   = dbval(trigger.resp_id, 'FILLER_ST_ID')
           x0             = dbval(trigger.resp_id, 'LOCATE_X')
           y0             = dbval(trigger.resp_id, 'LOCATE_Y')
           verify_fov     = dbval(trigger.resp_id, 'LINE_INDEX')
           dbclose
           ; Now get response study details and concatenate to list
           xrtf = eis_get_xrt_flare_study_details(response_st_id)
           CASE N_TAGS(xrtf_all[0]) OF
               0    : xrtf_all =  xrtf
               ELSE : xrtf_all = [xrtf_all , xrtf]
           ENDCASE

           ; If defined, then get Filler study details
           IF (filler_st_id GT 0) THEN BEGIN
               xrtf = eis_get_xrt_flare_study_details(filler_st_id,$
                                                        /FILLER_STUDY)
               CASE N_TAGS(xrtf_filler_all[0]) OF
                   0    : xrtf_filler_all =  xrtf
                   ELSE : xrtf_filler_all = [xrtf_filler_all , xrtf]
               ENDCASE

           ENDIF
       ENDIF

   ENDFOR

   ; 14-Jun-2010
   IF (N_TAGS(eise_all[0]) GT 0) THEN                                      $
       eis_study_detail = [eis_study_detail,eise_all[0]]
   IF (N_TAGS(eisf_all[0]) GT 0) THEN                                      $
       eis_study_detail = [eis_study_detail,eisf_all[0]]
   IF (N_TAGS(xrtf_all[0]) GT 0) THEN                                      $
       eis_study_detail = [eis_study_detail,xrtf_all[0]]
   IF (N_TAGS(xrtf_filler_all[0]) GT 0) THEN                               $
       eis_study_detail = [eis_study_detail,xrtf_filler_all[0]]

ENDIF





; Collect up all the rubbish here


; ; Get study_detail of EIS EVENT response study (if there is one) and append
; ; it to "eis_study_detail"
; ;st_id = eis_xrt_flare_control.filler_identifier
; IF (N_TAGS(tlc_eis_event[0]) GT 0) THEN BEGIN
;
;    st_id            = tlc_eis_event[0].response_study_id
;    eise             = eis_get_eis_event_study_details(st_id)
;    eis_study_detail = [eis_study_detail,eise]
;
; ENDIF
;
;
; ;
; ; EIS Event Properties
; ;
; Self.parentClass->getProperty , eis_xrt_flare_control = eis_xrt_flare_control
; ;-------------------------------------------------------------------
; ;
; ; EIS EVENT
; ;
; ;-------------------------------------------------------------------
; ; JAR 1-Apr-2008
; ; Added Eis Event functionality
; ; 1. Check if there are any tl entries flagged to respond to EIS Events
; ;    The result is an array of {eis_event_component} structures, one for
; ;    each studyRaster flagged with an EIS EVENT trigger. The result will
; ;    be zero if NO such entries are found (hence use N_TAGS on result to
; ;    decide).
; tlc_eis_event = cpt_tlc->eis_event_structure()
; ; 2. If there are such entries, then let's get to work
; IF (N_TAGS(tlc_eis_event[0]) GT 0) THEN BEGIN
;    ; 3. OK, how many we got? If > 1, then we need to ensure the props
;    ;    are the same for all. If so, just take the first one and
;    ;    carry on.
;    IF (N_ELEMENTS(tlc_eis_event) GT 1) THEN BEGIN
;
;        valid = eis_event_props_same(tlc_eis_event)
;        IF (valid.valid NE 1) THEN BEGIN
;            BEEP
;            complain = DIALOG_MESSAGE( valid.mText                ,         $
;                          DIALOG_PARENT = Self.tlbID          ,             $
;                          /ERROR )
;            RETURN
;
;        ENDIF
;    ENDIF
;    ; 4. OK, this is where we actually check the properties have been
;    ;    set.
;    valid           = eis_event_props_valid(tlc_eis_event[0])
;
;    ; 5. If there's a problem, report it here! Then bail out!
;    IF (valid.valid NE 1) THEN BEGIN
;        BEEP
;        complain = DIALOG_MESSAGE( valid.mText                ,             $
;                          DIALOG_PARENT = Self.tlbID          ,             $
;                          /ERROR )
;        RETURN
;
;    ENDIF
;
; ENDIF
; ;-------------------------------------------------------------------
; eis_control = eis_get_control( eis_xrt_flare_control      ,                $
;                                tlc_eis_event[0]                   )
;
;
;
; ;
; ; XRT Flare
; ;
; ; Get study_detail of XRT response study (if there is one) and append it
; ; to "eis_study_detail"
; st_id = eis_xrt_flare_control.response_identifier
; IF (st_id NE 0) THEN BEGIN
;
;     xrtf = eis_get_xrt_flare_study_details(st_id)
;     eis_study_detail = [eis_study_detail,xrtf]
;
; ENDIF
; ; Get study_detail of XRT filler study (if there is one) and append it
; ; to "eis_study_detail"
; st_id = eis_xrt_flare_control.filler_identifier
; IF (st_id NE 0) THEN BEGIN
;
;     xrtf = eis_get_xrt_flare_study_details(st_id , /filler_study)
;     eis_study_detail = [eis_study_detail,xrtf]
;
; ENDIF
;
; ; Get study_detail of EIS EVENT response study (if there is one) and append
; ; it to "eis_study_detail"
; ;st_id = eis_xrt_flare_control.filler_identifier
; IF (N_TAGS(tlc_eis_event[0]) GT 0) THEN BEGIN
;
;    st_id            = tlc_eis_event[0].response_study_id
;    eise             = eis_get_eis_event_study_details(st_id)
;    eis_study_detail = [eis_study_detail,eise]
;
; ENDIF
;
;
;
; Default Study
;




;
; Engineering Properties
;
eis_eng_props     = eis_get_engineering()
; JAR 9-Dec-2010. Changed EIS pixel size to 1 arcsecond
; Was 115. On advice from Martin and Khalid after testing
; EIS Flare trigger at MSSL on 8-Dec-2010
eis_eng_props.eis_flare_parameters.eis_p_size = 100



; JAR 30-Jul-2012
; If x0 or y0 are NOT zero, then subtract CMIR offset
; Commented out on 12-Dec-2012
;IF (x0 NE 0.) THEN x0 = x0 - 77
;IF (y0 NE 0.) THEN y0 = y0 - 16


;
; JAR 14-Dec-2011
; Hard wire the XRT Flare parameters
;
; These tags needs updating - they are editable by the planner!
eis_eng_props.xrt_flare_parameters.verify_fov     = verify_fov
eis_eng_props.xrt_flare_parameters.x0             = x0
eis_eng_props.xrt_flare_parameters.y0             = y0
;print,eis_eng_props.xrt_flare_parameters.verify_fov
;print,eis_eng_props.xrt_flare_parameters.x0
;print,eis_eng_props.xrt_flare_parameters.y0


; The following are hard-coded.
eis_eng_props.xrt_flare_parameters.x_conversion   = 1
eis_eng_props.xrt_flare_parameters.y_conversion   = 0
eis_eng_props.xrt_flare_parameters.angle          = 0
eis_eng_props.xrt_flare_parameters.ocb            = 8
eis_eng_props.xrt_flare_parameters.xrt_pixel_size = 100
; JAR 24-Jul-2012. Changed the following from 1 to 3
eis_eng_props.xrt_flare_parameters.eis_fov_flag   = 3
;
; End of XRT Flare parameters!


;
; BakeOut Properties
;
;eis_bakeout_props = eis_list_bakeout_periods(cpt_tlc)


eis_upload            = {EIS_upload}
eis_upload.time       = datetime_upload


upload_time = anytim2cal(anytim2utc(datetime_upload,/stime,/date),form=8,/date)

; upload_id   = STRJOIN([upload_time,opog_pass_id_string],/SINGLE)
; eis_upload.upload_id  = upload_id

eis_upload.obstbl_upload_id = STRJOIN([upload_time,obstbl_pass_id_string],/SINGLE)
eis_upload.orl_upload_id    = STRJOIN([upload_time,opog_pass_id_string],/SINGLE)
eis_upload.version          = ''
eis_upload.ram_sub_id       = ''

; Check properties
mssl  = WIDGET_INFO(Self.msslButtonID  , /BUTTON_SET)
intel = WIDGET_INFO(Self.intelButtonID , /BUTTON_SET)
quiet = WIDGET_INFO(Self.quietButtonID , /BUTTON_SET)

; Is reset button selected - ON
reset_on = WIDGET_INFO(Self.resetButtonID , /BUTTON_SET)
IF (reset_on EQ 1) THEN BEGIN

    CASE WIDGET_INFO(Self.softButtonID , /BUTTON_SET) OF
        0: reset = 2
        1: reset = 1
    ENDCASE

ENDIF

;
; Revised Plan 12-Apr-2011
;
; Get state of Revised Plan button
revised_plan = WIDGET_INFO(Self.revisedButtonID , /BUTTON_SET)

get_utc , utc
cpt_start_time = anytim2utc(utc,/STIME,/TRUNCATE)
mText = '+++++++++++++++++++++++++++++++++++++++++++++++++++++++'
WIDGET_CONTROL , Self.outputTextID , set_value = mText , /APPEND
mText = STRJOIN(['CPT started at          : ',cpt_start_time],/SINGLE)
WIDGET_CONTROL , Self.outputTextID , set_value = mText , /APPEND


cpt = eis_cpt( engineering           = eis_eng_props             ,          $
               revised_plan          = revised_plan              ,          $
               JSIDE                 = JSIDE                     ,          $
               UPLOAD                = eis_upload                ,          $
               MSSL                  = mssl                      ,          $
               INTEL                 = intel                     ,          $
               QUIET                 = quiet                     ,          $
               RESET                 = reset                     ,          $
               CONTROL               = eis_control               ,          $
               TIME_PERIOD           = [startTime,stopTime]      ,          $
               STUDIES               = eis_study_detail          ,          $
               widget                = Self.outputTextID                    $
;               contact_info          = eis_read_file_station_events(fileName)    $
            )

IF (cpt EQ 0) THEN BEGIN
    BEEP
    mText = 'CPT error. Aborting.'
    WIDGET_CONTROL , Self.outputTextID , set_value = mText , /APPEND
ENDIF ELSE BEGIN
    ;
    ; Write dR output file
    ;
    olines = cpt_tlc->create_dr_output(start_time = anytim2tai(startTime),     $
                                   stop_time  = anytim2tai(stopTime))
    PTR_FREE , Self.dr_output
    Self.dr_output = PTR_NEW(olines)
    ; And finally, write to the file
    Self->write_dr_output_file , opog_pass_id_string



    fileName = Self->get_dr_output_filename(opog_pass_id_string)
    BEEP
    mText = 'Data Rate output file   : ' + fileName
    WIDGET_CONTROL , Self.outputTextID , set_value = mText , /APPEND

    ;
    ; 3-Apr-2007
    ; JAR - adding plan_summary
    fileName = Self->get_plan_summary_filename()
    mText = 'Plan Summary file       : ' + fileName

    WIDGET_CONTROL , Self.outputTextID , set_value = mText , /APPEND
    eis_ps = OBJ_NEW('eis_plan_summary' , cpt_tlc , fileName ,       $
                                      widID = Self.outputTextID)
    OBJ_DESTROY , eis_ps

    ; JAR 25-Sep-2008
    ; Write CPT properties to a file "$HOME/eis_cpt_properties.txt"
    Self->write_cpt_props_file ,startTime , stopTime , tUpload[0] ,     $
                      opog_pass_id_string , obstbl_pass_id_string ,     $
                      obs , cp ,tbn

    baseName = "eis_cpt_properties.txt"
    fileName = CONCAT_DIR(GETENV("HOME") , baseName)
    mText = 'EIS_CPT Properties      : ' + fileName
    WIDGET_CONTROL , Self.outputTextID , set_value = mText , /APPEND

    mText = ['CPT ran successfully    : Time for coffee!'    ,            $
             '+++++++++++++++++++++++++++++++++++++++++++++++++++++++']
    WIDGET_CONTROL , Self.outputTextID , set_value = mText , /APPEND

    ;Self->cpt_pointings , cpt_tlc

ENDELSE

;
;
; OK , remove objects from the cpt_tlc container. They're still in use
; in the Self.tlc container. Then destroy the cpt_tlc container!!
; The Self.tlc object is destroyed during CPT cleanup!
;
cpt_tlc->REMOVE , /ALL
OBJ_DESTROY , cpt_tlc

END
;______________________________________________________________________________
; Create pointings image
;______________________________________________________________________________
PRO eis_cpt_gui::cpt_pointings , cpt_tlc

window,0,xs=500,ys=600
wset,0

; Get XRT image. If not found, then return is 0
start_time = Self->get_start_time()
xrt_image = eis_get_xrt_image(start_time)
IF (SIZE(xrt_image , /N_DIMENSIONS) EQ 0) THEN BEGIN
   sun_radius = 1000.
   win_radius = sun_radius/2.-1
   win_radius = 250.
   ratio      = sun_radius/win_radius
   tvcircle , win_radius , win_radius , win_radius , color = FSC_COLOR('yellow') , /FILL
ENDIF ELSE BEGIN
   stop
ENDELSE

FOR i = 0 , cpt_tlc->count() - 1 DO BEGIN
    temp  = cpt_tlc->get( position = i)
    tl    = temp->get()

    Self->oplot_pointing , i , tl
ENDFOR
stop


END
;______________________________________________________________________________
; Plot pointing for each timeline entry
;______________________________________________________________________________
PRO eis_cpt_gui::oplot_pointing , st_index , tl

; Image Label
start_time_string = ANYTIM2UTC(Self->get_start_time(),/STIME)
stop_time_string  = ANYTIM2UTC(Self->get_stop_time() ,/STIME)
line0 = STRJOIN(['CPT Start Time : ',start_time_string],/SINGLE)
line1 = STRJOIN(['CPT Stop  Time : ',stop_time_string],/SINGLE)
XYOUTS , 0.02 , 0.96 , /NORM , line0 , color = FSC_COLOR('white'),charsize=1.4
XYOUTS , 0.02 , 0.94 , /NORM , line1 , color = FSC_COLOR('white'),charsize=1.4

sun_radius = 1000.
win_radius = sun_radius/2.-1
win_radius = 250.
ratio      = sun_radius/win_radius

; Get EIS pointing offset
stop
offsets         = eis_pointing_offset()
fov_half_height = 1024./2.

sc         = tl.science_component
sra        = tl.science_component.studyRasters

FOR i = 0 , sc.nRasters - 1 DO BEGIN

   x       = sra[i].x_point
   y       = sra[i].y_point
   sc_x    = sra[i].sc_x - offsets.x_offset
   sc_y    = sra[i].sc_y - offsets.y_offset
   x_point = x/ratio
   y_point = y/ratio

   ;
   ; Draw FOV box
   ;
   CASE sra[i].slitIndex OF
       0    : fov_half_width  = 590/2.
       1    : fov_half_width  = 856/2.
       2    : fov_half_width  = 592/2.
       3    : fov_half_width  = 630/2.
       ELSE : fov_half_width  = 590/2.
   ENDCASE

   sc_x_box = [ (sc_x - fov_half_width )/ratio                       ,     $
                (sc_x - fov_half_width )/ratio                       ,     $
                (sc_x + fov_half_width )/ratio                       ,     $
                (sc_x + fov_half_width )/ratio                       ,     $
                (sc_x - fov_half_width )/ratio    ]
   sc_y_box = [ (sc_y - fov_half_height)/ratio                       ,     $
                (sc_y + fov_half_height)/ratio                       ,     $
                (sc_y + fov_half_height)/ratio                       ,     $
                (sc_y - fov_half_height)/ratio                       ,     $
                (sc_y - fov_half_height)/ratio    ]
   PLOTS  , sc_x_box + win_radius                                    ,     $
            sc_y_box + win_radius                                    ,     $
            color = FSC_COLOR('red'), /DEVICE , lines = 0 , thick = 2

   ra_half_width  = sra[i].ra_width/2.
   ra_half_height = sra[i].windHeight/2.
   ra_x_box = [ (x - ra_half_width )/ratio                           ,     $
                (x - ra_half_width )/ratio                           ,     $
                (x + ra_half_width )/ratio                           ,     $
                (x + ra_half_width )/ratio                           ,     $
                (x - ra_half_width )/ratio    ]
   ra_y_box = [ (y - ra_half_height)/ratio                           ,     $
                (y + ra_half_height)/ratio                           ,     $
                (y + ra_half_height)/ratio                           ,     $
                (y - ra_half_height)/ratio                           ,     $
                (y - ra_half_height)/ratio    ]
   PLOTS  , ra_x_box + win_radius                                    ,     $
            ra_y_box + win_radius                                    ,     $
            color = FSC_COLOR('red'), /DEVICE , lines = 0 , thick = 1

ENDFOR


END
;______________________________________________________________________________
; Write DR file
;______________________________________________________________________________
PRO eis_cpt_gui::write_cpt_props_file , start_time                   ,     $
                                        stop_time                    ,     $
                                        upload_time                  ,     $
                                        opog_pass_id_string          ,     $
                                        obstbl_pass_id_string        ,     $
                                        obs                          ,     $
                                        cp                           ,     $
                                        tbn

baseName = "eis_cpt_properties.txt"
fileName = CONCAT_DIR(GETENV("HOME") , baseName)

; Get state of Revised Plan button
revised_plan = WIDGET_INFO(Self.revisedButtonID , /BUTTON_SET)
revised_plan = STRCOMPRESS(revised_plan,/REMOVE_ALL)

OPENW    , lun , fileName , /GET_LUN
PRINTF   , lun , "EIS_CPT Properties [v1]"
PRINTF   , lun , STRING(format="(A-20,A-40)","start_time",start_time)
PRINTF   , lun , STRING(format="(A-20,A-40)","stop_time" ,stop_time)
PRINTF   , lun , STRING(format="(A-20,A-40)","upload_time" ,upload_time)
PRINTF   , lun , STRING(format="(A-20,A-40)","opog_pass_id" ,opog_pass_id_string)
PRINTF   , lun , STRING(format="(A-20,A-40)","obstbl_pass_id" ,obstbl_pass_id_string)
PRINTF   , lun , STRING(format="(A-20,A-40)","co" ,obs)
PRINTF   , lun , STRING(format="(A-20,A-40)","cp" ,cp)
PRINTF   , lun , STRING(format="(A-20,A-40)","tohban" ,tbn)
PRINTF   , lun , STRING(format="(A-20,A-40)","revised_plan" ,revised_plan)
FREE_LUN , lun


END
;______________________________________________________________________________
; Write DR file
;______________________________________________________________________________
PRO eis_cpt_gui::write_dr_output_file , opog_pass_id_string

fileName = Self->get_dr_output_filename(opog_pass_id_string)

OPENW  , lun , fileName , /GET_LUN
FOR i = 0, N_ELEMENTS(*Self.dr_output) - 1 DO BEGIN
   PRINTF , lun , (*Self.dr_output)[i]
ENDFOR
FREE_LUN , lun

; Copy this file to $HOME/cmdpln/latest directory
baseName = FILE_BASENAME(fileName)
pathName = STRJOIN([EXPAND_PATH(GETENV('CMDPLN_EISCO')),'latest']    ,     $
                                              PATH_SEP(),/SINGLE)
IF (FILE_TEST(pathName,/DIRECTORY) EQ 1) THEN BEGIN
   fileName_copy = CONCAT_DIR(pathName , baseName)
   FILE_COPY , fileName , fileName_copy , /OVERWRITE , /FORCE
   ;IF ~FILE_TEST(fileName_copy) THEN FILE_COPY , fileName , fileName_copy
   value = STRJOIN(['Data Rate output file   : ',fileName_copy],/SINGLE)
   WIDGET_CONTROL , Self.outputTextID , set_value = value , /APPEND
ENDIF

END
;______________________________________________________________________________
; Create DR output filename
;______________________________________________________________________________
FUNCTION eis_cpt_gui::get_dr_output_filename , opog_pass_id_string

; Get Upload Time
WIDGET_CONTROL , Self.tUploadID , get_value = datetime
; Create date string - 20070615
date_string = anytim2cal(datetime , form = 8 , /DATE)

; Create fileName
pathName = EXPAND_PATH(GETENV('cpt_output_dir'))
pathName = STRJOIN([pathName,'dr'],PATH_SEP(),/SINGLE)
baseName = STRJOIN(['dr_EIS_' , date_string ,opog_pass_id_string, '.txt'] , /SINGLE)

RETURN , CONCAT_DIR(pathName , baseName)

END
;______________________________________________________________________________
; Create eis_plan summary filename
;______________________________________________________________________________
FUNCTION eis_cpt_gui::get_plan_summary_filename

; Get Upload Time
WIDGET_CONTROL , Self.tUploadID , get_value = datetime
; Create date string - 20070615
date_string = anytim2cal(datetime , form = 8 , /DATE)

; Create fileName
pathName = EXPAND_PATH(GETENV('cpt_output_dir'))
pathName = STRJOIN([pathName,'eis_plan'],PATH_SEP(),/SINGLE)
baseName = STRJOIN(['eis_plan_' , date_string , '.txt'] , /SINGLE)

RETURN , CONCAT_DIR(pathName , baseName)

END
;______________________________________________________________________________
; Apply modification
;______________________________________________________________________________
PRO eis_cpt_gui::updateTime

Self.parentClass->initialize_plot

END
;______________________________________________________________________________
; Define Data members
;______________________________________________________________________________
PRO eis_cpt_gui__Define

struct = { eis_cpt_gui                                               ,     $
               tlbID               : 0L                              ,     $
               group_leader        : 0L                              ,     $
               parentClass         : OBJ_NEW()                       ,     $
               tlc                 : OBJ_NEW()                       ,     $
               tl_graphics         : {eis_timeline_graphics}         ,     $
               observerComboID     : 0L                              ,     $
               cpComboID           : 0L                              ,     $
               tohbahComboID       : 0L                              ,     $
               msslButtonID        : 0L                              ,     $
               revisedButtonID     : 0L                              ,     $
               emergencyButtonID   : 0L                              ,     $
               intelButtonID       : 0L                              ,     $
               quietButtonID       : 0L                              ,     $
               softButtonID        : 0L                              ,     $
               resetButtonID       : 0L                              ,     $
               resetBaseID         : 0L                              ,     $
               outputTextID        : 0L                              ,     $
               dr_output           : PTR_NEW()                       ,     $
               tStartID            : 0L                              ,     $
               tStopID             : 0L                              ,     $
               tUploadID           : 0L                              ,     $
               opogPassNumID       : 0L                              ,     $
               obstblPassNumID     : 0L                              ,     $
               outputDirID         : 0L                                    $
         }

END
