HTML_REPORT: RPT_ALL as sum of individual options

This syncs the "All" checkbox with the state of the report options such
that selecting "All" automatically selects the other boxes and
deselecting a box results in the "All" box also being unselected.  This
allows a single click filtering of report messages.

Fixes: lp:1796992
* https://bugs.launchpad.net/kicad/+bug/1796992
This commit is contained in:
Seth Hillbrand 2018-11-23 20:29:33 -08:00
parent 327942affb
commit 106eaaade6
3 changed files with 12 additions and 13 deletions

View File

@ -35,7 +35,6 @@ WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent,
WX_HTML_REPORT_PANEL_BASE( parent, id, pos, size, style ), WX_HTML_REPORT_PANEL_BASE( parent, id, pos, size, style ),
m_reporter( this ), m_reporter( this ),
m_severities( -1 ), m_severities( -1 ),
m_showAll( true ),
m_lazyUpdate( false ) m_lazyUpdate( false )
{ {
syncCheckboxes(); syncCheckboxes();
@ -236,7 +235,7 @@ wxString WX_HTML_REPORT_PANEL::generateHtml( const REPORT_LINE& aLine )
{ {
wxString retv; wxString retv;
if( !m_showAll && ! ( m_severities & aLine.severity ) ) if( !( m_severities & aLine.severity ) )
return retv; return retv;
switch( aLine.severity ) switch( aLine.severity )
@ -307,9 +306,9 @@ void WX_HTML_REPORT_PANEL::onMenuEvent( wxMenuEvent& event )
void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event ) void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event )
{ {
if( event.IsChecked() ) if( event.IsChecked() )
m_showAll = true; m_severities = REPORTER::RPT_ALL;
else else
m_showAll = false; m_severities = 0;
syncCheckboxes(); syncCheckboxes();
Flush( true ); Flush( true );
@ -318,7 +317,7 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event )
void WX_HTML_REPORT_PANEL::syncCheckboxes() void WX_HTML_REPORT_PANEL::syncCheckboxes()
{ {
m_checkBoxShowAll->SetValue( m_showAll ); m_checkBoxShowAll->SetValue( m_severities == REPORTER::RPT_ALL );
m_checkBoxShowWarnings->SetValue( m_severities & REPORTER::RPT_WARNING ); m_checkBoxShowWarnings->SetValue( m_severities & REPORTER::RPT_WARNING );
m_checkBoxShowErrors->SetValue( m_severities & REPORTER::RPT_ERROR ); m_checkBoxShowErrors->SetValue( m_severities & REPORTER::RPT_ERROR );
m_checkBoxShowInfos->SetValue( m_severities & REPORTER::RPT_INFO ); m_checkBoxShowInfos->SetValue( m_severities & REPORTER::RPT_INFO );
@ -333,6 +332,7 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowWarnings( wxCommandEvent& event )
else else
m_severities &= ~REPORTER::RPT_WARNING; m_severities &= ~REPORTER::RPT_WARNING;
syncCheckboxes();
Flush( true ); Flush( true );
} }
@ -344,6 +344,7 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowErrors( wxCommandEvent& event )
else else
m_severities &= ~REPORTER::RPT_ERROR; m_severities &= ~REPORTER::RPT_ERROR;
syncCheckboxes();
Flush( true ); Flush( true );
} }
@ -355,6 +356,7 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowInfos( wxCommandEvent& event )
else else
m_severities &= ~REPORTER::RPT_INFO; m_severities &= ~REPORTER::RPT_INFO;
syncCheckboxes();
Flush( true ); Flush( true );
} }
@ -366,6 +368,7 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowActions( wxCommandEvent& event )
else else
m_severities &= ~REPORTER::RPT_ACTION; m_severities &= ~REPORTER::RPT_ACTION;
syncCheckboxes();
Flush( true ); Flush( true );
} }
@ -423,12 +426,9 @@ void WX_HTML_REPORT_PANEL::SetLabel( const wxString& aLabel )
void WX_HTML_REPORT_PANEL::SetVisibleSeverities( int aSeverities ) void WX_HTML_REPORT_PANEL::SetVisibleSeverities( int aSeverities )
{ {
if( aSeverities < 0 ) if( aSeverities < 0 )
m_showAll = true; m_severities = REPORTER::RPT_ALL;
else else
{
m_showAll = false;
m_severities = aSeverities; m_severities = aSeverities;
}
syncCheckboxes(); syncCheckboxes();
} }
@ -436,5 +436,5 @@ void WX_HTML_REPORT_PANEL::SetVisibleSeverities( int aSeverities )
int WX_HTML_REPORT_PANEL::GetVisibleSeverities() int WX_HTML_REPORT_PANEL::GetVisibleSeverities()
{ {
return m_showAll ? m_severities | 0x80000000 : m_severities & ~0x80000000; return m_severities;
} }

View File

@ -129,9 +129,6 @@ private:
///> message severities to display (mask) ///> message severities to display (mask)
int m_severities; int m_severities;
///> show all messages flag (overrides m_severities)
bool m_showAll;
bool m_lazyUpdate; bool m_lazyUpdate;
}; };

View File

@ -79,6 +79,8 @@ public:
RPT_ERROR = 0x8 RPT_ERROR = 0x8
}; };
static constexpr int RPT_ALL = RPT_INFO | RPT_ACTION | RPT_WARNING | RPT_ERROR;
/** /**
* Location where the message is to be reported. * Location where the message is to be reported.
* LOC_HEAD messages are printed before all others (typically intro messages) * LOC_HEAD messages are printed before all others (typically intro messages)