Trackobot::Trackobot( int argc, char **argv )
  : mApp( argc, argv ),
    mWindow( NULL ),
    mSingleInstanceServer( NULL )
{
  SetupApplication();
  mWebProfile = new WebProfile( this );
  mResultTracker = new ResultTracker( this );
}
// frame constructor
MyFrame::MyFrame(const wxString& title)
       : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(478, 506))
{
#if wxUSE_MENUS
    // create a menu bar
    wxMenu *fileMenu = new wxMenu;

    // the "About" item should be in the help menu
    wxMenu *helpMenu = new wxMenu;
    helpMenu->Append(Minimal_About, _T("&About...\tF1"), _T("Show about dialog"));

	fileMenu->Append(Minimal_Open, _T("&Open\tAlt-O"), _T("Open a saved configuration"));
	fileMenu->Append(Minimal_Save, _T("&Save\tAlt-S"), _T("Save the current configuration"));
    fileMenu->Append(Minimal_Quit, _T("E&xit\tAlt-X"), _T("Quit this program"));

    // now append the freshly created menu to the menu bar...
    wxMenuBar *menuBar = new wxMenuBar();
    menuBar->Append(fileMenu, _T("&File"));
    menuBar->Append(helpMenu, _T("&Help"));

    // ... and attach this menu bar to the frame
    SetMenuBar(menuBar);
#endif // wxUSE_MENUS

#if wxUSE_STATUSBAR
    // create a status bar just for fun (by default with 1 pane only)
    CreateStatusBar(2);
    SetStatusText(_T("Logician C++ Test App"));
#endif // wxUSE_STATUSBAR

	//configuration controls
	panel = new wxPanel(this, wxID_ANY);
	wxBoxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
	wxFlexGridSizer *sizerGrid = new wxFlexGridSizer(2);

	wxStaticText *stCylinderSeries = new wxStaticText(panel, LabelCtrl, _T("lbCylinderSeries"));
	sizerGrid->Add(stCylinderSeries);
	wxComboBox *comboCylinderSeries = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("CylinderSeries"));
	sizerGrid->Add(comboCylinderSeries);

	wxStaticText *stMountingStyle = new wxStaticText(panel, LabelCtrl, _T("lbMountingStyle"));
	sizerGrid->Add(stMountingStyle);
	wxComboBox *comboMountingStyle = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("MountingStyle"));
	sizerGrid->Add(comboMountingStyle);

	wxGridSizer *sizeBoreRod = new wxGridSizer(2);
	wxStaticText *stBoreDiameter = new wxStaticText(panel, LabelCtrl, _T("lbBoreDiameter"));
	wxStaticText *stRodDiameter = new wxStaticText(panel, LabelCtrl, _T("lbRodDiameter"));
	sizeBoreRod->Add(stBoreDiameter);
	sizeBoreRod->Add(stRodDiameter);
	wxComboBox *comboBoreDiameter = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("BoreDiameter"));
	wxComboBox *comboRodDiameter = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("RodDiameter"));
	sizeBoreRod->Add(comboBoreDiameter);
	sizeBoreRod->Add(comboRodDiameter);
	sizerGrid->AddSpacer(0);
	sizerGrid->Add(sizeBoreRod);

	wxStaticText *stRodEndTypes = new wxStaticText(panel, LabelCtrl, _T("lbRodEndTypes"));
	sizerGrid->Add(stRodEndTypes);
	wxComboBox *comboRodEndTypes = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("RodEndTypes"));
	sizerGrid->Add(comboRodEndTypes);

	wxStaticText *stSealingSystem = new wxStaticText(panel, LabelCtrl, _T("lbSealingSystem"));
	sizerGrid->Add(stSealingSystem);
	wxComboBox *comboSealingSystem = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("SealingSystem"));
	sizerGrid->Add(comboSealingSystem);

	wxStaticText *stPorts = new wxStaticText(panel, LabelCtrl, _T("lbPorts"));
	sizerGrid->Add(stPorts);
	wxComboBox *comboPorts = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("Ports"));
	sizerGrid->Add(comboPorts);

	wxGridSizer *sizerPort = new wxGridSizer(2);
	wxStaticText *stPortLocationHead = new wxStaticText(panel, LabelCtrl, _T("lbPortLocationHead"));
	wxStaticText *stPortLocationCap = new wxStaticText(panel, LabelCtrl, _T("lbPortLocationCap"));
	sizerPort->Add(stPortLocationHead);
	sizerPort->Add(stPortLocationCap);
	wxComboBox *comboPortLocationHead = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("PortLocationHead"));
	wxComboBox *comboPortLocationCap = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("PortLocationCap"));
	sizerPort->Add(comboPortLocationHead);
	sizerPort->Add(comboPortLocationCap);
	sizerGrid->AddSpacer(0);
	sizerGrid->Add(sizerPort);

	wxGridSizer *sizerCushion = new wxGridSizer(2);
	wxStaticText *stCushionLocationHead = new wxStaticText(panel, LabelCtrl, _T("lbCushionHead"));
	wxStaticText *stCushionLocationCap = new wxStaticText(panel, LabelCtrl, _T("lbCushionCap"));
	sizerCushion->Add(stCushionLocationHead);
	sizerCushion->Add(stCushionLocationCap);
	wxComboBox *comboCushionLocationHead = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("CushionHead"));
	wxComboBox *comboCushionLocationCap = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("CushionCap"));
	sizerCushion->Add(comboCushionLocationHead);
	sizerCushion->Add(comboCushionLocationCap);
	sizerGrid->AddStretchSpacer();
	sizerGrid->Add(sizerCushion);

	wxStaticText *stCylinderStroke = new wxStaticText(panel, LabelCtrl, _T("lbCylinderStroke"));
	sizerGrid->Add(stCylinderStroke);
	wxTextCtrl *editCylinderStroke = new wxTextCtrl(panel, EditCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, wxDefaultValidator, _T("CylinderStroke"));
	sizerGrid->Add(editCylinderStroke);

	wxStaticText *stAdditionalOption = new wxStaticText(panel, LabelCtrl, _T("lbAdditionalOption"));
	sizerGrid->Add(stAdditionalOption);
	wxComboBox *comboAdditionalOption = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("AdditionalOption"));
	sizerGrid->Add(comboAdditionalOption);

	sizerGrid->AddStretchSpacer();
	wxGridSizer *sizerOptions = new wxGridSizer(2);
	wxStaticText *stExtraRodProtection = new wxStaticText(panel, LabelCtrl, _T("lbExtraRodProtection"));
	wxTextCtrl *editExtraRodProtection = new wxTextCtrl(panel, EditCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, wxDefaultValidator, _T("ExtraRodProtection"));
	wxStaticText *stPosition = new wxStaticText(panel, wxID_ANY, _T("Position"));
	sizerOptions->Add(stExtraRodProtection);
	sizerOptions->Add(stPosition);
	sizerOptions->Add(editExtraRodProtection);

	wxGridSizer *sizerPosition = new wxGridSizer(2);
	wxStaticText *stOptionHead= new wxStaticText(panel, LabelCtrl, _T("lbOptionHead"));
	wxStaticText *stOptionCap = new wxStaticText(panel, LabelCtrl, _T("lbOptionCap"));
	wxComboBox *comboOptionHead = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("OptionHead"));
	wxComboBox *comboOptionCap = new wxComboBox(panel, ComboCtrl, wxEmptyString, wxDefaultPosition,
		wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("OptionCap"));
	sizerPosition->Add(stOptionHead);
	sizerPosition->Add(stOptionCap);
	sizerPosition->Add(comboOptionHead);
	sizerPosition->Add(comboOptionCap);
	sizerOptions->Add(sizerPosition);
	sizerGrid->Add(sizerOptions);

	wxStaticText *stCatnumLabel= new wxStaticText(panel, wxID_ANY, _T("Catalog#:"));
	wxStaticText *stCatnum= new wxStaticText(panel, Catalog, _T("XXXXXXXX"));

	sizerGrid->Add(stCatnumLabel);
	sizerGrid->Add(stCatnum);

	sizerTop->Add(sizerGrid, 1);
#ifdef USEDEBUGGER
	m_debugger = NULL;
#endif
	m_engine = NULL;
	bLoadingItems = false;
	SetupApplication();
#ifdef USEDEBUGGER
	m_debugger = new wxLogicianDebugCtrl(m_rootNode, panel, wxID_ANY, wxDefaultPosition,
		wxSize(640, 480));
	sizerTop->Add(m_debugger, 1, wxEXPAND|wxSHRINK);
#endif
	panel->SetSizer(sizerTop);
	sizerTop->Fit(this);
	sizerTop->SetSizeHints(this);
}