Convert between refs and KIIDs in Footprint Properties.
Also fixes DIALOG_TEXT_PROPERTIES, which did it correctly for multi-line texts, but not for single-line texts. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16721
This commit is contained in:
parent
89850824d5
commit
65c75072ef
|
@ -261,8 +261,13 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow()
|
|||
return false;
|
||||
|
||||
// Footprint Fields
|
||||
for( PCB_FIELD* field : m_footprint->GetFields() )
|
||||
m_fields->push_back( *field );
|
||||
for( PCB_FIELD* srcField : m_footprint->GetFields() )
|
||||
{
|
||||
PCB_FIELD field( *srcField );
|
||||
field.SetText( m_footprint->GetBoard()->ConvertKIIDsToCrossReferences( field.GetText() ) );
|
||||
|
||||
m_fields->push_back( field );
|
||||
}
|
||||
|
||||
// notify the grid
|
||||
wxGridTableMessage tmsg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED,
|
||||
|
@ -477,6 +482,12 @@ bool DIALOG_FOOTPRINT_PROPERTIES::TransferDataFromWindow()
|
|||
commit.Modify( m_footprint );
|
||||
|
||||
// Update fields
|
||||
for( size_t ii = 0; ii < m_fields->size(); ++ii )
|
||||
{
|
||||
PCB_FIELD& field = m_fields->at( ii );
|
||||
field.SetText( m_footprint->GetBoard()->ConvertCrossReferencesToKIIDs( field.GetText() ) );
|
||||
}
|
||||
|
||||
size_t i = 0;
|
||||
|
||||
for( PCB_FIELD* field : m_footprint->GetFields() )
|
||||
|
|
|
@ -285,10 +285,11 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
{
|
||||
BOARD* board = m_frame->GetBoard();
|
||||
FOOTPRINT* parentFP = m_item->GetParentFootprint();
|
||||
wxString msg = board->ConvertKIIDsToCrossReferences( UnescapeString( m_item->GetText() ) );
|
||||
|
||||
if( m_SingleLineText->IsShown() )
|
||||
{
|
||||
m_SingleLineText->SetValue( m_item->GetText() );
|
||||
m_SingleLineText->SetValue( msg );
|
||||
|
||||
if( m_item->Type() == PCB_FIELD_T && static_cast<PCB_FIELD*>( m_item )->IsReference() )
|
||||
KIUI::SelectReferenceNumber( static_cast<wxTextEntry*>( m_SingleLineText ) );
|
||||
|
@ -297,8 +298,6 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
|
|||
}
|
||||
else if( m_MultiLineText->IsShown() )
|
||||
{
|
||||
wxString msg = board->ConvertKIIDsToCrossReferences( UnescapeString( m_item->GetText() ) );
|
||||
|
||||
m_MultiLineText->SetValue( msg );
|
||||
m_MultiLineText->SetSelection( -1, -1 );
|
||||
m_MultiLineText->EmptyUndoBuffer();
|
||||
|
@ -435,6 +434,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
if( !m_textWidth.Validate( minSize, maxSize ) || !m_textHeight.Validate( minSize, maxSize ) )
|
||||
return false;
|
||||
|
||||
BOARD* board = m_frame->GetBoard();
|
||||
BOARD_COMMIT commit( m_frame );
|
||||
commit.Modify( m_item );
|
||||
|
||||
|
@ -451,13 +451,16 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
|
|||
if( m_SingleLineText->IsShown() )
|
||||
{
|
||||
if( !m_SingleLineText->GetValue().IsEmpty() )
|
||||
m_item->SetText( m_SingleLineText->GetValue() );
|
||||
{
|
||||
wxString txt = board->ConvertCrossReferencesToKIIDs( m_SingleLineText->GetValue() );
|
||||
|
||||
m_item->SetText( txt );
|
||||
}
|
||||
}
|
||||
else if( m_MultiLineText->IsShown() )
|
||||
{
|
||||
if( !m_MultiLineText->GetValue().IsEmpty() )
|
||||
{
|
||||
BOARD* board = m_frame->GetBoard();
|
||||
wxString txt = board->ConvertCrossReferencesToKIIDs( m_MultiLineText->GetValue() );
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
|
Loading…
Reference in New Issue