41#include <wx/clipbrd.h>
42#include <wx/dataobj.h>
44#include <wx/wupdlock.h>
45#include <wx/richmsgdlg.h>
46#include <wx/dcclient.h>
47#include <wx/treebook.h>
48#include <wx/textdlg.h>
56#define ID_INCREMENT 256
74static void drawBitmap( wxBitmap& aBitmap, wxColor aColor );
97 wxClientDC dc(
this );
148 std::vector< BOARD_STACKUP_ROW_UI_ITEM* > items_candidate;
152 int min_thickness = 0;
162 wxCheckBox* cb_box =
dynamic_cast<wxCheckBox*
> ( ui_item.m_ThicknessLockCtrl );
164 if( cb_box && !cb_box->GetValue() )
166 items_candidate.push_back( &ui_item );
170 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
173 min_thickness += item_thickness;
178 if( min_thickness == 0 )
180 title.Printf(
_(
"Enter board thickness in %s:" ),
185 title.Printf(
_(
"Enter expected board thickness (min value %s):" ),
189 wxTextEntryDialog dlg(
this, title,
_(
"Adjust Unlocked Dielectric Layers" ) );
191 if( dlg.ShowModal() != wxID_OK )
196 if( iu_thickness < min_thickness )
205 if( items_candidate.size() )
211 wxMessageBox(
_(
"All dielectric thickness layers are locked" ) );
223 wxBitmapComboBox* cb =
dynamic_cast<wxBitmapComboBox*
>( item );
227 cb->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED,
232 wxButton* matButt =
dynamic_cast<wxButton*
>( item );
236 matButt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
241 wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( item );
245 textCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
255 wxArrayString headers;
256 headers.Add(
_(
"Layers" ) );
259 std::vector<wxArrayString> d_list;
260 std::vector<int> rows;
267 if( !item.m_isEnabled )
274 wxArrayString d_item;
288 d_list.emplace_back( d_item );
289 rows.push_back( row );
294 wxEmptyString,
false );
298 if( dlg.ShowModal() == wxID_OK && dlg.
GetSelection() >= 0 )
316 wxArrayString headers;
317 headers.Add(
_(
"Layers" ) );
322 std::vector<wxArrayString> d_list;
323 std::vector<int> rows;
330 item->GetSublayersCount() <= 1 )
336 for(
int ii = 0; ii < item->GetSublayersCount(); ii++ )
338 wxArrayString d_item;
341 item->FormatDielectricLayerName(),
343 item->GetSublayersCount() ) );
345 d_list.emplace_back( d_item );
346 rows.push_back( row++ );
351 wxEmptyString,
false );
355 if( dlg.ShowModal() == wxID_OK && dlg.
GetSelection() >= 0 )
379 if( item->GetSublayersCount() > 1 )
381 event.Enable(
true );
386 event.Enable(
false );
400 if( wxTheClipboard->Open() )
404 wxTheClipboard->SetData(
new wxTextDataObject( report ) );
405 wxTheClipboard->Flush();
406 wxTheClipboard->Close();
415 const wxBitmapComboBox* choice =
dynamic_cast<wxBitmapComboBox*
>( row.
m_ColorCtrl );
418 int idx = choice ? choice->GetSelection() : 0;
440 wxASSERT( copperLayerCount % 2 == 0 );
442 int dielectricLayerCount = copperLayerCount - 1;
443 int coreLayerCount = copperLayerCount / 2 - 1;
445 wxASSERT( dielectricLayerCount > 0 );
447 bool currentLayerIsCore =
false;
450 if( copperLayerCount == 2 )
453 currentLayerIsCore =
true;
456 wxASSERT( coreLayerCount > 0 );
458 int prePregLayerCount = dielectricLayerCount - coreLayerCount;
460 int totalWidthOfFixedItems = 0;
469 wxCheckBox* cbLock =
dynamic_cast<wxCheckBox*
>( ui_item.m_ThicknessLockCtrl );
470 wxChoice* layerType =
dynamic_cast<wxChoice*
>( ui_item.m_LayerTypeCtrl );
476 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
479 totalWidthOfFixedItems += item_thickness;
485 targetThickness - totalWidthOfFixedItems - ( prePregDefaultThickness * prePregLayerCount );
487 int prePregThickness = prePregDefaultThickness;
488 int coreThickness = remainingWidth / coreLayerCount;
490 if( coreThickness < prePregThickness )
493 remainingWidth = targetThickness - totalWidthOfFixedItems;
494 prePregThickness = coreThickness = std::max( 0, remainingWidth / dielectricLayerCount );
504 wxChoice* layerType =
dynamic_cast<wxChoice*
>( ui_item.m_LayerTypeCtrl );
512 wxCheckBox* cbLock =
dynamic_cast<wxCheckBox*
>( ui_item.m_ThicknessLockCtrl );
514 if( cbLock && cbLock->GetValue() )
516 currentLayerIsCore = !currentLayerIsCore;
522 int layerThickness = currentLayerIsCore ? coreThickness : prePregThickness;
524 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
525 layerType->SetSelection( currentLayerIsCore ? 0 : 1 );
528 currentLayerIsCore = !currentLayerIsCore;
544 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
547 thickness += item_thickness;
570 wxASSERT( copperCount >= 2 );
575 for(
int i = 1; i < copperCount - 1; i++ )
593 int sub_item = ui_row_item.m_SubItem;
597 wxChoice* choice =
dynamic_cast<wxChoice*
>( ui_row_item.m_LayerTypeCtrl );
605 wxTextCtrl* matName =
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_MaterialCtrl );
610 matName->ChangeValue( item->
GetMaterial( sub_item ) );
618 wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_ThicknessCtrl );
625 wxCheckBox* cb_box =
dynamic_cast<wxCheckBox*
> ( ui_row_item.m_ThicknessLockCtrl );
634 auto bm_combo =
dynamic_cast<wxBitmapComboBox*
>( ui_row_item.m_ColorCtrl );
637 if( item->
GetColor( sub_item ).StartsWith( wxT(
"#" ) ) )
641 ui_row_item.m_UserColor = custom_color;
647 bm_combo->SetString( selected, item->
GetColor( sub_item ) );
650 bm_combo->SetItemBitmap( selected, layerbmp );
671 bm_combo->SetSelection( selected );
677 wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_EpsilonCtrl );
680 textCtrl->ChangeValue( txt );
686 wxTextCtrl* textCtrl =
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_LossTgCtrl );
689 textCtrl->ChangeValue( txt );
707 int copperLayersCount = copperMask.count();
722 ui_row_item.m_isEnabled = show_item;
725 ui_row_item.m_Icon->Show( show_item );
726 ui_row_item.m_LayerName->Show( show_item );
727 ui_row_item.m_LayerTypeCtrl->Show( show_item );
728 ui_row_item.m_MaterialCtrl->Show( show_item );
730 if( ui_row_item.m_MaterialButt )
731 ui_row_item.m_MaterialButt->Show( show_item );
733 ui_row_item.m_ThicknessCtrl->Show( show_item );
734 ui_row_item.m_ThicknessLockCtrl->Show( show_item );
735 ui_row_item.m_ColorCtrl->Show( show_item );
736 ui_row_item.m_EpsilonCtrl->Show( show_item );
737 ui_row_item.m_LossTgCtrl->Show( show_item );
745 wxBoxSizer* bSizerMat =
new wxBoxSizer( wxHORIZONTAL );
747 wxTextCtrl* textCtrl =
new wxTextCtrl(
m_scGridWin, wxID_ANY );
752 textCtrl->ChangeValue( *aMaterialName );
758 bSizerMat->Add( textCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
760 wxButton* m_buttonMat =
new wxButton(
m_scGridWin, aId,
_(
"..." ), wxDefaultPosition,
761 wxDefaultSize, wxBU_EXACTFIT );
762 bSizerMat->Add( m_buttonMat, 0, wxALIGN_CENTER_VERTICAL, 2 );
764 m_buttonMat->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
776 wxStaticText* emptyText =
new wxStaticText(
m_scGridWin, wxID_ANY, wxEmptyString );
786 wxASSERT( aStackupItem );
787 wxASSERT( aSublayerIdx >= 0 && aSublayerIdx < aStackupItem->GetSublayersCount() );
795 wxStaticBitmap* bitmap =
new wxStaticBitmap(
m_scGridWin, wxID_ANY, wxNullBitmap );
796 m_fgGridSizer->Add( bitmap, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 4 );
797 ui_row_item.
m_Icon = bitmap;
807 lname << wxT(
" (" ) << aSublayerIdx+1 << wxT(
"/" )
811 wxStaticText* st_text =
new wxStaticText(
m_scGridWin, wxID_ANY, lname );
812 m_fgGridSizer->Add( st_text, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
817 if( aSublayerIdx == 0 )
819 wxChoice* choice =
new wxChoice(
m_scGridWin, wxID_ANY, wxDefaultPosition,
822 m_fgGridSizer->Add( choice, 1, wxEXPAND|wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
835 m_fgGridSizer->Add( st_text, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 1 );
836 st_text->Show(
true );
842 lname =
_(
"Copper" );
846 st_text =
new wxStaticText(
m_scGridWin, wxID_ANY, lname );
847 m_fgGridSizer->Add( st_text, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
853 wxString matName = item->
GetMaterial( aSublayerIdx );
866 m_fgGridSizer->Add( textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
868 textCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED,
894 if( item->
GetColor( aSublayerIdx ).StartsWith( wxT(
"#" ) ) )
904 m_fgGridSizer->Add( bm_combo, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 );
906 if( item->
GetColor( aSublayerIdx ).StartsWith( wxT(
"#" ) ) )
909 bm_combo->SetString( selected, item->
GetColor( aSublayerIdx ) );
924 bm_combo->SetSelection( selected );
935 wxTextCtrl* textCtrl =
new wxTextCtrl(
m_scGridWin, wxID_ANY, wxEmptyString,
937 textCtrl->ChangeValue( txt );
938 m_fgGridSizer->Add( textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
949 wxTextCtrl* textCtrl =
new wxTextCtrl(
m_scGridWin, wxID_ANY, wxEmptyString,
951 textCtrl->ChangeValue( txt );
952 m_fgGridSizer->Add( textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
980 ui_item.m_MaterialCtrl->SetSizer(
nullptr );
983 delete ui_item.m_Icon;
984 delete ui_item.m_LayerName;
985 delete ui_item.m_LayerTypeCtrl;
986 delete ui_item.m_MaterialCtrl;
987 delete ui_item.m_MaterialButt;
988 delete ui_item.m_ThicknessCtrl;
989 delete ui_item.m_ThicknessLockCtrl;
990 delete ui_item.m_ColorCtrl;
991 delete ui_item.m_EpsilonCtrl;
992 delete ui_item.m_LossTgCtrl;
1004 m_fgGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
1009 const int sizer_flags = wxALIGN_CENTER_VERTICAL | wxALL | wxALIGN_CENTER_HORIZONTAL;
1033 bool aRelinkStackup )
1037 if( aCreateInitialStackup || aRelinkStackup )
1039 if( aCreateInitialStackup )
1058 if( item->GetBrdLayerId() == board_item->GetBrdLayerId() )
1060 *item = *board_item;
1070 if( item->GetDielectricLayerId() == board_item->GetDielectricLayerId() )
1072 *item = *board_item;
1084 for(
int sub_idx = 0; sub_idx < item->GetSublayersCount(); sub_idx++ )
1101 bool success =
true;
1108 if( !ui_item.m_isEnabled )
1115 int sub_item = ui_item.m_SubItem;
1126 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_EpsilonCtrl );
1127 wxString txt = textCtrl->GetValue();
1129 if( txt.ToDouble( &value ) && value >= 0.0 )
1131 else if( txt.ToCDouble( &value ) && value >= 0.0 )
1136 error_msg <<
_(
"Incorrect value for Epsilon R (Epsilon R must be positive or "
1137 "null if not used)" );
1143 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_LossTgCtrl );
1144 wxString txt = textCtrl->GetValue();
1146 if( txt.ToDouble( &value ) && value >= 0.0 )
1148 else if( txt.ToCDouble( &value ) && value >= 0.0 )
1154 if( !error_msg.IsEmpty() )
1155 error_msg << wxT(
"\n" );
1157 error_msg <<
_(
"Incorrect value for Loss tg (Loss tg must be positive or null "
1164 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_MaterialCtrl );
1165 item->
SetMaterial( textCtrl->GetValue(), sub_item );
1176 wxChoice* choice =
dynamic_cast<wxChoice*
>( ui_item.m_LayerTypeCtrl );
1180 int idx = choice->GetSelection();
1191 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
1196 if( new_thickness < 0 )
1200 if( !error_msg.IsEmpty() )
1201 error_msg << wxT(
"\n" );
1203 error_msg <<
_(
"A layer thickness is < 0. Fix it" );
1209 wxCheckBox* cb_box =
static_cast<wxCheckBox*
>( ui_item.m_ThicknessLockCtrl );
1216 wxBitmapComboBox* choice =
dynamic_cast<wxBitmapComboBox*
>( ui_item.m_ColorCtrl );
1220 int idx = choice->GetSelection();
1223 item->
SetColor( ui_item.m_UserColor.ToHexString(), sub_item );
1234 wxMessageBox( error_msg,
_(
"Errors" ) );
1273 if( item->IsEnabled() )
1349 int idx =
event.GetSelection();
1350 int item_id =
event.GetId();
1365 if( dlg.ShowModal() == wxID_OK )
1367 wxBitmapComboBox* combo =
static_cast<wxBitmapComboBox*
>( FindWindowById( item_id ) );
1372 combo->SetString( idx,
color.ToHexString() );
1376 combo->SetItemBitmap( combo->GetCount() - 1, layerbmp );
1378 combo->SetSelection( idx );
1407 for(
int ii = 0; ii < item->GetSublayersCount(); ii++ )
1410 item->GetEpsilonR( ii ),
1411 item->GetLossTangent( ii ) );
1413 if( idx < 0 && !item->GetMaterial().IsEmpty() )
1417 new_mat.
m_Name = item->GetMaterial( ii );
1418 new_mat.
m_EpsilonR = item->GetEpsilonR( ii );
1435 default: item_mat_list =
nullptr;
break;
1438 wxCHECK( item_mat_list, );
1442 if( dlg.ShowModal() != wxID_OK )
1447 if( substrate.
m_Name.IsEmpty() )
1455 wxTextCtrl* textCtrl =
static_cast<wxTextCtrl*
>(
m_rowUiItemsList[row].m_MaterialCtrl );
1456 textCtrl->ChangeValue( item->
GetMaterial( sub_item ) );
1459 && !item->
GetColor( sub_item ).StartsWith(
"#" ) )
1461 if( substrate.
m_Name.IsSameAs(
"PTFE" )
1462 || substrate.
m_Name.IsSameAs(
"Teflon" ) )
1464 item->
SetColor(
"PTFE natural", sub_item );
1466 else if( substrate.
m_Name.IsSameAs(
"Polyimide" )
1467 || substrate.
m_Name.IsSameAs(
"Kapton" ) )
1469 item->
SetColor(
"Polyimide", sub_item );
1471 else if( substrate.
m_Name.IsSameAs(
"Al" ) )
1473 item->
SetColor(
"Aluminum", sub_item );
1477 item->
SetColor(
"FR4 natural", sub_item );
1481 wxBitmapComboBox* picker =
static_cast<wxBitmapComboBox*
>(
m_rowUiItemsList[row].m_ColorCtrl );
1487 picker->SetSelection( ii );
1495 textCtrl =
dynamic_cast<wxTextCtrl*
>(
m_rowUiItemsList[row].m_EpsilonCtrl );
1504 textCtrl =
dynamic_cast<wxTextCtrl*
>(
m_rowUiItemsList[row].m_LossTgCtrl );
1515 wxString value =
event.GetString();
1542 wxASSERT( st_item );
1558 wxFAIL_MSG( wxT(
"PANEL_SETUP_BOARD_STACKUP::getColorIconItem: unrecognized item type" ) );
1562 wxASSERT_MSG(
color.IsOk(), wxT(
"Invalid color in PCB stackup" ) );
1571 const int bitmap_depth = 24;
1579 st_bitmap->SetBitmap( bmp );
1596 wxEmptyString, wxDefaultPosition,
1597 wxDefaultSize, 0,
nullptr, wxCB_READONLY );
1610 && aStackupItem && aStackupItem->
GetColor().StartsWith( wxT(
"#" ) ) )
1613 curr_color =
COLOR4D( label );
1624 combo->Append( label, layerbmp );
1632 int sel = combo->GetSelection();
1633 combo->SetSelection( combo->GetCount() - 1 );
1635 combo->SetMinSize( wxSize( -1, -1 ) );
1636 wxSize bestSize = combo->GetBestSize();
1639 combo->SetMinSize( bestSize );
1640 combo->SetSelection( sel );
1646 combo->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED,
1650 combo->Bind( wxEVT_COMBOBOX_DROPDOWN,
1651 [combo]( wxCommandEvent& aEvent )
1653 combo->SetString( combo->GetCount() - 1,
_(
"Custom..." ) );
1662 wxNativePixelData data( aBitmap );
1663 wxNativePixelData::Iterator p( data );
1665 for(
int yy = 0; yy < data.GetHeight(); yy++ )
1667 wxNativePixelData::Iterator rowStart = p;
1669 for(
int xx = 0; xx < data.GetWidth(); xx++ )
1671 p.Red() = aColor.Red();
1672 p.Green() = aColor.Green();
1673 p.Blue() = aColor.Blue();
1678 p.OffsetY( data, 1 );
constexpr EDA_IU_SCALE pcbIUScale
wxBitmap KiScaledBitmap(BITMAPS aBitmap, wxWindow *aWindow, int aHeight, bool aQuantized)
Construct a wxBitmap from a memory record, scaling it if device DPI demands it.
bool IsPrmSpecified(const wxString &aPrmValue)
@ BS_ITEM_TYPE_SILKSCREEN
@ BS_ITEM_TYPE_DIELECTRIC
@ BS_ITEM_TYPE_SOLDERPASTE
@ BS_ITEM_TYPE_SOLDERMASK
wxString BuildStackupReport(BOARD_STACKUP &aStackup, EDA_UNITS aUnits)
Container for design settings for a BOARD object.
int GetBoardThickness() const
The full thickness of the board including copper and masks.
BOARD_STACKUP & GetStackupDescriptor()
int GetCopperLayerCount() const
void SetBoardThickness(int aThickness)
Manage one layer needed to make a physical board.
void AddDielectricPrms(int aDielectricPrmsIdx)
Add (insert) a DIELECTRIC_PRMS item to m_DielectricPrmsList all values are set to default.
wxString GetTypeName() const
int GetSublayersCount() const
double GetEpsilonR(int aDielectricSubLayer=0) const
wxString GetColor(int aDielectricSubLayer=0) const
bool HasEpsilonRValue() const
void SetThickness(int aThickness, int aDielectricSubLayer=0)
bool IsMaterialEditable() const
void SetThicknessLocked(bool aLocked, int aDielectricSubLayer=0)
wxString FormatDielectricLayerName() const
wxString GetLayerName() const
void SetMaterial(const wxString &aName, int aDielectricSubLayer=0)
bool HasLossTangentValue() const
PCB_LAYER_ID GetBrdLayerId() const
bool IsThicknessEditable() const
void SetLossTangent(double aTg, int aDielectricSubLayer=0)
int GetThickness(int aDielectricSubLayer=0) const
void SetEnabled(bool aEnable)
BOARD_STACKUP_ITEM_TYPE GetType() const
wxString GetMaterial(int aDielectricSubLayer=0) const
void SetTypeName(const wxString &aName)
bool IsThicknessLocked(int aDielectricSubLayer=0) const
wxString FormatEpsilonR(int aDielectricSubLayer=0) const
void SetColor(const wxString &aColorName, int aDielectricSubLayer=0)
void SetEpsilonR(double aEpsilon, int aDielectricSubLayer=0)
void SetLayerName(const wxString &aName)
void RemoveDielectricPrms(int aDielectricPrmsIdx)
Remove a DIELECTRIC_PRMS item from m_DielectricPrmsList.
int GetDielectricLayerId() const
bool IsColorEditable() const
wxString FormatLossTangent(int aDielectricSubLayer=0) const
double GetLossTangent(int aDielectricSubLayer=0) const
Manage layers needed to make a physical board.
void RemoveAll()
Delete all items in list and clear the list.
void FormatBoardStackup(OUTPUTFORMATTER *aFormatter, const BOARD *aBoard, int aNestLevel) const
Write the stackup info on board file.
bool m_CastellatedPads
True if castellated pads exist.
const std::vector< BOARD_STACKUP_ITEM * > & GetList() const
static LSET StackupAllowedBrdLayers()
int BuildBoardThicknessFromStackup() const
bool m_HasDielectricConstrains
True if some layers have impedance controlled tracks or have specific constrains for micro-wave appli...
void Add(BOARD_STACKUP_ITEM *aItem)
Add a new item in stackup layer.
void BuildDefaultStackupList(const BOARD_DESIGN_SETTINGS *aSettings, int aActiveCopperLayersCount=0)
Create a default stackup, according to the current BOARD_DESIGN_SETTINGS settings.
bool m_EdgePlating
True if the edge board is plated.
BS_EDGE_CONNECTOR_CONSTRAINTS m_EdgeConnectorConstraints
If the board has edge connector cards, some constrains can be specified in job file: BS_EDGE_CONNECTO...
wxString m_FinishType
The name of external copper finish.
Information pertinent to a Pcbnew printed circuit board.
LSET GetEnabledLayers() const
A proxy function that calls the corresponding function in m_BoardSettings.
int GetCopperLayerCount() const
const wxString GetLayerName(PCB_LAYER_ID aLayer) const
Return the name of a aLayer.
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
KIGFX::COLOR4D GetColor()
a Dialog to select/change/add a dielectric material from a material list
DIELECTRIC_SUBSTRATE GetSelectedSubstrate()
int AppendSubstrate(DIELECTRIC_SUBSTRATE &aItem)
Append a item in list similar to aItem.
int FindSubstrate(DIELECTRIC_SUBSTRATE *aItem)
Find a item in list similar to aItem.
void SetListLabel(const wxString &aLabel)
A color representation with 4 components: red, green, blue, alpha.
wxColour ToColour() const
static void DrawColorSwatch(wxBitmap &aLayerbmp, const COLOR4D &aBackground, const COLOR4D &aColor)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
LSET is a set of PCB_LAYER_IDs.
static LSET ExternalCuMask()
Return a mask holding the Front and Bottom layers.
static LSET InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
Class PANEL_SETUP_BOARD_STACKUP_BASE.
wxScrolledWindow * m_scGridWin
wxStaticText * m_staticTextLayer
wxStaticText * m_staticTextMaterial
wxStaticText * m_staticTextLayerId
wxStaticBitmap * m_bitmapLockThickness
wxStaticText * m_staticTextColor
wxCheckBox * m_impedanceControlled
wxStaticText * m_staticTextType
wxStaticText * m_staticTextThickness
wxFlexGridSizer * m_fgGridSizer
wxStaticText * m_staticTextLossTg
wxStaticText * m_staticTextEpsilonR
wxChoice * m_choiceCopperLayers
int GetSublayerId(int aRow)
void onAddDielectricLayer(wxCommandEvent &event) override
DIELECTRIC_SUBSTRATE_LIST m_silkscreenMatList
wxArrayString m_core_prepreg_choice
void onExportToClipboard(wxCommandEvent &event) override
bool transferDataFromUIToStackup()
Transfer current UI settings to m_stackup but not to the board.
BOARD_STACKUP_ROW_UI_ITEM createRowData(int aRow, BOARD_STACKUP_ITEM *aStackupItem, int aSublayerIdx)
Creates a BOARD_STACKUP_ROW_UI_ITEM relative to the aStackupItem.
wxControl * addSpacer()
add a Spacer in m_fgGridSizer when a empty cell is needed
wxSize m_numericTextCtrlSize
std::vector< wxControl * > m_controlItemsList
void onColorSelected(wxCommandEvent &event)
bool TransferDataFromWindow() override
void onCopperLayersSelCount(wxCommandEvent &event) override
void ImportSettingsFrom(BOARD *aBoard)
wxColor getColorIconItem(int aRow)
void OnLayersOptionsChanged(LSET aNewLayerSet)
Must be called if the copper layers count has changed or solder mask, solder paste or silkscreen laye...
void updateIconColor(int aRow=-1)
Update the icons color (swatches in first grid column)
void updateCopperLayerCount()
Updates the enabled copper layers when the dropdown is changed.
wxColor GetSelectedColor(int aRow) const
Return the color currently selected for the row aRow.
void onRemoveDielectricLayer(wxCommandEvent &event) override
int computeBoardThickness()
Recompute the board thickness and update the textbox.
void setDefaultLayerWidths(int targetThickness)
Set the widths of dielectric layers to sensible defaults.
PAGED_DIALOG * m_parentDialog
void synchronizeWithBoard(bool aFullSync)
Synchronize the full stackup shown in m_fgGridSizer according to the stackup of the current board and...
void buildLayerStackPanel(bool aCreateInitialStackup=false, bool aRelinkStackup=false)
Populate m_fgGridSizer with items to handle stackup parameters This is a full list: all copper layers...
void onThicknessChange(wxCommandEvent &event)
BOARD_DESIGN_SETTINGS * m_brdSettings
int GetCopperLayerCount() const
BOARD_STACKUP_ITEM * GetStackupItem(int aRow)
void showOnlyActiveLayers()
Show or do not show items in m_fgGridSizer according to the stackup of the current board.
DIELECTRIC_SUBSTRATE_LIST m_solderMaskMatList
std::vector< BOARD_STACKUP_ROW_UI_ITEM > m_rowUiItemsList
PANEL_SETUP_LAYERS * m_panelLayers
void onRemoveDielUI(wxUpdateUIEvent &event) override
DIELECTRIC_SUBSTRATE_LIST m_delectricMatList
wxBitmapComboBox * createColorBox(BOARD_STACKUP_ITEM *aStackupItem, int aRow)
creates a bitmap combobox to select a layer color
wxSize m_numericFieldsSize
void disconnectEvents()
disconnect event handlers connected to wxControl items found in list m_controlItemsList
void onAdjustDielectricThickness(wxCommandEvent &event) override
void addMaterialChooser(wxWindowID aId, const wxString *aMaterialName, BOARD_STACKUP_ROW_UI_ITEM &aUiRowItem)
add a control (a wxTextCtrl + a button) in m_fgGridSizer to select a material
~PANEL_SETUP_BOARD_STACKUP()
void onMaterialChange(wxCommandEvent &event)
wxSize m_colorSwatchesSize
void rebuildLayerStackPanel(bool aRelinkItems=false)
Populate m_fgGridSizer with items to handle stackup parameters If previous items are in list,...
PANEL_SETUP_BOARD_STACKUP(PAGED_DIALOG *aParent, PCB_EDIT_FRAME *aFrame, PANEL_SETUP_LAYERS *aPanelLayers)
bool IsInitialized() const
void SetPhysicalStackupPanel(PANEL_SETUP_BOARD_STACKUP *aPanel)
The main frame for Pcbnew.
void OnModify() override
Must be called after a board change to set the modified flag.
wxString StringFromValue(double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aValue in internal units into a united string.
int ValueFromString(const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Converts aTextValue in aUnits to internal units used by the frame.
EDA_UNITS GetUserUnits() const
void SetBorders(bool aLeft, bool aRight, bool aTop, bool aBottom)
This file contains miscellaneous commonly used macros and functions.
wxString GetText(EDA_UNITS aUnits, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Get the units string for a given units type.
static wxColor pasteColor(200, 200, 200)
static wxColor copperColor(220, 180, 30)
static wxColor dielectricColor(75, 120, 75)
static void drawBitmap(wxBitmap &aBitmap, wxColor aColor)
@ ID_ITEM_THICKNESS_LOCKED
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
std::vector< FAB_LAYER_COLOR > dummy
const std::vector< FAB_LAYER_COLOR > & GetStandardColors(BOARD_STACKUP_ITEM_TYPE aType)
int GetColorUserDefinedListIdx(BOARD_STACKUP_ITEM_TYPE aType)
bool IsCustomColorIdx(BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
KIGFX::COLOR4D GetStandardColor(BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
wxString NotSpecifiedPrm()
const wxString & GetStandardColorName(BOARD_STACKUP_ITEM_TYPE aType, int aIdx)
KIGFX::COLOR4D GetDefaultUserColor(BOARD_STACKUP_ITEM_TYPE aType)
std::string UIDouble2Str(double aValue)
Print a float number without using scientific notation and no trailing 0 We want to avoid scientific ...
wxControl * m_ThicknessCtrl
wxStaticText * m_LayerName
wxControl * m_ThicknessLockCtrl
wxControl * m_EpsilonCtrl
wxButton * m_MaterialButt
wxControl * m_MaterialCtrl
wxControl * m_LayerTypeCtrl
BOARD_STACKUP_ITEM * m_Item
constexpr int mmToIU(double mm) const