DIALOG_DRC: avoid use UNDEFINED_LAYER when select or activate a physical layer.

Although strangely it did not create issues on Linux, it does not work on Windows
This commit is contained in:
jean-pierre charras 2022-01-07 12:53:10 +01:00
parent 5fde992ed4
commit 534d635dd4
1 changed files with 18 additions and 14 deletions

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2016 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2009-2016 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -390,30 +390,34 @@ void DIALOG_DRC::OnDRCItemSelected( wxDataViewEvent& aEvent )
if( a || b || c || d ) if( a || b || c || d )
violationLayers = LSET::AllLayersMask(); violationLayers = LSET::AllLayersMask();
if( a ) for( BOARD_ITEM* it: {a, b, c, d} )
violationLayers &= getActiveLayers( a ); {
if( !it )
continue;
if( b ) LSET layersList = getActiveLayers( it );
violationLayers &= getActiveLayers( b ); violationLayers &= layersList;
// Try to initialize principalLayer to a valid layer
if( c ) // Some markers have a layer set to UNDEFINED_LAYER, and setting
violationLayers &= getActiveLayers( c ); // principalLayer to a valid layer can be useful
if( principalLayer <= UNDEFINED_LAYER )
if( d ) principalLayer = layersList.Seq().front();
violationLayers &= getActiveLayers( d ); }
} }
if( violationLayers.count() ) if( violationLayers.count() )
principalLayer = violationLayers.Seq().front(); principalLayer = violationLayers.Seq().front();
else else if( !(principalLayer <= UNDEFINED_LAYER ) )
violationLayers.set( principalLayer ); violationLayers.set( principalLayer );
WINDOW_THAWER thawer( m_frame ); WINDOW_THAWER thawer( m_frame );
if( ( violationLayers & board->GetVisibleLayers() ) == 0 ) if( !(principalLayer <= UNDEFINED_LAYER )
&& ( violationLayers & board->GetVisibleLayers() ) == 0 )
m_frame->GetAppearancePanel()->SetLayerVisible( principalLayer, true ); m_frame->GetAppearancePanel()->SetLayerVisible( principalLayer, true );
if( board->GetVisibleLayers().test( principalLayer ) ) if( !(principalLayer <= UNDEFINED_LAYER )
&& board->GetVisibleLayers().test( principalLayer ) )
m_frame->SetActiveLayer( principalLayer ); m_frame->SetActiveLayer( principalLayer );
if( m_centerMarkerOnIdle ) if( m_centerMarkerOnIdle )