Add restrictions on copper layers for NPTH pads.

Also updates the stackup graphics to include NPTH pads.

Fixes https://gitlab.com/kicad/code/kicad/issues/5477
This commit is contained in:
Jeff Young 2020-09-09 00:39:33 +01:00
parent c090f1b646
commit 59c6635286
5 changed files with 1045 additions and 1412 deletions

View File

@ -175,8 +175,7 @@ DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aP
infoFont.SetSymbolicSize( wxFONTSIZE_SMALL );
m_copperLayersLabel->SetFont( infoFont );
m_techLayersLabel->SetFont( infoFont );
m_parentInfoLine1->SetFont( infoFont );
m_parentInfoLine2->SetFont( infoFont );
m_parentInfo->SetFont( infoFont );
infoFont.SetStyle( wxFONTSTYLE_ITALIC );
m_nonCopperNote->SetFont( infoFont );
@ -239,25 +238,6 @@ void DIALOG_PAD_PROPERTIES::OnCancel( wxCommandEvent& event )
}
void DIALOG_PAD_PROPERTIES::autoSelectPreview( int aPage )
{
// This is the place to turn auto-select off.
// (Just make sure the redraw() call remains.)
// We have focus issues on GTK when we try to set the notebook page while a user is
// typing into a text control.
wxWindow* focus = FindFocus();
m_previewNotebook->ChangeSelection( aPage );
if( aPage == 0 )
redraw();
if( focus && dynamic_cast<wxTextEntry*>( focus ) )
focus->SetFocus();
}
void DIALOG_PAD_PROPERTIES::enablePrimitivePage( bool aEnable )
{
// Enable or disable the widgets in page managing custom shape primitives
@ -364,7 +344,7 @@ void DIALOG_PAD_PROPERTIES::onCornerRadiusChange( wxCommandEvent& event )
m_tcCornerSizeRatio->ChangeValue( ratio );
m_tcCornerSizeRatio1->ChangeValue( ratio );
autoSelectPreview( 0 );
redraw();
}
@ -449,7 +429,7 @@ void DIALOG_PAD_PROPERTIES::onCornerSizePercentChange( wxCommandEvent& event )
m_cornerRadius.ChangeValue( m_dummyPad->GetRoundRectCornerRadius() );
}
autoSelectPreview( 0 );
redraw();
}
@ -482,21 +462,18 @@ void DIALOG_PAD_PROPERTIES::initValues()
// Diplay parent footprint info
MODULE* footprint = m_currentPad->GetParent();
wxString msg1, msg2;
if( footprint )
{
msg1.Printf( _("Footprint %s (%s),"),
msg.Printf( _("Footprint %s (%s), %s, rotated %.1f deg"),
footprint->Reference().GetShownText(),
footprint->Value().GetShownText() );
msg2.Printf( _("%s, rotated %.1f deg"),
footprint->Value().GetShownText(),
footprint->IsFlipped() ? _( "back side (mirrored)" )
: _( "front side" ),
footprint->GetOrientation() / 10.0 );
}
m_parentInfoLine1->SetLabel( msg1 );
m_parentInfoLine2->SetLabel( msg2 );
m_parentInfo->SetLabel( msg );
}
if( m_isFlipped )
@ -803,7 +780,7 @@ void DIALOG_PAD_PROPERTIES::onChangePadMode( wxCommandEvent& event )
settings->SetHighContrast( false );
settings->SetContrastModeDisplay( HIGH_CONTRAST_MODE::NORMAL );
autoSelectPreview( 0 );
redraw();
}
@ -902,21 +879,21 @@ void DIALOG_PAD_PROPERTIES::OnPadShapeSelection( wxCommandEvent& event )
if( m_MainSizer->GetSize().y < m_MainSizer->GetMinSize().y )
m_MainSizer->SetSizeHints( this );
autoSelectPreview( 0 );
redraw();
}
void DIALOG_PAD_PROPERTIES::OnDrillShapeSelected( wxCommandEvent& event )
{
transferDataToPad( m_dummyPad );
autoSelectPreview( 0 );
redraw();
}
void DIALOG_PAD_PROPERTIES::PadOrientEvent( wxCommandEvent& event )
{
transferDataToPad( m_dummyPad );
autoSelectPreview( 0 );
redraw();
}
@ -1000,11 +977,10 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
m_choiceFabProperty->Enable( hasProperty );
m_previewNotebook->SetSelection( hasHole ? 1 : 0 );
UpdateLayersDropdown();
transferDataToPad( m_dummyPad );
redraw();
}
@ -1156,40 +1132,17 @@ bool DIALOG_PAD_PROPERTIES::Show( bool aShow )
m_stackupImage6->SetBitmap( KiBitmap( pads_npth_bottom_xpm ) );
m_stackupImage7->SetBitmap( KiBitmap( pads_npth_xpm ) );
m_stackupPanel->Layout();
Layout();
}
return retVal;
}
void DIALOG_PAD_PROPERTIES::OnPreviewPageChanged( wxNotebookEvent& event )
{
// It *should* work to set the stackup bitmaps in the constructor, but it doesn't.
// wxWidgets needs to have these set when the panel is visible for some reason.
// https://gitlab.com/kicad/code/kicad/-/issues/5534
m_stackupImage0->SetBitmap( KiBitmap( pads_reset_unused_xpm ) );
m_stackupImage1->SetBitmap( KiBitmap( pads_remove_unused_keep_bottom_xpm ) );
m_stackupImage2->SetBitmap( KiBitmap( pads_remove_unused_xpm ) );
m_stackupImage4->SetBitmap( KiBitmap( pads_npth_top_bottom_xpm ) );
m_stackupImage5->SetBitmap( KiBitmap( pads_npth_top_xpm ) );
m_stackupImage6->SetBitmap( KiBitmap( pads_npth_bottom_xpm ) );
m_stackupImage7->SetBitmap( KiBitmap( pads_npth_xpm ) );
m_stackupPanel->Layout();
event.Skip();
}
void DIALOG_PAD_PROPERTIES::OnSetCopperLayers( wxCommandEvent& event )
{
transferDataToPad( m_dummyPad );
if( m_PadType->GetSelection() == 0 || m_PadType->GetSelection() == 3 )
autoSelectPreview( 1 );
else
autoSelectPreview( 0 );
redraw();
}

View File

@ -96,8 +96,6 @@ private:
void updateRoundRectCornerValues();
void enablePrimitivePage( bool aEnable ); ///< enable (or disable) the primitive page editor
void autoSelectPreview( int aPage );
/**
* Function setPadLayersList
* updates the CheckBox states in pad layers list,
@ -115,7 +113,6 @@ private:
void OnResize( wxSizeEvent& event );
void OnCancel( wxCommandEvent& event ) override;
void OnUpdateUI( wxUpdateUIEvent& event ) override;
void OnPreviewPageChanged( wxNotebookEvent& event ) override;
void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override
{

View File

@ -837,10 +837,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_bSizerPanelPrimitives->Fit( m_panelCustomShapePrimitives );
m_notebook->AddPage( m_panelCustomShapePrimitives, _("Custom Shape Primitives"), false );
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 );
bSizerUpper->Add( m_notebook, 0, wxEXPAND|wxTOP|wxBOTTOM|wxLEFT, 5 );
wxBoxSizer* bSizerDisplayPad;
bSizerDisplayPad = new wxBoxSizer( wxVERTICAL );
@ -849,41 +846,10 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
bSizerDisplayPad->Add( 0, 0, 0, wxBOTTOM|wxEXPAND|wxTOP, 3 );
m_parentInfoLine1 = new wxStaticText( this, wxID_ANY, _("Footprint name"), wxDefaultPosition, wxDefaultSize, 0 );
m_parentInfoLine1->Wrap( -1 );
m_parentInfoLine1->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizerDisplayPad->Add( m_parentInfoLine1, 0, wxTOP, 8 );
m_parentInfoLine2 = new wxStaticText( this, wxID_ANY, _("side and rotation"), wxDefaultPosition, wxDefaultSize, 0 );
m_parentInfoLine2->Wrap( -1 );
m_parentInfoLine2->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bSizerDisplayPad->Add( m_parentInfoLine2, 0, wxRIGHT, 3 );
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 ) );
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_stackupImagesBook = new wxSimplebook( m_stackupPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
m_stackupImagesBook = new wxSimplebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_SIMPLE );
page0 = new wxPanel( m_stackupImagesBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* page0Sizer;
page0Sizer = new wxBoxSizer( wxVERTICAL );
@ -978,31 +944,42 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
page7Sizer->Fit( page7 );
m_stackupImagesBook->AddPage( page7, _("a page"), false );
bSizer30->Add( m_stackupImagesBook, 0, wxEXPAND|wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bSizerDisplayPad->Add( m_stackupImagesBook, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_boardViewPanel = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
m_padPreviewSizer = new wxBoxSizer( wxVERTICAL );
m_padPreviewSizer->SetMinSize( wxSize( 280,-1 ) );
m_boardViewPanel->SetSizer( m_padPreviewSizer );
m_boardViewPanel->Layout();
m_padPreviewSizer->Fit( m_boardViewPanel );
bSizerDisplayPad->Add( m_boardViewPanel, 1, wxEXPAND|wxALL, 2 );
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 );
m_staticline13 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerDisplayPad->Add( m_staticline13, 0, wxEXPAND|wxTOP|wxBOTTOM|wxRIGHT, 10 );
bSizerUpper->Add( bSizerDisplayPad, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bSizerUpper->Add( bSizerDisplayPad, 1, wxEXPAND|wxTOP|wxRIGHT, 10 );
m_MainSizer->Add( bSizerUpper, 1, wxEXPAND, 5 );
wxBoxSizer* bottomSizer;
bottomSizer = new wxBoxSizer( wxHORIZONTAL );
m_parentInfo = new wxStaticText( this, wxID_ANY, _("Footprint R1 (300K), back side (mirrored), rotated 180.0º"), wxDefaultPosition, wxDefaultSize, 0 );
m_parentInfo->Wrap( -1 );
m_parentInfo->SetFont( wxFont( 12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxEmptyString ) );
bottomSizer->Add( m_parentInfo, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT, 8 );
bottomSizer->Add( 20, 0, 1, wxEXPAND, 5 );
m_cbShowPadOutline = new wxCheckBox( this, wxID_ANY, _("Preview pad in sketch mode"), wxDefaultPosition, wxDefaultSize, 0 );
bottomSizer->Add( m_cbShowPadOutline, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bottomSizer->Add( 20, 0, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
@ -1010,7 +987,10 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
m_MainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
bottomSizer->Add( m_sdbSizer, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_MainSizer->Add( bottomSizer, 0, wxEXPAND|wxLEFT, 5 );
this->SetSizer( m_MainSizer );
@ -1073,7 +1053,6 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_buttonDup->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDuplicatePrimitive ), NULL, this );
m_buttonGeometry->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
m_buttonDel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDeletePrimitive ), NULL, this );
m_previewNotebook->Connect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPreviewPageChanged ), NULL, this );
m_cbShowPadOutline->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onChangePadMode ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );
}
@ -1134,7 +1113,6 @@ DIALOG_PAD_PROPERTIES_BASE::~DIALOG_PAD_PROPERTIES_BASE()
m_buttonDup->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDuplicatePrimitive ), NULL, this );
m_buttonGeometry->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onGeometryTransform ), NULL, this );
m_buttonDel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onDeletePrimitive ), NULL, this );
m_previewNotebook->Disconnect( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, wxNotebookEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnPreviewPageChanged ), NULL, this );
m_cbShowPadOutline->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::onChangePadMode ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PAD_PROPERTIES_BASE::OnCancel ), NULL, this );

File diff suppressed because it is too large Load Diff

View File

@ -209,13 +209,6 @@ 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;
wxSimplebook* m_stackupImagesBook;
wxPanel* page0;
wxStaticBitmap* m_stackupImage0;
@ -232,8 +225,10 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxStaticBitmap* m_stackupImage6;
wxPanel* page7;
wxStaticBitmap* m_stackupImage7;
wxPanel* m_boardViewPanel;
wxBoxSizer* m_padPreviewSizer;
wxStaticText* m_parentInfo;
wxCheckBox* m_cbShowPadOutline;
wxStaticLine* m_staticline13;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
@ -260,7 +255,6 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
virtual void onDuplicatePrimitive( wxCommandEvent& event ) { event.Skip(); }
virtual void onGeometryTransform( wxCommandEvent& event ) { event.Skip(); }
virtual void onDeletePrimitive( wxCommandEvent& event ) { event.Skip(); }
virtual void OnPreviewPageChanged( wxNotebookEvent& event ) { event.Skip(); }
virtual void onChangePadMode( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancel( wxCommandEvent& event ) { event.Skip(); }