//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: quickdebug.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////

#include "quickdebugbase.h"


// Declare the bitmap loading function
extern void wxCrafterSFKMcrInitBitmapResources();

static bool bBitmapLoaded = false;


QuickDebugBase::QuickDebugBase(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style)
    : wxDialog(parent, id, title, pos, size, style)
{
    if ( !bBitmapLoaded ) {
        // We need to initialise the default bitmap handler
        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
        wxCrafterSFKMcrInitBitmapResources();
        bBitmapLoaded = true;
    }
    
    wxBoxSizer* bSizer1 = new wxBoxSizer(wxVERTICAL);
    this->SetSizer(bSizer1);
    
    wxBoxSizer* bSizer3 = new wxBoxSizer(wxVERTICAL);
    
    bSizer1->Add(bSizer3, 1, wxALL|wxEXPAND, 5);
    
    wxFlexGridSizer* fgSizer1 = new wxFlexGridSizer(0, 3, 0, 0);
    fgSizer1->SetFlexibleDirection( wxBOTH );
    fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
    fgSizer1->AddGrowableCol(1);
    
    bSizer3->Add(fgSizer1, 0, wxALL|wxEXPAND, 5);
    
    m_staticText2 = new wxStaticText(this, wxID_ANY, _("Select executable:"), wxDefaultPosition, wxSize(-1, -1), 0);
    
    fgSizer1->Add(m_staticText2, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    wxArrayString m_ExeFilepathArr;
    m_ExeFilepath = new wxComboBox(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, -1), m_ExeFilepathArr, 0);
    m_ExeFilepath->SetToolTip(_("Enter the filepath to the program that you want to debug.\nAlternatively, if you enter the path below, putting just the filename here will suffice."));
    m_ExeFilepath->SetFocus();
    #if wxVERSION_NUMBER >= 3000
    m_ExeFilepath->SetHint(wxT(""));
    #endif
    
    fgSizer1->Add(m_ExeFilepath, 0, wxALL|wxEXPAND, 5);
    
    m_buttonBrowseExe = new wxButton(this, wxID_ANY, _("..."), wxDefaultPosition, wxSize(-1, -1), wxBU_EXACTFIT);
    m_buttonBrowseExe->SetToolTip(_("Select executale to debug"));
    
    fgSizer1->Add(m_buttonBrowseExe, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    m_staticText5 = new wxStaticText(this, wxID_ANY, _("Working directory:"), wxDefaultPosition, wxSize(-1, -1), 0);
    
    fgSizer1->Add(m_staticText5, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    wxArrayString m_WDArr;
    m_WD = new wxComboBox(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, -1), m_WDArr, 0);
    m_WD->SetToolTip(_("Optionally, enter the path where the program that you want to debug can be found"));
    #if wxVERSION_NUMBER >= 3000
    m_WD->SetHint(wxT(""));
    #endif
    
    fgSizer1->Add(m_WD, 0, wxALL|wxEXPAND, 5);
    
    m_buttonBrowseWD = new wxButton(this, wxID_ANY, _("..."), wxDefaultPosition, wxSize(-1, -1), wxBU_EXACTFIT);
    m_buttonBrowseWD->SetToolTip(_("Browse for working directory"));
    
    fgSizer1->Add(m_buttonBrowseWD, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    m_staticText4 = new wxStaticText(this, wxID_ANY, _("Program arguments:"), wxDefaultPosition, wxSize(-1, -1), 0);
    
    fgSizer1->Add(m_staticText4, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    m_textCtrlArgs = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, -1), 0);
    #if wxVERSION_NUMBER >= 3000
    m_textCtrlArgs->SetHint(wxT(""));
    #endif
    
    fgSizer1->Add(m_textCtrlArgs, 0, wxALL|wxEXPAND, 5);
    
    fgSizer1->Add(0, 0, 1, wxALL, 5);
    
    m_staticText3 = new wxStaticText(this, wxID_ANY, _("Select debugger:"), wxDefaultPosition, wxSize(-1, -1), 0);
    
    fgSizer1->Add(m_staticText3, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    wxArrayString m_choiceDebuggersArr;
    m_choiceDebuggers = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxSize(-1, -1), m_choiceDebuggersArr, 0);
    
    fgSizer1->Add(m_choiceDebuggers, 0, wxALL|wxEXPAND, 5);
    
    fgSizer1->Add(0, 0, 1, wxALL, 5);
    
    m_staticText12 = new wxStaticText(this, wxID_ANY, _("Alternate debugger executable:"), wxDefaultPosition, wxSize(-1,-1), 0);
    
    fgSizer1->Add(m_staticText12, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
    
    m_textCtrlDebuggerExec = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1,-1), 0);
    m_textCtrlDebuggerExec->SetToolTip(_("Provide an alternate debugger executable to use.\nThis is currently only supported for GDB"));
    #if wxVERSION_NUMBER >= 3000
    m_textCtrlDebuggerExec->SetHint(wxT(""));
    #endif
    
    fgSizer1->Add(m_textCtrlDebuggerExec, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5);
    
    m_buttonBrowseDebugger = new wxButton(this, wxID_ANY, _("..."), wxDefaultPosition, wxSize(-1,-1), wxBU_EXACTFIT);
    m_buttonBrowseDebugger->SetToolTip(_("Select debugger executable"));
    
    fgSizer1->Add(m_buttonBrowseDebugger, 0, wxALIGN_CENTER_VERTICAL, 5);
    
    m_staticText6 = new wxStaticText(this, wxID_ANY, _("Startup commands:"), wxDefaultPosition, wxSize(-1, -1), 0);
    
    bSizer3->Add(m_staticText6, 0, wxALL, 5);
    
    m_textCtrlCmds = new wxTextCtrl(this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(-1, -1), wxTE_RICH2|wxTE_PROCESS_TAB|wxTE_MULTILINE);
    #ifdef __WXMSW__
    // To get the newer version of the font on MSW, we use font wxSYS_DEFAULT_GUI_FONT with family set to wxFONTFAMILY_TELETYPE
    wxFont m_textCtrlCmdsFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
    m_textCtrlCmdsFont.SetFamily(wxFONTFAMILY_TELETYPE);
    #else
    wxFont m_textCtrlCmdsFont = wxSystemSettings::GetFont(wxSYS_ANSI_FIXED_FONT);
    m_textCtrlCmdsFont.SetFamily(wxFONTFAMILY_TELETYPE);
    #endif
    m_textCtrlCmds->SetFont(m_textCtrlCmdsFont);
    
    bSizer3->Add(m_textCtrlCmds, 1, wxALL|wxEXPAND, 5);
    m_textCtrlCmds->SetMinSize(wxSize(-1,150));
    
    m_stdBtnSizer2 = new wxStdDialogButtonSizer();
    
    bSizer1->Add(m_stdBtnSizer2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 10);
    
    m_buttonOK = new wxButton(this, wxID_OK, wxT(""), wxDefaultPosition, wxSize(-1, -1), 0);
    m_buttonOK->SetDefault();
    m_stdBtnSizer2->AddButton(m_buttonOK);
    
    m_buttonCancel1 = new wxButton(this, wxID_CANCEL, wxT(""), wxDefaultPosition, wxSize(-1, -1), 0);
    m_stdBtnSizer2->AddButton(m_buttonCancel1);
    m_stdBtnSizer2->Realize();
    
    SetName(wxT("QuickDebugBase"));
    SetMinClientSize(wxSize(500,400));
    SetSize(-1,-1);
    if (GetSizer()) {
         GetSizer()->Fit(this);
    }
    if(GetParent()) {
        CentreOnParent(wxBOTH);
    } else {
        CentreOnScreen(wxBOTH);
    }
#if wxVERSION_NUMBER >= 2900
    if(!wxPersistenceManager::Get().Find(this)) {
        wxPersistenceManager::Get().RegisterAndRestore(this);
    } else {
        wxPersistenceManager::Get().Restore(this);
    }
#endif
    // Connect events
    m_buttonBrowseExe->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonBrowseExe), NULL, this);
    m_buttonBrowseWD->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonBrowseWD), NULL, this);
    m_buttonBrowseDebugger->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnSelectAlternateDebugger), NULL, this);
    m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonDebug), NULL, this);
    m_buttonCancel1->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonCancel), NULL, this);
    
}

QuickDebugBase::~QuickDebugBase()
{
    m_buttonBrowseExe->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonBrowseExe), NULL, this);
    m_buttonBrowseWD->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonBrowseWD), NULL, this);
    m_buttonBrowseDebugger->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnSelectAlternateDebugger), NULL, this);
    m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonDebug), NULL, this);
    m_buttonCancel1->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(QuickDebugBase::OnButtonCancel), NULL, this);
    
}
