Not all font sizes, fill properties or color properties are the same.
This commit is contained in:
parent
30d0a68aeb
commit
87571ed8b8
|
@ -1904,13 +1904,16 @@ static struct EDA_SHAPE_DESC
|
|||
&EDA_SHAPE::SetEndY, &EDA_SHAPE::GetEndY, PROPERTY_DISPLAY::PT_COORD,
|
||||
ORIGIN_TRANSFORMS::ABS_Y_COORD ) )
|
||||
.SetAvailableFunc( isNotPolygon );
|
||||
// TODO: m_arcCenter, m_bezierC1, m_bezierC2, m_poly
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, int>( _HKI( "Line Width" ),
|
||||
&EDA_SHAPE::SetWidth, &EDA_SHAPE::GetWidth, PROPERTY_DISPLAY::PT_SIZE ) );
|
||||
|
||||
void ( EDA_SHAPE::*lineStyleSetter )( PLOT_DASH_TYPE ) = &EDA_SHAPE::SetLineStyle;
|
||||
propMgr.AddProperty( new PROPERTY_ENUM<EDA_SHAPE, PLOT_DASH_TYPE>(
|
||||
_HKI( "Line Style" ), lineStyleSetter, &EDA_SHAPE::GetLineStyle ) );
|
||||
_HKI( "Line Style" ), lineStyleSetter, &EDA_SHAPE::GetLineStyle ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Line Color" ),
|
||||
&EDA_SHAPE::SetLineColor, &EDA_SHAPE::GetLineColor ) );
|
||||
|
||||
auto angle = new PROPERTY<EDA_SHAPE, EDA_ANGLE>( _HKI( "Angle" ),
|
||||
NO_SETTER( EDA_SHAPE, EDA_ANGLE ), &EDA_SHAPE::GetArcAngle,
|
||||
|
@ -1925,35 +1928,32 @@ static struct EDA_SHAPE_DESC
|
|||
} );
|
||||
propMgr.AddProperty( angle );
|
||||
|
||||
auto filled = new PROPERTY<EDA_SHAPE, bool>( _HKI( "Filled" ),
|
||||
&EDA_SHAPE::SetFilled, &EDA_SHAPE::IsFilled );
|
||||
filled->SetAvailableFunc(
|
||||
[=]( INSPECTABLE* aItem ) -> bool
|
||||
{
|
||||
SHAPE_T itemShape;
|
||||
auto fillAvailable =
|
||||
[=]( INSPECTABLE* aItem ) -> bool
|
||||
{
|
||||
if( EDA_SHAPE* shape = dynamic_cast<EDA_SHAPE*>( aItem ) )
|
||||
{
|
||||
switch( shape->GetShape() )
|
||||
{
|
||||
case SHAPE_T::POLY:
|
||||
case SHAPE_T::RECTANGLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
return true;
|
||||
|
||||
try
|
||||
{
|
||||
itemShape = aItem->Get<SHAPE_T>( shape );
|
||||
}
|
||||
catch( std::runtime_error& err )
|
||||
{
|
||||
wxFAIL_MSG( err.what() );
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
switch( itemShape )
|
||||
{
|
||||
case SHAPE_T::POLY:
|
||||
case SHAPE_T::RECTANGLE:
|
||||
case SHAPE_T::CIRCLE:
|
||||
return true;
|
||||
return false;
|
||||
};
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, bool>( _HKI( "Filled" ),
|
||||
&EDA_SHAPE::SetFilled, &EDA_SHAPE::IsFilled ) )
|
||||
.SetAvailableFunc( fillAvailable );
|
||||
|
||||
propMgr.AddProperty( filled );
|
||||
propMgr.AddProperty( new PROPERTY<EDA_SHAPE, COLOR4D>( _HKI( "Fill Color" ),
|
||||
&EDA_SHAPE::SetFillColor, &EDA_SHAPE::GetFillColor ) )
|
||||
.SetAvailableFunc( fillAvailable );
|
||||
}
|
||||
} _EDA_SHAPE_DESC;
|
||||
|
|
|
@ -489,11 +489,11 @@ BITMAPS LIB_SHAPE::GetMenuImage() const
|
|||
{
|
||||
switch( GetShape() )
|
||||
{
|
||||
case SHAPE_T::SEGMENT: return BITMAPS::add_line;
|
||||
case SHAPE_T::ARC: return BITMAPS::add_arc;
|
||||
case SHAPE_T::CIRCLE: return BITMAPS::add_circle;
|
||||
case SHAPE_T::RECTANGLE: return BITMAPS::add_rectangle;
|
||||
case SHAPE_T::POLY: return BITMAPS::add_graphical_segments;
|
||||
case SHAPE_T::SEGMENT: return BITMAPS::add_line;
|
||||
case SHAPE_T::ARC: return BITMAPS::add_arc;
|
||||
case SHAPE_T::CIRCLE: return BITMAPS::add_circle;
|
||||
case SHAPE_T::RECTANGLE: return BITMAPS::add_rectangle;
|
||||
case SHAPE_T::POLY: return BITMAPS::add_graphical_segments;
|
||||
|
||||
default:
|
||||
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
|
||||
|
@ -582,5 +582,25 @@ static struct LIB_SHAPE_DESC
|
|||
_HKI( "Position X" ), isPolygon );
|
||||
propMgr.OverrideAvailability( TYPE_HASH( LIB_SHAPE ), TYPE_HASH( LIB_ITEM ),
|
||||
_HKI( "Position Y" ), isPolygon );
|
||||
|
||||
propMgr.Mask( TYPE_HASH( LIB_SHAPE ), TYPE_HASH( EDA_SHAPE ), _HKI( "Filled" ) );
|
||||
|
||||
ENUM_MAP<FILL_T>& fillEnum = ENUM_MAP<FILL_T>::Instance();
|
||||
|
||||
if( fillEnum.Choices().GetCount() == 0 )
|
||||
{
|
||||
fillEnum.Map( FILL_T::NO_FILL, _HKI( "None" ) )
|
||||
.Map( FILL_T::FILLED_SHAPE, _HKI( "Body outline color" ) )
|
||||
.Map( FILL_T::FILLED_WITH_BG_BODYCOLOR, _HKI( "Body background color" ) )
|
||||
.Map( FILL_T::FILLED_WITH_COLOR, _HKI( "Fill color" ) );
|
||||
}
|
||||
|
||||
void ( LIB_SHAPE::*fillModeSetter )( FILL_T ) = &LIB_SHAPE::SetFillMode;
|
||||
FILL_T ( LIB_SHAPE::*fillModeGetter )() const = &LIB_SHAPE::GetFillMode;
|
||||
|
||||
propMgr.AddProperty( new PROPERTY_ENUM< LIB_SHAPE, FILL_T>( _HKI( "Fill" ),
|
||||
fillModeSetter, fillModeGetter ) );
|
||||
}
|
||||
} _LIB_SHAPE_DESC;
|
||||
|
||||
ENUM_TO_WXANY( FILL_T )
|
||||
|
|
|
@ -116,6 +116,13 @@ public:
|
|||
void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void setFilled( bool aFlag ) override
|
||||
{
|
||||
m_fill = aFlag ? FILL_T::FILLED_WITH_COLOR : FILL_T::NO_FILL;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
void Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
void PrintBackground( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset ) override;
|
||||
|
|
|
@ -509,6 +509,11 @@ static struct SCH_TEXT_DESC
|
|||
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Visible" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Thickness" ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<SCH_TEXT, int>( _HKI( "Text Size" ),
|
||||
&SCH_TEXT::SetSchTextSize, &SCH_TEXT::GetSchTextSize, PROPERTY_DISPLAY::PT_SIZE ),
|
||||
_( "Text Properties" ) );
|
||||
|
||||
// Orientation is exposed differently in schematic; mask the base for now
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXT ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
|
||||
|
|
|
@ -62,6 +62,9 @@ public:
|
|||
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
||||
}
|
||||
|
||||
int GetSchTextSize() const { return GetTextWidth(); }
|
||||
void SetSchTextSize( int aSize ) { SetTextSize( VECTOR2I( aSize, aSize ) ); }
|
||||
|
||||
bool IsHypertext() const override
|
||||
{
|
||||
return HasHyperlink();
|
||||
|
|
|
@ -508,16 +508,21 @@ static struct SCH_TEXTBOX_DESC
|
|||
REGISTER_TYPE( SCH_TEXTBOX );
|
||||
|
||||
propMgr.AddTypeCast( new TYPE_CAST<SCH_TEXTBOX, SCH_SHAPE> );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<SCH_TEXTBOX, EDA_SHAPE> );
|
||||
propMgr.AddTypeCast( new TYPE_CAST<SCH_TEXTBOX, EDA_TEXT> );
|
||||
propMgr.InheritsAfter( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( SCH_SHAPE ) );
|
||||
propMgr.InheritsAfter( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ) );
|
||||
propMgr.InheritsAfter( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ) );
|
||||
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Shape" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start X" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Start Y" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End X" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End Y" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Width" ) );
|
||||
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Width" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Height" ) );
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Thickness" ) );
|
||||
|
||||
propMgr.AddProperty( new PROPERTY<SCH_TEXTBOX, int>( _HKI( "Text Size" ),
|
||||
&SCH_TEXTBOX::SetSchTextSize, &SCH_TEXTBOX::GetSchTextSize, PROPERTY_DISPLAY::PT_SIZE ),
|
||||
_( "Text Properties" ) );
|
||||
|
||||
propMgr.Mask( TYPE_HASH( SCH_TEXTBOX ), TYPE_HASH( EDA_TEXT ), _HKI( "Orientation" ) );
|
||||
}
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
|
||||
int GetTextMargin() const;
|
||||
|
||||
int GetSchTextSize() const { return GetTextWidth(); }
|
||||
void SetSchTextSize( int aSize ) { SetTextSize( VECTOR2I( aSize, aSize ) ); }
|
||||
|
||||
VECTOR2I GetDrawPos() const override;
|
||||
|
||||
virtual wxString GetShownText( const SCH_SHEET_PATH* aPath, bool aAllowExtraText,
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
|
||||
void SetFilled( bool aFlag )
|
||||
{
|
||||
m_fill = aFlag ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
|
||||
setFilled( aFlag );
|
||||
}
|
||||
|
||||
void SetFillMode( FILL_T aFill ) { m_fill = aFill; }
|
||||
|
@ -113,6 +113,9 @@ public:
|
|||
void SetLineStyle( const PLOT_DASH_TYPE aStyle );
|
||||
PLOT_DASH_TYPE GetLineStyle() const;
|
||||
|
||||
void SetLineColor( const COLOR4D& aColor ) { m_stroke.SetColor( aColor ); }
|
||||
COLOR4D GetLineColor() const { return m_stroke.GetColor(); }
|
||||
|
||||
void SetShape( SHAPE_T aShape ) { m_shape = aShape; }
|
||||
SHAPE_T GetShape() const { return m_shape; }
|
||||
|
||||
|
@ -339,6 +342,11 @@ protected:
|
|||
void setPosition( const VECTOR2I& aPos );
|
||||
VECTOR2I getPosition() const;
|
||||
|
||||
virtual void setFilled( bool aFlag )
|
||||
{
|
||||
m_fill = aFlag ? FILL_T::FILLED_SHAPE : FILL_T::NO_FILL;
|
||||
}
|
||||
|
||||
void move( const VECTOR2I& aMoveVector );
|
||||
void rotate( const VECTOR2I& aRotCentre, const EDA_ANGLE& aAngle );
|
||||
void flip( const VECTOR2I& aCentre, bool aFlipLeftRight );
|
||||
|
|
|
@ -681,6 +681,9 @@ static struct PCB_SHAPE_DESC
|
|||
propMgr.OverrideAvailability( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( BOARD_ITEM ),
|
||||
_HKI( "Position Y" ), isPolygon );
|
||||
|
||||
propMgr.Mask( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Color" ) );
|
||||
propMgr.Mask( TYPE_HASH( PCB_SHAPE ), TYPE_HASH( EDA_SHAPE ), _HKI( "Fill Color" ) );
|
||||
|
||||
auto isCopper =
|
||||
[]( INSPECTABLE* aItem ) -> bool
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue