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:
parent
be8b0b4823
commit
a6a9d8eedf
|
@ -651,9 +651,9 @@ void EDA_3D_CANVAS::TakeScreenshot( wxCommandEvent& event )
|
||||||
mask = wxT( "*." ) + file_ext;
|
mask = wxT( "*." ) + file_ext;
|
||||||
fn.SetExt( file_ext );
|
fn.SetExt( file_ext );
|
||||||
|
|
||||||
FullFileName = EDA_FileSelector( _( "3D Image File Name:" ), fn.GetPath(),
|
FullFileName = EDA_FILE_SELECTOR( _( "3D Image File Name:" ), fn.GetPath(),
|
||||||
fn.GetFullName(), file_ext, mask, this,
|
fn.GetFullName(), file_ext, mask, this,
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT, true );
|
||||||
|
|
||||||
if( FullFileName.IsEmpty() )
|
if( FullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2010 jean-pierre.charras
|
* Copyright (C) 1992-2010 jean-pierre.charras
|
||||||
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2015 Kicad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -43,6 +43,7 @@
|
||||||
#include <kiway.h>
|
#include <kiway.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
|
|
||||||
|
|
||||||
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
#define KEYWORD_FRAME_POSX wxT( "Bmconverter_Pos_x" )
|
||||||
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
#define KEYWORD_FRAME_POSY wxT( "Bmconverter_Pos_y" )
|
||||||
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
#define KEYWORD_FRAME_SIZEX wxT( "Bmconverter_Size_x" )
|
||||||
|
@ -96,7 +97,7 @@ private:
|
||||||
void OnExport( wxCommandEvent& event );
|
void OnExport( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a schematic library which comtains one component:
|
* Generate a schematic library which contains one component:
|
||||||
* the logo
|
* the logo
|
||||||
*/
|
*/
|
||||||
void OnExportEeschema();
|
void OnExportEeschema();
|
||||||
|
@ -123,9 +124,9 @@ private:
|
||||||
void OnResolutionChange( wxCommandEvent& event );
|
void OnResolutionChange( wxCommandEvent& event );
|
||||||
|
|
||||||
// called when texts controls which handle the image resolution
|
// called when texts controls which handle the image resolution
|
||||||
// lose the focus, to ensure the rigyht vaules are displayed
|
// lose the focus, to ensure the right values are displayed
|
||||||
// because the m_imageDPI are clipped to acceptable values, and
|
// because the m_imageDPI are clipped to acceptable values, and
|
||||||
// the text displayed could be differ duringa text edition
|
// the text displayed could be differ during text edition
|
||||||
// We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
|
// We are using ChangeValue here to avoid generating a wxEVT_TEXT event.
|
||||||
void UpdateDPITextValueX( wxMouseEvent& event )
|
void UpdateDPITextValueX( wxMouseEvent& event )
|
||||||
{
|
{
|
||||||
|
@ -249,7 +250,7 @@ void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
|
||||||
m_BNPicturePanel->PrepareDC( nb_dc );
|
m_BNPicturePanel->PrepareDC( nb_dc );
|
||||||
|
|
||||||
// OSX crashes with empty bitmaps (on initial refreshes)
|
// OSX crashes with empty bitmaps (on initial refreshes)
|
||||||
if(m_Pict_Bitmap.IsOk() && m_Greyscale_Bitmap.IsOk() && m_BN_Bitmap.IsOk())
|
if( m_Pict_Bitmap.IsOk() && m_Greyscale_Bitmap.IsOk() && m_BN_Bitmap.IsOk() )
|
||||||
{
|
{
|
||||||
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, false );
|
pict_dc.DrawBitmap( m_Pict_Bitmap, 0, 0, false );
|
||||||
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, false );
|
greyscale_dc.DrawBitmap( m_Greyscale_Bitmap, 0, 0, false );
|
||||||
|
@ -258,19 +259,17 @@ void BM2CMP_FRAME::OnPaint( wxPaintEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Called to load a bitmap file
|
|
||||||
*/
|
|
||||||
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn( m_BitmapFileName );
|
wxFileName fn( m_BitmapFileName );
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
if( path.IsEmpty() || !wxDirExists(path) )
|
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||||
path = wxGetCwd();
|
path = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
wxFileDialog fileDlg( this, _( "Choose Image" ), path, wxEmptyString,
|
||||||
_( "Image Files " ) + wxImage::GetImageExtWildcard(),
|
_( "Image Files " ) + wxImage::GetImageExtWildcard(),
|
||||||
wxFD_OPEN );
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
int diag = fileDlg.ShowModal();
|
int diag = fileDlg.ShowModal();
|
||||||
|
|
||||||
|
@ -282,6 +281,8 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
|
||||||
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
if( !OpenProjectFiles( std::vector<wxString>( 1, fullFilename ) ) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
fn = fullFilename;
|
||||||
|
m_mruPath = fn.GetPath();
|
||||||
m_buttonExport->Enable( true );
|
m_buttonExport->Enable( true );
|
||||||
SetStatusText( fullFilename );
|
SetStatusText( fullFilename );
|
||||||
Refresh();
|
Refresh();
|
||||||
|
@ -349,11 +350,12 @@ bool BM2CMP_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, int
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::updateImageInfo()
|
void BM2CMP_FRAME::updateImageInfo()
|
||||||
{
|
{
|
||||||
// Note: the image resolution text controls are not modified
|
// Note: the image resolution text controls are not modified
|
||||||
// here, to avoid a race between text change when entered by user and
|
// here, to avoid a race between text change when entered by user and
|
||||||
// a text change if it is modifed here.
|
// a text change if it is modified here.
|
||||||
int h = m_Pict_Bitmap.GetHeight();
|
int h = m_Pict_Bitmap.GetHeight();
|
||||||
int w = m_Pict_Bitmap.GetWidth();
|
int w = m_Pict_Bitmap.GetWidth();
|
||||||
int nb = m_Pict_Bitmap.GetDepth();
|
int nb = m_Pict_Bitmap.GetDepth();
|
||||||
|
@ -368,6 +370,7 @@ void BM2CMP_FRAME::updateImageInfo()
|
||||||
(double) h / m_imageDPI.y * 25.4 ) );
|
(double) h / m_imageDPI.y * 25.4 ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnResolutionChange( wxCommandEvent& event )
|
void BM2CMP_FRAME::OnResolutionChange( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
long tmp;
|
long tmp;
|
||||||
|
@ -387,6 +390,7 @@ void BM2CMP_FRAME::OnResolutionChange( wxCommandEvent& event )
|
||||||
updateImageInfo();
|
updateImageInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void BM2CMP_FRAME::Binarize( double aThreshold )
|
void BM2CMP_FRAME::Binarize( double aThreshold )
|
||||||
{
|
{
|
||||||
unsigned int pixin;
|
unsigned int pixin;
|
||||||
|
@ -427,10 +431,10 @@ void BM2CMP_FRAME::NegateGreyscaleImage( )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called on Normal/Negative change option */
|
|
||||||
void BM2CMP_FRAME::OnOptionsSelection( wxCommandEvent& event )
|
void BM2CMP_FRAME::OnOptionsSelection( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
NegateGreyscaleImage( );
|
NegateGreyscaleImage();
|
||||||
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
m_Greyscale_Bitmap = wxBitmap( m_Greyscale_Image );
|
||||||
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
Binarize( (double)m_sliderThreshold->GetValue()/m_sliderThreshold->GetMax() );
|
||||||
Refresh();
|
Refresh();
|
||||||
|
@ -498,7 +502,7 @@ void BM2CMP_FRAME::OnExportLogo()
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "File '%s' could not be created" ), GetChars(m_ConvertedFileName) );
|
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -536,7 +540,7 @@ void BM2CMP_FRAME::OnExportPostScript()
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "File '%s' could not be created" ), GetChars( m_ConvertedFileName ) );
|
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -554,7 +558,7 @@ void BM2CMP_FRAME::OnExportEeschema()
|
||||||
if( path.IsEmpty() || !wxDirExists(path) )
|
if( path.IsEmpty() || !wxDirExists(path) )
|
||||||
path = ::wxGetCwd();
|
path = ::wxGetCwd();
|
||||||
|
|
||||||
wxFileDialog fileDlg( this, _( "Create a lib file for Eeschema" ),
|
wxFileDialog fileDlg( this, _( "Create a component library file for Eeschema" ),
|
||||||
path, wxEmptyString,
|
path, wxEmptyString,
|
||||||
wxGetTranslation( SchematicLibraryFileWildcard ),
|
wxGetTranslation( SchematicLibraryFileWildcard ),
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
@ -573,7 +577,7 @@ void BM2CMP_FRAME::OnExportEeschema()
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "File '%s' could not be created" ), GetChars( m_ConvertedFileName ) );
|
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -589,9 +593,9 @@ void BM2CMP_FRAME::OnExportPcbnew()
|
||||||
wxString path = fn.GetPath();
|
wxString path = fn.GetPath();
|
||||||
|
|
||||||
if( path.IsEmpty() || !wxDirExists( path ) )
|
if( path.IsEmpty() || !wxDirExists( path ) )
|
||||||
path = ::wxGetCwd();
|
path = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog fileDlg( this, _( "Create a footprint file for PcbNew" ),
|
wxFileDialog fileDlg( this, _( "Create a footprint file for Pcbnew" ),
|
||||||
path, wxEmptyString,
|
path, wxEmptyString,
|
||||||
wxGetTranslation( KiCadFootprintLibFileWildcard ),
|
wxGetTranslation( KiCadFootprintLibFileWildcard ),
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
@ -610,13 +614,14 @@ void BM2CMP_FRAME::OnExportPcbnew()
|
||||||
if( outfile == NULL )
|
if( outfile == NULL )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
msg.Printf( _( "File '%s' could not be created" ), GetChars( m_ConvertedFileName ) );
|
msg.Printf( _( "File '%s' could not be created." ), GetChars( m_ConvertedFileName ) );
|
||||||
wxMessageBox( msg );
|
wxMessageBox( msg );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportFile( outfile, PCBNEW_KICAD_MOD );
|
ExportFile( outfile, PCBNEW_KICAD_MOD );
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
|
m_mruPath = fn.GetPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include <wx/clipbrd.h>
|
#include <wx/clipbrd.h>
|
||||||
#include <wx/statline.h>
|
#include <wx/statline.h>
|
||||||
#include <wx/platinfo.h>
|
#include <wx/platinfo.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
|
@ -61,6 +62,8 @@ static const wxChar entryAutoSaveInterval[] = wxT( "AutoSaveInterval" );
|
||||||
/// Configuration file entry for wxAuiManger perspective.
|
/// Configuration file entry for wxAuiManger perspective.
|
||||||
static const wxChar entryPerspective[] = wxT( "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,
|
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_autoSaveState = false;
|
||||||
m_autoSaveInterval = -1;
|
m_autoSaveInterval = -1;
|
||||||
m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
|
m_autoSaveTimer = new wxTimer( this, ID_AUTO_SAVE_TIMER );
|
||||||
|
m_mruPath = wxStandardPaths::Get().GetDocumentsDir();
|
||||||
minsize.x = 470;
|
minsize.x = 470;
|
||||||
minsize.y = 350;
|
minsize.y = 350;
|
||||||
|
|
||||||
|
@ -265,6 +268,7 @@ void EDA_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
Maximize();
|
Maximize();
|
||||||
|
|
||||||
aCfg->Read( baseCfgName + entryPerspective, &m_perspective );
|
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",
|
// printf( "perspective(%s): %s\n",
|
||||||
// TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );
|
// TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );
|
||||||
aCfg->Write( baseCfgName + entryPerspective, perspective );
|
aCfg->Write( baseCfgName + entryPerspective, perspective );
|
||||||
|
aCfg->Write( baseCfgName + entryMruPath, m_mruPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -141,15 +141,15 @@ bool GetAssociatedDocument( wxWindow* aParent,
|
||||||
|
|
||||||
if( wxIsWild( fullfilename ) )
|
if( wxIsWild( fullfilename ) )
|
||||||
{
|
{
|
||||||
fullfilename = EDA_FileSelector( _( "Doc Files" ),
|
fullfilename = EDA_FILE_SELECTOR( _( "Doc Files" ),
|
||||||
wxPathOnly( fullfilename ),
|
wxPathOnly( fullfilename ),
|
||||||
fullfilename,
|
fullfilename,
|
||||||
extension,
|
extension,
|
||||||
mask,
|
mask,
|
||||||
aParent,
|
aParent,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
true,
|
true,
|
||||||
wxPoint( -1, -1 ) );
|
wxPoint( -1, -1 ) );
|
||||||
if( fullfilename.IsEmpty() )
|
if( fullfilename.IsEmpty() )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,26 +58,26 @@ void AddDelimiterString( wxString& string )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool EDA_DirectorySelector( const wxString& Title,
|
bool EDA_PATH_SELECTOR( const wxString& aTitle,
|
||||||
wxString& Path,
|
wxString& aPath,
|
||||||
int flag,
|
int aFlags,
|
||||||
wxWindow* Frame,
|
wxWindow* aParent,
|
||||||
const wxPoint& Pos )
|
const wxPoint& aPosition )
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
|
|
||||||
wxDirDialog* DirFrame = new wxDirDialog( Frame,
|
wxDirDialog* DirFrame = new wxDirDialog( aParent,
|
||||||
wxString( Title ),
|
aTitle,
|
||||||
Path,
|
aPath,
|
||||||
flag,
|
aFlags,
|
||||||
Pos );
|
aPosition );
|
||||||
|
|
||||||
ii = DirFrame->ShowModal();
|
ii = DirFrame->ShowModal();
|
||||||
|
|
||||||
if( ii == wxID_OK )
|
if( ii == wxID_OK )
|
||||||
{
|
{
|
||||||
Path = DirFrame->GetPath();
|
aPath = DirFrame->GetPath();
|
||||||
selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,21 +86,22 @@ bool EDA_DirectorySelector( const wxString& Title,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString EDA_FileSelector( const wxString& Title,
|
wxString EDA_FILE_SELECTOR( const wxString& aTitle,
|
||||||
const wxString& Path,
|
const wxString& aPath,
|
||||||
const wxString& FileName,
|
const wxString& aFileName,
|
||||||
const wxString& Ext,
|
const wxString& aExtension,
|
||||||
const wxString& Mask,
|
const wxString& aWildcard,
|
||||||
wxWindow* Frame,
|
wxWindow* aParent,
|
||||||
int flag,
|
int aStyle,
|
||||||
const bool keep_working_directory,
|
const bool aKeepWorkingDirectory,
|
||||||
const wxPoint& Pos )
|
const wxPoint& aPosition,
|
||||||
|
wxString* aMruPath )
|
||||||
{
|
{
|
||||||
wxString fullfilename;
|
wxString fullfilename;
|
||||||
wxString curr_cwd = wxGetCwd();
|
wxString curr_cwd = wxGetCwd();
|
||||||
wxString defaultname = FileName;
|
wxString defaultname = aFileName;
|
||||||
wxString defaultpath = Path;
|
wxString defaultpath = aPath;
|
||||||
wxString dotted_Ext = wxT(".") + Ext;
|
wxString dotted_Ext = wxT(".") + aExtension;
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
defaultname.Replace( wxT( "/" ), wxT( "\\" ) );
|
defaultname.Replace( wxT( "/" ), wxT( "\\" ) );
|
||||||
|
@ -108,7 +109,12 @@ wxString EDA_FileSelector( const wxString& Title,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( defaultpath.IsEmpty() )
|
if( defaultpath.IsEmpty() )
|
||||||
defaultpath = wxGetCwd();
|
{
|
||||||
|
if( aMruPath == NULL )
|
||||||
|
defaultpath = wxGetCwd();
|
||||||
|
else
|
||||||
|
defaultpath = *aMruPath;
|
||||||
|
}
|
||||||
|
|
||||||
wxSetWorkingDirectory( defaultpath );
|
wxSetWorkingDirectory( defaultpath );
|
||||||
|
|
||||||
|
@ -116,24 +122,30 @@ wxString EDA_FileSelector( const wxString& Title,
|
||||||
printf( "defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
|
printf( "defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
|
||||||
TO_UTF8( defaultpath ),
|
TO_UTF8( defaultpath ),
|
||||||
TO_UTF8( defaultname ),
|
TO_UTF8( defaultname ),
|
||||||
TO_UTF8( Ext ),
|
TO_UTF8( aExtension ),
|
||||||
TO_UTF8( Mask ),
|
TO_UTF8( aWildcard ),
|
||||||
flag,
|
aStyle,
|
||||||
keep_working_directory );
|
aKeepWorkingDirectory );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fullfilename = wxFileSelector( wxString( Title ),
|
fullfilename = wxFileSelector( aTitle,
|
||||||
defaultpath,
|
defaultpath,
|
||||||
defaultname,
|
defaultname,
|
||||||
dotted_Ext,
|
dotted_Ext,
|
||||||
Mask,
|
aWildcard,
|
||||||
flag, // open mode wxFD_OPEN, wxFD_SAVE ..
|
aStyle, // open mode wxFD_OPEN, wxFD_SAVE ..
|
||||||
Frame,
|
aParent,
|
||||||
Pos.x, Pos.y );
|
aPosition.x, aPosition.y );
|
||||||
|
|
||||||
if( keep_working_directory )
|
if( aKeepWorkingDirectory )
|
||||||
wxSetWorkingDirectory( curr_cwd );
|
wxSetWorkingDirectory( curr_cwd );
|
||||||
|
|
||||||
|
if( !fullfilename.IsEmpty() && aMruPath )
|
||||||
|
{
|
||||||
|
wxFileName fn = fullfilename;
|
||||||
|
*aMruPath = fn.GetPath();
|
||||||
|
}
|
||||||
|
|
||||||
return fullfilename;
|
return fullfilename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -749,12 +749,12 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList,
|
||||||
#if 0 // pass in the project dir as an argument
|
#if 0 // pass in the project dir as an argument
|
||||||
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
#else
|
#else
|
||||||
wxString path = wxGetCwd();
|
wxString path = GetMruPath();
|
||||||
#endif
|
#endif
|
||||||
wxFileName fn( aDefaultShortname );
|
wxFileName fn( aDefaultShortname );
|
||||||
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
||||||
|
|
||||||
wxString filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
|
wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
|
||||||
path,
|
path,
|
||||||
fn.GetFullPath(),
|
fn.GetFullPath(),
|
||||||
ext,
|
ext,
|
||||||
|
@ -767,6 +767,7 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ReadHotkeyConfigFile( filename, aDescList );
|
ReadHotkeyConfigFile( filename, aDescList );
|
||||||
|
SetMruPath( wxFileName( filename ).GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -779,24 +780,25 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList,
|
||||||
#if 0
|
#if 0
|
||||||
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
#else
|
#else
|
||||||
wxString path = wxGetCwd();
|
wxString path = GetMruPath();
|
||||||
#endif
|
#endif
|
||||||
wxFileName fn( aDefaultShortname );
|
wxFileName fn( aDefaultShortname );
|
||||||
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
||||||
|
|
||||||
wxString filename = EDA_FileSelector( _( "Write Hotkey Configuration File:" ),
|
wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
|
||||||
path,
|
path,
|
||||||
fn.GetFullPath(),
|
fn.GetFullPath(),
|
||||||
ext,
|
ext,
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_SAVE,
|
wxFD_SAVE,
|
||||||
true );
|
true );
|
||||||
|
|
||||||
if( filename.IsEmpty() )
|
if( filename.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WriteHotkeyConfig( aDescList, &filename );
|
WriteHotkeyConfig( aDescList, &filename );
|
||||||
|
SetMruPath( wxFileName( filename ).GetPath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -336,9 +336,9 @@ const wxString& PGM_BASE::GetEditorName()
|
||||||
#ifdef __WINDOWS__
|
#ifdef __WINDOWS__
|
||||||
mask += wxT( ".exe" );
|
mask += wxT( ".exe" );
|
||||||
#endif
|
#endif
|
||||||
editorname = EDA_FileSelector( _( "Preferred Editor:" ), wxEmptyString,
|
editorname = EDA_FILE_SELECTOR( _( "Preferred Editor:" ), wxEmptyString,
|
||||||
wxEmptyString, wxEmptyString, mask,
|
wxEmptyString, wxEmptyString, mask,
|
||||||
NULL, wxFD_OPEN, true );
|
NULL, wxFD_OPEN, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !editorname.IsEmpty() )
|
if( !editorname.IsEmpty() )
|
||||||
|
|
|
@ -483,15 +483,14 @@ wxString DIALOG_BOM::choosePlugin()
|
||||||
wxString path = GetOSXKicadDataDir() + wxT( "/plugins" );
|
wxString path = GetOSXKicadDataDir() + wxT( "/plugins" );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxString fullFileName = EDA_FileSelector( _( "Plugin files:" ),
|
wxString fullFileName = EDA_FILE_SELECTOR( _( "Plugin files:" ),
|
||||||
path,
|
path,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
true
|
true );
|
||||||
);
|
|
||||||
if( fullFileName.IsEmpty() )
|
if( fullFileName.IsEmpty() )
|
||||||
return wxEmptyString;
|
return wxEmptyString;
|
||||||
|
|
||||||
|
|
|
@ -453,15 +453,14 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile( wxCommandEvent& e
|
||||||
if( !docpath )
|
if( !docpath )
|
||||||
docpath = search->LastVisitedPath( wxT( "doc" ) );
|
docpath = search->LastVisitedPath( wxT( "doc" ) );
|
||||||
|
|
||||||
wxString fullFileName = EDA_FileSelector( _( "Doc Files" ),
|
wxString fullFileName = EDA_FILE_SELECTOR( _( "Doc Files" ),
|
||||||
docpath,
|
docpath,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
true
|
true );
|
||||||
);
|
|
||||||
if( fullFileName.IsEmpty() )
|
if( fullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -387,9 +387,9 @@ void DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath( wxCommandEvent& event )
|
||||||
wxString abs_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
wxString abs_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
|
||||||
wxString path;
|
wxString path;
|
||||||
|
|
||||||
bool select = EDA_DirectorySelector( _( "Default Path for Libraries" ),
|
bool select = EDA_PATH_SELECTOR( _( "Default Path for Libraries" ),
|
||||||
abs_path, wxDD_DEFAULT_STYLE,
|
abs_path, wxDD_DEFAULT_STYLE,
|
||||||
this, wxDefaultPosition );
|
this, wxDefaultPosition );
|
||||||
|
|
||||||
if( !select )
|
if( !select )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -837,14 +837,14 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
||||||
#else
|
#else
|
||||||
Path = GetOSXKicadDataDir() + wxT( "/plugins" );
|
Path = GetOSXKicadDataDir() + wxT( "/plugins" );
|
||||||
#endif
|
#endif
|
||||||
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
|
FullFileName = EDA_FILE_SELECTOR( _( "Plugin files:" ),
|
||||||
Path,
|
Path,
|
||||||
FullFileName,
|
FullFileName,
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
Mask,
|
Mask,
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
if( FullFileName.IsEmpty() )
|
if( FullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -49,7 +49,7 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath,
|
wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath,
|
||||||
wxEmptyString, SchematicLibraryFileWildcard,
|
m_mruPath, SchematicLibraryFileWildcard,
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
|
@ -57,6 +57,8 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
|
||||||
|
|
||||||
wxFileName fn = dlg.GetPath();
|
wxFileName fn = dlg.GetPath();
|
||||||
|
|
||||||
|
m_mruPath = fn.GetPath();
|
||||||
|
|
||||||
std::auto_ptr<PART_LIB> lib;
|
std::auto_ptr<PART_LIB> lib;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
|
|
@ -71,7 +71,7 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
|
||||||
|
|
||||||
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
|
|
||||||
fullFileName = EDA_FileSelector( _( "Filename:" ), pro_dir,
|
fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir,
|
||||||
fn.GetFullName(), file_ext, mask, this,
|
fn.GetFullName(), file_ext, mask, this,
|
||||||
wxFD_SAVE, true );
|
wxFD_SAVE, true );
|
||||||
|
|
||||||
|
@ -94,9 +94,9 @@ void LIB_EDIT_FRAME::OnPlotCurrentComponent( wxCommandEvent& event )
|
||||||
|
|
||||||
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
|
|
||||||
fullFileName = EDA_FileSelector( _( "Filename:" ), pro_dir,
|
fullFileName = EDA_FILE_SELECTOR( _( "Filename:" ), pro_dir,
|
||||||
fn.GetFullName(), file_ext, mask, this,
|
fn.GetFullName(), file_ext, mask, this,
|
||||||
wxFD_SAVE, true );
|
wxFD_SAVE, true );
|
||||||
|
|
||||||
if( fullFileName.IsEmpty() )
|
if( fullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -916,7 +916,7 @@ void SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile( wxCommandEvent& event )
|
||||||
void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
// wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
wxString pro_dir = wxGetCwd();
|
wxString pro_dir = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir,
|
wxFileDialog dlg( this, _( "New Schematic" ), pro_dir,
|
||||||
wxEmptyString, SchematicFileWildcard,
|
wxEmptyString, SchematicFileWildcard,
|
||||||
|
@ -942,6 +942,7 @@ void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
|
||||||
wxASSERT_MSG( create_me.IsAbsolute(), wxT( "wxFileDialog returned non-absolute" ) );
|
wxASSERT_MSG( create_me.IsAbsolute(), wxT( "wxFileDialog returned non-absolute" ) );
|
||||||
|
|
||||||
OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
|
OpenProjectFiles( std::vector<wxString>( 1, create_me.GetFullPath() ), KICTL_CREATE );
|
||||||
|
m_mruPath = create_me.GetPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,7 +950,7 @@ void SCH_EDIT_FRAME::OnNewProject( wxCommandEvent& event )
|
||||||
void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
// wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||||
wxString pro_dir = wxGetCwd();
|
wxString pro_dir = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
|
wxFileDialog dlg( this, _( "Open Schematic" ), pro_dir,
|
||||||
wxEmptyString, SchematicFileWildcard,
|
wxEmptyString, SchematicFileWildcard,
|
||||||
|
@ -958,6 +959,7 @@ void SCH_EDIT_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
if( dlg.ShowModal() != wxID_CANCEL )
|
if( dlg.ShowModal() != wxID_CANCEL )
|
||||||
{
|
{
|
||||||
OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
|
OpenProjectFiles( std::vector<wxString>( 1, dlg.GetPath() ) );
|
||||||
|
m_mruPath = Prj().GetProjectPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
* Copyright (C) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -44,6 +44,7 @@
|
||||||
#include <build_version.h>
|
#include <build_version.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
|
||||||
|
|
||||||
// Imported function
|
// Imported function
|
||||||
extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
|
extern const wxString GetPCBDefaultLayerName( LAYER_NUM aLayerNumber );
|
||||||
|
|
||||||
|
@ -174,11 +175,11 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString fileName;
|
wxString fileName;
|
||||||
wxString path = wxGetCwd();
|
wxString path = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog filedlg( this, _( "Board file name:" ),
|
wxFileDialog filedlg( this, _( "Board file name:" ),
|
||||||
path, fileName, PcbFileWildcard,
|
path, fileName, PcbFileWildcard,
|
||||||
wxFD_SAVE );
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||||
|
|
||||||
if( filedlg.ShowModal() == wxID_CANCEL )
|
if( filedlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
@ -195,16 +196,11 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
|
||||||
if( ok != wxID_OK )
|
if( ok != wxID_OK )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( wxFileExists( fileName ) )
|
m_mruPath = wxFileName( fileName ).GetPath();
|
||||||
{
|
|
||||||
if( !IsOK( this, _( "OK to change the existing file ?" ) ) )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
|
GBR_TO_PCB_EXPORTER gbr_exporter( this, fileName );
|
||||||
|
|
||||||
gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(),
|
gbr_exporter.ExportPcb( layerdlg->GetLayersLookUpTable(), layerdlg->GetCopperLayersCount() );
|
||||||
layerdlg->GetCopperLayersCount() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2004-2012 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -113,7 +113,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
* the .gbr (.pho in legacy files) extension is the default used in Pcbnew
|
* the .gbr (.pho in legacy files) extension is the default used in Pcbnew
|
||||||
* However there are a lot of other extensions used for gerber files
|
* However there are a lot of other extensions used for gerber files
|
||||||
* Because the first letter is usually g, we accept g* as extension
|
* Because the first letter is usually g, we accept g* as extension
|
||||||
* (Mainly internal copper layers do not have specific extention,
|
* (Mainly internal copper layers do not have specific extension,
|
||||||
* and filenames are like *.g1, *.g2 *.gb1 ...).
|
* and filenames are like *.g1, *.g2 *.gb1 ...).
|
||||||
* Now (2014) Ucamco (the company which manager the Gerber format) encourage
|
* Now (2014) Ucamco (the company which manager the Gerber format) encourage
|
||||||
* use of .gbr only and the Gerber X2 file format.
|
* use of .gbr only and the Gerber X2 file format.
|
||||||
|
@ -144,7 +144,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
if( filename.DirExists() )
|
if( filename.DirExists() )
|
||||||
currentPath = filename.GetPath();
|
currentPath = filename.GetPath();
|
||||||
else
|
else
|
||||||
currentPath = wxGetCwd();
|
currentPath = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this,
|
wxFileDialog dlg( this,
|
||||||
_( "Open Gerber File" ),
|
_( "Open Gerber File" ),
|
||||||
|
@ -157,13 +157,20 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
dlg.GetPaths( filenamesList );
|
dlg.GetPaths( filenamesList );
|
||||||
|
|
||||||
|
// @todo Take a closer look at the CWD switching here. The current working directory
|
||||||
|
// gets changed by wxFileDialog because the wxFD_CHANGE_DIR flag is set. Is this the
|
||||||
|
// appropriate behavior? The current working directory is not returned to the previous
|
||||||
|
// value so this may be an issue elsewhere.
|
||||||
currentPath = wxGetCwd();
|
currentPath = wxGetCwd();
|
||||||
|
m_mruPath = currentPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFileName filename = aFullFileName;
|
wxFileName filename = aFullFileName;
|
||||||
filenamesList.Add( aFullFileName );
|
filenamesList.Add( aFullFileName );
|
||||||
currentPath = filename.GetPath();
|
currentPath = filename.GetPath();
|
||||||
|
m_mruPath = currentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read gerber files: each file is loaded on a new GerbView layer
|
// Read gerber files: each file is loaded on a new GerbView layer
|
||||||
|
@ -208,6 +215,7 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
{
|
{
|
||||||
wxString filetypes;
|
wxString filetypes;
|
||||||
|
@ -226,7 +234,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
if( filename.DirExists() )
|
if( filename.DirExists() )
|
||||||
currentPath = filename.GetPath();
|
currentPath = filename.GetPath();
|
||||||
else
|
else
|
||||||
currentPath = wxGetCwd();
|
currentPath = m_mruPath;
|
||||||
|
|
||||||
wxFileDialog dlg( this,
|
wxFileDialog dlg( this,
|
||||||
_( "Open Drill File" ),
|
_( "Open Drill File" ),
|
||||||
|
@ -240,12 +248,14 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
|
|
||||||
dlg.GetPaths( filenamesList );
|
dlg.GetPaths( filenamesList );
|
||||||
currentPath = wxGetCwd();
|
currentPath = wxGetCwd();
|
||||||
|
m_mruPath = currentPath;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFileName filename = aFullFileName;
|
wxFileName filename = aFullFileName;
|
||||||
filenamesList.Add( aFullFileName );
|
filenamesList.Add( aFullFileName );
|
||||||
currentPath = filename.GetPath();
|
currentPath = filename.GetPath();
|
||||||
|
m_mruPath = currentPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read gerber files: each file is loaded on a new GerbView layer
|
// Read gerber files: each file is loaded on a new GerbView layer
|
||||||
|
@ -264,7 +274,7 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
|
||||||
|
|
||||||
if( Read_EXCELLON_File( filename.GetFullPath() ) )
|
if( Read_EXCELLON_File( filename.GetFullPath() ) )
|
||||||
{
|
{
|
||||||
// Update the list of recentdrill files.
|
// Update the list of recent drill files.
|
||||||
UpdateFileHistory( filename.GetFullPath(), &m_drillFileHistory );
|
UpdateFileHistory( filename.GetFullPath(), &m_drillFileHistory );
|
||||||
|
|
||||||
layer = getNextAvailableLayer( layer );
|
layer = getNextAvailableLayer( layer );
|
||||||
|
|
|
@ -57,32 +57,56 @@ bool OpenPDF( const wxString& file );
|
||||||
|
|
||||||
void OpenFile( const wxString& file );
|
void OpenFile( const wxString& file );
|
||||||
|
|
||||||
bool EDA_DirectorySelector( const wxString& Title,
|
/**
|
||||||
wxString& Path,
|
* Function EDA_PATH_SELECTOR
|
||||||
int flag, /* reserve */
|
*
|
||||||
wxWindow* Frame,
|
* is a helper function that wraps wxDirDialog.
|
||||||
const wxPoint& Pos );
|
*
|
||||||
|
* @param aTitle is a string to display in the dialog title bar.
|
||||||
/* Selection file dialog box:
|
* @param aPath is a string contain the default path for the path dialog. This string also
|
||||||
* Dialog title
|
* contains the result of the wxDirDialog when the OK button is used to dismiss
|
||||||
* Default path
|
* the dialog.
|
||||||
* default filename
|
* @param aFlags is the style of the path dialog, wxDD_???.
|
||||||
* default filename extension
|
* @param aParaent is the parent window of the dialog.
|
||||||
* filter for filename list
|
* @param aPosition is the position of the dialog.
|
||||||
* parent frame
|
* @return true if a path was selected.
|
||||||
* wxFD_SAVE, wxFD_OPEN ..
|
|
||||||
* true = keep the current path
|
|
||||||
*/
|
*/
|
||||||
wxString EDA_FileSelector( const wxString& Title,
|
bool EDA_PATH_SELECTOR( const wxString& aTitle,
|
||||||
const wxString& Path,
|
wxString& aPath,
|
||||||
const wxString& FileName,
|
int aFlags, /* reserve */
|
||||||
const wxString& Ext,
|
wxWindow* aParent,
|
||||||
const wxString& Mask,
|
const wxPoint& aPosition = wxDefaultPosition );
|
||||||
wxWindow* Frame,
|
|
||||||
int flag,
|
|
||||||
const bool keep_working_directory,
|
|
||||||
const wxPoint& Pos = wxPoint( -1, -1 ) );
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function EDA_FILE_SELECTOR
|
||||||
|
*
|
||||||
|
* is a helper function that wraps a call to wxFileSelector.
|
||||||
|
*
|
||||||
|
* @param aTitle is a string to display in the dialog title bar.
|
||||||
|
* @param aPath is a string contain the default path for the path dialog.
|
||||||
|
* @param aFileName is a string containing the default file name.
|
||||||
|
* @param aExtension is a string containing the default file extension.
|
||||||
|
* @param aWildcard is a string containing the default wildcard.
|
||||||
|
* @param aParaent is the parent window of the dialog.
|
||||||
|
* @param aFlags is the style of the path dialog, wxFD_???.
|
||||||
|
* @param aKeepWorkingDirectory determines if current working directory should be set to the
|
||||||
|
* user selected path.
|
||||||
|
* @param aPosition is the position of the dialog.
|
||||||
|
* @param aMruPath is a pointer to a string to copy the path selected by the user when
|
||||||
|
* the OK button is pressed to dismiss the dialog. This can be NULL.
|
||||||
|
* @return the full path and file name of the selected file or wxEmptyString if the user
|
||||||
|
* pressed the cancel button to dismiss the dialog.
|
||||||
|
*/
|
||||||
|
wxString EDA_FILE_SELECTOR( const wxString& aTitle,
|
||||||
|
const wxString& aPath,
|
||||||
|
const wxString& aFileName,
|
||||||
|
const wxString& aExtension,
|
||||||
|
const wxString& aWildcard,
|
||||||
|
wxWindow* aParent,
|
||||||
|
int aStyle,
|
||||||
|
const bool aKeepWorkingDirectory,
|
||||||
|
const wxPoint& aPosition = wxDefaultPosition,
|
||||||
|
wxString* aMruPath = NULL );
|
||||||
|
|
||||||
EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
|
EDA_LIST_DIALOG* GetFileNames( char* Directory, char* Mask );
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,8 @@ protected:
|
||||||
|
|
||||||
wxString m_perspective; ///< wxAuiManager perspective.
|
wxString m_perspective; ///< wxAuiManager perspective.
|
||||||
|
|
||||||
|
wxString m_mruPath; ///< Most recently used path.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function onAutoSaveTimer
|
* Function onAutoSaveTimer
|
||||||
* handles the auto save timer event.
|
* handles the auto save timer event.
|
||||||
|
@ -362,6 +364,10 @@ public:
|
||||||
*/
|
*/
|
||||||
void UpdateFileHistory( const wxString& FullFileName, wxFileHistory * aFileHistory = NULL );
|
void UpdateFileHistory( const wxString& FullFileName, wxFileHistory * aFileHistory = NULL );
|
||||||
|
|
||||||
|
void SetMruPath( const wxString& aPath ) { m_mruPath = aPath; }
|
||||||
|
|
||||||
|
wxString GetMruPath() const { return m_mruPath; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ReCreateMenuBar
|
* Function ReCreateMenuBar
|
||||||
* Creates recreates the menu bar.
|
* Creates recreates the menu bar.
|
||||||
|
|
|
@ -176,7 +176,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
|
||||||
// Prepare the zip file
|
// Prepare the zip file
|
||||||
wxString zipfilename = zip.GetFullPath();
|
wxString zipfilename = zip.GetFullPath();
|
||||||
|
|
||||||
wxFFileOutputStream ostream(zipfilename);
|
wxFFileOutputStream ostream( zipfilename );
|
||||||
wxZipOutputStream zipstream( ostream );
|
wxZipOutputStream zipstream( ostream );
|
||||||
|
|
||||||
// Build list of filenames to put in zip archive
|
// Build list of filenames to put in zip archive
|
||||||
|
@ -199,11 +199,11 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
|
||||||
curr_fn.MakeRelativeTo( currdirname );
|
curr_fn.MakeRelativeTo( currdirname );
|
||||||
currFilename = curr_fn.GetFullPath();
|
currFilename = curr_fn.GetFullPath();
|
||||||
|
|
||||||
msg.Printf(_( "Archive file <%s>" ), GetChars( currFilename ) );
|
msg.Printf( _( "Archive file <%s>" ), GetChars( currFilename ) );
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
|
|
||||||
// Read input file and add it to the zip file:
|
// Read input file and add it to the zip file:
|
||||||
wxFSFile* infile = fsfile.OpenFile(currFilename);
|
wxFSFile* infile = fsfile.OpenFile( currFilename );
|
||||||
|
|
||||||
if( infile )
|
if( infile )
|
||||||
{
|
{
|
||||||
|
@ -213,20 +213,20 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
|
||||||
int zippedsize = zipstream.GetSize() - zipBytesCnt;
|
int zippedsize = zipstream.GetSize() - zipBytesCnt;
|
||||||
zipBytesCnt = zipstream.GetSize();
|
zipBytesCnt = zipstream.GetSize();
|
||||||
PrintMsg( wxT(" ") );
|
PrintMsg( wxT(" ") );
|
||||||
msg.Printf( _( "(%d bytes, compressed %d bytes)\n"),
|
msg.Printf( _( "(%lu bytes, compressed %d bytes)\n" ),
|
||||||
infile->GetStream()->GetSize(), zippedsize );
|
(unsigned long)infile->GetStream()->GetSize(), zippedsize );
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
delete infile;
|
delete infile;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
PrintMsg( _(" >>Error\n") );
|
PrintMsg( _( " >>Error\n" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
zipBytesCnt = ostream.GetSize();
|
zipBytesCnt = ostream.GetSize();
|
||||||
|
|
||||||
if( zipstream.Close() )
|
if( zipstream.Close() )
|
||||||
{
|
{
|
||||||
msg.Printf( _("\nZip archive <%s> created (%d bytes)" ),
|
msg.Printf( _( "\nZip archive <%s> created (%d bytes)" ),
|
||||||
GetChars( zipfilename ), zipBytesCnt );
|
GetChars( zipfilename ), zipBytesCnt );
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
PrintMsg( wxT( "\n** end **\n" ) );
|
PrintMsg( wxT( "\n** end **\n" ) );
|
||||||
|
@ -234,7 +234,7 @@ void KICAD_MANAGER_FRAME::OnArchiveFiles( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( wxT( "Unable to create archive <%s>, abort\n" ),
|
msg.Printf( wxT( "Unable to create archive <%s>, abort\n" ),
|
||||||
GetChars( zipfilename ) );
|
GetChars( zipfilename ) );
|
||||||
PrintMsg( msg );
|
PrintMsg( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
|
||||||
{
|
{
|
||||||
GetFileHistory().RemoveFileFromHistory( 0 );
|
GetFileHistory().RemoveFileFromHistory( 0 );
|
||||||
|
|
||||||
wxFileName namelessProject( wxGetCwd(), NAMELESS_PROJECT,
|
wxFileName namelessProject( wxStandardPaths::Get().GetDocumentsDir(), NAMELESS_PROJECT,
|
||||||
ProjectFileExtension );
|
ProjectFileExtension );
|
||||||
|
|
||||||
frame->SetProjectFileName( namelessProject.GetFullPath() );
|
frame->SetProjectFileName( namelessProject.GetFullPath() );
|
||||||
|
@ -181,7 +181,7 @@ bool PGM_KICAD::OnPgmInit( wxApp* aWxApp )
|
||||||
}
|
}
|
||||||
else // there is no history
|
else // there is no history
|
||||||
{
|
{
|
||||||
wxFileName namelessProject( wxGetCwd(), NAMELESS_PROJECT,
|
wxFileName namelessProject( wxStandardPaths::Get().GetDocumentsDir(), NAMELESS_PROJECT,
|
||||||
ProjectFileExtension );
|
ProjectFileExtension );
|
||||||
|
|
||||||
frame->SetProjectFileName( namelessProject.GetFullPath() );
|
frame->SetProjectFileName( namelessProject.GetFullPath() );
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
#include <dialog_hotkeys_editor.h>
|
#include <dialog_hotkeys_editor.h>
|
||||||
|
|
||||||
|
#include <wx/filefn.h>
|
||||||
|
|
||||||
|
|
||||||
#define TREE_FRAME_WIDTH_ENTRY wxT( "LeftWinWidth" )
|
#define TREE_FRAME_WIDTH_ENTRY wxT( "LeftWinWidth" )
|
||||||
|
|
||||||
|
@ -410,16 +412,12 @@ void KICAD_MANAGER_FRAME::OnRunPageLayoutEditor( wxCommandEvent& event )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <wx/filefn.h>
|
|
||||||
void KICAD_MANAGER_FRAME::OnRunGerbview( wxCommandEvent& event )
|
void KICAD_MANAGER_FRAME::OnRunGerbview( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// Gerbview is called without any file to open, because we do not know
|
// Gerbview is called without any file to open, because we do not know
|
||||||
// the list and the name of files to open (if any...).
|
// the list and the name of files to open (if any...).
|
||||||
// however we run it in the path of the project
|
// however we run it in the path of the project
|
||||||
wxString cwd = wxGetCwd();
|
Execute( this, GERBVIEW_EXE, Prj().GetProjectPath() );
|
||||||
wxSetWorkingDirectory( Prj().GetProjectPath() );
|
|
||||||
Execute( this, GERBVIEW_EXE, wxEmptyString );
|
|
||||||
wxSetWorkingDirectory( cwd );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -240,9 +240,9 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
|
style = wxFD_OPEN | wxFD_FILE_MUST_EXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString default_dir = wxGetCwd();
|
wxString default_dir = GetMruPath();
|
||||||
wxFileDialog dlg( this, title, default_dir, wxEmptyString,
|
wxFileDialog dlg( this, title, default_dir, wxEmptyString,
|
||||||
ProjectFileWildcard, style );
|
ProjectFileWildcard, style );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
@ -333,6 +333,8 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
|
||||||
|
|
||||||
if( !wxFileName( prj_filename ).IsDirWritable() )
|
if( !wxFileName( prj_filename ).IsDirWritable() )
|
||||||
title += _( " [Read Only]" );
|
title += _( " [Read Only]" );
|
||||||
|
else
|
||||||
|
SetMruPath( Prj().GetProjectPath() ); // Only set MRU path if we have write access.
|
||||||
|
|
||||||
SetTitle( title );
|
SetTitle( title );
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <wx/regex.h>
|
#include <wx/regex.h>
|
||||||
#include <wx/dir.h>
|
#include <wx/dir.h>
|
||||||
#include <wx/imaglist.h>
|
#include <wx/imaglist.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
#include <stack>
|
#include <stack>
|
||||||
|
|
||||||
|
@ -595,7 +596,7 @@ void TREE_PROJECT_FRAME::ReCreateTreePrj()
|
||||||
if( !fn.IsOk() )
|
if( !fn.IsOk() )
|
||||||
{
|
{
|
||||||
fn.Clear();
|
fn.Clear();
|
||||||
fn.SetPath( ::wxGetCwd() );
|
fn.SetPath( wxStandardPaths::Get().GetDocumentsDir() );
|
||||||
fn.SetName( NAMELESS_PROJECT );
|
fn.SetName( NAMELESS_PROJECT );
|
||||||
fn.SetExt( ProjectFileExtension );
|
fn.SetExt( ProjectFileExtension );
|
||||||
}
|
}
|
||||||
|
|
|
@ -479,9 +479,9 @@ void DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile()
|
||||||
fileFilters += wxChar( '|' );
|
fileFilters += wxChar( '|' );
|
||||||
fileFilters += wxGetTranslation( IDF3DFileWildcard );
|
fileFilters += wxGetTranslation( IDF3DFileWildcard );
|
||||||
|
|
||||||
wxString filename = EDA_FileSelector( _( "3D Shape:" ), initialpath,
|
wxString filename = EDA_FILE_SELECTOR( _( "3D Shape:" ), initialpath,
|
||||||
wxEmptyString, wxEmptyString,
|
wxEmptyString, wxEmptyString,
|
||||||
fileFilters, this, wxFD_OPEN, true );
|
fileFilters, this, wxFD_OPEN, true );
|
||||||
|
|
||||||
if( filename.IsEmpty() )
|
if( filename.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -349,10 +349,10 @@ void DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile()
|
||||||
fileFilters += wxChar( '|' );
|
fileFilters += wxChar( '|' );
|
||||||
fileFilters += wxGetTranslation( IDF3DFileWildcard );
|
fileFilters += wxGetTranslation( IDF3DFileWildcard );
|
||||||
|
|
||||||
wxString filename = EDA_FileSelector( _( "3D Shape:" ), initialpath,
|
wxString filename = EDA_FILE_SELECTOR( _( "3D Shape:" ), initialpath,
|
||||||
wxEmptyString, wxEmptyString,
|
wxEmptyString, wxEmptyString,
|
||||||
wxGetTranslation( fileFilters ),
|
wxGetTranslation( fileFilters ),
|
||||||
this, wxFD_OPEN, true );
|
this, wxFD_OPEN, true );
|
||||||
|
|
||||||
if( filename.IsEmpty() )
|
if( filename.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -191,10 +191,10 @@ const wxString DIALOG_FREEROUTE::createDSN_File()
|
||||||
fn.SetExt( dsn_ext );
|
fn.SetExt( dsn_ext );
|
||||||
wxString mask = wxT( "*." ) + dsn_ext;
|
wxString mask = wxT( "*." ) + dsn_ext;
|
||||||
|
|
||||||
wxString fullFileName = EDA_FileSelector( _( "Specctra DSN file:" ),
|
wxString fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN file:" ),
|
||||||
fn.GetPath(), fn.GetFullName(),
|
fn.GetPath(), fn.GetFullName(),
|
||||||
dsn_ext, mask,
|
dsn_ext, mask,
|
||||||
this, wxFD_SAVE, false );
|
this, wxFD_SAVE, false );
|
||||||
|
|
||||||
if( !fullFileName.IsEmpty() )
|
if( !fullFileName.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 1992-2012 Jean_Pierre Charras <jp.charras at wanadoo.fr>
|
* Copyright (C) 1992-2012 Jean_Pierre Charras <jp.charras at wanadoo.fr>
|
||||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -42,6 +42,8 @@
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
|
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
|
||||||
// Keywords for read and write config
|
// Keywords for read and write config
|
||||||
#define ZerosFormatKey wxT( "DrillZerosFormat" )
|
#define ZerosFormatKey wxT( "DrillZerosFormat" )
|
||||||
|
@ -391,7 +393,7 @@ void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
|
||||||
wxString defaultPath = m_plotOpts.GetOutputDirectory();
|
wxString defaultPath = m_plotOpts.GetOutputDirectory();
|
||||||
|
|
||||||
if( defaultPath.IsEmpty() )
|
if( defaultPath.IsEmpty() )
|
||||||
defaultPath = ::wxGetCwd();
|
defaultPath = wxStandardPaths::Get().GetDocumentsDir();
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath,
|
wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath,
|
||||||
fn.GetFullName(), wxGetTranslation( ReportFileWildcard ),
|
fn.GetFullName(), wxGetTranslation( ReportFileWildcard ),
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2011-2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -52,6 +52,8 @@
|
||||||
#include <module_editor_frame.h>
|
#include <module_editor_frame.h>
|
||||||
#include <modview_frame.h>
|
#include <modview_frame.h>
|
||||||
|
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
|
||||||
//#define USE_INSTRUMENTATION true
|
//#define USE_INSTRUMENTATION true
|
||||||
#define USE_INSTRUMENTATION false
|
#define USE_INSTRUMENTATION false
|
||||||
|
@ -114,7 +116,7 @@ bool AskLoadBoardFileName( wxWindow* aParent, int* aCtl, wxString* aFileName, bo
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path = wxGetCwd();
|
path = wxStandardPaths::Get().GetDocumentsDir();
|
||||||
// leave name empty
|
// leave name empty
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,21 +311,22 @@ void PCB_EDIT_FRAME::Files_io_from_id( int id )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_NEW_BOARD:
|
case ID_NEW_BOARD:
|
||||||
{
|
{
|
||||||
if( !Clear_Pcb( true ) )
|
if( !Clear_Pcb( true ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
wxFileName fn( wxGetCwd(), wxT( "noname" ), ProjectFileExtension );
|
wxFileName fn( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),
|
||||||
|
ProjectFileExtension );
|
||||||
|
|
||||||
Prj().SetProjectFullName( fn.GetFullPath() );
|
Prj().SetProjectFullName( fn.GetFullPath() );
|
||||||
|
|
||||||
fn.SetExt( PcbFileExtension );
|
fn.SetExt( PcbFileExtension );
|
||||||
|
|
||||||
GetBoard()->SetFileName( fn.GetFullPath() );
|
GetBoard()->SetFileName( fn.GetFullPath() );
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
ReCreateLayerBox();
|
ReCreateLayerBox();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case ID_SAVE_BOARD:
|
case ID_SAVE_BOARD:
|
||||||
if( ! GetBoard()->GetFileName().IsEmpty() )
|
if( ! GetBoard()->GetFileName().IsEmpty() )
|
||||||
|
|
|
@ -27,8 +27,10 @@
|
||||||
* @brief Manage module (footprint) libraries.
|
* @brief Manage module (footprint) libraries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
|
#include <fctsys.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
|
@ -105,7 +107,7 @@ MODULE* FOOTPRINT_EDIT_FRAME::Import_Module()
|
||||||
// Some day it might be useful save the last library type selected along with the path.
|
// Some day it might be useful save the last library type selected along with the path.
|
||||||
static int lastFilterIndex = 0;
|
static int lastFilterIndex = 0;
|
||||||
|
|
||||||
wxString lastOpenedPathForLoading;
|
wxString lastOpenedPathForLoading = m_mruPath;
|
||||||
wxConfigBase* config = Kiface().KifaceSettings();
|
wxConfigBase* config = Kiface().KifaceSettings();
|
||||||
|
|
||||||
if( config )
|
if( config )
|
||||||
|
@ -308,7 +310,7 @@ void FOOTPRINT_EDIT_FRAME::Export_Module( MODULE* aModule )
|
||||||
if( config )
|
if( config )
|
||||||
{
|
{
|
||||||
wxString path;
|
wxString path;
|
||||||
config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path );
|
config->Read( EXPORT_IMPORT_LASTPATH_KEY, &path, m_mruPath );
|
||||||
fn.SetPath( path );
|
fn.SetPath( path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -844,10 +844,10 @@ void MWAVE_POLYGONAL_SHAPE_DLG::ReadDataShapeDescr( wxCommandEvent& event )
|
||||||
static wxString lastpath; // To remember the last open path during a session
|
static wxString lastpath; // To remember the last open path during a session
|
||||||
wxString mask = wxT( "*.*" );
|
wxString mask = wxT( "*.*" );
|
||||||
|
|
||||||
wxString FullFileName = EDA_FileSelector( _( "Read descr shape file" ),
|
wxString FullFileName = EDA_FILE_SELECTOR( _( "Read descr shape file" ),
|
||||||
lastpath, FullFileName,
|
lastpath, FullFileName,
|
||||||
wxEmptyString, mask,
|
wxEmptyString, mask,
|
||||||
this, wxFD_OPEN, true );
|
this, wxFD_OPEN, true );
|
||||||
if( FullFileName.IsEmpty() )
|
if( FullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -137,15 +137,14 @@ void PCB_EDIT_FRAME::ExportToSpecctra( wxCommandEvent& event )
|
||||||
|
|
||||||
name += dsn_ext;
|
name += dsn_ext;
|
||||||
|
|
||||||
fullFileName = EDA_FileSelector( _( "Specctra DSN file:" ),
|
fullFileName = EDA_FILE_SELECTOR( _( "Specctra DSN file:" ),
|
||||||
path,
|
path,
|
||||||
name, // name.ext without path!
|
name, // name.ext without path!
|
||||||
dsn_ext,
|
dsn_ext,
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_SAVE,
|
wxFD_SAVE,
|
||||||
false
|
false );
|
||||||
);
|
|
||||||
|
|
||||||
if( fullFileName == wxEmptyString )
|
if( fullFileName == wxEmptyString )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -81,15 +81,14 @@ void PCB_EDIT_FRAME::ImportSpecctraSession( wxCommandEvent& event )
|
||||||
wxFileName::SplitPath( fullFileName, &path, &name, &ext );
|
wxFileName::SplitPath( fullFileName, &path, &name, &ext );
|
||||||
name += sessionExt;
|
name += sessionExt;
|
||||||
|
|
||||||
fullFileName = EDA_FileSelector( _( "Merge Specctra Session file:" ),
|
fullFileName = EDA_FILE_SELECTOR( _( "Merge Specctra Session file:" ),
|
||||||
path,
|
path,
|
||||||
name,
|
name,
|
||||||
sessionExt,
|
sessionExt,
|
||||||
mask,
|
mask,
|
||||||
this,
|
this,
|
||||||
wxFD_OPEN,
|
wxFD_OPEN,
|
||||||
false
|
false );
|
||||||
);
|
|
||||||
|
|
||||||
if( fullFileName == wxEmptyString )
|
if( fullFileName == wxEmptyString )
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue