28 #include <wx/clipbrd.h> 45 Connect( wxEVT_COMMAND_MENU_SELECTED,
58 GetSizer()->SetSizeHints(
this );
125 int x, y, xUnit, yUnit;
128 m_htmlView->GetScrollPixelsPerUnit( &xUnit, &yUnit );
147 wxColour bgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW );
148 wxColour fgcolor = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
150 return wxString::Format( wxT(
"<html><body bgcolor='%s' text='%s'>%s</body></html>" ),
151 bgcolor.GetAsString( wxC2S_HTML_SYNTAX ),
152 fgcolor.GetAsString( wxC2S_HTML_SYNTAX ),
163 for(
const REPORT_LINE& reportLine : reportLineArray )
165 if( severityMask & reportLine.severity )
184 retv =
"<font color=\"red\" size=3>" +
_(
"Error:" ) +
" </font>" 185 "<font size=3>" + aLine.
message +
"</font><br>";
188 retv =
"<font size=3>" +
_(
"Warning:" ) + wxS(
" " ) + aLine.
message +
"</font><br>";
191 retv =
"<font color=\"dark gray\" size=3>" + aLine.
message +
"</font><br>";
194 retv =
"<font color=\"dark green\" size=3>" + aLine.
message +
"</font><br>";
197 retv =
"<font size=3>" + aLine.
message +
"</font><br>";
209 return _(
"Error:" ) + wxS(
" " )+ aLine.
message + wxT(
"\n" );
211 return _(
"Warning:" ) + wxS(
" " )+ aLine.
message + wxT(
"\n" );
213 return _(
"Info:" ) + wxS(
" " )+ aLine.
message + wxT(
"\n" );
215 return aLine.
message + wxT(
"\n" );
223 popup.Append( wxID_COPY,
"Copy" );
230 if( event.GetId() == wxID_COPY )
234 if( wxTheClipboard->Open() )
236 bool primarySelection = wxTheClipboard->IsUsingPrimarySelection();
237 wxTheClipboard->UsePrimarySelection(
false );
238 wxTheClipboard->SetData(
new wxTextDataObject(
m_htmlView->SelectionToText() ) );
239 wxTheClipboard->Close();
240 wxTheClipboard->UsePrimarySelection( primarySelection );
252 if( event.IsChecked() )
274 if( event.IsChecked() )
286 if( event.IsChecked() )
298 if( event.IsChecked() )
310 if( event.IsChecked() )
325 fn = wxT(
"./report.txt" );
329 wxFileDialog dlg(
this,
_(
"Save Report to File" ), fn.GetPath(), fn.GetFullName(),
332 if( dlg.ShowModal() != wxID_OK )
337 if( fn.GetExt().IsEmpty() )
340 wxFFile f( fn.GetFullPath(),
"wb" );
346 msg.Printf(
_(
"Cannot write report to file \"%s\"." ),
347 fn.GetFullPath().GetData() );
348 wxMessageBox( msg,
_(
"File save error" ), wxOK | wxICON_ERROR,
this );
378 m_box->GetStaticBox()->SetLabel( aLabel );
384 if( aSeverities < 0 )
void SetVisibleSeverities(int aSeverities)
void onCheckBoxShowInfos(wxCommandEvent &event) override
void onBtnSaveToFile(wxCommandEvent &event) override
wxString addHeader(const wxString &aBody)
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.
wxCheckBox * m_checkBoxShowErrors
void onCheckBoxShowWarnings(wxCommandEvent &event) override
void onCheckBoxShowErrors(wxCommandEvent &event) override
A pure virtual class used to derive REPORTER objects from.
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
wxHtmlWindow * m_htmlView
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.
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 Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
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 lasy update.
void onMenuEvent(wxMenuEvent &event)
bool ConvertSmartQuotesAndDashes(wxString *aString)
Converts curly quotes and em/en dashes to straight quotes and dashes.
int m_severities
message severities to display (mask)
static int RPT_SEVERITY_ALL