Default and most recently used path fixes. (fixes: 1494210)

* Rename Eda_FileSelector to EDA_FILE_SELECTOR.
* Add optional pointer to wxString to save the most recently used path to EDA_FILE_SELECTOR.
* Rename Eda_DirectorySelector to EDA_PATH_SELECTOR.
* Replace wxGetCwd() with wxStandardPaths::GetDocumentsDir().  This fixes the windows issue
  where wxGetCwd() returns the path where the executable files are located.
* Add code to handle most recently used path to EDA_BASE_FRAME.
* Fix string formatting error in kicad/files-io.cpp.
* Remove setting and restoring current working directory when launching GerbView.  Setting the CWD
  has no effect on the launched executable which starts with it's own CWD.
* Allow project path to be passed to GerbView when launched from KiCad.
* Note: this is a work in progress.  Do not expect every path and/or file selection dialog to properly
  update the most recently used path.  The correct solution to this problem requires a much more
  well though out solution which will not happen until after the next stable release.
This commit is contained in:
Wayne Stambaugh
2015-09-25 15:38:09 -04:00
parent be8b0b4823
commit a6a9d8eedf
32 changed files with 292 additions and 224 deletions
+6 -1
View File
@@ -33,6 +33,7 @@
#include <wx/clipbrd.h>
#include <wx/statline.h>
#include <wx/platinfo.h>
#include <wx/stdpaths.h>
#include <build_version.h>
#include <fctsys.h>
@@ -61,6 +62,8 @@ static const wxChar entryAutoSaveInterval[] = wxT( "AutoSaveInterval" );
/// Configuration file entry for wxAuiManger perspective.
static const wxChar entryPerspective[] = wxT( "Perspective" );
/// Configuration file entry for most recently used path.
static const wxChar entryMruPath[] = wxT( "MostRecentlyUsedPath" );
EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
@@ -76,7 +79,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
m_autoSaveState = false;
m_autoSaveInterval = -1;
m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
m_mruPath = wxStandardPaths::Get().GetDocumentsDir();
minsize.x = 470;
minsize.y = 350;
@@ -265,6 +268,7 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
Maximize();
aCfg->Read( baseCfgName + entryPerspective, &m_perspective );
aCfg->Read( baseCfgName + entryMruPath, &m_mruPath );
}
@@ -309,6 +313,7 @@ void EDA_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
// printf( "perspective(%s): %s\n",
// TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );
aCfg->Write( baseCfgName + entryPerspective, perspective );
aCfg->Write( baseCfgName + entryMruPath, m_mruPath );
}