void AdvancedCompilerOptionsDlg::OnRegexTest(wxCommandEvent& WXUNUSED(event)) { if (m_SelectedRegex == -1) return; wxString text = XRCCTRL(*this, "txtRegexTest", wxTextCtrl)->GetValue(); if (text.IsEmpty()) { cbMessageBox(_("Please enter a compiler line in the \"Compiler output\" text box..."), _("Error"), wxICON_ERROR); return; } Compiler* compiler = CompilerFactory::GetCompiler(m_CompilerId); // backup regexes RegExArray regex_copy = m_Regexes; SaveRegexDetails(m_SelectedRegex); // test-run compiler->SetRegExArray(m_Regexes); CompilerLineType clt = compiler->CheckForWarningsAndErrors(text); // restore regexes compiler->SetRegExArray(regex_copy); m_Regexes = regex_copy; wxString msg; msg.Printf(_("Regular expression analyzed as follows:\n\n" "Type: %s message\n" "Filename: %s\n" "Line number: %s\n" "Message: %s"), clt == cltNormal ? _("Normal") : (clt == cltInfo ? _("Info") : (clt == cltError ? _("Error") : _("Warning"))), #if wxCHECK_VERSION(2, 9, 0) compiler->GetLastErrorFilename().wx_str(), compiler->GetLastErrorLine().wx_str(), compiler->GetLastError().wx_str() #else compiler->GetLastErrorFilename().c_str(), compiler->GetLastErrorLine().c_str(), compiler->GetLastError().c_str() #endif ); cbMessageBox(msg, _("Test results"), wxICON_INFORMATION); }