modedit: Allow name input for new footprint library
When prompting for a new footprint library, we need to treat the input as a file for creation rather than a directory for selection. Otherwise, users cannot specify the name of their new footprint library independently of the existing directory names. Fixes: lp:1812135 * https://bugs.launchpad.net/kicad/+bug/1812135
This commit is contained in:
parent
b0ab53ac26
commit
823dce1a50
|
@ -1865,10 +1865,10 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
|
|||
wxString prompt = doOpen ? _( "Select Library" ) : _( "New Library" );
|
||||
aFilename.SetExt( ext );
|
||||
|
||||
if( isDirectory )
|
||||
if( isDirectory && doOpen )
|
||||
{
|
||||
wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
|
||||
doOpen ? wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST : wxDD_DEFAULT_STYLE );
|
||||
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return false;
|
||||
|
|
|
@ -1499,10 +1499,10 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
|
|||
aFilename.SetExt( ext );
|
||||
|
||||
#ifndef __WXMAC__
|
||||
if( isDirectory )
|
||||
if( isDirectory && doOpen )
|
||||
{
|
||||
wxDirDialog dlg( this, prompt, Prj().GetProjectPath(),
|
||||
doOpen ? wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST : wxDD_DEFAULT_STYLE );
|
||||
wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
return false;
|
||||
|
|
|
@ -202,7 +202,8 @@ protected:
|
|||
* @return true for OK; false for Cancel.
|
||||
*/
|
||||
bool LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
|
||||
const wxString& wildcard, const wxString& ext, bool isDirectory );
|
||||
const wxString& wildcard, const wxString& ext,
|
||||
bool isDirectory = false );
|
||||
|
||||
/**
|
||||
* Handle the common part of GeneralControl dedicated to global
|
||||
|
|
|
@ -430,8 +430,7 @@ wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary(const wxString& aLibName )
|
|||
fn = initialPath;
|
||||
|
||||
if( !LibraryFileBrowser( false, fn,
|
||||
KiCadFootprintLibPathWildcard(), KiCadFootprintLibPathExtension,
|
||||
true ) )
|
||||
KiCadFootprintLibPathWildcard(), KiCadFootprintLibPathExtension) )
|
||||
{
|
||||
return wxEmptyString;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue