KiCad PCB EDA Suite
WX_HTML_REPORT_PANEL Class Reference

A widget for browsing a rich text error/status report. More...

#include <wx_html_report_panel.h>

Inheritance diagram for WX_HTML_REPORT_PANEL:
WX_HTML_REPORT_PANEL_BASE

Classes

struct  REPORT_LINE
 

Public Member Functions

 WX_HTML_REPORT_PANEL (wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxTAB_TRAVERSAL)
 
 ~WX_HTML_REPORT_PANEL ()
 Set the min size of the area which displays html messages: More...
 
void MsgPanelSetMinSize (const wxSize &aMinSize)
 returns the reporter object that reports to this panel More...
 
REPORTERReporter ()
 
void Report (const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
 Reports the string. More...
 
void Clear ()
 return the number of messages matching the given severity mask. More...
 
int Count (int severityMask)
 sets the frame label More...
 
void SetLabel (const wxString &aLabel) override
 Sets the lazy update. More...
 
void SetLazyUpdate (bool aLazyUpdate)
 Forces updating the HTML page, after the report is built in lazy mode If aSort = true, the body messages will be ordered by severity. More...
 
void Flush (bool aSort=false)
 Set the visible severity filter. More...
 
void SetVisibleSeverities (int aSeverities)
 
int GetVisibleSeverities () const
 
void SetShowSeverity (SEVERITY aSeverity, bool aValue)
 Set the report full file name to the string. More...
 
void SetFileName (const wxString &aReportFileName)
 
wxString & GetFileName (void)
 

Protected Attributes

wxStaticBoxSizer * m_box
 
wxFlexGridSizer * m_fgSizer
 
HTML_WINDOWm_htmlView
 
wxStaticText * m_staticTextShow
 
wxCheckBox * m_checkBoxShowAll
 
wxCheckBox * m_checkBoxShowErrors
 
NUMBER_BADGEm_errorsBadge
 
wxCheckBox * m_checkBoxShowWarnings
 
NUMBER_BADGEm_warningsBadge
 
wxCheckBox * m_checkBoxShowActions
 
wxCheckBox * m_checkBoxShowInfos
 
wxButton * m_btnSaveReportToFile
 

Private Types

typedef std::vector< REPORT_LINEREPORT_LINES
 

Private Member Functions

wxString addHeader (const wxString &aBody)
 
wxString generateHtml (const REPORT_LINE &aLine)
 
wxString generatePlainText (const REPORT_LINE &aLine)
 
void updateBadges ()
 
void scrollToBottom ()
 
void syncCheckboxes ()
 
void onRightClick (wxMouseEvent &event) override
 
void onMenuEvent (wxMenuEvent &event)
 
void onCheckBoxShowAll (wxCommandEvent &event) override
 
void onCheckBoxShowWarnings (wxCommandEvent &event) override
 
void onCheckBoxShowErrors (wxCommandEvent &event) override
 
void onCheckBoxShowInfos (wxCommandEvent &event) override
 
void onCheckBoxShowActions (wxCommandEvent &event) override
 
void onBtnSaveToFile (wxCommandEvent &event) override
 
void onThemeChanged (wxSysColourChangedEvent &aEvent)
 

Private Attributes

WX_HTML_PANEL_REPORTER m_reporter
 
REPORT_LINES m_report
 copy of the report, stored for filtering More...
 
REPORT_LINES m_reportTail
 Lines to print at the end, regardless of sorting. More...
 
REPORT_LINES m_reportHead
 ... and at the beginning, regardless of sorting More...
 
int m_severities
 message severities to display (mask) More...
 
bool m_lazyUpdate
 
wxString m_reportFileName
 defaults to the not very useful /bin/report.txt More...
 

Detailed Description

A widget for browsing a rich text error/status report.

Used in numerous dialogs in eeschema and pcbnew. Provides error filtering functionality and saving report files.

The messages are reported through a REPORTER object

Definition at line 37 of file wx_html_report_panel.h.

Member Typedef Documentation

◆ REPORT_LINES

typedef std::vector<REPORT_LINE> WX_HTML_REPORT_PANEL::REPORT_LINES
private

Definition at line 104 of file wx_html_report_panel.h.

Constructor & Destructor Documentation

◆ WX_HTML_REPORT_PANEL()

WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL ( wxWindow *  parent,
wxWindowID  id = wxID_ANY,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxSize( 500,300 ),
long  style = wxTAB_TRAVERSAL 
)

Definition at line 40 of file wx_html_report_panel.cpp.

41  :
42  WX_HTML_REPORT_PANEL_BASE( parent, id, pos, size, style ),
43  m_reporter( this ),
44  m_severities( -1 ),
45  m_lazyUpdate( false )
46 {
49  Flush();
50 
51  Connect( wxEVT_COMMAND_MENU_SELECTED,
52  wxMenuEventHandler( WX_HTML_REPORT_PANEL::onMenuEvent ), nullptr, this );
53 
54  m_htmlView->Bind( wxEVT_SYS_COLOUR_CHANGED,
55  wxSysColourChangedEventHandler( WX_HTML_REPORT_PANEL::onThemeChanged ),
56  this );
57 }
void Flush(bool aSort=false)
Set the visible severity filter.
wxFont GetInfoFont(wxWindow *aWindow)
Definition: ui_common.cpp:144
WX_HTML_PANEL_REPORTER m_reporter
void onThemeChanged(wxSysColourChangedEvent &aEvent)
void onMenuEvent(wxMenuEvent &event)
WX_HTML_REPORT_PANEL_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
int m_severities
message severities to display (mask)

References Flush(), KIUI::GetInfoFont(), WX_HTML_REPORT_PANEL_BASE::m_htmlView, onMenuEvent(), onThemeChanged(), and syncCheckboxes().

◆ ~WX_HTML_REPORT_PANEL()

WX_HTML_REPORT_PANEL::~WX_HTML_REPORT_PANEL ( )

Set the min size of the area which displays html messages:

Definition at line 60 of file wx_html_report_panel.cpp.

61 {
62 }

Member Function Documentation

◆ addHeader()

wxString WX_HTML_REPORT_PANEL::addHeader ( const wxString &  aBody)
private

◆ Clear()

void WX_HTML_REPORT_PANEL::Clear ( )

return the number of messages matching the given severity mask.

Definition at line 407 of file wx_html_report_panel.cpp.

408 {
409  m_report.clear();
410  m_reportHead.clear();
411  m_reportTail.clear();
412 }
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
REPORT_LINES m_report
copy of the report, stored for filtering

References m_report, m_reportHead, and m_reportTail.

Referenced by DIALOG_NETLIST_IMPORT::loadNetlist(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_NETLIST_IMPORT::onFilenameChanged(), DIALOG_CHANGE_SYMBOLS::onOkButtonClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), DIALOG_UPDATE_PCB::PerformUpdate(), and DIALOG_UPDATE_FROM_PCB::updateData().

◆ Count()

int WX_HTML_REPORT_PANEL::Count ( int  severityMask)

sets the frame label

Definition at line 163 of file wx_html_report_panel.cpp.

164 {
165  int count = 0;
166 
167  for( const auto& reportLineArray : { m_report, m_reportHead, m_reportTail } )
168  {
169  for( const REPORT_LINE& reportLine : reportLineArray )
170  {
171  if( severityMask & reportLine.severity )
172  count++;
173  }
174  }
175 
176  return count;
177 }
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
REPORT_LINES m_report
copy of the report, stored for filtering

References m_report, m_reportHead, and m_reportTail.

Referenced by WX_HTML_PANEL_REPORTER::HasMessage(), and updateBadges().

◆ Flush()

void WX_HTML_REPORT_PANEL::Flush ( bool  aSort = false)

Set the visible severity filter.

if aSeverities < 0 the m_showAll option is set

Definition at line 114 of file wx_html_report_panel.cpp.

115 {
116  wxString html;
117 
118  if( aSort )
119  {
120  std::sort( m_report.begin(), m_report.end(),
121  []( const REPORT_LINE& a, const REPORT_LINE& b)
122  {
123  return a.severity < b.severity;
124  });
125  }
126 
127  for( const auto& line : m_reportHead )
128  html += generateHtml( line );
129 
130  for( const auto& line : m_report )
131  html += generateHtml( line );
132 
133  for( const auto& line : m_reportTail )
134  html += generateHtml( line );
135 
136  m_htmlView->SetPage( html );
137  scrollToBottom();
138 }
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
bool SetPage(const wxString &aSource) override
Definition: html_window.cpp:38
REPORT_LINES m_report
copy of the report, stored for filtering
wxString generateHtml(const REPORT_LINE &aLine)

References generateHtml(), WX_HTML_REPORT_PANEL_BASE::m_htmlView, m_report, m_reportHead, m_reportTail, scrollToBottom(), HTML_WINDOW::SetPage(), and WX_HTML_REPORT_PANEL::REPORT_LINE::severity.

Referenced by DIALOG_NETLIST_IMPORT::loadNetlist(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_BOARD_REANNOTATE::OnApplyClick(), onCheckBoxShowActions(), onCheckBoxShowAll(), onCheckBoxShowErrors(), onCheckBoxShowInfos(), onCheckBoxShowWarnings(), DIALOG_CHANGE_SYMBOLS::onOkButtonClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), onThemeChanged(), DIALOG_UPDATE_FROM_PCB::OnUpdateClick(), DIALOG_UPDATE_PCB::PerformUpdate(), DIALOG_UPDATE_FROM_PCB::updateData(), and WX_HTML_REPORT_PANEL().

◆ generateHtml()

wxString WX_HTML_REPORT_PANEL::generateHtml ( const REPORT_LINE aLine)
private

Definition at line 180 of file wx_html_report_panel.cpp.

181 {
182  wxString retv;
183 
184  if( !( m_severities & aLine.severity ) )
185  return retv;
186 
188  {
189  switch( aLine.severity )
190  {
191  case RPT_SEVERITY_ERROR:
192  retv = wxT( "<font color=#F04040 size=3>" ) + _( "Error:" ) + " </font>"
193  wxT( "<font size=3>" ) + aLine.message + wxT( "</font><br>" );
194  break;
196  retv = wxT( "<font size=3>" ) + _( "Warning:" ) + wxS( " " ) + aLine.message + "</font><br>";
197  break;
198  case RPT_SEVERITY_INFO:
199  retv = wxT( "<font color=#909090 size=3>" ) + aLine.message + wxT( "</font><br>" );
200  break;
201  case RPT_SEVERITY_ACTION:
202  retv = wxT( "<font color=#60D060 size=3>" ) + aLine.message + wxT( "</font><br>" );
203  break;
204  default:
205  retv = wxT( "<font size=3>" ) + aLine.message + wxT( "</font><br>" );
206  }
207  }
208  else
209  {
210  switch( aLine.severity )
211  {
212  case RPT_SEVERITY_ERROR:
213  retv = wxT( "<font color=#D00000 size=3>" ) + _( "Error:" ) + " </font>"
214  wxT( "<font size=3>" ) + aLine.message + wxT( "</font><br>" );
215  break;
217  retv = wxT( "<font size=3>" ) + _( "Warning:" ) + wxS( " " ) + aLine.message + "</font><br>";
218  break;
219  case RPT_SEVERITY_INFO:
220  retv = wxT( "<font color=#808080 size=3>" ) + aLine.message + wxT( "</font><br>" );
221  break;
222  case RPT_SEVERITY_ACTION:
223  retv = wxT( "<font color=#008000 size=3>" ) + aLine.message + wxT( "</font><br>" );
224  break;
225  default:
226  retv = wxT( "<font size=3>" ) + aLine.message + wxT( "</font><br>" );
227  }
228  }
229 
230  // wxHtmlWindow fails to do correct baseline alignment between Japanese/Chinese cells and
231  // Roman cells. This keeps the line in a single cell.
232  retv.Replace( wxT( " " ), wxT( "&nbsp;" ) );
233 
234  return retv;
235 }
bool IsDarkTheme()
Determine if the desktop interface is currently using a dark theme or a light theme.
Definition: gtk/ui.cpp:31
#define _(s)
int m_severities
message severities to display (mask)

References _, KIPLATFORM::UI::IsDarkTheme(), m_severities, WX_HTML_REPORT_PANEL::REPORT_LINE::message, RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, RPT_SEVERITY_WARNING, and WX_HTML_REPORT_PANEL::REPORT_LINE::severity.

Referenced by Flush(), and Report().

◆ generatePlainText()

wxString WX_HTML_REPORT_PANEL::generatePlainText ( const REPORT_LINE aLine)
private

Definition at line 238 of file wx_html_report_panel.cpp.

239 {
240  switch( aLine.severity )
241  {
242  case RPT_SEVERITY_ERROR: return _( "Error:" ) + wxS( " " ) + aLine.message + wxT( "\n" );
243  case RPT_SEVERITY_WARNING: return _( "Warning:" ) + wxS( " " ) + aLine.message + wxT( "\n" );
244  case RPT_SEVERITY_INFO: return _( "Info:" ) + wxS( " " ) + aLine.message + wxT( "\n" );
245  default: return aLine.message + wxT( "\n" );
246  }
247 }
#define _(s)

References _, WX_HTML_REPORT_PANEL::REPORT_LINE::message, RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, RPT_SEVERITY_WARNING, and WX_HTML_REPORT_PANEL::REPORT_LINE::severity.

Referenced by onBtnSaveToFile().

◆ GetFileName()

wxString & WX_HTML_REPORT_PANEL::GetFileName ( void  )

Definition at line 444 of file wx_html_report_panel.cpp.

445 {
446  return ( m_reportFileName );
447 }
wxString m_reportFileName
defaults to the not very useful /bin/report.txt

References m_reportFileName.

Referenced by DIALOG_BOARD_REANNOTATE::~DIALOG_BOARD_REANNOTATE().

◆ GetVisibleSeverities()

int WX_HTML_REPORT_PANEL::GetVisibleSeverities ( ) const
Returns
the visible severity filter. If the m_showAll option is set, the mask is < 0

Definition at line 432 of file wx_html_report_panel.cpp.

433 {
434  return m_severities;
435 }
int m_severities
message severities to display (mask)

References m_severities.

Referenced by DIALOG_ANNOTATE::~DIALOG_ANNOTATE(), DIALOG_NETLIST_IMPORT::~DIALOG_NETLIST_IMPORT(), and DIALOG_UPDATE_PCB::~DIALOG_UPDATE_PCB().

◆ MsgPanelSetMinSize()

void WX_HTML_REPORT_PANEL::MsgPanelSetMinSize ( const wxSize &  aMinSize)

returns the reporter object that reports to this panel

Definition at line 73 of file wx_html_report_panel.cpp.

74 {
75  m_fgSizer->SetMinSize( aMinSize );
76  GetSizer()->SetSizeHints( this );
77 }

References WX_HTML_REPORT_PANEL_BASE::m_fgSizer.

Referenced by DIALOG_GEN_FOOTPRINT_POSITION::initDialog(), and DIALOG_ANNOTATE::InitValues().

◆ onBtnSaveToFile()

void WX_HTML_REPORT_PANEL::onBtnSaveToFile ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from WX_HTML_REPORT_PANEL_BASE.

Definition at line 352 of file wx_html_report_panel.cpp.

353 {
354  wxFileName fn;
355 
356  if( m_reportFileName.empty() )
357  {
358  fn = wxT( "report.txt" );
359 
360  KIWAY_HOLDER* parent = dynamic_cast<KIWAY_HOLDER*>( m_parent );
361 
362  if( parent )
363  fn.SetPath( parent->Prj().GetProjectPath() );
364  }
365  else
366  fn = m_reportFileName;
367 
368  wxFileDialog dlg( this, _( "Save Report to File" ), fn.GetPath(), fn.GetFullName(),
369  TextFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
370 
371  if( dlg.ShowModal() != wxID_OK )
372  return;
373 
374  fn = dlg.GetPath();
375 
376  if( fn.GetExt().IsEmpty() )
377  fn.SetExt( "txt" );
378 
379  wxFFile f( fn.GetFullPath(), wxT( "wb" ) );
380 
381  if( !f.IsOpened() )
382  {
383  wxString msg;
384 
385  msg.Printf( _( "Cannot write report to file '%s'." ),
386  fn.GetFullPath().GetData() );
387  wxMessageBox( msg, _( "File save error" ), wxOK | wxICON_ERROR, this );
388  return;
389  }
390 
391  for( REPORT_LINES section : { m_reportHead, m_report, m_reportTail } )
392  {
393  for( const REPORT_LINE& l : section )
394  {
395  wxString s = generatePlainText( l );
396 
398  f.Write( s );
399  }
400  }
401 
402  m_reportFileName = fn.GetFullPath();
403  f.Close();
404 }
A mix in class which holds the location of a wxWindow's KIWAY.
Definition: kiway_holder.h:36
wxString generatePlainText(const REPORT_LINE &aLine)
virtual const wxString GetProjectPath() const
Return the full path of the project.
Definition: project.cpp:122
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
#define _(s)
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
REPORT_LINES m_report
copy of the report, stored for filtering
std::vector< REPORT_LINE > REPORT_LINES
wxString TextFileWildcard()

References _, ConvertSmartQuotesAndDashes(), generatePlainText(), PROJECT::GetProjectPath(), m_report, m_reportFileName, m_reportHead, m_reportTail, KIWAY_HOLDER::Prj(), and TextFileWildcard().

◆ onCheckBoxShowActions()

void WX_HTML_REPORT_PANEL::onCheckBoxShowActions ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from WX_HTML_REPORT_PANEL_BASE.

Definition at line 340 of file wx_html_report_panel.cpp.

341 {
342  if( event.IsChecked() )
344  else
346 
347  syncCheckboxes();
348  Flush( true );
349 }
void Flush(bool aSort=false)
Set the visible severity filter.
int m_severities
message severities to display (mask)

References Flush(), m_severities, RPT_SEVERITY_ACTION, and syncCheckboxes().

◆ onCheckBoxShowAll()

void WX_HTML_REPORT_PANEL::onCheckBoxShowAll ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from WX_HTML_REPORT_PANEL_BASE.

Definition at line 282 of file wx_html_report_panel.cpp.

283 {
284  if( event.IsChecked() )
286  else
288 
289  syncCheckboxes();
290  Flush( true );
291 }
void Flush(bool aSort=false)
Set the visible severity filter.
int m_severities
message severities to display (mask)
static int RPT_SEVERITY_ALL

References Flush(), m_severities, RPT_SEVERITY_ALL, RPT_SEVERITY_ERROR, and syncCheckboxes().

◆ onCheckBoxShowErrors()

void WX_HTML_REPORT_PANEL::onCheckBoxShowErrors ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from WX_HTML_REPORT_PANEL_BASE.

Definition at line 316 of file wx_html_report_panel.cpp.

317 {
318  if( event.IsChecked() )
320  else
322 
323  syncCheckboxes();
324  Flush( true );
325 }
void Flush(bool aSort=false)
Set the visible severity filter.
int m_severities
message severities to display (mask)

References Flush(), m_severities, RPT_SEVERITY_ERROR, and syncCheckboxes().

◆ onCheckBoxShowInfos()

void WX_HTML_REPORT_PANEL::onCheckBoxShowInfos ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from WX_HTML_REPORT_PANEL_BASE.

Definition at line 328 of file wx_html_report_panel.cpp.

329 {
330  if( event.IsChecked() )
332  else
334 
335  syncCheckboxes();
336  Flush( true );
337 }
void Flush(bool aSort=false)
Set the visible severity filter.
int m_severities
message severities to display (mask)

References Flush(), m_severities, RPT_SEVERITY_INFO, and syncCheckboxes().

◆ onCheckBoxShowWarnings()

void WX_HTML_REPORT_PANEL::onCheckBoxShowWarnings ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from WX_HTML_REPORT_PANEL_BASE.

Definition at line 304 of file wx_html_report_panel.cpp.

305 {
306  if( event.IsChecked() )
308  else
310 
311  syncCheckboxes();
312  Flush( true );
313 }
void Flush(bool aSort=false)
Set the visible severity filter.
int m_severities
message severities to display (mask)

References Flush(), m_severities, RPT_SEVERITY_WARNING, and syncCheckboxes().

◆ onMenuEvent()

void WX_HTML_REPORT_PANEL::onMenuEvent ( wxMenuEvent &  event)
private

Definition at line 258 of file wx_html_report_panel.cpp.

259 {
260  if( event.GetId() == wxID_COPY )
261  {
262  wxLogNull doNotLog; // disable logging of failed clipboard actions
263 
264  if( wxTheClipboard->Open() )
265  {
266  bool primarySelection = wxTheClipboard->IsUsingPrimarySelection();
267  wxTheClipboard->UsePrimarySelection( false ); // required to use the main clipboard
268  wxTheClipboard->SetData( new wxTextDataObject( m_htmlView->SelectionToText() ) );
269  wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
270  wxTheClipboard->Close();
271  wxTheClipboard->UsePrimarySelection( primarySelection );
272  }
273  }
274 }

References WX_HTML_REPORT_PANEL_BASE::m_htmlView.

Referenced by WX_HTML_REPORT_PANEL().

◆ onRightClick()

void WX_HTML_REPORT_PANEL::onRightClick ( wxMouseEvent &  event)
overrideprivatevirtual

Reimplemented from WX_HTML_REPORT_PANEL_BASE.

Definition at line 250 of file wx_html_report_panel.cpp.

251 {
252  wxMenu popup;
253  popup.Append( wxID_COPY, wxT( "Copy" ) );
254  PopupMenu( &popup );
255 }

◆ onThemeChanged()

void WX_HTML_REPORT_PANEL::onThemeChanged ( wxSysColourChangedEvent &  aEvent)
private

Definition at line 65 of file wx_html_report_panel.cpp.

66 {
67  Flush();
68 
69  aEvent.Skip();
70 }
void Flush(bool aSort=false)
Set the visible severity filter.

References Flush().

Referenced by WX_HTML_REPORT_PANEL().

◆ Report()

void WX_HTML_REPORT_PANEL::Report ( const wxString &  aText,
SEVERITY  aSeverity,
REPORTER::LOCATION  aLocation = REPORTER::LOC_BODY 
)

Reports the string.

Parameters
aTextstring message to report
aSeveritystring classification level bitfield
aLocationREPORTER::LOCATION enum for placement of messageclears the report panel

Definition at line 86 of file wx_html_report_panel.cpp.

88 {
89  REPORT_LINE line;
90  line.message = aText;
91  line.severity = aSeverity;
92 
93  if( aLocation == REPORTER::LOC_HEAD )
94  m_reportHead.push_back( line );
95  else if( aLocation == REPORTER::LOC_TAIL )
96  m_reportTail.push_back( line );
97  else
98  m_report.push_back( line );
99 
100  if( !m_lazyUpdate )
101  {
103  scrollToBottom();
104  }
105 }
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
bool AppendToPage(const wxString &aSource)
Definition: html_window.cpp:57
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
REPORT_LINES m_report
copy of the report, stored for filtering
wxString generateHtml(const REPORT_LINE &aLine)

References HTML_WINDOW::AppendToPage(), generateHtml(), REPORTER::LOC_HEAD, REPORTER::LOC_TAIL, WX_HTML_REPORT_PANEL_BASE::m_htmlView, m_lazyUpdate, m_report, m_reportHead, m_reportTail, WX_HTML_REPORT_PANEL::REPORT_LINE::message, scrollToBottom(), and WX_HTML_REPORT_PANEL::REPORT_LINE::severity.

Referenced by DIALOG_EXCHANGE_FOOTPRINTS::processFootprint(), DIALOG_CHANGE_SYMBOLS::processSymbol(), WX_HTML_PANEL_REPORTER::Report(), WX_HTML_PANEL_REPORTER::ReportHead(), WX_HTML_PANEL_REPORTER::ReportTail(), and DIALOG_BOARD_REANNOTATE::ShowReport().

◆ Reporter()

◆ scrollToBottom()

void WX_HTML_REPORT_PANEL::scrollToBottom ( )
private

Definition at line 141 of file wx_html_report_panel.cpp.

142 {
143  int x, y, xUnit, yUnit;
144 
145  m_htmlView->GetVirtualSize( &x, &y );
146  m_htmlView->GetScrollPixelsPerUnit( &xUnit, &yUnit );
147  m_htmlView->Scroll( 0, y / yUnit );
148 
149  updateBadges();
150 }

References WX_HTML_REPORT_PANEL_BASE::m_htmlView, and updateBadges().

Referenced by Flush(), and Report().

◆ SetFileName()

◆ SetLabel()

void WX_HTML_REPORT_PANEL::SetLabel ( const wxString &  aLabel)
override

Sets the lazy update.

If this mode is on, messages are stored but the display is not updated (Updating display can be very time consuming if there are many messages) A call to Flush() will be needed after build the report

Definition at line 415 of file wx_html_report_panel.cpp.

416 {
417  m_box->GetStaticBox()->SetLabel( aLabel );
418 }

References WX_HTML_REPORT_PANEL_BASE::m_box.

Referenced by DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DIALOG_UPDATE_PCB::OnUpdateClick(), and DIALOG_NETLIST_IMPORT::onUpdatePCB().

◆ SetLazyUpdate()

void WX_HTML_REPORT_PANEL::SetLazyUpdate ( bool  aLazyUpdate)

◆ SetShowSeverity()

void WX_HTML_REPORT_PANEL::SetShowSeverity ( SEVERITY  aSeverity,
bool  aValue 
)

◆ SetVisibleSeverities()

void WX_HTML_REPORT_PANEL::SetVisibleSeverities ( int  aSeverities)
Returns
the visible severity filter. If the m_showAll option is set, the mask is < 0

Definition at line 421 of file wx_html_report_panel.cpp.

422 {
423  if( aSeverities < 0 )
425  else
426  m_severities = aSeverities;
427 
428  syncCheckboxes();
429 }
int m_severities
message severities to display (mask)
static int RPT_SEVERITY_ALL

References m_severities, RPT_SEVERITY_ALL, and syncCheckboxes().

Referenced by DIALOG_NETLIST_IMPORT::DIALOG_NETLIST_IMPORT(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), and DIALOG_ANNOTATE::InitValues().

◆ syncCheckboxes()

void WX_HTML_REPORT_PANEL::syncCheckboxes ( )
private

Definition at line 294 of file wx_html_report_panel.cpp.

References WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowActions, WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowAll, WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowErrors, WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowInfos, WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowWarnings, m_severities, RPT_SEVERITY_ACTION, RPT_SEVERITY_ALL, RPT_SEVERITY_ERROR, RPT_SEVERITY_INFO, and RPT_SEVERITY_WARNING.

Referenced by onCheckBoxShowActions(), onCheckBoxShowAll(), onCheckBoxShowErrors(), onCheckBoxShowInfos(), onCheckBoxShowWarnings(), SetVisibleSeverities(), and WX_HTML_REPORT_PANEL().

◆ updateBadges()

void WX_HTML_REPORT_PANEL::updateBadges ( )
private

Definition at line 153 of file wx_html_report_panel.cpp.

154 {
155  int count = Count(RPT_SEVERITY_ERROR );
157 
158  count = Count(RPT_SEVERITY_WARNING );
160 }
void UpdateNumber(int aNumber, SEVERITY aSeverity)
Update the number displayed on the badge.
int Count(int severityMask)
sets the frame label

References Count(), WX_HTML_REPORT_PANEL_BASE::m_errorsBadge, WX_HTML_REPORT_PANEL_BASE::m_warningsBadge, RPT_SEVERITY_ERROR, RPT_SEVERITY_WARNING, and NUMBER_BADGE::UpdateNumber().

Referenced by scrollToBottom().

Member Data Documentation

◆ m_box

wxStaticBoxSizer* WX_HTML_REPORT_PANEL_BASE::m_box
protectedinherited

◆ m_btnSaveReportToFile

wxButton* WX_HTML_REPORT_PANEL_BASE::m_btnSaveReportToFile
protectedinherited

◆ m_checkBoxShowActions

wxCheckBox* WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowActions
protectedinherited

◆ m_checkBoxShowAll

wxCheckBox* WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowAll
protectedinherited

◆ m_checkBoxShowErrors

wxCheckBox* WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowErrors
protectedinherited

◆ m_checkBoxShowInfos

wxCheckBox* WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowInfos
protectedinherited

◆ m_checkBoxShowWarnings

wxCheckBox* WX_HTML_REPORT_PANEL_BASE::m_checkBoxShowWarnings
protectedinherited

◆ m_errorsBadge

NUMBER_BADGE* WX_HTML_REPORT_PANEL_BASE::m_errorsBadge
protectedinherited

◆ m_fgSizer

wxFlexGridSizer* WX_HTML_REPORT_PANEL_BASE::m_fgSizer
protectedinherited

◆ m_htmlView

◆ m_lazyUpdate

bool WX_HTML_REPORT_PANEL::m_lazyUpdate
private

Definition at line 134 of file wx_html_report_panel.h.

Referenced by Report(), and SetLazyUpdate().

◆ m_report

REPORT_LINES WX_HTML_REPORT_PANEL::m_report
private

copy of the report, stored for filtering

Definition at line 129 of file wx_html_report_panel.h.

Referenced by Clear(), Count(), Flush(), onBtnSaveToFile(), and Report().

◆ m_reporter

WX_HTML_PANEL_REPORTER WX_HTML_REPORT_PANEL::m_reporter
private

Definition at line 127 of file wx_html_report_panel.h.

Referenced by Reporter().

◆ m_reportFileName

wxString WX_HTML_REPORT_PANEL::m_reportFileName
private

defaults to the not very useful /bin/report.txt

Definition at line 136 of file wx_html_report_panel.h.

Referenced by GetFileName(), onBtnSaveToFile(), and SetFileName().

◆ m_reportHead

REPORT_LINES WX_HTML_REPORT_PANEL::m_reportHead
private

... and at the beginning, regardless of sorting

Definition at line 131 of file wx_html_report_panel.h.

Referenced by Clear(), Count(), Flush(), onBtnSaveToFile(), and Report().

◆ m_reportTail

REPORT_LINES WX_HTML_REPORT_PANEL::m_reportTail
private

Lines to print at the end, regardless of sorting.

Definition at line 130 of file wx_html_report_panel.h.

Referenced by Clear(), Count(), Flush(), onBtnSaveToFile(), and Report().

◆ m_severities

int WX_HTML_REPORT_PANEL::m_severities
private

◆ m_staticTextShow

wxStaticText* WX_HTML_REPORT_PANEL_BASE::m_staticTextShow
protectedinherited

◆ m_warningsBadge

NUMBER_BADGE* WX_HTML_REPORT_PANEL_BASE::m_warningsBadge
protectedinherited

The documentation for this class was generated from the following files: