Renaming: replace convert with body-style.

No functional changes.
This commit is contained in:
Jeff Young 2024-01-26 16:16:13 +00:00
parent c5bd62434b
commit ae735d3eb4
76 changed files with 9664 additions and 9509 deletions

View File

@ -159,8 +159,8 @@ DIALOG_FIELD_PROPERTIES::~DIALOG_FIELD_PROPERTIES()
void DIALOG_FIELD_PROPERTIES::init()
{
// Disable options for graphic text editing which are not needed for fields.
m_CommonConvert->Show( false );
m_CommonUnit->Show( false );
m_commonToAllBodyStyles->Show( false );
m_commonToAllUnits->Show( false );
// Predefined fields cannot contain some chars and cannot be empty, so they need a
// SCH_FIELD_VALIDATOR (m_StyledTextCtrl cannot use a SCH_FIELD_VALIDATOR).

View File

@ -266,11 +266,11 @@ DIALOG_FIELD_PROPERTIES_BASE::DIALOG_FIELD_PROPERTIES_BASE( wxWindow* parent, wx
m_yPosUnits->Wrap( -1 );
gbSizer1->Add( m_yPosUnits, wxGBPosition( 4, 2 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL|wxLEFT, 3 );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_CommonUnit, wxGBPosition( 3, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
m_commonToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_commonToAllUnits, wxGBPosition( 3, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_CommonConvert, wxGBPosition( 4, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
m_commonToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_commonToAllBodyStyles, wxGBPosition( 4, 4 ), wxGBSpan( 1, 1 ), wxRIGHT, 5 );
bPropertiesSizer->Add( gbSizer1, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );

View File

@ -2773,7 +2773,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_CommonUnit</property>
<property name="name">m_commonToAllUnits</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -2841,7 +2841,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_CommonConvert</property>
<property name="name">m_commonToAllBodyStyles</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -83,8 +83,8 @@ class DIALOG_FIELD_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_yPosLabel;
wxTextCtrl* m_yPosCtrl;
wxStaticText* m_yPosUnits;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxCheckBox* m_commonToAllUnits;
wxCheckBox* m_commonToAllBodyStyles;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;

View File

@ -226,12 +226,12 @@ public:
break;
case COL_DEMORGAN:
switch( pin->GetConvert() )
switch( pin->GetBodyStyle() )
{
case LIB_ITEM::LIB_CONVERT::BASE:
case LIB_ITEM::BODY_STYLE::BASE:
val = DEMORGAN_STD;
break;
case LIB_ITEM::LIB_CONVERT::DEMORGAN:
case LIB_ITEM::BODY_STYLE::DEMORGAN:
val = DEMORGAN_ALT;
break;
default:
@ -437,11 +437,11 @@ public:
case COL_DEMORGAN:
if( value == DEMORGAN_STD )
pin->SetConvert( 1 );
pin->SetBodyStyle( 1 );
else if( value == DEMORGAN_ALT )
pin->SetConvert( 2 );
pin->SetBodyStyle( 2 );
else
pin->SetConvert( 0 );
pin->SetBodyStyle( 0 );
break;
default:

View File

@ -126,18 +126,18 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
m_checkApplyToAllUnits->SetValue(
symbol && symbol->GetUnitCount() > 1 && m_shape->GetUnit() == 0 );
m_checkApplyToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 );
m_checkApplyToAllConversions->SetValue( m_shape->GetConvert() == 0 );
m_checkApplyToAllBodyStyles->SetValue( m_shape->GetBodyStyle() == 0 );
bool enblConvOptStyle = symbol && symbol->HasConversion();
bool enableAlternateBodyStyle = symbol && symbol->HasAlternateBodyStyle();
// If a symbol contains no conversion-specific pins or graphic items, symbol->HasConversion()
// will return false.
// But when creating a new symbol, with DeMorgan option set, the ApplyToAllConversions
// If a symbol contains no body-style-specific pins or graphic items,
// symbol->HasAlternateBodyStyle() will return false.
// But when creating a new symbol, with DeMorgan option set, the m_checkApplyToAllBodyStyles
// must be enabled in order to be able to create graphic items shared by all body styles.
if( m_frame->GetShowDeMorgan() )
enblConvOptStyle = true;
enableAlternateBodyStyle = true;
m_checkApplyToAllConversions->Enable( enblConvOptStyle );
m_checkApplyToAllBodyStyles->Enable( enableAlternateBodyStyle );
m_rbFillNone->Enable( true );
m_rbFillOutline->Enable( true );
@ -282,9 +282,9 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
m_shape->SetPrivate( m_privateCheckbox->GetValue() );
if( GetApplyToAllConversions() )
m_shape->SetConvert( 0 );
m_shape->SetBodyStyle( 0 );
else
m_shape->SetConvert( m_frame->GetConvert() );
m_shape->SetBodyStyle( m_frame->GetBodyStyle() );
if( GetApplyToAllUnits() )
m_shape->SetUnit( 0 );
@ -297,7 +297,7 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
bool DIALOG_LIB_SHAPE_PROPERTIES::GetApplyToAllConversions()
{
return m_checkApplyToAllConversions->IsChecked();
return m_checkApplyToAllBodyStyles->IsChecked();
}

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -154,8 +154,8 @@ DIALOG_LIB_SHAPE_PROPERTIES_BASE::DIALOG_LIB_SHAPE_PROPERTIES_BASE( wxWindow* pa
bBottom->Add( 0, 0, 1, wxEXPAND, 5 );
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
bBottom->Add( m_checkApplyToAllConversions, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_checkApplyToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
bBottom->Add( m_checkApplyToAllBodyStyles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
mainSizer->Add( bBottom, 0, wxEXPAND|wxALL, 10 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -74,7 +74,7 @@ class DIALOG_LIB_SHAPE_PROPERTIES_BASE : public DIALOG_SHIM
COLOR_SWATCH* m_fillColorSwatch;
wxCheckBox* m_privateCheckbox;
wxCheckBox* m_checkApplyToAllUnits;
wxCheckBox* m_checkApplyToAllConversions;
wxCheckBox* m_checkApplyToAllBodyStyles;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;

View File

@ -174,11 +174,12 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
m_OptionPartsInterchangeable->SetValue( !m_libEntry->UnitsLocked() ||
m_libEntry->GetUnitCount() == 1 );
// If a symbol contains no conversion-specific pins or graphic items, symbol->HasConversion()
// will return false. But when editing a symbol with DeMorgan option set, we don't want to
// keep turning it off just because there aren't any conversion-specific items yet, so we force
// it to on if the parent frame has it enabled.
m_AsConvertButt->SetValue( m_Parent->GetShowDeMorgan() );
// If a symbol contains no body-style-specific pins or graphic items,
// symbol->HasAlternateBodyStyle() will return false.
// But when editing a symbol with DeMorgan option set, we don't want to keep turning it off
// just because there aren't any body-style-specific items yet, so we force it to on if the
// parent frame has it enabled.
m_hasAlternateBodyStyles->SetValue( m_Parent->GetShowDeMorgan() );
m_OptionPower->SetValue( m_libEntry->IsPower() );
@ -296,7 +297,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate()
return false;
}
if( !m_AsConvertButt->GetValue() && m_libEntry->HasConversion() )
if( !m_hasAlternateBodyStyles->GetValue() && m_libEntry->HasAlternateBodyStyle() )
{
if( !IsOK( this, _( "Delete alternate body style (De Morgan) from symbol?" ) ) )
return false;
@ -391,8 +392,8 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
m_libEntry->SetUnitCount( m_SelNumberOfUnits->GetValue() );
m_libEntry->LockUnits( m_libEntry->GetUnitCount() > 1 &&
!m_OptionPartsInterchangeable->GetValue() );
m_libEntry->SetConversion( m_AsConvertButt->GetValue() );
m_Parent->SetShowDeMorgan( m_AsConvertButt->GetValue() );
m_libEntry->SetHasAlternateBodyStyle( m_hasAlternateBodyStyles->GetValue() );
m_Parent->SetShowDeMorgan( m_hasAlternateBodyStyles->GetValue() );
if( m_OptionPower->GetValue() )
{
@ -429,9 +430,10 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
m_Parent->UpdateAfterSymbolProperties( &oldName );
// It's possible that the symbol being edited has no pins, in which case there may be no
// alternate body style objects causing #LIB_SYMBOL::HasCoversion() to always return false.
// This allows the user to edit the alternate body style just in case this condition occurs.
m_Parent->SetShowDeMorgan( m_AsConvertButt->GetValue() );
// alternate body style objects causing #LIB_SYMBOL::HasAlternateBodyStyle() to always return
// false. This allows the user to edit the alternate body style just in case this condition
// occurs.
m_Parent->SetShowDeMorgan( m_hasAlternateBodyStyles->GetValue() );
return true;
}

View File

@ -187,10 +187,10 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow*
sbSizerSymbol->Add( 0, 8, 0, wxEXPAND, 5 );
m_AsConvertButt = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Has alternate body style (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_AsConvertButt->SetToolTip( _("Check this option if the symbol has an alternate body style for a De Morgan logic equivalence.\nFor instance, this should be checked for a NAND gate to provide an alternate representation as an OR gate with inverted inputs.") );
m_hasAlternateBodyStyles = new wxCheckBox( sbSizerSymbol->GetStaticBox(), wxID_ANY, _("Has alternate body style (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
m_hasAlternateBodyStyles->SetToolTip( _("Check this option if the symbol has an alternate body style for a De Morgan logic equivalence.\nFor instance, this should be checked for a NAND gate to provide an alternate representation as an OR gate with inverted inputs.") );
sbSizerSymbol->Add( m_AsConvertButt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
sbSizerSymbol->Add( m_hasAlternateBodyStyles, 0, wxBOTTOM|wxRIGHT|wxLEFT, 4 );
sbSizerSymbol->Add( 0, 7, 0, wxEXPAND, 5 );
@ -391,7 +391,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::DIALOG_LIB_SYMBOL_PROPERTIES_BASE( wxWindow*
m_SelNumberOfUnits->Connect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrl ), NULL, this );
m_SelNumberOfUnits->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrlText ), NULL, this );
m_OptionPartsInterchangeable->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_AsConvertButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_hasAlternateBodyStyles->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_OptionPower->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::onPowerCheckBox ), NULL, this );
m_ShowPinNumButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_ShowPinNameButt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
@ -426,7 +426,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES_BASE::~DIALOG_LIB_SYMBOL_PROPERTIES_BASE()
m_SelNumberOfUnits->Disconnect( wxEVT_COMMAND_SPINCTRL_UPDATED, wxSpinEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrl ), NULL, this );
m_SelNumberOfUnits->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnSpinCtrlText ), NULL, this );
m_OptionPartsInterchangeable->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_AsConvertButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_hasAlternateBodyStyles->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_OptionPower->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::onPowerCheckBox ), NULL, this );
m_ShowPinNumButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );
m_ShowPinNameButt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_LIB_SYMBOL_PROPERTIES_BASE::OnCheckBox ), NULL, this );

View File

@ -1318,7 +1318,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_AsConvertButt</property>
<property name="name">m_hasAlternateBodyStyles</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -66,7 +66,7 @@ class DIALOG_LIB_SYMBOL_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_staticTextNbUnits;
wxSpinCtrl* m_SelNumberOfUnits;
wxCheckBox* m_OptionPartsInterchangeable;
wxCheckBox* m_AsConvertButt;
wxCheckBox* m_hasAlternateBodyStyles;
wxCheckBox* m_OptionPower;
wxCheckBox* m_ShowPinNumButt;
wxCheckBox* m_ShowPinNameButt;

View File

@ -122,7 +122,7 @@ DIALOG_LIB_TEXT_PROPERTIES::~DIALOG_LIB_TEXT_PROPERTIES()
bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
{
wxCHECK( m_CommonUnit, false );
wxCHECK( m_commonToAllUnits, false );
LIB_SYMBOL* symbol = nullptr;
@ -143,9 +143,9 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
m_bold->Check( m_graphicText->IsBold() );
m_privateCheckbox->SetValue( m_graphicText->IsPrivate() );
m_CommonUnit->SetValue(
symbol && symbol->GetUnitCount() > 1 && m_graphicText->GetUnit() == 0 );
m_CommonConvert->SetValue( m_graphicText->GetConvert() == 0 );
m_commonToAllUnits->SetValue( symbol && symbol->GetUnitCount() > 1
&& m_graphicText->GetUnit() == 0 );
m_commonToAllBodyStyles->SetValue( m_graphicText->GetBodyStyle() == 0 );
if( m_graphicText->GetTextAngle().IsHorizontal() )
m_horizontal->Check();
@ -176,8 +176,8 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
m_textSize.SetValue( schIUScale.MilsToIU( cfg->m_Defaults.text_size ) );
m_CommonUnit->SetValue( symbol->GetUnitCount() > 1 && !tools->GetDrawSpecificUnit() );
m_CommonConvert->SetValue( !tools->GetDrawSpecificConvert() );
m_commonToAllUnits->SetValue( symbol->GetUnitCount() > 1 && !tools->GetDrawSpecificUnit() );
m_commonToAllBodyStyles->SetValue( !tools->GetDrawSpecificBodyStyle() );
if( tools->GetLastTextAngle().IsHorizontal() )
m_horizontal->Check();
@ -185,7 +185,7 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
m_vertical->Check();
}
m_CommonUnit->Enable( symbol && symbol->GetUnitCount() > 1 );
m_commonToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 );
return true;
}
@ -252,15 +252,15 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
m_graphicText->SetPrivate( m_privateCheckbox->GetValue() );
if( !m_CommonUnit->GetValue() )
if( !m_commonToAllUnits->GetValue() )
m_graphicText->SetUnit( m_parent->GetUnit() );
else
m_graphicText->SetUnit( 0 );
if( !m_CommonConvert->GetValue() )
m_graphicText->SetConvert( m_parent->GetConvert() );
if( !m_commonToAllBodyStyles->GetValue() )
m_graphicText->SetBodyStyle( m_parent->GetBodyStyle() );
else
m_graphicText->SetConvert( 0 );
m_graphicText->SetBodyStyle( 0 );
m_graphicText->SetItalic( m_italic->IsChecked() );
m_graphicText->SetBold( m_bold->IsChecked() );
@ -283,8 +283,8 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataFromWindow()
// Record settings used for next time:
auto* tools = m_parent->GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
tools->SetLastTextAngle( m_graphicText->GetTextAngle() );
tools->SetDrawSpecificConvert( !m_CommonConvert->GetValue() );
tools->SetDrawSpecificUnit( !m_CommonUnit->GetValue() );
tools->SetDrawSpecificBodyStyle( !m_commonToAllBodyStyles->GetValue() );
tools->SetDrawSpecificUnit( !m_commonToAllUnits->GetValue() );
}
m_parent->SetMsgPanel( m_graphicText );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -196,11 +196,11 @@ DIALOG_LIB_TEXT_PROPERTIES_BASE::DIALOG_LIB_TEXT_PROPERTIES_BASE( wxWindow* pare
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to Symbol Editor"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_privateCheckbox, wxGBPosition( 5, 0 ), wxGBSpan( 1, 2 ), wxLEFT, 5 );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_CommonUnit, wxGBPosition( 5, 3 ), wxGBSpan( 1, 1 ), wxLEFT, 100 );
m_commonToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_commonToAllUnits, wxGBPosition( 5, 3 ), wxGBSpan( 1, 1 ), wxLEFT, 100 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_CommonConvert, wxGBPosition( 6, 3 ), wxGBSpan( 1, 1 ), wxLEFT, 100 );
m_commonToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
gbSizer1->Add( m_commonToAllBodyStyles, wxGBPosition( 6, 3 ), wxGBSpan( 1, 1 ), wxLEFT, 100 );
bPropertiesSizer->Add( gbSizer1, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -71,8 +71,8 @@ class DIALOG_LIB_TEXT_PROPERTIES_BASE : public DIALOG_SHIM
wxPanel* m_panelBorderColor1;
COLOR_SWATCH* m_textColorSwatch;
wxCheckBox* m_privateCheckbox;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxCheckBox* m_commonToAllUnits;
wxCheckBox* m_commonToAllBodyStyles;
wxStdDialogButtonSizer* m_sdbSizerButtons;
wxButton* m_sdbSizerButtonsOK;
wxButton* m_sdbSizerButtonsCancel;

View File

@ -213,10 +213,10 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
m_fillColorSwatch->Enable( m_currentText->IsFilled() );
m_privateCheckbox->SetValue( m_currentText->IsPrivate() );
m_CommonUnit->SetValue(
m_commonToAllUnits->SetValue(
symbol && symbol->GetUnitCount() > 1 && m_currentText->GetUnit() == 0 );
m_CommonUnit->Enable( symbol && symbol->GetUnitCount() > 1 );
m_CommonConvert->SetValue( m_currentText->GetConvert() == 0 );
m_commonToAllUnits->Enable( symbol && symbol->GetUnitCount() > 1 );
m_commonToAllBodyStyles->SetValue( m_currentText->GetBodyStyle() == 0 );
return true;
}
@ -340,21 +340,21 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow()
m_currentText->SetPrivate( m_privateCheckbox->GetValue() );
if( !m_CommonUnit->GetValue() )
if( !m_commonToAllUnits->GetValue() )
m_currentText->SetUnit( m_frame->GetUnit() );
else
m_currentText->SetUnit( 0 );
if( !m_CommonConvert->GetValue() )
m_currentText->SetConvert( m_frame->GetConvert() );
if( !m_commonToAllBodyStyles->GetValue() )
m_currentText->SetBodyStyle( m_frame->GetBodyStyle() );
else
m_currentText->SetConvert( 0 );
m_currentText->SetBodyStyle( 0 );
// Record settings used for next time:
auto* tools = m_frame->GetToolManager()->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
tools->SetLastTextAngle( m_currentText->GetTextAngle() );
tools->SetDrawSpecificConvert( !m_CommonConvert->GetValue() );
tools->SetDrawSpecificUnit( !m_CommonUnit->GetValue() );
tools->SetDrawSpecificBodyStyle( !m_commonToAllBodyStyles->GetValue() );
tools->SetDrawSpecificUnit( !m_commonToAllUnits->GetValue() );
m_frame->SetMsgPanel( m_currentText );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -285,11 +285,11 @@ DIALOG_LIB_TEXTBOX_PROPERTIES_BASE::DIALOG_LIB_TEXTBOX_PROPERTIES_BASE( wxWindow
m_privateCheckbox = new wxCheckBox( this, wxID_ANY, _("Private to symbol editor"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_privateCheckbox, wxGBPosition( 9, 0 ), wxGBSpan( 1, 2 ), 0, 5 );
m_CommonUnit = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_CommonUnit, wxGBPosition( 9, 4 ), wxGBSpan( 1, 2 ), 0, 5 );
m_commonToAllUnits = new wxCheckBox( this, wxID_ANY, _("Common to all units"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_commonToAllUnits, wxGBPosition( 9, 4 ), wxGBSpan( 1, 2 ), 0, 5 );
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_CommonConvert, wxGBPosition( 10, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 90 );
m_commonToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body styles"), wxDefaultPosition, wxDefaultSize, 0 );
m_textEntrySizer->Add( m_commonToAllBodyStyles, wxGBPosition( 10, 4 ), wxGBSpan( 1, 2 ), wxRIGHT, 90 );
m_textEntrySizer->AddGrowableCol( 3 );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -88,8 +88,8 @@ class DIALOG_LIB_TEXTBOX_PROPERTIES_BASE : public DIALOG_SHIM
wxPanel* m_panelFillColor;
COLOR_SWATCH* m_fillColorSwatch;
wxCheckBox* m_privateCheckbox;
wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert;
wxCheckBox* m_commonToAllUnits;
wxCheckBox* m_commonToAllBodyStyles;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;

View File

@ -197,7 +197,7 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN
OnAddAlternate( aEvent );
} ) );
if( aPin->GetParent()->HasConversion() )
if( aPin->GetParent()->HasAlternateBodyStyle() )
{
m_alternatesTurndown->Collapse();
m_alternatesTurndown->Disable();
@ -268,7 +268,7 @@ bool DIALOG_PIN_PROPERTIES::TransferDataToWindow()
m_pinLength.SetValue( m_pin->GetLength() );
m_checkApplyToAllParts->Enable( m_pin->GetParent()->IsMulti() );
m_checkApplyToAllParts->SetValue( m_pin->GetParent()->IsMulti() && m_pin->GetUnit() == 0 );
m_checkApplyToAllConversions->SetValue( m_pin->GetConvert() == 0 );
m_checkApplyToAllBodyStyles->SetValue( m_pin->GetBodyStyle() == 0 );
m_checkShow->SetValue( m_pin->IsVisible() );
m_dummyPin->SetVisible( m_pin->IsVisible() );
@ -360,7 +360,7 @@ bool DIALOG_PIN_PROPERTIES::TransferDataFromWindow()
m_pin->ChangeLength( m_pinLength.GetValue() );
m_pin->SetType( m_choiceElectricalType->GetPinTypeSelection() );
m_pin->SetShape( m_choiceStyle->GetPinShapeSelection() );
m_pin->SetConvert( m_checkApplyToAllConversions->GetValue() ? 0 : m_frame->GetConvert() );
m_pin->SetBodyStyle( m_checkApplyToAllBodyStyles->GetValue() ? 0 : m_frame->GetBodyStyle() );
m_pin->SetUnit( m_checkApplyToAllParts->GetValue() ? 0 : m_frame->GetUnit() );
m_pin->SetVisible( m_checkShow->GetValue() );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -154,8 +154,8 @@ DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWind
m_checkApplyToAllParts = new wxCheckBox( this, wxID_ANY, _("Common to all &units in symbol"), wxDefaultPosition, wxDefaultSize, 0 );
checkboxesSizer->Add( m_checkApplyToAllParts, 0, wxBOTTOM, 3 );
m_checkApplyToAllConversions = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
checkboxesSizer->Add( m_checkApplyToAllConversions, 0, wxBOTTOM, 3 );
m_checkApplyToAllBodyStyles = new wxCheckBox( this, wxID_ANY, _("Common to all body &styles (De Morgan)"), wxDefaultPosition, wxDefaultSize, 0 );
checkboxesSizer->Add( m_checkApplyToAllBodyStyles, 0, wxBOTTOM, 3 );
checkboxesSizer->Add( 0, 0, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
@ -283,7 +283,7 @@ DIALOG_PIN_PROPERTIES_BASE::DIALOG_PIN_PROPERTIES_BASE( wxWindow* parent, wxWind
m_choiceStyle->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllParts->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllConversions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllBodyStyles->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkShow->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_panelShowPin->Connect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
m_alternatesTurndown->Connect( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnCollapsiblePaneChange ), NULL, this );
@ -305,7 +305,7 @@ DIALOG_PIN_PROPERTIES_BASE::~DIALOG_PIN_PROPERTIES_BASE()
m_choiceStyle->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_choiceOrientation->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllParts->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllConversions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkApplyToAllBodyStyles->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_checkShow->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPropertiesChange ), NULL, this );
m_panelShowPin->Disconnect( wxEVT_PAINT, wxPaintEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnPaintShowPanel ), NULL, this );
m_alternatesTurndown->Disconnect( wxEVT_COLLAPSIBLEPANE_CHANGED, wxCollapsiblePaneEventHandler( DIALOG_PIN_PROPERTIES_BASE::OnCollapsiblePaneChange ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 4.0.0-0-g0efcecf)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -77,7 +77,7 @@ class DIALOG_PIN_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticText* m_nameSizeUnits;
wxStaticText* m_numberSizeUnits;
wxCheckBox* m_checkApplyToAllParts;
wxCheckBox* m_checkApplyToAllConversions;
wxCheckBox* m_checkApplyToAllBodyStyles;
wxCheckBox* m_checkShow;
wxStaticText* m_staticText16;
wxPanel* m_panelShowPin;

View File

@ -83,7 +83,7 @@ DIALOG_SIM_MODEL<T_symbol, T_field>::DIALOG_SIM_MODEL( wxWindow* aParent, EDA_BA
for( LIB_PIN* pin : aSymbol.GetAllLibPins() )
{
// De Morgan conversions are equivalences, not additional items to simulate
if( !pin->GetParent()->HasConversion() || pin->GetConvert() < 2 )
if( !pin->GetParent()->HasAlternateBodyStyle() || pin->GetBodyStyle() < 2 )
m_sortedPartPins.push_back( pin );
}

View File

@ -348,7 +348,7 @@ DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES( SCH_EDIT_FRAME* aParent,
m_shownColumns = m_fieldsGrid->GetShownColumns();
}
if( m_part && m_part->HasConversion() )
if( m_part && m_part->HasAlternateBodyStyle() )
{
// DeMorgan conversions are a subclass of alternate pin assignments, so don't allow
// free-form alternate assignments as well. (We won't know how to map the alternates
@ -499,9 +499,9 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataToWindow()
m_unitChoice->Enable( false );
}
if( m_part && m_part->HasConversion() )
if( m_part && m_part->HasAlternateBodyStyle() )
{
if( m_symbol->GetConvert() > LIB_ITEM::LIB_CONVERT::BASE )
if( m_symbol->GetBodyStyle() > LIB_ITEM::BODY_STYLE::BASE )
m_cbAlternateSymbol->SetValue( true );
}
else
@ -696,9 +696,9 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
// For symbols with multiple shapes (De Morgan representation) Set the selected shape:
if( m_cbAlternateSymbol->IsEnabled() && m_cbAlternateSymbol->GetValue() )
m_symbol->SetConvert( LIB_ITEM::LIB_CONVERT::DEMORGAN );
m_symbol->SetBodyStyle( LIB_ITEM::BODY_STYLE::DEMORGAN );
else
m_symbol->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
m_symbol->SetBodyStyle( LIB_ITEM::BODY_STYLE::BASE );
//Set the part selection in multiple part per package
int unit_selection = m_unitChoice->IsEnabled() ? m_unitChoice->GetSelection() + 1 : 1;

View File

@ -378,7 +378,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
LIB_SHAPE* comp_body = new LIB_SHAPE( symbol, SHAPE_T::POLY );
comp_body->SetUnit( 0 );
comp_body->SetConvert( 0 );
comp_body->SetBodyStyle( 0 );
comp_body->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
comp_body->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
comp_body->AddPoint( MILS_POINT( p.x - 200, p.y + 200 ) );

View File

@ -87,7 +87,7 @@ const std::vector<KICAD_T> EE_COLLECTOR::FieldOwners = {
INSPECT_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
{
if( m_Unit || m_Convert )
if( m_Unit || m_BodyStyle )
{
LIB_ITEM* lib_item = dynamic_cast<LIB_ITEM*>( aItem );
@ -99,7 +99,7 @@ INSPECT_RESULT EE_COLLECTOR::Inspect( EDA_ITEM* aItem, void* aTestData )
if( m_Unit && lib_item->GetUnit() && lib_item->GetUnit() != m_Unit )
return INSPECT_RESULT::CONTINUE;
if( m_Convert && lib_item->GetConvert() && lib_item->GetConvert() != m_Convert )
if( m_BodyStyle && lib_item->GetBodyStyle() && lib_item->GetBodyStyle() != m_BodyStyle )
return INSPECT_RESULT::CONTINUE;
}
}
@ -122,8 +122,8 @@ void EE_COLLECTOR::Collect( SCH_SCREEN* aScreen, const std::vector<KICAD_T>& aFi
Empty(); // empty the collection just in case
SetScanTypes( aFilterList );
m_Unit = aUnit;
m_Convert = aConvert;
m_Unit = aUnit;
m_BodyStyle = aConvert;
// remember where the snapshot was taken from and pass refPos to the Inspect() function.
SetRefPos( aPos );
@ -143,7 +143,7 @@ void EE_COLLECTOR::Collect( LIB_ITEMS_CONTAINER& aItems, const std::vector<KICAD
SetScanTypes( aFilterList );
m_Unit = aUnit;
m_Convert = aConvert;
m_BodyStyle = aConvert;
// remember where the snapshot was taken from and pass refPos to the Inspect() function.
SetRefPos( aPos );

View File

@ -44,9 +44,9 @@ public:
static const std::vector<KICAD_T> FieldOwners;
EE_COLLECTOR( const std::vector<KICAD_T>& aScanTypes = { SCH_LOCATE_ANY_T } ) :
m_Unit( 0 ),
m_Convert( 0 ),
m_ShowPinElectricalTypes( false )
m_Unit( 0 ),
m_BodyStyle( 0 ),
m_ShowPinElectricalTypes( false )
{
SetScanTypes( aScanTypes );
}
@ -102,7 +102,7 @@ public:
public:
int m_Unit; // Fixed symbol unit filter (for symbol editor)
int m_Convert; // Fixed DeMorgan filter (for symbol editor)
int m_BodyStyle; // Fixed DeMorgan filter (for symbol editor)
bool m_ShowPinElectricalTypes;
};

View File

@ -692,7 +692,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
// iterate from unit 1, unit 0 would be "all units" which we don't want
for( int unit = 1; unit < symbol->GetUnitCount() + 1; unit++ )
{
for( int convert = 1; convert < ( symbol->HasConversion() ? 2 : 1 ) + 1; ++convert )
for( int bodyStyle = 1; bodyStyle < ( symbol->HasAlternateBodyStyle() ? 2 : 1 ) + 1; ++bodyStyle )
{
wxString filename;
wxFileName fn;
@ -715,7 +715,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
{
filename += wxString::Format( "_%d", unit );
if( convert == 2 )
if( bodyStyle == 2 )
filename += wxS( "_demorgan" );
fn.SetName( filename );
@ -725,7 +725,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
}
else
{
if( convert == 2 )
if( bodyStyle == 2 )
filename += wxS( "_demorgan" );
fn.SetName( filename );
@ -735,7 +735,7 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
}
// Get the symbol bounding box to fit the plot page to it
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, convert, false );
BOX2I symbolBB = symbol->Flatten()->GetUnitBoundingBox( unit, bodyStyle, false );
PAGE_INFO pageInfo( PAGE_INFO::Custom );
pageInfo.SetHeightMils( schIUScale.IUToMils( symbolBB.GetHeight() * 1.2 ) );
pageInfo.SetWidthMils( schIUScale.IUToMils( symbolBB.GetWidth() * 1.2 ) );
@ -775,12 +775,12 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
plotPos.y = pageInfo.GetHeightIU( schIUScale.IU_PER_MILS ) / 2;
// note, we want the fields from the original symbol pointer (in case of non-alias)
symbolToPlot->Plot( plotter, unit, convert, background, plotPos, temp, false );
symbol->PlotLibFields( plotter, unit, convert, background, plotPos, temp, false,
symbolToPlot->Plot( plotter, unit, bodyStyle, background, plotPos, temp, false );
symbol->PlotLibFields( plotter, unit, bodyStyle, background, plotPos, temp, false,
aSvgJob->m_includeHiddenFields );
symbolToPlot->Plot( plotter, unit, convert, !background, plotPos, temp, false );
symbol->PlotLibFields( plotter, unit, convert, !background, plotPos, temp, false,
symbolToPlot->Plot( plotter, unit, bodyStyle, !background, plotPos, temp, false );
symbol->PlotLibFields( plotter, unit, bodyStyle, !background, plotPos, temp, false,
aSvgJob->m_includeHiddenFields );
plotter->EndPlot();

View File

@ -498,7 +498,7 @@ int ERC_TESTER::TestMissingUnits()
{
if( refList.GetItem( ii ).GetUnit() == missing_unit )
{
convert = refList.GetItem( ii ).GetSymbol()->GetConvert();
convert = refList.GetItem( ii ).GetSymbol()->GetBodyStyle();
break;
}
}

View File

@ -35,10 +35,10 @@ const int fill_tab[3] = { 'N', 'F', 'f' };
LIB_ITEM::LIB_ITEM( KICAD_T aType, LIB_SYMBOL* aSymbol, int aUnit, int aConvert ) :
EDA_ITEM( aSymbol, aType ),
m_unit( aUnit ),
m_convert( aConvert ),
m_private( false )
EDA_ITEM( aSymbol, aType ),
m_unit( aUnit ),
m_bodyStyle( aConvert ),
m_private( false )
{
}
@ -56,9 +56,9 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
aList.emplace_back( _( "Unit" ), msg );
if( m_convert == LIB_ITEM::LIB_CONVERT::BASE )
if( m_bodyStyle == LIB_ITEM::BODY_STYLE::BASE )
msg = _( "no" );
else if( m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN )
else if( m_bodyStyle == LIB_ITEM::BODY_STYLE::DEMORGAN )
msg = _( "yes" );
else
msg = wxT( "?" );
@ -79,8 +79,8 @@ int LIB_ITEM::compare( const LIB_ITEM& aOther, int aCompareFlags ) const
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_unit != aOther.m_unit )
return m_unit - aOther.m_unit;
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_convert != aOther.m_convert )
return m_convert - aOther.m_convert;
if( !( aCompareFlags & COMPARE_FLAGS::UNIT ) && m_bodyStyle != aOther.m_bodyStyle )
return m_bodyStyle - aOther.m_bodyStyle;
if( IsPrivate() != aOther.IsPrivate() )
return IsPrivate() < aOther.IsPrivate();

View File

@ -73,8 +73,12 @@ public:
virtual ~LIB_ITEM() { }
// Define the enums for basic
enum LIB_CONVERT : int { BASE = 1, DEMORGAN = 2 };
// Define the enums for basic body styles
enum BODY_STYLE : int
{
BASE = 1,
DEMORGAN = 2
};
/**
* The list of flags used by the #compare function.
@ -224,7 +228,7 @@ public:
if( m_unit != aItem.m_unit )
similarity *= 0.9;
if( m_convert != aItem.m_convert )
if( m_bodyStyle != aItem.m_bodyStyle )
similarity *= 0.9;
if( m_private != aItem.m_private )
@ -335,8 +339,8 @@ public:
void SetUnit( int aUnit ) { m_unit = aUnit; }
int GetUnit() const { return m_unit; }
void SetConvert( int aConvert ) { m_convert = aConvert; }
int GetConvert() const { return m_convert; }
void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
int GetBodyStyle() const { return m_bodyStyle; }
void SetPrivate( bool aPrivate ) { m_private = aPrivate; }
bool IsPrivate() const { return m_private; }
@ -398,7 +402,7 @@ protected:
* Shape identification for alternate body styles. Set 0 if the item is common to all
* body styles. This is typially used for representing DeMorgan variants in KiCad.
*/
int m_convert;
int m_bodyStyle;
/**
* Private items are shown only in the Symbol Editor.

View File

@ -123,7 +123,7 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent ) :
LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aNumber,
PIN_ORIENTATION aOrientation, ELECTRICAL_PINTYPE aPinType, int aLength,
int aNameTextSize, int aNumTextSize, int aConvert, const VECTOR2I& aPos,
int aNameTextSize, int aNumTextSize, int aBodyStyle, const VECTOR2I& aPos,
int aUnit ) :
LIB_ITEM( LIB_PIN_T, aParent ),
m_position( aPos ),
@ -138,7 +138,7 @@ LIB_PIN::LIB_PIN( LIB_SYMBOL* aParent, const wxString& aName, const wxString& aN
SetName( aName );
SetNumber( aNumber );
SetUnit( aUnit );
SetConvert( aConvert );
SetBodyStyle( aBodyStyle );
}

View File

@ -355,7 +355,7 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags, REPORTER* aR
{
const LIB_PIN* aPin = static_cast<const LIB_PIN*>( aPinItem );
const LIB_PIN* bPin = aRhs.GetPin( aPin->GetNumber(), aPin->GetUnit(),
aPin->GetConvert() );
aPin->GetBodyStyle() );
if( !bPin )
{
@ -777,7 +777,7 @@ wxString LIB_SYMBOL::LetterSubReference( int aUnit, int aFirstId )
void LIB_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset,
int aUnit, int aConvert, const LIB_SYMBOL_OPTIONS& aOpts,
int aUnit, int aBodyStyle, const LIB_SYMBOL_OPTIONS& aOpts,
bool aDimmed )
{
/* draw background for filled items using background option
@ -800,7 +800,7 @@ void LIB_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR
if( aUnit && shape.m_unit && ( shape.m_unit != aUnit ) )
continue;
if( aConvert && shape.m_convert && ( shape.m_convert != aConvert ) )
if( aBodyStyle && shape.m_bodyStyle && ( shape.m_bodyStyle != aBodyStyle ) )
continue;
if( shape.GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
@ -812,7 +812,7 @@ void LIB_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR
void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aUnit,
int aConvert, const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed )
int aBodyStyle, const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed )
{
for( LIB_ITEM& item : m_drawings )
@ -825,7 +825,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
continue;
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
continue;
if( item.Type() == LIB_FIELD_T )
@ -862,7 +862,7 @@ void LIB_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
}
void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackground,
void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I &aOffset, const TRANSFORM &aTransform, bool aDimmed ) const
{
wxASSERT( aPlotter != nullptr );
@ -895,7 +895,7 @@ void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackgro
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
continue;
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
continue;
item.Plot( aPlotter, aBackground, aOffset, aTransform, aDimmed );
@ -903,7 +903,7 @@ void LIB_SYMBOL::Plot( PLOTTER *aPlotter, int aUnit, int aConvert, bool aBackgro
}
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed,
bool aPlotHidden )
{
@ -934,7 +934,7 @@ void LIB_SYMBOL::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool
if( aUnit && item.m_unit && ( item.m_unit != aUnit ) )
continue;
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
continue;
LIB_FIELD& field = (LIB_FIELD&) item;
@ -1034,13 +1034,13 @@ void LIB_SYMBOL::AddDrawItem( LIB_ITEM* aItem, bool aSort )
}
void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aBodyStyle ) const
{
/* Notes:
* when aUnit == 0: no unit filtering
* when aConvert == 0: no convert (shape selection) filtering
* when m_unit == 0, the body item is common to units
* when m_convert == 0, the body item is common to shapes
* when aBodyStyle == 0: no body style filtering
* when m_unit == 0, the item is common to all units
* when m_bodyStyle == 0, the item is common to all body styles
*/
LIB_SYMBOL_SPTR parent = m_parent.lock();
@ -1053,7 +1053,7 @@ void LIB_SYMBOL::GetPins( LIB_PINS& aList, int aUnit, int aConvert ) const
continue;
// De Morgan variant filtering:
if( aConvert && item.m_convert && ( item.m_convert != aConvert ) )
if( aBodyStyle && item.m_bodyStyle && ( item.m_bodyStyle != aBodyStyle ) )
continue;
aList.push_back( (LIB_PIN*) &item );
@ -1079,11 +1079,11 @@ int LIB_SYMBOL::GetPinCount()
}
LIB_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aConvert ) const
LIB_PIN* LIB_SYMBOL::GetPin( const wxString& aNumber, int aUnit, int aBodyStyle ) const
{
LIB_PINS pinList;
GetPins( pinList, aUnit, aConvert );
GetPins( pinList, aUnit, aBodyStyle );
for( LIB_PIN* pin : pinList )
{
@ -1101,13 +1101,13 @@ bool LIB_SYMBOL::PinsConflictWith( const LIB_SYMBOL& aOtherPart, bool aTestNums,
bool aTestType, bool aTestOrientation, bool aTestLength ) const
{
LIB_PINS thisPinList;
GetPins( thisPinList, /* aUnit */ 0, /* aConvert */ 0 );
GetPins( thisPinList, /* aUnit */ 0, /* aBodyStyle */ 0 );
for( const LIB_PIN* eachThisPin : thisPinList )
{
wxASSERT( eachThisPin );
LIB_PINS otherPinList;
aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aConvert */ 0 );
aOtherPart.GetPins( otherPinList, /* aUnit */ 0, /* aBodyStyle */ 0 );
bool foundMatch = false;
for( const LIB_PIN* eachOtherPin : otherPinList )
@ -1119,7 +1119,7 @@ bool LIB_SYMBOL::PinsConflictWith( const LIB_SYMBOL& aOtherPart, bool aTestNums,
continue;
// Same body stype?
if( eachThisPin->GetConvert() != eachOtherPin->GetConvert() )
if( eachThisPin->GetBodyStyle() != eachOtherPin->GetBodyStyle() )
continue;
// Same position?
@ -1164,7 +1164,7 @@ bool LIB_SYMBOL::PinsConflictWith( const LIB_SYMBOL& aOtherPart, bool aTestNums,
}
const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert,
const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aBodyStyle,
bool aIgnoreHiddenFields ) const
{
BOX2I bBox; // Start with a fresh BOX2I so the Merge algorithm works
@ -1179,7 +1179,7 @@ const BOX2I LIB_SYMBOL::GetUnitBoundingBox( int aUnit, int aConvert,
continue;
}
if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
if( item.m_bodyStyle > 0 && aBodyStyle > 0 && aBodyStyle != item.m_bodyStyle )
continue;
if( aIgnoreHiddenFields && ( item.Type() == LIB_FIELD_T )
@ -1207,7 +1207,7 @@ void LIB_SYMBOL::ViewGetLayers( int aLayers[], int& aCount ) const
}
const BOX2I LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
const BOX2I LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aIncludePins,
bool aIncludePrivateItems ) const
{
BOX2I bbox;
@ -1217,7 +1217,7 @@ const BOX2I LIB_SYMBOL::GetBodyBoundingBox( int aUnit, int aConvert, bool aInclu
if( item.m_unit > 0 && aUnit > 0 && aUnit != item.m_unit )
continue;
if( item.m_convert > 0 && aConvert > 0 && aConvert != item.m_convert )
if( item.m_bodyStyle > 0 && aBodyStyle > 0 && aBodyStyle != item.m_bodyStyle )
continue;
if( item.IsPrivate() && !aIncludePrivateItems )
@ -1495,11 +1495,11 @@ void LIB_SYMBOL::RemoveDuplicateDrawItems()
}
bool LIB_SYMBOL::HasConversion() const
bool LIB_SYMBOL::HasAlternateBodyStyle() const
{
for( const LIB_ITEM& item : m_drawings )
{
if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
if( item.m_bodyStyle > LIB_ITEM::BODY_STYLE::BASE )
return true;
}
@ -1507,7 +1507,7 @@ bool LIB_SYMBOL::HasConversion() const
{
for( const LIB_ITEM& item : parent->GetDrawItems() )
{
if( item.m_convert > LIB_ITEM::LIB_CONVERT::BASE )
if( item.m_bodyStyle > LIB_ITEM::BODY_STYLE::BASE )
return true;
}
}
@ -1549,13 +1549,13 @@ void LIB_SYMBOL::ClearEditFlags()
}
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType,
const VECTOR2I& aPoint )
{
for( LIB_ITEM& item : m_drawings )
{
if( ( aUnit && item.m_unit && aUnit != item.m_unit )
|| ( aConvert && item.m_convert && aConvert != item.m_convert )
|| ( aBodyStyle && item.m_bodyStyle && aBodyStyle != item.m_bodyStyle )
|| ( item.Type() != aType && aType != TYPE_NOT_INIT ) )
{
continue;
@ -1569,7 +1569,7 @@ LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
}
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType,
const VECTOR2I& aPoint, const TRANSFORM& aTransform )
{
/* we use LocateDrawItem( int aUnit, int convert, KICAD_T type, const
@ -1581,7 +1581,7 @@ LIB_ITEM* LIB_SYMBOL::LocateDrawItem( int aUnit, int aConvert, KICAD_T aType,
TRANSFORM transform = DefaultTransform;
DefaultTransform = aTransform;
item = LocateDrawItem( aUnit, aConvert, aType, aPoint );
item = LocateDrawItem( aUnit, aBodyStyle, aType, aPoint );
// Restore matrix
DefaultTransform = transform;
@ -1664,13 +1664,13 @@ int LIB_SYMBOL::GetUnitCount() const
}
void LIB_SYMBOL::SetConversion( bool aSetConvert, bool aDuplicatePins )
void LIB_SYMBOL::SetHasAlternateBodyStyle( bool aHasAlternate, bool aDuplicatePins )
{
if( aSetConvert == HasConversion() )
if( aHasAlternate == HasAlternateBodyStyle() )
return;
// Duplicate items to create the converted shape
if( aSetConvert )
if( aHasAlternate )
{
if( aDuplicatePins )
{
@ -1682,10 +1682,10 @@ void LIB_SYMBOL::SetConversion( bool aSetConvert, bool aDuplicatePins )
if( item.Type() != LIB_PIN_T )
continue;
if( item.m_convert == 1 )
if( item.m_bodyStyle == 1 )
{
LIB_ITEM* newItem = (LIB_ITEM*) item.Duplicate();
newItem->m_convert = 2;
newItem->m_bodyStyle = 2;
tmp.push_back( newItem );
}
}
@ -1703,7 +1703,7 @@ void LIB_SYMBOL::SetConversion( bool aSetConvert, bool aDuplicatePins )
while( i != m_drawings.end() )
{
if( i->m_convert > 1 )
if( i->m_bodyStyle > 1 )
i = m_drawings.erase( i );
else
++i;
@ -1714,7 +1714,7 @@ void LIB_SYMBOL::SetConversion( bool aSetConvert, bool aDuplicatePins )
}
std::vector<LIB_ITEM*> LIB_SYMBOL::GetUnitDrawItems( int aUnit, int aConvert )
std::vector<LIB_ITEM*> LIB_SYMBOL::GetUnitDrawItems( int aUnit, int aBodyStyle )
{
std::vector<LIB_ITEM*> unitItems;
@ -1723,9 +1723,9 @@ std::vector<LIB_ITEM*> LIB_SYMBOL::GetUnitDrawItems( int aUnit, int aConvert )
if( item.Type() == LIB_FIELD_T )
continue;
if( ( aConvert == -1 && item.GetUnit() == aUnit )
|| ( aUnit == -1 && item.GetConvert() == aConvert )
|| ( aUnit == item.GetUnit() && aConvert == item.GetConvert() ) )
if( ( aBodyStyle == -1 && item.GetUnit() == aUnit )
|| ( aUnit == -1 && item.GetBodyStyle() == aBodyStyle )
|| ( aUnit == item.GetUnit() && aBodyStyle == item.GetBodyStyle() ) )
{
unitItems.push_back( &item );
}
@ -1745,19 +1745,19 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUnitDrawItems()
continue;
int unit = item.GetUnit();
int convert = item.GetConvert();
int bodyStyle = item.GetBodyStyle();
auto it = std::find_if( units.begin(), units.end(),
[unit, convert]( const LIB_SYMBOL_UNIT& a )
[unit, bodyStyle]( const LIB_SYMBOL_UNIT& a )
{
return a.m_unit == unit && a.m_convert == convert;
return a.m_unit == unit && a.m_bodyStyle == bodyStyle;
} );
if( it == units.end() )
{
struct LIB_SYMBOL_UNIT newUnit;
newUnit.m_unit = item.GetUnit();
newUnit.m_convert = item.GetConvert();
newUnit.m_bodyStyle = item.GetBodyStyle();
newUnit.m_items.push_back( &item );
units.emplace_back( newUnit );
}
@ -1782,7 +1782,7 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUniqueUnits()
// The first unit is guaranteed to be unique so always include it.
unit.m_unit = 1;
unit.m_convert = 1;
unit.m_bodyStyle = 1;
unit.m_items = GetUnitDrawItems( 1, 1 );
// There are no unique units if there are no draw items other than fields.
@ -1791,7 +1791,7 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUniqueUnits()
uniqueUnits.emplace_back( unit );
if( ( GetUnitCount() == 1 || UnitsLocked() ) && !HasConversion() )
if( ( GetUnitCount() == 1 || UnitsLocked() ) && !HasAlternateBodyStyle() )
return uniqueUnits;
currentDrawItems = unit.m_items;
@ -1806,7 +1806,7 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUniqueUnits()
if( currentDrawItems.size() != compareDrawItems.size() )
{
unit.m_unit = unitNum;
unit.m_convert = 1;
unit.m_bodyStyle = 1;
unit.m_items = compareDrawItems;
uniqueUnits.emplace_back( unit );
}
@ -1818,7 +1818,7 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUniqueUnits()
LIB_ITEM::COMPARE_FLAGS::UNIT ) != 0 )
{
unit.m_unit = unitNum;
unit.m_convert = 1;
unit.m_bodyStyle = 1;
unit.m_items = compareDrawItems;
uniqueUnits.emplace_back( unit );
}
@ -1826,14 +1826,14 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUniqueUnits()
}
}
if( HasConversion() )
if( HasAlternateBodyStyle() )
{
currentDrawItems = GetUnitDrawItems( 1, 2 );
if( ( GetUnitCount() == 1 || UnitsLocked() ) )
{
unit.m_unit = 1;
unit.m_convert = 2;
unit.m_bodyStyle = 2;
unit.m_items = currentDrawItems;
uniqueUnits.emplace_back( unit );
@ -1850,7 +1850,7 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUniqueUnits()
if( currentDrawItems.size() != compareDrawItems.size() )
{
unit.m_unit = unitNum;
unit.m_convert = 2;
unit.m_bodyStyle = 2;
unit.m_items = compareDrawItems;
uniqueUnits.emplace_back( unit );
}
@ -1862,7 +1862,7 @@ std::vector<struct LIB_SYMBOL_UNIT> LIB_SYMBOL::GetUniqueUnits()
LIB_ITEM::COMPARE_FLAGS::UNIT ) != 0 )
{
unit.m_unit = unitNum;
unit.m_convert = 2;
unit.m_bodyStyle = 2;
unit.m_items = compareDrawItems;
uniqueUnits.emplace_back( unit );
}

View File

@ -84,7 +84,7 @@ struct LIB_SYMBOL_OPTIONS
struct LIB_SYMBOL_UNIT
{
int m_unit; ///< The unit number.
int m_convert; ///< The alternate body style of the unit.
int m_bodyStyle; ///< The alternate body style of the unit.
std::vector<LIB_ITEM*> m_items; ///< The items unique to this unit and alternate body style.
};
@ -241,24 +241,25 @@ public:
*
* @return the symbol bounding box ( in user coordinates )
* @param aUnit = unit selection = 0, or 1..n
* @param aConvert = 0, 1 or 2
* @param aBodyStyle = 0, 1 or 2
* If aUnit == 0, unit is not used
* if aConvert == 0 Convert is non used
* if aBodyStyle == 0 Convert is non used
* @param aIgnoreHiddenFields default true, ignores any hidden fields
**/
const BOX2I GetUnitBoundingBox( int aUnit, int aConvert, bool aIgnoreHiddenFields = true ) const;
const BOX2I GetUnitBoundingBox( int aUnit, int aBodyStyle,
bool aIgnoreHiddenFields = true ) const;
/**
* Get the symbol bounding box excluding fields.
*
* @return the symbol bounding box ( in user coordinates ) without fields
* @param aUnit = unit selection = 0, or 1..n
* @param aConvert = 0, 1 or 2
* @param aBodyStyle = 0, 1 or 2
* If aUnit == 0, unit is not used
* if aConvert == 0 Convert is non used
* if aBodyStyle == 0 Convert is non used
* Fields are not taken in account
**/
const BOX2I GetBodyBoundingBox( int aUnit, int aConvert, bool aIncludePins,
const BOX2I GetBodyBoundingBox( int aUnit, int aBodyStyle, bool aIncludePins,
bool aIncludePrivateItems ) const;
const BOX2I GetBoundingBox() const override
@ -362,24 +363,24 @@ public:
*
* @param aOffset - Position of symbol.
* @param aMulti - unit if multiple units per symbol.
* @param aConvert - Symbol conversion (DeMorgan) if available.
* @param aBodyStyle - Symbol alternate body style (DeMorgan) if available.
* @param aOpts - Drawing options
* @param aDimmed - Reduce brightness of symbol
*/
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti, int aConvert,
const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed );
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset, int aMulti,
int aBodyStyle, const LIB_SYMBOL_OPTIONS& aOpts, bool aDimmed );
/**
* Print just the background fills of a symbol
*
* @param aOffset - Position of symbol.
* @param aMulti - unit if multiple units per symbol.
* @param aConvert - Symbol conversion (DeMorgan) if available.
* @param aBodyStyle - Symbol alternate body style (DeMorgan) if available.
* @param aOpts - Drawing options
* @param aDimmed - Reduce brightness of symbol
*/
void PrintBackground( const RENDER_SETTINGS *aSettings, const VECTOR2I &aOffset, int aMulti,
int aConvert, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed );
int aBodyStyle, const LIB_SYMBOL_OPTIONS &aOpts, bool aDimmed );
/**
* Plot lib symbol to plotter.
@ -388,13 +389,13 @@ public:
*
* @param aPlotter - Plotter object to plot to.
* @param aUnit - Symbol symbol to plot.
* @param aConvert - Symbol alternate body style to plot.
* @param aBodyStyle - Symbol alternate body style to plot.
* @param aBackground - A poor-man's Z-order.
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix.
* @param aDimmed - Reduce brightness of symbol
*/
void Plot( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
void Plot( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed ) const;
/**
@ -403,13 +404,13 @@ public:
*
* @param aPlotter - Plotter object to plot to.
* @param aUnit - Symbol to plot.
* @param aConvert - Symbol alternate body style to plot.
* @param aBodyStyle - Symbol alternate body style to plot.
* @param aBackground - A poor-man's Z-order.
* @param aOffset - Distance to shift the plot coordinates.
* @param aTransform - Symbol plot transform matrix.
* @param aDimmed - reduce brightness of fields
*/
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert, bool aBackground,
void PlotLibFields( PLOTTER* aPlotter, int aUnit, int aBodyStyle, bool aBackground,
const VECTOR2I& aOffset, const TRANSFORM& aTransform, bool aDimmed,
bool aPlotHidden = true );
@ -440,10 +441,10 @@ public:
*
* @param aList - Pin list to place pin object pointers into.
* @param aUnit - Unit number of pins to collect. Set to 0 to get pins from any symbol unit.
* @param aConvert - Convert number of pins to collect. Set to 0 to get pins from any
* DeMorgan variant of symbol.
* @param aBodyStyle - Symbol alternate body style of pins to collect. Set to 0 to get pins
* from any DeMorgan variant of symbol.
*/
void GetPins( LIB_PINS& aList, int aUnit = 0, int aConvert = 0 ) const;
void GetPins( LIB_PINS& aList, int aUnit = 0, int aBodyStyle = 0 ) const;
/**
* Return a list of pin pointers for all units / converts. Used primarily for SPICE where
@ -461,11 +462,11 @@ public:
*
* @param aNumber - Number of the pin to find.
* @param aUnit - Unit filter. Set to 0 if a specific unit number is not required.
* @param aConvert - DeMorgan variant filter. Set to 0 if no specific DeMorgan variant is
* @param aBodyStyle - DeMorgan variant filter. Set to 0 if no specific DeMorgan variant is
* required.
* @return The pin object if found. Otherwise NULL.
*/
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 ) const;
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aBodyStyle = 0 ) const;
/**
* Return true if this symbol's pins do not match another symbol's pins. This is used to
@ -498,7 +499,7 @@ public:
*
* @return True if symbol has more than one conversion.
*/
bool HasConversion() const;
bool HasAlternateBodyStyle() const;
/**
* @return the highest pin number of the symbol's pins.
@ -516,24 +517,24 @@ public:
* Locate a draw object.
*
* @param aUnit - Unit number of draw item.
* @param aConvert - Body style of draw item.
* @param aBodyStyle - Body style of draw item.
* @param aType - Draw object type, set to 0 to search for any type.
* @param aPoint - Coordinate for hit testing.
* @return The draw object if found. Otherwise NULL.
*/
LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint );
LIB_ITEM* LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I& aPoint );
/**
* Locate a draw object (overlaid)
*
* @param aUnit - Unit number of draw item.
* @param aConvert - Body style of draw item.
* @param aBodyStyle - Body style of draw item.
* @param aType - Draw object type, set to 0 to search for any type.
* @param aPoint - Coordinate for hit testing.
* @param aTransform = the transform matrix
* @return The draw object if found. Otherwise NULL.
*/
LIB_ITEM* LocateDrawItem( int aUnit, int aConvert, KICAD_T aType, const VECTOR2I& aPoint,
LIB_ITEM* LocateDrawItem( int aUnit, int aBodyStyle, KICAD_T aType, const VECTOR2I& aPoint,
const TRANSFORM& aTransform );
/**
@ -603,16 +604,15 @@ public:
/**
* Set or clear the alternate body style (DeMorgan) for the symbol.
*
* If the symbol already has an alternate body style set and a
* asConvert if false, all of the existing draw items for the alternate
* body style are remove. If the alternate body style is not set and
* asConvert is true, than the base draw items are duplicated and
* added to the symbol.
* If the symbol already has an alternate body style set and aHasAlternate is false, all
* of the existing draw items for the alternate body style are remove. If the alternate
* body style is not set and aHasAlternate is true, than the base draw items are duplicated
* and added to the symbol.
*
* @param aSetConvert - Set or clear the symbol alternate body style.
* @param aHasAlternate - Set or clear the symbol alternate body style.
* @param aDuplicatePins - Duplicate all pins from original body style if true.
*/
void SetConversion( bool aSetConvert, bool aDuplicatePins = true );
void SetHasAlternateBodyStyle( bool aHasAlternate, bool aDuplicatePins = true );
/**
* Set the offset in mils of the pin name text from the pin symbol.
@ -713,16 +713,16 @@ public:
std::vector<struct LIB_SYMBOL_UNIT> GetUniqueUnits();
/**
* Return a list of item pointers for \a aUnit and \a aConvert for this symbol.
* Return a list of item pointers for \a aUnit and \a aBodyStyle for this symbol.
*
* @note #LIB_FIELD objects are not included.
*
* @param aUnit is the unit number of the item, -1 includes all units.
* @param aConvert is the alternate body styple of the item, -1 includes all body styles.
* @param aBodyStyle is the alternate body styple of the item, -1 includes all body styles.
*
* @return a list of unit items.
*/
std::vector<LIB_ITEM*> GetUnitDrawItems( int aUnit, int aConvert );
std::vector<LIB_ITEM*> GetUnitDrawItems( int aUnit, int aBodyStyle );
/**
* Return a measure of similarity between this symbol and \a aSymbol.

View File

@ -123,7 +123,7 @@ void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
}
void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
void SCH_EDIT_FRAME::FlipBodyStyle( SCH_SYMBOL* aSymbol )
{
if( !aSymbol || !aSymbol->GetLibSymbolRef() )
return;
@ -131,7 +131,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
SCH_COMMIT commit( m_toolManager );
wxString msg;
if( !aSymbol->GetLibSymbolRef()->HasConversion() )
if( !aSymbol->GetLibSymbolRef()->HasAlternateBodyStyle() )
{
LIB_ID id = aSymbol->GetLibSymbolRef()->GetLibId();
@ -144,20 +144,21 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
commit.Modify( aSymbol, GetScreen() );
aSymbol->SetConvert( aSymbol->GetConvert() + 1 );
aSymbol->SetBodyStyle( aSymbol->GetBodyStyle() + 1 );
// ensure m_convert = 1 or 2
// 1 = shape 1 = not converted
// 2 = shape 2 = first converted shape
// ensure m_bodyStyle = 1 or 2
// 1 = shape 1 = first (base DeMorgan) alternate body style
// 2 = shape 2 = second (DeMorgan conversion) alternate body style
// > 2 is not currently supported
// When m_convert = val max, return to the first shape
if( aSymbol->GetConvert() > LIB_ITEM::LIB_CONVERT::DEMORGAN )
aSymbol->SetConvert( LIB_ITEM::LIB_CONVERT::BASE );
// When m_bodyStyle = val max, return to the first shape
if( aSymbol->GetBodyStyle() > LIB_ITEM::BODY_STYLE::DEMORGAN )
aSymbol->SetBodyStyle( LIB_ITEM::BODY_STYLE::BASE );
// If selected make sure all the now-included pins are selected
if( aSymbol->IsSelected() )
m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, aSymbol );
// TODO: 9.0 "Change Body Style"
commit.Push( _( "Convert Symbol" ) );
}

View File

@ -178,7 +178,7 @@ void RESCUE_CASE_CANDIDATE::FindRescues( RESCUER& aRescuer,
RESCUE_CASE_CANDIDATE candidate( symbol_name, case_insensitive_matches[0]->GetName(),
case_insensitive_matches[0],
eachSymbol->GetUnit(),
eachSymbol->GetConvert() );
eachSymbol->GetBodyStyle() );
candidate_map[symbol_name] = candidate;
}
@ -296,8 +296,7 @@ void RESCUE_CACHE_CANDIDATE::FindRescues( RESCUER& aRescuer,
// Check if the symbol has already been rescued.
RESCUE_CACHE_CANDIDATE candidate( symbol_name, symbol_name, cache_match, lib_match,
eachSymbol->GetUnit(),
eachSymbol->GetConvert() );
eachSymbol->GetUnit(), eachSymbol->GetBodyStyle() );
candidate_map[symbol_name] = candidate;
}
@ -469,7 +468,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
RESCUE_SYMBOL_LIB_TABLE_CANDIDATE candidate( symbol_id, new_id, cache_match, lib_match,
eachSymbol->GetUnit(),
eachSymbol->GetConvert() );
eachSymbol->GetBodyStyle() );
candidate_map[symbol_id] = candidate;
}

View File

@ -634,7 +634,7 @@ public:
*/
void DeleteJunction( SCH_COMMIT* aCommit, SCH_ITEM* aItem );
void ConvertPart( SCH_SYMBOL* aSymbol );
void FlipBodyStyle( SCH_SYMBOL* aSymbol );
void SelectUnit( SCH_SYMBOL* aSymbol, int aUnit );

View File

@ -1190,19 +1190,19 @@ SCH_SYMBOL* SCH_IO_KICAD_LEGACY::loadSymbol( LINE_READER& aReader )
symbol->SetUnit( unit );
// Same can also happen with the convert parameter
int convert = parseInt( aReader, line, &line );
// Same can also happen with the body style ("convert") parameter
int bodyStyle = parseInt( aReader, line, &line );
if( convert == 0 )
if( bodyStyle == 0 )
{
convert = 1;
bodyStyle = 1;
// Set the file as modified so the user can be warned.
if( m_rootSheet->GetScreen() )
m_rootSheet->GetScreen()->SetContentModified();
}
symbol->SetConvert( convert );
symbol->SetBodyStyle( bodyStyle );
wxString text;
parseUnquotedString( text, aReader, line, &line );
@ -1691,7 +1691,7 @@ void SCH_IO_KICAD_LEGACY::saveSymbol( SCH_SYMBOL* aSymbol )
// Generate unit number, conversion and timestamp
m_out->Print( 0, "U %d %d %8.8X\n",
aSymbol->GetUnit(),
aSymbol->GetConvert(),
aSymbol->GetBodyStyle(),
aSymbol->m_Uuid.AsLegacyTimestamp() );
// Save the position

View File

@ -843,7 +843,7 @@ LIB_SHAPE* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadArc( std::unique_ptr<LIB_SYMBOL>&
NORMALIZE_ANGLE_POS( angle2 );
arc->SetUnit( parseInt( aReader, line, &line ) );
arc->SetConvert( parseInt( aReader, line, &line ) );
arc->SetBodyStyle( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ),
LINE_STYLE::SOLID );
@ -920,7 +920,7 @@ LIB_SHAPE* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadCircle( std::unique_ptr<LIB_SYMBOL
circle->SetStart( center );
circle->SetEnd( VECTOR2I( center.x + radius, center.y ) );
circle->SetUnit( parseInt( aReader, line, &line ) );
circle->SetConvert( parseInt( aReader, line, &line ) );
circle->SetBodyStyle( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ),
LINE_STYLE::SOLID );
@ -960,7 +960,7 @@ LIB_TEXT* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadText( std::unique_ptr<LIB_SYMBOL>&
text->SetTextSize( size );
text->SetVisible( !parseInt( aReader, line, &line ) );
text->SetUnit( parseInt( aReader, line, &line ) );
text->SetConvert( parseInt( aReader, line, &line ) );
text->SetBodyStyle( parseInt( aReader, line, &line ) );
wxString str;
@ -1055,7 +1055,7 @@ LIB_SHAPE* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadRect( std::unique_ptr<LIB_SYMBOL>&
rectangle->SetEnd( end );
rectangle->SetUnit( parseInt( aReader, line, &line ) );
rectangle->SetConvert( parseInt( aReader, line, &line ) );
rectangle->SetBodyStyle( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ),
LINE_STYLE::SOLID );
@ -1303,7 +1303,7 @@ LIB_SHAPE* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadPolyLine( std::unique_ptr<LIB_SYMB
int points = parseInt( aReader, line, &line );
polyLine->SetUnit( parseInt( aReader, line, &line ) );
polyLine->SetConvert( parseInt( aReader, line, &line ) );
polyLine->SetBodyStyle( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ),
LINE_STYLE::SOLID );
@ -1340,7 +1340,7 @@ LIB_SHAPE* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadBezier( std::unique_ptr<LIB_SYMBOL
LIB_SHAPE* bezier = new LIB_SHAPE( aSymbol.get(), SHAPE_T::BEZIER );
bezier->SetUnit( parseInt( aReader, line, &line ) );
bezier->SetConvert( parseInt( aReader, line, &line ) );
bezier->SetBodyStyle( parseInt( aReader, line, &line ) );
STROKE_PARAMS stroke ( schIUScale.MilsToIU( parseInt( aReader, line, &line ) ),
LINE_STYLE::SOLID );
@ -1609,7 +1609,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveArc( LIB_SHAPE* aArc, OUTPUTFORMATTER& a
startAngle.AsTenthsOfADegree(),
endAngle.AsTenthsOfADegree(),
aArc->GetUnit(),
aArc->GetConvert(),
aArc->GetBodyStyle(),
schIUScale.IUToMils( aArc->GetWidth() ),
fill_tab[ static_cast<int>( aArc->GetFillMode() ) - 1 ],
schIUScale.IUToMils( aArc->GetStart().x ),
@ -1625,7 +1625,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveBezier( LIB_SHAPE* aBezier, OUTPUTFORMAT
aFormatter.Print( 0, "B 4 %d %d %d",
aBezier->GetUnit(),
aBezier->GetConvert(),
aBezier->GetBodyStyle(),
schIUScale.IUToMils( aBezier->GetWidth() ) );
aFormatter.Print( 0, " %d %d %d %d %d %d %d %d",
@ -1651,7 +1651,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveCircle( LIB_SHAPE* aCircle, OUTPUTFORMAT
schIUScale.IUToMils( aCircle->GetPosition().y ),
schIUScale.IUToMils( aCircle->GetRadius() ),
aCircle->GetUnit(),
aCircle->GetConvert(),
aCircle->GetBodyStyle(),
schIUScale.IUToMils( aCircle->GetWidth() ),
fill_tab[ static_cast<int>( aCircle->GetFillMode() ) - 1 ] );
}
@ -1742,7 +1742,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::savePin( const LIB_PIN* aPin, OUTPUTFORMATTE
schIUScale.IUToMils( aPin->GetNumberTextSize() ),
schIUScale.IUToMils( aPin->GetNameTextSize() ),
aPin->GetUnit(),
aPin->GetConvert(),
aPin->GetBodyStyle(),
Etype );
if( aPin->GetShape() != GRAPHIC_PINSHAPE::LINE || !aPin->IsVisible() )
@ -1779,7 +1779,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::savePolyLine( LIB_SHAPE* aPolyLine,
aFormatter.Print( 0, "P %d %d %d %d",
(int) aPolyLine->GetPolyShape().Outline( 0 ).GetPointCount(),
aPolyLine->GetUnit(),
aPolyLine->GetConvert(),
aPolyLine->GetBodyStyle(),
schIUScale.IUToMils( aPolyLine->GetWidth() ) );
for( const VECTOR2I& pt : aPolyLine->GetPolyShape().Outline( 0 ).CPoints() )
@ -1801,7 +1801,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveRectangle( LIB_SHAPE* aRectangle,
schIUScale.IUToMils( aRectangle->GetEnd().x ),
schIUScale.IUToMils( aRectangle->GetEnd().y ),
aRectangle->GetUnit(),
aRectangle->GetConvert(),
aRectangle->GetBodyStyle(),
schIUScale.IUToMils( aRectangle->GetWidth() ),
fill_tab[ static_cast<int>( aRectangle->GetFillMode() ) - 1 ] );
}
@ -1827,7 +1827,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::saveText( const LIB_TEXT* aText, OUTPUTFORMA
schIUScale.IUToMils( aText->GetTextWidth() ),
!aText->IsVisible(),
aText->GetUnit(),
aText->GetConvert(),
aText->GetBodyStyle(),
TO_UTF8( text ) );
aFormatter.Print( 0, " %s %d", aText->IsItalic() ? "Italic" : "Normal", aText->IsBold() );

View File

@ -696,8 +696,8 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
m_out->Print( 0, " (unit %d)", unit );
if( aSymbol->GetConvert() == LIB_ITEM::LIB_CONVERT::DEMORGAN )
m_out->Print( 0, " (convert %d)", aSymbol->GetConvert() );
if( aSymbol->GetBodyStyle() == LIB_ITEM::BODY_STYLE::DEMORGAN )
m_out->Print( 0, " (convert %d)", aSymbol->GetBodyStyle() );
m_out->Print( 0, "\n" );

View File

@ -221,7 +221,7 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMAT
[]( const LIB_SYMBOL_UNIT& a, const LIB_SYMBOL_UNIT& b )
{
if( a.m_unit == b.m_unit )
return a.m_convert < b.m_convert;
return a.m_bodyStyle < b.m_bodyStyle;
return a.m_unit < b.m_unit;
} );
@ -233,7 +233,9 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMAT
name.pop_back(); // Remove last char: the quote ending the string.
aFormatter.Print( aNestLevel + 1, "(symbol %s_%d_%d\"\n",
name.c_str(), unit.m_unit, unit.m_convert );
name.c_str(),
unit.m_unit,
unit.m_bodyStyle );
// if the unit has a display name, write that
if( aSymbol->HasUnitDisplayName( unit.m_unit ) )

View File

@ -70,16 +70,16 @@ SCH_IO_KICAD_SEXPR_PARSER::SCH_IO_KICAD_SEXPR_PARSER( LINE_READER* aLineReader,
PROGRESS_REPORTER* aProgressReporter,
unsigned aLineCount, SCH_SHEET* aRootSheet,
bool aIsAppending ) :
SCHEMATIC_LEXER( aLineReader ),
m_requiredVersion( 0 ),
m_unit( 1 ),
m_convert( 1 ),
m_appending( aIsAppending ),
m_progressReporter( aProgressReporter ),
m_lineReader( aLineReader ),
m_lastProgressLine( 0 ),
m_lineCount( aLineCount ),
m_rootSheet( aRootSheet )
SCHEMATIC_LEXER( aLineReader ),
m_requiredVersion( 0 ),
m_unit( 1 ),
m_bodyStyle( 1 ),
m_appending( aIsAppending ),
m_progressReporter( aProgressReporter ),
m_lineReader( aLineReader ),
m_lastProgressLine( 0 ),
m_lineCount( aLineCount ),
m_rootSheet( aRootSheet )
{
}
@ -236,7 +236,7 @@ void SCH_IO_KICAD_SEXPR_PARSER::ParseLib( LIB_SYMBOL_MAP& aSymbolLibMap )
checkVersion();
m_unit = 1;
m_convert = 1;
m_bodyStyle = 1;
LIB_SYMBOL* symbol = parseLibSymbol( aSymbolLibMap );
aSymbolLibMap[symbol->GetName()] = symbol;
break;
@ -463,10 +463,10 @@ LIB_SYMBOL* SCH_IO_KICAD_SEXPR_PARSER::parseLibSymbol( LIB_SYMBOL_MAP& aSymbolLi
THROW_PARSE_ERROR( error, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
}
m_convert = static_cast<int>( tmp );
m_bodyStyle = static_cast<int>( tmp );
if( m_convert > 1 )
symbol->SetConversion( true, false );
if( m_bodyStyle > 1 )
symbol->SetHasAlternateBodyStyle( true, false );
if( m_unit > symbol->GetUnitCount() )
symbol->SetUnitCount( m_unit, false );
@ -513,7 +513,7 @@ LIB_SYMBOL* SCH_IO_KICAD_SEXPR_PARSER::parseLibSymbol( LIB_SYMBOL_MAP& aSymbolLi
}
m_unit = 1;
m_convert = 1;
m_bodyStyle = 1;
break;
}
@ -1099,7 +1099,7 @@ LIB_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseArc()
std::unique_ptr<LIB_SHAPE> arc = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::ARC );
arc->SetUnit( m_unit );
arc->SetConvert( m_convert );
arc->SetBodyStyle( m_bodyStyle );
token = NextTok();
@ -1276,7 +1276,7 @@ LIB_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseBezier()
std::unique_ptr<LIB_SHAPE> bezier = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::BEZIER );
bezier->SetUnit( m_unit );
bezier->SetConvert( m_convert );
bezier->SetBodyStyle( m_bodyStyle );
token = NextTok();
@ -1359,7 +1359,7 @@ LIB_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseCircle()
std::unique_ptr<LIB_SHAPE> circle = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::CIRCLE );
circle->SetUnit( m_unit );
circle->SetConvert( m_convert );
circle->SetBodyStyle( m_bodyStyle );
token = NextTok();
@ -1469,7 +1469,7 @@ LIB_PIN* SCH_IO_KICAD_SEXPR_PARSER::parsePin()
std::unique_ptr<LIB_PIN> pin = std::make_unique<LIB_PIN>( nullptr );
pin->SetUnit( m_unit );
pin->SetConvert( m_convert );
pin->SetBodyStyle( m_bodyStyle );
// Pin electrical type.
token = NextTok();
@ -1632,7 +1632,7 @@ LIB_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parsePolyLine()
std::unique_ptr<LIB_SHAPE> poly = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::POLY );
poly->SetUnit( m_unit );
poly->SetConvert( m_convert );
poly->SetBodyStyle( m_bodyStyle );
token = NextTok();
@ -1700,7 +1700,7 @@ LIB_SHAPE* SCH_IO_KICAD_SEXPR_PARSER::parseRectangle()
std::unique_ptr<LIB_SHAPE> rectangle = std::make_unique<LIB_SHAPE>( nullptr, SHAPE_T::RECTANGLE );
rectangle->SetUnit( m_unit );
rectangle->SetConvert( m_convert );
rectangle->SetBodyStyle( m_bodyStyle );
token = NextTok();
@ -1758,7 +1758,7 @@ LIB_TEXT* SCH_IO_KICAD_SEXPR_PARSER::parseText()
std::unique_ptr<LIB_TEXT> text = std::make_unique<LIB_TEXT>( nullptr );
text->SetUnit( m_unit );
text->SetConvert( m_convert );
text->SetBodyStyle( m_bodyStyle );
token = NextTok();
if( token == T_private )
@ -1820,7 +1820,7 @@ LIB_TEXTBOX* SCH_IO_KICAD_SEXPR_PARSER::parseTextBox()
std::unique_ptr<LIB_TEXTBOX> textBox = std::make_unique<LIB_TEXTBOX>( nullptr );
textBox->SetUnit( m_unit );
textBox->SetConvert( m_convert );
textBox->SetBodyStyle( m_bodyStyle );
token = NextTok();
if( token == T_private )
@ -2890,7 +2890,7 @@ SCH_SYMBOL* SCH_IO_KICAD_SEXPR_PARSER::parseSchematicSymbol()
break;
case T_convert:
symbol->SetConvert( parseInt( "symbol convert" ) );
symbol->SetBodyStyle( parseInt( "symbol body style" ) );
NeedRIGHT();
break;

View File

@ -217,12 +217,13 @@ private:
SCH_TEXTBOX* parseSchTextBox();
void parseBusAlias( SCH_SCREEN* aScreen );
int m_requiredVersion; ///< Set to the symbol library file version required.
private:
int m_requiredVersion; ///< Set to the symbol library file version required.
wxString m_generatorVersion;
int m_unit; ///< The current unit being parsed.
int m_convert; ///< The current body style being parsed.
wxString m_symbolName; ///< The current symbol name.
bool m_appending; ///< Appending load status.
int m_unit; ///< The current unit being parsed.
int m_bodyStyle; ///< The current body style being parsed.
wxString m_symbolName; ///< The current symbol name.
bool m_appending; ///< Appending load status.
/// Field IDs that have been read so far for the current symbol.
std::set<int> m_fieldIDsRead;

View File

@ -102,7 +102,7 @@ std::vector<KICAD_T> SCH_PAINTER::g_ScaledSelectionTypes = {
SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
m_IsSymbolEditor( false ),
m_ShowUnit( 0 ),
m_ShowConvert( 0 ),
m_ShowBodyStyle( 0 ),
m_ShowPinsElectricalType( true ),
m_ShowPinNumbers( false ),
m_ShowDisabled( false ),
@ -339,9 +339,9 @@ bool SCH_PAINTER::isUnitAndConversionShown( const LIB_ITEM* aItem ) const
return false;
}
if( m_schSettings.m_ShowConvert // showing a specific conversion
&& aItem->GetConvert() // item is conversion-specific
&& aItem->GetConvert() != m_schSettings.m_ShowConvert )
if( m_schSettings.m_ShowBodyStyle // showing a specific body style
&& aItem->GetBodyStyle() // item is body-style-specific
&& aItem->GetBodyStyle() != m_schSettings.m_ShowBodyStyle )
{
return false;
}
@ -737,13 +737,13 @@ void SCH_PAINTER::triLine( const VECTOR2D &a, const VECTOR2D &b, const VECTOR2D
void SCH_PAINTER::draw( const LIB_SYMBOL* aSymbol, int aLayer, bool aDrawFields, int aUnit,
int aConvert, bool aDimmed )
int aBodyStyle, bool aDimmed )
{
if( !aUnit )
aUnit = m_schSettings.m_ShowUnit;
if( !aConvert )
aConvert = m_schSettings.m_ShowConvert;
if( !aBodyStyle )
aBodyStyle = m_schSettings.m_ShowBodyStyle;
std::unique_ptr< LIB_SYMBOL > tmpSymbol;
const LIB_SYMBOL* drawnSymbol = aSymbol;
@ -782,7 +782,7 @@ void SCH_PAINTER::draw( const LIB_SYMBOL* aSymbol, int aLayer, bool aDrawFields,
if( aUnit && item.GetUnit() && aUnit != item.GetUnit() )
continue;
if( aConvert && item.GetConvert() && aConvert != item.GetConvert() )
if( aBodyStyle && item.GetBodyStyle() && aBodyStyle != item.GetBodyStyle() )
continue;
draw( &item, aLayer, aDimmed );
@ -2489,18 +2489,18 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
}
int unit = aSymbol->GetUnitSelection( &m_schematic->CurrentSheet() );
int convert = aSymbol->GetConvert();
int bodyStyle = aSymbol->GetBodyStyle();
// Use dummy symbol if the actual couldn't be found (or couldn't be locked).
LIB_SYMBOL* originalSymbol = aSymbol->GetLibSymbolRef() ?
aSymbol->GetLibSymbolRef().get() : dummy();
LIB_PINS originalPins;
originalSymbol->GetPins( originalPins, unit, convert );
originalSymbol->GetPins( originalPins, unit, bodyStyle );
// Copy the source so we can re-orient and translate it.
LIB_SYMBOL tempSymbol( *originalSymbol );
LIB_PINS tempPins;
tempSymbol.GetPins( tempPins, unit, convert );
tempSymbol.GetPins( tempPins, unit, bodyStyle );
tempSymbol.SetFlags( aSymbol->GetFlags() );
@ -2549,7 +2549,7 @@ void SCH_PAINTER::draw( const SCH_SYMBOL* aSymbol, int aLayer )
tempPin->SetOperatingPoint( symbolPin->GetOperatingPoint() );
}
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetConvert(), aSymbol->GetDNP() );
draw( &tempSymbol, aLayer, false, aSymbol->GetUnit(), aSymbol->GetBodyStyle(), aSymbol->GetDNP() );
for( unsigned i = 0; i < tempPins.size(); ++i )
{

View File

@ -111,7 +111,7 @@ public:
bool m_IsSymbolEditor;
int m_ShowUnit; // Show all units if 0
int m_ShowConvert; // Show all conversions if 0
int m_ShowBodyStyle; // Show all body styles if 0
bool m_ShowPinsElectricalType;
bool m_ShowPinNumbers; // Force showing of pin numbers (normally symbol-specific)
@ -148,7 +148,7 @@ private:
void draw( const LIB_PIN* aPin, int aLayer, bool aDimmed );
void draw( const LIB_SHAPE* aCircle, int aLayer, bool aDimmed );
void draw( const LIB_SYMBOL* aSymbol, int, bool aDrawFields = true, int aUnit = 0,
int aConvert = 0, bool aDimmed = false );
int aBodyStyle = 0, bool aDimmed = false );
void draw( const LIB_FIELD* aField, int aLayer, bool aDimmed );
void draw( const LIB_TEXT* aText, int aLayer, bool aDimmed );
void draw( const LIB_TEXTBOX* aTextBox, int aLayer, bool aDimmed );

View File

@ -215,9 +215,9 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITE
aList.emplace_back( _( "Type" ), _( "Pin" ) );
if( m_libPin->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
if( m_libPin->GetBodyStyle() == LIB_ITEM::BODY_STYLE::BASE )
msg = _( "no" );
else if( m_libPin->GetConvert() == LIB_ITEM::LIB_CONVERT::DEMORGAN )
else if( m_libPin->GetBodyStyle() == LIB_ITEM::BODY_STYLE::DEMORGAN )
msg = _( "yes" );
else
msg = wxT( "?" );

View File

@ -105,14 +105,14 @@ SCH_SYMBOL::SCH_SYMBOL() :
SCH_SYMBOL::SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId,
const SCH_SHEET_PATH* aSheet, int aUnit, int aConvert,
const SCH_SHEET_PATH* aSheet, int aUnit, int aBodyStyle,
const VECTOR2I& aPosition, EDA_ITEM* aParent ) :
SCH_ITEM( aParent, SCH_SYMBOL_T )
{
Init( aPosition );
m_unit = aUnit;
m_convert = aConvert;
m_bodyStyle = aBodyStyle;
m_lib_id = aLibId;
std::unique_ptr< LIB_SYMBOL > part;
@ -166,7 +166,7 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
m_parent = aSymbol.m_parent;
m_pos = aSymbol.m_pos;
m_unit = aSymbol.m_unit;
m_convert = aSymbol.m_convert;
m_bodyStyle = aSymbol.m_bodyStyle;
m_lib_id = aSymbol.m_lib_id;
m_isInNetlist = aSymbol.m_isInNetlist;
m_excludedFromSim = aSymbol.m_excludedFromSim;
@ -204,10 +204,10 @@ SCH_SYMBOL::SCH_SYMBOL( const SCH_SYMBOL& aSymbol ) :
void SCH_SYMBOL::Init( const VECTOR2I& pos )
{
m_layer = LAYER_DEVICE;
m_pos = pos;
m_unit = 1; // In multi unit chip - which unit to draw.
m_convert = LIB_ITEM::LIB_CONVERT::BASE; // De Morgan Handling
m_layer = LAYER_DEVICE;
m_pos = pos;
m_unit = 1; // In multi unit chip - which unit to draw.
m_bodyStyle = LIB_ITEM::BODY_STYLE::BASE; // De Morgan Handling
// The rotation/mirror transformation matrix. pos normal
m_transform = TRANSFORM();
@ -363,7 +363,7 @@ void SCH_SYMBOL::UpdatePins()
{
// NW: Don't filter by unit: this data-structure is used for all instances,
// some of which might have different units.
if( libPin->GetConvert() && m_convert && m_convert != libPin->GetConvert() )
if( libPin->GetBodyStyle() && m_bodyStyle && m_bodyStyle != libPin->GetBodyStyle() )
continue;
SCH_PIN* pin = nullptr;
@ -459,11 +459,11 @@ void SCH_SYMBOL::UpdateUnit( int aUnit )
}
void SCH_SYMBOL::SetConvert( int aConvert )
void SCH_SYMBOL::SetBodyStyle( int aBodyStyle )
{
if( m_convert != aConvert )
if( m_bodyStyle != aBodyStyle )
{
m_convert = aConvert;
m_bodyStyle = aBodyStyle;
// The convert may have a different pin layout so the update the pin map.
UpdatePins();
@ -511,7 +511,7 @@ void SCH_SYMBOL::PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR
opts.draw_hidden_fields = false;
if( m_part )
m_part->PrintBackground( aSettings, m_pos + aOffset, m_unit, m_convert, opts, GetDNP() );
m_part->PrintBackground( aSettings, m_pos + aOffset, m_unit, m_bodyStyle, opts, GetDNP() );
}
@ -525,11 +525,11 @@ void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
if( m_part )
{
LIB_PINS libPins;
m_part->GetPins( libPins, m_unit, m_convert );
m_part->GetPins( libPins, m_unit, m_bodyStyle );
LIB_SYMBOL tempSymbol( *m_part );
LIB_PINS tempPins;
tempSymbol.GetPins( tempPins, m_unit, m_convert );
tempSymbol.GetPins( tempPins, m_unit, m_bodyStyle );
// Copy the pin info from the symbol to the temp pins
for( unsigned i = 0; i < tempPins.size(); ++ i )
@ -553,7 +553,7 @@ void SCH_SYMBOL::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffse
}
}
tempSymbol.Print( aSettings, m_pos + aOffset, m_unit, m_convert, opts, GetDNP() );
tempSymbol.Print( aSettings, m_pos + aOffset, m_unit, m_bodyStyle, opts, GetDNP() );
}
else // Use dummy() part if the actual cannot be found.
{
@ -1145,7 +1145,7 @@ SCH_PIN* SCH_SYMBOL::GetPin( const wxString& aNumber ) const
void SCH_SYMBOL::GetLibPins( std::vector<LIB_PIN*>& aPinsList ) const
{
if( m_part )
m_part->GetPins( aPinsList, m_unit, m_convert );
m_part->GetPins( aPinsList, m_unit, m_bodyStyle );
}
@ -1227,7 +1227,7 @@ void SCH_SYMBOL::SwapData( SCH_ITEM* aItem )
std::swap( m_pos, symbol->m_pos );
std::swap( m_unit, symbol->m_unit );
std::swap( m_convert, symbol->m_convert );
std::swap( m_bodyStyle, symbol->m_bodyStyle );
m_fields.swap( symbol->m_fields ); // std::vector's swap()
@ -1786,9 +1786,9 @@ BOX2I SCH_SYMBOL::doGetBoundingBox( bool aIncludePins, bool aIncludeFields ) con
BOX2I bBox;
if( m_part )
bBox = m_part->GetBodyBoundingBox( m_unit, m_convert, aIncludePins, false );
bBox = m_part->GetBodyBoundingBox( m_unit, m_bodyStyle, aIncludePins, false );
else
bBox = dummy()->GetBodyBoundingBox( m_unit, m_convert, aIncludePins, false );
bBox = dummy()->GetBodyBoundingBox( m_unit, m_bodyStyle, aIncludePins, false );
int x0 = bBox.GetX();
int xm = bBox.GetRight();
@ -2120,13 +2120,15 @@ std::vector<VECTOR2I> SCH_SYMBOL::GetConnectionPoints() const
{
// Collect only pins attached to the current unit and convert.
// others are not associated to this symbol instance
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit()
: GetUnit();
int pin_bodyStyle = pin->GetLibPin() ? pin->GetLibPin()->GetBodyStyle()
: GetBodyStyle();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
if( pin_convert > 0 && pin_convert != GetConvert() )
if( pin_bodyStyle > 0 && pin_bodyStyle != GetBodyStyle() )
continue;
retval.push_back( m_transform.TransformCoordinate( pin->GetLocalPosition() ) + m_pos );
@ -2143,7 +2145,7 @@ LIB_ITEM* SCH_SYMBOL::GetDrawItem( const VECTOR2I& aPosition, KICAD_T aType )
// Calculate the position relative to the symbol.
VECTOR2I libPosition = aPosition - m_pos;
return m_part->LocateDrawItem( m_unit, m_convert, aType, libPosition, m_transform );
return m_part->LocateDrawItem( m_unit, m_bodyStyle, aType, libPosition, m_transform );
}
return nullptr;
@ -2211,13 +2213,15 @@ INSPECT_RESULT SCH_SYMBOL::Visit( INSPECTOR aInspector, void* aTestData,
{
// Collect only pins attached to the current unit and convert.
// others are not associated to this symbol instance
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit()
: GetUnit();
int pin_bodyStyle = pin->GetLibPin() ? pin->GetLibPin()->GetBodyStyle()
: GetBodyStyle();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
if( pin_convert > 0 && pin_convert != GetConvert() )
if( pin_bodyStyle > 0 && pin_bodyStyle != GetBodyStyle() )
continue;
if( INSPECT_RESULT::QUIT == aInspector( pin.get(), (void*) this ) )
@ -2292,7 +2296,7 @@ SCH_SYMBOL& SCH_SYMBOL::operator=( const SCH_ITEM& aItem )
m_part.reset( libSymbol );
m_pos = c->m_pos;
m_unit = c->m_unit;
m_convert = c->m_convert;
m_bodyStyle = c->m_bodyStyle;
m_transform = c->m_transform;
m_instanceReferences = c->m_instanceReferences;
@ -2349,13 +2353,15 @@ bool SCH_SYMBOL::doIsConnected( const VECTOR2I& aPosition ) const
// Collect only pins attached to the current unit and convert.
// others are not associated to this symbol instance
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit()
: GetUnit();
int pin_bodyStyle = pin->GetLibPin() ? pin->GetLibPin()->GetBodyStyle()
: GetBodyStyle();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
if( pin_convert > 0 && pin_convert != GetConvert() )
if( pin_bodyStyle > 0 && pin_bodyStyle != GetBodyStyle() )
continue;
if( pin->GetLocalPosition() == new_pos )
@ -2381,12 +2387,12 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground,
if( m_part )
{
LIB_PINS libPins;
m_part->GetPins( libPins, GetUnit(), GetConvert() );
m_part->GetPins( libPins, GetUnit(), GetBodyStyle() );
// Copy the source so we can re-orient and translate it.
LIB_SYMBOL tempSymbol( *m_part );
LIB_PINS tempPins;
tempSymbol.GetPins( tempPins, GetUnit(), GetConvert() );
tempSymbol.GetPins( tempPins, GetUnit(), GetBodyStyle() );
// Copy the pin info from the symbol to the temp pins
for( unsigned i = 0; i < tempPins.size(); ++ i )
@ -2418,7 +2424,7 @@ void SCH_SYMBOL::Plot( PLOTTER* aPlotter, bool aBackground,
for( bool local_background : { true, false } )
{
tempSymbol.Plot( aPlotter, GetUnit(), GetConvert(), local_background, m_pos, temp,
tempSymbol.Plot( aPlotter, GetUnit(), GetBodyStyle(), local_background, m_pos, temp,
GetDNP() );
for( SCH_FIELD field : m_fields )
@ -2491,12 +2497,12 @@ void SCH_SYMBOL::PlotPins( PLOTTER* aPlotter ) const
if( m_part )
{
LIB_PINS libPins;
m_part->GetPins( libPins, GetUnit(), GetConvert() );
m_part->GetPins( libPins, GetUnit(), GetBodyStyle() );
// Copy the source to stay const
LIB_SYMBOL tempSymbol( *m_part );
LIB_PINS tempPins;
tempSymbol.GetPins( tempPins, GetUnit(), GetConvert() );
tempSymbol.GetPins( tempPins, GetUnit(), GetBodyStyle() );
TRANSFORM transform = GetTransform();
@ -2538,13 +2544,15 @@ bool SCH_SYMBOL::IsPointClickableAnchor( const VECTOR2I& aPos ) const
{
for( const std::unique_ptr<SCH_PIN>& pin : m_pins )
{
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit() : GetUnit();
int pin_convert = pin->GetLibPin() ? pin->GetLibPin()->GetConvert() : GetConvert();
int pin_unit = pin->GetLibPin() ? pin->GetLibPin()->GetUnit()
: GetUnit();
int pin_bodyStyle = pin->GetLibPin() ? pin->GetLibPin()->GetBodyStyle()
: GetBodyStyle();
if( pin_unit > 0 && pin_unit != GetUnit() )
continue;
if( pin_convert > 0 && pin_convert != GetConvert() )
if( pin_bodyStyle > 0 && pin_bodyStyle != GetBodyStyle() )
continue;
if( pin->IsPointClickableAnchor( aPos ) )
@ -2597,7 +2605,7 @@ bool SCH_SYMBOL::operator==( const SCH_ITEM& aOther ) const
if( GetUnit() != symbol.GetUnit() )
return false;
if( GetConvert() != symbol.GetConvert() )
if( GetBodyStyle() != symbol.GetBodyStyle() )
return false;
if( GetTransform() != symbol.GetTransform() )

View File

@ -117,11 +117,11 @@ public:
* @param aLibId is the #LIB_ID of alias to create.
* @param aSheet is the schematic sheet the symbol is place into.
* @param aUnit is unit for symbols that have multiple parts per package.
* @param aConvert is the alternate body style for the schematic symbols.
* @param aBodyStyle is the alternate body style for the schematic symbols.
* @param aPosition is the position of the symbol.
*/
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const LIB_ID& aLibId, const SCH_SHEET_PATH* aSheet,
int aUnit, int aConvert = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
int aUnit, int aBodyStyle = 0, const VECTOR2I& aPosition = VECTOR2I( 0, 0 ),
EDA_ITEM* aParent = nullptr );
SCH_SYMBOL( const LIB_SYMBOL& aSymbol, const SCH_SHEET_PATH* aSheet, const PICKED_SYMBOL& aSel,
@ -297,9 +297,8 @@ public:
*/
void UpdateUnit( int aUnit );
int GetConvert() const { return m_convert; }
void SetConvert( int aConvert );
int GetBodyStyle() const { return m_bodyStyle; }
void SetBodyStyle( int aBodyStyle );
wxString GetPrefix() const { return m_prefix; }
@ -889,9 +888,9 @@ private:
VECTOR2I m_pos;
LIB_ID m_lib_id; ///< Name and library the symbol was loaded from, i.e. 74xx:74LS00.
int m_unit; ///< The unit for multiple part per package symbols.
int m_convert; ///< The alternate body style for symbols that have more than
///< one body style defined. Primarily used for symbols that
///< have a De Morgan conversion.
int m_bodyStyle; ///< The alternate body style for symbols that have more than
///< one body style defined. Currently only used for symbols
///< that have a DeMorgan conversion.
wxString m_prefix; ///< C, R, U, Q etc - the first character(s) which typically
///< indicate what the symbol is. Determined, upon placement,
///< from the library symbol. Created upon file load, by the

View File

@ -94,11 +94,11 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
if( pin->GetNumber() != next->GetNumber() )
continue;
// Pins are not duplicated only if they are in different convert bodies
// (but GetConvert() == 0 means commun to all convert bodies)
if( pin->GetConvert() != 0 && next->GetConvert() != 0 )
// Pins are not duplicated only if they are in different body styles
// (but GetBodyStyle() == 0 means commun to all body styles)
if( pin->GetBodyStyle() != 0 && next->GetBodyStyle() != 0 )
{
if( pin->GetConvert() != next->GetConvert() )
if( pin->GetBodyStyle() != next->GetBodyStyle() )
continue;
}
@ -111,10 +111,11 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
if( next->GetName() != "~" && !next->GetName().IsEmpty() )
nextName = " '" + next->GetName() + "'";
if( aSymbol->HasConversion() && next->GetConvert() )
if( aSymbol->HasAlternateBodyStyle() && next->GetBodyStyle() )
{
if( pin->GetUnit() == 0 || next->GetUnit() == 0 )
{
// TODO: 9.0: change "of converted" to "of alternate body style"
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
" conflicts with pin %s%s at location <b>(%s, %s)</b>"
" of converted." ),
@ -129,6 +130,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
}
else
{
// TODO: 9.0: change "of converted" to "of alternate body style"
msg.Printf( _( "<b>Duplicate pin %s</b> %s at location <b>(%s, %s)</b>"
" conflicts with pin %s%s at location <b>(%s, %s)</b>"
" in units %s and %s of converted." ),
@ -182,7 +184,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
}
// Test for a valid power aSymbol.
// A valid power aSymbol has only one unit, no convert and one pin.
// A valid power aSymbol has only one unit, no alternate body styles and one pin.
// And this pin should be PT_POWER_IN (invisible to be automatically connected)
// or PT_POWER_OUT for a power flag
if( aSymbol->IsPower() )
@ -193,8 +195,9 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
aMessages.push_back( msg );
}
if( aSymbol->HasConversion() )
if( aSymbol->HasAlternateBodyStyle() )
{
// TODO: 9.0: change to "A Power Symbol should not have DeMorgan variants"
msg.Printf( _( "<b>A Power Symbol should have no convert option</b><br><br>" ) );
aMessages.push_back( msg );
}
@ -238,10 +241,11 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
&& !pin->IsVisible() )
{
// hidden power pin
if( aSymbol->HasConversion() && pin->GetConvert() )
if( aSymbol->HasAlternateBodyStyle() && pin->GetBodyStyle() )
{
if( aSymbol->GetUnitCount() <= 1 )
{
// TODO: 9.0: change "of converted" to "of alternate body style"
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
" of converted." ),
pin->GetNumber(),
@ -251,6 +255,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
}
else
{
// TODO: 9.0: change "of converted" to "of alternate body style"
msg.Printf( _( "Info: <b>Hidden power pin %s</b> %s at location <b>(%s, %s)</b>"
" in unit %c of converted." ),
pin->GetNumber(),
@ -294,10 +299,11 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
// pin is off grid
msg.Empty();
if( aSymbol->HasConversion() && pin->GetConvert() )
if( aSymbol->HasAlternateBodyStyle() && pin->GetBodyStyle() )
{
if( aSymbol->GetUnitCount() <= 1 )
{
// TODO: 9.0: change "of converted" to "of alternate body style"
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%s, %s)</b>"
" of converted." ),
pin->GetNumber(),
@ -307,6 +313,7 @@ void CheckLibSymbol( LIB_SYMBOL* aSymbol, std::vector<wxString>& aMessages,
}
else
{
// TODO: 9.0: change "of converted" to "of alternate body style"
msg.Printf( _( "<b>Off grid pin %s</b> %s at location <b>(%.3s, %.3s)</b>"
" in unit %c of converted." ),
pin->GetNumber(),
@ -409,7 +416,7 @@ bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst )
// Use DeMorgan variant as secondary key
if( test == 0 )
test = ref->GetConvert() - tst->GetConvert();
test = ref->GetBodyStyle() - tst->GetBodyStyle();
// Use unit as tertiary key
if( test == 0 )

View File

@ -112,7 +112,7 @@ SYMBOL_EDIT_FRAME::SYMBOL_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_treePane = nullptr;
m_libMgr = nullptr;
m_unit = 1;
m_convert = 1;
m_bodyStyle = 1;
m_aboutTitle = _HKI( "KiCad Symbol Editor" );
wxIcon icon;
@ -497,13 +497,13 @@ void SYMBOL_EDIT_FRAME::setupUIConditions()
auto demorganStandardCond =
[this]( const SELECTION& )
{
return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
return m_bodyStyle == LIB_ITEM::BODY_STYLE::BASE;
};
auto demorganAlternateCond =
[this]( const SELECTION& )
{
return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
return m_bodyStyle == LIB_ITEM::BODY_STYLE::DEMORGAN;
};
auto multiUnitModeCond =
@ -787,7 +787,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
GetRenderSettings()->m_ShowUnit = m_unit;
GetRenderSettings()->m_ShowConvert = m_convert;
GetRenderSettings()->m_ShowBodyStyle = m_bodyStyle;
GetRenderSettings()->m_ShowDisabled = IsSymbolFromLegacyLibrary() && !IsSymbolFromSchematic();
GetRenderSettings()->m_ShowGraphicsDisabled = IsSymbolAlias() && !IsSymbolFromSchematic();
GetCanvas()->DisplaySymbol( m_symbol );
@ -841,7 +841,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
}
int unit = GetUnit();
int convert = GetConvert();
int bodyStyle = GetBodyStyle();
wxString msg;
wxString link;
@ -854,7 +854,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom )
button->Bind( wxEVT_COMMAND_HYPERLINK, std::function<void( wxHyperlinkEvent& aEvent )>(
[=]( wxHyperlinkEvent& aEvent )
{
LoadSymbolFromCurrentLib( rootSymbolName, unit, convert );
LoadSymbolFromCurrentLib( rootSymbolName, unit, bodyStyle );
} ) );
infobar->RemoveAllButtons();
@ -1282,7 +1282,7 @@ void SYMBOL_EDIT_FRAME::SetScreen( BASE_SCREEN* aScreen )
void SYMBOL_EDIT_FRAME::RebuildView()
{
GetRenderSettings()->m_ShowUnit = m_unit;
GetRenderSettings()->m_ShowConvert = m_convert;
GetRenderSettings()->m_ShowBodyStyle = m_bodyStyle;
GetRenderSettings()->m_ShowDisabled = IsSymbolFromLegacyLibrary() && !IsSymbolFromSchematic();
GetRenderSettings()->m_ShowGraphicsDisabled = IsSymbolAlias() && !IsSymbolFromSchematic();
GetCanvas()->DisplaySymbol( m_symbol );
@ -1335,7 +1335,7 @@ const BOX2I SYMBOL_EDIT_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) con
}
else
{
return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_convert );
return m_symbol->Flatten()->GetUnitBoundingBox( m_unit, m_bodyStyle );
}
}
@ -1498,7 +1498,7 @@ void SYMBOL_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
SetScreen( symbol_screen );
SetCurSymbol( new LIB_SYMBOL( *lib_symbol ), false );
RebuildSymbolUnitsList();
SetShowDeMorgan( GetCurSymbol()->HasConversion() );
SetShowDeMorgan( GetCurSymbol()->HasAlternateBodyStyle() );
if( m_toolManager )
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
@ -1641,7 +1641,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
m_schematicSymbolUUID = aSymbol->m_Uuid;
m_reference = symbol->GetFieldById( REFERENCE_FIELD )->GetText();
m_unit = std::max( 1, aSymbol->GetUnit() );
m_convert = std::max( 1, aSymbol->GetConvert() );
m_bodyStyle = std::max( 1, aSymbol->GetBodyStyle() );
// Optimize default edit options for this symbol
// Usually if units are locked, graphic items are specific to each unit
@ -1667,7 +1667,7 @@ void SYMBOL_EDIT_FRAME::LoadSymbolFromSchematic( SCH_SYMBOL* aSymbol )
UpdateTitle();
RebuildSymbolUnitsList();
SetShowDeMorgan( GetCurSymbol()->HasConversion() );
SetShowDeMorgan( GetCurSymbol()->HasAlternateBodyStyle() );
UpdateSymbolMsgPanelInfo();
// Let tools add things to the view if necessary

View File

@ -236,8 +236,8 @@ public:
int GetUnit() const { return m_unit; }
void SetUnit( int aUnit ) { m_unit = aUnit; }
int GetConvert() const { return m_convert; }
void SetConvert( int aConvert ) { m_convert = aConvert; }
int GetBodyStyle() const { return m_bodyStyle; }
void SetBodyStyle( int aBodyStyle ) { m_bodyStyle = aBodyStyle; }
bool GetShowDeMorgan() const { return m_showDeMorgan; }
void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
@ -309,10 +309,10 @@ public:
*
* @param aLibId is the #LIB_ID of the symbol to select.
* @param aUnit the unit to show
* @param aConvert the DeMorgan variant to show
* @param aBodyStyle the DeMorgan variant to show
* @return true if the symbol defined by \a aLibId was loaded.
*/
bool LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConvert );
bool LoadSymbol( const LIB_ID& aLibId, int aUnit, int aBodyStyle );
/**
* Print a page.
@ -452,10 +452,10 @@ private:
*
* @param aAliasName The symbol alias name to load from the current library.
* @param aUnit Unit to be selected
* @param aConvert Convert to be selected
* @param aBodyStyle Convert to be selected
* @return true if the symbol loaded correctly.
*/
bool LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aConvert = 0 );
bool LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aBodyStyle = 0 );
/**
* Create a copy of \a aLibEntry into memory.
@ -464,11 +464,11 @@ private:
* @param aLibrary the path to the library file that \a aLibEntry was loaded from. This is
* for error messaging purposes only.
* @param aUnit the initial unit to show.
* @param aConvert the initial DeMorgan variant to show.
* @param aBodyStyle the initial DeMorgan variant to show.
* @return True if a copy of \a aLibEntry was successfully copied.
*/
bool LoadOneLibrarySymbolAux( LIB_SYMBOL* aLibEntry, const wxString& aLibrary, int aUnit,
int aConvert );
int aBodyStyle );
///< Create a backup copy of a file with requested extension.
bool backupFile( const wxFileName& aOriginalFile, const wxString& aBackupExt );
@ -571,8 +571,8 @@ private:
// The unit number to edit and show
int m_unit;
// Show the normal shape ( m_convert <= 1 ) or the converted shape ( m_convert > 1 )
int m_convert;
// Show the normal shape (m_bodyStyle <= 1) or the DeMorgan converted shape (m_bodyStyle > 1)
int m_bodyStyle;
///< Flag if the symbol being edited was loaded directly from a schematic.
bool m_isSymbolFromSchematic;

View File

@ -142,7 +142,7 @@ bool SYMBOL_EDIT_FRAME::saveCurrentSymbol()
}
bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConvert )
bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aBodyStyle )
{
LIB_ID libId = aLibId;
@ -176,7 +176,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConver
if( GetCurSymbol() && !IsSymbolFromSchematic()
&& GetCurSymbol()->GetLibId() == libId
&& GetUnit() == aUnit
&& GetConvert() == aConvert )
&& GetBodyStyle() == aBodyStyle )
{
return true;
}
@ -195,7 +195,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbol( const LIB_ID& aLibId, int aUnit, int aConver
SelectActiveLibrary( libId.GetLibNickname() );
if( LoadSymbolFromCurrentLib( libId.GetLibItemName(), aUnit, aConvert ) )
if( LoadSymbolFromCurrentLib( libId.GetLibItemName(), aUnit, aBodyStyle ) )
{
m_treePane->GetLibTree()->SelectLibId( libId );
m_treePane->GetLibTree()->ExpandLibId( libId );
@ -219,7 +219,7 @@ void SYMBOL_EDIT_FRAME::centerItemIdleHandler( wxIdleEvent& aEvent )
bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit,
int aConvert )
int aBodyStyle )
{
LIB_SYMBOL* alias = nullptr;
@ -238,7 +238,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
return false;
}
if( !alias || !LoadOneLibrarySymbolAux( alias, GetCurLib(), aUnit, aConvert ) )
if( !alias || !LoadOneLibrarySymbolAux( alias, GetCurLib(), aUnit, aBodyStyle ) )
return false;
// Enable synchronized pin edit mode for symbols with interchangeable units
@ -246,7 +246,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
ClearUndoRedoList();
m_toolManager->RunAction( ACTIONS::zoomFitScreen );
SetShowDeMorgan( GetCurSymbol()->Flatten()->HasConversion() );
SetShowDeMorgan( GetCurSymbol()->Flatten()->HasAlternateBodyStyle() );
if( aUnit > 0 )
RebuildSymbolUnitsList();
@ -256,7 +256,7 @@ bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, in
bool SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux( LIB_SYMBOL* aEntry, const wxString& aLibrary,
int aUnit, int aConvert )
int aUnit, int aBodyStyle )
{
bool rebuildMenuAndToolbar = false;
@ -288,7 +288,7 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux( LIB_SYMBOL* aEntry, const wxStr
wxCHECK( lib_symbol, false );
m_unit = aUnit > 0 ? aUnit : 1;
m_convert = aConvert > 0 ? aConvert : 1;
m_bodyStyle = aBodyStyle > 0 ? aBodyStyle : 1;
// The buffered screen for the symbol
SCH_SCREEN* symbol_screen = m_libMgr->GetScreen( lib_symbol->GetName(), aLibrary );
@ -306,7 +306,7 @@ bool SYMBOL_EDIT_FRAME::LoadOneLibrarySymbolAux( LIB_SYMBOL* aEntry, const wxStr
UpdateTitle();
RebuildSymbolUnitsList();
SetShowDeMorgan( GetCurSymbol()->HasConversion() );
SetShowDeMorgan( GetCurSymbol()->HasAlternateBodyStyle() );
ClearUndoRedoList();
@ -445,7 +445,7 @@ void SYMBOL_EDIT_FRAME::CreateNewSymbol( const wxString& aInheritFrom )
if( dlg.GetUnitCount() < 2 )
new_symbol.LockUnits( false );
new_symbol.SetConversion( dlg.GetAlternateBodyStyle() );
new_symbol.SetHasAlternateBodyStyle( dlg.GetAlternateBodyStyle() );
}
else
{
@ -501,7 +501,7 @@ void SYMBOL_EDIT_FRAME::CreateNewSymbol( const wxString& aInheritFrom )
if( !new_symbol.GetParent().lock() )
SetShowDeMorgan( dlg.GetAlternateBodyStyle() );
else
SetShowDeMorgan( new_symbol.HasConversion() );
SetShowDeMorgan( new_symbol.HasAlternateBodyStyle() );
}
@ -775,7 +775,7 @@ void SYMBOL_EDIT_FRAME::UpdateAfterSymbolProperties( wxString* aOldName )
}
RebuildSymbolUnitsList();
SetShowDeMorgan( GetCurSymbol()->Flatten()->HasConversion() );
SetShowDeMorgan( GetCurSymbol()->Flatten()->HasAlternateBodyStyle() );
UpdateTitle();
// N.B. The view needs to be rebuilt first as the Symbol Properties change may invalidate
@ -921,7 +921,7 @@ void SYMBOL_EDIT_FRAME::DuplicateSymbol( bool aFromClipboard )
ensureUniqueName( symbol, lib );
m_libMgr->UpdateSymbol( symbol, lib );
LoadOneLibrarySymbolAux( symbol, lib, GetUnit(), GetConvert() );
LoadOneLibrarySymbolAux( symbol, lib, GetUnit(), GetBodyStyle() );
}
SyncLibraries( false );
@ -1277,10 +1277,10 @@ void SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo()
AppendMsgPanel( _( "Unit" ), msg, 8 );
if( m_convert > 1 )
msg = _( "Convert" );
if( m_bodyStyle > 1 )
msg = _( "Alternate" );
else
msg = _( "Normal" );
msg = _( "Standard" );
AppendMsgPanel( _( "Body" ), msg, 8 );

View File

@ -68,15 +68,17 @@ void SYMBOL_EDIT_FRAME::SVGPlotSymbol( const wxString& aFullFileName, VECTOR2I a
plotPos.x = aOffset.x;
plotPos.y = aOffset.y;
m_symbol->Plot( plotter, GetUnit(), GetConvert(), background, plotPos, temp, false );
m_symbol->Plot( plotter, GetUnit(), GetBodyStyle(), background, plotPos, temp, false );
// Plot lib fields, not plotted by m_symbol->Plot():
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), background, plotPos, temp, false );
m_symbol->PlotLibFields( plotter, GetUnit(), GetBodyStyle(), background, plotPos, temp,
false );
m_symbol->Plot( plotter, GetUnit(), GetConvert(), !background, plotPos, temp, false );
m_symbol->Plot( plotter, GetUnit(), GetBodyStyle(), !background, plotPos, temp, false );
// Plot lib fields, not plotted by m_symbol->Plot():
m_symbol->PlotLibFields( plotter, GetUnit(), GetConvert(), !background, plotPos, temp, false );
m_symbol->PlotLibFields( plotter, GetUnit(), GetBodyStyle(), !background, plotPos, temp,
false );
}
plotter->EndPlot();
@ -99,7 +101,8 @@ void SYMBOL_EDIT_FRAME::PrintPage( const RENDER_SETTINGS* aSettings )
plot_offset.x = pagesize.x / 2;
plot_offset.y = pagesize.y / 2;
m_symbol->PrintBackground( aSettings, plot_offset, m_unit, m_convert, LIB_SYMBOL_OPTIONS(), false );
m_symbol->PrintBackground( aSettings, plot_offset, m_unit, m_bodyStyle, LIB_SYMBOL_OPTIONS(),
false );
m_symbol->Print( aSettings, plot_offset, m_unit, m_convert, LIB_SYMBOL_OPTIONS(), false );
m_symbol->Print( aSettings, plot_offset, m_unit, m_bodyStyle, LIB_SYMBOL_OPTIONS(), false );
}

View File

@ -105,7 +105,7 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromRedoList()
}
RebuildSymbolUnitsList();
SetShowDeMorgan( symbol->HasConversion() );
SetShowDeMorgan( symbol->HasAlternateBodyStyle() );
UpdateTitle();
RebuildView();
@ -156,7 +156,7 @@ void SYMBOL_EDIT_FRAME::GetSymbolFromUndoList()
}
RebuildSymbolUnitsList();
SetShowDeMorgan( symbol->HasConversion() );
SetShowDeMorgan( symbol->HasAlternateBodyStyle() );
UpdateTitle();
RebuildView();

View File

@ -70,7 +70,7 @@
LIB_ID SYMBOL_VIEWER_FRAME::m_currentSymbol;
int SYMBOL_VIEWER_FRAME::m_unit = 1;
int SYMBOL_VIEWER_FRAME::m_convert = 1;
int SYMBOL_VIEWER_FRAME::m_bodyStyle = 1;
bool SYMBOL_VIEWER_FRAME::m_show_progress = true;
@ -371,19 +371,19 @@ void SYMBOL_VIEWER_FRAME::setupUIConditions()
[this]( const SELECTION& )
{
LIB_SYMBOL* symbol = GetSelectedSymbol();
return symbol && symbol->HasConversion();
return symbol && symbol->HasAlternateBodyStyle();
};
auto demorganStandardCond =
[]( const SELECTION& )
{
return m_convert == LIB_ITEM::LIB_CONVERT::BASE;
return m_bodyStyle == LIB_ITEM::BODY_STYLE::BASE;
};
auto demorganAlternateCond =
[]( const SELECTION& )
{
return m_convert == LIB_ITEM::LIB_CONVERT::DEMORGAN;
return m_bodyStyle == LIB_ITEM::BODY_STYLE::DEMORGAN;
};
auto haveDatasheetCond =
@ -407,10 +407,10 @@ void SYMBOL_VIEWER_FRAME::setupUIConditions()
}
void SYMBOL_VIEWER_FRAME::SetUnitAndConvert( int aUnit, int aConvert )
void SYMBOL_VIEWER_FRAME::SetUnitAndBodyStyle( int aUnit, int aBodyStyle )
{
m_unit = aUnit > 0 ? aUnit : 1;
m_convert = aConvert > 0 ? aConvert : LIB_ITEM::LIB_CONVERT::BASE;
m_bodyStyle = aBodyStyle > 0 ? aBodyStyle : LIB_ITEM::BODY_STYLE::BASE;
m_selection_changed = false;
updatePreviewSymbol();
@ -444,7 +444,7 @@ void SYMBOL_VIEWER_FRAME::updatePreviewSymbol()
if( symbol )
{
GetRenderSettings()->m_ShowUnit = m_unit;
GetRenderSettings()->m_ShowConvert = m_convert;
GetRenderSettings()->m_ShowBodyStyle = m_bodyStyle;
m_previewItem = symbol->Flatten();
view->Add( m_previewItem.get() );
@ -640,7 +640,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList()
? m_libList->GetBaseString( 0 ) : wxString( wxT( "" ) ) );
m_currentSymbol.SetLibItemName( wxEmptyString );
m_unit = 1;
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
m_bodyStyle = LIB_ITEM::BODY_STYLE::BASE;
}
bool cmp_changed = ReCreateSymbolList();
@ -715,7 +715,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList()
if( m_symbolList->IsEmpty() )
{
SetSelectedSymbol( wxEmptyString );
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
m_bodyStyle = LIB_ITEM::BODY_STYLE::BASE;
m_unit = 1;
return true;
}
@ -727,7 +727,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList()
{
// Select the first library entry when the previous entry name does not exist in
// the current library.
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
m_bodyStyle = LIB_ITEM::BODY_STYLE::BASE;
m_unit = 1;
index = -1;
changed = true;
@ -827,7 +827,7 @@ void SYMBOL_VIEWER_FRAME::SetSelectedSymbol( const wxString& aSymbolName )
if( m_selection_changed )
{
m_unit = 1;
m_convert = LIB_ITEM::LIB_CONVERT::BASE;
m_bodyStyle = LIB_ITEM::BODY_STYLE::BASE;
m_selection_changed = false;
}
@ -953,7 +953,7 @@ const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) c
wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) );
return tmp->GetUnitBoundingBox( m_unit, m_convert );
return tmp->GetUnitBoundingBox( m_unit, m_bodyStyle );
}
}

View File

@ -105,11 +105,11 @@ public:
* Set unit and convert, and set flag preventing them from automatically resetting to 1.
*
* @param aUnit is the unit, if invalid will be set to 1.
* @param aConvert is the alternate body style, if invalid will be set to 1.
* @param aBodyStyle is the alternate body style, if invalid will be set to 1.
*/
void SetUnitAndConvert( int aUnit, int aConvert );
void SetUnitAndBodyStyle( int aUnit, int aBodyStyle );
int GetUnit() const { return m_unit; }
int GetConvert() const { return m_convert; }
int GetBodyStyle() const { return m_bodyStyle; }
LIB_SYMBOL* GetSelectedSymbol() const;
@ -168,7 +168,7 @@ private:
static LIB_ID m_currentSymbol;
static int m_unit;
static int m_convert;
static int m_bodyStyle;
static bool m_show_progress;
/**

View File

@ -345,7 +345,7 @@ int EE_INSPECTION_TOOL::DiffSymbol( const TOOL_EVENT& aEvent )
SYMBOL_DIFF_WIDGET* diff = constructDiffPanel( panel );
diff->DisplayDiff( flattenedSchSymbol.release(), flattenedLibSymbol.release(),
symbol->GetUnit(), symbol->GetConvert() );
symbol->GetUnit(), symbol->GetBodyStyle() );
}
}

View File

@ -92,7 +92,7 @@ SELECTION_CONDITION EE_CONDITIONS::SingleDeMorganSymbol = []( const SELECTION& a
SCH_SYMBOL* symbol = dynamic_cast<SCH_SYMBOL*>( aSel.Front() );
if( symbol )
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->HasConversion();
return symbol->GetLibSymbolRef() && symbol->GetLibSymbolRef()->HasAlternateBodyStyle();
}
return false;
@ -158,7 +158,7 @@ EE_SELECTION_TOOL::EE_SELECTION_TOOL() :
m_isSymbolEditor( false ),
m_isSymbolViewer( false ),
m_unit( 0 ),
m_convert( 0 )
m_bodyStyle( 0 )
{
m_selection.Clear();
}
@ -201,7 +201,7 @@ bool EE_SELECTION_TOOL::Init()
{
m_isSymbolEditor = true;
m_unit = symbolEditorFrame->GetUnit();
m_convert = symbolEditorFrame->GetConvert();
m_bodyStyle = symbolEditorFrame->GetBodyStyle();
}
else
{
@ -343,7 +343,7 @@ void EE_SELECTION_TOOL::Reset( RESET_REASON aReason )
{
m_isSymbolEditor = true;
m_unit = symbolEditFrame->GetUnit();
m_convert = symbolEditFrame->GetConvert();
m_bodyStyle = symbolEditFrame->GetBodyStyle();
}
else
{
@ -1025,11 +1025,11 @@ bool EE_SELECTION_TOOL::CollectHits( EE_COLLECTOR& aCollector, const VECTOR2I& a
if( !symbol )
return false;
aCollector.Collect( symbol->GetDrawItems(), aScanTypes, aWhere, m_unit, m_convert );
aCollector.Collect( symbol->GetDrawItems(), aScanTypes, aWhere, m_unit, m_bodyStyle );
}
else
{
aCollector.Collect( m_frame->GetScreen(), aScanTypes, aWhere, m_unit, m_convert );
aCollector.Collect( m_frame->GetScreen(), aScanTypes, aWhere, m_unit, m_bodyStyle );
if( m_frame->eeconfig()->m_Selection.select_pin_selects_symbol )
{
@ -2099,7 +2099,7 @@ bool EE_SELECTION_TOOL::Selectable( const EDA_ITEM* aItem, const VECTOR2I* aPos,
if( lib_item->GetUnit() && lib_item->GetUnit() != symEditFrame->GetUnit() )
return false;
if( lib_item->GetConvert() && lib_item->GetConvert() != symEditFrame->GetConvert() )
if( lib_item->GetBodyStyle() && lib_item->GetBodyStyle() != symEditFrame->GetBodyStyle() )
return false;
}

View File

@ -288,7 +288,7 @@ private:
bool m_isSymbolEditor; // True when the symbol editor is the parent frame
bool m_isSymbolViewer; // True when the symbol browser is the parent frame
int m_unit; // Fixed unit filter (for symbol editor)
int m_convert; // Fixed DeMorgan filter (for symbol editor)
int m_bodyStyle; // Fixed DeMorgan filter (for symbol editor)
};
#endif //KICAD_SCH_SELECTION_TOOL_H

View File

@ -1675,7 +1675,7 @@ int SCH_EDIT_TOOL::ChangeSymbols( const TOOL_EVENT& aEvent )
}
int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
int SCH_EDIT_TOOL::ChangeBodyStyle( const TOOL_EVENT& aEvent )
{
EE_SELECTION& selection = m_selectionTool->RequestSelection( { SCH_SYMBOL_T } );
@ -1685,13 +1685,13 @@ int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
if( aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard )
&& symbol->GetConvert() == LIB_ITEM::LIB_CONVERT::BASE )
&& symbol->GetBodyStyle() == LIB_ITEM::BODY_STYLE::BASE )
{
return 0;
}
if( aEvent.IsAction( &EE_ACTIONS::showDeMorganAlternate )
&& symbol->GetConvert() != LIB_ITEM::LIB_CONVERT::DEMORGAN )
&& symbol->GetBodyStyle() != LIB_ITEM::BODY_STYLE::DEMORGAN )
{
return 0;
}
@ -1699,7 +1699,7 @@ int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
if( !symbol->IsNew() )
saveCopyInUndoList( symbol, UNDO_REDO::CHANGED );
m_frame->ConvertPart( symbol );
m_frame->FlipBodyStyle( symbol );
if( symbol->IsNew() )
m_toolMgr->PostAction( ACTIONS::refreshPreview );
@ -1801,7 +1801,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
if( wxWindow* blocking_win = editor->Kiway().GetBlockingDialog() )
blocking_win->Close( true );
editor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetConvert() );
editor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetBodyStyle() );
editor->Show( true );
editor->Raise();
@ -2643,9 +2643,9 @@ void SCH_EDIT_TOOL::setTransitions()
Go( &SCH_EDIT_TOOL::ChangeSymbols, EE_ACTIONS::updateSymbols.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeSymbols, EE_ACTIONS::changeSymbol.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeSymbols, EE_ACTIONS::updateSymbol.MakeEvent() );
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::toggleDeMorgan.MakeEvent() );
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::showDeMorganStandard.MakeEvent() );
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::showDeMorganAlternate.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeBodyStyle, EE_ACTIONS::toggleDeMorgan.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeBodyStyle, EE_ACTIONS::showDeMorganStandard.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeBodyStyle, EE_ACTIONS::showDeMorganAlternate.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, EE_ACTIONS::toLabel.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, EE_ACTIONS::toHLabel.MakeEvent() );
Go( &SCH_EDIT_TOOL::ChangeTextType, EE_ACTIONS::toGLabel.MakeEvent() );

View File

@ -54,7 +54,7 @@ public:
int EditField( const TOOL_EVENT& aEvent );
int AutoplaceFields( const TOOL_EVENT& aEvent );
int ChangeSymbols( const TOOL_EVENT& aEvent );
int ConvertDeMorgan( const TOOL_EVENT& aEvent );
int ChangeBodyStyle( const TOOL_EVENT& aEvent );
int EditPageNumber( const TOOL_EVENT& aEvent );
/**

View File

@ -2235,7 +2235,8 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
}
else if( aEvent.IsAction( &EE_ACTIONS::editLibSymbolWithLibEdit ) )
{
symbolEditor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(), symbol->GetConvert() );
symbolEditor->LoadSymbol( symbol->GetLibId(), symbol->GetUnit(),
symbol->GetBodyStyle() );
if( !symbolEditor->IsSymbolTreeShown() )
{

View File

@ -434,7 +434,7 @@ int SYMBOL_EDITOR_CONTROL::RenameSymbol( const TOOL_EVENT& aEvent )
int SYMBOL_EDITOR_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent )
{
int convert = aEvent.IsAction( &EE_ACTIONS::showDeMorganStandard ) ?
LIB_ITEM::LIB_CONVERT::BASE : LIB_ITEM::LIB_CONVERT::DEMORGAN;
LIB_ITEM::BODY_STYLE::BASE : LIB_ITEM::BODY_STYLE::DEMORGAN;
if( m_frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
{
@ -442,7 +442,7 @@ int SYMBOL_EDITOR_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection );
SYMBOL_EDIT_FRAME* symbolEditor = static_cast<SYMBOL_EDIT_FRAME*>( m_frame );
symbolEditor->SetConvert( convert );
symbolEditor->SetBodyStyle( convert );
m_toolMgr->ResetTools( TOOL_BASE::MODEL_RELOAD );
symbolEditor->RebuildView();
@ -450,7 +450,7 @@ int SYMBOL_EDITOR_CONTROL::OnDeMorgan( const TOOL_EVENT& aEvent )
else if( m_frame->IsType( FRAME_SCH_VIEWER ) )
{
SYMBOL_VIEWER_FRAME* symbolViewer = static_cast<SYMBOL_VIEWER_FRAME*>( m_frame );
symbolViewer->SetUnitAndConvert( symbolViewer->GetUnit(), convert );
symbolViewer->SetUnitAndBodyStyle( symbolViewer->GetUnit(), convert );
}
return 0;
@ -624,7 +624,7 @@ int SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG( const TOOL_EVENT& aEvent )
PAGE_INFO pageTemp = pageSave;
BOX2I symbolBBox = symbol->GetUnitBoundingBox( editFrame->GetUnit(),
editFrame->GetConvert(), false );
editFrame->GetBodyStyle(), false );
// Add a small margin (10% of size)to the plot bounding box
symbolBBox.Inflate( symbolBBox.GetSize().x * 0.1, symbolBBox.GetSize().y * 0.1 );
@ -648,15 +648,15 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
{
LIB_SYMBOL* libSymbol = nullptr;
LIB_ID libId;
int unit, convert;
int unit, bodyStyle;
if( m_isSymbolEditor )
{
SYMBOL_EDIT_FRAME* editFrame = getEditFrame<SYMBOL_EDIT_FRAME>();
libSymbol = editFrame->GetCurSymbol();
unit = editFrame->GetUnit();
convert = editFrame->GetConvert();
unit = editFrame->GetUnit();
bodyStyle = editFrame->GetBodyStyle();
if( libSymbol )
libId = libSymbol->GetLibId();
@ -667,7 +667,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
libSymbol = viewerFrame->GetSelectedSymbol();
unit = viewerFrame->GetUnit();
convert = viewerFrame->GetConvert();
bodyStyle = viewerFrame->GetBodyStyle();
if( libSymbol )
libId = libSymbol->GetLibId();
@ -695,7 +695,7 @@ int SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent )
wxCHECK( libSymbol->GetLibId().IsValid(), 0 );
SCH_SYMBOL* symbol = new SCH_SYMBOL( *libSymbol, libId, &schframe->GetCurrentSheet(),
unit, convert );
unit, bodyStyle );
symbol->SetParent( schframe->GetScreen() );

View File

@ -55,7 +55,7 @@ SYMBOL_EDITOR_DRAWING_TOOLS::SYMBOL_EDITOR_DRAWING_TOOLS() :
m_lastFillStyle( FILL_T::NO_FILL ),
m_lastFillColor( COLOR4D::UNSPECIFIED ),
m_lastStroke( 0, LINE_STYLE::DEFAULT, COLOR4D::UNSPECIFIED ),
m_drawSpecificConvert( true ),
m_drawSpecificBodyStyle( true ),
m_drawSpecificUnit( false ),
m_inDrawShape( false ),
m_inTwoClickPlace( false )
@ -224,8 +224,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
if( m_drawSpecificUnit )
text->SetUnit( m_frame->GetUnit() );
if( m_drawSpecificConvert )
text->SetConvert( m_frame->GetConvert() );
if( m_drawSpecificBodyStyle )
text->SetBodyStyle( m_frame->GetBodyStyle() );
text->SetPosition( VECTOR2I( cursorPos.x, -cursorPos.y ) );
text->SetTextSize( VECTOR2I( schIUScale.MilsToIU( settings->m_Defaults.text_size ),
@ -488,8 +488,8 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::doDrawShape( const TOOL_EVENT& aEvent, std::opt
if( m_drawSpecificUnit )
item->SetUnit( m_frame->GetUnit() );
if( m_drawSpecificConvert )
item->SetConvert( m_frame->GetConvert() );
if( m_drawSpecificBodyStyle )
item->SetBodyStyle( m_frame->GetBodyStyle() );
m_selectionTool->AddItemToSel( item );
}

View File

@ -59,8 +59,8 @@ public:
void SetLastTextAngle( const EDA_ANGLE& aAngle ) { m_lastTextAngle = aAngle; }
EDA_ANGLE GetLastTextAngle() const { return m_lastTextAngle; }
void SetDrawSpecificConvert( bool aSpecific ) { m_drawSpecificConvert = aSpecific; }
bool GetDrawSpecificConvert() const { return m_drawSpecificConvert; }
void SetDrawSpecificBodyStyle( bool aSpecific ) { m_drawSpecificBodyStyle = aSpecific; }
bool GetDrawSpecificBodyStyle() const { return m_drawSpecificBodyStyle; }
void SetDrawSpecificUnit( bool aSpecific ) { m_drawSpecificUnit = aSpecific; }
bool GetDrawSpecificUnit() const { return m_drawSpecificUnit; }
@ -78,7 +78,7 @@ private:
FILL_T m_lastFillStyle;
COLOR4D m_lastFillColor;
STROKE_PARAMS m_lastStroke;
bool m_drawSpecificConvert;
bool m_drawSpecificBodyStyle;
bool m_drawSpecificUnit;
///< Re-entrancy guards

View File

@ -318,7 +318,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
got_unit[curr_pin->GetUnit()] = true;
int curr_convert = curr_pin->GetConvert();
int curr_bodyStyle = curr_pin->GetBodyStyle();
ELECTRICAL_PINTYPE etype = curr_pin->GetType();
wxString name = curr_pin->GetName();
std::vector<LIB_PIN*> pins = symbol->GetAllLibPins();
@ -331,7 +331,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DoDelete( const TOOL_EVENT& aEvent )
if( pin->GetPosition() != pos )
continue;
if( pin->GetConvert() != curr_convert )
if( pin->GetBodyStyle() != curr_bodyStyle )
continue;
if( pin->GetType() != etype )
@ -504,7 +504,7 @@ void SYMBOL_EDITOR_EDIT_TOOL::editShapeProperties( LIB_SHAPE* aShape )
m_frame->OnModify();
SYMBOL_EDITOR_DRAWING_TOOLS* drawingTools = m_toolMgr->GetTool<SYMBOL_EDITOR_DRAWING_TOOLS>();
drawingTools->SetDrawSpecificConvert( !dlg.GetApplyToAllConversions() );
drawingTools->SetDrawSpecificBodyStyle( !dlg.GetApplyToAllConversions() );
drawingTools->SetDrawSpecificUnit( !dlg.GetApplyToAllUnits() );
std::vector<MSG_PANEL_ITEM> items;
@ -843,7 +843,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
newItem->SetFlags( IS_NEW | IS_PASTED | SELECTED );
newItem->SetUnit( newItem->GetUnit() ? m_frame->GetUnit() : 0 );
newItem->SetConvert( newItem->GetConvert() ? m_frame->GetConvert() : 0 );
newItem->SetBodyStyle( newItem->GetBodyStyle() ? m_frame->GetBodyStyle() : 0 );
symbol->AddDrawItem( newItem );
getView()->Add( newItem );

View File

@ -200,7 +200,7 @@ bool SYMBOL_EDITOR_MOVE_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, SCH_COM
if( !got_unit[pin->GetUnit()]
&& pin->GetPosition() == cur_pin->GetPosition()
&& pin->GetOrientation() == cur_pin->GetOrientation()
&& pin->GetConvert() == cur_pin->GetConvert()
&& pin->GetBodyStyle() == cur_pin->GetBodyStyle()
&& pin->GetType() == cur_pin->GetType()
&& pin->GetName() == cur_pin->GetName() )
{

View File

@ -35,17 +35,17 @@
#include "symbol_editor_pin_tool.h"
static ELECTRICAL_PINTYPE g_LastPinType = ELECTRICAL_PINTYPE::PT_INPUT;
static PIN_ORIENTATION g_LastPinOrient = PIN_ORIENTATION::PIN_RIGHT;
static GRAPHIC_PINSHAPE g_LastPinShape = GRAPHIC_PINSHAPE::LINE;
static bool g_LastPinCommonConvert = false;
static bool g_LastPinCommonUnit = false;
static bool g_LastPinVisible = true;
static ELECTRICAL_PINTYPE g_LastPinType = ELECTRICAL_PINTYPE::PT_INPUT;
static PIN_ORIENTATION g_LastPinOrient = PIN_ORIENTATION::PIN_RIGHT;
static GRAPHIC_PINSHAPE g_LastPinShape = GRAPHIC_PINSHAPE::LINE;
static bool g_LastPinCommonBodyStyle = false;
static bool g_LastPinCommonUnit = false;
static bool g_LastPinVisible = true;
// The -1 is a non-valid value to trigger delayed initialization
static int g_LastPinLength = -1;
static int g_LastPinNameSize = -1;
static int g_LastPinNumSize = -1;
static int g_LastPinLength = -1;
static int g_LastPinNameSize = -1;
static int g_LastPinNumSize = -1;
static int GetLastPinLength()
{
@ -157,12 +157,12 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
&& other->IsVisible() == original_pin.IsVisible()
&& other->GetName() == original_pin.GetName() )
{
if( aPin->GetConvert() == 0 )
if( aPin->GetBodyStyle() == 0 )
{
if( !aPin->GetUnit() || other->GetUnit() == aPin->GetUnit() )
aPin->GetParent()->RemoveDrawItem( other );
}
else if( other->GetConvert() == aPin->GetConvert() )
else if( other->GetBodyStyle() == aPin->GetBodyStyle() )
{
other->SetPosition( aPin->GetPosition() );
other->ChangeLength( aPin->GetLength() );
@ -171,7 +171,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
if( aPin->GetUnit() == 0 )
{
if( !aPin->GetConvert() || other->GetConvert() == aPin->GetConvert() )
if( !aPin->GetBodyStyle() || other->GetBodyStyle() == aPin->GetBodyStyle() )
aPin->GetParent()->RemoveDrawItem( other );
}
@ -200,7 +200,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
g_LastPinLength = aPin->GetLength();
g_LastPinShape = aPin->GetShape();
g_LastPinType = aPin->GetType();
g_LastPinCommonConvert = aPin->GetConvert() == 0;
g_LastPinCommonBodyStyle = aPin->GetBodyStyle() == 0;
g_LastPinCommonUnit = aPin->GetUnit() == 0;
g_LastPinVisible = aPin->IsVisible();
@ -221,7 +221,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::PlacePin( LIB_PIN* aPin )
continue;
// test for same body style
if( test->GetConvert() && test->GetConvert() != aPin->GetConvert() )
if( test->GetBodyStyle() && test->GetBodyStyle() != aPin->GetBodyStyle() )
continue;
if( ask_for_pin && m_frame->SynchronizePins() )
@ -302,7 +302,7 @@ LIB_PIN* SYMBOL_EDITOR_PIN_TOOL::CreatePin( const VECTOR2I& aPosition, LIB_SYMBO
pin->SetShape( g_LastPinShape );
pin->SetNameTextSize( GetLastPinNameSize() );
pin->SetNumberTextSize( GetLastPinNumSize() );
pin->SetConvert( g_LastPinCommonConvert ? 0 : m_frame->GetConvert() );
pin->SetBodyStyle( g_LastPinCommonBodyStyle ? 0 : m_frame->GetBodyStyle() );
pin->SetUnit( g_LastPinCommonUnit ? 0 : m_frame->GetUnit() );
pin->SetVisible( g_LastPinVisible );
@ -386,7 +386,7 @@ int SYMBOL_EDITOR_PIN_TOOL::PushPinProperties( const TOOL_EVENT& aEvent )
if( aEvent.IsAction( &EE_ACTIONS::pushPinLength ) )
{
if( !pin->GetConvert() || pin->GetConvert() == m_frame->GetConvert() )
if( !pin->GetBodyStyle() || pin->GetBodyStyle() == m_frame->GetBodyStyle() )
pin->ChangeLength( sourcePin->GetLength() );
}
else if( aEvent.IsAction( &EE_ACTIONS::pushPinNameSize ) )

View File

@ -609,7 +609,7 @@ void PANEL_SYMBOL_CHOOSER::populateFootprintSelector( LIB_ID const& aLibId )
wxString fp_name = fp_field ? fp_field->GetFullText() : wxString( "" );
// All units, but only a single De Morgan variant.
if( symbol->HasConversion() )
if( symbol->HasAlternateBodyStyle() )
symbol->GetPins( temp_pins, 0, 1 );
else
symbol->GetPins( temp_pins );

View File

@ -92,13 +92,13 @@ void SYMBOL_DIFF_WIDGET::DisplayDiff( LIB_SYMBOL* aSchSymbol, LIB_SYMBOL* aLibSy
static_cast<KIGFX::SCH_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
settings->m_ShowUnit = ( m_previewItem->IsMulti() && !aUnit ) ? 1 : aUnit;
settings->m_ShowConvert = ( m_previewItem->HasConversion() && !aConvert ) ? 1 : aConvert;
settings->m_ShowBodyStyle = ( m_previewItem->HasAlternateBodyStyle() && !aConvert ) ? 1 : aConvert;
view->Add( m_previewItem );
// Get the symbol size, in internal units
m_itemBBox = m_previewItem->GetUnitBoundingBox( settings->m_ShowUnit,
settings->m_ShowConvert );
settings->m_ShowBodyStyle );
// Calculate the draw scale to fit the drawing area
fitOnDrawArea();

View File

@ -183,7 +183,7 @@ void SYMBOL_PREVIEW_WIDGET::fitOnDrawArea()
}
void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, int aConvert )
void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, int aBodyStyle )
{
KIGFX::VIEW* view = m_preview->GetView();
auto settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( view->GetPainter()->GetSettings() );
@ -233,14 +233,14 @@ void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, i
settings->m_ShowUnit = ( m_previewItem->IsMulti() && aUnit == 0 ) ? 1 : aUnit;
// For symbols having a De Morgan body style, use the first style
settings->m_ShowConvert =
( m_previewItem->HasConversion() && aConvert == 0 ) ? 1 : aConvert;
settings->m_ShowBodyStyle =
( m_previewItem->HasAlternateBodyStyle() && aBodyStyle == 0 ) ? 1 : aBodyStyle;
view->Add( m_previewItem );
// Get the symbol size, in internal units
m_itemBBox = m_previewItem->GetUnitBoundingBox( settings->m_ShowUnit,
settings->m_ShowConvert );
settings->m_ShowBodyStyle );
if( !m_preview->IsShownOnScreen() )
{
@ -260,7 +260,7 @@ void SYMBOL_PREVIEW_WIDGET::DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, i
}
void SYMBOL_PREVIEW_WIDGET::DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aConvert )
void SYMBOL_PREVIEW_WIDGET::DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aBodyStyle )
{
KIGFX::VIEW* view = m_preview->GetView();
@ -283,13 +283,13 @@ void SYMBOL_PREVIEW_WIDGET::DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aCo
// draw all of them.)
settings->m_ShowUnit = ( m_previewItem->IsMulti() && aUnit == 0 ) ? 1 : aUnit;
settings->m_ShowConvert =
( m_previewItem->HasConversion() && aConvert == 0 ) ? 1 : aConvert;
settings->m_ShowBodyStyle =
( m_previewItem->HasAlternateBodyStyle() && aBodyStyle == 0 ) ? 1 : aBodyStyle;
view->Add( m_previewItem );
// Get the symbol size, in internal units
m_itemBBox = aSymbol->GetUnitBoundingBox( settings->m_ShowUnit, settings->m_ShowConvert );
m_itemBBox = aSymbol->GetUnitBoundingBox( settings->m_ShowUnit, settings->m_ShowBodyStyle );
// Calculate the draw scale to fit the drawing area
fitOnDrawArea();

View File

@ -56,9 +56,9 @@ public:
/**
* Set the currently displayed symbol.
*/
void DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, int aConvert = 0 );
void DisplaySymbol( const LIB_ID& aSymbolID, int aUnit, int aBodyStyle = 0 );
void DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aConvert = 0 );
void DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aBodyStyle = 0 );
protected:
void onSize( wxSizeEvent& aEvent );

View File

@ -74,7 +74,7 @@ BOOST_AUTO_TEST_CASE( DefaultProperties )
BOOST_CHECK_EQUAL( m_part_no_data.IsMulti(), false );
// no conversion
BOOST_CHECK_EQUAL( m_part_no_data.HasConversion(), false );
BOOST_CHECK_EQUAL( m_part_no_data.HasAlternateBodyStyle(), false );
}
@ -538,7 +538,7 @@ BOOST_AUTO_TEST_CASE( GetUnitItems )
BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 0 ).size() == 1 );
// A single unique unit with 1 pin in unit 1 and body style 1.
pin1->SetConvert( 1 );
pin1->SetBodyStyle( 1 );
BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 1 ).size() == 1 );
// Two unique units with pin 1 assigned to unit 1 and body style 1 and pin 2 assigned to
@ -546,13 +546,13 @@ BOOST_AUTO_TEST_CASE( GetUnitItems )
LIB_PIN* pin2 = new LIB_PIN( &m_part_no_data );
m_part_no_data.SetUnitCount( 2 );
pin2->SetUnit( 2 );
pin2->SetConvert( 2 );
pin2->SetBodyStyle( 2 );
pin2->SetNumber( "4" );
m_part_no_data.AddDrawItem( pin2 );
BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 2, 2 ).size() == 1 );
// Make pin 1 body style common to all units.
pin1->SetConvert( 0 );
pin1->SetBodyStyle( 0 );
BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 1, 1 ).size() == 0 );
BOOST_CHECK( m_part_no_data.GetUnitDrawItems( 2, 1 ).size() == 1 );
@ -577,7 +577,7 @@ BOOST_AUTO_TEST_CASE( GetUnitDrawItems )
std::vector<struct LIB_SYMBOL_UNIT> units = m_part_no_data.GetUnitDrawItems();
BOOST_CHECK( units.size() == 1 );
BOOST_CHECK( units[0].m_unit == 0 );
BOOST_CHECK( units[0].m_convert == 0 );
BOOST_CHECK( units[0].m_bodyStyle == 0 );
BOOST_CHECK( units[0].m_items[0] == pin1 );
}