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 bool HasMessageOfSeverity( int aSeverityMask ) const override;
52
53private:
55};
56
65{
66public:
67 WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY,
68 const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
71
73 void MsgPanelSetMinSize( const wxSize& aMinSize );
74
76 REPORTER& Reporter();
77
84 void Report( const wxString& aText, SEVERITY aSeverity,
86
88 void Clear();
89
91 int Count( int severityMask );
92
94 void SetLabel( const wxString& aLabel ) override;
95
99 void SetLazyUpdate( bool aLazyUpdate );
100
103 void Flush( bool aSort = false );
104
107 void SetVisibleSeverities( int aSeverities );
108
111 int GetVisibleSeverities() const;
112
115 void SetShowSeverity( SEVERITY aSeverity, bool aValue );
116
118 void SetFileName( const wxString& aReportFileName );
119
121 wxString& GetFileName( void );
122
123
124private:
126 {
128 wxString message;
129 };
130
131 typedef std::vector<REPORT_LINE> REPORT_LINES;
132
133 wxString addHeader( const wxString& aBody );
134 wxString generateHtml( const REPORT_LINE& aLine );
135 wxString generatePlainText( const REPORT_LINE& aLine );
136 void updateBadges();
137
138 void scrollToBottom();
139 void syncCheckboxes();
140
141 void onRightClick( wxMouseEvent& event ) override;
142 void onMenuEvent( wxMenuEvent& event );
143 void onCheckBoxShowAll( wxCommandEvent& event ) override;
144 void onCheckBoxShowWarnings( wxCommandEvent& event ) override;
145 void onCheckBoxShowErrors( wxCommandEvent& event ) override;
146 void onCheckBoxShowInfos( wxCommandEvent& event ) override;
147 void onCheckBoxShowActions( wxCommandEvent& event ) override;
148
149 void onBtnSaveToFile( wxCommandEvent& event ) override;
150
151 void onThemeChanged( wxSysColourChangedEvent &aEvent );
152
153private:
155
159
162
164};
165
166#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 HasMessageOfSeverity(int aSeverityMask) const
Returns true if the reporter has one or more messages matching the specified severity mask.
Definition: reporter.cpp:53
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