pcbnew: draw polygon and element previews on layer

This ensures that when starting to draw a zone or graphic element, the
preview is drawn in the same color/on the same layer as the element that
will be created.  Previously, beginning a graphic polygon while a copper
layer was active would result in the preview being drawn in the color of
the active copper layer.
This commit is contained in:
Seth Hillbrand 2018-10-03 05:57:02 -07:00
parent c9ca1013b2
commit f714d2fa64
3 changed files with 13 additions and 1 deletions

View File

@ -976,6 +976,8 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
DRAWSEGMENT line45;
m_frame->SetActiveLayer( getDrawingLayer() );
// Add a VIEW_GROUP that serves as a preview for the new item
SELECTION preview;
m_view->Add( &preview );
@ -1458,6 +1460,13 @@ int DRAWING_TOOL::drawZone( bool aKeepout, ZONE_MODE aMode )
params.m_mode = aMode;
params.m_sourceZone = sourceZone;
if( aMode == ZONE_MODE::GRAPHIC_POLYGON )
params.m_layer = getDrawingLayer();
else if( aMode == ZONE_MODE::SIMILAR )
params.m_layer = sourceZone->GetLayer();
else
params.m_layer = m_frame->GetActiveLayer();
ZONE_CREATE_HELPER zoneTool( *this, params );
// the geometry manager which handles the zone geometry, and

View File

@ -60,7 +60,7 @@ std::unique_ptr<ZONE_CONTAINER> ZONE_CREATE_HELPER::createNewZone( bool aKeepout
// Get the current default settings for zones
ZONE_SETTINGS zoneInfo = frame.GetZoneSettings();
zoneInfo.m_CurrentZone_Layer = frame.GetScreen()->m_Active_Layer;
zoneInfo.m_CurrentZone_Layer = m_params.m_layer;
zoneInfo.m_NetcodeSelection = board.GetHighLightNetCode();
zoneInfo.SetIsKeepout( m_params.m_keepout );

View File

@ -52,6 +52,9 @@ public:
///> Should create a keepout zone?
bool m_keepout;
///> Layer to begin drawing
PCB_LAYER_ID m_layer;
///> The zone mode to operate in
DRAWING_TOOL::ZONE_MODE m_mode;