Library Manager: select library when none is set for import/create new part
This commit is contained in:
parent
bb83b73f76
commit
a2b6c8e20a
|
@ -49,6 +49,14 @@ void LIB_EDIT_FRAME::OnImportPart( wxCommandEvent& event )
|
||||||
m_lastDrawItem = NULL;
|
m_lastDrawItem = NULL;
|
||||||
wxString libName = getTargetLib();
|
wxString libName = getTargetLib();
|
||||||
|
|
||||||
|
if( !m_libMgr->LibraryExists( libName ) )
|
||||||
|
{
|
||||||
|
libName = SelectLibraryFromList();
|
||||||
|
|
||||||
|
if( !m_libMgr->LibraryExists( libName ) )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
wxFileDialog dlg( this, _( "Import Symbol" ), m_mruPath,
|
wxFileDialog dlg( this, _( "Import Symbol" ), m_mruPath,
|
||||||
wxEmptyString, SchematicLibraryFileWildcard(),
|
wxEmptyString, SchematicLibraryFileWildcard(),
|
||||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||||
|
|
|
@ -319,6 +319,15 @@ void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() );
|
||||||
m_drawItem = NULL;
|
m_drawItem = NULL;
|
||||||
|
wxString lib = getTargetLib();
|
||||||
|
|
||||||
|
if( !m_libMgr->LibraryExists( lib ) )
|
||||||
|
{
|
||||||
|
lib = SelectLibraryFromList();
|
||||||
|
|
||||||
|
if( !m_libMgr->LibraryExists( lib ) )
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
DIALOG_LIB_NEW_COMPONENT dlg( this );
|
DIALOG_LIB_NEW_COMPONENT dlg( this );
|
||||||
dlg.SetMinSize( dlg.GetSize() );
|
dlg.SetMinSize( dlg.GetSize() );
|
||||||
|
@ -335,8 +344,6 @@ void LIB_EDIT_FRAME::OnCreateNewPart( wxCommandEvent& event )
|
||||||
wxString name = dlg.GetName();
|
wxString name = dlg.GetName();
|
||||||
name.Replace( " ", "_" );
|
name.Replace( " ", "_" );
|
||||||
|
|
||||||
wxString lib = getTargetLib();
|
|
||||||
|
|
||||||
// Test if there is a component with this name already.
|
// Test if there is a component with this name already.
|
||||||
if( !lib.empty() && m_libMgr->PartExists( name, lib ) )
|
if( !lib.empty() && m_libMgr->PartExists( name, lib ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue