Bug fixes for handling boolean flags in DRC rules.

This commit is contained in:
Jeff Young 2023-05-26 18:43:23 +01:00
parent 768fbf5af2
commit cb53a18ee3
4 changed files with 9 additions and 16 deletions

View File

@ -1220,7 +1220,7 @@ void UOP::Exec( CONTEXT* ctx )
result = arg1Value != 0.0 ? 0 : 1;
break;
default:
result = 0.0;
result = arg1Value != 0.0 ? 1 : 0;
break;
}

View File

@ -353,6 +353,10 @@ protected:
{
wxAny a = getter( aObject );
// We don't currently have a bool type, so change it to a numeric
if( a.CheckType<bool>() )
a = a.RawAs<bool>() ? 1 : 0;
if ( !( std::is_enum<T>::value && a.CheckType<int>() ) && !a.CheckType<T>() )
throw std::invalid_argument( "Invalid requested type" );

View File

@ -1429,9 +1429,6 @@ static struct ALIGNED_DIMENSION_DESC
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ALIGNED ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
@ -1468,9 +1465,6 @@ static struct ORTHOGONAL_DIMENSION_DESC
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_ORTHOGONAL ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
@ -1512,9 +1506,6 @@ static struct RADIAL_DIMENSION_DESC
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_RADIAL ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
@ -1560,9 +1551,6 @@ static struct LEADER_DIMENSION_DESC
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_LEADER ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );
@ -1600,9 +1588,6 @@ static struct CENTER_DIMENSION_DESC
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( EDA_TEXT ),
_HKI( "Hyperlink" ),
[]( INSPECTABLE* aItem ) { return false; } );
// This is actually defined on PCB_TEXT, but using PCB_TEXT as the base-class doesn't
// work, while using BOARD_ITEM does. ???
propMgr.OverrideAvailability( TYPE_HASH( PCB_DIM_CENTER ), TYPE_HASH( BOARD_ITEM ),
_HKI( "Knockout" ),
[]( INSPECTABLE* aItem ) { return false; } );

View File

@ -257,6 +257,10 @@ std::unique_ptr<LIBEVAL::VAR_REF> PCB_EXPR_UCODE::CreateVarRef( const wxString&
{
vref->SetType( LIBEVAL::VT_NUMERIC );
}
else if( prop->TypeHash() == TYPE_HASH( bool ) )
{
vref->SetType( LIBEVAL::VT_NUMERIC );
}
else if( prop->TypeHash() == TYPE_HASH( wxString ) )
{
vref->SetType( LIBEVAL::VT_STRING );