28 #include <wx/clipbrd.h> 32 #include <wx/filedlg.h> 33 #include <wx/msgdlg.h> 35 #include <wx/textctrl.h> 41 const wxSize& size,
long style ) :
51 Connect( wxEVT_COMMAND_MENU_SELECTED,
76 GetSizer()->SetSizeHints(
this );
143 int x, y, xUnit, yUnit;
146 m_htmlView->GetScrollPixelsPerUnit( &xUnit, &yUnit );
169 for(
const REPORT_LINE& reportLine : reportLineArray )
171 if( severityMask & reportLine.severity )
192 retv = wxT(
"<font color=#F04040 size=3>" ) +
_(
"Error:" ) +
" </font>" 193 wxT(
"<font size=3>" ) + aLine.
message + wxT(
"</font><br>" );
196 retv = wxT(
"<font size=3>" ) +
_(
"Warning:" ) + wxS(
" " ) + aLine.
message +
"</font><br>";
199 retv = wxT(
"<font color=#909090 size=3>" ) + aLine.
message + wxT(
"</font><br>" );
202 retv = wxT(
"<font color=#60D060 size=3>" ) + aLine.
message + wxT(
"</font><br>" );
205 retv = wxT(
"<font size=3>" ) + aLine.
message + wxT(
"</font><br>" );
213 retv = wxT(
"<font color=#D00000 size=3>" ) +
_(
"Error:" ) +
" </font>" 214 wxT(
"<font size=3>" ) + aLine.
message + wxT(
"</font><br>" );
217 retv = wxT(
"<font size=3>" ) +
_(
"Warning:" ) + wxS(
" " ) + aLine.
message +
"</font><br>";
220 retv = wxT(
"<font color=#808080 size=3>" ) + aLine.
message + wxT(
"</font><br>" );
223 retv = wxT(
"<font color=#008000 size=3>" ) + aLine.
message + wxT(
"</font><br>" );
226 retv = wxT(
"<font size=3>" ) + aLine.
message + wxT(
"</font><br>" );
232 retv.Replace( wxT(
" " ), wxT(
" " ) );
245 default:
return aLine.
message + wxT(
"\n" );
253 popup.Append( wxID_COPY, wxT(
"Copy" ) );
260 if( event.GetId() == wxID_COPY )
264 if( wxTheClipboard->Open() )
266 bool primarySelection = wxTheClipboard->IsUsingPrimarySelection();
267 wxTheClipboard->UsePrimarySelection(
false );
268 wxTheClipboard->SetData(
new wxTextDataObject(
m_htmlView->SelectionToText() ) );
269 wxTheClipboard->Flush();
270 wxTheClipboard->Close();
271 wxTheClipboard->UsePrimarySelection( primarySelection );
284 if( event.IsChecked() )
306 if( event.IsChecked() )
318 if( event.IsChecked() )
330 if( event.IsChecked() )
342 if( event.IsChecked() )
358 fn = wxT(
"report.txt" );
360 KIWAY_HOLDER* parent = dynamic_cast<KIWAY_HOLDER*>( m_parent );
368 wxFileDialog dlg(
this,
_(
"Save Report to File" ), fn.GetPath(), fn.GetFullName(),
371 if( dlg.ShowModal() != wxID_OK )
376 if( fn.GetExt().IsEmpty() )
379 wxFFile f( fn.GetFullPath(), wxT(
"wb" ) );
385 msg.Printf(
_(
"Cannot write report to file '%s'." ),
386 fn.GetFullPath().GetData() );
387 wxMessageBox( msg,
_(
"File save error" ), wxOK | wxICON_ERROR,
this );
417 m_box->GetStaticBox()->SetLabel( aLabel );
423 if( aSeverities < 0 )
void SetVisibleSeverities(int aSeverities)
void onCheckBoxShowInfos(wxCommandEvent &event) override
void onBtnSaveToFile(wxCommandEvent &event) override
A mix in class which holds the location of a wxWindow's KIWAY.
void SetLazyUpdate(bool aLazyUpdate)
Forces updating the HTML page, after the report is built in lazy mode If aSort = true,...
~WX_HTML_REPORT_PANEL()
Set the min size of the area which displays html messages:
void onCheckBoxShowActions(wxCommandEvent &event) override
wxString generatePlainText(const REPORT_LINE &aLine)
Class WX_HTML_REPORT_PANEL_BASE.
wxString & GetFileName(void)
void UpdateNumber(int aNumber, SEVERITY aSeverity)
Update the number displayed on the badge.
void Flush(bool aSort=false)
Set the visible severity filter.
wxFont GetInfoFont(wxWindow *aWindow)
wxCheckBox * m_checkBoxShowErrors
void onCheckBoxShowWarnings(wxCommandEvent &event) override
void onCheckBoxShowErrors(wxCommandEvent &event) override
A pure virtual class used to derive REPORTER objects from.
virtual const wxString GetProjectPath() const
Return the full path of the project.
void onRightClick(wxMouseEvent &event) override
wxCheckBox * m_checkBoxShowActions
WX_HTML_REPORT_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxTAB_TRAVERSAL)
wxCheckBox * m_checkBoxShowInfos
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
bool AppendToPage(const wxString &aSource)
WX_HTML_PANEL_REPORTER m_reporter
NUMBER_BADGE * m_warningsBadge
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
int Count(int severityMask)
sets the frame label
Definition of file extensions used in Kicad.
bool SetPage(const wxString &aSource) override
bool ConvertSmartQuotesAndDashes(wxString *aString)
Convert curly quotes and em/en dashes to straight quotes and dashes.
wxString m_reportFileName
defaults to the not very useful /bin/report.txt
void SetShowSeverity(SEVERITY aSeverity, bool aValue)
Set the report full file name to the string.
REPORT_LINES m_report
copy of the report, stored for filtering
int GetVisibleSeverities() const
void Report(const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
Reports the string.
wxCheckBox * m_checkBoxShowAll
LOCATION
Location where the message is to be reported.
void onThemeChanged(wxSysColourChangedEvent &aEvent)
void Clear()
return the number of messages matching the given severity mask.
std::vector< REPORT_LINE > REPORT_LINES
void onCheckBoxShowAll(wxCommandEvent &event) override
wxString TextFileWildcard()
wxFlexGridSizer * m_fgSizer
wxCheckBox * m_checkBoxShowWarnings
wxString generateHtml(const REPORT_LINE &aLine)
void MsgPanelSetMinSize(const wxSize &aMinSize)
returns the reporter object that reports to this panel
void SetFileName(const wxString &aReportFileName)
NUMBER_BADGE * m_errorsBadge
void SetLabel(const wxString &aLabel) override
Sets the lazy update.
void onMenuEvent(wxMenuEvent &event)
int m_severities
message severities to display (mask)
static int RPT_SEVERITY_ALL