diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp index 3c7b4d1976..57434462cd 100644 --- a/common/dialogs/wx_html_report_panel.cpp +++ b/common/dialogs/wx_html_report_panel.cpp @@ -170,6 +170,7 @@ void WX_HTML_REPORT_PANEL::onCheckBoxShowAll( wxCommandEvent& event ) void WX_HTML_REPORT_PANEL::syncCheckboxes() { + m_checkBoxShowAll->SetValue( m_showAll ); m_checkBoxShowWarnings->Enable( !m_showAll ); m_checkBoxShowWarnings->SetValue( m_severities & REPORTER::RPT_WARNING ); m_checkBoxShowErrors->Enable( !m_showAll ); @@ -184,9 +185,9 @@ void WX_HTML_REPORT_PANEL::syncCheckboxes() void WX_HTML_REPORT_PANEL::onCheckBoxShowWarnings( wxCommandEvent& event ) { if ( event.IsChecked() ) - m_severities |= REPORTER::RPT_WARNING; - else - m_severities &= ~REPORTER::RPT_WARNING; + m_severities |= REPORTER::RPT_WARNING; + else + m_severities &= ~REPORTER::RPT_WARNING; refreshView(); } @@ -272,3 +273,23 @@ void WX_HTML_REPORT_PANEL::SetLabel( const wxString& aLabel ) { m_box->GetStaticBox()->SetLabel( aLabel ); } + + +void WX_HTML_REPORT_PANEL::SetVisibleSeverities( int aSeverities ) +{ + if( aSeverities < 0 ) + m_showAll = true; + else + { + m_showAll = false; + m_severities = aSeverities; + } + + syncCheckboxes(); +} + + +int WX_HTML_REPORT_PANEL::GetVisibleSeverities() +{ + return m_showAll ? m_severities | 0x80000000 : m_severities & ~0x80000000; +} diff --git a/common/dialogs/wx_html_report_panel.h b/common/dialogs/wx_html_report_panel.h index 6442cf3c3f..6e98d0e256 100644 --- a/common/dialogs/wx_html_report_panel.h +++ b/common/dialogs/wx_html_report_panel.h @@ -66,12 +66,13 @@ public: ///> Forces updating the HTML page, after the report is built in lazy mode void Flush(); - void SetVisibleSeverities( int aSeverities ) - { - m_showAll = false; - m_severities = aSeverities; - syncCheckboxes(); - } + ///> Set the visible severity filter. + ///> if aSeverities < 0 the m_showAll option is set + void SetVisibleSeverities( int aSeverities ); + + ///> @return the visible severity filter. + ///> If the m_showAll option is set, the mask is < 0 + int GetVisibleSeverities(); private: struct REPORT_LINE diff --git a/pcbnew/dialogs/dialog_netlist.cpp b/pcbnew/dialogs/dialog_netlist.cpp index 5e1202e6e0..8eae523234 100644 --- a/pcbnew/dialogs/dialog_netlist.cpp +++ b/pcbnew/dialogs/dialog_netlist.cpp @@ -50,7 +50,7 @@ #include #define NETLIST_SILENTMODE_KEY wxT("SilentMode") -#define NETLIST_FULLMESSAGES_KEY wxT("NetlistReportAllMsg") +#define NETLIST_FILTER_MESSAGES_KEY wxT("NetlistReportFilterMsg") #define NETLIST_DELETESINGLEPADNETS_KEY wxT("NetlistDeleteSinglePadNets") void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) @@ -58,23 +58,24 @@ void PCB_EDIT_FRAME::InstallNetlistFrame( wxDC* DC ) /* Setup the netlist file name to the last netlist file read, * or the board file name if the last filename is empty or last file not existing. */ - wxFileName fn = GetLastNetListRead(); - wxString lastNetlistName = GetLastNetListRead(); + wxString netlistName = GetLastNetListRead(); - if( !fn.FileExists() ) + wxFileName fn = netlistName; + + if( !fn.IsOk() || !fn.FileExists() ) { fn = GetBoard()->GetFileName(); fn.SetExt( NetlistFileExtension ); - lastNetlistName = fn.GetFullPath(); + netlistName = fn.GetFullPath(); } - DIALOG_NETLIST dlg( this, DC, lastNetlistName ); + DIALOG_NETLIST dlg( this, DC, netlistName ); dlg.ShowModal(); // Save project settings if needed. // Project settings are saved in the corresponding .pro file - bool configChanged = lastNetlistName != GetLastNetListRead(); + bool configChanged = !GetLastNetListRead().IsEmpty() && ( netlistName != GetLastNetListRead() ); if( configChanged && !GetBoard()->GetFileName().IsEmpty() && IsOK( NULL, _( "The project configuration has changed. Do you want to save it?" ) ) ) @@ -97,13 +98,15 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, m_parent = aParent; m_dc = aDC; m_config = Kiface().KifaceSettings(); + m_silentMode = m_config->Read( NETLIST_SILENTMODE_KEY, 0l ); - m_reportAll = m_config->Read( NETLIST_FULLMESSAGES_KEY, 1l ); bool tmp = m_config->Read( NETLIST_DELETESINGLEPADNETS_KEY, 0l ); m_rbSingleNets->SetSelection( tmp == 0 ? 0 : 1); m_NetlistFilenameCtrl->SetValue( aNetlistFullFilename ); m_checkBoxSilentMode->SetValue( m_silentMode ); - m_checkBoxFullMessages->SetValue( m_reportAll ); + + int severities = m_config->Read( NETLIST_FILTER_MESSAGES_KEY, -1l ); + m_MessageWindow->SetVisibleSeverities( severities ); GetSizer()->SetSizeHints( this ); } @@ -111,9 +114,10 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC, DIALOG_NETLIST::~DIALOG_NETLIST() { m_config->Write( NETLIST_SILENTMODE_KEY, (long) m_silentMode ); - m_config->Write( NETLIST_FULLMESSAGES_KEY, (long) m_reportAll ); m_config->Write( NETLIST_DELETESINGLEPADNETS_KEY, (long) m_rbSingleNets->GetSelection() ); + m_config->Write( NETLIST_FILTER_MESSAGES_KEY, + (long) m_MessageWindow->GetVisibleSeverities() ); } @@ -146,7 +150,6 @@ void DIALOG_NETLIST::OnOpenNetlistClick( wxCommandEvent& event ) m_NetlistFilenameCtrl->SetValue( FilesDialog.GetPath() ); } - void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) { wxString msg; @@ -173,6 +176,8 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) msg = _( "Using references to match components and footprints.\n" ); reporter.Report( msg, REPORTER::RPT_INFO ); + m_MessageWindow->SetLazyUpdate( true ); // use a "lazy" update to speed up the creation of the report + // (The window is not updated for each message) m_parent->ReadPcbNetlist( netlistFileName, wxEmptyString, &reporter, m_ChangeExistingFootprintCtrl->GetSelection() == 1, @@ -181,6 +186,9 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event ) m_Select_By_Timestamp->GetSelection() == 1, m_rbSingleNets->GetSelection() == 1, m_checkDryRun->GetValue() ); + // The creation of the report was made without window update: + // the full page must be displayed + m_MessageWindow->Flush(); } @@ -356,8 +364,6 @@ void DIALOG_NETLIST::OnSaveMessagesToFile( wxCommandEvent& aEvent ) wxMessageBox( msg, _( "File Write Error" ), wxOK | wxICON_ERROR, this ); return; } - - //f.Write( m_MessageWindow->GetValue() ); } diff --git a/pcbnew/dialogs/dialog_netlist.h b/pcbnew/dialogs/dialog_netlist.h index b2050e9441..958a7e07a6 100644 --- a/pcbnew/dialogs/dialog_netlist.h +++ b/pcbnew/dialogs/dialog_netlist.h @@ -41,9 +41,7 @@ private: PCB_EDIT_FRAME* m_parent; wxDC* m_dc; bool m_silentMode; // if true, do not display warning message about undo - bool m_reportAll; // If true report all messages, - // false, report only warnings or errors - wxConfigBase* m_config; + wxConfigBase* m_config; public: DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC* aDC, const wxString & aNetlistFullFilename ); @@ -90,10 +88,6 @@ private: { m_silentMode = m_checkBoxSilentMode->GetValue(); } - void OnClickFullMessages( wxCommandEvent& event ) - { - m_reportAll = m_checkBoxFullMessages->GetValue(); - } void OnUpdateUISaveMessagesToFile( wxUpdateUIEvent& aEvent ); void OnUpdateUIValidNetlistFile( wxUpdateUIEvent& aEvent ); diff --git a/pcbnew/dialogs/dialog_netlist_fbp.cpp b/pcbnew/dialogs/dialog_netlist_fbp.cpp index af2b8fdacd..343895cb14 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.cpp +++ b/pcbnew/dialogs/dialog_netlist_fbp.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -130,12 +130,6 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w bCenterSizer->Add( m_checkBoxSilentMode, 0, wxRIGHT|wxLEFT, 5 ); - m_checkBoxFullMessages = new wxCheckBox( this, wxID_ANY, _("Display all messages"), wxDefaultPosition, wxDefaultSize, 0 ); - m_checkBoxFullMessages->SetValue(true); - m_checkBoxFullMessages->SetToolTip( _("Messages filter:\nIf checked: show all messages when reading the netlist\nIf not checked: show only warning or error messages") ); - - bCenterSizer->Add( m_checkBoxFullMessages, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); - bMainSizer->Add( bCenterSizer, 0, wxALL|wxEXPAND, 5 ); @@ -185,7 +179,6 @@ DIALOG_NETLIST_FBP::DIALOG_NETLIST_FBP( wxWindow* parent, wxWindowID id, const w m_buttonSaveMessages->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnSaveMessagesToFile ), NULL, this ); m_buttonSaveMessages->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUISaveMessagesToFile ), NULL, this ); m_checkBoxSilentMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickSilentMode ), NULL, this ); - m_checkBoxFullMessages->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickFullMessages ), NULL, this ); m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNetlistClick ), NULL, this ); } @@ -202,7 +195,6 @@ DIALOG_NETLIST_FBP::~DIALOG_NETLIST_FBP() m_buttonSaveMessages->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnSaveMessagesToFile ), NULL, this ); m_buttonSaveMessages->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( DIALOG_NETLIST_FBP::OnUpdateUISaveMessagesToFile ), NULL, this ); m_checkBoxSilentMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickSilentMode ), NULL, this ); - m_checkBoxFullMessages->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnClickFullMessages ), NULL, this ); m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_NETLIST_FBP::OnOpenNetlistClick ), NULL, this ); } diff --git a/pcbnew/dialogs/dialog_netlist_fbp.fbp b/pcbnew/dialogs/dialog_netlist_fbp.fbp index 6d24370836..7240e07b0b 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.fbp +++ b/pcbnew/dialogs/dialog_netlist_fbp.fbp @@ -1315,94 +1315,6 @@ - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - 1 - 1 - 1 - 1 - - - - - - - - 1 - 0 - 1 - 1 - - 1 - 0 - Dock - 0 - Left - 1 - - 1 - - 0 - 0 - wxID_ANY - Display all messages - - 0 - - - 0 - - 1 - m_checkBoxFullMessages - 1 - - - protected - 1 - - Resizable - 1 - - - - 0 - Messages filter: If checked: show all messages when reading the netlist If not checked: show only warning or error messages - - wxFILTER_NONE - wxDefaultValidator - - - - - - OnClickFullMessages - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/pcbnew/dialogs/dialog_netlist_fbp.h b/pcbnew/dialogs/dialog_netlist_fbp.h index d35e9fdd72..db56cbfe60 100644 --- a/pcbnew/dialogs/dialog_netlist_fbp.h +++ b/pcbnew/dialogs/dialog_netlist_fbp.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Jun 5 2014) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -61,7 +61,6 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM wxStaticLine* m_staticline11; wxCheckBox* m_checkDryRun; wxCheckBox* m_checkBoxSilentMode; - wxCheckBox* m_checkBoxFullMessages; wxStaticLine* m_staticline1; wxStaticText* m_staticTextNetfilename; wxTextCtrl* m_NetlistFilenameCtrl; @@ -77,7 +76,6 @@ class DIALOG_NETLIST_FBP : public DIALOG_SHIM virtual void OnSaveMessagesToFile( wxCommandEvent& event ) { event.Skip(); } virtual void OnUpdateUISaveMessagesToFile( wxUpdateUIEvent& event ) { event.Skip(); } virtual void OnClickSilentMode( wxCommandEvent& event ) { event.Skip(); } - virtual void OnClickFullMessages( wxCommandEvent& event ) { event.Skip(); } virtual void OnOpenNetlistClick( wxCommandEvent& event ) { event.Skip(); }