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

#ifndef NewTabletCounter_FormH
#define NewTabletCounter_FormH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <Buttons.hpp>

#include "Common.h"
#include "TntButtons.hpp"
#include "TntExtCtrls.hpp"
#include "TntForms.hpp"
#include "TntStdCtrls.hpp"
#define PC_TABLET_LONG_LIST_COUNT		65536
//---------------------------------------------------------------------------
class TNewTabletCounterForm : public TTntForm
{
__published:	// IDE-managed Components
	TTntPanel *Panel1;
	TTntButton *SpeedControlButton;
	TTntGroupBox *GroupBox1;
	TTntSpeedButton *SCSpeedButton1;
	TTntSpeedButton *SCSpeedButton2;
	TTntSpeedButton *SCSpeedButton3;
	TTntButton *StartButton;
	TTntButton *StopButton;
	TTntPanel *Panel2;
	TTntLabel *Label1;
	TTntLabel *Label2;
	TTntImage *SensorImage1;
	TTntPanel *Panel3;
	TTntLabel *Label5;
	TTntLabel *Label6;
	TTntImage *SensorImage2;
	TTntPanel *Panel4;
	TTntLabel *Label7;
	TTntLabel *Label8;
	TTntImage *SensorImage_Match;
	TTntScrollBar *ViewingScrollBar;
	TTntPanel *Panel5;
	TTntButton *ZoomInButton;
	TTntButton *ZoomOutButton;
	TTntButton *CloseButton;
	TTntGroupBox *GroupBox2;
	TTntSpeedButton *VFRunSpeedButton;
	TTntSpeedButton *VFStopSpeedButton;
	TTntSpeedButton *VFAutoSpeedButton;
	TTntLabel *Label13;
	TTntEdit *VFSpeedEdit;
	TTntSpeedButton *AirKnifeOnSpeedButton;
	TTntSpeedButton *AirKnifeOffSpeedButton;
	TTntButton *TimerStopButton;
	TTimer *TabletInfoTimer;
	TTntLabel *Sensor1CountLabel;
	TTntLabel *Sensor2CountLabel;
	TTntLabel *TotalCountLabel;
	TTntLabel *Label11;
	TTntLabel *MisFeedingCountLabel;
	TTntLabel *Label16;
	TTntLabel *ClosedCountLabel;
	TTntLabel *Label9;
	TTntLabel *LostCountLabel;
	TTntLabel *Label14;
	TTntLabel *InsertedCountLabel;
	TTntLabel *Label18;
        TTntLabel *ClosedTabletUninsCountLabel;
	TTntLabel *Label22;
        TTntLabel *NozzErrorUnInsTabletCountLabel;
	TTntLabel *Label24;
	TTntLabel *GoodCountLabel;
	TTntLabel *Label26;
	TTntLabel *UnInsCountLabel;
	TTntLabel *Label10;
	TTntLabel *TPHLabel;
	TTntPanel *Panel6;
	TTntLabel *Label3;
	TTntLabel *Label4;
	TTntLabel *Sensor3CountLabel;
	TTntImage *SensorImage3;
	TTntPanel *Panel7;
	TTntLabel *Label15;
	TTntLabel *Label17;
	TTntLabel *CountedCountLabel;
	TTntImage *SensorImage_Ejection_Match;
	TTntGroupBox *GroupBox3;
	TTntGroupBox *GroupBox4;
	TTntCheckBox *DefectGenEnabledCheckBox;
	TTntRadioButton *DefectGenKindRadioButton1;
	TTntLabel *Label21;
	TTntEdit *DefectGenRatioEdit;
	TTntLabel *Label23;
	TTntRadioButton *DefectGenKindRadioButton2;
	TTntLabel *Label25;
	TTntEdit *DefectGenMaskEdit;
	TTntGroupBox *GroupBox5;
	TTntLabel *Label27;
	TTntLabel *Label28;
	TTntLabel *Label29;
	TTntCheckBox *UnInsGenEnabledCheckBox;
	TTntRadioButton *UnInsGenKindRadioButton1;
	TTntEdit *UnInsGenRatioEdit;
	TTntRadioButton *UnInsGenKindRadioButton2;
	TTntEdit *UnInsGenMaskEdit;
	TTntLabel *Label30;
	TTntLabel *DefectCountLabel;
	TTntLabel *Label32;
	TTntLabel *UnInsGenCountLabel;
	TTntLabel *Label31;
	TTntLabel *GoodTabletLostCountLabel;
	TTntLabel *Label34;
	TTntLabel *MisejectDefectTabletCountLabel;
	TTntLabel *Label36;
	TTntLabel *MisejectTabletInsertCountLabel;
	TTntLabel *Label38;
	TTntLabel *MisejectUnInsTabletCountLabel;
	void __fastcall SpeedControlButtonClick(TObject *Sender);
	void __fastcall StartButtonClick(TObject *Sender);
	void __fastcall TabletInfoTimerTimer(TObject *Sender);
	void __fastcall FormDestroy(TObject *Sender);
	void __fastcall ViewingScrollBarScroll(TObject *Sender,
          TScrollCode ScrollCode, int &ScrollPos);
	void __fastcall ZoomInButtonClick(TObject *Sender);
	void __fastcall ZoomOutButtonClick(TObject *Sender);
	void __fastcall TimerStopButtonClick(TObject *Sender);
	void __fastcall StopButtonClick(TObject *Sender);
	void __fastcall CloseButtonClick(TObject *Sender);
	void __fastcall VFRunSpeedButtonClick(TObject *Sender);
	void __fastcall VFStopSpeedButtonClick(TObject *Sender);
	void __fastcall VFAutoSpeedButtonClick(TObject *Sender);
	void __fastcall AirKnifeOnSpeedButtonClick(TObject *Sender);
	void __fastcall AirKnifeOffSpeedButtonClick(TObject *Sender);
	void __fastcall NumEditClick(TObject *Sender);
private:	// User declarations
	THCBDisk1TabletUnit *Disk1TabletList;
	THCBDisk2TabletUnit *Disk2TabletList;
	int CurrentList1TabletNumber, CurrentList2TabletNumber;
	int CurrentList1TabletNumber_Add, CurrentList2TabletNumber_Add;
	int CurrentList1Index, CurrentList2Index;
	int LastPCList1Index, LastPCList2Index; 
	TTabletInfo HCBTabletInfo;
	TTabletInspectInfo TabletInspectInfo;
	unsigned int StartHCBTime, CurrentHCBTime, ViewingLastTime;
	int TimingGap, TimingGap2;
	int Zoom;
	int AnalysisIndex;
	int ValidDataIndex;
	int ErrCount1, ErrCount2;
  void __fastcall GetDefaultString();
	void __fastcall RefreshGraph(void);
public:		// User declarations
	__fastcall TNewTabletCounterForm(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TNewTabletCounterForm *NewTabletCounterForm;
//---------------------------------------------------------------------------
#endif
