Better name for a plot style variable and accessors.
Accessors were previously GetType() and SetType(), but this is a bad name: These names are already widely used in code as accessors for a data type. We do not set a data type, but a style, so use a better name (GetPlotStyle/SetPlotStyle).
This commit is contained in:
parent
51ab639ce4
commit
a9619c051b
|
@ -112,10 +112,10 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataToWindow()
|
|||
if( std::all_of( m_strokeItems.begin() + 1, m_strokeItems.end(),
|
||||
[&]( const SCH_ITEM* r )
|
||||
{
|
||||
return r->GetStroke().GetType() == first_stroke_item->GetStroke().GetType();
|
||||
return r->GetStroke().GetPlotStyle() == first_stroke_item->GetStroke().GetPlotStyle();
|
||||
} ) )
|
||||
{
|
||||
int style = static_cast<int>( first_stroke_item->GetStroke().GetType() );
|
||||
int style = static_cast<int>( first_stroke_item->GetStroke().GetPlotStyle() );
|
||||
|
||||
if( style == -1 )
|
||||
m_typeCombo->SetStringSelection( DEFAULT_STYLE );
|
||||
|
@ -166,9 +166,9 @@ bool DIALOG_EDIT_LINE_STYLE::TransferDataFromWindow()
|
|||
std::advance( it, m_typeCombo->GetSelection() );
|
||||
|
||||
if( it == lineTypeNames.end() )
|
||||
stroke.SetType( PLOT_DASH_TYPE::DEFAULT );
|
||||
stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
stroke.SetType( it->first );
|
||||
stroke.SetPlotStyle( it->first );
|
||||
|
||||
stroke.SetColor( m_colorSwatch->GetSwatchColor() );
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ PLOT_DASH_TYPE SCH_BUS_ENTRY_BASE::GetStrokeStyle() const
|
|||
if( netclass )
|
||||
return (PLOT_DASH_TYPE) netclass->GetLineStyle();
|
||||
|
||||
return m_stroke.GetType();
|
||||
return m_stroke.GetPlotStyle();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ public:
|
|||
virtual void SetStroke( const STROKE_PARAMS& aStroke ) override { m_stroke = aStroke; }
|
||||
|
||||
PLOT_DASH_TYPE GetStrokeStyle() const;
|
||||
void SetStrokeStyle( PLOT_DASH_TYPE aStyle ) { m_stroke.SetType( aStyle ); }
|
||||
void SetStrokeStyle( PLOT_DASH_TYPE aStyle ) { m_stroke.SetPlotStyle( aStyle ); }
|
||||
|
||||
COLOR4D GetStrokeColor() const;
|
||||
void SetStrokeColor( const COLOR4D& aColor ) { m_stroke.SetColor( aColor ); }
|
||||
|
|
|
@ -153,15 +153,15 @@ typedef std::unordered_set<SCH_ITEM*> SCH_ITEM_SET;
|
|||
class STROKE_PARAMS
|
||||
{
|
||||
int m_width;
|
||||
PLOT_DASH_TYPE m_type;
|
||||
PLOT_DASH_TYPE m_plotstyle;
|
||||
COLOR4D m_color;
|
||||
|
||||
public:
|
||||
STROKE_PARAMS( int aWidth = Mils2iu( DEFAULT_LINE_THICKNESS ),
|
||||
PLOT_DASH_TYPE aType = PLOT_DASH_TYPE::DEFAULT,
|
||||
PLOT_DASH_TYPE aPlotStyle = PLOT_DASH_TYPE::DEFAULT,
|
||||
const COLOR4D& aColor = COLOR4D::UNSPECIFIED ) :
|
||||
m_width( aWidth ),
|
||||
m_type( aType ),
|
||||
m_plotstyle( aPlotStyle ),
|
||||
m_color( aColor )
|
||||
{
|
||||
}
|
||||
|
@ -169,8 +169,8 @@ public:
|
|||
int GetWidth() const { return m_width; }
|
||||
void SetWidth( int aWidth ) { m_width = aWidth; }
|
||||
|
||||
PLOT_DASH_TYPE GetType() const { return m_type; }
|
||||
void SetType( PLOT_DASH_TYPE aType ) { m_type = aType; }
|
||||
PLOT_DASH_TYPE GetPlotStyle() const { return m_plotstyle; }
|
||||
void SetPlotStyle( PLOT_DASH_TYPE aPlotStyle ) { m_plotstyle = aPlotStyle; }
|
||||
|
||||
COLOR4D GetColor() const { return m_color; }
|
||||
void SetColor( const COLOR4D& aColor ) { m_color = aColor; }
|
||||
|
@ -178,7 +178,7 @@ public:
|
|||
bool operator!=( const STROKE_PARAMS& aOther )
|
||||
{
|
||||
return m_width != aOther.m_width
|
||||
|| m_type != aOther.m_type
|
||||
|| m_plotstyle != aOther.m_plotstyle
|
||||
|| m_color != aOther.m_color;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
|||
m_end = pos;
|
||||
m_startIsDangling = m_endIsDangling = false;
|
||||
m_stroke.SetWidth( 0 );
|
||||
m_stroke.SetType( PLOT_DASH_TYPE::DEFAULT );
|
||||
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
switch( layer )
|
||||
|
@ -237,16 +237,16 @@ void SCH_LINE::SetLineStyle( const int aStyleId )
|
|||
void SCH_LINE::SetLineStyle( const PLOT_DASH_TYPE aStyle )
|
||||
{
|
||||
if( aStyle == GetDefaultStyle() )
|
||||
m_stroke.SetType( PLOT_DASH_TYPE::DEFAULT );
|
||||
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
m_stroke.SetType( aStyle );
|
||||
m_stroke.SetPlotStyle( aStyle );
|
||||
}
|
||||
|
||||
|
||||
PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
|
||||
{
|
||||
if( m_stroke.GetType() != PLOT_DASH_TYPE::DEFAULT )
|
||||
return m_stroke.GetType();
|
||||
if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
|
||||
return m_stroke.GetPlotStyle();
|
||||
|
||||
return GetDefaultStyle();
|
||||
}
|
||||
|
@ -254,8 +254,8 @@ PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
|
|||
|
||||
PLOT_DASH_TYPE SCH_LINE::GetEffectiveLineStyle() const
|
||||
{
|
||||
if( m_stroke.GetType() != PLOT_DASH_TYPE::DEFAULT )
|
||||
return m_stroke.GetType();
|
||||
if( m_stroke.GetPlotStyle() != PLOT_DASH_TYPE::DEFAULT )
|
||||
return m_stroke.GetPlotStyle();
|
||||
|
||||
NETCLASSPTR netclass = NetClass();
|
||||
|
||||
|
@ -858,6 +858,6 @@ bool SCH_LINE::IsWire() const
|
|||
bool SCH_LINE::UsesDefaultStroke() const
|
||||
{
|
||||
return m_stroke.GetWidth() == 0 && m_stroke.GetColor() == COLOR4D::UNSPECIFIED
|
||||
&& ( m_stroke.GetType() == GetDefaultStyle()
|
||||
|| m_stroke.GetType() == PLOT_DASH_TYPE::DEFAULT );
|
||||
&& ( m_stroke.GetPlotStyle() == GetDefaultStyle()
|
||||
|| m_stroke.GetPlotStyle() == PLOT_DASH_TYPE::DEFAULT );
|
||||
}
|
||||
|
|
|
@ -429,7 +429,7 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke )
|
|||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a stroke." ) );
|
||||
|
||||
aStroke.SetWidth( Mils2iu( DEFAULT_LINE_THICKNESS ) );
|
||||
aStroke.SetType( PLOT_DASH_TYPE::DEFAULT );
|
||||
aStroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||
aStroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
T token;
|
||||
|
@ -454,10 +454,10 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke )
|
|||
|
||||
switch( token )
|
||||
{
|
||||
case T_dash: aStroke.SetType( PLOT_DASH_TYPE::DASH ); break;
|
||||
case T_dot: aStroke.SetType( PLOT_DASH_TYPE::DOT ); break;
|
||||
case T_dash_dot: aStroke.SetType( PLOT_DASH_TYPE::DASHDOT ); break;
|
||||
case T_solid: aStroke.SetType( PLOT_DASH_TYPE::SOLID ); break;
|
||||
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_solid: aStroke.SetPlotStyle( PLOT_DASH_TYPE::SOLID ); break;
|
||||
default:
|
||||
Expecting( "solid, dash, dash_dot, or dot" );
|
||||
}
|
||||
|
|
|
@ -270,7 +270,7 @@ static void formatStroke( OUTPUTFORMATTER* aFormatter, int aNestLevel,
|
|||
|
||||
aFormatter->Print( aNestLevel, "(stroke (width %s) (type %s) (color %d %d %d %s))",
|
||||
FormatInternalUnits( aStroke.GetWidth() ).c_str(),
|
||||
TO_UTF8( getLineStyleToken( aStroke.GetType() ) ),
|
||||
TO_UTF8( getLineStyleToken( aStroke.GetPlotStyle() ) ),
|
||||
KiROUND( aStroke.GetColor().r * 255.0 ),
|
||||
KiROUND( aStroke.GetColor().g * 255.0 ),
|
||||
KiROUND( aStroke.GetColor().b * 255.0 ),
|
||||
|
|
Loading…
Reference in New Issue