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-2021 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 
40 {
41 public:
42  WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id = wxID_ANY,
43  const wxPoint& pos = wxDefaultPosition,
44  const wxSize& size = wxSize( 500,300 ), long style = wxTAB_TRAVERSAL );
46 
48  void MsgPanelSetMinSize( const wxSize& aMinSize );
49 
51  REPORTER& Reporter();
52 
59  void Report( const wxString& aText, SEVERITY aSeverity,
61 
63  void Clear();
64 
66  int Count( int severityMask );
67 
69  void SetLabel( const wxString& aLabel ) override;
70 
74  void SetLazyUpdate( bool aLazyUpdate );
75 
78  void Flush( bool aSort = false );
79 
82  void SetVisibleSeverities( int aSeverities );
83 
86  int GetVisibleSeverities() const;
87 
89  void SetPrintInfo( bool aPrintInfo );
90 
93  void SetShowSeverity( SEVERITY aSeverity, bool aValue );
94 
96  void SetFileName( const wxString& aReportFileName );
97 
99  wxString& GetFileName( void );
100 
101 
102 private:
103  struct REPORT_LINE
104  {
106  wxString message;
107  };
108 
109  typedef std::vector<REPORT_LINE> REPORT_LINES;
110 
111  wxString addHeader( const wxString& aBody );
112  wxString generateHtml( const REPORT_LINE& aLine );
113  wxString generatePlainText( const REPORT_LINE& aLine );
114  void updateBadges();
115 
116  void scrollToBottom();
117  void syncCheckboxes();
118 
119  void onRightClick( wxMouseEvent& event ) override;
120  void onMenuEvent( wxMenuEvent& event );
121  void onCheckBoxShowAll( wxCommandEvent& event ) override;
122  void onCheckBoxShowWarnings( wxCommandEvent& event ) override;
123  void onCheckBoxShowErrors( wxCommandEvent& event ) override;
124  void onCheckBoxShowInfos( wxCommandEvent& event ) override;
125  void onCheckBoxShowActions( wxCommandEvent& event ) override;
126 
127  void onBtnSaveToFile( wxCommandEvent& event ) override;
128 
131 
134 
137 
140 
143 
145 
148 
151 };
152 
153 #endif //__WX_HTML_REPORT_PANEL_H__
void SetVisibleSeverities(int aSeverities)
void onCheckBoxShowInfos(wxCommandEvent &event) override
void onBtnSaveToFile(wxCommandEvent &event) override
copy of the report, stored for filtering
wxString addHeader(const wxString &aBody)
void SetLazyUpdate(bool aLazyUpdate)
Forces updating the HTML page, after the report is built in lazy mode If aSort = true,...
~WX_HTML_REPORT_PANEL()
Set the min size of the area which displays html messages:
void onCheckBoxShowActions(wxCommandEvent &event) override
wxString generatePlainText(const REPORT_LINE &aLine)
Class WX_HTML_REPORT_PANEL_BASE.
SEVERITY
Definition: ui_common.h:83
void Flush(bool aSort=false)
Set the visible severity filter.
void onCheckBoxShowWarnings(wxCommandEvent &event) override
void onCheckBoxShowErrors(wxCommandEvent &event) override
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void onRightClick(wxMouseEvent &event) override
WX_HTML_REPORT_PANEL(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 300), long style=wxTAB_TRAVERSAL)
REPORT_LINES m_reportHead
the reporter
void SetPrintInfo(bool aPrintInfo)
WX_HTML_PANEL_REPORTER m_reporter
message severities to display (mask)
REPORT_LINES m_reportTail
Lines to print at the very beginning of the report, regardless of sorting.
int Count(int severityMask)
sets the frame label
bool m_printInfo
Use this as the filename instead of /bin/report.txt (default)
void SetShowSeverity(SEVERITY aSeverity, bool aValue)
Set the report full file name to the string.
REPORT_LINES m_report
Lines to print at the very end of the report, regardless of sorting.
int GetVisibleSeverities() const
If true prints Info: at the beginning of each Info severity line (Default)
void Report(const wxString &aText, SEVERITY aSeverity, REPORTER::LOCATION aLocation=REPORTER::LOC_BODY)
Reports the string.
A wrapper for reporting to a wx HTML window.
Definition: reporter.h:183
LOCATION
Location where the message is to be reported.
Definition: reporter.h:73
void Clear()
return the number of messages matching the given severity mask.
std::vector< REPORT_LINE > REPORT_LINES
void onCheckBoxShowAll(wxCommandEvent &event) override
wxString generateHtml(const REPORT_LINE &aLine)
void MsgPanelSetMinSize(const wxSize &aMinSize)
returns the reporter object that reports to this panel
void SetFileName(const wxString &aReportFileName)
bool m_lazyUpdate
Print "Info:" at the front of Info messages (default)
void SetLabel(const wxString &aLabel) override
Sets the lasy update.
void onMenuEvent(wxMenuEvent &event)
A widget for browsing a rich text error/status report.