From 0862ac28d0bd1645d68d919a07e5ab79989a180b Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 17 Jun 2016 08:24:54 +0200 Subject: [PATCH] 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. --- pcbnew/dialogs/dialog_drc.cpp | 50 ++++++++++++++++------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 6e915b6fd7..3cd6ded8fd 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -51,10 +51,7 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* parent ) : InitValues(); - if( GetSizer() ) - { - GetSizer()->SetSizeHints( this ); - } + GetSizer()->SetSizeHints( this ); Centre(); } @@ -153,7 +150,9 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event ) { 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(); @@ -162,16 +161,17 @@ void DIALOG_DRC_CONTROL::OnStartdrcClick( wxCommandEvent& event ) wxCommandEvent dummy; OnButtonBrowseRptFileClick( dummy ); } - } - reportName = makeValidFileNameReport(); + if( !reportName.IsEmpty() ) + reportName = makeValidFileNameReport(); + } SetDrcParmeters(); 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 keepout areas enabled - reportName, m_CreateRptCtrl->IsChecked() ); + reportName, make_report ); DelDRCMarkers(); @@ -219,7 +219,9 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event ) { 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(); @@ -228,17 +230,18 @@ void DIALOG_DRC_CONTROL::OnListUnconnectedClick( wxCommandEvent& event ) wxCommandEvent junk; OnButtonBrowseRptFileClick( junk ); } - } - reportName = makeValidFileNameReport(); + if( !reportName.IsEmpty() ) + reportName = makeValidFileNameReport(); + } SetDrcParmeters(); 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 keepout areas enabled - reportName, m_CreateRptCtrl->IsChecked() ); + reportName, make_report ); 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 ) { - wxFileName fn; - wxString wildcard( _( "DRC report files (.rpt)|*.rpt" ) ); - wxString Ext( wxT( "rpt" ) ); + wxFileName fn = m_Parent->GetBoard()->GetFileName(); + fn.SetExt( ReportFileExtension ); + wxString prj_path = Prj().GetProjectPath(); - fn = m_Parent->GetBoard()->GetFileName() + wxT( "-drc" ); - fn.SetExt( Ext ); - - wxFileDialog dlg( this, _( "Save DRC Report File" ), wxEmptyString, - fn.GetFullName(), wildcard, - wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxFD_CHANGE_DIR ); + wxFileDialog dlg( this, _( "Save DRC Report File" ), prj_path, + fn.GetFullName(), ReportFileWildcard, + wxFD_SAVE | wxFD_OVERWRITE_PROMPT ); if( dlg.ShowModal() == wxID_CANCEL ) return;