Library Editor field edit dialog takes data from LIB_MANAGER
This commit is contained in:
parent
5c61b61c27
commit
3589244ff3
|
@ -35,6 +35,7 @@
|
||||||
#include <symbol_lib_table.h>
|
#include <symbol_lib_table.h>
|
||||||
#include <template_fieldnames.h>
|
#include <template_fieldnames.h>
|
||||||
#include <dialog_edit_one_field.h>
|
#include <dialog_edit_one_field.h>
|
||||||
|
#include <lib_manager.h>
|
||||||
|
|
||||||
|
|
||||||
void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
||||||
|
@ -42,14 +43,12 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
||||||
wxString newFieldValue;
|
wxString newFieldValue;
|
||||||
wxString title;
|
wxString title;
|
||||||
wxString caption;
|
wxString caption;
|
||||||
wxString oldName;
|
|
||||||
|
|
||||||
if( aField == NULL )
|
if( aField == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
LIB_PART* parent = aField->GetParent();
|
LIB_PART* parent = aField->GetParent();
|
||||||
|
wxCHECK( parent, /* void */ );
|
||||||
wxASSERT( parent );
|
|
||||||
|
|
||||||
// Editing the component value field is equivalent to creating a new component based
|
// Editing the component value field is equivalent to creating a new component based
|
||||||
// on the current component. Set the dialog message to inform the user.
|
// on the current component. Set the dialog message to inform the user.
|
||||||
|
@ -85,7 +84,7 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
||||||
wxString lib = GetCurLib();
|
wxString lib = GetCurLib();
|
||||||
|
|
||||||
// Test the current library for name conflicts.
|
// Test the current library for name conflicts.
|
||||||
if( !lib.empty() && Prj().SchSymbolLibTable()->LoadSymbol( lib, newFieldValue ) )
|
if( !lib.empty() && m_libMgr->PartExists( newFieldValue, lib ) )
|
||||||
{
|
{
|
||||||
msg.Printf( _(
|
msg.Printf( _(
|
||||||
"The name '%s' conflicts with an existing entry in the component library '%s'.\n\n"
|
"The name '%s' conflicts with an existing entry in the component library '%s'.\n\n"
|
||||||
|
@ -124,7 +123,7 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
||||||
bool conflicts = false;
|
bool conflicts = false;
|
||||||
wxArrayString libAliasNames, symbolAliasNames;
|
wxArrayString libAliasNames, symbolAliasNames;
|
||||||
|
|
||||||
Prj().SchSymbolLibTable()->EnumerateSymbolLib( lib, libAliasNames );
|
libAliasNames = m_libMgr->GetAliasNames( lib );
|
||||||
symbolAliasNames = parent->GetAliasNames();
|
symbolAliasNames = parent->GetAliasNames();
|
||||||
|
|
||||||
for( size_t i = 0; i < symbolAliasNames.GetCount(); i++ )
|
for( size_t i = 0; i < symbolAliasNames.GetCount(); i++ )
|
||||||
|
@ -156,7 +155,7 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
||||||
|
|
||||||
for( size_t i = 0; i < aliases.GetCount(); i++ )
|
for( size_t i = 0; i < aliases.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
if( Prj().SchSymbolLibTable()->LoadSymbol( lib, aliases[ i ] ) != NULL )
|
if( m_libMgr->GetAlias( aliases[i], lib ) != NULL )
|
||||||
parent->RemoveAlias( aliases[ i ] );
|
parent->RemoveAlias( aliases[ i ] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,6 +163,9 @@ void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
|
||||||
|
|
||||||
if( !parent->HasAlias( m_aliasName ) )
|
if( !parent->HasAlias( m_aliasName ) )
|
||||||
m_aliasName = newFieldValue;
|
m_aliasName = newFieldValue;
|
||||||
|
|
||||||
|
//m_libMgr->RemovePart( fieldText, lib );
|
||||||
|
m_libMgr->UpdatePart( parent, lib, fieldText );
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg.UpdateField( aField );
|
dlg.UpdateField( aField );
|
||||||
|
|
Loading…
Reference in New Issue