Pcbnew: Fix some issues in dialog netlist: remove useless check box, avoid a message sometimes erroneously shown, use lazy mode to build the netlist report, store the netlist report options in user config.

This commit is contained in:
jean-pierre charras 2015-07-24 20:49:47 +02:00
parent e4c8854159
commit ee08e8d1de
7 changed files with 53 additions and 129 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -50,7 +50,7 @@
#include <wx_html_report_panel.h>
#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 <board name>.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() );
}

View File

@ -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 );

View File

@ -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 );
}

View File

@ -1315,94 +1315,6 @@
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">1</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Display all messages</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxFullMessages</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Messages filter:&#x0A;If checked: show all messages when reading the netlist&#x0A;If not checked: show only warning or error messages</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnClickFullMessages</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">

View File

@ -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(); }