DIALOG_TRACK_VIA_PROPERTIES: Do not use wxcombobox selection as temporary variable.
Fixes #9746 https://gitlab.com/kicad/code/kicad/issues/9746
This commit is contained in:
parent
7fc04c3cf2
commit
c0fdac2774
|
@ -37,6 +37,8 @@
|
||||||
#include <board_commit.h>
|
#include <board_commit.h>
|
||||||
#include <macros.h>
|
#include <macros.h>
|
||||||
|
|
||||||
|
#include <wx/log.h>
|
||||||
|
|
||||||
DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent,
|
DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParent,
|
||||||
const PCB_SELECTION& aItems,
|
const PCB_SELECTION& aItems,
|
||||||
COMMIT& aCommit ) :
|
COMMIT& aCommit ) :
|
||||||
|
@ -90,6 +92,15 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
bool hasLocked = false;
|
bool hasLocked = false;
|
||||||
bool hasUnlocked = false;
|
bool hasUnlocked = false;
|
||||||
|
|
||||||
|
// Start and end layers of vias
|
||||||
|
// if at least 2 vias do not have the same start or the same end layer
|
||||||
|
// the layers will be set as undefined
|
||||||
|
int selection_first_layer = -1;
|
||||||
|
int selection_last_layer = -1;
|
||||||
|
|
||||||
|
// The selection layer for tracks
|
||||||
|
int track_selection_layer = -1;
|
||||||
|
|
||||||
auto getAnnularRingSelection =
|
auto getAnnularRingSelection =
|
||||||
[]( const PCB_VIA* via ) -> int
|
[]( const PCB_VIA* via ) -> int
|
||||||
{
|
{
|
||||||
|
@ -128,7 +139,7 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
m_trackEndX.SetValue( t->GetEnd().x );
|
m_trackEndX.SetValue( t->GetEnd().x );
|
||||||
m_trackEndY.SetValue( t->GetEnd().y );
|
m_trackEndY.SetValue( t->GetEnd().y );
|
||||||
m_trackWidth.SetValue( t->GetWidth() );
|
m_trackWidth.SetValue( t->GetWidth() );
|
||||||
m_TrackLayerCtrl->SetLayerSelection( t->GetLayer() );
|
track_selection_layer = t->GetLayer();
|
||||||
m_tracks = true;
|
m_tracks = true;
|
||||||
}
|
}
|
||||||
else // check if values are the same for every selected track
|
else // check if values are the same for every selected track
|
||||||
|
@ -148,11 +159,9 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
if( m_trackWidth.GetValue() != t->GetWidth() )
|
if( m_trackWidth.GetValue() != t->GetWidth() )
|
||||||
m_trackWidth.SetValue( INDETERMINATE_STATE );
|
m_trackWidth.SetValue( INDETERMINATE_STATE );
|
||||||
|
|
||||||
if( m_TrackLayerCtrl->GetLayerSelection() != t->GetLayer() )
|
if( track_selection_layer != t->GetLayer() )
|
||||||
{
|
{
|
||||||
m_TrackLayerCtrl->SetUndefinedLayerName( INDETERMINATE_STATE );
|
track_selection_layer = UNDEFINED_LAYER;
|
||||||
m_TrackLayerCtrl->Resync();
|
|
||||||
m_TrackLayerCtrl->SetLayerSelection( UNDEFINED_LAYER );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,10 +185,10 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
m_viaDrill.SetValue( v->GetDrillValue() );
|
m_viaDrill.SetValue( v->GetDrillValue() );
|
||||||
m_vias = true;
|
m_vias = true;
|
||||||
viaType = v->GetViaType();
|
viaType = v->GetViaType();
|
||||||
m_ViaStartLayer->SetLayerSelection( v->TopLayer() );
|
|
||||||
m_ViaEndLayer->SetLayerSelection( v->BottomLayer() );
|
|
||||||
m_viaNotFree->SetValue( !v->GetIsFree() );
|
m_viaNotFree->SetValue( !v->GetIsFree() );
|
||||||
m_annularRingsCtrl->SetSelection( getAnnularRingSelection( v ) );
|
m_annularRingsCtrl->SetSelection( getAnnularRingSelection( v ) );
|
||||||
|
selection_first_layer = v->TopLayer();
|
||||||
|
selection_last_layer = v->BottomLayer();
|
||||||
}
|
}
|
||||||
else // check if values are the same for every selected via
|
else // check if values are the same for every selected via
|
||||||
{
|
{
|
||||||
|
@ -201,18 +210,14 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
if( v->GetIsFree() != !m_viaNotFree->GetValue() )
|
if( v->GetIsFree() != !m_viaNotFree->GetValue() )
|
||||||
m_viaNotFree->Set3StateValue( wxCHK_UNDETERMINED );
|
m_viaNotFree->Set3StateValue( wxCHK_UNDETERMINED );
|
||||||
|
|
||||||
if( m_ViaStartLayer->GetLayerSelection() != v->TopLayer() )
|
if( selection_first_layer != v->TopLayer() )
|
||||||
{
|
{
|
||||||
m_ViaStartLayer->SetUndefinedLayerName( INDETERMINATE_STATE );
|
selection_first_layer = UNDEFINED_LAYER;
|
||||||
m_ViaStartLayer->Resync();
|
|
||||||
m_ViaStartLayer->SetLayerSelection( UNDEFINED_LAYER );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_ViaEndLayer->GetLayerSelection() != v->BottomLayer() )
|
if( selection_last_layer != v->BottomLayer() )
|
||||||
{
|
{
|
||||||
m_ViaEndLayer->SetUndefinedLayerName( INDETERMINATE_STATE );
|
selection_last_layer = UNDEFINED_LAYER;
|
||||||
m_ViaEndLayer->Resync();
|
|
||||||
m_ViaEndLayer->SetLayerSelection( UNDEFINED_LAYER );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_annularRingsCtrl->GetSelection() != getAnnularRingSelection( v ) )
|
if( m_annularRingsCtrl->GetSelection() != getAnnularRingSelection( v ) )
|
||||||
|
@ -240,6 +245,36 @@ DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES( PCB_BASE_FRAME* aParen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_tracks )
|
||||||
|
{
|
||||||
|
// Set the track layer selection state:
|
||||||
|
if( track_selection_layer == UNDEFINED_LAYER )
|
||||||
|
{
|
||||||
|
m_TrackLayerCtrl->SetUndefinedLayerName( INDETERMINATE_STATE );
|
||||||
|
m_TrackLayerCtrl->Resync();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_TrackLayerCtrl->SetLayerSelection( track_selection_layer );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the vias layers selections state:
|
||||||
|
if( m_vias )
|
||||||
|
{
|
||||||
|
if( selection_first_layer == UNDEFINED_LAYER )
|
||||||
|
{
|
||||||
|
m_ViaStartLayer->SetUndefinedLayerName( INDETERMINATE_STATE );
|
||||||
|
m_ViaStartLayer->Resync();
|
||||||
|
}
|
||||||
|
m_ViaStartLayer->SetLayerSelection( selection_first_layer );
|
||||||
|
|
||||||
|
if( selection_last_layer == UNDEFINED_LAYER )
|
||||||
|
{
|
||||||
|
m_ViaEndLayer->SetUndefinedLayerName( INDETERMINATE_STATE );
|
||||||
|
m_ViaEndLayer->Resync();
|
||||||
|
}
|
||||||
|
m_ViaEndLayer->SetLayerSelection( selection_last_layer );
|
||||||
|
}
|
||||||
|
|
||||||
m_netSelector->SetBoard( aParent->GetBoard() );
|
m_netSelector->SetBoard( aParent->GetBoard() );
|
||||||
m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
|
m_netSelector->SetNetInfo( &aParent->GetBoard()->GetNetInfo() );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue