@ -50,7 +50,7 @@
# include <wx_html_report_panel.h>
# include <wx_html_report_panel.h>
# define NETLIST_SILENTMODE_KEY wxT("SilentMode")
# define NETLIST_SILENTMODE_KEY wxT("SilentMode")
# define NETLIST_FULLMESSAGES_KEY wxT("NetlistReportAll Msg")
# define NETLIST_FILTER_MESSAGES_KEY wxT("NetlistReportFilter Msg")
# define NETLIST_DELETESINGLEPADNETS_KEY wxT("NetlistDeleteSinglePadNets")
# define NETLIST_DELETESINGLEPADNETS_KEY wxT("NetlistDeleteSinglePadNets")
void PCB_EDIT_FRAME : : InstallNetlistFrame ( wxDC * DC )
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,
/* 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 .
* 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 = GetBoard ( ) - > GetFileName ( ) ;
fn . SetExt ( NetlistFileExtension ) ;
fn . SetExt ( NetlistFileExtension ) ;
lastN etlistName = fn . GetFullPath ( ) ;
n etlistName = fn . GetFullPath ( ) ;
}
}
DIALOG_NETLIST dlg ( this , DC , lastN etlistName ) ;
DIALOG_NETLIST dlg ( this , DC , n etlistName ) ;
dlg . ShowModal ( ) ;
dlg . ShowModal ( ) ;
// Save project settings if needed.
// Save project settings if needed.
// Project settings are saved in the corresponding <board name>.pro file
// Project settings are saved in the corresponding <board name>.pro file
bool configChanged = lastN etlistName ! = GetLastNetListRead ( ) ;
bool configChanged = ! GetLastNetListRead ( ) . IsEmpty ( ) & & ( n etlistName ! = GetLastNetListRead ( ) ) ;
if ( configChanged & & ! GetBoard ( ) - > GetFileName ( ) . IsEmpty ( )
if ( configChanged & & ! GetBoard ( ) - > GetFileName ( ) . IsEmpty ( )
& & IsOK ( NULL , _ ( " The project configuration has changed. Do you want to save it? " ) ) )
& & 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_parent = aParent ;
m_dc = aDC ;
m_dc = aDC ;
m_config = Kiface ( ) . KifaceSettings ( ) ;
m_config = Kiface ( ) . KifaceSettings ( ) ;
m_silentMode = m_config - > Read ( NETLIST_SILENTMODE_KEY , 0l ) ;
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 ) ;
bool tmp = m_config - > Read ( NETLIST_DELETESINGLEPADNETS_KEY , 0l ) ;
m_rbSingleNets - > SetSelection ( tmp = = 0 ? 0 : 1 ) ;
m_rbSingleNets - > SetSelection ( tmp = = 0 ? 0 : 1 ) ;
m_NetlistFilenameCtrl - > SetValue ( aNetlistFullFilename ) ;
m_NetlistFilenameCtrl - > SetValue ( aNetlistFullFilename ) ;
m_checkBoxSilentMode - > SetValue ( m_silentMode ) ;
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 ) ;
GetSizer ( ) - > SetSizeHints ( this ) ;
}
}
@ -111,9 +114,10 @@ DIALOG_NETLIST::DIALOG_NETLIST( PCB_EDIT_FRAME* aParent, wxDC * aDC,
DIALOG_NETLIST : : ~ DIALOG_NETLIST ( )
DIALOG_NETLIST : : ~ DIALOG_NETLIST ( )
{
{
m_config - > Write ( NETLIST_SILENTMODE_KEY , ( long ) m_silentMode ) ;
m_config - > Write ( NETLIST_SILENTMODE_KEY , ( long ) m_silentMode ) ;
m_config - > Write ( NETLIST_FULLMESSAGES_KEY , ( long ) m_reportAll ) ;
m_config - > Write ( NETLIST_DELETESINGLEPADNETS_KEY ,
m_config - > Write ( NETLIST_DELETESINGLEPADNETS_KEY ,
( long ) m_rbSingleNets - > GetSelection ( ) ) ;
( 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 ( ) ) ;
m_NetlistFilenameCtrl - > SetValue ( FilesDialog . GetPath ( ) ) ;
}
}
void DIALOG_NETLIST : : OnReadNetlistFileClick ( wxCommandEvent & event )
void DIALOG_NETLIST : : OnReadNetlistFileClick ( wxCommandEvent & event )
{
{
wxString msg ;
wxString msg ;
@ -173,6 +176,8 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event )
msg = _ ( " Using references to match components and footprints. \n " ) ;
msg = _ ( " Using references to match components and footprints. \n " ) ;
reporter . Report ( msg , REPORTER : : RPT_INFO ) ;
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_parent - > ReadPcbNetlist ( netlistFileName , wxEmptyString , & reporter ,
m_ChangeExistingFootprintCtrl - > GetSelection ( ) = = 1 ,
m_ChangeExistingFootprintCtrl - > GetSelection ( ) = = 1 ,
@ -181,6 +186,9 @@ void DIALOG_NETLIST::OnReadNetlistFileClick( wxCommandEvent& event )
m_Select_By_Timestamp - > GetSelection ( ) = = 1 ,
m_Select_By_Timestamp - > GetSelection ( ) = = 1 ,
m_rbSingleNets - > GetSelection ( ) = = 1 ,
m_rbSingleNets - > GetSelection ( ) = = 1 ,
m_checkDryRun - > GetValue ( ) ) ;
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 ) ;
wxMessageBox ( msg , _ ( " File Write Error " ) , wxOK | wxICON_ERROR , this ) ;
return ;
return ;
}
}
//f.Write( m_MessageWindow->GetValue() );
}
}