wxString NewBuildTab::GetBuildContent() const { wxString output; for(int i=0; i<m_listctrl->GetItemCount(); ++i) { wxString curline = m_listctrl->GetTextValue(i, 0); StripBuildMarkders(curline); curline.Trim(); output << curline << wxT("\n"); } return output; }
void NewBuildTab::OnCopySelection(wxCommandEvent& e) { wxDataViewItemArray items; m_listctrl->GetSelections(items); if(items.IsEmpty()) return; wxString text; for(size_t i = 0; i < items.GetCount(); ++i) { wxString line; line << m_listctrl->GetTextValue(m_listctrl->GetStore()->GetRow(items.Item(i)), 0).Trim().Trim(false); StripBuildMarkders(line); text << line << "\n"; } text.Trim(); ::CopyToClipboard(text); }
void NewBuildTab::MarkEditor(LEditor* editor) { if ( !editor ) return; editor->DelAllCompilerMarkers(); editor->AnnotationClearAll(); editor->AnnotationSetVisible(2); // Visible with box around it BuildTabSettingsData options; EditorConfigST::Get()->ReadObject(wxT("build_tab_settings"), &options); // Are markers or annotations enabled? if( options.GetErrorWarningStyle() == BuildTabSettingsData::EWS_NoMarkers ) { return; } std::pair<MultimapBuildInfo_t::iterator, MultimapBuildInfo_t::iterator> iter = m_buildInfoPerFile.equal_range(editor->GetFileName().GetFullPath()); if ( iter.first == iter.second ) { // could not find any, try the fullname iter = m_buildInfoPerFile.equal_range(editor->GetFileName().GetFullName()); #if defined(__WXGTK__) if ( iter.first == iter.second ) { // Nope. Perhaps it's a symlink iter = m_buildInfoPerFile.equal_range(CLRealPath(editor->GetFileName().GetFullPath())); } #endif } editor->InitializeAnnotations(); // Merge all the errors from the same line into a single error AnnotationInfoByLineMap_t annotations; for(; iter.first != iter.second; ++iter.first) { BuildLineInfo *bli = iter.first->second; wxString text = m_listctrl->GetTextValue(bli->GetLineInBuildTab(), 0).Trim().Trim(false); // strip any build markers StripBuildMarkders(text); // remove the line part from the text text = text.Mid(bli->GetRegexLineMatch()); // if the line starts with ':' remove it as well text.StartsWith(":", &text); text.Trim().Trim(false); if ( !text.IsEmpty() ) { if( bli && (bli->GetSeverity() == SV_ERROR || bli->GetSeverity() == SV_WARNING) ) { if( annotations.count(bli->GetLineNumber()) ) { // we already have an error on this line, concatenate the message AnnotationInfo &info = annotations[bli->GetLineNumber()]; info.text << "\n" << text; if ( bli->GetSeverity() == SV_ERROR ) { // override the severity to ERROR info.severity = SV_ERROR; } } else { // insert new one AnnotationInfo info; info.line = bli->GetLineNumber(); info.severity = bli->GetSeverity(); info.text = text; annotations.insert( std::make_pair(bli->GetLineNumber(), info) ); } } } } AnnotationInfoByLineMap_t::iterator annIter = annotations.begin(); for(; annIter != annotations.end(); ++annIter) { if ( annIter->second.severity == SV_ERROR ) { editor->SetErrorMarker(annIter->first, annIter->second.text); } else { editor->SetWarningMarker(annIter->first, annIter->second.text); } } // now place the errors editor->Refresh(); }