//---------------------------------------------------------------------------
/*
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/>.

*/
// Home Page : http://www.silogic.com/trains/RTC_Running.html
//---------------------------------------------------------------------------
#ifndef Volume_ControlH
#define Volume_ControlH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "_GClass.hpp"
#include "AbVSlide.hpp"
#include "AbHSlide.hpp"
#include "AbSwitch.hpp"
#include <ExtCtrls.hpp>
#include <Graphics.hpp>
#include "AbCBitBt.hpp"
#include "AbDial.hpp"
#include <Menus.hpp>
#include "AbGearDial.hpp"
#include "AbVInd.hpp"
#include "ColorButton.hpp"
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
class TVolume : public TForm
{
__published:	// IDE-managed Components
    TLabel *Volume_Controls_Label;
	TButton *HideButton;
	TPanel *SoundPanel;
	TAbVSlider *MasterVolume;
	TAbVSlider *EngineVolume;
	TAbRockerSwitch *EngineSoundOnSwitch;
	TLabel *Label1;
	TLabel *Mute;
	TAbVSlider *AccentVolume;
	TAbVSlider *HornWhistleVolume;
	TAbVSlider *BellVolume;
	TAbDial *EngineSoundKnob;
	TAbDial *IdleSoundKnob;
	TPanel *Panel1;
	TGroupBox *CoorsGroupBox;
	TColorButton *CoorsColorButton;
	TButton *CoorsDoorsOpen;
	TButton *CoorsDoorsClose;
	TAbColBitBtn *IdleSoundButton;
	TGroupBox *BoilerGroupBox;
	TButton *BoilerStartupButton;
	TButton *BoilerReleaseButton;
	TButton *STWButton;
	TAbColBitBtn *EngineSoundButton;
	TGroupBox *CouplerGroup;
	TButton *SCSButton;
	TButton *SCCButton;
	TImage *Copyright;
	TUpDown *EngineSoundUpDown;
	TUpDown *IdleSoundUpDown;
	TButton *OpControlsButton;
	TButton *IdleStopButton;
	TButton *SoundStopButton;
	void __fastcall EngineSoundOnSwitchStatusChanged(TObject *Sender);
	void __fastcall HideButtonClick(TObject *Sender);
	void __fastcall EngineSoundButtonClick(TObject *Sender);
	void __fastcall EngineSoundKnobKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
	void __fastcall IdleSoundKnobKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
	void __fastcall IdleSoundButtonClick(TObject *Sender);
	void __fastcall MasterVolumeValueChange(TObject *Sender);
	void __fastcall EngineVolumeValueChange(TObject *Sender);
	void __fastcall AccentVolumeValueChange(TObject *Sender);
	void __fastcall HornVolumeValueChange(TObject *Sender);
	void __fastcall BellVolumeValueChange(TObject *Sender);
	void __fastcall BoilerStartupButtonClick(TObject *Sender);
	void __fastcall BoilerReleaseButtonClick(TObject *Sender);
	void __fastcall SCSButtonClick(TObject *Sender);
	void __fastcall SCCButtonClick(TObject *Sender);
	void __fastcall STWButtonClick(TObject *Sender);
	void __fastcall FormKeyDown(TObject *Sender, WORD &Key,
          TShiftState Shift);
	void __fastcall CoorsDoorsOpenClick(TObject *Sender);
	void __fastcall CoorsDoorsCloseClick(TObject *Sender);
	void __fastcall EngineSoundKnobDblClick(TObject *Sender);
	void __fastcall IdleSoundKnobDblClick(TObject *Sender);
	void __fastcall CoorsColorButtonMouseDown(TObject *Sender,
          TMouseButton Button, TShiftState Shift, int X, int Y);
	void __fastcall EngineSoundUpDownClick(TObject *Sender, TUDBtnType Button);
	void __fastcall IdleSoundUpDownClick(TObject *Sender, TUDBtnType Button);
	void __fastcall OpControlsButtonClick(TObject *Sender);
	void __fastcall SoundStopButtonClick(TObject *Sender);
	void __fastcall IdleStopButtonClick(TObject *Sender);
	void __fastcall CopyrightClick(TObject *Sender);
	void __fastcall FormDeactivate(TObject *Sender);
	void __fastcall FormActivate(TObject *Sender);
	void __fastcall Volume_Controls_LabelClick(TObject *Sender);

private:	// User declarations
    int RemoteNo, ConsistNo, TIUNo;
    String ConsistName;
    char * LashUpEngineListVol;
    //float MasterVolSaved;

    void PlayEngineSound(void);
    void PlayIdleSound(void);
	__fastcall TVolume(TComponent* Owner);
    int LastSentMasterVolumeValue, SavedMasterVolumeValue;

    void __fastcall (__closure *EventOnValueChange)(TObject *Sender);
    void __fastcall (__closure *EventOnStatusChanged)(TObject *Sender);
    bool LocalTransparencyOverride;

public:		// User declarations
    __fastcall TVolume(TComponent* Owner, int, int, int, String, char *);
    __fastcall ~TVolume(void);
    HWND ParentHandle;

   	// Pointer to mate up with Quick Controls Window
    TAbHSlider * ptrQuick_MasterVolume;
    // Pointer to mate up with Operations Window
    TAbRockerSwitch * ptrOp_SoundsSwitch;

};
//---------------------------------------------------------------------------
extern PACKAGE TVolume *Volume;
//---------------------------------------------------------------------------
#endif
