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

#ifndef TVmsFormFH
#define TVmsFormFH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <stdio.h>
#include <ADODB.hpp>
#include <DB.hpp>
#include <SyncObjs.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
#include <GIFimg.hpp>
#include "LibSTLF.hpp"
//---------------------------------------------------------------------------
#include "VitzroCommF.h"
#include "ITSLogF.h"
//---------------------------------------------------------------------------

#define MAX_VMS_OBJ_LIST               64     	    /* 최대 VMS 오브젝트 리스트 갯수 */

class TVmsFormObj
{
public:
    TVmsFormObj();
    ~TVmsFormObj();

public:
	int         ObjectKind;         /* 객체종류 */
	int         ObjectType;         /* 객체타입 */
	int         ObjectSize;         /* 객체크기 */
	int         IsBlinking;         /* 점멸 여부 */
	int         PosX;               /* 위치 X */
	int         PosY;               /* 위치 Y */
	int         Width;              /* 객체넓이 */
	int         Height;             /* 객체높이 */
	int         BkColor;            /* 객체배경색상 */
	int         TextFontName;       /* 폰트이름 */
    //TODO
    AnsiString  StrTextFontName;
	int         TextFontColor;      /* 폰트색상 */
	int         TextFontSize;       /* 폰트크기 */
	int         TextFontBold;       /* 폰트굵기 */
	int         TextAlign;          /* 문자열정열방식 */
	AnsiString  TextData;           /* 문자열데이터 */
	AnsiString  ImageId;            /* 이미지아이디 */
	AnsiString  ImageType;          /* 이미지 타입 */
	//int         ObjectId;           /* 폼객체ID */
    AnsiString  IFSC_ID;

	TImage        *pImageData;      /* 이미지데이터 */
	TMemoryStream *pImageStream;    /* 이미지데이터 버퍼 */

public:
    void Clear();
    TImage *NewImage();
};
//---------------------------------------------------------------------------

class TVmsForm
{
public:
    TVmsForm();
    ~TVmsForm();

public:
	int         ScenarioSeq;        /* 폼 표출순서 */
	AnsiString  FormId;             /* 폼 ID */
	int         DisplayTime;        /* 표출시간(초) */
	AnsiString  DisplayMode;        /* 표출기능 */
	AnsiString  DisplayDir;         /* 표출방향 */
	int         FormKind;           /* 폼 종류 */
	int         BkColor;            /* 배경색상 */

	int         Width;              /* 폼넓이 */
	int         Height;             /* 폼높이 */

	bool        SvcRes;             /* 제공결과 */
	bool        FtpRes;             /* 제공결과 */

    AnsiString  TrfBakImgId;

    TCriticalSection *pCriticalSection;

public:
    int                 FTotal;
    int                 FObjects;
    IntMap<TVmsFormObj> FLists;

    void Lock()   { pCriticalSection->Enter(); }
    void UnLock() { pCriticalSection->Leave(); };

    int Count() { return FObjects; }
    int Total() { return FTotal; }

    void Clear();
    TVmsFormObj *GetItem(int AIdx);
    int AddFormObject(TVmsFormObj *AFormObj);
    TVmsFormObj *AddFormObject();

    void Init(int AWidth, int AHeight);
    void FormClear(TColor ABkColor);
	Graphics::TBitmap *pBitmap;     /* 이미지데이터 */
	TMemoryStream     *pStream;     /* 이미지데이터 버퍼 */
};
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
class TVmsFormManager
{
public:
    TVmsFormManager();
    ~TVmsFormManager();

private:

public:
    void Lock() { FLists.Lock(); }
    void UnLock() { FLists.UnLock(); }

public:
    int              FormWidth;
    int              FormHeight;

    int              FTotal;
    int              FObjects;
    IntMap<TVmsForm> FLists;

    int Count() { return FObjects; }
    int Total() { return FTotal; }

    void Clear();
    TVmsForm *GetItem(int AIdx);
    int AddForm(TVmsForm *AForm);
    TVmsForm *AddForm();
};
//---------------------------------------------------------------------------
//extern TVmsFormManager *VmsFormManager;
//---------------------------------------------------------------------------



#endif
