Eeschema: factor out line stroke property object.
The line stroke property object STROKE_PARAMS was factored out an used in the schematic line object. This will allow it to be used in other objects that require line stroke properties so every object does not need to have it's own definition for line stroke properties.
This commit is contained in:
parent
e376750f62
commit
b15ee1086f
|
@ -30,7 +30,11 @@
|
|||
#include <vector>
|
||||
|
||||
#include <base_struct.h>
|
||||
#include <general.h>
|
||||
#include <plotter.h>
|
||||
|
||||
#include <gal/color4d.h>
|
||||
|
||||
#include <default_values.h>
|
||||
#include <sch_sheet_path.h>
|
||||
#include <render_settings.h>
|
||||
|
||||
|
@ -73,8 +77,7 @@ enum DANGLING_END_T
|
|||
|
||||
|
||||
/**
|
||||
* DANGLING_END_ITEM
|
||||
* is a helper class used to store the state of schematic items that can be connected to
|
||||
* Helper class used to store the state of schematic items that can be connected to
|
||||
* other schematic items.
|
||||
*/
|
||||
class DANGLING_END_ITEM
|
||||
|
@ -141,12 +144,43 @@ public:
|
|||
|
||||
typedef std::unordered_set<SCH_ITEM*> ITEM_SET;
|
||||
|
||||
|
||||
/**
|
||||
* SCH_ITEM
|
||||
* is a base class for any item which can be embedded within the SCHEMATIC
|
||||
* container class, and therefore instances of derived classes should only be
|
||||
* found in EESCHEMA or other programs that use class SCHEMATIC and its contents.
|
||||
* The corresponding class in Pcbnew is BOARD_ITEM.
|
||||
* Simple container to manage line stroke parameters.
|
||||
*/
|
||||
class STROKE_PARAMS
|
||||
{
|
||||
int m_width;
|
||||
PLOT_DASH_TYPE m_type;
|
||||
COLOR4D m_color;
|
||||
|
||||
public:
|
||||
STROKE_PARAMS( int aWidth = Mils2iu( DEFAULT_LINE_THICKNESS ),
|
||||
PLOT_DASH_TYPE aType = PLOT_DASH_TYPE::DEFAULT,
|
||||
const COLOR4D& aColor = COLOR4D::UNSPECIFIED ) :
|
||||
m_width( aWidth ),
|
||||
m_type( aType ),
|
||||
m_color( aColor )
|
||||
{
|
||||
}
|
||||
|
||||
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; }
|
||||
|
||||
COLOR4D GetColor() const { return m_color; }
|
||||
void SetColor( const COLOR4D& aColor ) { m_color = aColor; }
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Base class for any item which can be embedded within the #SCHEMATIC container class,
|
||||
* and therefore instances of derived classes should only be found in EESCHEMA or other
|
||||
* programs that use class SCHEMATIC and its contents.
|
||||
*
|
||||
* The corresponding class in Pcbnew is #BOARD_ITEM.
|
||||
*/
|
||||
class SCH_ITEM : public EDA_ITEM
|
||||
{
|
||||
|
@ -181,8 +215,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function SwapData
|
||||
* swap the internal data structures \a aItem with the schematic item.
|
||||
* Swap the internal data structures \a aItem with the schematic item.
|
||||
* Obviously, aItem must have the same type than me
|
||||
* @param aItem The item to swap the data structures with.
|
||||
*/
|
||||
|
@ -198,7 +231,6 @@ public:
|
|||
SCH_ITEM* Duplicate( bool doClone = false ) const;
|
||||
|
||||
/**
|
||||
* Virtual function IsMovableFromAnchorPoint
|
||||
* @return true for items which are moved with the anchor point at mouse cursor
|
||||
* and false for items moved with no reference to anchor
|
||||
* Usually return true for small items (labels, junctions) and false for
|
||||
|
@ -223,91 +255,77 @@ public:
|
|||
SCHEMATIC* Schematic() const;
|
||||
|
||||
/**
|
||||
* Function IsLocked
|
||||
* @return bool - true if the object is locked, else false
|
||||
*/
|
||||
virtual bool IsLocked() const { return false; }
|
||||
|
||||
/**
|
||||
* Function SetLocked
|
||||
* modifies 'lock' status for of the item.
|
||||
* Set the 'lock' status to \a aLocked for of this item.
|
||||
*/
|
||||
virtual void SetLocked( bool aLocked ) {}
|
||||
|
||||
/**
|
||||
* Function GetLayer
|
||||
* returns the layer this item is on.
|
||||
* Return the layer this item is on.
|
||||
*/
|
||||
SCH_LAYER_ID GetLayer() const { return m_Layer; }
|
||||
|
||||
/**
|
||||
* Function SetLayer
|
||||
* sets the layer this item is on.
|
||||
* Set the layer this item is on.
|
||||
*
|
||||
* @param aLayer The layer number.
|
||||
*/
|
||||
void SetLayer( SCH_LAYER_ID aLayer ) { m_Layer = aLayer; }
|
||||
|
||||
/**
|
||||
* Function ViewGetLayers
|
||||
* returns the layers the item is drawn on (which may be more than its "home" layer)
|
||||
* Return the layers the item is drawn on (which may be more than its "home" layer)
|
||||
*/
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
/**
|
||||
* Function GetPenSize virtual pure
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
virtual int GetPenWidth() const { return 0; }
|
||||
|
||||
/**
|
||||
* Function Print
|
||||
* Print a schematic item. Each schematic item should have its own method
|
||||
* Print a schematic item.
|
||||
*
|
||||
* Each schematic item should have its own method
|
||||
*
|
||||
* @param aOffset drawing offset (usually {0,0} but can be different when moving an object)
|
||||
*/
|
||||
virtual void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) = 0;
|
||||
|
||||
/**
|
||||
* Function Move
|
||||
* moves the item by \a aMoveVector to a new position.
|
||||
* Move the item by \a aMoveVector to a new position.
|
||||
*
|
||||
* @param aMoveVector = the displacement vector
|
||||
*/
|
||||
virtual void Move( const wxPoint& aMoveVector ) = 0;
|
||||
|
||||
/**
|
||||
* Function MirrorY
|
||||
* mirrors item relative to the Y axis about \a aYaxis_position.
|
||||
* Mirror item relative to the Y axis about \a aYaxis_position.
|
||||
*
|
||||
* @param aYaxis_position The Y axis position to mirror around.
|
||||
*/
|
||||
virtual void MirrorY( int aYaxis_position ) = 0;
|
||||
|
||||
/**
|
||||
* Function MirrorX
|
||||
* mirrors item relative to the X axis about \a aXaxis_position.
|
||||
* Mirror item relative to the X axis about \a aXaxis_position.
|
||||
*
|
||||
* @param aXaxis_position The X axis position to mirror around.
|
||||
*/
|
||||
virtual void MirrorX( int aXaxis_position ) = 0;
|
||||
|
||||
/**
|
||||
* Function Rotate
|
||||
* rotates the item around \a aPosition 90 degrees in the clockwise direction.
|
||||
* Rotate the item around \a aPosition 90 degrees in the clockwise direction.
|
||||
*
|
||||
* @param aPosition A reference to a wxPoint object containing the coordinates to
|
||||
* rotate around.
|
||||
*/
|
||||
virtual void Rotate( wxPoint aPosition ) = 0;
|
||||
|
||||
/**
|
||||
* Function Load
|
||||
* reads a schematic item from \a aLine in a .sch file.
|
||||
*
|
||||
* @param aLine - Essentially this is file to read the object from.
|
||||
* @param aErrorMsg - Description of the error if an error occurs while loading the object.
|
||||
* @return True if the object loaded successfully.
|
||||
*/
|
||||
virtual bool Load( LINE_READER& aLine, wxString& aErrorMsg ) { return false; }
|
||||
|
||||
/**
|
||||
* Function GetEndPoints
|
||||
* adds the schematic item end points to \a aItemList if the item has end points.
|
||||
* Add the schematic item end points to \a aItemList if the item has end points.
|
||||
*
|
||||
* The default version doesn't do anything since many of the schematic object cannot
|
||||
* be tested for dangling ends. If you add a new schematic item that can have a
|
||||
|
@ -319,8 +337,7 @@ public:
|
|||
virtual void GetEndPoints( std::vector< DANGLING_END_ITEM >& aItemList ) {}
|
||||
|
||||
/**
|
||||
* Function IsDanglingStateChanged
|
||||
* tests the schematic item to \a aItemList to check if it's dangling state has changed.
|
||||
* Test the schematic item to \a aItemList to check if it's dangling state has changed.
|
||||
*
|
||||
* Note that the return value only true when the state of the test has changed. Use
|
||||
* the IsDangling() method to get the current dangling state of the item. Some of
|
||||
|
@ -346,14 +363,12 @@ public:
|
|||
virtual bool CanConnect( const SCH_ITEM* aItem ) const { return m_Layer == aItem->GetLayer(); }
|
||||
|
||||
/**
|
||||
* Function IsConnectable
|
||||
* returns true if the schematic item can connect to another schematic item.
|
||||
* @return true if the schematic item can connect to another schematic item.
|
||||
*/
|
||||
virtual bool IsConnectable() const { return false; }
|
||||
|
||||
/**
|
||||
* Function GetConnectionPoints
|
||||
* add all the connection points for this item to \a aPoints.
|
||||
* Add all the connection points for this item to \a aPoints.
|
||||
*
|
||||
* Not all schematic items have connection points so the default method does nothing.
|
||||
*
|
||||
|
@ -362,8 +377,7 @@ public:
|
|||
virtual void GetConnectionPoints( std::vector< wxPoint >& aPoints ) const { }
|
||||
|
||||
/**
|
||||
* Function ClearConnections
|
||||
* clears all of the connection items from the list.
|
||||
* Clears all of the connection items from the list.
|
||||
*
|
||||
* The vector release method is used to prevent the item pointers from being deleted.
|
||||
* Do not use the vector erase method on the connection list.
|
||||
|
@ -371,8 +385,7 @@ public:
|
|||
void ClearConnections() { m_connections.clear(); }
|
||||
|
||||
/**
|
||||
* Function IsConnected
|
||||
* tests the item to see if it is connected to \a aPoint.
|
||||
* Test the item to see if it is connected to \a aPoint.
|
||||
*
|
||||
* @param aPoint A reference to a wxPoint object containing the coordinates to test.
|
||||
* @return True if connection to \a aPoint exists.
|
||||
|
@ -380,8 +393,9 @@ public:
|
|||
bool IsConnected( const wxPoint& aPoint ) const;
|
||||
|
||||
/**
|
||||
* Retrieves the connection associated with this object in the given sheet
|
||||
* Note: the returned value can be nullptr.
|
||||
* Retrieve the connection associated with this object in the given sheet
|
||||
*
|
||||
* @note The returned value can be nullptr.
|
||||
*/
|
||||
SCH_CONNECTION* Connection( const SCH_SHEET_PATH& aPath ) const;
|
||||
|
||||
|
@ -438,17 +452,24 @@ public:
|
|||
virtual void AutoplaceFields( SCH_SCREEN* aScreen, bool aManual ) { }
|
||||
|
||||
/**
|
||||
* Function Plot
|
||||
* plots the schematic item to \a aPlotter.
|
||||
* Check if this schematic item has line stoke properties.
|
||||
*
|
||||
* @see #STROKE_PARAMS
|
||||
*
|
||||
* @return true if this schematic item support line stroke properties. Otherwise, false.
|
||||
*/
|
||||
virtual bool HasLineStroke() const { return false; }
|
||||
|
||||
/**
|
||||
* Plot the schematic item to \a aPlotter.
|
||||
*
|
||||
* @param aPlotter A pointer to a #PLOTTER object.
|
||||
*/
|
||||
virtual void Plot( PLOTTER* aPlotter );
|
||||
|
||||
/**
|
||||
* Function GetNetListItem
|
||||
* creates a new #NETLIST_OBJECT for the schematic object and adds it to
|
||||
* \a aNetListItems.
|
||||
* Create a new #NETLIST_OBJECT for the schematic object and adds it to \a aNetListItems.
|
||||
*
|
||||
* <p>
|
||||
* Not all schematic objects have net list items associated with them. This
|
||||
* method only needs to be overridden for those schematic objects that have
|
||||
|
@ -459,8 +480,7 @@ public:
|
|||
SCH_SHEET_PATH* aSheetPath ) { }
|
||||
|
||||
/**
|
||||
* Function SetPosition
|
||||
* set the schematic item position to \a aPosition.
|
||||
* Set the schematic item position to \a aPosition.
|
||||
*
|
||||
* @param aPosition A reference to a wxPoint object containing the new position.
|
||||
*/
|
||||
|
@ -470,8 +490,7 @@ public:
|
|||
|
||||
private:
|
||||
/**
|
||||
* Function doIsConnected
|
||||
* provides the object specific test to see if it is connected to \a aPosition.
|
||||
* Provide the object specific test to see if it is connected to \a aPosition.
|
||||
*
|
||||
* @note Override this function if the derived object can be connect to another
|
||||
* object such as a wire, bus, or junction. Do not override this function
|
||||
|
|
|
@ -70,9 +70,9 @@ SCH_LINE::SCH_LINE( const wxPoint& pos, int layer ) :
|
|||
m_start = pos;
|
||||
m_end = pos;
|
||||
m_startIsDangling = m_endIsDangling = false;
|
||||
m_size = 0;
|
||||
m_style = PLOT_DASH_TYPE::DEFAULT;
|
||||
m_color = COLOR4D::UNSPECIFIED;
|
||||
m_stroke.SetWidth( 0 );
|
||||
m_stroke.SetType( PLOT_DASH_TYPE::DEFAULT );
|
||||
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
switch( layer )
|
||||
{
|
||||
|
@ -96,9 +96,7 @@ SCH_LINE::SCH_LINE( const SCH_LINE& aLine ) :
|
|||
{
|
||||
m_start = aLine.m_start;
|
||||
m_end = aLine.m_end;
|
||||
m_size = aLine.m_size;
|
||||
m_style = aLine.m_style;
|
||||
m_color = aLine.m_color;
|
||||
m_stroke = aLine.m_stroke;
|
||||
m_startIsDangling = aLine.m_startIsDangling;
|
||||
m_endIsDangling = aLine.m_endIsDangling;
|
||||
}
|
||||
|
@ -204,8 +202,8 @@ void SCH_LINE::ViewGetLayers( int aLayers[], int& aCount ) const
|
|||
|
||||
const EDA_RECT SCH_LINE::GetBoundingBox() const
|
||||
{
|
||||
int width = m_size / 2;
|
||||
int extra = m_size & 0x1;
|
||||
int width = m_stroke.GetWidth() / 2;
|
||||
int extra = m_stroke.GetWidth() & 0x1;
|
||||
|
||||
int xmin = std::min( m_start.x, m_end.x ) - width;
|
||||
int ymin = std::min( m_start.y, m_end.y ) - width;
|
||||
|
@ -225,9 +223,9 @@ double SCH_LINE::GetLength() const
|
|||
}
|
||||
|
||||
|
||||
void SCH_LINE::SetLineColor( const COLOR4D aColor )
|
||||
void SCH_LINE::SetLineColor( const COLOR4D& aColor )
|
||||
{
|
||||
m_color = aColor;
|
||||
m_stroke.SetColor( aColor );
|
||||
}
|
||||
|
||||
|
||||
|
@ -236,19 +234,19 @@ void SCH_LINE::SetLineColor( const double r, const double g, const double b, con
|
|||
COLOR4D newColor(r, g, b, a);
|
||||
|
||||
if( newColor == COLOR4D::UNSPECIFIED )
|
||||
m_color = COLOR4D::UNSPECIFIED;
|
||||
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||
else
|
||||
{
|
||||
// Eeschema does not allow alpha channel in colors
|
||||
newColor.a = 1.0;
|
||||
m_color = newColor;
|
||||
m_stroke.SetColor( newColor );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
COLOR4D SCH_LINE::GetLineColor() const
|
||||
{
|
||||
return m_color;
|
||||
return m_stroke.GetColor();
|
||||
}
|
||||
|
||||
|
||||
|
@ -270,16 +268,16 @@ void SCH_LINE::SetLineStyle( const int aStyleId )
|
|||
void SCH_LINE::SetLineStyle( const PLOT_DASH_TYPE aStyle )
|
||||
{
|
||||
if( aStyle == GetDefaultStyle() )
|
||||
m_style = PLOT_DASH_TYPE::DEFAULT;
|
||||
m_stroke.SetType( PLOT_DASH_TYPE::DEFAULT );
|
||||
else
|
||||
m_style = aStyle;
|
||||
m_stroke.SetType( aStyle );
|
||||
}
|
||||
|
||||
|
||||
PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
|
||||
{
|
||||
if( m_style != PLOT_DASH_TYPE::DEFAULT )
|
||||
return m_style;
|
||||
if( m_stroke.GetType() != PLOT_DASH_TYPE::DEFAULT )
|
||||
return m_stroke.GetType();
|
||||
|
||||
return GetDefaultStyle();
|
||||
}
|
||||
|
@ -287,23 +285,23 @@ PLOT_DASH_TYPE SCH_LINE::GetLineStyle() const
|
|||
|
||||
void SCH_LINE::SetLineWidth( const int aSize )
|
||||
{
|
||||
m_size = aSize;
|
||||
m_stroke.SetWidth( aSize );
|
||||
}
|
||||
|
||||
|
||||
int SCH_LINE::GetPenWidth() const
|
||||
{
|
||||
if( m_size == 0 && Schematic() )
|
||||
if( m_stroke.GetWidth() == 0 && Schematic() )
|
||||
return std::max( Schematic()->Settings().m_DefaultLineWidth, 1 );
|
||||
|
||||
return std::max( m_size, 1 );
|
||||
return std::max( m_stroke.GetWidth(), 1 );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LINE::Print( RENDER_SETTINGS* aSettings, const wxPoint& offset )
|
||||
{
|
||||
wxDC* DC = aSettings->GetPrintDC();
|
||||
COLOR4D color = m_color;
|
||||
COLOR4D color = m_stroke.GetColor();
|
||||
wxPoint start = m_start;
|
||||
wxPoint end = m_end;
|
||||
int penWidth = std::max( GetPenWidth(), aSettings->GetDefaultPenWidth() );
|
||||
|
@ -731,9 +729,7 @@ void SCH_LINE::SwapData( SCH_ITEM* aItem )
|
|||
std::swap( m_end, item->m_end );
|
||||
std::swap( m_startIsDangling, item->m_startIsDangling );
|
||||
std::swap( m_endIsDangling, item->m_endIsDangling );
|
||||
std::swap( m_style, item->m_style );
|
||||
std::swap( m_size, item->m_size );
|
||||
std::swap( m_color, item->m_color );
|
||||
std::swap( m_stroke, item->m_stroke );
|
||||
}
|
||||
|
||||
|
||||
|
@ -751,8 +747,8 @@ void SCH_LINE::Plot( PLOTTER* aPlotter )
|
|||
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
||||
int penWidth;
|
||||
|
||||
if( m_color != COLOR4D::UNSPECIFIED )
|
||||
aPlotter->SetColor( m_color );
|
||||
if( m_stroke.GetColor() != COLOR4D::UNSPECIFIED )
|
||||
aPlotter->SetColor( m_stroke.GetColor() );
|
||||
else
|
||||
aPlotter->SetColor( aPlotter->RenderSettings()->GetLayerColor( GetLayer() ) );
|
||||
|
||||
|
@ -828,6 +824,7 @@ bool SCH_LINE::IsWire() const
|
|||
|
||||
bool SCH_LINE::UsesDefaultStroke() const
|
||||
{
|
||||
return m_size == 0 && m_color == COLOR4D::UNSPECIFIED
|
||||
&& ( m_style == GetDefaultStyle() || m_style == PLOT_DASH_TYPE::DEFAULT );
|
||||
return m_stroke.GetWidth() == 0 && m_stroke.GetColor() == COLOR4D::UNSPECIFIED
|
||||
&& ( m_stroke.GetType() == GetDefaultStyle()
|
||||
|| m_stroke.GetType() == PLOT_DASH_TYPE::DEFAULT );
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#ifndef _SCH_LINE_H_
|
||||
#define _SCH_LINE_H_
|
||||
|
||||
#include <plotter.h>
|
||||
#include <sch_item.h>
|
||||
|
||||
class NETLIST_OBJECT_LIST;
|
||||
|
@ -41,9 +40,7 @@ class SCH_LINE : public SCH_ITEM
|
|||
bool m_endIsDangling; ///< True if end point is not connected.
|
||||
wxPoint m_start; ///< Line start point
|
||||
wxPoint m_end; ///< Line end point
|
||||
int m_size; ///< Line pensize
|
||||
PLOT_DASH_TYPE m_style; ///< Line style
|
||||
COLOR4D m_color; ///< Line color
|
||||
STROKE_PARAMS m_stroke; ///< Line stroke properties.
|
||||
|
||||
public:
|
||||
|
||||
|
@ -114,7 +111,7 @@ public:
|
|||
/// (mainly to read style from .sch file
|
||||
static PLOT_DASH_TYPE GetLineStyleByName( const wxString& aStyleName );
|
||||
|
||||
void SetLineColor( const COLOR4D aColor );
|
||||
void SetLineColor( const COLOR4D& aColor );
|
||||
|
||||
void SetLineColor( const double r, const double g, const double b, const double a );
|
||||
|
||||
|
@ -123,6 +120,10 @@ public:
|
|||
|
||||
void SetLineWidth( const int aSize );
|
||||
|
||||
virtual bool HasLineStroke() const override { return true; }
|
||||
STROKE_PARAMS GetStroke() const { return m_stroke; }
|
||||
void SetStroke( const STROKE_PARAMS& aStroke ) { m_stroke = aStroke; }
|
||||
|
||||
/**
|
||||
* Test if the #SCH_LINE object uses the default stroke settings.
|
||||
*
|
||||
|
@ -132,7 +133,7 @@ public:
|
|||
*/
|
||||
bool UsesDefaultStroke() const;
|
||||
|
||||
int GetLineSize() const { return m_size; }
|
||||
int GetLineSize() const { return m_stroke.GetWidth(); }
|
||||
|
||||
void ViewGetLayers( int aLayers[], int& aCount ) const override;
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
|
||||
#include <common.h>
|
||||
#include <lib_id.h>
|
||||
#include <plotter.h>
|
||||
|
||||
#include <class_libentry.h>
|
||||
#include <lib_arc.h>
|
||||
|
@ -419,9 +418,9 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke )
|
|||
wxCHECK_RET( CurTok() == T_stroke,
|
||||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as a stroke." ) );
|
||||
|
||||
aStroke.m_Width = Mils2iu( DEFAULT_LINE_THICKNESS );
|
||||
aStroke.m_Type = PLOT_DASH_TYPE::DEFAULT;
|
||||
aStroke.m_Color = COLOR4D::UNSPECIFIED;
|
||||
aStroke.SetWidth( Mils2iu( DEFAULT_LINE_THICKNESS ) );
|
||||
aStroke.SetType( PLOT_DASH_TYPE::DEFAULT );
|
||||
aStroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||
|
||||
T token;
|
||||
|
||||
|
@ -435,7 +434,7 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke )
|
|||
switch( token )
|
||||
{
|
||||
case T_width:
|
||||
aStroke.m_Width = parseInternalUnits( "stroke width" );
|
||||
aStroke.SetWidth( parseInternalUnits( "stroke width" ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -445,10 +444,10 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke )
|
|||
|
||||
switch( token )
|
||||
{
|
||||
case T_dash: aStroke.m_Type = PLOT_DASH_TYPE::DASH; break;
|
||||
case T_dot: aStroke.m_Type = PLOT_DASH_TYPE::DOT; break;
|
||||
case T_dash_dot: aStroke.m_Type = PLOT_DASH_TYPE::DASHDOT; break;
|
||||
case T_solid: aStroke.m_Type = PLOT_DASH_TYPE::SOLID; break;
|
||||
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;
|
||||
default:
|
||||
Expecting( "solid, dash, dash_dot, or dot" );
|
||||
}
|
||||
|
@ -466,7 +465,7 @@ void SCH_SEXPR_PARSER::parseStroke( STROKE_PARAMS& aStroke )
|
|||
color.b = parseInt( "blue" ) / 255.0;
|
||||
color.a = Clamp( parseDouble( "alpha" ), 0.0, 1.0 );
|
||||
|
||||
aStroke.m_Color = color;
|
||||
aStroke.SetColor( color );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
}
|
||||
|
@ -2325,8 +2324,8 @@ SCH_SHEET* SCH_SEXPR_PARSER::parseSheet()
|
|||
|
||||
case T_stroke:
|
||||
parseStroke( stroke );
|
||||
sheet->SetBorderWidth( stroke.m_Width );
|
||||
sheet->SetBorderColor( stroke.m_Color );
|
||||
sheet->SetBorderWidth( stroke.GetWidth() );
|
||||
sheet->SetBorderColor( stroke.GetColor() );
|
||||
break;
|
||||
|
||||
case T_fill:
|
||||
|
@ -2528,9 +2527,7 @@ SCH_LINE* SCH_SEXPR_PARSER::parseLine()
|
|||
|
||||
case T_stroke:
|
||||
parseStroke( stroke );
|
||||
line->SetLineWidth( stroke.m_Width );
|
||||
line->SetLineStyle( stroke.m_Type );
|
||||
line->SetLineColor( stroke.m_Color );
|
||||
line->SetStroke( stroke );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -62,27 +62,6 @@ class SCH_TEXT;
|
|||
class TITLE_BLOCK;
|
||||
|
||||
|
||||
/**
|
||||
* Simple container to manage line stroke parameters.
|
||||
*/
|
||||
class STROKE_PARAMS
|
||||
{
|
||||
public:
|
||||
int m_Width;
|
||||
PLOT_DASH_TYPE m_Type;
|
||||
COLOR4D m_Color;
|
||||
|
||||
STROKE_PARAMS( int aWidth = Mils2iu( DEFAULT_LINE_THICKNESS ),
|
||||
PLOT_DASH_TYPE aType = PLOT_DASH_TYPE::DEFAULT,
|
||||
const COLOR4D& aColor = COLOR4D::UNSPECIFIED ) :
|
||||
m_Width( aWidth ),
|
||||
m_Type( aType ),
|
||||
m_Color( aColor )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Simple container to manage fill parameters.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue