Dialog DRC: fix a minor bug created in rev 6936: the report file was always created, regardless the option selected in the check box.

Enhancement: the browse file dialog nows open the project folder by default.
This commit is contained in:
jean-pierre charras 2016-06-17 08:24:54 +02:00
parent 66f8a0c1b5
commit 0862ac28d0
1 changed files with 23 additions and 27 deletions

View File

@ -51,10 +51,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) :
InitValues(); InitValues();
if( GetSizer() )
{
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
}
Centre(); Centre();
} }
@ -153,7 +150,9 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
{ {
wxString reportName; wxString reportName;
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt bool make_report = m_CreateRptCtrl->IsChecked();
if( make_report ) // Create a rpt file
{ {
reportName = m_RptFilenameCtrl->GetValue(); reportName = m_RptFilenameCtrl->GetValue();
@ -162,16 +161,17 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event )
wxCommandEvent dummy; wxCommandEvent dummy;
OnButtonBrowseRptFileClick( dummy ); OnButtonBrowseRptFileClick( dummy );
} }
}
if( !reportName.IsEmpty() )
reportName = makeValidFileNameReport(); reportName = makeValidFileNameReport();
}
SetDrcParmeters(); SetDrcParmeters();
m_tester->SetSettings( true, // Pad to pad DRC test enabled m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled true, // unconnected pads DRC test enabled
true, // DRC test for zones enabled true, // DRC test for zones enabled
true, // DRC test for keepout areas enabled true, // DRC test for keepout areas enabled
reportName, m_CreateRptCtrl->IsChecked() ); reportName, make_report );
DelDRCMarkers(); DelDRCMarkers();
@ -219,7 +219,9 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
{ {
wxString reportName; wxString reportName;
if( m_CreateRptCtrl->IsChecked() ) // Create a file rpt bool make_report = m_CreateRptCtrl->IsChecked();
if( make_report ) // Create a file rpt
{ {
reportName = m_RptFilenameCtrl->GetValue(); reportName = m_RptFilenameCtrl->GetValue();
@ -228,17 +230,18 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
wxCommandEvent junk; wxCommandEvent junk;
OnButtonBrowseRptFileClick( junk ); OnButtonBrowseRptFileClick( junk );
} }
}
if( !reportName.IsEmpty() )
reportName = makeValidFileNameReport(); reportName = makeValidFileNameReport();
}
SetDrcParmeters(); SetDrcParmeters();
m_tester->SetSettings( true, // Pad to pad DRC test enabled m_tester->SetSettings( true, // Pad to pad DRC test enabled
true, // unconnected pdas DRC test enabled true, // unconnected pads DRC test enabled
true, // DRC test for zones enabled true, // DRC test for zones enabled
true, // DRC test for keepout areas enabled true, // DRC test for keepout areas enabled
reportName, m_CreateRptCtrl->IsChecked() ); reportName, make_report );
DelDRCMarkers(); DelDRCMarkers();
@ -273,22 +276,15 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event )
} }
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_BROWSE_RPT_FILE
*/
void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event ) void DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick( wxCommandEvent& event )
{ {
wxFileName fn; wxFileName fn = m_Parent->GetBoard()->GetFileName();
wxString wildcard( _( "DRC report files (.rpt)|*.rpt" ) ); fn.SetExt( ReportFileExtension );
wxString Ext( wxT( "rpt" ) ); wxString prj_path = Prj().GetProjectPath();
fn = m_Parent->GetBoard()->GetFileName() + wxT( "-drc" ); wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path,
fn.SetExt( Ext ); fn.GetFullName(), ReportFileWildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxFileDialog dlg( this, _( "Save DRC Report File" ), wxEmptyString,
fn.GetFullName(), wildcard,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR );
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return; return;