7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 17:09:36 +00:00
It's been a long time since line style was specific to plotting.
This commit is contained in:
Jeff Young 2023-11-25 13:05:45 +00:00
parent d4ce2c8982
commit df83e24eb7
73 changed files with 623 additions and 621 deletions
3d-viewer/3d_canvas
common
eeschema
include
pcbnew
qa/pcbnew_utils

View File

@ -598,9 +598,9 @@ void BOARD_ADAPTER::addShape( const PCB_SHAPE* aShape, CONTAINER_2D_BASE* aConta
{
// The full width of the lines to create
const float linewidth3DU = TO_3DU( aShape->GetWidth() );
PLOT_DASH_TYPE lineStyle = aShape->GetStroke().GetPlotStyle();
LINE_STYLE lineStyle = aShape->GetStroke().GetLineStyle();
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
{
switch( aShape->GetShape() )
{

View File

@ -40,7 +40,7 @@
EDA_SHAPE::EDA_SHAPE( SHAPE_T aType, int aLineWidth, FILL_T aFill ) :
m_endsSwapped( false ),
m_shape( aType ),
m_stroke( aLineWidth, PLOT_DASH_TYPE::DEFAULT, COLOR4D::UNSPECIFIED ),
m_stroke( aLineWidth, LINE_STYLE::DEFAULT, COLOR4D::UNSPECIFIED ),
m_fill( aFill ),
m_fillColor( COLOR4D::UNSPECIFIED ),
m_rectangleHeight( 0 ),
@ -1599,7 +1599,7 @@ int EDA_SHAPE::Compare( const EDA_SHAPE* aOther ) const
TEST_PT( m_poly.CVertex( ii ), aOther->m_poly.CVertex( ii ) );
TEST_E( m_stroke.GetWidth(), aOther->m_stroke.GetWidth() );
TEST( (int) m_stroke.GetPlotStyle(), (int) aOther->m_stroke.GetPlotStyle() );
TEST( (int) m_stroke.GetLineStyle(), (int) aOther->m_stroke.GetLineStyle() );
TEST( (int) m_fill, (int) aOther->m_fill );
return 0;
@ -1718,18 +1718,18 @@ void EDA_SHAPE::TransformShapeToPolygon( SHAPE_POLY_SET& aBuffer, int aClearance
}
void EDA_SHAPE::SetLineStyle( const PLOT_DASH_TYPE aStyle )
void EDA_SHAPE::SetLineStyle( const LINE_STYLE aStyle )
{
m_stroke.SetPlotStyle( aStyle );
m_stroke.SetLineStyle( aStyle );
}
PLOT_DASH_TYPE EDA_SHAPE::GetLineStyle() const
LINE_STYLE EDA_SHAPE::GetLineStyle() const
{
if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
return m_stroke.GetPlotStyle();
if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
return m_stroke.GetLineStyle();
return PLOT_DASH_TYPE::SOLID;
return LINE_STYLE::SOLID;
}
@ -1744,7 +1744,7 @@ bool EDA_SHAPE::operator==( const EDA_SHAPE& aOther ) const
if( m_stroke.GetWidth() != aOther.m_stroke.GetWidth() )
return false;
if( m_stroke.GetPlotStyle() != aOther.m_stroke.GetPlotStyle() )
if( m_stroke.GetLineStyle() != aOther.m_stroke.GetLineStyle() )
return false;
if( m_fillColor != aOther.m_fillColor )
@ -1791,7 +1791,7 @@ double EDA_SHAPE::Similarity( const EDA_SHAPE& aOther ) const
if( m_stroke.GetWidth() != aOther.m_stroke.GetWidth() )
similarity *= 0.9;
if( m_stroke.GetPlotStyle() != aOther.m_stroke.GetPlotStyle() )
if( m_stroke.GetLineStyle() != aOther.m_stroke.GetLineStyle() )
similarity *= 0.9;
if( m_fillColor != aOther.m_fillColor )
@ -1857,7 +1857,7 @@ double EDA_SHAPE::Similarity( const EDA_SHAPE& aOther ) const
IMPLEMENT_ENUM_TO_WXANY( SHAPE_T )
IMPLEMENT_ENUM_TO_WXANY( PLOT_DASH_TYPE )
IMPLEMENT_ENUM_TO_WXANY( LINE_STYLE )
static struct EDA_SHAPE_DESC
@ -1872,16 +1872,16 @@ static struct EDA_SHAPE_DESC
.Map( SHAPE_T::POLY, _HKI( "Polygon" ) )
.Map( SHAPE_T::BEZIER, _HKI( "Bezier" ) );
auto& plotDashTypeEnum = ENUM_MAP<PLOT_DASH_TYPE>::Instance();
auto& plotDashTypeEnum = ENUM_MAP<LINE_STYLE>::Instance();
if( plotDashTypeEnum.Choices().GetCount() == 0 )
{
plotDashTypeEnum.Map( PLOT_DASH_TYPE::DEFAULT, _HKI( "Default" ) )
.Map( PLOT_DASH_TYPE::SOLID, _HKI( "Solid" ) )
.Map( PLOT_DASH_TYPE::DASH, _HKI( "Dashed" ) )
.Map( PLOT_DASH_TYPE::DOT, _HKI( "Dotted" ) )
.Map( PLOT_DASH_TYPE::DASHDOT, _HKI( "Dash-Dot" ) )
.Map( PLOT_DASH_TYPE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
plotDashTypeEnum.Map( LINE_STYLE::DEFAULT, _HKI( "Default" ) )
.Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
.Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
.Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
.Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
.Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
@ -1920,8 +1920,8 @@ static struct EDA_SHAPE_DESC
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>(
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<EDA_SHAPE, COLOR4D>( _HKI( "Line Color" ),

View File

@ -47,7 +47,7 @@ class EDA_ITEM;
class IMPORTED_STROKE
{
public:
IMPORTED_STROKE( double aWidth = 0, PLOT_DASH_TYPE aPlotStyle = PLOT_DASH_TYPE::DEFAULT,
IMPORTED_STROKE( double aWidth = 0, LINE_STYLE aPlotStyle = LINE_STYLE::DEFAULT,
const KIGFX::COLOR4D& aColor = KIGFX::COLOR4D::UNSPECIFIED ) :
m_width( aWidth ),
m_plotstyle( aPlotStyle ), m_color( aColor )
@ -57,15 +57,15 @@ public:
double GetWidth() const { return m_width; }
void SetWidth( double aWidth ) { m_width = aWidth; }
PLOT_DASH_TYPE GetPlotStyle() const { return m_plotstyle; }
void SetPlotStyle( PLOT_DASH_TYPE aPlotStyle ) { m_plotstyle = aPlotStyle; }
LINE_STYLE GetPlotStyle() const { return m_plotstyle; }
void SetPlotStyle( LINE_STYLE aPlotStyle ) { m_plotstyle = aPlotStyle; }
KIGFX::COLOR4D GetColor() const { return m_color; }
void SetColor( const KIGFX::COLOR4D& aColor ) { m_color = aColor; }
private:
double m_width;
PLOT_DASH_TYPE m_plotstyle;
LINE_STYLE m_plotstyle;
KIGFX::COLOR4D m_color;
};

View File

@ -145,7 +145,7 @@ bool SVG_IMPORT_PLUGIN::Import()
strokeColor = COLOR4D::UNSPECIFIED;
}
PLOT_DASH_TYPE dashType = PLOT_DASH_TYPE::SOLID;
LINE_STYLE dashType = LINE_STYLE::SOLID;
if( shape->strokeDashCount > 0 )
{
@ -165,13 +165,13 @@ bool SVG_IMPORT_PLUGIN::Import()
}
if( dotCount > 0 && dashCount == 0 )
dashType = PLOT_DASH_TYPE::DOT;
dashType = LINE_STYLE::DOT;
else if( dotCount == 0 && dashCount > 0 )
dashType = PLOT_DASH_TYPE::DASH;
dashType = LINE_STYLE::DASH;
else if( dotCount == 1 && dashCount == 1 )
dashType = PLOT_DASH_TYPE::DASHDOT;
dashType = LINE_STYLE::DASHDOT;
else if( dotCount == 2 && dashCount == 1 )
dashType = PLOT_DASH_TYPE::DASHDOTDOT;
dashType = LINE_STYLE::DASHDOTDOT;
}
IMPORTED_STROKE stroke( lineWidth, dashType, strokeColor );

View File

@ -96,21 +96,21 @@ static const struct
};
static const char* getDXFLineType( PLOT_DASH_TYPE aType )
static const char* getDXFLineType( LINE_STYLE aType )
{
switch( aType )
{
case PLOT_DASH_TYPE::DEFAULT:
case PLOT_DASH_TYPE::SOLID:
case LINE_STYLE::DEFAULT:
case LINE_STYLE::SOLID:
return "CONTINUOUS";
case PLOT_DASH_TYPE::DASH:
case LINE_STYLE::DASH:
return "DASHED";
case PLOT_DASH_TYPE::DOT:
case LINE_STYLE::DOT:
return "DOTTED";
case PLOT_DASH_TYPE::DASHDOT:
case LINE_STYLE::DASHDOT:
return "DASHDOT";
default:
wxFAIL_MSG( "Unhandled PLOT_DASH_TYPE" );
wxFAIL_MSG( "Unhandled LINE_STYLE" );
return "CONTINUOUS";
}
}
@ -623,11 +623,11 @@ void DXF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
if( m_penLastpos != pos && plume == 'D' )
{
wxASSERT( m_currentLineType >= PLOT_DASH_TYPE::FIRST_TYPE
&& m_currentLineType <= PLOT_DASH_TYPE::LAST_TYPE );
wxASSERT( m_currentLineType >= LINE_STYLE::FIRST_TYPE
&& m_currentLineType <= LINE_STYLE::LAST_TYPE );
// DXF LINE
wxString cname = getDXFColorName( m_currentColor );
const char* lname = getDXFLineType( static_cast<PLOT_DASH_TYPE>( m_currentLineType ) );
const char* lname = getDXFLineType( static_cast<LINE_STYLE>( m_currentLineType ) );
fprintf( m_outputFile, "0\nLINE\n8\n%s\n6\n%s\n10\n%s\n20\n%s\n11\n%s\n21\n%s\n",
TO_UTF8( cname ), lname,
formatCoord( pen_lastpos_dev.x ).c_str(),
@ -640,10 +640,10 @@ void DXF_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
}
void DXF_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle )
void DXF_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
{
wxASSERT( aLineStyle >= PLOT_DASH_TYPE::FIRST_TYPE
&& aLineStyle <= PLOT_DASH_TYPE::LAST_TYPE );
wxASSERT( aLineStyle >= LINE_STYLE::FIRST_TYPE
&& aLineStyle <= LINE_STYLE::LAST_TYPE );
m_currentLineType = aLineStyle;
}

View File

@ -222,7 +222,7 @@ static const double PLUsPERDECIMIL = 0.1016;
HPGL_PLOTTER::HPGL_PLOTTER() :
m_arcTargetChordLength( 0 ),
m_arcMinChordDegrees( 5.0, DEGREES_T ),
m_lineStyle( PLOT_DASH_TYPE::SOLID ),
m_lineStyle( LINE_STYLE::SOLID ),
m_useUserCoords( false ),
m_fitUserCoords( false ),
m_current_item( nullptr )
@ -305,10 +305,10 @@ bool HPGL_PLOTTER::EndPlot()
}
}
VECTOR2I loc = m_items.begin()->loc_start;
bool pen_up = true;
PLOT_DASH_TYPE current_dash = PLOT_DASH_TYPE::SOLID;
int current_pen = m_penNumber;
VECTOR2I loc = m_items.begin()->loc_start;
bool pen_up = true;
LINE_STYLE current_dash = LINE_STYLE::SOLID;
int current_pen = m_penNumber;
for( HPGL_ITEM const& item : m_items )
{
@ -531,7 +531,7 @@ void HPGL_PLOTTER::PenTo( const VECTOR2I& pos, char plume )
}
void HPGL_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle )
void HPGL_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
{
m_lineStyle = aLineStyle;
flushItem();
@ -906,15 +906,15 @@ void HPGL_PLOTTER::sortItems( std::list<HPGL_ITEM>& items )
}
const char* HPGL_PLOTTER::lineStyleCommand( PLOT_DASH_TYPE aLineStyle )
const char* HPGL_PLOTTER::lineStyleCommand( LINE_STYLE aLineStyle )
{
switch( aLineStyle )
{
case PLOT_DASH_TYPE::DASH: return "LT 2 4 1;";
case PLOT_DASH_TYPE::DOT: return "LT 1 1 1;";
case PLOT_DASH_TYPE::DASHDOT: return "LT 4 6 1;";
case PLOT_DASH_TYPE::DASHDOTDOT: return "LT 7 8 1;";
default: return "LT;";
case LINE_STYLE::DASH: return "LT 2 4 1;";
case LINE_STYLE::DOT: return "LT 1 1 1;";
case LINE_STYLE::DASHDOT: return "LT 4 6 1;";
case LINE_STYLE::DASHDOTDOT: return "LT 7 8 1;";
default: return "LT;";
}
}

View File

@ -183,29 +183,29 @@ void PDF_PLOTTER::emitSetRGBColor( double r, double g, double b, double a )
}
void PDF_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle )
void PDF_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
{
wxASSERT( m_workFile );
switch( aLineStyle )
{
case PLOT_DASH_TYPE::DASH:
case LINE_STYLE::DASH:
fprintf( m_workFile, "[%d %d] 0 d\n",
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DOT:
case LINE_STYLE::DOT:
fprintf( m_workFile, "[%d %d] 0 d\n",
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOT:
case LINE_STYLE::DASHDOT:
fprintf( m_workFile, "[%d %d %d %d] 0 d\n",
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOTDOT:
case LINE_STYLE::DASHDOTDOT:
fprintf( m_workFile, "[%d %d %d %d %d %d] 0 d\n",
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),

View File

@ -461,27 +461,27 @@ void PS_PLOTTER::emitSetRGBColor( double r, double g, double b, double a )
}
void PS_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle )
void PS_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
{
switch( aLineStyle )
{
case PLOT_DASH_TYPE::DASH:
case LINE_STYLE::DASH:
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DOT:
case LINE_STYLE::DOT:
fprintf( m_outputFile, "[%d %d] 0 setdash\n",
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOT:
case LINE_STYLE::DASHDOT:
fprintf( m_outputFile, "[%d %d %d %d] 0 setdash\n",
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOTDOT:
case LINE_STYLE::DASHDOTDOT:
fprintf( m_outputFile, "[%d %d %d %d %d %d] 0 setdash\n",
(int) GetDashMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),
(int) GetDotMarkLenIU( aLineWidth ), (int) GetDashGapLenIU( aLineWidth ),

View File

@ -170,7 +170,7 @@ SVG_PLOTTER::SVG_PLOTTER()
m_pen_rgb_color = 0; // current color value (black)
m_brush_rgb_color = 0; // current color value (black)
m_brush_alpha = 1.0;
m_dashed = PLOT_DASH_TYPE::SOLID;
m_dashed = LINE_STYLE::SOLID;
m_precision = 4; // default: 4 digits in mantissa.
}
@ -262,31 +262,31 @@ void SVG_PLOTTER::setSVGPlotStyle( int aLineWidth, bool aIsGroup, const std::str
//set any extra attributes for non-solid lines
switch( m_dashed )
{
case PLOT_DASH_TYPE::DASH:
case LINE_STYLE::DASH:
fprintf( m_outputFile, "stroke-dasharray:%.*f,%.*f;", m_precision,
GetDashMarkLenIU( aLineWidth ), m_precision, GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DOT:
case LINE_STYLE::DOT:
fprintf( m_outputFile, "stroke-dasharray:%f,%f;", GetDotMarkLenIU( aLineWidth ),
GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOT:
case LINE_STYLE::DASHDOT:
fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f;", GetDashMarkLenIU( aLineWidth ),
GetDashGapLenIU( aLineWidth ), GetDotMarkLenIU( aLineWidth ),
GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DASHDOTDOT:
case LINE_STYLE::DASHDOTDOT:
fprintf( m_outputFile, "stroke-dasharray:%f,%f,%f,%f,%f,%f;",
GetDashMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ),
GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ),
GetDotMarkLenIU( aLineWidth ), GetDashGapLenIU( aLineWidth ) );
break;
case PLOT_DASH_TYPE::DEFAULT:
case PLOT_DASH_TYPE::SOLID:
case LINE_STYLE::DEFAULT:
case LINE_STYLE::SOLID:
default:
//do nothing
break;
@ -359,7 +359,7 @@ void SVG_PLOTTER::emitSetRGBColor( double r, double g, double b, double a )
}
void SVG_PLOTTER::SetDash( int aLineWidth, PLOT_DASH_TYPE aLineStyle )
void SVG_PLOTTER::SetDash( int aLineWidth, LINE_STYLE aLineStyle )
{
if( m_dashed != aLineStyle )
{

View File

@ -32,16 +32,16 @@
using namespace STROKEPARAMS_T;
const std::map<PLOT_DASH_TYPE, struct lineTypeStruct> lineTypeNames = {
{ PLOT_DASH_TYPE::SOLID, { _( "Solid" ), BITMAPS::stroke_solid } },
{ PLOT_DASH_TYPE::DASH, { _( "Dashed" ), BITMAPS::stroke_dash } },
{ PLOT_DASH_TYPE::DOT, { _( "Dotted" ), BITMAPS::stroke_dot } },
{ PLOT_DASH_TYPE::DASHDOT, { _( "Dash-Dot" ), BITMAPS::stroke_dashdot } },
{ PLOT_DASH_TYPE::DASHDOTDOT, { _( "Dash-Dot-Dot" ), BITMAPS::stroke_dashdotdot } }
const std::map<LINE_STYLE, struct LINE_STYLE_DESC> lineTypeNames = {
{ LINE_STYLE::SOLID, { _( "Solid" ), BITMAPS::stroke_solid } },
{ LINE_STYLE::DASH, { _( "Dashed" ), BITMAPS::stroke_dash } },
{ LINE_STYLE::DOT, { _( "Dotted" ), BITMAPS::stroke_dot } },
{ LINE_STYLE::DASHDOT, { _( "Dash-Dot" ), BITMAPS::stroke_dashdot } },
{ LINE_STYLE::DASHDOTDOT, { _( "Dash-Dot-Dot" ), BITMAPS::stroke_dashdotdot } }
};
void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int aWidth,
void STROKE_PARAMS::Stroke( const SHAPE* aShape, LINE_STYLE aLineStyle, int aWidth,
const KIGFX::RENDER_SETTINGS* aRenderSettings,
std::function<void( const VECTOR2I& a, const VECTOR2I& b )> aStroker )
{
@ -51,24 +51,24 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
switch( aLineStyle )
{
case PLOT_DASH_TYPE::DASH:
case LINE_STYLE::DASH:
strokes[0] = aRenderSettings->GetDashLength( aWidth );
strokes[1] = aRenderSettings->GetGapLength( aWidth );
wrapAround = 2;
break;
case PLOT_DASH_TYPE::DOT:
case LINE_STYLE::DOT:
strokes[0] = aRenderSettings->GetDotLength( aWidth );
strokes[1] = aRenderSettings->GetGapLength( aWidth );
wrapAround = 2;
break;
case PLOT_DASH_TYPE::DASHDOT:
case LINE_STYLE::DASHDOT:
strokes[0] = aRenderSettings->GetDashLength( aWidth );
strokes[1] = aRenderSettings->GetGapLength( aWidth );
strokes[2] = aRenderSettings->GetDotLength( aWidth );
strokes[3] = aRenderSettings->GetGapLength( aWidth );
wrapAround = 4;
break;
case PLOT_DASH_TYPE::DASHDOTDOT:
case LINE_STYLE::DASHDOTDOT:
strokes[0] = aRenderSettings->GetDashLength( aWidth );
strokes[1] = aRenderSettings->GetGapLength( aWidth );
strokes[2] = aRenderSettings->GetDotLength( aWidth );
@ -181,18 +181,18 @@ void STROKE_PARAMS::Stroke( const SHAPE* aShape, PLOT_DASH_TYPE aLineStyle, int
}
wxString STROKE_PARAMS::GetLineStyleToken( PLOT_DASH_TYPE aStyle )
wxString STROKE_PARAMS::GetLineStyleToken( LINE_STYLE aStyle )
{
wxString token;
switch( aStyle )
{
case PLOT_DASH_TYPE::DASH: token = wxT( "dash" ); break;
case PLOT_DASH_TYPE::DOT: token = wxT( "dot" ); break;
case PLOT_DASH_TYPE::DASHDOT: token = wxT( "dash_dot" ); break;
case PLOT_DASH_TYPE::DASHDOTDOT: token = wxT( "dash_dot_dot" ); break;
case PLOT_DASH_TYPE::SOLID: token = wxT( "solid" ); break;
case PLOT_DASH_TYPE::DEFAULT: token = wxT( "default" ); break;
case LINE_STYLE::DASH: token = wxT( "dash" ); break;
case LINE_STYLE::DOT: token = wxT( "dot" ); break;
case LINE_STYLE::DASHDOT: token = wxT( "dash_dot" ); break;
case LINE_STYLE::DASHDOTDOT: token = wxT( "dash_dot_dot" ); break;
case LINE_STYLE::SOLID: token = wxT( "solid" ); break;
case LINE_STYLE::DEFAULT: token = wxT( "default" ); break;
}
return token;
@ -207,9 +207,9 @@ void STROKE_PARAMS::GetMsgPanelInfo( UNITS_PROVIDER* aUnitsProvider,
{
wxString lineStyle = _( "Default" );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
for( const std::pair<const LINE_STYLE, LINE_STYLE_DESC>& typeEntry : lineTypeNames )
{
if( typeEntry.first == GetPlotStyle() )
if( typeEntry.first == GetLineStyle() )
{
lineStyle = typeEntry.second.name;
break;
@ -233,13 +233,13 @@ void STROKE_PARAMS::Format( OUTPUTFORMATTER* aFormatter, const EDA_IU_SCALE& aIu
{
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s))",
EDA_UNIT_UTILS::FormatInternalUnits( aIuScale, GetWidth() ).c_str(),
TO_UTF8( GetLineStyleToken( GetPlotStyle() ) ) );
TO_UTF8( GetLineStyleToken( GetLineStyle() ) ) );
}
else
{
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s) (color %d %d %d %s))",
EDA_UNIT_UTILS::FormatInternalUnits( aIuScale, GetWidth() ).c_str(),
TO_UTF8( GetLineStyleToken( GetPlotStyle() ) ),
TO_UTF8( GetLineStyleToken( GetLineStyle() ) ),
KiROUND( GetColor().r * 255.0 ),
KiROUND( GetColor().g * 255.0 ),
KiROUND( GetColor().b * 255.0 ),
@ -270,12 +270,12 @@ void STROKE_PARAMS_PARSER::ParseStroke( STROKE_PARAMS& aStroke )
switch( token )
{
case T_dash: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DASH ); break;
case T_dot: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DOT ); break;
case T_dash_dot: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DASHDOT ); break;
case T_dash_dot_dot: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DASHDOTDOT ); break;
case T_solid: aStroke.SetPlotStyle( PLOT_DASH_TYPE::SOLID ); break;
case T_default: aStroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT ); break;
case T_dash: aStroke.SetLineStyle( LINE_STYLE::DASH ); break;
case T_dot: aStroke.SetLineStyle( LINE_STYLE::DOT ); break;
case T_dash_dot: aStroke.SetLineStyle( LINE_STYLE::DASHDOT ); break;
case T_dash_dot_dot: aStroke.SetLineStyle( LINE_STYLE::DASHDOTDOT ); break;
case T_solid: aStroke.SetLineStyle( LINE_STYLE::SOLID ); break;
case T_default: aStroke.SetLineStyle( LINE_STYLE::DEFAULT ); break;
default:
Expecting( "solid, dash, dash_dot, dash_dot_dot, dot or default" );
}

View File

@ -336,9 +336,9 @@ void DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::processItem( SCH_COMMIT* aCommit,
if( m_lineStyle->GetStringSelection() != INDETERMINATE_ACTION )
{
if( m_lineStyle->GetStringSelection() == DEFAULT_STYLE )
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetPlotStyle( (PLOT_DASH_TYPE) m_lineStyle->GetSelection() );
stroke.SetLineStyle( (LINE_STYLE) m_lineStyle->GetSelection() );
}
if( m_setColor->GetValue() )

View File

@ -50,8 +50,8 @@ DIALOG_LIB_SHAPE_PROPERTIES::DIALOG_LIB_SHAPE_PROPERTIES( SYMBOL_EDIT_FRAME* aPa
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_borderStyleCombo->Append( DEFAULT_STYLE );
@ -113,7 +113,7 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow()
m_borderColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false );
int style = static_cast<int>( m_shape->GetStroke().GetPlotStyle() );
int style = static_cast<int>( m_shape->GetStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
@ -260,9 +260,9 @@ bool DIALOG_LIB_SHAPE_PROPERTIES::TransferDataFromWindow()
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetPlotStyle( it->first );
stroke.SetLineStyle( it->first );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );

View File

@ -54,8 +54,8 @@ DIALOG_LIB_TEXTBOX_PROPERTIES::DIALOG_LIB_TEXTBOX_PROPERTIES( SYMBOL_EDIT_FRAME*
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_borderStyleCombo->Append( DEFAULT_STYLE );
@ -197,7 +197,7 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataToWindow()
m_borderColorSwatch->SetSwatchColor( m_currentText->GetStroke().GetColor(), false );
int style = static_cast<int>( m_currentText->GetStroke().GetPlotStyle() );
int style = static_cast<int>( m_currentText->GetStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
@ -326,9 +326,9 @@ bool DIALOG_LIB_TEXTBOX_PROPERTIES::TransferDataFromWindow()
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetPlotStyle( it->first );
stroke.SetLineStyle( it->first );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );

View File

@ -49,8 +49,8 @@ DIALOG_LINE_PROPERTIES::DIALOG_LINE_PROPERTIES( SCH_EDIT_FRAME* aParent,
SetInitialFocus( m_lineWidth );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_typeCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_typeCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_typeCombo->Append( DEFAULT_STYLE );
@ -94,10 +94,10 @@ bool DIALOG_LINE_PROPERTIES::TransferDataToWindow()
if( std::all_of( m_lines.begin() + 1, m_lines.end(),
[&]( const SCH_LINE* r )
{
return r->GetStroke().GetPlotStyle() == first_stroke_item->GetStroke().GetPlotStyle();
return r->GetStroke().GetLineStyle() == first_stroke_item->GetStroke().GetLineStyle();
} ) )
{
int style = static_cast<int>( first_stroke_item->GetStroke().GetPlotStyle() );
int style = static_cast<int>( first_stroke_item->GetStroke().GetLineStyle() );
if( style == -1 )
m_typeCombo->SetStringSelection( DEFAULT_STYLE );
@ -142,7 +142,7 @@ bool DIALOG_LINE_PROPERTIES::TransferDataFromWindow()
std::advance( it, m_typeCombo->GetSelection() );
if( it == lineTypeNames.end() )
line->SetLineStyle( PLOT_DASH_TYPE::DEFAULT );
line->SetLineStyle( LINE_STYLE::DEFAULT );
else
line->SetLineStyle( it->first );

View File

@ -45,8 +45,8 @@ DIALOG_SHAPE_PROPERTIES::DIALOG_SHAPE_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_S
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_borderStyleCombo->Append( DEFAULT_STYLE );
@ -92,7 +92,7 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataToWindow()
m_borderColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false );
int style = static_cast<int>( m_shape->GetStroke().GetPlotStyle() );
int style = static_cast<int>( m_shape->GetStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
@ -153,9 +153,9 @@ bool DIALOG_SHAPE_PROPERTIES::TransferDataFromWindow()
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetPlotStyle( it->first );
stroke.SetLineStyle( it->first );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );

View File

@ -59,8 +59,8 @@ DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( SCH_EDIT_FRAME* aParent, SCH_ITE
m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
m_borderColorSwatch->SetSwatchBackground( schematicBackground );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_borderStyleCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_borderStyleCombo->Append( DEFAULT_STYLE );
@ -287,7 +287,7 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataToWindow()
m_borderColorSwatch->SetSwatchColor( textBox->GetStroke().GetColor(), false );
int style = static_cast<int>( textBox->GetStroke().GetPlotStyle() );
int style = static_cast<int>( textBox->GetStroke().GetLineStyle() );
if( style == -1 )
m_borderStyleCombo->SetStringSelection( DEFAULT_STYLE );
@ -520,9 +520,9 @@ bool DIALOG_TEXT_PROPERTIES::TransferDataFromWindow()
std::advance( it, m_borderStyleCombo->GetSelection() );
if( it == lineTypeNames.end() )
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
stroke.SetLineStyle( LINE_STYLE::DEFAULT );
else
stroke.SetPlotStyle( it->first );
stroke.SetLineStyle( it->first );
stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );

View File

@ -52,8 +52,8 @@ DIALOG_WIRE_BUS_PROPERTIES::DIALOG_WIRE_BUS_PROPERTIES( SCH_EDIT_FRAME* aParent,
SetInitialFocus( m_lineWidth );
for( const std::pair<const PLOT_DASH_TYPE, lineTypeStruct>& typeEntry : lineTypeNames )
m_typeCombo->Append( typeEntry.second.name, KiBitmap( typeEntry.second.bitmap ) );
for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
m_typeCombo->Append( lineStyleDesc.name, KiBitmap( lineStyleDesc.bitmap ) );
m_typeCombo->Append( DEFAULT_STYLE );
@ -119,10 +119,10 @@ bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataToWindow()
[&]( const SCH_ITEM* item )
{
return !item->HasLineStroke()
|| item->GetStroke().GetPlotStyle() == stroke.GetPlotStyle();
|| item->GetStroke().GetLineStyle() == stroke.GetLineStyle();
} ) )
{
int style = static_cast<int>( stroke.GetPlotStyle() );
int style = static_cast<int>( stroke.GetLineStyle() );
if( style == -1 )
m_typeCombo->SetStringSelection( DEFAULT_STYLE );
@ -195,7 +195,7 @@ bool DIALOG_WIRE_BUS_PROPERTIES::TransferDataFromWindow()
if( m_typeCombo->GetStringSelection() != INDETERMINATE_STYLE )
{
PLOT_DASH_TYPE lineStyle = PLOT_DASH_TYPE::DEFAULT;
LINE_STYLE lineStyle = LINE_STYLE::DEFAULT;
size_t lineTypeSelection = m_typeCombo->GetSelection();
auto it = lineTypeNames.begin();

View File

@ -291,7 +291,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
if( line.first != LAYER_NOTES )
{
stroke.SetPlotStyle( PLOT_DASH_TYPE::SOLID );
stroke.SetLineStyle( LINE_STYLE::SOLID );
if( line.first == LAYER_BUS )
stroke.SetWidth( schIUScale.MilsToIU( 12 ) );
@ -379,7 +379,7 @@ void PANEL_EESCHEMA_COLOR_SETTINGS::createPreviewItems()
comp_body->SetUnit( 0 );
comp_body->SetConvert( 0 );
comp_body->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), PLOT_DASH_TYPE::SOLID ) );
comp_body->SetStroke( STROKE_PARAMS( schIUScale.MilsToIU( 10 ), LINE_STYLE::SOLID ) );
comp_body->SetFillMode( FILL_T::FILLED_WITH_BG_BODYCOLOR );
comp_body->AddPoint( MILS_POINT( p.x - 200, p.y + 200 ) );
comp_body->AddPoint( MILS_POINT( p.x + 200, p.y ) );

View File

@ -158,10 +158,10 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
cornerList.push_back( aTransform.TransformCoordinate( pt ) + aOffset );
}
int penWidth;
COLOR4D color = GetStroke().GetColor();
PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
FILL_T fill = m_fill;
int penWidth;
COLOR4D color = GetStroke().GetColor();
LINE_STYLE lineStyle = GetStroke().GetLineStyle();
FILL_T fill = m_fill;
if( aBackground )
{
@ -186,15 +186,15 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
}
penWidth = 0;
lineStyle = PLOT_DASH_TYPE::SOLID;
lineStyle = LINE_STYLE::SOLID;
}
else
{
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = aPlotter->RenderSettings()->GetLayerColor( LAYER_DEVICE );
if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
lineStyle = PLOT_DASH_TYPE::SOLID;
if( lineStyle == LINE_STYLE::DEFAULT )
lineStyle = LINE_STYLE::SOLID;
if( m_fill == FILL_T::FILLED_SHAPE )
fill = m_fill;
@ -249,7 +249,7 @@ void LIB_SHAPE::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOffs
UNIMPLEMENTED_FOR( SHAPE_T_asString() );
}
aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
}
@ -383,7 +383,7 @@ void LIB_SHAPE::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffset
if( penWidth > 0 )
{
if( GetEffectiveLineStyle() == PLOT_DASH_TYPE::SOLID )
if( GetEffectiveLineStyle() == LINE_STYLE::SOLID )
{
switch( GetShape() )
{

View File

@ -62,12 +62,12 @@ public:
int GetPenWidth() const override;
PLOT_DASH_TYPE GetEffectiveLineStyle() const
LINE_STYLE GetEffectiveLineStyle() const
{
if( m_stroke.GetPlotStyle() == PLOT_DASH_TYPE::DEFAULT )
return PLOT_DASH_TYPE::SOLID;
if( m_stroke.GetLineStyle() == LINE_STYLE::DEFAULT )
return LINE_STYLE::SOLID;
else
return m_stroke.GetPlotStyle();
return m_stroke.GetLineStyle();
}
const BOX2I GetBoundingBox() const override;

View File

@ -228,11 +228,11 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
if( IsPrivate() )
return;
bool forceNoFill = static_cast<bool>( aData );
bool blackAndWhiteMode = GetGRForceBlackPenState();
int penWidth = GetEffectivePenWidth( aSettings );
COLOR4D color = GetStroke().GetColor();
PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
bool forceNoFill = static_cast<bool>( aData );
bool blackAndWhiteMode = GetGRForceBlackPenState();
int penWidth = GetEffectivePenWidth( aSettings );
COLOR4D color = GetStroke().GetColor();
LINE_STYLE lineStyle = GetStroke().GetLineStyle();
wxDC* DC = aSettings->GetPrintDC();
VECTOR2I pt1 = aTransform.TransformCoordinate( m_start ) + aOffset;
@ -259,10 +259,10 @@ void LIB_TEXTBOX::print( const RENDER_SETTINGS* aSettings, const VECTOR2I& aOffs
color = color.Mix( bg, 0.5f );
}
if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
lineStyle = PLOT_DASH_TYPE::SOLID;
if( lineStyle == LINE_STYLE::DEFAULT )
lineStyle = LINE_STYLE::SOLID;
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
{
GRRect( DC, pt1, pt2, penWidth, color );
}
@ -405,17 +405,17 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
if( bg == COLOR4D::UNSPECIFIED || !aPlotter->GetColorMode() )
bg = COLOR4D::WHITE;
int penWidth = GetEffectivePenWidth( renderSettings );
COLOR4D color = GetStroke().GetColor();
PLOT_DASH_TYPE lineStyle = GetStroke().GetPlotStyle();
int penWidth = GetEffectivePenWidth( renderSettings );
COLOR4D color = GetStroke().GetColor();
LINE_STYLE lineStyle = GetStroke().GetLineStyle();
if( penWidth > 0 )
{
if( !aPlotter->GetColorMode() || color == COLOR4D::UNSPECIFIED )
color = renderSettings->GetLayerColor( LAYER_DEVICE );
if( lineStyle == PLOT_DASH_TYPE::DEFAULT )
lineStyle = PLOT_DASH_TYPE::DASH;
if( lineStyle == LINE_STYLE::DEFAULT )
lineStyle = LINE_STYLE::DASH;
if( aDimmed )
{
@ -426,7 +426,7 @@ void LIB_TEXTBOX::Plot( PLOTTER* aPlotter, bool aBackground, const VECTOR2I& aOf
aPlotter->SetColor( color );
aPlotter->SetDash( penWidth, lineStyle );
aPlotter->Rect( start, end, FILL_T::NO_FILL, penWidth );
aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
}
KIFONT::FONT* font = GetFont();

View File

@ -52,7 +52,7 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool
m_size.y = schIUScale.MilsToIU( DEFAULT_SCH_ENTRY_SIZE );
m_stroke.SetWidth( 0 );
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
m_stroke.SetLineStyle( LINE_STYLE::DEFAULT );
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
if( aFlipY )
@ -61,7 +61,7 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const VECTOR2I& pos, bool
m_isDanglingStart = m_isDanglingEnd = true;
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedLineStyle = LINE_STYLE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -73,7 +73,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, bool aFlipY ) :
m_connected_bus_item = nullptr;
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedLineStyle = LINE_STYLE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -94,7 +94,7 @@ SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const VECTOR2I& pos, int aQuadrant ) :
m_connected_bus_item = nullptr;
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedLineStyle = LINE_STYLE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -107,7 +107,7 @@ SCH_BUS_BUS_ENTRY::SCH_BUS_BUS_ENTRY( const VECTOR2I& pos, bool aFlipY ) :
m_connected_bus_items[1] = nullptr;
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_WIRE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedLineStyle = LINE_STYLE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -205,20 +205,20 @@ void SCH_BUS_ENTRY_BASE::SetBusEntryColor( const COLOR4D& aColor )
}
PLOT_DASH_TYPE SCH_BUS_ENTRY_BASE::GetLineStyle() const
LINE_STYLE SCH_BUS_ENTRY_BASE::GetLineStyle() const
{
if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
m_lastResolvedLineStyle = m_stroke.GetPlotStyle();
if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
m_lastResolvedLineStyle = m_stroke.GetLineStyle();
else if( IsConnectable() && !IsConnectivityDirty() )
m_lastResolvedLineStyle = (PLOT_DASH_TYPE) GetEffectiveNetClass()->GetLineStyle();
m_lastResolvedLineStyle = (LINE_STYLE) GetEffectiveNetClass()->GetLineStyle();
return m_lastResolvedLineStyle;
}
void SCH_BUS_ENTRY_BASE::SetLineStyle( PLOT_DASH_TYPE aStyle )
void SCH_BUS_ENTRY_BASE::SetLineStyle( LINE_STYLE aStyle )
{
m_stroke.SetPlotStyle( aStyle );
m_stroke.SetLineStyle( aStyle );
m_lastResolvedLineStyle = aStyle;
}
@ -274,7 +274,7 @@ void SCH_BUS_ENTRY_BASE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I
VECTOR2I end = GetEnd() + aOffset;
int penWidth = ( GetPenWidth() == 0 ) ? aSettings->GetDefaultPenWidth() : GetPenWidth();
if( GetLineStyle() <= PLOT_DASH_TYPE::FIRST_TYPE )
if( GetLineStyle() <= LINE_STYLE::FIRST_TYPE )
{
GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
}
@ -490,7 +490,7 @@ void SCH_BUS_ENTRY_BASE::Plot( PLOTTER* aPlotter, bool aBackground,
aPlotter->MoveTo( m_pos );
aPlotter->FinishTo( GetEnd() );
aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
}
@ -630,23 +630,23 @@ static struct SCH_BUS_ENTRY_DESC
propMgr.InheritsAfter( TYPE_HASH( SCH_BUS_WIRE_ENTRY ), TYPE_HASH( SCH_BUS_ENTRY_BASE ) );
propMgr.InheritsAfter( TYPE_HASH( SCH_BUS_BUS_ENTRY ), TYPE_HASH( SCH_BUS_ENTRY_BASE ) );
ENUM_MAP<PLOT_DASH_TYPE>& plotDashTypeEnum = ENUM_MAP<PLOT_DASH_TYPE>::Instance();
ENUM_MAP<LINE_STYLE>& plotDashTypeEnum = ENUM_MAP<LINE_STYLE>::Instance();
if( plotDashTypeEnum.Choices().GetCount() == 0 )
{
plotDashTypeEnum.Map( PLOT_DASH_TYPE::DEFAULT, _HKI( "Default" ) )
.Map( PLOT_DASH_TYPE::SOLID, _HKI( "Solid" ) )
.Map( PLOT_DASH_TYPE::DASH, _HKI( "Dashed" ) )
.Map( PLOT_DASH_TYPE::DOT, _HKI( "Dotted" ) )
.Map( PLOT_DASH_TYPE::DASHDOT, _HKI( "Dash-Dot" ) )
.Map( PLOT_DASH_TYPE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
plotDashTypeEnum.Map( LINE_STYLE::DEFAULT, _HKI( "Default" ) )
.Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
.Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
.Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
.Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
.Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
}
// TODO: Maybe SCH_BUS_ENTRY_BASE should inherit from or mix in with SCH_LINE
void ( SCH_BUS_ENTRY_BASE::*lineStyleSetter )( PLOT_DASH_TYPE ) =
void ( SCH_BUS_ENTRY_BASE::*lineStyleSetter )( LINE_STYLE ) =
&SCH_BUS_ENTRY_BASE::SetLineStyle;
propMgr.AddProperty( new PROPERTY_ENUM<SCH_BUS_ENTRY_BASE, PLOT_DASH_TYPE>(
propMgr.AddProperty( new PROPERTY_ENUM<SCH_BUS_ENTRY_BASE, LINE_STYLE>(
_HKI( "Line Style" ),
lineStyleSetter, &SCH_BUS_ENTRY_BASE::GetLineStyle ) );

View File

@ -81,8 +81,8 @@ public:
virtual STROKE_PARAMS GetStroke() const override { return m_stroke; }
virtual void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; }
PLOT_DASH_TYPE GetLineStyle() const;
void SetLineStyle( PLOT_DASH_TYPE aStyle );
LINE_STYLE GetLineStyle() const;
void SetLineStyle( LINE_STYLE aStyle );
COLOR4D GetBusEntryColor() const;
void SetBusEntryColor( const COLOR4D& aColor );
@ -150,9 +150,9 @@ protected:
// If real-time connectivity gets disabled (due to being too slow on a particular
// design), we can no longer rely on getting the NetClass to find netclass-specific
// linestyles, linewidths and colors.
mutable PLOT_DASH_TYPE m_lastResolvedLineStyle;
mutable int m_lastResolvedWidth;
mutable COLOR4D m_lastResolvedColor;
mutable LINE_STYLE m_lastResolvedLineStyle;
mutable int m_lastResolvedWidth;
mutable COLOR4D m_lastResolvedColor;
};
/**

View File

@ -46,7 +46,7 @@ SCH_LINE::SCH_LINE( const VECTOR2I& pos, int layer ) :
m_start = pos;
m_end = pos;
m_stroke.SetWidth( 0 );
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
m_stroke.SetLineStyle( LINE_STYLE::DEFAULT );
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
switch( layer )
@ -68,7 +68,7 @@ SCH_LINE::SCH_LINE( const VECTOR2I& pos, int layer ) :
else
m_lastResolvedWidth = schIUScale.MilsToIU( DEFAULT_LINE_WIDTH_MILS );
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedLineStyle = LINE_STYLE::SOLID;
m_lastResolvedColor = COLOR4D::UNSPECIFIED;
}
@ -279,34 +279,34 @@ COLOR4D SCH_LINE::GetLineColor() const
void SCH_LINE::SetLineStyle( const int aStyleId )
{
SetLineStyle( static_cast<PLOT_DASH_TYPE>( aStyleId ) );
SetLineStyle( static_cast<LINE_STYLE>( aStyleId ) );
}
void SCH_LINE::SetLineStyle( const PLOT_DASH_TYPE aStyle )
void SCH_LINE::SetLineStyle( const LINE_STYLE aStyle )
{
m_stroke.SetPlotStyle( aStyle );
m_stroke.SetLineStyle( aStyle );
m_lastResolvedLineStyle = GetLineStyle();
}
PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
LINE_STYLE SCH_LINE::GetLineStyle() const
{
if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
return m_stroke.GetPlotStyle();
if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
return m_stroke.GetLineStyle();
return PLOT_DASH_TYPE::SOLID;
return LINE_STYLE::SOLID;
}
PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle() const
LINE_STYLE SCH_LINE::GetEffectiveLineStyle() const
{
if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
m_lastResolvedLineStyle = m_stroke.GetPlotStyle();
if( m_stroke.GetLineStyle() != LINE_STYLE::DEFAULT )
m_lastResolvedLineStyle = m_stroke.GetLineStyle();
else if( !IsConnectable() )
m_lastResolvedLineStyle = PLOT_DASH_TYPE::SOLID;
m_lastResolvedLineStyle = LINE_STYLE::SOLID;
else if( !IsConnectivityDirty() )
m_lastResolvedLineStyle = (PLOT_DASH_TYPE) GetEffectiveNetClass()->GetLineStyle();
m_lastResolvedLineStyle = (LINE_STYLE) GetEffectiveNetClass()->GetLineStyle();
return m_lastResolvedLineStyle;
}
@ -361,12 +361,12 @@ void SCH_LINE::Print( const RENDER_SETTINGS* aSettings, const VECTOR2I& offset )
if( color == COLOR4D::UNSPECIFIED )
color = aSettings->GetLayerColor( GetLayer() );
VECTOR2I start = m_start;
VECTOR2I end = m_end;
PLOT_DASH_TYPE lineStyle = GetEffectiveLineStyle();
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
VECTOR2I start = m_start;
VECTOR2I end = m_end;
LINE_STYLE lineStyle = GetEffectiveLineStyle();
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
if( lineStyle <= PLOT_DASH_TYPE::FIRST_TYPE )
if( lineStyle <= LINE_STYLE::FIRST_TYPE )
{
GRLine( DC, start.x, start.y, end.x, end.y, penWidth, color );
}
@ -881,7 +881,7 @@ void SCH_LINE::Plot( PLOTTER* aPlotter, bool aBackground,
aPlotter->MoveTo( m_start );
aPlotter->FinishTo( m_end );
aPlotter->SetDash( penWidth, PLOT_DASH_TYPE::SOLID );
aPlotter->SetDash( penWidth, LINE_STYLE::SOLID );
// Plot attributes to a hypertext menu
std::vector<wxString> properties;
@ -939,7 +939,7 @@ void SCH_LINE::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_IT
aList.emplace_back( _( "Line Type" ), msg );
PLOT_DASH_TYPE lineStyle = GetLineStyle();
LINE_STYLE lineStyle = GetLineStyle();
if( GetEffectiveLineStyle() != lineStyle )
aList.emplace_back( _( "Line Style" ), _( "from netclass" ) );
@ -1004,7 +1004,7 @@ bool SCH_LINE::operator==( const SCH_ITEM& aOther ) const
if( m_stroke.GetColor() != other.m_stroke.GetColor() )
return false;
if( m_stroke.GetPlotStyle() != other.m_stroke.GetPlotStyle() )
if( m_stroke.GetLineStyle() != other.m_stroke.GetLineStyle() )
return false;
return true;
@ -1038,7 +1038,7 @@ double SCH_LINE::Similarity( const SCH_ITEM& aOther ) const
if( m_stroke.GetColor() != other.m_stroke.GetColor() )
similarity *= 0.9;
if( m_stroke.GetPlotStyle() != other.m_stroke.GetPlotStyle() )
if( m_stroke.GetLineStyle() != other.m_stroke.GetLineStyle() )
similarity *= 0.9;
return similarity;
@ -1049,25 +1049,25 @@ static struct SCH_LINE_DESC
{
SCH_LINE_DESC()
{
ENUM_MAP<PLOT_DASH_TYPE>& plotDashTypeEnum = ENUM_MAP<PLOT_DASH_TYPE>::Instance();
ENUM_MAP<LINE_STYLE>& plotDashTypeEnum = ENUM_MAP<LINE_STYLE>::Instance();
if( plotDashTypeEnum.Choices().GetCount() == 0 )
{
plotDashTypeEnum.Map( PLOT_DASH_TYPE::DEFAULT, _HKI( "Default" ) )
.Map( PLOT_DASH_TYPE::SOLID, _HKI( "Solid" ) )
.Map( PLOT_DASH_TYPE::DASH, _HKI( "Dashed" ) )
.Map( PLOT_DASH_TYPE::DOT, _HKI( "Dotted" ) )
.Map( PLOT_DASH_TYPE::DASHDOT, _HKI( "Dash-Dot" ) )
.Map( PLOT_DASH_TYPE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
plotDashTypeEnum.Map( LINE_STYLE::DEFAULT, _HKI( "Default" ) )
.Map( LINE_STYLE::SOLID, _HKI( "Solid" ) )
.Map( LINE_STYLE::DASH, _HKI( "Dashed" ) )
.Map( LINE_STYLE::DOT, _HKI( "Dotted" ) )
.Map( LINE_STYLE::DASHDOT, _HKI( "Dash-Dot" ) )
.Map( LINE_STYLE::DASHDOTDOT, _HKI( "Dash-Dot-Dot" ) );
}
PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance();
REGISTER_TYPE( SCH_LINE );
propMgr.InheritsAfter( TYPE_HASH( SCH_LINE ), TYPE_HASH( SCH_ITEM ) );
void ( SCH_LINE::*lineStyleSetter )( PLOT_DASH_TYPE ) = &SCH_LINE::SetLineStyle;
void ( SCH_LINE::*lineStyleSetter )( LINE_STYLE ) = &SCH_LINE::SetLineStyle;
propMgr.AddProperty( new PROPERTY_ENUM<SCH_LINE, PLOT_DASH_TYPE>( _HKI( "Line Style" ),
propMgr.AddProperty( new PROPERTY_ENUM<SCH_LINE, LINE_STYLE>( _HKI( "Line Style" ),
lineStyleSetter, &SCH_LINE::GetLineStyle ) );
propMgr.AddProperty( new PROPERTY<SCH_LINE, int>( _HKI( "Line Width" ),

View File

@ -158,13 +158,13 @@ public:
}
}
void SetLineStyle( const PLOT_DASH_TYPE aStyle );
void SetLineStyle( const int aStyleId );
PLOT_DASH_TYPE GetLineStyle() const;
void SetLineStyle( const LINE_STYLE aStyle );
void SetLineStyle( const int aStyleId );
LINE_STYLE GetLineStyle() const;
/// @return the style that the line should be drawn in
/// this might be set on the line or inherited from the line's netclass
PLOT_DASH_TYPE GetEffectiveLineStyle() const;
LINE_STYLE GetEffectiveLineStyle() const;
void SetLineColor( const COLOR4D& aColor );
@ -188,12 +188,12 @@ public:
if( m_stroke.GetColor() != aLine->GetStroke().GetColor() )
return false;
PLOT_DASH_TYPE style_a = m_stroke.GetPlotStyle();
PLOT_DASH_TYPE style_b = aLine->GetStroke().GetPlotStyle();
LINE_STYLE style_a = m_stroke.GetLineStyle();
LINE_STYLE style_b = aLine->GetStroke().GetLineStyle();
return style_a == style_b
|| ( style_a == PLOT_DASH_TYPE::DEFAULT && style_b == PLOT_DASH_TYPE::SOLID )
|| ( style_a == PLOT_DASH_TYPE::SOLID && style_b == PLOT_DASH_TYPE::DEFAULT );
|| ( style_a == LINE_STYLE::DEFAULT && style_b == LINE_STYLE::SOLID )
|| ( style_a == LINE_STYLE::SOLID && style_b == LINE_STYLE::DEFAULT );
}
void ViewGetLayers( int aLayers[], int& aCount ) const override;
@ -345,21 +345,22 @@ private:
const SCH_SHEET_PATH &aSheet ) const;
bool doIsConnected( const VECTOR2I& aPosition ) const override;
bool m_startIsDangling; ///< True if start point is not connected.
bool m_endIsDangling; ///< True if end point is not connected.
VECTOR2I m_start; ///< Line start point
VECTOR2I m_end; ///< Line end point
EDA_ANGLE m_storedAngle; ///< Stored angle
STROKE_PARAMS m_stroke; ///< Line stroke properties.
private:
bool m_startIsDangling; ///< True if start point is not connected.
bool m_endIsDangling; ///< True if end point is not connected.
VECTOR2I m_start; ///< Line start point
VECTOR2I m_end; ///< Line end point
EDA_ANGLE m_storedAngle; ///< Stored angle
STROKE_PARAMS m_stroke; ///< Line stroke properties.
// If real-time connectivity gets disabled (due to being too slow on a particular
// design), we can no longer rely on getting the NetClass to find netclass-specific
// linestyles, linewidths and colors.
mutable PLOT_DASH_TYPE m_lastResolvedLineStyle;
mutable int m_lastResolvedWidth;
mutable COLOR4D m_lastResolvedColor;
mutable LINE_STYLE m_lastResolvedLineStyle;
mutable int m_lastResolvedWidth;
mutable COLOR4D m_lastResolvedColor;
wxString m_operatingPoint;
wxString m_operatingPoint;
};

Some files were not shown because too many files have changed in this diff Show More