BuildTabSetting::BuildTabSetting( wxWindow* parent ) : BuildTabSettingsBase( parent ) { BuildTabSettingsData options; EditorConfigST::Get()->ReadObject(wxT("build_tab_settings"), &options); m_checkBoxSkipeWarnings->SetValue( options.GetSkipWarnings() ); m_colourPickerError->SetColour(options.GetErrorColourBg()); m_colourPickerWarnings->SetColour(options.GetWarnColourBg()); m_colourPickerErrorFg->SetColour(options.GetErrorColour()); m_colourPickerWarningsFg->SetColour(options.GetWarnColour()); m_checkBoxBoldErrFont->SetValue(options.GetBoldErrFont()); m_checkBoxBoldWarnFont->SetValue(options.GetBoldWarnFont()); m_radioBoxShowBuildTab->Select(options.GetShowBuildPane()); m_checkBoxAutoHide->SetValue(options.GetAutoHide()); m_checkBoxDisplayAnnotations->SetValue(options.GetErrorWarningStyle() & BuildTabSettingsData::EWS_Annotations); m_checkBoxDisplayMarkers->SetValue(options.GetErrorWarningStyle() & BuildTabSettingsData::EWS_Bookmarks); }
void BuildTabSetting::Save() { BuildTabSettingsData options; options.SetErrorColourBg(m_colourPickerError->GetColour().GetAsString(wxC2S_HTML_SYNTAX)); options.SetWarnColourBg(m_colourPickerWarnings->GetColour().GetAsString(wxC2S_HTML_SYNTAX)); options.SetErrorColour(m_colourPickerErrorFg->GetColour().GetAsString(wxC2S_HTML_SYNTAX)); options.SetWarnColour(m_colourPickerWarningsFg->GetColour().GetAsString(wxC2S_HTML_SYNTAX)); options.SetSkipWarnings(m_checkBoxSkipeWarnings->IsChecked()); options.SetBoldErrFont(m_checkBoxBoldErrFont->IsChecked()); options.SetBoldWarnFont(m_checkBoxBoldWarnFont->IsChecked()); options.SetShowBuildPane(m_radioBoxShowBuildTab->GetSelection()); options.SetAutoHide(m_checkBoxAutoHide->IsChecked()); int flag (BuildTabSettingsData::EWS_NoMarkers); if ( m_checkBoxDisplayAnnotations->IsChecked() ) { flag |= BuildTabSettingsData::EWS_Annotations; } if ( m_checkBoxDisplayMarkers->IsChecked() ) { flag |= BuildTabSettingsData::EWS_Bookmarks; } options.SetErrorWarningStyle( flag ); EditorConfigST::Get()->WriteObject(wxT("build_tab_settings"), &options); }
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(); }