Avoid forcing all units

When the enduser is not allowed to change the status of "common to all
units", then it should be disabled

Fixes https://gitlab.com/kicad/code/kicad/issues/14084

(cherry picked from commit 3207d1386e)
This commit is contained in:
Seth Hillbrand 2023-02-28 12:58:58 -08:00
parent ff6f658f9d
commit 17c34c88dc
4 changed files with 16 additions and 5 deletions

View File

@ -119,7 +119,8 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
wxFAIL_MSG( "Line type not found in the type lookup map" );
m_privateCheckbox->SetValue( m_shape->IsPrivate() );
m_checkApplyToAllUnits->SetValue( m_shape->GetUnit() == 0 );
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 );

View File

@ -122,6 +122,8 @@ DIALOG_LIB_TEXT_PROPERTIES::~DIALOG_LIB_TEXT_PROPERTIES()
bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
{
LIB_SYMBOL* symbol = m_graphicText->GetParent();
if( m_graphicText )
{
m_textSize.SetValue( m_graphicText->GetTextWidth() );
@ -135,7 +137,8 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
m_bold->Check( m_graphicText->IsBold() );
m_privateCheckbox->SetValue( m_graphicText->IsPrivate() );
m_CommonUnit->SetValue( m_graphicText->GetUnit() == 0 );
m_CommonUnit->SetValue(
symbol && symbol->GetUnitCount() > 1 && m_graphicText->GetUnit() == 0 );
m_CommonConvert->SetValue( m_graphicText->GetConvert() == 0 );
if( m_graphicText->GetTextAngle().IsHorizontal() )
@ -164,7 +167,8 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
m_textSize.SetValue( schIUScale.MilsToIU( cfg->m_Defaults.text_size ) );
m_CommonUnit->SetValue( !tools->GetDrawSpecificUnit() );
m_CommonUnit->SetValue(
symbol && symbol->GetUnitCount() > 1 && !tools->GetDrawSpecificUnit() );
m_CommonConvert->SetValue( !tools->GetDrawSpecificConvert() );
if( tools->GetLastTextAngle().IsHorizontal() )
@ -173,6 +177,8 @@ bool DIALOG_LIB_TEXT_PROPERTIES::TransferDataToWindow()
m_vertical->Check();
}
m_CommonUnit->Enable( symbol && symbol->GetUnitCount() > 1 );
return true;
}

View File

@ -141,6 +141,8 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
if( !wxDialog::TransferDataToWindow() )
return false;
LIB_SYMBOL* symbol = m_currentText->GetParent();
m_textCtrl->SetValue( m_currentText->GetText() );
m_textCtrl->EmptyUndoBuffer();
@ -204,7 +206,9 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
m_fillColorSwatch->Enable( m_currentText->IsFilled() );
m_privateCheckbox->SetValue( m_currentText->IsPrivate() );
m_CommonUnit->SetValue( m_currentText->GetUnit() == 0 );
m_CommonUnit->SetValue(
symbol && symbol->GetUnitCount() > 1 && m_currentText->GetUnit() == 0 );
m_CommonUnit->Enable( symbol && symbol->GetUnitCount() > 1 );
m_CommonConvert->SetValue( m_currentText->GetConvert() == 0 );
return true;

View File

@ -266,7 +266,7 @@ bool DIALOG_PIN_PROPERTIES::TransferDataToWindow()
m_numberSize.SetValue( m_pin->GetNumberTextSize() );
m_pinLength.SetValue( m_pin->GetLength() );
m_checkApplyToAllParts->Enable( m_pin->GetParent()->IsMulti() );
m_checkApplyToAllParts->SetValue( m_pin->GetUnit() == 0 );
m_checkApplyToAllParts->SetValue( m_pin->GetParent()->IsMulti() && m_pin->GetUnit() == 0 );
m_checkApplyToAllConversions->SetValue( m_pin->GetConvert() == 0 );
m_checkShow->SetValue( m_pin->IsVisible() );