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 The KiCad Developers, see AUTHORS.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#pragma once
23
24#include <reporter.h>
25#include <vector>
26
28
30
35{
36public:
38 REPORTER(),
39 m_panel( aPanel )
40 {}
41
43
44 REPORTER& Report( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
45 REPORTER& ReportTail( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
46 REPORTER& ReportHead( const wxString& aText, SEVERITY aSeverity = RPT_SEVERITY_UNDEFINED ) override;
47
48 bool HasMessage() const override;
49 bool HasMessageOfSeverity( int aSeverityMask ) const override;
50
51private:
53};
54
62{
63public:
64 WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxSize( 500, 300 ), long style = wxTAB_TRAVERSAL );
66
68
70 void MsgPanelSetMinSize( const wxSize& aMinSize );
71
73 REPORTER& Reporter();
74
82 void Report( const wxString& aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation = REPORTER::LOC_BODY );
83
85 void Clear();
86
88 int Count( int severityMask );
89
91 void SetLabel( const wxString& aLabel ) override;
92
96 void SetLazyUpdate( bool aLazyUpdate ) { m_lazyUpdate = aLazyUpdate; }
97
100 void Flush( bool aSort = false );
101
104 int GetVisibleSeverities() const;
105
107 void SetFileName( const wxString& aReportFileName ) { m_reportFileName = aReportFileName; }
108
110 wxString& GetFileName( void ) { return m_reportFileName; }
111
112private:
114 {
116 wxString message;
117 };
118
119 typedef std::vector<REPORT_LINE> REPORT_LINES;
120
121 wxString generateHtml( const REPORT_LINE& aLine );
122 wxString generatePlainText( const REPORT_LINE& aLine );
123 void updateBadges();
124
125 void scrollToBottom();
126
127 void onRightClick( wxMouseEvent& event ) override;
128 void onMenuEvent( wxMenuEvent& event );
129 void onCheckBox( wxCommandEvent& event ) override;
130
131 void onBtnSaveToFile( wxCommandEvent& event ) override;
132
133 void onThemeChanged( wxSysColourChangedEvent &aEvent );
134
135private:
137
141
143
145};
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 & GetFileName(void)
wxString m_reportFileName
defaults to the not very useful /bin/report.txt
REPORT_LINES m_report
copy of the report, stored for filtering
void SetLazyUpdate(bool aLazyUpdate)
Set the lazy update.
WX_HTML_PANEL_REPORTER m_reporter
std::vector< REPORT_LINE > REPORT_LINES
void SetFileName(const wxString &aReportFileName)
Set the report full file name to the string.
REPORT_LINES m_reportHead
... and at the beginning, regardless of sorting
REPORT_LINES m_reportTail
Lines to print at the end, regardless of sorting.
#define KICOMMON_API
Definition: kicommon.h:28
SEVERITY
@ RPT_SEVERITY_UNDEFINED