diff --git a/pcbnew/dialogs/dialog_export_vrml.cpp b/pcbnew/dialogs/dialog_export_vrml.cpp
index a56eed304a..286a5e7125 100644
--- a/pcbnew/dialogs/dialog_export_vrml.cpp
+++ b/pcbnew/dialogs/dialog_export_vrml.cpp
@@ -7,7 +7,7 @@
*
* Copyright (C) 2009-2013 Lorenzo Mercantonio
* Copyright (C) 2013 Jean-Pierre Charras jp.charras at wanadoo.fr
- * Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -54,7 +54,7 @@ private:
wxConfigBase* m_config;
int m_unitsOpt; // Remember last units option
bool m_copy3DFilesOpt; // Remember last copy model files option
- bool m_useRelativePathsOpt; // Remember last use absolut paths option
+ bool m_useRelativePathsOpt; // Remember last use absolute paths option
bool m_usePlainPCBOpt; // Remember last Plain Board option
int m_RefUnits; // Remember last units for Reference Point
double m_XRef; // Remember last X Reference Point
@@ -85,11 +85,7 @@ public:
tmpStr = wxT( "" );
tmpStr << m_YRef;
m_VRML_Yref->SetValue( tmpStr );
- wxButton* okButton = (wxButton*) FindWindowByLabel( wxT( "OK" ) );
-
- if( okButton )
- SetDefaultItem( okButton );
-
+ m_sdbSizer1OK->SetDefault();
GetSizer()->SetSizeHints( this );
Centre();
@@ -165,18 +161,30 @@ public:
// Making path relative or absolute has no meaning when VRML files are not copied.
event.Enable( m_cbCopyFiles->GetValue() );
}
+
+ virtual void OnFileChanged( wxFileDirPickerEvent& event )
+ {
+ // Clicking on file picker button changes the focus to the file picker button which
+ // is not the behavior we want. Set the focus back to the OK button so the next enter
+ // key press dismisses this dialog with the OK action.
+ m_sdbSizer1OK->SetFocus();
+ }
+
};
void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
{
+ static wxString mruPath;
+ static wxString subDirFor3Dshapes;
wxFileName fn;
wxString projectPath;
if( !wxGetEnv( wxT( "KIPRJMOD" ), &projectPath ) )
projectPath = wxFileName::GetCwd();
- static wxString subDirFor3Dshapes;
+ if( mruPath.IsEmpty() )
+ mruPath = projectPath;
if( subDirFor3Dshapes.IsEmpty() )
{
@@ -191,6 +199,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
// Build default file name
fn = GetBoard()->GetFileName();
fn.SetExt( wxT( "wrl" ) );
+ fn.SetPath( mruPath );
DIALOG_EXPORT_3DFILE dlg( this );
dlg.FilePicker()->SetPath( fn.GetFullPath() );
@@ -219,6 +228,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
modelPath.AppendDir( dlg.GetSubdir() );
subDirFor3Dshapes = dlg.GetSubdir();
+ mruPath = dlg.FilePicker()->GetPath();
wxLogDebug( wxT( "Exporting enabled=%d to %s." ),
export3DFiles, GetChars( subDirFor3Dshapes ) );
@@ -232,7 +242,7 @@ void PCB_EDIT_FRAME::OnExportVRML( wxCommandEvent& event )
usePlainPCB, modelPath.GetPath(),
aXRef, aYRef ) )
{
- wxString msg = _( "Unable to create " ) + fullFilename;
+ wxString msg = _( "Unable to create file " ) + fullFilename;
wxMessageBox( msg );
return;
}
diff --git a/pcbnew/dialogs/dialog_export_vrml_base.cpp b/pcbnew/dialogs/dialog_export_vrml_base.cpp
index 936cbbe12f..e04f19b461 100644
--- a/pcbnew/dialogs/dialog_export_vrml_base.cpp
+++ b/pcbnew/dialogs/dialog_export_vrml_base.cpp
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
-// C++ code generated with wxFormBuilder (version Jun 17 2015)
+// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@@ -128,6 +128,9 @@ DIALOG_EXPORT_3DFILE_BASE::DIALOG_EXPORT_3DFILE_BASE( wxWindow* parent, wxWindow
bSizer1->Add( bLowerSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
+
+ bSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
+
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer1->Add( m_staticline1, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
@@ -143,8 +146,10 @@ DIALOG_EXPORT_3DFILE_BASE::DIALOG_EXPORT_3DFILE_BASE( wxWindow* parent, wxWindow
this->SetSizer( bSizer1 );
this->Layout();
+ bSizer1->Fit( this );
// Connect Events
+ m_filePicker->Connect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnFileChanged ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnOkClick ), NULL, this );
}
@@ -152,6 +157,7 @@ DIALOG_EXPORT_3DFILE_BASE::DIALOG_EXPORT_3DFILE_BASE( wxWindow* parent, wxWindow
DIALOG_EXPORT_3DFILE_BASE::~DIALOG_EXPORT_3DFILE_BASE()
{
// Disconnect Events
+ m_filePicker->Disconnect( wxEVT_COMMAND_FILEPICKER_CHANGED, wxFileDirPickerEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnFileChanged ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EXPORT_3DFILE_BASE::OnOkClick ), NULL, this );
diff --git a/pcbnew/dialogs/dialog_export_vrml_base.fbp b/pcbnew/dialogs/dialog_export_vrml_base.fbp
index 53a2e67eb6..ab8d857882 100644
--- a/pcbnew/dialogs/dialog_export_vrml_base.fbp
+++ b/pcbnew/dialogs/dialog_export_vrml_base.fbp
@@ -44,7 +44,7 @@
DIALOG_EXPORT_3DFILE_BASE
- 384,370
+ -1,-1
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
DIALOG_SHIM; dialog_shim.h
VRML Export Options
@@ -93,11 +93,11 @@
bSizer1
wxVERTICAL
none
-