Eeschema: allow editing of wire and bus properties.

CHANGED: Wire and bus lines properties (color, line width, and line type)
can be edited the same as graphical lines.
This commit is contained in:
Wayne Stambaugh 2020-05-09 17:19:34 -04:00
parent c2d94358fc
commit 91fd063585
4 changed files with 38 additions and 7 deletions

View File

@ -820,6 +820,12 @@ bool SCH_LINE::IsGraphicLine() const
}
bool SCH_LINE::IsWire() const
{
return ( GetLayer() == LAYER_WIRE );
}
bool SCH_LINE::UsesDefaultStroke() const
{
return m_size == 0 && m_color == COLOR4D::UNSPECIFIED

View File

@ -231,6 +231,13 @@ public:
*/
bool IsGraphicLine() const;
/**
* Returns true if the line is a wire.
*
* @return true if this line is on the wire layer.
*/
bool IsWire() const;
private:
bool doIsConnected( const wxPoint& aPosition ) const override;
};

View File

@ -313,14 +313,32 @@ float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
float SCH_PAINTER::getLineWidth( const SCH_ITEM* aItem, bool aDrawingShadows )
{
wxCHECK( aItem && aItem->Type() == SCH_LINE_T,
static_cast<float>( m_schSettings.m_DefaultWireThickness ) );
float width;
const SCH_LINE* line = dynamic_cast<const SCH_LINE*>( aItem );
wxCHECK( line, static_cast<float>( m_schSettings.m_DefaultWireThickness ) );
if( aItem->GetLayer() == LAYER_WIRE )
width = (float) m_schSettings.m_DefaultWireThickness;
{
if( line->GetLineSize() != 0 )
width = (float) line->GetLineSize();
else
width = (float) m_schSettings.m_DefaultWireThickness;
}
else if( aItem->GetLayer() == LAYER_BUS )
width = (float) m_schSettings.m_DefaultBusThickness;
{
if( line->GetLineSize() != 0 )
width = (float) line->GetLineSize();
else
width = (float) m_schSettings.m_DefaultBusThickness;
}
else
{
width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
}
if( aItem->IsSelected() && aDrawingShadows )
width += getShadowWidth();

View File

@ -1387,19 +1387,19 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
case SCH_LINE_T:
{
std::deque<SCH_LINE*> graphicLines;
std::deque<SCH_LINE*> lines;
for( EDA_ITEM* selItem : selection.Items() )
for( auto selItem : selection.Items() )
{
SCH_LINE* line = dynamic_cast<SCH_LINE*>( selItem );
if( line && line->IsGraphicLine() )
graphicLines.push_back( line );
if( line )
lines.push_back( line );
else
return 0;
}
DIALOG_EDIT_LINE_STYLE dlg( m_frame, graphicLines );
DIALOG_EDIT_LINE_STYLE dlg( m_frame, lines );
if( dlg.ShowModal() == wxID_OK )
{