Only paint pads on layers they appear on.

Also adds pad layer removal controls to Pad Properties dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/5320
This commit is contained in:
Jeff Young 2020-08-23 18:11:47 +01:00
parent 6edcc9d38f
commit 49ac89f72c
8 changed files with 751 additions and 337 deletions

View File

@ -113,6 +113,8 @@ D_PAD::D_PAD( const D_PAD& aOther ) :
SetPinFunction( aOther.GetPinFunction() );
SetSubRatsnest( aOther.GetSubRatsnest() );
m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius;
m_removeUnconnectedLayer = aOther.m_removeUnconnectedLayer;
m_keepTopBottomLayer = aOther.m_keepTopBottomLayer;
}
@ -128,6 +130,8 @@ D_PAD& D_PAD::operator=( const D_PAD &aOther )
SetPinFunction( aOther.GetPinFunction() );
SetSubRatsnest( aOther.GetSubRatsnest() );
m_effectiveBoundingRadius = aOther.m_effectiveBoundingRadius;
m_removeUnconnectedLayer = aOther.m_removeUnconnectedLayer;
m_keepTopBottomLayer = aOther.m_keepTopBottomLayer;
return *this;
}
@ -1179,14 +1183,14 @@ unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( IsFlipped() && !aView->IsLayerVisible( LAYER_MOD_BK ) )
return HIDE;
if( IsFrontLayer( ( PCB_LAYER_ID )aLayer ) && !aView->IsLayerVisible( LAYER_PAD_FR ) )
if( IsFrontLayer( (PCB_LAYER_ID) aLayer ) && !aView->IsLayerVisible( LAYER_PAD_FR ) )
return HIDE;
if( IsBackLayer( ( PCB_LAYER_ID )aLayer ) && !aView->IsLayerVisible( LAYER_PAD_BK ) )
if( IsBackLayer( (PCB_LAYER_ID) aLayer ) && !aView->IsLayerVisible( LAYER_PAD_BK ) )
return HIDE;
// Only draw the pad if at least one of the layers it crosses is being displayed
if( board && !( board->GetVisibleLayers() & GetLayerSet() ).any() )
if( board && !IsPadOnLayer( board->GetVisibleLayers() ) )
return HIDE;
// Netnames will be shown only if zoom is appropriate

View File

@ -169,6 +169,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
wxFont infoFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
m_copperLayersLabel->SetFont( infoFont );
m_techLayersLabel->SetFont( infoFont );
m_parentInfoLine1->SetFont( infoFont );
m_parentInfoLine2->SetFont( infoFont );
@ -186,6 +187,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
// Initialize canvas to be able to display the dummy pad:
prepareCanvas();
m_stackupImage->SetBitmap( KiBitmap( pads_remove_unused_xpm ) );
SetInitialFocus( m_PadNumCtrl );
m_sdbSizerOK->SetDefault();
@ -255,7 +257,7 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
#else
EDA_DRAW_PANEL_GAL::GAL_TYPE backend = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
#endif
m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( this, -1, wxDefaultPosition, wxDefaultSize,
m_padPreviewGAL = new PCB_DRAW_PANEL_GAL( m_boardViewPanel, -1, wxDefaultPosition, wxDefaultSize,
m_parent->GetGalDisplayOptions(), backend );
m_padPreviewSizer->Add( m_padPreviewGAL, 12, wxEXPAND | wxALL, 5 );
@ -271,9 +273,10 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
m_padPreviewGAL->UpdateColors();
m_padPreviewGAL->SetStealsFocus( false );
m_padPreviewGAL->ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
m_padPreviewGAL->GetViewControls()->ApplySettings(
m_parent->GetCanvas()->GetViewControls()->GetSettings() );
KIGFX::VIEW_CONTROLS* parentViewControls = m_parent->GetCanvas()->GetViewControls();
m_padPreviewGAL->GetViewControls()->ApplySettings( parentViewControls->GetSettings() );
m_padPreviewGAL->Show();
@ -287,6 +290,8 @@ void DIALOG_PAD_PROPERTIES::prepareCanvas()
settings->SetSketchMode( LAYER_PAD_BK, sketchMode );
settings->SetSketchModeGraphicItems( sketchMode );
settings->SetHighContrast( false );
// gives a non null grid size (0.001mm) because GAL layer does not like a 0 size grid:
double gridsize = 0.001 * IU_PER_MM;
view->GetGAL()->SetGridSize( VECTOR2D( gridsize, gridsize ) );
@ -316,6 +321,9 @@ void DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues()
m_tcChamferRatio->ChangeValue( ratio );
m_tcChamferRatio1->ChangeValue( ratio );
}
m_previewNotebook->ChangeSelection( 0 );
redraw();
}
@ -339,6 +347,8 @@ void DIALOG_PAD_PROPERTIES::onCornerRadiusChange( wxCommandEvent& event )
auto ratio = wxString::Format( "%.1f", m_dummyPad->GetRoundRectRadiusRatio() * 100 );
m_tcCornerSizeRatio->ChangeValue( ratio );
m_tcCornerSizeRatio1->ChangeValue( ratio );
m_previewNotebook->ChangeSelection( 0 );
redraw();
}
@ -422,8 +432,10 @@ void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange( wxCommandEvent& event )
{
transferDataToPad( m_dummyPad );
m_cornerRadius.ChangeValue( m_dummyPad->GetRoundRectCornerRadius() );
redraw();
}
m_previewNotebook->ChangeSelection( 0 );
redraw();
}
@ -436,11 +448,6 @@ void DIALOG_PAD_PROPERTIES::initValues()
// because nets are living only in the board managed by the board editor
m_canEditNetName = m_parent->IsType( FRAME_PCB_EDITOR );
// Setup layers names from board
// Should be made first, before calling m_rbCopperLayersSel->SetSelection()
m_rbCopperLayersSel->SetString( 0, m_board->GetLayerName( F_Cu ) );
m_rbCopperLayersSel->SetString( 1, m_board->GetLayerName( B_Cu ) );
m_PadLayerAdhCmp->SetLabel( m_board->GetLayerName( F_Adhes ) );
m_PadLayerAdhCu->SetLabel( m_board->GetLayerName( B_Adhes ) );
m_PadLayerPateCmp->SetLabel( m_board->GetLayerName( F_Paste ) );
@ -580,9 +587,6 @@ void DIALOG_PAD_PROPERTIES::initValues()
NORMALIZE_ANGLE_180( angle ); // ? normalizing is in D_PAD::SetOrientation()
// Set layers used by this pad: :
setPadLayersList( m_dummyPad->GetLayerSet() );
// Pad Orient
// Note: use ChangeValue() instead of SetValue() so that we don't generate events
m_orientation->ChangeValue( StringFromValue( EDA_UNITS::DEGREES, angle ) );
@ -667,7 +671,8 @@ void DIALOG_PAD_PROPERTIES::initValues()
// Update some dialog widgets state (Enable/disable options):
wxCommandEvent cmd_event;
setPadLayersList( m_dummyPad->GetLayerSet() );
setPadLayersList( m_dummyPad->GetLayerSet(), m_dummyPad->GetRemoveUnconnected(),
m_dummyPad->GetKeepTopBottom() );
OnPadShapeSelection( cmd_event );
OnOffsetCheckbox( cmd_event );
@ -780,6 +785,9 @@ void DIALOG_PAD_PROPERTIES::onChangePadMode( wxCommandEvent& event )
settings->SetSketchMode( LAYER_PAD_BK, m_sketchPreview );
settings->SetSketchModeGraphicItems( m_sketchPreview );
settings->SetHighContrast( false );
m_previewNotebook->ChangeSelection( 0 );
redraw();
}
@ -879,6 +887,7 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
if( m_MainSizer->GetSize().y < m_MainSizer->GetMinSize().y )
m_MainSizer->SetSizeHints( this );
m_previewNotebook->ChangeSelection( 0 );
redraw();
}
@ -886,6 +895,7 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
{
transferDataToPad( m_dummyPad );
m_previewNotebook->ChangeSelection( 0 );
redraw();
}
@ -893,10 +903,32 @@ void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
{
transferDataToPad( m_dummyPad );
m_previewNotebook->ChangeSelection( 0 );
redraw();
}
void DIALOG_PAD_PROPERTIES::UpdateLayersDropdown()
{
m_rbCopperLayersSel->Clear();
if( m_PadType->GetSelection() == 0 || m_PadType->GetSelection() == 3 )
{
m_rbCopperLayersSel->Append( _( "All copper layers" ) );
m_rbCopperLayersSel->Append( wxString::Format( _( "%s, %s and connected layers" ),
m_board->GetLayerName( F_Cu ),
m_board->GetLayerName( B_Cu ) ) );
m_rbCopperLayersSel->Append( _( "Connected layers only" ) );
m_rbCopperLayersSel->Append( _( "None" ) );
}
else
{
m_rbCopperLayersSel->Append( m_board->GetLayerName( F_Cu ) );
m_rbCopperLayersSel->Append( m_board->GetLayerName( B_Cu ) );
}
}
void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
{
int ii = m_PadType->GetSelection();
@ -916,8 +948,8 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
case 4: /* Aperture */ hasHole = false; hasConnection = false; hasProperty = true; break;
}
LSET layer_mask = std_pad_layers[ii];
setPadLayersList( layer_mask );
setPadLayersList( std_pad_layers[ii], m_dummyPad->GetRemoveUnconnected(),
m_dummyPad->GetKeepTopBottom() );
if( !hasHole )
{
@ -947,6 +979,10 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
m_choiceFabProperty->Enable( hasProperty );
m_previewNotebook->SetSelection( hasHole ? 1 : 0 );
UpdateLayersDropdown();
transferDataToPad( m_dummyPad );
redraw();
}
@ -997,18 +1033,49 @@ void DIALOG_PAD_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
}
void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask )
void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask, bool remove_unconnected,
bool keep_top_bottom )
{
UpdateLayersDropdown();
LSET cu_set = layer_mask & LSET::AllCuMask();
if( cu_set == LSET( F_Cu ) )
m_rbCopperLayersSel->SetSelection( 0 );
else if( cu_set == LSET( B_Cu ) )
m_rbCopperLayersSel->SetSelection( 1 );
else if( cu_set.any() )
m_rbCopperLayersSel->SetSelection( 2 );
if( m_PadType->GetSelection() == 0 || m_PadType->GetSelection() == 3 )
{
if( !cu_set.any() )
{
m_rbCopperLayersSel->SetSelection( 3 );
m_stackupImage->SetBitmap( wxBitmap() );
}
else if( !remove_unconnected )
{
m_rbCopperLayersSel->SetSelection( 0 );
m_stackupImage->SetBitmap( KiBitmap( pads_reset_unused_xpm ) );
}
else if( keep_top_bottom )
{
m_rbCopperLayersSel->SetSelection( 1 );
m_stackupImage->SetBitmap( KiBitmap( pads_remove_unused_keep_bottom_xpm ) );
}
else
{
m_rbCopperLayersSel->SetSelection( 2 );
m_stackupImage->SetBitmap( KiBitmap( pads_remove_unused_xpm ) );
}
}
else
m_rbCopperLayersSel->SetSelection( 3 );
{
if( cu_set == LSET( F_Cu ) )
{
m_rbCopperLayersSel->SetSelection( 0 );
m_stackupImage->SetBitmap( wxBitmap() );
}
else
{
m_rbCopperLayersSel->SetSelection( 1 );
m_stackupImage->SetBitmap( wxBitmap() );
}
}
m_PadLayerAdhCmp->SetValue( layer_mask[F_Adhes] );
m_PadLayerAdhCu->SetValue( layer_mask[B_Adhes] );
@ -1029,6 +1096,31 @@ void DIALOG_PAD_PROPERTIES::setPadLayersList( LSET layer_mask )
}
void DIALOG_PAD_PROPERTIES::OnSetCopperLayers( wxCommandEvent& event )
{
if( m_PadType->GetSelection() == 0 || m_PadType->GetSelection() == 3 )
{
m_previewNotebook->ChangeSelection( 1 );
switch( event.GetSelection() )
{
case 0: m_stackupImage->SetBitmap( KiBitmap( pads_reset_unused_xpm ) ); break;
case 1: m_stackupImage->SetBitmap( KiBitmap( pads_remove_unused_keep_bottom_xpm ) ); break;
case 2: m_stackupImage->SetBitmap( KiBitmap( pads_remove_unused_xpm ) ); break;
case 3: m_stackupImage->SetBitmap( wxBitmap() ); break;
}
}
else
{
m_previewNotebook->ChangeSelection( 0 );
m_stackupImage->SetBitmap( wxBitmap() );
}
transferDataToPad( m_dummyPad );
redraw();
}
// Called when select/deselect a layer.
void DIALOG_PAD_PROPERTIES::OnSetLayers( wxCommandEvent& event )
{
@ -1687,13 +1779,44 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
aPad->SetProperty( getSelectedProperty() );
LSET padLayerMask;
int copperLayersChoice = m_rbCopperLayersSel->GetSelection();
switch( m_rbCopperLayersSel->GetSelection() )
if( m_PadType->GetSelection() == 0 || m_PadType->GetSelection() == 3 )
{
case 0: padLayerMask.set( F_Cu ); break;
case 1: padLayerMask.set( B_Cu ); break;
case 2: padLayerMask |= LSET::AllCuMask(); break;
case 3: break; // No copper layers
switch( copperLayersChoice )
{
case 0:
// All copper layers
padLayerMask |= LSET::AllCuMask();
aPad->SetRemoveUnconnected( false );
break;
case 1:
// Front, back and connected
padLayerMask |= LSET::AllCuMask();
aPad->SetRemoveUnconnected( true );
aPad->SetKeepTopBottom( true );
break;
case 2:
// Connected only
padLayerMask |= LSET::AllCuMask();
aPad->SetRemoveUnconnected( true );
aPad->SetKeepTopBottom( false );
break;
case 3:
// No copper layers
break;
}
}
else
{
switch( copperLayersChoice )
{
case 0: padLayerMask.set( F_Cu ); break;
case 1: padLayerMask.set( B_Cu ); break;
}
}
if( m_PadLayerAdhCmp->GetValue() )

View File

@ -101,7 +101,7 @@ private:
* updates the CheckBox states in pad layers list,
* @param layer_mask = pad layer mask (ORed layers bit mask)
*/
void setPadLayersList( LSET layer_mask );
void setPadLayersList( LSET layer_mask, bool remove_unconnected, bool keep_top_bottom );
/// Copy values from dialog field to aPad's members
bool transferDataToPad( D_PAD* aPad );
@ -127,6 +127,8 @@ private:
void PadOrientEvent( wxCommandEvent& event ) override;
void PadTypeSelected( wxCommandEvent& event ) override;
void UpdateLayersDropdown();
void OnSetCopperLayers( wxCommandEvent& event ) override;
void OnSetLayers( wxCommandEvent& event ) override;
// Called when corner setup value is changed for rounded rect pads

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -86,7 +86,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_LeftBoxSizer->Add( gbSizerCommon, 0, wxEXPAND|wxBOTTOM, 5 );
m_LeftBoxSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_LeftBoxSizer->Add( 0, 5, 0, wxEXPAND, 5 );
m_staticline5 = new wxStaticLine( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_LeftBoxSizer->Add( m_staticline5, 0, wxEXPAND, 5 );
@ -393,7 +393,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_LeftBoxSizer->Add( gbSizerHole, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
m_LeftBoxSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_LeftBoxSizer->Add( 0, 5, 0, wxEXPAND, 5 );
m_staticline7 = new wxStaticLine( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
m_LeftBoxSizer->Add( m_staticline7, 0, wxEXPAND|wxBOTTOM, 5 );
@ -472,9 +472,6 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_LeftBoxSizer->Add( fgSizerPadToDie, 0, wxEXPAND, 5 );
m_LeftBoxSizer->Add( 0, 3, 1, wxEXPAND, 5 );
bGeneralSizer->Add( m_LeftBoxSizer, 0, wxEXPAND|wxALL, 5 );
m_middleBoxSizer = new wxBoxSizer( wxVERTICAL );
@ -496,21 +493,16 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_LayersSizer->Add( m_FlippedWarningSizer, 0, wxEXPAND|wxBOTTOM, 5 );
wxBoxSizer* bSizer11;
bSizer11 = new wxBoxSizer( wxHORIZONTAL );
m_copperLayersLabel = new wxStaticText( m_LayersSizer->GetStaticBox(), wxID_ANY, _("Copper layers:"), wxDefaultPosition, wxDefaultSize, 0 );
m_copperLayersLabel->Wrap( -1 );
m_copperLayersLabel->SetFont( wxFont( 11, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
m_staticText511 = new wxStaticText( m_LayersSizer->GetStaticBox(), wxID_ANY, _("Copper:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText511->Wrap( -1 );
bSizer11->Add( m_staticText511, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxTOP, 4 );
m_LayersSizer->Add( m_copperLayersLabel, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxRIGHT|wxLEFT, 4 );
wxString m_rbCopperLayersSelChoices[] = { _("Front layer"), _("Back layer"), _("All copper layers"), _("None") };
int m_rbCopperLayersSelNChoices = sizeof( m_rbCopperLayersSelChoices ) / sizeof( wxString );
m_rbCopperLayersSel = new wxChoice( m_LayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_rbCopperLayersSelNChoices, m_rbCopperLayersSelChoices, 0 );
wxArrayString m_rbCopperLayersSelChoices;
m_rbCopperLayersSel = new wxChoice( m_LayersSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_rbCopperLayersSelChoices, 0 );
m_rbCopperLayersSel->SetSelection( 0 );
bSizer11->Add( m_rbCopperLayersSel, 1, wxALL|wxEXPAND|wxTOP, 4 );
m_LayersSizer->Add( bSizer11, 0, wxEXPAND, 5 );
m_LayersSizer->Add( m_rbCopperLayersSel, 1, wxALL|wxEXPAND|wxTOP, 4 );
m_techLayersLabel = new wxStaticText( m_LayersSizer->GetStaticBox(), wxID_ANY, _("Technical layers:"), wxDefaultPosition, wxDefaultSize, 0 );
m_techLayersLabel->Wrap( -1 );
@ -847,6 +839,9 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
bSizerUpper->Add( m_notebook, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticline8 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_VERTICAL );
bSizerUpper->Add( m_staticline8, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerDisplayPad;
bSizerDisplayPad = new wxBoxSizer( wxVERTICAL );
@ -867,25 +862,49 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
bSizerDisplayPad->Add( m_parentInfoLine2, 0, wxRIGHT, 3 );
bSizerDisplayPad->Add( 0, 0, 1, wxEXPAND, 5 );
bSizerDisplayPad->Add( 0, 10, 0, wxEXPAND, 5 );
m_previewNotebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_previewNotebook->SetMinSize( wxSize( -1,320 ) );
m_boardViewPanel = new wxPanel( m_previewNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_padPreviewSizer = new wxBoxSizer( wxVERTICAL );
m_padPreviewSizer->SetMinSize( wxSize( 280,-1 ) );
bSizerDisplayPad->Add( m_padPreviewSizer, 12, wxEXPAND, 5 );
m_boardViewPanel->SetSizer( m_padPreviewSizer );
m_boardViewPanel->Layout();
m_padPreviewSizer->Fit( m_boardViewPanel );
m_previewNotebook->AddPage( m_boardViewPanel, _("Board View"), false );
m_stackupPanel = new wxPanel( m_previewNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer30;
bSizer30 = new wxBoxSizer( wxVERTICAL );
bSizer30->Add( 0, 0, 1, wxEXPAND, 5 );
m_stackupImage = new wxStaticBitmap( m_stackupPanel, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
bSizer30->Add( m_stackupImage, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bSizer30->Add( 0, 0, 1, wxEXPAND, 5 );
m_stackupPanel->SetSizer( bSizer30 );
m_stackupPanel->Layout();
bSizer30->Fit( m_stackupPanel );
m_previewNotebook->AddPage( m_stackupPanel, _("Stackup View"), false );
bSizerDisplayPad->Add( m_previewNotebook, 12, wxEXPAND|wxRIGHT, 5 );
m_cbShowPadOutline = new wxCheckBox( this, wxID_ANY, _("Show pad in outline mode"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerDisplayPad->Add( m_cbShowPadOutline, 0, wxBOTTOM|wxRIGHT|wxTOP, 5 );
bSizerDisplayPad->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticline13 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerDisplayPad->Add( m_staticline13, 0, wxEXPAND|wxTOP|wxBOTTOM, 10 );
bSizerDisplayPad->Add( m_staticline13, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10 );
bSizerUpper->Add( bSizerDisplayPad, 1, wxEXPAND|wxTOP|wxRIGHT, 10 );
bSizerUpper->Add( bSizerDisplayPad, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_MainSizer->Add( bSizerUpper, 1, wxEXPAND, 5 );
@ -938,7 +957,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_offsetXCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_offsetYCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_padToDieOpt->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPadToDieCheckbox ), NULL, this );
m_rbCopperLayersSel->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );
m_rbCopperLayersSel->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetCopperLayers ), NULL, this );
m_PadLayerAdhCmp->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );
m_PadLayerAdhCu->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );
m_PadLayerPateCmp->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );
@ -998,7 +1017,7 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
m_offsetXCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_offsetYCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnValuesChanged ), NULL, this );
m_padToDieOpt->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPadToDieCheckbox ), NULL, this );
m_rbCopperLayersSel->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );
m_rbCopperLayersSel->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetCopperLayers ), NULL, this );
m_PadLayerAdhCmp->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );
m_PadLayerAdhCu->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );
m_PadLayerPateCmp->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnSetLayers ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -10,10 +10,8 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
class TEXT_CTRL_EVAL;
class WX_GRID;
class wxListView;
#include "dialog_shim.h"
#include <wx/string.h>
@ -154,7 +152,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxBoxSizer* m_FlippedWarningSizer;
wxStaticBitmap* m_FlippedWarningIcon;
wxStaticText* m_staticText86;
wxStaticText* m_staticText511;
wxStaticText* m_copperLayersLabel;
wxChoice* m_rbCopperLayersSel;
wxStaticText* m_techLayersLabel;
wxCheckBox* m_PadLayerAdhCmp;
@ -211,9 +209,14 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxButton* m_buttonDup;
wxButton* m_buttonGeometry;
wxButton* m_buttonDel;
wxStaticLine* m_staticline8;
wxStaticText* m_parentInfoLine1;
wxStaticText* m_parentInfoLine2;
wxNotebook* m_previewNotebook;
wxPanel* m_boardViewPanel;
wxBoxSizer* m_padPreviewSizer;
wxPanel* m_stackupPanel;
wxStaticBitmap* m_stackupImage;
wxCheckBox* m_cbShowPadOutline;
wxStaticLine* m_staticline13;
wxStdDialogButtonSizer* m_sdbSizer;
@ -233,6 +236,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
virtual void OnDrillShapeSelected( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOffsetCheckbox( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPadToDieCheckbox( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetCopperLayers( wxCommandEvent& event ) { event.Skip(); }
virtual void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) { event.Skip(); }
virtual void onPrimitiveDClick( wxMouseEvent& event ) { event.Skip(); }
virtual void OnPrimitiveSelection( wxListEvent& event ) { event.Skip(); }

View File

@ -706,31 +706,14 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
{
const D_PAD* pad = aPad;
/// We setup the dummy pad to use in case we need to only draw the hole outline rather
/// than the pad itself
D_PAD dummypad( aPad->GetParent() );
dummypad.SetNetCode( aPad->GetNetCode() );
dummypad.SetSize( aPad->GetDrillSize() );
dummypad.SetOrientation( aPad->GetOrientation() );
dummypad.SetShape( aPad->GetDrillShape() == PAD_DRILL_SHAPE_OBLONG ? PAD_SHAPE_OVAL
: PAD_SHAPE_CIRCLE );
dummypad.SetPosition( aPad->GetPosition() );
/// Pads not connected to copper are optionally not drawn
/// We draw instead the hole size to ensure we show the proper clearance
if( IsCopperLayer( aLayer ) && !aPad->IsPadOnLayer( aLayer ) )
pad = &dummypad;
// Draw description layer
if( IsNetnameLayer( aLayer ) )
{
// Is anything that we can display enabled?
if( m_pcbSettings.m_netNamesOnPads || m_pcbSettings.m_padNumbers )
{
bool displayNetname = ( m_pcbSettings.m_netNamesOnPads && !pad->GetNetname().empty() );
EDA_RECT padBBox = pad->GetBoundingBox();
bool displayNetname = ( m_pcbSettings.m_netNamesOnPads && !aPad->GetNetname().empty() );
EDA_RECT padBBox = aPad->GetBoundingBox();
VECTOR2D position = padBBox.Centre();
VECTOR2D padsize = VECTOR2D( padBBox.GetSize() );
@ -788,7 +771,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
if( displayNetname )
{
wxString netname = UnescapeString( pad->GetShortNetname() );
wxString netname = UnescapeString( aPad->GetShortNetname() );
// calculate the size of net name text:
double tsize = 1.5 * padsize.x / netname.Length();
tsize = std::min( tsize, size );
@ -803,7 +786,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
if( m_pcbSettings.m_padNumbers )
{
const wxString& padName = pad->GetName();
const wxString& padName = aPad->GetName();
textpos.y = -textpos.y;
double tsize = 1.5 * padsize.x / padName.Length();
tsize = std::min( tsize, size );
@ -828,10 +811,10 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// Pad hole color is pad-type-specific: the background color for plated holes and the
// pad color for NPTHs. Note the extra check for "should be" NPTHs to keep mis-marked
// holes with no annular ring from getting "lost" in the background.
if( ( aLayer == LAYER_PADS_PLATEDHOLES ) && !pad->PadShouldBeNPTH() )
if( ( aLayer == LAYER_PADS_PLATEDHOLES ) && !aPad->PadShouldBeNPTH() )
color = m_pcbSettings.GetBackgroundColor();
else
color = m_pcbSettings.GetColor( pad, aLayer );
color = m_pcbSettings.GetColor( aPad, aLayer );
if( m_pcbSettings.m_sketchMode[LAYER_PADS_TH] )
{
@ -852,7 +835,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
// Choose drawing settings depending on if we are drawing a pad itself or a hole
if( aLayer == LAYER_PADS_PLATEDHOLES || aLayer == LAYER_NON_PLATEDHOLES )
{
const SHAPE_SEGMENT* seg = pad->GetEffectiveHoleShape();
const SHAPE_SEGMENT* seg = aPad->GetEffectiveHoleShape();
if( seg->GetSeg().A == seg->GetSeg().B ) // Circular hole
m_gal->DrawCircle( seg->GetSeg().A, seg->GetWidth()/2 );
@ -861,19 +844,19 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
}
else
{
wxSize pad_size = pad->GetSize();
wxSize pad_size = aPad->GetSize();
wxSize margin;
switch( aLayer )
{
case F_Mask:
case B_Mask:
margin.x = margin.y = pad->GetSolderMaskMargin();
margin.x = margin.y = aPad->GetSolderMaskMargin();
break;
case F_Paste:
case B_Paste:
margin = pad->GetSolderPasteMargin();
margin = aPad->GetSolderPasteMargin();
break;
default:
@ -883,11 +866,11 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
if( margin.x != margin.y )
{
const_cast<D_PAD*>( pad )->SetSize( pad_size + margin + margin );
const_cast<D_PAD*>( aPad )->SetSize( pad_size + margin + margin );
margin.x = margin.y = 0;
}
const std::shared_ptr<SHAPE_COMPOUND> shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( pad->GetEffectiveShape() );
const std::shared_ptr<SHAPE_COMPOUND> shapes = std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
if( shapes && shapes->Size() == 1 && shapes->Shapes()[0]->Type() == SH_SEGMENT )
{
@ -902,12 +885,12 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
else
{
SHAPE_POLY_SET polySet;
pad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x );
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), margin.x );
m_gal->DrawPolygon( polySet );
}
if( pad->GetSize() != pad_size )
const_cast<D_PAD*>( pad )->SetSize( pad_size );
if( aPad->GetSize() != pad_size )
const_cast<D_PAD*>( aPad )->SetSize( pad_size );
}
// Clearance outlines
@ -925,7 +908,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
int clearance = aPad->GetClearance( aPad->GetLayer() );
const std::shared_ptr<SHAPE_COMPOUND> shapes =
std::dynamic_pointer_cast<SHAPE_COMPOUND>( pad->GetEffectiveShape() );
std::dynamic_pointer_cast<SHAPE_COMPOUND>( aPad->GetEffectiveShape() );
if( shapes && shapes->Size() == 1 && shapes->Shapes()[0]->Type() == SH_SEGMENT )
{
@ -940,7 +923,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
else
{
SHAPE_POLY_SET polySet;
pad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), clearance );
aPad->TransformShapeWithClearanceToPolygon( polySet, ToLAYER_ID( aLayer ), clearance );
m_gal->DrawPolygon( polySet );
}
}

View File

@ -285,11 +285,13 @@ const APPEARANCE_CONTROLS::APPEARANCE_SETTING APPEARANCE_CONTROLS::s_objectSetti
RR(),
RR( _( "Footprints Front" ), LAYER_MOD_FR, _( "Show footprints that are on board's front" ) ),
RR( _( "Footprints Back" ), LAYER_MOD_BK, _( "Show footprints that are on board's back" ) ),
RR( _( "Through-hole Pads" ),LAYER_PADS_TH, _( "Show through-hole pads" ) ),
RR( _( "Values" ), LAYER_MOD_VALUES, _( "Show footprint values" ) ),
RR( _( "References" ), LAYER_MOD_REFERENCES, _( "Show footprint references" ) ),
RR( _( "Footprint Text" ), LAYER_MOD_TEXT_FR, _( "Show footprint text" ) ),
RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, _( "Show footprint text marked as invisible" ) ),
RR(),
RR(),
RR( _( "Ratsnest" ), LAYER_RATSNEST, _( "Show unconnected nets as a ratsnest") ),
RR( _( "No-Connects" ), LAYER_NO_CONNECTS, _( "Show a marker on pads which have no net connected" ) ),
RR( _( "DRC Warnings" ), LAYER_DRC_WARNING, _( "DRC violations with a Warning severity" ) ),