Make sure lines/wires/busses get default widths if not spec'ed.
Fixes https://gitlab.com/kicad/code/kicad/issues/4854
This commit is contained in:
parent
ec0d8dc5e5
commit
e910dc0092
|
@ -83,8 +83,8 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
|
||||||
{
|
{
|
||||||
EDA_RECT rect;
|
EDA_RECT rect;
|
||||||
|
|
||||||
int size =
|
int size = Schematic() ? Schematic()->Settings().m_JunctionSize
|
||||||
Schematic() ? Schematic()->Settings().m_JunctionSize : Mils2iu( DEFAULT_JUNCTION_DIAM );
|
: Mils2iu( DEFAULT_JUNCTION_DIAM );
|
||||||
|
|
||||||
if( m_diameter != 0 )
|
if( m_diameter != 0 )
|
||||||
size = m_diameter;
|
size = m_diameter;
|
||||||
|
|
|
@ -271,13 +271,41 @@ int SCH_LINE::GetPenWidth() const
|
||||||
{
|
{
|
||||||
NETCLASSPTR netclass = NetClass();
|
NETCLASSPTR netclass = NetClass();
|
||||||
|
|
||||||
if( netclass )
|
switch ( m_Layer )
|
||||||
return ( m_Layer == LAYER_BUS ) ? netclass->GetBusWidth() : netclass->GetWireWidth();
|
{
|
||||||
|
default:
|
||||||
|
if( m_stroke.GetWidth() > 0 )
|
||||||
|
return m_stroke.GetWidth();
|
||||||
|
|
||||||
if( m_stroke.GetWidth() == 0 && Schematic() )
|
if( Schematic() )
|
||||||
return std::max( Schematic()->Settings().m_DefaultLineWidth, 1 );
|
return Schematic()->Settings().m_DefaultLineWidth;
|
||||||
|
|
||||||
return std::max( m_stroke.GetWidth(), 1 );
|
return DEFAULT_LINE_THICKNESS;
|
||||||
|
|
||||||
|
case LAYER_WIRE:
|
||||||
|
if( netclass )
|
||||||
|
return netclass->GetWireWidth();
|
||||||
|
|
||||||
|
if( m_stroke.GetWidth() > 0 )
|
||||||
|
return m_stroke.GetWidth();
|
||||||
|
|
||||||
|
if( Schematic() )
|
||||||
|
return Schematic()->Settings().m_DefaultWireThickness;
|
||||||
|
|
||||||
|
return DEFAULT_WIRE_THICKNESS;
|
||||||
|
|
||||||
|
case LAYER_BUS:
|
||||||
|
if( netclass )
|
||||||
|
return netclass->GetBusWidth();
|
||||||
|
|
||||||
|
if( m_stroke.GetWidth() > 0 )
|
||||||
|
return m_stroke.GetWidth();
|
||||||
|
|
||||||
|
if( Schematic() )
|
||||||
|
return Schematic()->Settings().m_DefaultBusThickness;
|
||||||
|
|
||||||
|
return DEFAULT_BUS_THICKNESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -731,6 +731,8 @@ SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Give segments a parent so they find the default line/wire/bus widths
|
||||||
|
segment->SetParent( &m_frame->Schematic() );
|
||||||
segment->SetFlags( IS_NEW | IS_MOVED );
|
segment->SetFlags( IS_NEW | IS_MOVED );
|
||||||
m_wires.push_back( segment );
|
m_wires.push_back( segment );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue