Disable custom color selection when Fill Mode is Body Background Color

Currently, the system allows custom color selection for the Fill Color
property in the Properties toolbar even when Fill Mode is set to Body
Background Color via the Properties window. However, this does not update
the color to match the Body Background color. To fix this, custom color
selection for Fill Color will be disabled when Body Background Color is
chosen.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18919
This commit is contained in:
Dhineshkumar S 2024-10-28 15:48:02 +00:00 committed by Seth Hillbrand
parent 8057f7d420
commit cb41f39045

View File

@ -2095,9 +2095,17 @@ static struct EDA_SHAPE_DESC
shapeProps )
.SetAvailableFunc( fillAvailable );
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Fill Color" ),
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor ),
shapeProps )
auto fillColor = new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Fill Color" ),
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor );
fillColor->SetWriteableFunc(
[=]( INSPECTABLE* aItem ) -> bool
{
if( EDA_SHAPE* edaShape = dynamic_cast<EDA_SHAPE*>( aItem ) )
return edaShape->GetFillMode() == FILL_T::FILLED_WITH_COLOR;
return true;
} );
propMgr.AddProperty( fillColor, shapeProps )
.SetAvailableFunc( fillAvailable )
.SetIsHiddenFromRulesEditor();
}