Give the user a bit of help with board thickness.
Fixes https://gitlab.com/kicad/code/kicad/issues/3807
This commit is contained in:
parent
a8028e57ee
commit
a6cdb6440a
|
@ -40,6 +40,7 @@
|
|||
#include <wx/dataobj.h>
|
||||
#include "dialog_dielectric_list_manager.h"
|
||||
#include <wx/wupdlock.h>
|
||||
#include <wx/richmsgdlg.h>
|
||||
|
||||
// Some wx widget ID to know what widget has fired a event:
|
||||
#define ID_INCREMENT 256 // space between 2 ID type. Bigger than the layer count max
|
||||
|
@ -78,6 +79,7 @@ PANEL_SETUP_BOARD_STACKUP::PANEL_SETUP_BOARD_STACKUP( PAGED_DIALOG* aParent, PCB
|
|||
m_units = aFrame->GetUserUnits();
|
||||
|
||||
m_enabledLayers = m_board->GetEnabledLayers() & BOARD_STACKUP::StackupAllowedBrdLayers();
|
||||
m_stackupMismatch = false;
|
||||
|
||||
// Calculates a good size for color swatches (icons) in this dialog
|
||||
wxClientDC dc( this );
|
||||
|
@ -872,15 +874,22 @@ void PANEL_SETUP_BOARD_STACKUP::buildLayerStackPanel( bool aCreatedInitialStacku
|
|||
// Transfer current UI settings to m_stackup but not to the board
|
||||
bool PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup()
|
||||
{
|
||||
// First, verify the list of layers currently in stackup:
|
||||
// if it does not mach the list of layers set in PANEL_SETUP_LAYERS
|
||||
// prompt the user to update the stackup
|
||||
// First, verify the list of layers currently in stackup: if it doesn't match the list
|
||||
// of layers set in PANEL_SETUP_LAYERS prompt the user to update the stackup
|
||||
LSET layersList = m_panelLayers->GetUILayerMask() & BOARD_STACKUP::StackupAllowedBrdLayers();
|
||||
|
||||
if( m_enabledLayers != layersList )
|
||||
{
|
||||
m_parentDialog->SetError( _( "Stackup layers don't match board layers" ), this,
|
||||
m_thicknessCtrl );
|
||||
for( size_t i = 0; i < m_parentDialog->GetTreebook()->GetPageCount(); ++i )
|
||||
{
|
||||
if( m_parentDialog->GetTreebook()->GetPage( i ) == this )
|
||||
{
|
||||
m_parentDialog->GetTreebook()->SetSelection( i );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_stackupMismatch = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1395,28 +1404,15 @@ wxColor PANEL_SETUP_BOARD_STACKUP::getColorIconItem( int aRow )
|
|||
|
||||
switch( st_item->GetType() )
|
||||
{
|
||||
case BS_ITEM_TYPE_COPPER:
|
||||
color = copperColor;
|
||||
break;
|
||||
case BS_ITEM_TYPE_COPPER: color = copperColor; break;
|
||||
case BS_ITEM_TYPE_DIELECTRIC: color = dielectricColor; break;
|
||||
case BS_ITEM_TYPE_SOLDERMASK: color = GetSelectedColor( aRow ); break;
|
||||
case BS_ITEM_TYPE_SILKSCREEN: color = GetSelectedColor( aRow ); break;
|
||||
case BS_ITEM_TYPE_SOLDERPASTE: color = pasteColor; break;
|
||||
|
||||
case BS_ITEM_TYPE_DIELECTRIC:
|
||||
color = dielectricColor;
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_SOLDERMASK:
|
||||
color = GetSelectedColor( aRow );
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_SILKSCREEN:
|
||||
color = GetSelectedColor( aRow );
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_SOLDERPASTE:
|
||||
color = pasteColor;
|
||||
break;
|
||||
|
||||
case BS_ITEM_TYPE_UNDEFINED: // Should not happen
|
||||
wxASSERT( 0 );
|
||||
default:
|
||||
case BS_ITEM_TYPE_UNDEFINED:
|
||||
wxFAIL_MSG( "PANEL_SETUP_BOARD_STACKUP::getColorIconItem: unrecognized item type" );
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1446,7 +1442,8 @@ void PANEL_SETUP_BOARD_STACKUP::updateIconColor( int aRow )
|
|||
}
|
||||
|
||||
|
||||
wxBitmapComboBox* PANEL_SETUP_BOARD_STACKUP::createBmComboBox( BOARD_STACKUP_ITEM* aStackupItem, int aRow )
|
||||
wxBitmapComboBox* PANEL_SETUP_BOARD_STACKUP::createBmComboBox( BOARD_STACKUP_ITEM* aStackupItem,
|
||||
int aRow )
|
||||
{
|
||||
wxBitmapComboBox* combo = new wxBitmapComboBox( m_scGridWin, ID_ITEM_COLOR+aRow,
|
||||
wxEmptyString, wxDefaultPosition,
|
||||
|
@ -1524,3 +1521,32 @@ void drawBitmap( wxBitmap& aBitmap, wxColor aColor )
|
|||
p.OffsetY(data, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PANEL_SETUP_BOARD_STACKUP::OnUpdateUI( wxUpdateUIEvent& event )
|
||||
{
|
||||
// Handle an error. This is delayed to OnUpdateUI so that we can change the focus
|
||||
// even when the original validation was triggered from a killFocus event, and so
|
||||
// that the corresponding notebook page can be shown in the background when triggered
|
||||
// from an OK.
|
||||
if( m_stackupMismatch )
|
||||
{
|
||||
m_stackupMismatch = false;
|
||||
|
||||
wxRichMessageDialog dlg( this,
|
||||
_( "Physical stackup has not been updated to match layer count." ),
|
||||
_( "Update Physical Stackup" ),
|
||||
wxOK | wxCENTER | wxICON_WARNING );
|
||||
dlg.ShowCheckBox( _( "Update dielectric thickness from board thickness" ), true );
|
||||
|
||||
dlg.ShowModal();
|
||||
|
||||
if( dlg.IsCheckBoxChecked() )
|
||||
{
|
||||
wxCommandEvent dummy;
|
||||
onCalculateDielectricThickness( dummy );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ private:
|
|||
void onAddDielectricLayer( wxCommandEvent& event ) override;
|
||||
void onRemoveDielectricLayer( wxCommandEvent& event ) override;
|
||||
void onRemoveDielUI( wxUpdateUIEvent& event ) override;
|
||||
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
||||
|
||||
/** Update the icons color (swatches in first grid column)
|
||||
* @param aRow is the row (index in m_rowUiItemsList) that manages the icon to update.
|
||||
|
@ -244,6 +245,9 @@ private:
|
|||
// when building the BOARD_STACKUP_ITEM list editor and connected to command events
|
||||
// Used to disconnect event handlers
|
||||
std::vector<wxControl*> m_controlItemsList;
|
||||
|
||||
bool m_stackupMismatch; // flags an error when the stackup was not updated
|
||||
// to match changes made to the enabled layers
|
||||
};
|
||||
|
||||
#endif // #ifndef PANEL_SETUP_BOARD_STACKUP_H
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -189,6 +189,7 @@ PANEL_SETUP_BOARD_STACKUP_BASE::PANEL_SETUP_BOARD_STACKUP_BASE( wxWindow* parent
|
|||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::OnUpdateUI ) );
|
||||
m_thicknessCtrl->Connect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onUpdateThicknessValue ), NULL, this );
|
||||
m_buttonSetDielectricThickness->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onCalculateDielectricThickness ), NULL, this );
|
||||
m_buttonAddDielectricLayer->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onAddDielectricLayer ), NULL, this );
|
||||
|
@ -200,6 +201,7 @@ PANEL_SETUP_BOARD_STACKUP_BASE::PANEL_SETUP_BOARD_STACKUP_BASE( wxWindow* parent
|
|||
PANEL_SETUP_BOARD_STACKUP_BASE::~PANEL_SETUP_BOARD_STACKUP_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::OnUpdateUI ) );
|
||||
m_thicknessCtrl->Disconnect( wxEVT_UPDATE_UI, wxUpdateUIEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onUpdateThicknessValue ), NULL, this );
|
||||
m_buttonSetDielectricThickness->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onCalculateDielectricThickness ), NULL, this );
|
||||
m_buttonAddDielectricLayer->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP_BASE::onAddDielectricLayer ), NULL, this );
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<event name="OnUpdateUI">OnUpdateUI</event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bMainSizer</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version v3.8.0)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -73,6 +73,7 @@ class PANEL_SETUP_BOARD_STACKUP_BASE : public wxPanel
|
|||
wxButton* m_buttonExport;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnUpdateUI( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void onUpdateThicknessValue( wxUpdateUIEvent& event ) { event.Skip(); }
|
||||
virtual void onCalculateDielectricThickness( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onAddDielectricLayer( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
|
Loading…
Reference in New Issue