Don't allow component & sheet field IDs to collide.
Fixes https://gitlab.com/kicad/code/kicad/issues/4748
This commit is contained in:
parent
25c5c35176
commit
61b5a12362
|
@ -83,15 +83,6 @@ void DIALOG_EDIT_ONE_FIELD::init()
|
||||||
SCH_BASE_FRAME* parent = GetParent();
|
SCH_BASE_FRAME* parent = GetParent();
|
||||||
bool libedit = parent->IsType( FRAME_SCH_LIB_EDITOR );
|
bool libedit = parent->IsType( FRAME_SCH_LIB_EDITOR );
|
||||||
|
|
||||||
switch( m_fieldId )
|
|
||||||
{
|
|
||||||
case REFERENCE: m_textLabel->SetLabel( _( "Reference designator:" ) ); break;
|
|
||||||
case VALUE: m_textLabel->SetLabel( _( "Value:" ) ); break;
|
|
||||||
case FOOTPRINT: m_textLabel->SetLabel( _( "Footprint ID:" ) ); break;
|
|
||||||
case DATASHEET: m_textLabel->SetLabel( _( "Datasheet URL:" ) ); break;
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_TextCtrl->SetValidator( SCH_FIELD_VALIDATOR( libedit, m_fieldId, &m_text ) );
|
m_TextCtrl->SetValidator( SCH_FIELD_VALIDATOR( libedit, m_fieldId, &m_text ) );
|
||||||
|
|
||||||
// Disable options for graphic text editing which are not needed for fields.
|
// Disable options for graphic text editing which are not needed for fields.
|
||||||
|
@ -281,10 +272,25 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
|
||||||
const SCH_FIELD* aField ) :
|
const SCH_FIELD* aField ) :
|
||||||
DIALOG_EDIT_ONE_FIELD( aParent, aTitle, aField ),
|
DIALOG_EDIT_ONE_FIELD( aParent, aTitle, aField ),
|
||||||
m_field( aField )
|
m_field( aField )
|
||||||
|
{
|
||||||
|
if( aField->GetParent() && aField->GetParent()->Type() == SCH_COMPONENT_T )
|
||||||
{
|
{
|
||||||
m_fieldId = aField->GetId();
|
m_fieldId = aField->GetId();
|
||||||
|
}
|
||||||
|
else if( aField->GetParent() && aField->GetParent()->Type() == SCH_SHEET_T )
|
||||||
|
{
|
||||||
|
switch( aField->GetId() )
|
||||||
|
{
|
||||||
|
case SHEETNAME: m_fieldId = SHEETNAME_V; break;
|
||||||
|
case SHEETFILENAME: m_fieldId = SHEETFILENAME_V; break;
|
||||||
|
default: m_fieldId = SHEETUSERFIELD_V; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_isPower = false;
|
m_isPower = false;
|
||||||
|
|
||||||
|
m_textLabel->SetLabel( m_field->GetName() + ":" );
|
||||||
|
|
||||||
// The library symbol may have been removed so using SCH_COMPONENT::GetPartRef() here
|
// The library symbol may have been removed so using SCH_COMPONENT::GetPartRef() here
|
||||||
// could result in a segfault. If the library symbol is no longer available, the
|
// could result in a segfault. If the library symbol is no longer available, the
|
||||||
// schematic fields can still edit so set the power symbol flag to false. This may not
|
// schematic fields can still edit so set the power symbol flag to false. This may not
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#define SHEETNAME_V 100 // We can't use SHEETNAME and SHEETFILENAME because they
|
#define SHEETNAME_V 100 // We can't use SHEETNAME and SHEETFILENAME because they
|
||||||
#define SHEETFILENAME_V 101 // overlap with REFERENCE and VALUE
|
#define SHEETFILENAME_V 101 // overlap with REFERENCE and VALUE
|
||||||
|
#define SHEETUSERFIELD_V 102
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A text control validator used for validating the text allowed in library and
|
* A text control validator used for validating the text allowed in library and
|
||||||
|
|
Loading…
Reference in New Issue