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

#ifndef VMSM500MFH
#define VMSM500MFH
//---------------------------------------------------------------------------
#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 "VMSM500MSRCF.h"
#include "VmsDesignerF.h"
#include "cxColorComboBox.hpp"
#include "CDSVmsObjTypeF.h"
#include "cxCalc.hpp"
//---------------------------------------------------------------------------

typedef enum _e_selobj_type
{
    eSelObjNone,
    eSelObjIfsc,
    eSelObjAtmp,
    eSelObjPark,
} e_selobj_type;

class TVMSM500M : public TForm
{
__published:	// IDE-managed Components
    TTimer *TmrShow;
    TShape *ShpTitle;
    TcxButton *BtnClose;
    TLabel *LblCaption;
    TShape *ShpList;
    TEdit *EdFocus;
    TPanel *PanelBack;
    TPanel *PnlLeft;
    TcxSplitter *cxSplitter1;
    TcxGroupBox *GrpList;
    TPanel *Panel1;
    TPanel *Panel3;
    TcxGroupBox *cxGroupBox1;
    TcxGrid *CxList;
    TcxGridTableView *TvList;
    TcxGridColumn *Col01;
    TcxGridColumn *Col02;
    TcxGridColumn *Col03;
    TcxGridColumn *Col04;
    TcxGridColumn *Col05;
    TcxGridColumn *Col06;
    TcxGridLevel *GlList;
    TPanel *PnlMenu;
    TcxButton *BtnEdit;
    TcxButton *BtnInsert;
    TcxButton *BtnDelete;
    TcxButton *BtnSave;
    TPanel *Panel4;
    TImage *ImgDesc01;
    TcxLabel *cxLabel18;
    TcxComboBox *CbSizeType;
    TcxButton *BtnSearch;
    TOpenPictureDialog *OpenBmp;
    TSaveDialog *SaveDialog;
    VmsDesigner *VmsDesigner1;
    TcxGridColumn *Col07;
    TcxGridColumn *Col08;
    TcxGridColumn *Col09;
    TcxGridColumn *Col10;
    TcxGridColumn *Col12;
    TcxGridColumn *Col13;
    TImage *ImgDir;
    TImage *ImgNull;
    TcxButton *BtnCopyAdd;
    TcxLabel *lblText1;
    TcxLabel *lblText2;
    TcxLabel *lblText3;
    TcxLabel *lblText4;
    TcxLabel *lblText5;
    TcxLabel *lblText6;
    TcxLabel *lblText7;
    TcxLabel *lblText8;
    TcxLabel *lblText9;
    TcxLabel *lblText10;
    TcxLabel *lblText11;
    TcxLabel *lblText12;
    TcxLabel *lblText13;
    TcxLabel *lblFontName;
    TcxLabel *lblImage1;
    TcxLabel *lblFile1;
    TcxLabel *lblText14;
    TcxLabel *lblText15;
    TcxLabel *lblText16;
    TPanel *Panel6;
    TImage *ImgVideo;
    TImage *ImgStream;
    TcxPageControl *PgFormTab;
    TcxTabSheet *TsForm;
    TPanel *PnlCmd1;
    TImage *ImgTemp;
    TImage *ImgDesc02;
    TLabel *Label1;
    TLabel *Label3;
    TImage *ImgDesc03;
    TImage *ImgDesc06;
    TLabel *Label35;
    TImage *ImgDesc04;
    TLabel *Label2;
    TImage *ImgDesc07;
    TLabel *Label5;
    TLabel *Label7;
    TImage *ImgDesc08;
    TImage *ImgDesc09;
    TLabel *Label8;
    TImage *ImgDesc10;
    TLabel *Label9;
    TPanel *PnlBack;
    TPanel *PnlForm;
    TImage *ImgForm;
    TcxTextEdit *EdFormId;
    TcxTextEdit *EdFormName1;
    TcxTextEdit *EdFormDesc1;
    TcxTextEdit *EdSizeType;
    TcxComboBox *CbFormKind;
    TcxComboBox *CbFormDispMode;
    TcxComboBox *CbFormDispDir;
    TColorBox *CbFormColor1;
    TcxTabSheet *TsFormObject;
    TcxButton *BtnSaveImgFile;
    TPanel *PnlCmd2;
    TcxPageControl *PgObject;
    TcxTabSheet *TsObject;
    TPanel *PnlTopLeftBottom;
    TImage *ImgDesc16;
    TLabel *Label12;
    TcxComboBox *CbVmsObjType;
    TcxButton *BtnAddText;
    TcxGrid *CxObjList;
    TcxGridTableView *TvObjList;
    TcxGridColumn *ColSeq;
    TcxGridColumn *ColId;
    TcxGridColumn *ColKind;
    TcxGridColumn *ColType;
    TcxGridColumn *ColData;
    TcxGridColumn *ColX;
    TcxGridColumn *ColY;
    TcxGridColumn *ColIfscId;
    TcxGridColumn *TvObjListColumn9;
    TcxGridColumn *TvObjListColumn10;
    TcxGridColumn *TvObjListColumn11;
    TcxGridColumn *ColMem;
    TcxGridLevel *GlObjList;
    TPanel *Panel5;
    TcxButton *BtnUp;
    TcxButton *BtnDown;
    TcxButton *BtnObjDelete;
    TcxPageControl *PgEdit;
    TcxTabSheet *TsEdit;
    TPanel *PnlDesigner;
    TPanel *PnlMove;
    TcxButton *BtnMoveLeft;
    TcxButton *BtnMoveRight;
    TcxButton *BtnMoveUp;
    TcxButton *BtnMoveDown;
    TcxButton *BtnAlignLeft;
    TcxButton *BtnAlignRight;
    TcxButton *BtnAlignTop;
    TcxButton *BtnAlignBottom;
    TcxButton *BtnCenterWidth;
    TcxButton *BtnCenterHieght;
    TcxLabel *cxLabel1;
    TPanel *PnlPreview;
    TImage *ImgEdtTemp;
    TPanel *PnlEdtBack;
    TPanel *PnlEditForm;
    TPanel *PnlEdit;
    TLabel *Label22;
    TPanel *PnlObjTop;
    TImage *ImgDesc23;
    TLabel *Label4;
    TImage *ImgDesc22;
    TLabel *Label6;
    TImage *ImgDesc12;
    TLabel *Label11;
    TLabel *Lbl99;
    TImage *ImgDesc99;
    TcxComboBox *CbObjType;
    TcxCheckBox *ChkBlinking;
    TcxSpinEdit *SeLeft;
    TcxSpinEdit *SeTop;
    TColorBox *CbBkColor;
    TcxComboBox *Cb99;
    TEdit *EdObjSeq;
    TPanel *PnlObjText;
    TImage *ImgDesc05;
    TLabel *Label15;
    TImage *ImgDesc18;
    TLabel *Label16;
    TcxTextEdit *EdTextData;
    TcxSpinEdit *SeFontSize;
    TcxCheckBox *ChkFontBold;
    TcxComboBox *CbFontName;
    TcxComboBox *CbTextAlign;
    TColorBox *CbFontColor;
    TcxMaskEdit *EdObjId;
    TPanel *PnlIfsc;
    TImage *ImgDesc25;
    TLabel *LblTag;
    TcxButtonEdit *EdIfscId;
    TButton *BtnIfscErase;
    TcxTabSheet *TsDirect;
    TPanel *Panel7;
    TPanel *PnlReForm;
    TRichEdit *ReForm;
    TRichEdit *ReFormTemp;
    TPanel *Panel8;
    TcxButton *BtnLeftRe;
    TcxButton *BtnRightRe;
    TcxButton *BtnCenterRe;
    TcxButton *BtnBoldRe;
    TcxSpinEdit *SeFontSizeRe;
    TcxComboBox *CbFontNameRe;
    TColorBox *CbFontColorRe;
    TPanel *PnlReFormView;
    TPanel *PnlRePreview;
    TImage *ImgEdtPreview;
    TPanel *Panel9;
    TcxButton *BtnPreview;
    TcxCheckBox *ChkAutoPreview;
    TcxButton *BtnReApply;
    TPanel *Panel2;
    TLabel *Label10;
    TImage *ImgDesc20;
    TcxTextEdit *EdFormName;
    TLabel *Label13;
    TImage *ImgDesc21;
    TcxTextEdit *EdFormDesc;
    TLabel *Label14;
    TImage *ImgDesc24;
    TColorBox *CbFormColor;
    TLabel *Label17;
    TcxTextEdit *cxTextEdit2;
    TLabel *Label18;
    TPanel *PnlImage;
    TImage *ImgDesc90;
    TLabel *Label19;
    TcxSpinEdit *SeImgW;
    TcxSpinEdit *SeImgH;
    TcxButton *BtnCopyAdd212;
    TcxButton *BtrnReFormClear;
    TcxCheckBox *ChkDrawModule;
    TcxButton *BtnLime;
    TcxButton *BtnYellow;
    TcxButton *BtnRed;
    TcxButton *BtnObjLime;
    TcxButton *BtnObjYellow;
    TcxButton *BtnObjRed;
    TLabel *lblTxtTemp;
    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 BtnInsertClick(TObject *Sender);
    void __fastcall BtnDeleteClick(TObject *Sender);
    void __fastcall BtnSaveImgFileClick(TObject *Sender);
    void __fastcall OpenBmpCanClose(TObject *Sender, bool &CanClose);
    void __fastcall TvListCellDblClick(TcxCustomGridTableView *Sender, TcxGridTableDataCellViewInfo *ACellViewInfo,
          TMouseButton AButton, TShiftState AShift,
          bool &AHandled);
    void __fastcall TvListFocusedRecordChanged(TcxCustomGridTableView *Sender, TcxCustomGridRecord *APrevFocusedRecord,
          TcxCustomGridRecord *AFocusedRecord, bool ANewItemRecordFocusingChanged);
    void __fastcall CbSizeTypePropertiesChange(TObject *Sender);
    void __fastcall BtnSearchClick(TObject *Sender);
    void __fastcall BtnSortReClick(TObject *Sender);
    void __fastcall BtnBoldReClick(TObject *Sender);
    void __fastcall SeFontSizeRePropertiesChange(TObject *Sender);
    void __fastcall CbFontColorReClick(TObject *Sender);
    void __fastcall ReFormChange(TObject *Sender);
    void __fastcall ChkAutoPreviewClick(TObject *Sender);
    void __fastcall BtnPreviewClick(TObject *Sender);
    void __fastcall BtnReApplyClick(TObject *Sender);
    void __fastcall FormCreate(TObject *Sender);
    void __fastcall CbFormKindPropertiesChange(TObject *Sender);
    void __fastcall CbFormColorClick(TObject *Sender);
    void __fastcall BtnMoveClick(TObject *Sender);
    void __fastcall BtnAlignClick(TObject *Sender);
    void __fastcall BtnCenterClick(TObject *Sender);
    void __fastcall SePosPropertiesChange(TObject *Sender);
    void __fastcall CbBkColorClick(TObject *Sender);
    void __fastcall ChkBlinkingClick(TObject *Sender);
    void __fastcall EdTextDataKeyPress(TObject *Sender, wchar_t &Key);
    void __fastcall EdTextDataPropertiesChange(TObject *Sender);
    void __fastcall SeFontSizePropertiesChange(TObject *Sender);
    void __fastcall CbFontNamePropertiesChange(TObject *Sender);
    void __fastcall CbFontColorClick(TObject *Sender);
    void __fastcall CbTextAlignPropertiesChange(TObject *Sender);
    void __fastcall EdObjIdPropertiesChange(TObject *Sender);
    void __fastcall CbFontNameReClick(TObject *Sender);
    void __fastcall ChkFontBoldClick(TObject *Sender);
    void __fastcall TvObjListFocusedRecordChanged(TcxCustomGridTableView *Sender,
          TcxCustomGridRecord *APrevFocusedRecord, TcxCustomGridRecord *AFocusedRecord,
          bool ANewItemRecordFocusingChanged);
    void __fastcall BtnAddTextClick(TObject *Sender);
    void __fastcall BtnObjDeleteClick(TObject *Sender);
    void __fastcall ColXGetDataText(TcxCustomGridTableItem *Sender, int ARecordIndex,
          UnicodeString &AText);
    void __fastcall ColYGetDataText(TcxCustomGridTableItem *Sender, int ARecordIndex,
          UnicodeString &AText);
    void __fastcall CbVmsObjTypeClick(TObject *Sender);
    void __fastcall EdIfscIdClick(TObject *Sender);
    void __fastcall BtnIfscEraseClick(TObject *Sender);
    void __fastcall BtnCopyAddClick(TObject *Sender);
    void __fastcall BtnUpClick(TObject *Sender);
    void __fastcall BtnDownClick(TObject *Sender);
    void __fastcall BtnSaveClick(TObject *Sender);
    void __fastcall Cb99PropertiesChange(TObject *Sender);
    void __fastcall SeImgWHPropertiesChange(TObject *Sender);
    void __fastcall BtnCopyAdd212Click(TObject *Sender);
    void __fastcall PgEditClick(TObject *Sender);
    void __fastcall BtrnReFormClearClick(TObject *Sender);
    void __fastcall BtnRedClick(TObject *Sender);
    void __fastcall BtnObjLimeClick(TObject *Sender);



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

    int             FSelIdx;
    String          FVmsTypeCd;
    int             FVmsWidth;
    int             FVmsHeight;
    int             FVmsCols;
    int             FVmsRows;

    e_selobj_type   FSelObjType;

    TVmsObjTypeManager *MyVmsObjTypeManager;

public:
    TVmsFormDesigner   *m_pEdtDesigner;
    bool                m_bEdit;
    String              m_sFormTypeCd;
    TVmsObjUseManager  *MyUseManager;

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

    void __fastcall FormInit();
    void __fastcall FormObjectInit();
    void __fastcall RefreshData();

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

    //폼유형
    void __fastcall FillVmsFormType(TcxComboBox *ACombo);
    //표출방법
    void __fastcall FillVmsFormDispMode(TcxComboBox *ACombo);
    //표출방향
    void __fastcall FillVmsFormDispDir(TcxComboBox *ACombo);

    //VMS Font
    void __fastcall FillVmsFont(TcxComboBox *ACombo);

    void __fastcall ClearSymbloList();

    void __fastcall LoadVmsForm();

    void __fastcall DisplayInfo();
    bool __fastcall SaveVmsForm(String AVALID_YN);

    void __fastcall ChangeEditMode(int AEdit);
    void __fastcall ChangeEditModeObject(int AEdit);

    void __fastcall FormClear();
    void __fastcall FormObjectClear();

    void __fastcall DisplayFormInfo(int AIdx);
    void __fastcall LoadFormObjectInfo(String AFormId, TVmsFormDesigner *ADesigner, String AFormType);

    bool __fastcall GetNextVmsFormId(int &AFormId);

    void __fastcall SelObjectListData();
    void __fastcall AddObjectToList(TVmsFormObject *pObj, bool bSelect=false);
    String __fastcall FindObjectTypeName(String AFormType, String ATypeCd);

    bool __fastcall AddDefFormObject(String AFontName, int AFontSize, String AFontColor,
                                     int AObjType, String AText, int ASize, int APosX, int APosY, int AAlign=0);
    void __fastcall MakeDefSafeForm();
    void __fastcall MakeDefTrafficForm(int ARows);

    bool __fastcall CheckVideoStreamImage();
    void __fastcall MakeDefVideoStreamForm(int AType);

    bool __fastcall CheckVmsFormUse(String AFormId);
    bool __fastcall DelVmsForm(String AFormId);
    void __fastcall UpdateObjectIfscId();

    void __fastcall CheckImageSelected();
    int __fastcall CountFormObject(int objType);

    bool __fastcall CopyFormAdd(String AOrgFormId, String ANewFormId, String AFormName);
    bool __fastcall CopyFormAdd212(String AOrgFormId, String ANewFormId, String AFormName, String AVmsSizeType);

    void __fastcall FnFormObjectSelected(TMessage &Msg);
    BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(WM_OBJECT_SELECT, TMessage, FnFormObjectSelected)
    END_MESSAGE_MAP(TForm)
};
//---------------------------------------------------------------------------
extern PACKAGE TVMSM500M *VMSM500M;
//---------------------------------------------------------------------------

#endif

