diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index 39b211e4a7..d1c2e43cf2 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -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; } diff --git a/include/properties/property.h b/include/properties/property.h index 836ce6ca4c..5a2f3ce64c 100644 --- a/include/properties/property.h +++ b/include/properties/property.h @@ -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() ) + a = a.RawAs() ? 1 : 0; + if ( !( std::is_enum::value && a.CheckType() ) && !a.CheckType() ) throw std::invalid_argument( "Invalid requested type" ); diff --git a/pcbnew/pcb_dimension.cpp b/pcbnew/pcb_dimension.cpp index c6302c3ce5..40fa481999 100644 --- a/pcbnew/pcb_dimension.cpp +++ b/pcbnew/pcb_dimension.cpp @@ -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; } ); diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 314b24f837..490be93dd7 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -257,6 +257,10 @@ std::unique_ptr 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 );