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  void SetLabel( const wxString& aLabel ) override;
63 
67  void SetLazyUpdate( bool aLazyUpdate );
68 
70  void Flush();
71 
74  void SetVisibleSeverities( int aSeverities );
75 
79 
80 private:
81  struct REPORT_LINE
82  {
84  wxString message;
85  };
86 
87  typedef std::vector<REPORT_LINE> REPORT_LINES;
88 
89  wxString addHeader( const wxString& aBody );
90  wxString generateHtml( const REPORT_LINE& aLine );
91  wxString generatePlainText( const REPORT_LINE& aLine );
92 
93  void refreshView();
94  void scrollToBottom();
95  void syncCheckboxes();
96 
97  void onCheckBoxShowAll( wxCommandEvent& event ) override;
98  void onCheckBoxShowWarnings( wxCommandEvent& event ) override;
99  void onCheckBoxShowErrors( wxCommandEvent& event ) override;
100  void onCheckBoxShowInfos( wxCommandEvent& event ) override;
101  void onCheckBoxShowActions( wxCommandEvent& event ) override;
102 
103  void onBtnSaveToFile( wxCommandEvent& event ) override;
104 
106  REPORT_LINES m_report;
107 
110 
113 
115  bool m_showAll;
116 
117  wxString m_html;
118 
120 };
121 
122 #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)
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:135
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.