Reset session drawing props after Board Setup.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14932
This commit is contained in:
parent
3c742c71a0
commit
9ed2458f00
|
@ -269,6 +269,23 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
|
||||||
m_board = getModel<BOARD>();
|
m_board = getModel<BOARD>();
|
||||||
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
m_frame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||||
|
|
||||||
|
// Re-initialize session attributes
|
||||||
|
const BOARD_DESIGN_SETTINGS& bds = m_frame->GetDesignSettings();
|
||||||
|
|
||||||
|
m_layer = m_frame->GetActiveLayer();
|
||||||
|
m_stroke.SetWidth( bds.GetLineThickness( m_layer ) );
|
||||||
|
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||||
|
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||||
|
|
||||||
|
m_textAttrs.m_Size = bds.GetTextSize( m_layer );
|
||||||
|
m_textAttrs.m_StrokeWidth = bds.GetTextThickness( m_layer );
|
||||||
|
InferBold( &m_textAttrs );
|
||||||
|
m_textAttrs.m_Italic = bds.GetTextItalic( m_layer );
|
||||||
|
m_textAttrs.m_KeepUpright = bds.GetTextUpright( m_layer );
|
||||||
|
m_textAttrs.m_Mirrored = IsBackLayer( m_layer );
|
||||||
|
m_textAttrs.m_Halign = GR_TEXT_H_ALIGN_LEFT;
|
||||||
|
m_textAttrs.m_Valign = GR_TEXT_V_ALIGN_TOP;
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1759,7 +1776,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
|
||||||
if( m_layer != m_frame->GetActiveLayer() )
|
if( m_layer != m_frame->GetActiveLayer() )
|
||||||
{
|
{
|
||||||
m_layer = m_frame->GetActiveLayer();
|
m_layer = m_frame->GetActiveLayer();
|
||||||
m_stroke.SetWidth( getSegmentWidth( m_layer ) );
|
m_stroke.SetWidth( bds.GetLineThickness( m_layer ) );
|
||||||
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||||
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||||
|
|
||||||
|
@ -1874,7 +1891,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
|
||||||
if( m_layer != m_frame->GetActiveLayer() )
|
if( m_layer != m_frame->GetActiveLayer() )
|
||||||
{
|
{
|
||||||
m_layer = m_frame->GetActiveLayer();
|
m_layer = m_frame->GetActiveLayer();
|
||||||
m_stroke.SetWidth( getSegmentWidth( m_layer ) );
|
m_stroke.SetWidth( bds.GetLineThickness( m_layer ) );
|
||||||
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||||
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||||
|
|
||||||
|
@ -2148,7 +2165,7 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
|
||||||
if( m_layer != m_frame->GetActiveLayer() )
|
if( m_layer != m_frame->GetActiveLayer() )
|
||||||
{
|
{
|
||||||
m_layer = m_frame->GetActiveLayer();
|
m_layer = m_frame->GetActiveLayer();
|
||||||
m_stroke.SetWidth( getSegmentWidth( m_layer ) );
|
m_stroke.SetWidth( m_frame->GetDesignSettings().GetLineThickness( m_layer ) );
|
||||||
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||||
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||||
}
|
}
|
||||||
|
@ -2287,7 +2304,7 @@ bool DRAWING_TOOL::drawArc( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
|
||||||
if( m_layer != m_frame->GetActiveLayer() )
|
if( m_layer != m_frame->GetActiveLayer() )
|
||||||
{
|
{
|
||||||
m_layer = m_frame->GetActiveLayer();
|
m_layer = m_frame->GetActiveLayer();
|
||||||
m_stroke.SetWidth( getSegmentWidth( m_layer ) );
|
m_stroke.SetWidth( m_frame->GetDesignSettings().GetLineThickness( m_layer ) );
|
||||||
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
m_stroke.SetPlotStyle( PLOT_DASH_TYPE::DEFAULT );
|
||||||
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
m_stroke.SetColor( COLOR4D::UNSPECIFIED );
|
||||||
}
|
}
|
||||||
|
@ -3206,13 +3223,6 @@ int DRAWING_TOOL::DrawVia( const TOOL_EVENT& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int DRAWING_TOOL::getSegmentWidth( PCB_LAYER_ID aLayer ) const
|
|
||||||
{
|
|
||||||
assert( m_board );
|
|
||||||
return m_board->GetDesignSettings().GetLineThickness( aLayer );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const unsigned int DRAWING_TOOL::WIDTH_STEP = pcbIUScale.mmToIU( 0.1 );
|
const unsigned int DRAWING_TOOL::WIDTH_STEP = pcbIUScale.mmToIU( 0.1 );
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -333,9 +333,6 @@ private:
|
||||||
return aOrigin + VECTOR2I( int( xDiff ), int( yDiff ) );
|
return aOrigin + VECTOR2I( int( xDiff ), int( yDiff ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
///< Return the appropriate width for a segment depending on the settings.
|
|
||||||
int getSegmentWidth( PCB_LAYER_ID aLayer ) const;
|
|
||||||
|
|
||||||
KIGFX::VIEW* m_view;
|
KIGFX::VIEW* m_view;
|
||||||
KIGFX::VIEW_CONTROLS* m_controls;
|
KIGFX::VIEW_CONTROLS* m_controls;
|
||||||
BOARD* m_board;
|
BOARD* m_board;
|
||||||
|
|
Loading…
Reference in New Issue