DIALOG_EXPORT_STEP: fix missing init of m_outputFileName widget at opening.

Add also a validity test for the filename.
This commit is contained in:
jean-pierre charras 2023-10-29 10:13:08 +01:00
parent 7628879190
commit acda18465c
1 changed files with 10 additions and 1 deletions

View File

@ -141,6 +141,7 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
{ wxID_CANCEL, _( "Close" ) } } );
// Build default output file name
// (last saved filename in project or built from board filename)
wxString path = m_parent->GetLastPath( LAST_PATH_STEP );
if( path.IsEmpty() )
@ -150,6 +151,8 @@ DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP( PCB_EDIT_FRAME* aParent, const wxString&
path = brdFile.GetFullPath();
}
m_outputFileName->SetValue( path );
Layout();
bSizerSTEPFile->Fit( this );
@ -342,7 +345,7 @@ void DIALOG_EXPORT_STEP::onBrowseClicked( wxCommandEvent& aEvent )
wxFileName fn( Prj().AbsolutePath( path ) );
wxFileDialog dlg( this, _( "STEP Output File" ), fn.GetPath(), fn.GetFullName(), filter,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxFD_SAVE );
if( dlg.ShowModal() == wxID_CANCEL )
return;
@ -358,6 +361,12 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
path = ExpandEnvVarSubstitutions( path, &Prj() );
if( path.IsEmpty() )
{
DisplayErrorMessage( this, _( "No filename for output file" ) );
return;
}
double tolerance; // default value in mm
m_toleranceLastChoice = m_choiceTolerance->GetSelection();
m_exportTracks = m_cbExportTracks->GetValue();