// ###########################################################################
// #
// # FormDiag - Diagnostic Messages Display Form
// # Copyright (C) 2009 Tony Friery [DialTone]
// #
// # ALL RIGHTS RESERVED
// #
// ###########################################################################

#ifndef FormDiagH
#define FormDiagH

#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <Buttons.hpp>
#include <Dialogs.hpp>

///////////////////////////////////////////////////////////////////////
//
//		Identifiers for Diagnostic Message Types
//
///////////////////////////////////////////////////////////////////////

typedef enum
{
	DIAG_CPU,
	DIAG_EEPROM,
	DIAG_TIMER,
	DIAG_AUDIO,
	DIAG_OSCAMISC,
	DIAG_PALETTE,
	DIAG_VIDEO,
	DIAG_KBMOUSE,
	DIAG_MATHS,
	DIAG_SDMMC,
	DIAG_RS232,
	DIAG_UNUSED
}
DiagMsgTypes;

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

class TDiagForm : public TForm
{
	__published:	// IDE-managed Components
		TGroupBox 			*GrpFilters;
		TCheckBox 			*ChkCPU;
		TCheckBox 			*ChkPIC;
		TCheckBox 			*ChkTimer;
		TCheckBox 			*ChkAudio;
		TCheckBox 			*ChkVideo;
		TCheckBox 			*ChkOSCAMisc;
		TCheckBox 			*ChkPalette;
		TCheckBox 			*ChkKBMouse;
		TListView 			*ListMessages;
		TBitBtn 				*BtnClear;
		TBitBtn 				*BtnCopy;
		TBitBtn 				*BtnExport;
		TBitBtn 				*BtnClose;
		TSaveDialog 		*SaveDialog;
		TCheckBox 			*ChkMathsUnit;
		TCheckBox 			*ChkSDMMC;
		TCheckBox 			*ChkRS232;
		TCheckBox 			*ChkUnused8;
		TCheckBox 			*ChkLogToFile;

		void __fastcall 	BtnCloseClick(TObject *Sender);
		void __fastcall 	BtnClearClick(TObject *Sender);
		void __fastcall 	BtnCopyClick(TObject *Sender);
		void __fastcall 	BtnExportClick(TObject *Sender);
		void __fastcall 	ChkTypeModified(TObject *Sender);
	void __fastcall ChkLogModified(TObject *Sender);

	private:
		TMemoryStream 		*fCopiedDataStream;
		TFileStream			*fLogStream;
		bool					fMsgTypeActive[12];
		bool					fLogToFile;

		void __fastcall 	BuildCopiedData(void);
		void __fastcall 	DeleteCopiedData(void);

	public:
		void __fastcall 	AddMessage(DiagMsgTypes MsgType, UnicodeString Message);
		bool __fastcall   IsActive(DiagMsgTypes MsgType);
		__fastcall 			TDiagForm(TComponent* Owner);
		__fastcall 			~TDiagForm();
};

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

extern PACKAGE TDiagForm *DiagForm;

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

#endif
