//AB/ Project CrossMerge Sentinel
//AB/ Object prj is a Application_Project
  //AB/ Set Size to 111 226
  //AB/ Set ProjectName to "CrossMerge Sentinel"
  //AB/ Set ProjectFileName to "CmSentinel.src"
  //AB/ Set pbGenerateHeader to FALSE


//AB-StoreStart
//************************************************************************
// Confidential Trade Secret.
// Copyright (c) 1997 Data Access Corporation, Miami Florida
// as an unpublished work.  All rights reserved.
// DataFlex is a registered trademark of Data Access Corporation.
//
//************************************************************************
//
// $File name  : Sentinel.src
// $File title : Sentinel status Panel Support for VDF
// Notice      :
// $Author(s)  : John Tuohy
//
// $Rev History
// BW  11/13/98  Changed to Prgssent.src. Add a progress bar to the sentinel
//               program. Intended to be used with the Data Defintion white
//               paper sample application.
//
// JT  9/22/97   Added status_params, status_default_params and changed
//               interface for no-cancel, and created interface for additional
//               parameter passing
// JT 06/27/97   Added no-cancel support w/ Allow_cancel_state
// JT ??/??/96   File created for VDF 4.0
//************************************************************************

// 2002-10-14 ------------------------------------ Start Nils G. Svedmyr
Use RDCSent.pkg
// 2002-10-14 ------------------------------------ Stop Nils G. Svedmyr

// 2001-10-16 ------------------------------------ Start Nils G. Svedmyr
Use cAnimation.pkg
// 2001-10-16 ------------------------------------ Stop Nils G. Svedmyr

//*** BW, Use the progress class
Use cProgressBar.pkg //DFprgres

// No cancel button support. If the command line is passed the string -c0
// then this program will not create or accept a cancel button. This is used
// by programs that need to use the sentinel but do not support canceling. One
// would still use the sentinel because, once the overhead of loading it is over,
// the screen updating will be much faster.
//
Global_Variable Integer giNoCancel

// Currently this only checks for one param: -c
// This can altered to handle other parameters
Procedure ParseParam Global String sParam
  String sLParam sRParam
  Move (Trim(sParam)) To sParam
  Move (Lowercase(Left(sParam,2))) To sLParam
  Move (Mid(sParam,255,3)) To sRParam
  If (sLParam = "-c") Begin
    Move (sRParam="0") To giNoCancel
  End
End_Procedure

// We support the passing of command line parameters. Each
// param is called with ParseParam
Procedure ParseParams Global
  String CmdString
  Cmdline CmdString
  While CmdString Ne ''
    Send ParseParam CmdString
    Cmdline CmdString
  End
End_Procedure

Send ParseParams // Check for any command line params

Object oSentinel Is A RDCSentinelPanel
    Set Location to -1 0

    Set Locate_Mode   To Center_On_Screen
    Set Size to 152 260

    // 2002-10-14 ------------------------------------ Start Nils G. Svedmyr
    Object License_txt Is A TextBox
      Set Location            To 2 10
      Set Auto_Size_State     To False
      Set Oem_Translate_State To False
      Set Size                To 15 250
      Set Justification_Mode  To jMode_Center
    End_Object
    // 2002-10-14 ------------------------------------ Stop Nils G. Svedmyr

    // 2001-09-18 ------------------------------------ Start Nils G. Svedmyr
    Object oAnimation Is A cAnimation
      Set Location            To 14 40
      Set pbTransparent       To True
      Set pbAutoSize          To True
      Set pbActive            To False
      Set peAnimation         To AviFileCopy
    End_Object // oAnimation
    // 2001-09-18 ------------------------------------ End Nils G. Svedmyr

    Object Title_Txt Is A TextBox
      Set Location To 40 10
    End_Object

    Object Message_Txt Is A TextBox
      Set Location To 48 10
      Set Auto_Size_State To False
      Set size To 20 230 //150
    End_Object

    Object Action_Txt Is A TextBox
      Set Location To 67 10
    End_Object

    //*** BW, Add the progress bar object
    Object Progress Is A cProgressBar // ProgressBar
      Set Location to 80 42
      Set Size to 14 173
      Set piMinimum        To 0
      Set piMaximum        To 100
      //Set Step_Value       To 1
      Set pbSmooth         To True
    End_Object // Progress

    Object oPercentage_tb Is A TextBox
      Set Location to 82 224
      Set Size     To 14 10
      Set Label    To "% done"
    End_Object

    If Not giNoCancel Begin
     Object Stop_Button Is A SentinelButton
      Set Location to 100 100
      Set Label    To "Cancel"
     End_Object
    End

    // 2002-10-14 ------------------------------------ Start Nils G. Svedmyr
    Object oCopyRight Is A TextBox
//      Set Oem_Translate_State To False
      Set Auto_Size_State To False
      Set Location to 117 46
      Set Size to 15 230
      Set TypeFace To "Arial"
      Set Fontsize To 12 0
      Set Label to ("Copyright 2001-2007 RDC Tools International")
    End_Object
    // 2002-10-14 ------------------------------------ Stop Nils G. Svedmyr

    Procedure Activate
      Set pbActive Of oAnimation To True
      Forward Send Activate
    End_Procedure

    Procedure Close_Panel
      Handle ho
      Move (oAnimation(Self)) To ho
      If Not giNoCancel Begin
        Set peAnimation Of ho To AviNone
        Set pbActive    Of ho To False // open and start playing
        Forward Send Close_Panel
      End
    End_Procedure

    Procedure Data_Change Integer Mode
      // 2002-10-14 ------------------------------------ Start Nils G. Svedmyr
      If (Mode=HOST_DATA_ALL Or Mode=HOST_DATA_LICENSE) ;
        Set Label Of (License_Txt(Current_Object)) To (License_Text(Current_Object))
      // 2002-10-14 ------------------------------------ Stop Nils G. Svedmyr
      //*** BW, changed to call InterpretActionText rather than displaying it right away
      If (Mode=HOST_DATA_ALL Or Mode=HOST_DATA_ACTION) ;
        Send InterpretActionText
      If (Mode=HOST_DATA_ALL Or Mode=HOST_DATA_MESSAGE) ;
        Set Label Of (Message_Txt(Current_Object)) To (Message_Text(Current_Object))
      If (Mode=HOST_DATA_ALL Or Mode=HOST_DATA_CAPTION) ;
        Set Label To (Caption_Text(Current_Object))
      If (Mode=HOST_DATA_ALL Or Mode=HOST_DATA_TITLE) ;
        Set Label Of (Title_Txt(Current_Object)) To (Title_Text(Current_Object))
//      If (giNoCancel=0 And  ;
//        (Mode=HOST_DATA_ALL Or Mode=HOST_DATA_BUTTON)) ;
//        Set Label Of (Stop_Button(Current_Object)) To (Button_Text(Current_Object))
    End_Procedure

    //*** BW, Added the procedure to interpret action text.
    //***
    //*** Procedure: InterpretActiontext
    //*** Purpose  : If the action text starts with the text __PROGRESS__ it
    //***            indicates a percentage for the progress bar
    //***
    Procedure InterpretActionText
      String ActionTxt
      Get Action_Text To Actiontxt
      If (Left(ActionTxt, Length("__PROGRESS__")) = "__PROGRESS__") ;
        Set piPosition   Of (Progress(Self)) To (Right(ActionTxt, Length(ActionTxt) - Length("__PROGRESS__")))
//        Send DoAdvanceBy Of (Progress(Self)) (Right(ActionTxt, Length(ActionTxt) - Length("__PROGRESS__")))
//        Set Current_Position Of (Progress(Self)) To (Right(ActionTxt, Length(ActionTxt) - Length("__PROGRESS__")))
      Else ;
        Set Label Of (Action_Txt(Self)) To ActionTxt
    End_Procedure

End_Object

Send Popup_Modal To (oSentinel(Self))
//AB-StoreEnd

//AB/ End_Object    // prj
