28#include <wx/clipbrd.h>
32#include <wx/filedlg.h>
35#include <wx/textctrl.h>
41 const wxSize& size,
long style ) :
51 Connect( wxEVT_COMMAND_MENU_SELECTED,
76 GetSizer()->SetSizeHints(
this );
123 return a.severity < b.severity;
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 = wxS(
"<font color=#F04040 size=3>" ) +
_(
"Error:" ) + wxS(
" </font>" )
193 wxS(
"<font size=3>" ) + aLine.
message + wxS(
"</font><br>" );
196 retv = wxS(
"<font size=3>" ) +
_(
"Warning:" ) + wxS(
" " ) + aLine.
message
197 + wxS(
"</font><br>" );
200 retv = wxS(
"<font color=#909090 size=3>" ) + aLine.
message + wxS(
"</font><br>" );
203 retv = wxS(
"<font color=#60D060 size=3>" ) + aLine.
message + wxS(
"</font><br>" );
206 retv = wxS(
"<font size=3>" ) + aLine.
message + wxS(
"</font><br>" );
214 retv = wxS(
"<font color=#D00000 size=3>" ) +
_(
"Error:" ) + wxS(
" </font>" )
215 wxS(
"<font size=3>" ) + aLine.
message + wxS(
"</font><br>" );
218 retv = wxS(
"<font size=3>" ) +
_(
"Warning:" ) + wxS(
" " ) + aLine.
message
219 + wxS(
"</font><br>" );
222 retv = wxS(
"<font color=#808080 size=3>" ) + aLine.
message + wxS(
"</font><br>" );
225 retv = wxS(
"<font color=#008000 size=3>" ) + aLine.
message + wxS(
"</font><br>" );
228 retv = wxS(
"<font size=3>" ) + aLine.
message + wxS(
"</font><br>" );
234 retv.Replace( wxS(
" " ), wxS(
" " ) );
247 default:
return aLine.
message + wxT(
"\n" );
255 popup.Append( wxID_COPY,
"Copy" );
262 if( event.GetId() == wxID_COPY )
266 if( wxTheClipboard->Open() )
268 bool primarySelection = wxTheClipboard->IsUsingPrimarySelection();
269 wxTheClipboard->UsePrimarySelection(
false );
270 wxTheClipboard->SetData(
new wxTextDataObject(
m_htmlView->SelectionToText() ) );
271 wxTheClipboard->Flush();
272 wxTheClipboard->Close();
273 wxTheClipboard->UsePrimarySelection( primarySelection );
286 if( event.IsChecked() )
308 if( event.IsChecked() )
320 if( event.IsChecked() )
332 if( event.IsChecked() )
344 if( event.IsChecked() )
360 fn = wxT(
"report.txt" );
363 fn.SetPath( parent->Prj().GetProjectPath() );
370 wxWindow* topLevelParent = wxGetTopLevelParent(
this );
372 wxFileDialog dlg( topLevelParent,
_(
"Save Report File" ), fn.GetPath(), fn.GetFullName(),
375 if( dlg.ShowModal() != wxID_OK )
380 if( fn.GetExt().IsEmpty() )
383 wxFFile f( fn.GetFullPath(),
"wb" );
389 msg.Printf(
_(
"Cannot write report to file '%s'." ),
390 fn.GetFullPath().GetData() );
391 wxMessageBox( msg,
_(
"File save error" ), wxOK | wxICON_ERROR,
392 wxGetTopLevelParent(
this ) );
422 m_box->GetStaticBox()->SetLabel( aLabel );
428 if( aSeverities < 0 )
469 wxCHECK_MSG(
m_panel !=
nullptr, *
this,
470 wxT(
"No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
479 wxCHECK_MSG(
m_panel !=
nullptr, *
this,
480 wxT(
"No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
489 wxCHECK_MSG(
m_panel !=
nullptr, *
this,
490 wxT(
"No WX_HTML_REPORT_PANEL object defined in WX_HTML_PANEL_REPORTER." ) );
bool SetPage(const wxString &aSource) override
bool AppendToPage(const wxString &aSource)
A mix in class which holds the location of a wxWindow's KIWAY.
void UpdateNumber(int aNumber, SEVERITY aSeverity)
Update the number displayed on the badge.
A pure virtual class used to derive REPORTER objects from.
LOCATION
Location where the message is to be reported.
bool HasMessageOfSeverity(int aSeverityMask) const override
Returns true if the reporter has one or more messages matching the specified severity mask.
bool HasMessage() const override
Returns true if the reporter client is non-empty.
REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Places the report at the end of the list, for objects that support report ordering.
REPORTER & ReportHead(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Places the report at the beginning of the list for objects that support ordering.
REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED) override
Report a string with a given severity.
WX_HTML_REPORT_PANEL * m_panel
Class WX_HTML_REPORT_PANEL_BASE.
wxCheckBox * m_checkBoxShowAll
NUMBER_BADGE * m_warningsBadge
NUMBER_BADGE * m_errorsBadge
wxFlexGridSizer * m_fgSizer
wxCheckBox * m_checkBoxShowActions
wxCheckBox * m_checkBoxShowWarnings
wxCheckBox * m_checkBoxShowErrors
wxCheckBox * m_checkBoxShowInfos
wxString & GetFileName(void)
void Clear()
Clears the report panel.
void onCheckBoxShowErrors(wxCommandEvent &event) override
wxString m_reportFileName
defaults to the not very useful /bin/report.txt
void onThemeChanged(wxSysColourChangedEvent &aEvent)
void onCheckBoxShowActions(wxCommandEvent &event) override
REPORT_LINES m_report
copy of the report, stored for filtering
void onRightClick(wxMouseEvent &event) override
int m_severities
message severities to display (mask)
int Count(int severityMask)
Return the number of messages matching the given severity mask.
void SetLazyUpdate(bool aLazyUpdate)
Set the lazy update.
WX_HTML_PANEL_REPORTER m_reporter
void SetLabel(const wxString &aLabel) override
Set the frame label.
std::vector< REPORT_LINE > REPORT_LINES
int GetVisibleSeverities() const
void MsgPanelSetMinSize(const wxSize &aMinSize)
Set the min size of the area which displays html messages.
void SetFileName(const wxString &aReportFileName)
Set the report full file name to the string.
wxString generateHtml(const REPORT_LINE &aLine)
void Report(const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
Report the string.
void onCheckBoxShowAll(wxCommandEvent &event) override
void SetShowSeverity(SEVERITY aSeverity, bool aValue)
void SetVisibleSeverities(int aSeverities)
Set the visible severity filter.
void Flush(bool aSort=false)
Force updating the HTML page, after the report is built in lazy mode If aSort = true,...
void onCheckBoxShowWarnings(wxCommandEvent &event) override
void onMenuEvent(wxMenuEvent &event)
wxString generatePlainText(const REPORT_LINE &aLine)
void onBtnSaveToFile(wxCommandEvent &event) override
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
void onCheckBoxShowInfos(wxCommandEvent &event) override
REPORTER & Reporter()
Return the reporter object that reports to this panel.
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
WX_HTML_REPORT_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxTAB_TRAVERSAL)
static wxString TextFileWildcard()
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
bool ConvertSmartQuotesAndDashes(wxString *aString)
Convert curly quotes and em/en dashes to straight quotes and dashes.
Definition of file extensions used in Kicad.
static int RPT_SEVERITY_ALL