KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 The KiCad Developers, see AUTHORS.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 <reporter.h>
26#include <vector>
27
29
31
36{
37public:
39 REPORTER(),
40 m_panel( aPanel )
41 {}
42
44
45 REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
46
47 REPORTER& ReportTail( const wxString& aText,
48 SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
49
50 REPORTER& ReportHead( const wxString& aText,
51 SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
52
53 bool HasMessage() const override;
54 bool HasMessageOfSeverity( int aSeverityMask ) const override;
55
56private:
58};
59
67{
68public:
69 WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY,
70 const wxPoint& pos = wxDefaultPosition,
71 const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
72
74
76 void MsgPanelSetMinSize( const wxSize& aMinSize );
77
79 REPORTER& Reporter();
80
88 void Report( const wxString& aText, SEVERITY aSeverity,
90
92 void Clear();
93
95 int Count( int severityMask );
96
98 void SetLabel( const wxString& aLabel ) override;
99
103 void SetLazyUpdate( bool aLazyUpdate );
104
107 void Flush( bool aSort = false );
108
111 void SetVisibleSeverities( int aSeverities );
112
115 int GetVisibleSeverities() const;
116
119 void SetShowSeverity( SEVERITY aSeverity, bool aValue );
120
122 void SetFileName( const wxString& aReportFileName );
123
125 wxString& GetFileName( void );
126
127
128private:
130 {
132 wxString message;
133 };
134
135 typedef std::vector<REPORT_LINE> REPORT_LINES;
136
137 wxString addHeader( const wxString& aBody );
138 wxString generateHtml( const REPORT_LINE& aLine );
139 wxString generatePlainText( const REPORT_LINE& aLine );
140 void updateBadges();
141
142 void scrollToBottom();
143 void syncCheckboxes();
144
145 void onRightClick( wxMouseEvent& event ) override;
146 void onMenuEvent( wxMenuEvent& event );
147 void onCheckBoxShowAll( wxCommandEvent& event ) override;
148 void onCheckBoxShowWarnings( wxCommandEvent& event ) override;
149 void onCheckBoxShowErrors( wxCommandEvent& event ) override;
150 void onCheckBoxShowInfos( wxCommandEvent& event ) override;
151 void onCheckBoxShowActions( wxCommandEvent& event ) override;
152
153 void onBtnSaveToFile( wxCommandEvent& event ) override;
154
155 void onThemeChanged( wxSysColourChangedEvent &aEvent );
156
157private:
159
163
166
168};
169
170#endif //__WX_HTML_REPORT_PANEL_H__
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:73
LOCATION
Location where the message is to be reported.
Definition: reporter.h:88
@ LOC_BODY
Definition: reporter.h:90
virtual REPORTER & ReportHead(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the beginning of the list for objects that support ordering.
Definition: reporter.h:121
virtual void Clear()
Definition: reporter.h:150
virtual bool HasMessage() const =0
Returns true if the reporter client is non-empty.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Report a string with a given severity.
Definition: reporter.h:102
virtual REPORTER & ReportTail(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)
Places the report at the end of the list, for objects that support report ordering.
Definition: reporter.h:112
virtual bool HasMessageOfSeverity(int aSeverityMask) const
Returns true if the reporter has one or more messages matching the specified severity mask.
Definition: reporter.h:140
A wrapper for reporting to a wx HTML window.
WX_HTML_PANEL_REPORTER(WX_HTML_REPORT_PANEL *aPanel)
WX_HTML_REPORT_PANEL * m_panel
Class WX_HTML_REPORT_PANEL_BASE.
A widget for browsing a rich text error/status report.
wxString m_reportFileName
defaults to the not very useful /bin/report.txt
REPORT_LINES m_report
copy of the report, stored for filtering
int m_severities
message severities to display (mask)
WX_HTML_PANEL_REPORTER m_reporter
std::vector< REPORT_LINE > REPORT_LINES
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
wxString addHeader(const wxString &aBody)
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
#define KICOMMON_API
Definition: kicommon.h:28
SEVERITY
@ RPT_SEVERITY_UNDEFINED