//---------------------------------------------------------------------------
/*
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 Conv_ModeH
#define Conv_ModeH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "_GClass.hpp"
#include "AbCBitBt.hpp"
#include "HideButton.h"
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include "AbVSlide.hpp"
#include "AbNumEdit.hpp"
#include "AbSwitch.hpp"
#include "AbLED.hpp"
#include "ColorButton.hpp"
//---------------------------------------------------------------------------
class TConvMode : public TForm
{
__published:	// IDE-managed Components
	TLabel *Conventional_Controls_Label;
	THideButton *HideButton;
	TAbColBitBtn *ESTOP;
	TPanel *ConvPanel;
	TAbColBitBtn *WhistleButton;
	TAbColBitBtn *CPLRFButton;
	TAbColBitBtn *BellButton;
	TAbColBitBtn *CPLRRButton;
	TLabel *Label6;
    TAbNumSpin *InputVoltageSpin;
	TLabel *Label7;
	TLabel *Label8;
	TAbNumSpin *MaxVoltageSpin;
	TLabel *Label4;
	TLabel *Label1;
	TAbNumSpin *StartVoltageSpin;
	TLabel *Label5;
	TButton *MinVoltageButton;
	TButton *SpeedControlButton;
	TButton *DirLockButton;
    TButton *FactoryResetButton;
	TButton *PS1_Start_Button;
	TAbColBitBtn *DirButton;
	TAbLED *JumptoMinRequest;
	TAbColBitBtn *PFAButton;
	TAbRockerSwitch *VarXModeSwitch;
	TImage *Copyright;
	TAbVSlider *VoltageSlider;
	TColorButton *ZeroButton;
	TAbColBitBtn *BoostButton;
	TAbColBitBtn *BrakeButton;
    TAbRockerSwitch *VarXSignal;
    TLabel *Label16;
    TLabel *Label17;
	void __fastcall HideButtonClick(TObject *Sender);
	void __fastcall ESTOPClick(TObject *Sender);
	void __fastcall WhistleButtonMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall WhistleButtonMouseUp(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall PFAButtonMouseDown(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall VarXModeSwitchStatusChanged(TObject *Sender);
	void __fastcall PS1_Start_ButtonMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall FactoryResetButtonClick(TObject *Sender);
	void __fastcall DirButtonMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall DirButtonMouseUp(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall DirLockButtonMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall SpeedControlButtonMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall StartVoltageSpinChange(TObject *Sender);
	void __fastcall MinVoltageButtonMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall PS1_Start_ButtonMouseUp(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall BellButtonMouseDown(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall BellButtonMouseUp(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall InputVoltageSpinChange(TObject *Sender);
	void __fastcall MaxVoltageSpinValueChanged(TObject *Sender);
	void __fastcall CPLRFButtonMouseDown(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall CPLRRButtonMouseDown(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
	void __fastcall VoltageSliderValueChange(TObject *Sender);
	void __fastcall ZeroButtonMouseDown(TObject *Sender, TMouseButton Button,
          TShiftState Shift, int X, int Y);
	void __fastcall BoostButtonStatusChanged(TObject *Sender);
	void __fastcall BrakeButtonStatusChanged(TObject *Sender);
	void __fastcall FormDeactivate(TObject *Sender);
	void __fastcall FormActivate(TObject *Sender);
	void __fastcall Conventional_Controls_LabelClick(TObject *Sender);
	void __fastcall InputVoltageSpinValueChanged(TObject *Sender);
	void __fastcall StartVoltageSpinValueChanged(TObject *Sender);
    void __fastcall CopyrightClick(TObject *Sender);
    void __fastcall VarXSignalStatusChanged(TObject *Sender);

protected:
    void __fastcall CMWhistle(TMessage &Message);
    void __fastcall CMCPLRF(TMessage &Message);
    void __fastcall CMCPLRR(TMessage &Message);
    void __fastcall CMBell(TMessage &Message);
    void __fastcall CMDir(TMessage &Message);

    BEGIN_MESSAGE_MAP
        MESSAGE_HANDLER(CM_WHISTLE, TMessage, CMWhistle)
        MESSAGE_HANDLER(CM_CPLRF, TMessage, CMCPLRF)
        MESSAGE_HANDLER(CM_CPLRR, TMessage, CMCPLRR)
        MESSAGE_HANDLER(CM_BELL, TMessage, CMBell)
        MESSAGE_HANDLER(CM_DIR, TMessage, CMDir)
    END_MESSAGE_MAP(TForm)

private:	// User declarations
    int RemoteNo, EngineNo, TIUNo, ChannelNo;
    void __fastcall SetVoltageSliderValue(float Value);

    void __fastcall (__closure *VoltageSliderOnValueChange)(TObject *Sender);
    bool LocalTransparencyOverride;

public:		// User declarations
	__fastcall TConvMode(TComponent* Owner);
    __fastcall TConvMode(TComponent* Owner, int Remote, int Engine, int TIU, int Channel);
    __fastcall ~TConvMode(void);
    HWND ParentHandle;
};
//---------------------------------------------------------------------------
extern PACKAGE TConvMode *ConvMode;
//---------------------------------------------------------------------------
#endif
