ADDED: Expose units and DeMorgan to properties system.
(Also fixes inheritance bug in LIB_PIN's properties.)
(cherry picked from commit 58df9c96f4
)
This commit is contained in:
parent
09985988e7
commit
92275c41cc
|
@ -1973,53 +1973,65 @@ static struct EDA_SHAPE_DESC
|
|||
return false;
|
||||
};
|
||||
|
||||
const wxString shapeProps = _HKI( "Shape Properties" );
|
||||
|
||||
auto shape = new PROPERTY_ENUM<EDA_SHAPE, SHAPE_T>( _HKI( "Shape" ),
|
||||
NO_SETTER( EDA_SHAPE, SHAPE_T ), &EDA_SHAPE::GetShape );
|
||||
propMgr.AddProperty( shape );
|
||||
propMgr.AddProperty( shape, shapeProps );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Start X" ),
|
||||
&EDA_SHAPE::SetStartX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Start Y" ),
|
||||
&EDA_SHAPE::SetStartY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Center X" ),
|
||||
&EDA_SHAPE::SetStartX, &EDA_SHAPE::GetStartX, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( isCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Center Y" ),
|
||||
&EDA_SHAPE::SetStartY, &EDA_SHAPE::GetStartY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( isCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Radius" ),
|
||||
&EDA_SHAPE::SetRadius, &EDA_SHAPE::GetRadius, PROPERTY_DISPLAY::PT_SIZE,
|
||||
ORIGIN_TRANSFORMS::NOT_A_COORD ) )
|
||||
ORIGIN_TRANSFORMS::NOT_A_COORD ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( isCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "End X" ),
|
||||
&EDA_SHAPE::SetEndX, &EDA_SHAPE::GetEndX, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ) )
|
||||
ORIGIN_TRANSFORMS::ABS_X_COORD ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "End Y" ),
|
||||
&EDA_SHAPE::SetEndY, &EDA_SHAPE::GetEndY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( isNotPolygonOrCircle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Line Width" ),
|
||||
&EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
|
||||
&EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::PT_SIZE ),
|
||||
shapeProps );
|
||||
|
||||
void ( EDA_SHAPE::*lineStyleSetter )( LINE_STYLE ) = &EDA_SHAPE::SetLineStyle;
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_SHAPE, LINE_STYLE>(
|
||||
_HKI( "Line Style" ), lineStyleSetter, &EDA_SHAPE::GetLineStyle ) );
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_SHAPE, LINE_STYLE>( _HKI( "Line Style" ),
|
||||
lineStyleSetter, &EDA_SHAPE::GetLineStyle ),
|
||||
shapeProps );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Line Color" ),
|
||||
&EDA_SHAPE::SetLineColor, &EDA_SHAPE::GetLineColor ) )
|
||||
&EDA_SHAPE::SetLineColor, &EDA_SHAPE::GetLineColor ),
|
||||
shapeProps )
|
||||
.SetIsHiddenFromRulesEditor();
|
||||
|
||||
auto angle = new PROPERTY<EDA_SHAPE, EDA_ANGLE>( _HKI( "Angle" ),
|
||||
|
@ -2033,7 +2045,7 @@ static struct EDA_SHAPE_DESC
|
|||
|
||||
return false;
|
||||
} );
|
||||
propMgr.AddProperty( angle );
|
||||
propMgr.AddProperty( angle, shapeProps );
|
||||
|
||||
auto fillAvailable =
|
||||
[=]( INSPECTABLE* aItem ) -> bool
|
||||
|
@ -2056,11 +2068,13 @@ static struct EDA_SHAPE_DESC
|
|||
};
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, bool>( _HKI( "Filled" ),
|
||||
&EDA_SHAPE::SetFilled, &EDA_SHAPE::IsFilled ) )
|
||||
&EDA_SHAPE::SetFilled, &EDA_SHAPE::IsFilled ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( fillAvailable );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Fill Color" ),
|
||||
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor ) )
|
||||
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor ),
|
||||
shapeProps )
|
||||
.SetAvailableFunc( fillAvailable )
|
||||
.SetIsHiddenFromRulesEditor();
|
||||
}
|
||||
|
|
|
@ -183,3 +183,49 @@ void LIB_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
aLayers[1] = LAYER_DEVICE_BACKGROUND;
|
||||
aLayers[2] = LAYER_SELECTION_SHADOWS;
|
||||
}
|
||||
|
||||
|
||||
static struct LIB_ITEM_DESC
|
||||
{
|
||||
LIB_ITEM_DESC()
|
||||
{
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
REGISTER_TYPE( LIB_ITEM );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<LIB_ITEM, EDA_ITEM> );
|
||||
propMgr.InheritsAfter( TYPE_HASH( LIB_ITEM ), TYPE_HASH( EDA_ITEM ) );
|
||||
|
||||
auto multiUnit =
|
||||
[=]( INSPECTABLE* aItem ) -> bool
|
||||
{
|
||||
if( LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( aItem ) )
|
||||
{
|
||||
if( LIB_SYMBOL* symbol = libItem->GetParent() )
|
||||
return symbol->IsMulti();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
auto multiBodyStyle =
|
||||
[=]( INSPECTABLE* aItem ) -> bool
|
||||
{
|
||||
if( LIB_ITEM* libItem = dynamic_cast<LIB_ITEM*>( aItem ) )
|
||||
{
|
||||
if( LIB_SYMBOL* symbol = libItem->GetParent() )
|
||||
return symbol->HasAlternateBodyStyle();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<LIB_ITEM, int>( _HKI( "Unit" ),
|
||||
&LIB_ITEM::SetUnit, &LIB_ITEM::GetUnit ) )
|
||||
.SetAvailableFunc( multiUnit );
|
||||
propMgr.AddProperty( new PROPERTY<LIB_ITEM, int>( _HKI( "Body Style" ),
|
||||
&LIB_ITEM::SetBodyStyle, &LIB_ITEM::GetBodyStyle ) )
|
||||
.SetAvailableFunc( multiBodyStyle );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<LIB_ITEM, bool>( _HKI( "Private" ),
|
||||
&LIB_ITEM::SetPrivate, &LIB_ITEM::IsPrivate ) );
|
||||
}
|
||||
} _LIB_ITEM_DESC;
|
||||
|
|
|
@ -1661,7 +1661,8 @@ static struct LIB_PIN_DESC
|
|||
|
||||
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
|
||||
REGISTER_TYPE( LIB_PIN );
|
||||
propMgr.InheritsAfter( TYPE_HASH( LIB_PIN ), TYPE_HASH( SCH_ITEM ) );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<LIB_PIN, LIB_ITEM> );
|
||||
propMgr.InheritsAfter( TYPE_HASH( LIB_PIN ), TYPE_HASH( LIB_ITEM ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<LIB_PIN, wxString>( _HKI( "Pin Name" ),
|
||||
&LIB_PIN::SetName, &LIB_PIN::GetName ) );
|
||||
|
|
|
@ -600,7 +600,8 @@ static struct LIB_SHAPE_DESC
|
|||
FILL_T ( LIB_SHAPE::*fillModeGetter )() const = &LIB_SHAPE::GetFillMode;
|
||||
|
||||
propMgr.AddProperty( new PROPERTY_ENUM< LIB_SHAPE, FILL_T>( _HKI( "Fill" ),
|
||||
fillModeSetter, fillModeGetter ) );
|
||||
fillModeSetter, fillModeGetter ),
|
||||
_HKI( "Shape Properties" ) );
|
||||
}
|
||||
} _LIB_SHAPE_DESC;
|
||||
|
||||
|
|
Loading…
Reference in New Issue