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:
Seth Hillbrand 2019-01-22 05:21:26 -08:00
parent b0ab53ac26
commit 823dce1a50
4 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;
}