KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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-2021 KiCad Developers, see change_log.txt for contributors.
6 * Author: Tomasz Wlostowski <[email protected]>
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:
38 WX_HTML_PANEL_REPORTER( WX_HTML_REPORT_PANEL* aPanel ) : REPORTER(), m_panel( aPanel ) {}
39
41
42 REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
43
44 REPORTER& ReportTail( const wxString& aText,
45 SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
46
47 REPORTER& ReportHead( const wxString& aText,
48 SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
49
50 bool HasMessage() const override;
51
52private:
54};
55
64{
65public:
66 WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY,
67 const wxPoint& pos = wxDefaultPosition,
68 const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
70
72 void MsgPanelSetMinSize( const wxSize& aMinSize );
73
75 REPORTER& Reporter();
76
83 void Report( const wxString& aText, SEVERITY aSeverity,
85
87 void Clear();
88
90 int Count( int severityMask );
91
93 void SetLabel( const wxString& aLabel ) override;
94
98 void SetLazyUpdate( bool aLazyUpdate );
99
102 void Flush( bool aSort = false );
103
106 void SetVisibleSeverities( int aSeverities );
107
110 int GetVisibleSeverities() const;
111
114 void SetShowSeverity( SEVERITY aSeverity, bool aValue );
115
117 void SetFileName( const wxString& aReportFileName );
118
120 wxString& GetFileName( void );
121
122
123private:
125 {
127 wxString message;
128 };
129
130 typedef std::vector<REPORT_LINE> REPORT_LINES;
131
132 wxString addHeader( const wxString& aBody );
133 wxString generateHtml( const REPORT_LINE& aLine );
134 wxString generatePlainText( const REPORT_LINE& aLine );
135 void updateBadges();
136
137 void scrollToBottom();
138 void syncCheckboxes();
139
140 void onRightClick( wxMouseEvent& event ) override;
141 void onMenuEvent( wxMenuEvent& event );
142 void onCheckBoxShowAll( wxCommandEvent& event ) override;
143 void onCheckBoxShowWarnings( wxCommandEvent& event ) override;
144 void onCheckBoxShowErrors( wxCommandEvent& event ) override;
145 void onCheckBoxShowInfos( wxCommandEvent& event ) override;
146 void onCheckBoxShowActions( wxCommandEvent& event ) override;
147
148 void onBtnSaveToFile( wxCommandEvent& event ) override;
149
150 void onThemeChanged( wxSysColourChangedEvent &aEvent );
151
152private:
154
158
161
163};
164
165#endif //__WX_HTML_REPORT_PANEL_H__
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:72
LOCATION
Location where the message is to be reported.
Definition: reporter.h:80
@ LOC_BODY
Definition: reporter.h:82
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:109
virtual bool HasMessage() const =0
Returns true if the reporter client is non-empty.
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:100
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
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