/*************************************************************************\
* "$RCSfile: CDlgAppVCR.hpp,v $"                                          *
***************************************************************************
* Information by CVS or VSS:                                              *
*     Last check in on: $Date: 2009-04-23 12:46:27 $                      *
*     by                $Author: schluckebier $
*     Revision        : $Revision: 1.3 $                                  *
\*************************************************************************/
/*! \file CDlgApp.hpp
*	\brief Header CDlgApp Class
*	\author (c) 2007 - 2013 IMAGO Technologies &
*
*	$Revision: 1.3 $
*	$Date: 2009-04-23 12:46:27 $
**************************************************************************/

#define VCR_MAXIMAGE (1024*10)

/*************************************************************************/
/*! @brief Camera settings dialog class 

	Provides the user interface to the OCR reader.
	@image html CDlgApp.png

	CDlgApp is non modal.
**************************************************************************/
class CDlgApp: public CDlg
{
	typedef struct sVCRIMAGE
	{
		unsigned char *pAddr;
		int ImageSize;
		LgUns AktTime;
	} VCRIMAGE;

	//! Image type
	enum eITYPE
	{
		I_BMP,
		I_PNG,
		I_JPG,
		I_JP2,
		I_RAW,
		I_RBMP,
		I_RPNG,
		I_RJPG,
		I_RRAW,
		I_MPEG
	};

	//! Trigger mode
	enum eTRG_MODE
	{
		TRG_NO = 1,
		TRG_EDGE,
		TRG_STATE
	};

	//! Record mode
	enum eREC_MODE
	{
		REC_NOTHING,
		REC_START,
		REC_STOP
	};

	//! Dialog identifier of user interface. They are reused as array
	//! index together with the "INDEX" and "ICON" macro
	enum eDlgApp_ID
	{
		ID_APP_SETUP = 0x100,
		ID_APP_RESTART,
		ID_APP_PLAYER,
		ID_APP_LOAD,
		ID_APP_PREVIEW,
		ID_APP_APP,
		ID_APP_FIRST,
		ID_APP_LAST,
		ID_APP_PLUS,
		ID_APP_MINUS,
		ID_APP_PLAY,
		ID_APP_PAUSE,
		ID_APP_BACK,
		ID_APP_SAVE,
		ID_APP_IFIRST,
		ID_APP_ILAST,
		ID_APP_XXX
	}; 

public:
	CDlgApp(int x, int y, int Width, int Height);
	~CDlgApp();
	int OnUserIO(int nKey);
	int OnImage(YIMAGE *pSrc, CIMAGE *pDst);
	static void Trigger(unsigned int DinValue);

protected:
	int  LoadIni();
	int  SaveIni();
	void Reset(int Width = -1, int Height = -1);
	void Setup();
	int  PutImage(void *pBuffer);
	void DrawInfo(YIMAGE *pyImage);
	void Player();
	void Save(int First, int Last, GUI_DLG *pDialog, int *pAktPos);
	void Load();
	void LoadAVI(char *pPath);
	void RecordMode();
	void RecordEnd();
	void Restart();

	static void TriggerISR(unsigned int DinValue);

	int m_Recording;
	int m_Info;
	int m_First;
	int m_Polarity;		//!< Trigger polarity
	int m_Leading;		//!< Leading frames
	int m_Trailing;		//!< Trailing frames
	int m_TrigMode;		//!< Trigger mode
	int m_ModeChangeCmd;
	int m_FirstInt;
	int m_SType;		//!< Save image type
	int m_SImg;			//!< Image/sequence

	unsigned char *m_pBaseAddr;
	int m_MaxImages;
	int m_UsedImages;
	int m_CurImage;
	int m_Width;
	int m_Height;
	int m_BitsPerPixel;
	int m_ColorCoding;
	int m_ImageType;
	int m_Ring;
	int m_MaxMem;
	LgUns m_StartTime;
	VCRIMAGE m_Image[VCR_MAXIMAGE];
	DLG_ITEMD *m_pRec;
	CIMAGE m_CIcon[2];
};

extern CDlgApp *pDlgApp;

/*************************************************************************/
