KiCad PCB EDA Suite
wx_html_report_panel.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2015 CERN
5  * Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
6  * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
7  *
8  * This program is free software: you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License as published by the
10  * Free Software Foundation, either version 2 of the License, or (at your
11  * option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #ifndef __WX_HTML_REPORT_PANEL_H__
23 #define __WX_HTML_REPORT_PANEL_H__
24 
25 #include <wx/wx.h>
26 #include <reporter.h>
27 #include <vector>
28 
30 
31 
42 {
43 public:
44  WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY,
45  const wxPoint& pos = wxDefaultPosition,
46  const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
48 
50  void MsgPanelSetMinSize( const wxSize& aMinSize );
51 
53  REPORTER& Reporter();
54 
56  void Report( const wxString& aText, REPORTER::SEVERITY aSeverity );
57 
59  void Clear();
60 
62  int Count( int severityMask );
63 
65  void SetLabel( const wxString& aLabel ) override;
66 
70  void SetLazyUpdate( bool aLazyUpdate );
71 
73  void Flush();
74 
77  void SetVisibleSeverities( int aSeverities );
78 
82 
83 private:
84  struct REPORT_LINE
85  {
87  wxString message;
88  };
89 
90  typedef std::vector<REPORT_LINE> REPORT_LINES;
91 
92  wxString addHeader( const wxString& aBody );
93  wxString generateHtml( const REPORT_LINE& aLine );
94  wxString generatePlainText( const REPORT_LINE& aLine );
95 
96  void refreshView();
97  void scrollToBottom();
98  void syncCheckboxes();
99 
100  void onCheckBoxShowAll( wxCommandEvent& event ) override;
101  void onCheckBoxShowWarnings( wxCommandEvent& event ) override;
102  void onCheckBoxShowErrors( wxCommandEvent& event ) override;
103  void onCheckBoxShowInfos( wxCommandEvent& event ) override;
104  void onCheckBoxShowActions( wxCommandEvent& event ) override;
105 
106  void onBtnSaveToFile( wxCommandEvent& event ) override;
107 
109  REPORT_LINES m_report;
110 
113 
116 
118  bool m_showAll;
119 
120  wxString m_html;
121 
123 };
124 
125 #endif //__WX_HTML_REPORT_PANEL_H__
void SetVisibleSeverities(int aSeverities)
Set the visible severity filter.
void onCheckBoxShowInfos(wxCommandEvent &event) override
void onBtnSaveToFile(wxCommandEvent &event) override
wxString addHeader(const wxString &aBody)
void SetLazyUpdate(bool aLazyUpdate)
Sets the lasy update.
void onCheckBoxShowActions(wxCommandEvent &event) override
wxString generatePlainText(const REPORT_LINE &aLine)
Class WX_HTML_REPORT_PANEL_BASE.
void onCheckBoxShowWarnings(wxCommandEvent &event) override
void onCheckBoxShowErrors(wxCommandEvent &event) override
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
WX_HTML_REPORT_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxTAB_TRAVERSAL)
SEVERITY
Severity of the reported messages.
Definition: reporter.h:65
void Report(const wxString &aText, REPORTER::SEVERITY aSeverity)
reports a string directly.
REPORTER & Reporter()
returns the reporter object that reports to this panel
WX_HTML_PANEL_REPORTER m_reporter
the reporter
bool m_showAll
show all messages flag (overrides m_severities)
int Count(int severityMask)
return the number of messages matching the given severity mask.
REPORT_LINES m_report
copy of the report, stored for filtering
Class WX_HTML_PANEL_REPORTER is a wrapper for reporting to a wx HTML window.
Definition: reporter.h:145
void Flush()
Forces updating the HTML page, after the report is built in lazy mode
void Clear()
clears the report panel
std::vector< REPORT_LINE > REPORT_LINES
void onCheckBoxShowAll(wxCommandEvent &event) override
wxString generateHtml(const REPORT_LINE &aLine)
void MsgPanelSetMinSize(const wxSize &aMinSize)
Set the min size of the area which displays html messages:
void SetLabel(const wxString &aLabel) override
sets the frame label
int m_severities
message severities to display (mask)
Class WX_HTML_REPORT_PANEL.