//---------------------------------------------------------------------------
/*
Remote Train Control Program for Windows

(c) Copyright 2015 by Mark DiVecchio

    This file is part of Remote Train Control.

    Remote Train Control is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Remote Train Control is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Remote Train Control.  If not, see <http://www.gnu.org/licenses/>.

*/
//---------------------------------------------------------------------------
#ifndef Debug_ControlsH
#define Debug_ControlsH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include "HideButton.h"
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include <Menus.hpp>
#include <Dialogs.hpp>
#include "AbNumEdit.hpp"
//---------------------------------------------------------------------------
class TDB : public TForm
{
__published:	// IDE-managed Components
    TRichEdit *Debug_Messages;
	TPanel *DebugTopPanel;
	TPanel *Panel2;
	THideButton *HideButton;
    TPopupMenu *DebugPopupX;
	TMenuItem *CutDebug;
	TMenuItem *CopyDebug;
	TMenuItem *PasteDebug;
	TMenuItem *SelectAllDebug;
	TMenuItem *SaveDebug;
	TButton *ClearDebugButton;
    TMenuItem *FindDialogMenuItem;
	TButton *SaveDebugButton;
	TButton *FindButton;
	TButton *CopyButton;
	TFontDialog *FontDialog1;
	TMenuItem *Font1;
	TImage *Copyright;
	TLabel *DBLabel;
	TButton *TimeStampButton;
	TAbNumSpin *DBLevel;
	TMenuItem *ToggleWordWrap;
	TCheckBox *AutoScroll;
    TRadioGroup *TimeStampGroup;
    TSaveDialog *SaveDialog1;
    TFindDialog *FindDialog1;
    void __fastcall HideButtonClick(TObject *Sender);
	void __fastcall CutDebugClick(TObject *Sender);
	void __fastcall CopyDebugClick(TObject *Sender);
	void __fastcall PasteDebugClick(TObject *Sender);
	void __fastcall SelectAllDebugClick(TObject *Sender);
	void __fastcall SaveDebugClick(TObject *Sender);
	void __fastcall ClearDebugButtonClick(TObject *Sender);
	void __fastcall CopyButtonClick(TObject *Sender);
	void __fastcall Font1Click(TObject *Sender);
	void __fastcall FontDialog1Apply(TObject *Sender, HWND Wnd);
	void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
	void __fastcall CopyrightClick(TObject *Sender);
	void __fastcall TimeStampButtonClick(TObject *Sender);
	void __fastcall DBLevelValueChanged(TObject *Sender);
	void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
	void __fastcall ToggleWordWrapClick(TObject *Sender);
    void __fastcall AutoScrollClick(TObject *Sender);
    void __fastcall FindDialog1Find(TObject *Sender);
    void __fastcall FindButtonClick(TObject *Sender);
    void __fastcall FormKeyPress(TObject *Sender, char &Key);
    void __fastcall TimeStampGroupClick(TObject *Sender);
    void __fastcall FindDialog1Close(TObject *Sender);
    
private:	// User declarations
    String RegFileRootKey;
    String SaveMainHint;
    int __fastcall MyFindText(String SearchStr, long StartPos, long FindLength, TSearchTypes Options, bool SearchDown);
    TPoint TopLeftPos;

protected:
    void __fastcall CMReenable(TMessage &Message);
	void __fastcall WMEnable(TWMEnable &Message);

	BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(CM_REENABLE, TMessage, CMReenable);
		MESSAGE_HANDLER(WM_ENABLE, TWMEnable, WMEnable);
	END_MESSAGE_MAP(TForm)

public:		// User declarations
    __fastcall TDB(TComponent* Owner);
    __fastcall ~TDB(void);
    void __fastcall ShowIt(void);
    bool __fastcall Debug_Print(String, TColor = clBlack);

};
//---------------------------------------------------------------------------
extern PACKAGE TDB *DB;
//---------------------------------------------------------------------------
#endif
