void FileExplorer::OnActiveEditorChanged(wxCommandEvent& e) { e.Skip(); if (m_isLinkedToEditor) { LEditor *editor = clMainFrame::Get()->GetMainBook()->GetActiveEditor(); if (editor && editor->GetFileName().FileExists()) { m_fileTree->ClearSelections(); CL_DEBUG1(" ===> [Explorer] Expand to path for " + editor->GetFileName().GetFullPath() ); m_fileTree->Tree()->ExpandPath(editor->GetFileName().GetFullPath()); CL_DEBUG1(" <=== [Explorer] Expand to path for " + editor->GetFileName().GetFullPath() ); } } }
bool CxxPreProcessor::ExpandInclude(const wxFileName& currentFile, const wxString& includeStatement, wxFileName& outFile) { wxString includeName = includeStatement; includeName.Replace("\"", ""); includeName.Replace("<", ""); includeName.Replace(">", ""); // Try the current file's directory first wxArrayString paths = m_includePaths; paths.Insert(currentFile.GetPath(), 0); if(m_noSuchFiles.count(includeStatement)) { // wxPrintf("No such file hit\n"); return false; } std::map<wxString, wxString>::iterator iter = m_fileMapping.find(includeStatement); if(iter != m_fileMapping.end()) { // if this file has a mapped file, it means that we either // already scanned it or could not find a match for it // wxPrintf("File already been scanned\n"); return false; } for(size_t i = 0; i < paths.GetCount(); ++i) { wxString tmpfile; tmpfile << paths.Item(i) << "/" << includeName; wxFileName fn(tmpfile); tmpfile = fn.GetFullPath(); // CL_DEBUG(" ... Checking include file: %s\n", fn.GetFullPath()); struct stat buff; if((stat(tmpfile.mb_str(wxConvUTF8).data(), &buff) == 0)) { CL_DEBUG1(" ==> Creating scanner for file: %s\n", tmpfile); wxFileName fixedFileName(tmpfile); if(fixedFileName.FileExists()) { fixedFileName.Normalize(wxPATH_NORM_DOTS); tmpfile = fixedFileName.GetFullPath(); m_fileMapping.insert(std::make_pair(includeStatement, tmpfile)); outFile = fixedFileName; return true; } else { CL_DEBUG("Including a folder :/ : %s", fixedFileName.GetFullPath()); } } } // remember that we could not locate this include statement m_noSuchFiles.insert(includeStatement); m_fileMapping.insert(std::make_pair(includeStatement, wxString())); return false; }
void MemCheckOutputView::LoadErrors() { CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::LoadErrors()")); if(m_mgr->IsWorkspaceOpen()) m_workspacePath = m_mgr->GetWorkspace()->GetWorkspaceFileName().GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); else m_workspacePath = wxEmptyString; // common part for both pages m_choiceSuppFile->Set(m_plugin->GetProcessor()->GetSuppressionFiles()); m_choiceSuppFile->SetSelection(0); // errors panel ResetItemsView(); ShowPageView(1); // after reload start at page 1 // supp panel ResetItemsSupp(); ApplyFilterSupp(FILTER_CLEAR); }
void MemCheckOutputView::ApplyFilterSupp(unsigned int mode) { // CL_DEBUG1(PLUGIN_PREFIX("MemCheckOutputView::ApplyFilterSupp()")); ErrorList& errorList = m_plugin->GetProcessor()->GetErrors(); // change filter type if(mode == FILTER_STRING && m_searchCtrlFilter->GetValue().IsSameAs(wxT(FILTER_NONWORKSPACE_PLACEHOLDER))) mode = FILTER_WORKSPACE; if(mode == FILTER_STRING && m_searchCtrlFilter->GetValue().IsEmpty()) mode = FILTER_CLEAR; size_t iterFlags = 0; if(m_plugin->GetSettings()->GetOmitSuppressed()) iterFlags |= MC_IT_OMIT_SUPPRESSED; m_filterResults.clear(); m_listCtrlErrors->SetItemCount(0); switch(mode) { case FILTER_CLEAR: m_searchCtrlFilter->Clear(); for(MemCheckIterTools::ErrorListIterator it = MemCheckIterTools::Factory(errorList, wxEmptyString, iterFlags); it != errorList.end(); ++it) m_filterResults.push_back(&*it); m_totalErrorsSupp = m_filterResults.size(); m_checkBoxInvert->SetValue(false); m_checkBoxCase->SetValue(false); m_checkBoxRegexp->SetValue(false); m_checkBoxWord->SetValue(false); break; case FILTER_WORKSPACE: CL_DEBUG1(PLUGIN_PREFIX("m_workspacePath %s", m_workspacePath)); m_searchCtrlFilter->SetValue(wxT(FILTER_NONWORKSPACE_PLACEHOLDER)); m_searchCtrlFilter->SelectAll(); for(MemCheckIterTools::ErrorListIterator it = MemCheckIterTools::Factory(errorList, wxEmptyString, iterFlags); it != errorList.end(); ++it) { if(m_checkBoxInvert->IsChecked() == (*it).hasPath(m_workspacePath)) m_filterResults.push_back(&*it); } break; case FILTER_STRING: size_t flags = 0; if(m_checkBoxCase->IsChecked()) flags |= wxSD_MATCHCASE; if(m_checkBoxRegexp->IsChecked()) flags |= wxSD_REGULAREXPRESSION; if(m_checkBoxWord->IsChecked()) flags |= wxSD_MATCHWHOLEWORD; int offset = 0; int pos = 0, len = 0; if(m_totalErrorsSupp > ITEMS_FOR_WAIT_DIALOG) { wxWindowDisabler disableAll; wxBusyInfo wait(wxT(BUSY_MESSAGE)); m_mgr->GetTheApp()->Yield(); } size_t i = 0; for(MemCheckIterTools::ErrorListIterator it = MemCheckIterTools::Factory(errorList, wxEmptyString, iterFlags); it != errorList.end(); ++it) { if(m_checkBoxInvert->IsChecked() != StringFindReplacer::Search((*it).toString().wc_str(), offset, m_searchCtrlFilter->GetValue().wc_str(), flags, pos, len)) m_filterResults.push_back(&*it); if(m_totalErrorsSupp > ITEMS_FOR_WAIT_DIALOG) { ++i; if(!(i % WAIT_UPDATE_PER_ITEMS)) m_mgr->GetTheApp()->Yield(); } } break; } m_listCtrlErrors->SetItemCount(m_filterResults.size()); UpdateStatusSupp(); itemsInvalidSupp = false; // If tooltip is shown, LEAVE event isnt raised. This should help in most cases, because if filter is reset, this // means mouse leaved list. // m_lastToolTipItem = wxNOT_FOUND; }