Eeschema: fix broken component reference field in hierarchies. (fixes lp:1572812)

This commit is contained in:
Wayne Stambaugh 2016-04-22 09:29:47 -04:00
parent 53c031257d
commit ce593f9784
3 changed files with 23 additions and 6 deletions

View File

@ -252,3 +252,24 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
init(); init();
} }
void DIALOG_SCH_EDIT_ONE_FIELD::UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath )
{
wxASSERT( aField != NULL || aField->Type() != SCH_FIELD_T );
if( aField->GetId() == REFERENCE )
{
wxASSERT( aSheetPath != NULL );
SCH_COMPONENT* component = dynamic_cast< SCH_COMPONENT* >( aField->GetParent() );
wxASSERT( component != NULL );
if( component != NULL )
component->SetRef( aSheetPath, m_text );
}
aField->SetText( m_text );
updateText( aField );
}

View File

@ -153,11 +153,7 @@ public:
~DIALOG_SCH_EDIT_ONE_FIELD() {} ~DIALOG_SCH_EDIT_ONE_FIELD() {}
void UpdateField( SCH_FIELD* aField ) void UpdateField( SCH_FIELD* aField, SCH_SHEET_PATH* aSheetPath );
{
aField->SetText( m_text );
updateText( aField );
}
}; };
#endif // DIALOG_EDIT_ONE_FIELD_H_ #endif // DIALOG_EDIT_ONE_FIELD_H_

View File

@ -79,7 +79,7 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
return; return;
} }
dlg.UpdateField( aField ); dlg.UpdateField( aField, m_CurrentSheet );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false ); m_canvas->SetIgnoreMouseEvents( false );
OnModify(); OnModify();