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

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

#include "Processing.h"
#include "TntExtCtrls.hpp"
#include "TntStdCtrls.hpp"
#include "TntForms.hpp"
//---------------------------------------------------------------------------
typedef enum {SETUP_MODE_NONE, SETUP_MODE_STUDY, SETUP_MODE_INSPECTION, SETUP_MODE_GRADE_CHANGE} ESetupMode;
typedef enum {SETUP_STEP_NONE, SETUP_STEP_INIT, SETUP_STEP_READY, SETUP_STEP_SEND_COMPLETE,
	SETUP_STEP_CPB_WAITING, SETUP_STEP_CPB_SETUP_COMPLETE} ESetupStep;
//---------------------------------------------------------------------------
class TSetupForm : public TTntForm
{
__published:	// IDE-managed Components
	TTntPanel *Panel1;
	TTntPanel *Panel2;
	TTntButton *CancelButton;
	TTntPanel *Panel7;
	TTntPanel *Panel8;
	TTntLabel *InformationLabel;
	TTimer *SetupTimer;
	TTntPanel *Panel9;
	TTntLabel *Label6;
	TTntLabel *LoadSetupDataLabel;
	TTntLabel *Label7;
	TTntLabel *MakeCharacterDataLabel;
	TTntLabel *Label8;
	TTntLabel *ModifySetupDataLabel;
	TTntLabel *Label9;
	TTntLabel *Label11;
	TTntLabel *Label13;
	TTntLabel *Label15;
	TTntLabel *Label17;
  TTntPanel *IPBPanel1;
	TTntLabel *Label1;
	TTntPanel *Panel11;
	TTntShape *SendCaptureSetupDataShape1;
	TTntLabel *SendCaptureSetupDataLabel1;
	TTntPanel *Panel12;
	TTntShape *SendCharacterDataShape1;
	TTntLabel *SendCharacterDataLabel1;
	TTntPanel *Panel13;
	TTntShape *SendSetupDataShape1;
	TTntLabel *SendSetupDataLabel1;
	TTntPanel *Panel10;
	TTntShape *SendStudyDataShape1;
	TTntLabel *SendStudyDataLabel1;
	TTntPanel *Panel14;
	TTntShape *SendGradeDataShape1;
	TTntLabel *SendGradeDataLabel1;
	TTntLabel *Label31;
	TTntPanel *Panel15;
	TTntImage *CPBSetupImage1;
  TTntPanel *IPBPanel2;
	TTntLabel *Label2;
	TTntPanel *Panel5;
	TTntShape *SendCaptureSetupDataShape2;
	TTntLabel *SendCaptureSetupDataLabel2;
	TTntPanel *Panel6;
	TTntShape *SendCharacterDataShape2;
	TTntLabel *SendCharacterDataLabel2;
	TTntPanel *Panel16;
	TTntShape *SendSetupDataShape2;
	TTntLabel *SendSetupDataLabel2;
	TTntPanel *Panel17;
	TTntShape *SendStudyDataShape2;
	TTntLabel *SendStudyDataLabel2;
	TTntPanel *Panel18;
	TTntShape *SendGradeDataShape2;
	TTntLabel *SendGradeDataLabel2;
	TTntPanel *Panel19;
	TTntImage *CPBSetupImage2;
  TTntPanel *IPBPanel4;
	TTntLabel *Label16;
	TTntPanel *Panel21;
	TTntShape *SendCaptureSetupDataShape4;
	TTntLabel *SendCaptureSetupDataLabel4;
	TTntPanel *Panel22;
	TTntShape *SendCharacterDataShape4;
	TTntLabel *SendCharacterDataLabel4;
	TTntPanel *Panel23;
	TTntShape *SendSetupDataShape4;
	TTntLabel *SendSetupDataLabel4;
	TTntPanel *Panel24;
	TTntShape *SendStudyDataShape4;
	TTntLabel *SendStudyDataLabel4;
	TTntPanel *Panel25;
	TTntShape *SendGradeDataShape4;
	TTntLabel *SendGradeDataLabel4;
	TTntPanel *Panel26;
	TTntImage *CPBSetupImage4;
  TTntPanel *IPBPanel3;
	TTntLabel *Label23;
	TTntPanel *Panel28;
	TTntShape *SendCaptureSetupDataShape3;
	TTntLabel *SendCaptureSetupDataLabel3;
	TTntPanel *Panel29;
	TTntShape *SendCharacterDataShape3;
	TTntLabel *SendCharacterDataLabel3;
	TTntPanel *Panel30;
	TTntShape *SendSetupDataShape3;
	TTntLabel *SendSetupDataLabel3;
	TTntPanel *Panel31;
	TTntShape *SendStudyDataShape3;
	TTntLabel *SendStudyDataLabel3;
	TTntPanel *Panel32;
	TTntShape *SendGradeDataShape3;
	TTntLabel *SendGradeDataLabel3;
	TTntPanel *Panel33;
	TTntImage *CPBSetupImage3;
  TTntPanel *IPBPanel5;
  TTntLabel *TntLabel1;
  TTntPanel *TntPanel2;
  TTntShape *SendCaptureSetupDataShape5;
  TTntLabel *SendCaptureSetupDataLabel5;
  TTntPanel *TntPanel3;
  TTntShape *SendCharacterDataShape5;
  TTntLabel *SendCharacterDataLabel5;
  TTntPanel *TntPanel4;
  TTntShape *SendSetupDataShape5;
  TTntLabel *SendSetupDataLabel5;
  TTntPanel *TntPanel5;
  TTntShape *SendStudyDataShape5;
  TTntLabel *SendStudyDataLabel5;
  TTntPanel *TntPanel6;
  TTntShape *SendGradeDataShape5;
  TTntLabel *SendGradeDataLabel5;
  TTntPanel *TntPanel7;
  TTntImage *CPBSetupImage5;
  TTntPanel *IPBPanel8;
  TTntLabel *TntLabel2;
  TTntPanel *TntPanel9;
  TTntShape *SendCaptureSetupDataShape8;
  TTntLabel *SendCaptureSetupDataLabel8;
  TTntPanel *TntPanel10;
  TTntShape *SendCharacterDataShape8;
  TTntLabel *SendCharacterDataLabel8;
  TTntPanel *TntPanel11;
  TTntShape *SendSetupDataShape8;
  TTntLabel *SendSetupDataLabel8;
  TTntPanel *TntPanel12;
  TTntShape *SendStudyDataShape8;
  TTntLabel *SendStudyDataLabel8;
  TTntPanel *TntPanel13;
  TTntShape *SendGradeDataShape8;
  TTntLabel *SendGradeDataLabel8;
  TTntPanel *TntPanel14;
  TTntImage *CPBSetupImage8;
  TTntPanel *IPBPanel7;
  TTntLabel *TntLabel3;
  TTntPanel *TntPanel16;
  TTntShape *SendCaptureSetupDataShape7;
  TTntLabel *SendCaptureSetupDataLabel7;
  TTntPanel *TntPanel17;
  TTntShape *SendCharacterDataShape7;
  TTntLabel *SendCharacterDataLabel7;
  TTntPanel *TntPanel18;
  TTntShape *SendSetupDataShape7;
  TTntLabel *SendSetupDataLabel7;
  TTntPanel *TntPanel19;
  TTntShape *SendStudyDataShape7;
  TTntLabel *SendStudyDataLabel7;
  TTntPanel *TntPanel20;
  TTntShape *SendGradeDataShape7;
  TTntLabel *SendGradeDataLabel7;
  TTntPanel *TntPanel21;
  TTntImage *CPBSetupImage7;
  TTntPanel *IPBPanel6;
  TTntLabel *TntLabel9;
  TTntPanel *TntPanel23;
  TTntShape *SendCaptureSetupDataShape6;
  TTntLabel *SendCaptureSetupDataLabel6;
  TTntPanel *TntPanel24;
  TTntShape *SendCharacterDataShape6;
  TTntLabel *SendCharacterDataLabel6;
  TTntPanel *TntPanel25;
  TTntShape *SendSetupDataShape6;
  TTntLabel *SendSetupDataLabel6;
  TTntPanel *TntPanel26;
  TTntShape *SendStudyDataShape6;
  TTntLabel *SendStudyDataLabel6;
  TTntPanel *TntPanel27;
  TTntShape *SendGradeDataShape6;
  TTntLabel *SendGradeDataLabel6;
  TTntPanel *TntPanel28;
  TTntImage *CPBSetupImage6;
  TTntPanel *TntPanel1;
  TTntPanel *TntPanel8;
  TTntLabel *TntLabel4;
  TTntLabel *TntLabel5;
  TTntLabel *TntLabel6;
  TTntLabel *TntLabel7;
  TTntLabel *TntLabel8;
  TTntLabel *TntLabel10;
	void __fastcall SetupTimerTimer(TObject *Sender);
	void __fastcall FormActivate(TObject *Sender);
	void __fastcall FormDestroy(TObject *Sender);
private:	// User declarations
	TTabletCharacter TabletCharacter;
	TTabletSetupData *TabletSetupData;
	TTablet3DSetupData *Tablet3DSetupData;
	TTabletCaptureSetupData TabletCaptureSetupData;
	ESetupMode SetupMode;
	ESetupStep SetupStep;
	bool Setup3DNeeded;

	bool __fastcall ReadSetupData(TTabletSetupData *tabletSetupData);
	void __fastcall WriteSetupData(TTabletSetupData *tabletSetupData);
	bool __fastcall Read3DSetupData(TTablet3DSetupData *tablet3DSetupData);	
	void __fastcall InitDisplay(void);
	void __fastcall InitSetupData(void);
	void __fastcall SendCaptureSetupData(void);
	void __fastcall SendTabletCharacterData(void);
	void __fastcall SendTabletSetupData(void);
	void __fastcall SendTabletStudyData(void);
	void __fastcall SendTabletGradeData(void);

	void __fastcall SendSetupStartCommand(void);
	int __fastcall PollingCPBSetupStatus(void);
  void __fastcall GetDefaultString();
public:		// User declarations
  int validSPBMask;
  
	__fastcall TSetupForm(TComponent* Owner);
	void __fastcall InitSetup(ESetupMode setupMode);
};
//---------------------------------------------------------------------------
extern PACKAGE TSetupForm *SetupForm;

bool __fastcall SendInspectionSetupData(void);
bool __fastcall SendInspectionSetupDataForSimulation(int spbMask, int mode);
//---------------------------------------------------------------------------
#endif
