//---------------------------------------------------------------------------

#ifndef VMSM430MFH
#define VMSM430MFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBClient.hpp>
#include <FMTBcd.hpp>
#include <Provider.hpp>
#include <SqlExpr.hpp>
#include <Menus.hpp>
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <ComCtrls.hpp>
#include <ADODB.hpp>
#include <Dialogs.hpp>
#include <ExtDlgs.hpp>
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "WindowMsgF.h"
#include "cxButtons.hpp"
#include "cxCalendar.hpp"
#include "cxContainer.hpp"
#include "cxControls.hpp"
#include "cxDropDownEdit.hpp"
#include "cxEdit.hpp"
#include "cxGraphics.hpp"
#include "cxGroupBox.hpp"
#include "cxLabel.hpp"
#include "cxLookAndFeelPainters.hpp"
#include "cxLookAndFeels.hpp"
#include "cxMaskEdit.hpp"
#include "cxPC.hpp"
#include "cxPCdxBarPopupMenu.hpp"
#include "cxSpinEdit.hpp"
#include "cxSplitter.hpp"
#include "cxTextEdit.hpp"
#include "cxTimeEdit.hpp"
#include "dxSkinBlack.hpp"
#include "dxSkinBlue.hpp"
#include "dxSkinCaramel.hpp"
#include "dxSkinCoffee.hpp"
#include "dxSkinDarkRoom.hpp"
#include "dxSkinDarkSide.hpp"
#include "dxSkinFoggy.hpp"
#include "dxSkinGlassOceans.hpp"
#include "dxSkiniMaginary.hpp"
#include "dxSkinLilian.hpp"
#include "dxSkinLiquidSky.hpp"
#include "dxSkinLondonLiquidSky.hpp"
#include "dxSkinMcSkin.hpp"
#include "dxSkinMoneyTwins.hpp"
#include "dxSkinOffice2007Black.hpp"
#include "dxSkinOffice2007Blue.hpp"
#include "dxSkinOffice2007Green.hpp"
#include "dxSkinOffice2007Pink.hpp"
#include "dxSkinOffice2007Silver.hpp"
#include "dxSkinOffice2010Black.hpp"
#include "dxSkinOffice2010Blue.hpp"
#include "dxSkinOffice2010Silver.hpp"
#include "dxSkinsCore.hpp"
#include "dxSkinscxPCPainter.hpp"
#include "dxSkinSeven.hpp"
#include "dxSkinSharp.hpp"
#include "dxSkinSilver.hpp"
#include "dxSkinStardust.hpp"
#include "cxRadioGroup.hpp"
#include "cxClasses.hpp"
#include "cxCustomData.hpp"
#include "cxData.hpp"
#include "cxDataStorage.hpp"
#include "cxDBData.hpp"
#include "cxFilter.hpp"
#include "cxGrid.hpp"
#include "cxGridCustomTableView.hpp"
#include "cxGridCustomView.hpp"
#include "cxGridDBTableView.hpp"
#include "cxGridLevel.hpp"
#include "cxGridTableView.hpp"
#include "cxStyles.hpp"
#include "cxCheckBox.hpp"
#include "FRAME_VmsListF.h"
#include "cxImage.hpp"
#include "cxButtonEdit.hpp"
#include "cxBlobEdit.hpp"
#include "dxGDIPlusClasses.hpp"
#include "FFBaseComponent.hpp"
#include "FFBasePlay.hpp"
#include "FFPlay.hpp"
#include "FFDecode.hpp"
#include "IdAntiFreeze.hpp"
#include "IdAntiFreezeBase.hpp"
#include "IdBaseComponent.hpp"
#include "IdComponent.hpp"
#include "IdExplicitTLSClientServerBase.hpp"
#include "IdFTP.hpp"
#include "IdTCPClient.hpp"
#include "IdTCPConnection.hpp"
#include "cxCalc.hpp"

#define MAX_PLAYER  1

class TSymbFmt {
public:
    TSymbFmt(String AFmt, String AFmtType)  {
        fmt = AFmt;
        fmtType = AFmtType;
    };
    ~TSymbFmt() {};

public:
    String fmt;
    String fmtType;
};


class TVMSM430M : public TForm
{
__published:	// IDE-managed Components
    TTimer *TmrShow;
    TShape *ShpTitle;
    TcxButton *BtnClose;
    TLabel *LblCaption;
    TShape *ShpList;
    TEdit *EdFocus;
    TPanel *PnlBack;
    TPanel *PnlLeft;
    TcxSplitter *cxSplitter1;
    TcxGroupBox *GrpList;
    TPanel *Panel1;
    TPanel *PnlVmsList;
    TPanel *PnlSymbol;
    TcxSplitter *cxSplitter2;
    TcxGroupBox *cxGroupBox1;
    TcxGroupBox *cxGroupBox2;
    TFRAMEVmsList *FRAMEVmsList1;
    TcxGrid *CxList;
    TcxGridTableView *TvList;
    TcxGridColumn *ColLink1;
    TcxGridColumn *ColLink2;
    TcxGridColumn *ColLink3;
    TcxGridColumn *ColLink4;
    TcxGridColumn *ColLink5;
    TcxGridColumn *ColLink6;
    TcxGridLevel *GlList;
    TPanel *PnlMenu;
    TcxButton *BtnEdit;
    TcxButton *BtnInsert;
    TcxButton *BtnDelete;
    TcxButton *BtnSave;
    TPanel *Panel4;
    TcxButton *BtnDownload;
    TPanel *PnlCmd;
    TPanel *PnlPlayer;
    TImage *ImgPreView;
    TcxLabel *cxLabel18;
    TImage *ImgDesc01;
    TcxLabel *cxLabel1;
    TImage *ImgDesc02;
    TcxTextEdit *EdNmbr;
    TcxLabel *cxLabel2;
    TImage *ImgDesc03;
    TcxTextEdit *EdExpl;
    TcxButtonEdit *EdImageFileName;
    TcxLabel *cxLabel3;
    TImage *ImgDesc04;
    TcxButton *BtnSaveImgFile;
    TSaveDialog *SaveDialog;
    TOpenPictureDialog *OpenBmp;
    TcxTextEdit *EdVmsCd;
    TcxLabel *lblText1;
    TcxLabel *lblText2;
    TcxLabel *lblText3;
    TcxLabel *lblText4;
    TcxLabel *lblText5;
    TFFPlayer *FFPlayer1;
    TTrackBar *TrackBar1;
    TLabel *lblDuration1;
    TLabel *lblCurrentPTS1;
    TcxCheckBox *ChkFullScreen;
    TcxLabel *lblImage1;
    TcxLabel *lblImage2;
    TcxLabel *lblImage3;
    TcxLabel *lblImage4;
    TcxLabel *lblImage5;
    TcxLabel *lblImage9;
    TcxLabel *lblImage8;
    TcxLabel *lblImage7;
    TcxLabel *lblImage6;
    TcxLabel *lblImage12;
    TImage *ImgTemp;
    TFFDecoder *FFDecoder1;
    TcxButton *BtnPlay;
    TcxButton *BtnStop;
    TcxButton *BtnPause;
    TImage *ImgDesc07;
    TcxLabel *cxLabel4;
    TcxTextEdit *EdFileName;
    TcxLabel *lblImage21;
    TcxLabel *lblImage22;
    TIdFTP *IdFtp;
    TcxLabel *lblSameFile;
    TcxLabel *lblFtpServer;
    TImage *Image1;
    TcxSpinEdit *SeHeight;
    TcxSpinEdit *SeWidth;
    TcxLabel *cxLabel5;
    TcxSpinEdit *SeSize;
    TcxGridColumn *ColSize;
    void __fastcall FormShow(TObject *Sender);
    void __fastcall TmrShowTimer(TObject *Sender);
    void __fastcall BtnCloseClick(TObject *Sender);
    void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
    void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
    void __fastcall BtnEditClick(TObject *Sender);
    void __fastcall BtnSaveClick(TObject *Sender);
    void __fastcall BtnInsertClick(TObject *Sender);
    void __fastcall BtnDeleteClick(TObject *Sender);
    void __fastcall BtnSaveImgFileClick(TObject *Sender);
    void __fastcall EdImageFileNameClick(TObject *Sender);
    void __fastcall OpenBmpCanClose(TObject *Sender, bool &CanClose);
    void __fastcall TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift,
          bool &AHandled);
    void __fastcall BtnDownloadClick(TObject *Sender);
    void __fastcall TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
          TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged);
    void __fastcall BtnPlayClick(TObject *Sender);
    void __fastcall FFPlayer1FileOpen(TObject *Sender, const __int64 ADuration, int AFrameWidth, int AFrameHeight, int &AScreenWidth,
          int &AScreenHeight);
    void __fastcall BtnStopClick(TObject *Sender);
    void __fastcall BtnPauseClick(TObject *Sender);
    void __fastcall ChkFullScreenClick(TObject *Sender);
    void __fastcall TrackBar1Change(TObject *Sender);
    void __fastcall FFPlayer1OpenFailed(TObject *Sender);
    void __fastcall FFPlayer1Position(TObject *Sender, const __int64 APTS);
    void __fastcall FFPlayer1State(TObject *Sender, TPlayState APlayState);



private:	// User declarations
    void __fastcall CommClose();
    TcxDataController *m_pGDC;
    String          FTitle;
    bool            FUpdate;
    bool            FNewDb;
    bool            EditMode;
	TList          *FListSymb;

    bool            FPlayStream;
    int             FThumbNail;
    bool            FMakeThumbNail;
    DWORD           FPlayTime;
    DWORD           FFileSize;
    String          FFileName;
    String          FFileExt;

    __int64     FDuration[MAX_PLAYER];
    bool        FTrackChanging[MAX_PLAYER];
    TTrackBar  *FTrackBar[MAX_PLAYER];
    TLabel     *FLblDuration[MAX_PLAYER];
    TLabel     *FLblCurrPTS[MAX_PLAYER];

    TFFPlayer  *FFPlayer[MAX_PLAYER];
    TPanel     *FDispArea[MAX_PLAYER];
    String      PlayerFile[MAX_PLAYER];
public:
    TItsMap<String, TSymbFmt*> FSymbFmtLists;

public:		// User declarations
    __fastcall TVMSM430M(TComponent* Owner);

    void __fastcall FormInit();

    void __fastcall ClearSymbloList();

    void __fastcall LoadImageSymbol();

    void __fastcall DisplayInfo();

    bool __fastcall UpdateVmsImage(String ANmbr, String AExpl);
    bool __fastcall InsertVmsImage(String ANmbr, String AExpl, String AFileName, String ATypeCd);

    bool __fastcall IsUsedVideoFileName(String AFileName);
    bool __fastcall UploadFtpServer();
    void __fastcall DeleteFtpFile(AnsiString AFileName);

    void __fastcall ChangeEditMode(int AEdit);
};
//---------------------------------------------------------------------------
extern PACKAGE TVMSM430M *VMSM430M;
//---------------------------------------------------------------------------

#endif

