From cbc60d90ec6a0f704fd8b2d359de9b5fd6b7342a Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Thu, 24 Aug 2023 22:32:12 -0400 Subject: [PATCH] Add missing line style prop to eda_shape --- common/eda_shape.cpp | 19 +++++++++++++++++++ include/eda_shape.h | 3 +++ pcbnew/pcb_textbox.cpp | 1 + 3 files changed, 23 insertions(+) diff --git a/common/eda_shape.cpp b/common/eda_shape.cpp index 30fa37b63f..f4514a4164 100644 --- a/common/eda_shape.cpp +++ b/common/eda_shape.cpp @@ -1614,6 +1614,21 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance } +void EDA_SHAPE::SetLineStyle( const PLOT_DASH_TYPE aStyle ) +{ + m_stroke.SetPlotStyle( aStyle ); +} + + +PLOT_DASH_TYPE EDA_SHAPE::GetLineStyle() const +{ + if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT ) + return m_stroke.GetPlotStyle(); + + return PLOT_DASH_TYPE::SOLID; +} + + IMPLEMENT_ENUM_TO_WXANY( SHAPE_T ) IMPLEMENT_ENUM_TO_WXANY( PLOT_DASH_TYPE ) @@ -1678,6 +1693,10 @@ static struct EDA_SHAPE_DESC propMgr.AddProperty( new PROPERTY( _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( + _HKI( "Line Style" ), lineStyleSetter, &EDA_SHAPE::GetLineStyle ) ); + auto angle = new PROPERTY( _HKI( "Angle" ), NO_SETTER( EDA_SHAPE, EDA_ANGLE ), &EDA_SHAPE::GetArcAngle, PROPERTY_DISPLAY::PT_DECIDEGREE ); diff --git a/include/eda_shape.h b/include/eda_shape.h index 2a4ca65073..eb297c2027 100644 --- a/include/eda_shape.h +++ b/include/eda_shape.h @@ -110,6 +110,9 @@ public: int GetWidth() const { return m_stroke.GetWidth(); } virtual int GetEffectiveWidth() const { return GetWidth(); } + void SetLineStyle( const PLOT_DASH_TYPE aStyle ); + PLOT_DASH_TYPE GetLineStyle() const; + void SetShape( SHAPE_T aShape ) { m_shape = aShape; } SHAPE_T GetShape() const { return m_shape; } diff --git a/pcbnew/pcb_textbox.cpp b/pcbnew/pcb_textbox.cpp index abbc24d85b..e764a235db 100644 --- a/pcbnew/pcb_textbox.cpp +++ b/pcbnew/pcb_textbox.cpp @@ -581,5 +581,6 @@ static struct PCB_TEXTBOX_DESC propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End X" ) ); propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "End Y" ) ); propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Width" ) ); + propMgr.Mask( TYPE_HASH( PCB_TEXTBOX ), TYPE_HASH( EDA_SHAPE ), _HKI( "Line Style" ) ); } } _PCB_TEXTBOX_DESC;