Clean up atrophied code.

This commit is contained in:
Jeff Young 2023-04-14 18:43:36 +01:00
parent 923f386f08
commit 9f56b75f01
2 changed files with 1 additions and 20 deletions

View File

@ -68,9 +68,8 @@ DIALOG_FIELD_PROPERTIES::DIALOG_FIELD_PROPERTIES( SCH_BASE_FRAME* aParent, const
m_note->SetFont( KIUI::GetInfoFont( this ).Italic() ); m_note->SetFont( KIUI::GetInfoFont( this ).Italic() );
m_note->Show( false ); m_note->Show( false );
// The field ID and power status are Initialized in the derived object's ctor. // The field ID is initialized in the derived object's ctor.
m_fieldId = VALUE_FIELD; m_fieldId = VALUE_FIELD;
m_isPower = false;
m_scintillaTricks = new SCINTILLA_TRICKS( m_StyledTextCtrl, wxT( "{}" ), true, m_scintillaTricks = new SCINTILLA_TRICKS( m_StyledTextCtrl, wxT( "{}" ), true,
[this]() [this]()
@ -422,8 +421,6 @@ DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
m_nameVisible->Show(); m_nameVisible->Show();
m_cbAllowAutoPlace->Show(); m_cbAllowAutoPlace->Show();
// When in the library editor, power symbols can be renamed.
m_isPower = false;
init(); init();
} }
@ -486,8 +483,6 @@ DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
m_font = m_field->GetFont(); m_font = m_field->GetFont();
m_isPower = false;
m_textLabel->SetLabel( aField->GetName() + wxS( ":" ) ); m_textLabel->SetLabel( aField->GetName() + wxS( ":" ) );
m_position = m_field->GetPosition(); m_position = m_field->GetPosition();
@ -498,19 +493,6 @@ DIALOG_SCH_FIELD_PROPERTIES::DIALOG_SCH_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
m_horizontalJustification = m_field->GetEffectiveHorizJustify(); m_horizontalJustification = m_field->GetEffectiveHorizJustify();
m_verticalJustification = m_field->GetEffectiveVertJustify(); m_verticalJustification = m_field->GetEffectiveVertJustify();
// The library symbol may have been removed so using SCH_SYMBOL::GetLibSymbolRef() here
// 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
// be entirely accurate if the power library is missing but it's better then a segfault.
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
{
const SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aField->GetParent() );
const LIB_SYMBOL* libSymbol = GetParent()->GetLibSymbol( symbol->GetLibId(), true );
if( libSymbol && libSymbol->IsPower() )
m_isPower = true;
}
m_StyledTextCtrl->Bind( wxEVT_STC_CHARADDED, &DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded, m_StyledTextCtrl->Bind( wxEVT_STC_CHARADDED, &DIALOG_SCH_FIELD_PROPERTIES::onScintillaCharAdded,
this ); this );
m_StyledTextCtrl->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED, m_StyledTextCtrl->Bind( wxEVT_STC_AUTOCOMP_CHAR_DELETED,

View File

@ -89,7 +89,6 @@ protected:
UNIT_BINDER m_textSize; UNIT_BINDER m_textSize;
int m_fieldId; int m_fieldId;
bool m_isPower;
wxString m_text; wxString m_text;
KIFONT::FONT* m_font; KIFONT::FONT* m_font;
bool m_isItalic; bool m_isItalic;