コード例 #1
0
void AdvancedCompilerOptionsDlg::OnRegexAdd(wxCommandEvent& WXUNUSED(event))
{
    SaveRegexDetails(m_SelectedRegex);
    m_Regexes.Add(RegExStruct(_("New regular expression"), cltError, _T(""), 0));
    m_SelectedRegex = m_Regexes.Count() - 1;
    FillRegexes();
}
コード例 #2
0
void AdvancedCompilerOptionsDlg::OnRegexChange(wxCommandEvent& WXUNUSED(event))
{
    SaveRegexDetails(m_SelectedRegex);

    // update regex list, in case desc was changed
    XRCCTRL(*this, "lstRegex", wxListBox)->SetString(m_SelectedRegex, XRCCTRL(*this, "txtRegexDesc", wxTextCtrl)->GetValue());

    m_SelectedRegex = XRCCTRL(*this, "lstRegex", wxListBox)->GetSelection();
    FillRegexDetails(m_SelectedRegex);
}
コード例 #3
0
void AdvancedCompilerOptionsDlg::OnRegexDown(wxSpinEvent& WXUNUSED(event))
{
    if (m_SelectedRegex >= (int)m_Regexes.Count() - 1)
        return;

    SaveRegexDetails(m_SelectedRegex);
    RegExStruct rs = m_Regexes[m_SelectedRegex];
    m_Regexes.RemoveAt(m_SelectedRegex);
    m_Regexes.Insert(rs, m_SelectedRegex + 1);
    ++m_SelectedRegex;
    FillRegexes();
}
コード例 #4
0
void AdvancedCompilerOptionsDlg::OnRegexUp(wxSpinEvent& WXUNUSED(event))
{
    if (m_SelectedRegex <= 0)
        return;

    SaveRegexDetails(m_SelectedRegex);
    RegExStruct rs = m_Regexes[m_SelectedRegex];
    m_Regexes.RemoveAt(m_SelectedRegex);
    m_Regexes.Insert(rs, m_SelectedRegex - 1);
    --m_SelectedRegex;
    FillRegexes();
}
コード例 #5
0
void AdvancedCompilerOptionsDlg::EndModal(int retCode)
{
    if (retCode == wxID_OK)
    {
    	m_bDirty = true;
        Compiler* compiler = CompilerFactory::GetCompiler(m_CompilerId);

        // make sure we update the first command, if it changed
        CheckForChanges();
        // write options
        WriteCompilerOptions();
        // save regexes
        SaveRegexDetails(m_SelectedRegex);
        compiler->SetRegExArray(m_Regexes);
    }
    wxScrollingDialog::EndModal(retCode);
} // end of EndModal
コード例 #6
0
void AdvancedCompilerOptionsDlg::OnRegexChange(wxCommandEvent& WXUNUSED(event))
{
    // If we just have deleted the actual item or cleared the list, we should leave,
    // otherwise m_Regexes will be broken, because the regex details of an invalid
    // item will be saved
    wxListBox* list = XRCCTRL(*this, "lstRegex", wxListBox);
    if (list->GetSelection() == wxNOT_FOUND)
        return;

    SaveRegexDetails(m_SelectedRegex);

    // update regex list, in case desc was changed
    XRCCTRL(*this, "lstRegex", wxListBox)->SetString(m_SelectedRegex, XRCCTRL(*this, "txtRegexDesc", wxTextCtrl)->GetValue());

    m_SelectedRegex = XRCCTRL(*this, "lstRegex", wxListBox)->GetSelection();
    FillRegexDetails(m_SelectedRegex);
}
コード例 #7
0
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);
}