Eeschema: fix wxFileDialog assertion when importing component. (fixes lp:1558486)

* wxFileDialog ctor was setting the file name using the most recently used
  path which was incorrect.  Set the file path parameter to the most recently
  used path and the file name parameter to an empty string.
* Remove last used import path and use the application wide most recently
  path instead.
* Remove last used export path and use the application wide most recently
  path instead.
This commit is contained in:
Wayne Stambaugh 2016-04-08 09:05:07 -04:00
parent c146cc09eb
commit 0f89576f72
3 changed files with 8 additions and 20 deletions

View File

@ -743,11 +743,6 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
SetGridColor( GetLayerColor( LAYER_GRID ) );
SetDrawBgColor( GetLayerColor( LAYER_BACKGROUND ) );
wxString pro_dir = Prj().GetProjectFullName();
m_lastLibExportPath = aCfg->Read( lastLibExportPathEntry, pro_dir );
m_lastLibImportPath = aCfg->Read( lastLibImportPathEntry, pro_dir );
SetDefaultLineThickness( aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
m_textPinNumDefaultSize = aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
@ -765,8 +760,6 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::SaveSettings( aCfg );
aCfg->Write( lastLibExportPathEntry, m_lastLibExportPath );
aCfg->Write( lastLibImportPathEntry, m_lastLibImportPath );
aCfg->Write( DefaultPinLengthEntry, (long) GetDefaultPinLength() );
aCfg->Write( defaultPinNumSizeEntry, (long) GetPinNumDefaultSize() );
aCfg->Write( defaultPinNameSizeEntry, (long) GetPinNameDefaultSize() );

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2008-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2016 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
@ -48,8 +48,8 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
{
m_lastDrawItem = NULL;
wxFileDialog dlg( this, _( "Import Component" ), m_lastLibImportPath,
m_mruPath, SchematicLibraryFileWildcard,
wxFileDialog dlg( this, _( "Import Component" ), m_mruPath,
wxEmptyString, SchematicLibraryFileWildcard,
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
if( dlg.ShowModal() == wxID_CANCEL )
@ -92,11 +92,9 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
if( LoadOneLibraryPartAux( entry, lib.get() ) )
{
fn = dlg.GetPath();
m_lastLibImportPath = fn.GetPath();
DisplayLibInfos();
GetScreen()->ClearUndoRedoList();
m_canvas->Refresh();
Zoom_Automatique( false );
}
}
@ -120,8 +118,8 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
title = createLib ? _( "New Library" ) : _( "Export Component" );
wxFileDialog dlg( this, title, m_lastLibExportPath, fn.GetFullName(),
SchematicLibraryFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxFileDialog dlg( this, title, m_mruPath, fn.GetFullName(),
SchematicLibraryFileWildcard, wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
if( dlg.ShowModal() == wxID_CANCEL )
return;
@ -167,7 +165,7 @@ void LIB_EDIT_FRAME::OnExportPart( wxCommandEvent& event )
}
if( result )
m_lastLibExportPath = fn.GetPath();
m_mruPath = fn.GetPath();
if( result )
{

View File

@ -56,9 +56,6 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
wxComboBox* m_partSelectBox; ///< a Box to select a part to edit (if any)
wxComboBox* m_aliasSelectBox; ///< a box to select the alias to edit (if any)
wxString m_lastLibImportPath;
wxString m_lastLibExportPath;
/** Convert of the item currently being drawn. */
bool m_drawSpecificConvert;