void AdvancedCompilerOptionsDlg::OnExtChange(wxCommandEvent& WXUNUSED(event))
{
	CheckForChanges();
	int cmd = XRCCTRL(*this, "lstCommands", wxChoice)->GetSelection();
	int ext = XRCCTRL(*this, "lstExt", wxChoice)->GetSelection();
    DisplayCommand(cmd, ext);
}
void AdvancedCompilerOptionsDlg::OnCommandsChange(wxCommandEvent& WXUNUSED(event))
{
	CheckForChanges();
	int cmd = XRCCTRL(*this, "lstCommands", wxChoice)->GetSelection();
	ReadExtensions(cmd); // can change the extension cmb list !!!!!!!!!!!!!!!
	int ext = XRCCTRL(*this, "lstExt", wxChoice)->GetSelection();
    DisplayCommand(cmd, ext);
} // end of OnCommandsChange
void AdvancedCompilerOptionsDlg::ReadCompilerOptions()
{
    Compiler* compiler = CompilerFactory::GetCompiler(m_CompilerId);
    if (!compiler)
        return;

    wxChoice* lst = XRCCTRL(*this, "lstCommands", wxChoice);
    lst->Clear();
    for (int i = 0; i < ctCount; ++i)
    {
        m_Commands[i] = compiler->GetCommandToolsVector((CommandType)i);
        lst->Append(Compiler::CommandTypeDescriptions[i]);
    }
    lst->SetSelection(0);
    DisplayCommand(0,0);
    ReadExtensions(0);

    // switches
    const CompilerSwitches& switches = compiler->GetSwitches();
    XRCCTRL(*this, "txtAddIncludePath",       wxTextCtrl)->SetValue(switches.includeDirs);
    XRCCTRL(*this, "txtAddLibPath",           wxTextCtrl)->SetValue(switches.libDirs);
    XRCCTRL(*this, "txtAddLib",               wxTextCtrl)->SetValue(switches.linkLibs);
    XRCCTRL(*this, "txtLibPrefix",            wxTextCtrl)->SetValue(switches.libPrefix);
    XRCCTRL(*this, "txtLibExt",               wxTextCtrl)->SetValue(switches.libExtension);
    XRCCTRL(*this, "txtDefine",               wxTextCtrl)->SetValue(switches.defines);
    XRCCTRL(*this, "txtGenericSwitch",        wxTextCtrl)->SetValue(switches.genericSwitch);
    XRCCTRL(*this, "txtObjectExt",            wxTextCtrl)->SetValue(switches.objectExtension);
    XRCCTRL(*this, "chkFwdSlashes",           wxCheckBox)->SetValue(switches.forceFwdSlashes);
    XRCCTRL(*this, "chkLinkerNeedsLibPrefix", wxCheckBox)->SetValue(switches.linkerNeedsLibPrefix);
    XRCCTRL(*this, "chkLinkerNeedsLibExt",    wxCheckBox)->SetValue(switches.linkerNeedsLibExtension);
    XRCCTRL(*this, "chkLinkerNeedsPathRes",   wxCheckBox)->SetValue(switches.linkerNeedsPathResolved);
    XRCCTRL(*this, "chkNeedDeps",             wxCheckBox)->SetValue(switches.needDependencies);
    XRCCTRL(*this, "chkForceCompilerQuotes",  wxCheckBox)->SetValue(switches.forceCompilerUseQuotes);
    XRCCTRL(*this, "chkForceLinkerQuotes",    wxCheckBox)->SetValue(switches.forceLinkerUseQuotes);
    XRCCTRL(*this, "chkSupportsPCH",          wxCheckBox)->SetValue(switches.supportsPCH);
    XRCCTRL(*this, "txtPCHExt",               wxTextCtrl)->SetValue(switches.PCHExtension);
    XRCCTRL(*this, "chkUseFlatObjects",       wxCheckBox)->SetValue(switches.UseFlatObjects);
    XRCCTRL(*this, "chkUseFullSourcePaths",   wxCheckBox)->SetValue(switches.UseFullSourcePaths);
    XRCCTRL(*this, "txtIncludeDirSeparator",  wxTextCtrl)->SetValue(switches.includeDirSeparator);
    XRCCTRL(*this, "txtLibDirSeparator",      wxTextCtrl)->SetValue(switches.libDirSeparator);
    XRCCTRL(*this, "txtObjectSeparator",      wxTextCtrl)->SetValue(switches.objectSeparator);
    XRCCTRL(*this, "spnStatusSuccess",        wxSpinCtrl)->SetValue(switches.statusSuccess);
    XRCCTRL(*this, "chkUse83Paths",           wxCheckBox)->SetValue(switches.Use83Paths);

    m_Regexes = compiler->GetRegExArray();
    m_SelectedRegex = m_Regexes.Count() > 0 ? 0 : -1;
    FillRegexes();
}
void AdvancedCompilerOptionsDlg::OnAddExt(wxCommandEvent& WXUNUSED(event))
{
	wxString ext = wxGetTextFromUser(_("Please enter a semi-colon separated list of extensions, without the leading dot:"), _("New extension"));
	ext.Trim(false);
	ext.Trim(true);
	if (!ext.IsEmpty())
	{
		int nr = XRCCTRL(*this, "lstCommands", wxChoice)->GetSelection();
		CompilerTool* ptool = GetCompilerTool(nr,0);
		CompilerTool tool(ptool ? ptool->command : wxString(), ext);
		m_Commands[nr].push_back(tool);
		ReadExtensions(nr);
		wxChoice* cmb = XRCCTRL(*this, "lstExt", wxChoice);
		cmb->SetStringSelection(ext);
		DisplayCommand(nr,cmb->GetSelection());
	}
}
void AdvancedCompilerOptionsDlg::OnDelExt(wxCommandEvent& WXUNUSED(event))
{
	if (cbMessageBox(_("Are you sure you want to remove this extension set from the list?"), _T("Confirmation"), wxYES_NO) == wxID_YES)
	{
		int nr = XRCCTRL(*this, "lstCommands", wxChoice)->GetSelection();
		wxChoice* cmb = XRCCTRL(*this, "lstExt", wxChoice);
		wxString extS = cmb->GetStringSelection();
		if (!extS.IsEmpty())
		{
			int ext = cmb->GetSelection();
			m_Commands[nr].erase(m_Commands[nr].begin() + ext);
			ReadExtensions(nr);
			cmb->SetSelection(0);
			m_LastExtIndex = -1;
			DisplayCommand(nr,0);
		}
		else
			cbMessageBox(_("Can't remove default commands!"), _("Error"));
	}
}