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:
parent
c2d94358fc
commit
91fd063585
|
@ -820,6 +820,12 @@ bool SCH_LINE::IsGraphicLine() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool SCH_LINE::IsWire() const
|
||||||
|
{
|
||||||
|
return ( GetLayer() == LAYER_WIRE );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_LINE::UsesDefaultStroke() const
|
bool SCH_LINE::UsesDefaultStroke() const
|
||||||
{
|
{
|
||||||
return m_size == 0 && m_color == COLOR4D::UNSPECIFIED
|
return m_size == 0 && m_color == COLOR4D::UNSPECIFIED
|
||||||
|
|
|
@ -231,6 +231,13 @@ public:
|
||||||
*/
|
*/
|
||||||
bool IsGraphicLine() const;
|
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:
|
private:
|
||||||
bool doIsConnected( const wxPoint& aPosition ) const override;
|
bool doIsConnected( const wxPoint& aPosition ) const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -313,14 +313,32 @@ float SCH_PAINTER::getLineWidth( const LIB_ITEM* aItem, bool aDrawingShadows )
|
||||||
|
|
||||||
float SCH_PAINTER::getLineWidth( const SCH_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;
|
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 )
|
if( aItem->GetLayer() == LAYER_WIRE )
|
||||||
width = (float) m_schSettings.m_DefaultWireThickness;
|
{
|
||||||
else if( aItem->GetLayer() == LAYER_BUS )
|
if( line->GetLineSize() != 0 )
|
||||||
width = (float) m_schSettings.m_DefaultBusThickness;
|
width = (float) line->GetLineSize();
|
||||||
else
|
else
|
||||||
|
width = (float) m_schSettings.m_DefaultWireThickness;
|
||||||
|
}
|
||||||
|
else if( aItem->GetLayer() == LAYER_BUS )
|
||||||
|
{
|
||||||
|
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() );
|
width = (float) std::max( aItem->GetPenWidth(), m_schSettings.GetDefaultPenWidth() );
|
||||||
|
}
|
||||||
|
|
||||||
if( aItem->IsSelected() && aDrawingShadows )
|
if( aItem->IsSelected() && aDrawingShadows )
|
||||||
width += getShadowWidth();
|
width += getShadowWidth();
|
||||||
|
|
|
@ -1387,19 +1387,19 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||||
|
|
||||||
case SCH_LINE_T:
|
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 );
|
SCH_LINE* line = dynamic_cast<SCH_LINE*>( selItem );
|
||||||
|
|
||||||
if( line && line->IsGraphicLine() )
|
if( line )
|
||||||
graphicLines.push_back( line );
|
lines.push_back( line );
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DIALOG_EDIT_LINE_STYLE dlg( m_frame, graphicLines );
|
DIALOG_EDIT_LINE_STYLE dlg( m_frame, lines );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_OK )
|
if( dlg.ShowModal() == wxID_OK )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue