33#include <wx/bmpcbox.h> 
   36#include <wx/clipbrd.h> 
   37#include <wx/wupdlock.h> 
   38#include <wx/richmsgdlg.h> 
   47#include <wx/textdlg.h> 
   56#define ID_INCREMENT 256     
   74static void drawBitmap( wxBitmap& aBitmap, wxColor aColor );
 
   93    m_panel1->SetBorders( 
false, 
false, 
true, 
true );
 
 
  144            [&]( wxTextCtrl* aTextCtrl )
 
  146                wxString str = aTextCtrl->GetValue();
 
  152                aTextCtrl->ChangeValue( str );
 
  160            convert( 
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl ) );
 
 
  173    int oldBoardWidth = 
static_cast<int>( 
m_frame->ValueFromString( 
m_tcCTValue->GetValue() ) );
 
 
  186    std::vector< BOARD_STACKUP_ROW_UI_ITEM* > items_candidate;
 
  190    int min_thickness = 0;
 
  200        wxCheckBox* cb_box = 
dynamic_cast<wxCheckBox*
> ( ui_item.m_ThicknessLockCtrl );
 
  202        if( cb_box && !cb_box->GetValue() )
 
  204            items_candidate.push_back( &ui_item );
 
  208        wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
 
  210        int item_thickness = 
m_frame->ValueFromString( textCtrl->GetValue() );
 
  211        min_thickness += item_thickness;
 
  216    if( min_thickness == 0 )
 
  218        title.Printf( 
_( 
"Enter board thickness in %s:" ),
 
  223        title.Printf( 
_( 
"Enter expected board thickness (min value %s):" ),
 
  224                      m_frame->StringFromValue( min_thickness, 
true ) );
 
  227    wxTextEntryDialog dlg( 
this, title, 
_( 
"Adjust Unlocked Dielectric Layers" ) );
 
  229    if( dlg.ShowModal() != wxID_OK )
 
  232    int iu_thickness = 
m_frame->ValueFromString( dlg.GetValue() );
 
  234    if( iu_thickness < min_thickness )
 
  236        wxMessageBox( wxString::Format( 
_(
"Value too small (min value %s)." ),
 
  237                                        m_frame->StringFromValue( min_thickness, 
true ) ) );
 
  243    if( items_candidate.size() )
 
  246        wxMessageBox( 
_( 
"All dielectric  thickness layers are locked" ) );
 
 
  257        wxBitmapComboBox* cb = 
dynamic_cast<wxBitmapComboBox*
>( item );
 
  261            cb->Disconnect( wxEVT_COMMAND_COMBOBOX_SELECTED,
 
  266        wxButton* matButt = 
dynamic_cast<wxButton*
>( item );
 
  270            matButt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
 
  275        wxTextCtrl* textCtrl = 
dynamic_cast<wxTextCtrl*
>( item );
 
  279            textCtrl->Disconnect( wxEVT_COMMAND_TEXT_UPDATED,
 
 
  289    wxArrayString headers;
 
  290    headers.Add( 
_( 
"Layers" ) );
 
  293    std::vector<wxArrayString> d_list;
 
  294    std::vector<int>           rows;  
 
  301        if( !item.m_isEnabled )
 
  308            wxArrayString d_item;
 
  312                d_item.Add( wxString::Format( 
_( 
"Layer '%s' (sublayer %d/%d)" ),
 
  322            d_list.emplace_back( d_item );
 
  323            rows.push_back( row );
 
  328                         headers, d_list, wxEmptyString,
 
 
  351    wxArrayString headers;
 
  352    headers.Add( 
_( 
"Layers" ) );
 
  357    std::vector<wxArrayString> d_list;
 
  358    std::vector<int>           rows;      
 
  365            item->GetSublayersCount() <= 1 )
 
  371        for( 
int ii = 0; ii < item->GetSublayersCount(); ii++ )
 
  373            wxArrayString d_item;
 
  375            d_item.Add( wxString::Format( 
_( 
"Layer '%s' sublayer %d/%d" ),
 
  376                                          item->FormatDielectricLayerName(),
 
  378                                          item->GetSublayersCount() ) );
 
  380            d_list.emplace_back( d_item );
 
  381            rows.push_back( row++ );
 
  386                         headers, d_list, wxEmptyString,
 
 
  415        if( item->GetSublayersCount() > 1 )
 
  417            event.Enable( 
true );
 
  422    event.Enable( 
false );
 
 
  438    if( wxTheClipboard->Open() )
 
  442        wxTheClipboard->SetData( 
new wxTextDataObject( report ) );
 
  443        wxTheClipboard->Flush(); 
 
  444        wxTheClipboard->Close();
 
 
  453    const wxBitmapComboBox*          choice = 
dynamic_cast<wxBitmapComboBox*
>( row.
m_ColorCtrl );
 
  454    int                              idx = choice ? choice->GetSelection() : 0;
 
 
  469    const int prePregDefaultThickness = 
pcbIUScale.mmToIU( 0.1 );
 
  476    wxASSERT( copperLayerCount % 2 == 0 );
 
  478    int  dielectricLayerCount = copperLayerCount - 1;
 
  479    int  coreLayerCount = copperLayerCount / 2 - 1;
 
  481    wxASSERT( dielectricLayerCount > 0 );
 
  483    bool currentLayerIsCore = 
false;
 
  486    if( copperLayerCount == 2 )
 
  489        currentLayerIsCore = 
true;
 
  492    wxASSERT( coreLayerCount > 0 );
 
  494    int prePregLayerCount = dielectricLayerCount - coreLayerCount;
 
  496    int totalWidthOfFixedItems = 0;
 
  505        wxCheckBox* cbLock = 
dynamic_cast<wxCheckBox*
>( ui_item.m_ThicknessLockCtrl );
 
  506        wxChoice*   layerType = 
dynamic_cast<wxChoice*
>( ui_item.m_LayerTypeCtrl );
 
  511            || ( cbLock && cbLock->GetValue() ) )
 
  515            wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
 
  516            int         item_thickness = 
m_frame->ValueFromString( textCtrl->GetValue() );
 
  518            totalWidthOfFixedItems += item_thickness;
 
  523    int remainingWidth = targetThickness
 
  524                            - totalWidthOfFixedItems
 
  525                            - ( prePregDefaultThickness * prePregLayerCount );
 
  527    int prePregThickness = prePregDefaultThickness;
 
  528    int coreThickness = remainingWidth / coreLayerCount;
 
  530    if( coreThickness < prePregThickness )
 
  533        remainingWidth = targetThickness - totalWidthOfFixedItems;
 
  534        prePregThickness = coreThickness = std::max( 0, remainingWidth / dielectricLayerCount );
 
  544        wxChoice* layerType = 
dynamic_cast<wxChoice*
>( ui_item.m_LayerTypeCtrl );
 
  552        wxCheckBox* cbLock = 
dynamic_cast<wxCheckBox*
>( ui_item.m_ThicknessLockCtrl );
 
  554        if( cbLock && cbLock->GetValue() )
 
  556            currentLayerIsCore = !currentLayerIsCore;
 
  562        int layerThickness = currentLayerIsCore ? coreThickness : prePregThickness;
 
  564        wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
 
  565        layerType->SetSelection( currentLayerIsCore ? 0 : 1 );
 
  566        textCtrl->SetValue( 
m_frame->StringFromValue( layerThickness ) );
 
  568        currentLayerIsCore = !currentLayerIsCore;
 
 
  584        wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
 
  585        int         item_thickness = 
m_frame->ValueFromString( textCtrl->GetValue() );
 
  587        thickness += item_thickness;
 
  590    wxString thicknessStr = 
m_frame->StringFromValue( thickness, 
true );
 
 
  610    wxASSERT( copperCount >= 2 );
 
 
  630        int sub_item = ui_row_item.m_SubItem;
 
  634            wxChoice* choice = 
dynamic_cast<wxChoice*
>( ui_row_item.m_LayerTypeCtrl );
 
  642            wxTextCtrl* matName = 
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_MaterialCtrl );
 
  647                    matName->ChangeValue( item->
GetMaterial( sub_item ) );
 
  655            wxTextCtrl* textCtrl = 
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_ThicknessCtrl );
 
  662                wxCheckBox* cb_box = 
dynamic_cast<wxCheckBox*
> ( ui_row_item.m_ThicknessLockCtrl );
 
  671            auto bm_combo = 
dynamic_cast<wxBitmapComboBox*
>( ui_row_item.m_ColorCtrl );
 
  674            if( item->
GetColor( sub_item ).StartsWith( wxT( 
"#" ) ) )  
 
  678                ui_row_item.m_UserColor = custom_color;
 
  684                    bm_combo->SetString( selected, item->
GetColor( sub_item ) );
 
  687                    bm_combo->SetItemBitmap( selected, layerbmp );
 
  708                bm_combo->SetSelection( selected );
 
  714            wxTextCtrl* textCtrl = 
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_EpsilonCtrl );
 
  717                textCtrl->ChangeValue( txt );
 
  723            wxTextCtrl* textCtrl = 
dynamic_cast<wxTextCtrl*
>( ui_row_item.m_LossTgCtrl );
 
  726                textCtrl->ChangeValue( txt );
 
 
  744    int copperLayersCount = copperMask.count();
 
  760        ui_row_item.m_isEnabled = show_item;
 
  768        if( show_item && !ui_row_item.m_Icon )
 
  771        if( ui_row_item.m_Icon )
 
  774            ui_row_item.m_Icon->Show( show_item );
 
  775            ui_row_item.m_LayerName->Show( show_item );
 
  776            ui_row_item.m_LayerTypeCtrl->Show( show_item );
 
  777            ui_row_item.m_MaterialCtrl->Show( show_item );
 
  779            if( ui_row_item.m_MaterialButt )
 
  780                ui_row_item.m_MaterialButt->Show( show_item );
 
  782            ui_row_item.m_ThicknessCtrl->Show( show_item );
 
  783            ui_row_item.m_ThicknessLockCtrl->Show( show_item );
 
  784            ui_row_item.m_ColorCtrl->Show( show_item );
 
  785            ui_row_item.m_EpsilonCtrl->Show( show_item );
 
  786            ui_row_item.m_LossTgCtrl->Show( show_item );
 
 
  794    wxStaticText* emptyText = 
new wxStaticText( 
m_scGridWin, wxID_ANY, wxEmptyString );
 
  795    m_fgGridSizer->Insert( aPos, emptyText, 0, wxALIGN_CENTER_VERTICAL );
 
 
  805    int                 row = ui_row_item.
m_Row;
 
  809    wxStaticBitmap* bitmap = 
new wxStaticBitmap( 
m_scGridWin, wxID_ANY, wxNullBitmap );
 
  810    m_fgGridSizer->Insert( aPos++, bitmap, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 4 );
 
  811    ui_row_item.
m_Icon = bitmap;
 
  819            lname <<  wxT( 
"  (" ) << sublayerIdx +1 << wxT( 
"/" )
 
  823        wxStaticText* st_text = 
new wxStaticText( 
m_scGridWin, wxID_ANY, lname );
 
  824        m_fgGridSizer->Insert( aPos++, st_text, 0, wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
 
  829        if( sublayerIdx == 0 )
 
  831            wxChoice* choice = 
new wxChoice( 
m_scGridWin, wxID_ANY, wxDefaultPosition,
 
  834            m_fgGridSizer->Insert( aPos++, choice, 1, wxEXPAND|wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
 
  847        m_fgGridSizer->Insert( aPos++, st_text, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 1 );
 
  848        st_text->Show( 
true );
 
  854            lname = 
_( 
"Copper" );
 
  858        st_text = 
new wxStaticText( 
m_scGridWin, wxID_ANY, lname );
 
  859        m_fgGridSizer->Insert( aPos++, st_text, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
 
  865        wxString matName = item->
GetMaterial( sublayerIdx );
 
  867        wxBoxSizer* bSizerMat = 
new wxBoxSizer( wxHORIZONTAL );
 
  868        m_fgGridSizer->Insert( aPos++, bSizerMat, 1, wxRIGHT|wxEXPAND, 4 );
 
  869        wxTextCtrl* textCtrl = 
new wxTextCtrl( 
m_scGridWin, wxID_ANY );
 
  872            textCtrl->ChangeValue( matName );
 
  877        bSizerMat->Add( textCtrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
 
  880                                              wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
 
  881        bSizerMat->Add( m_buttonMat, 0, wxALIGN_CENTER_VERTICAL, 2 );
 
  883        m_buttonMat->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
 
  901        textCtrl->ChangeValue( 
m_frame->StringFromValue( item->
GetThickness( sublayerIdx ), 
true ) );
 
  902        m_fgGridSizer->Insert( aPos++, textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
 
  904        textCtrl->Connect( wxEVT_COMMAND_TEXT_UPDATED,
 
  916                                   wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL, 2 );
 
  933        if( item->
GetColor( sublayerIdx ).StartsWith( wxT( 
"#" ) ) )  
 
  943        m_fgGridSizer->Insert( aPos++, bm_combo, 1, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL|wxEXPAND, 2 );
 
  945        if( item->
GetColor( sublayerIdx ).StartsWith( wxT( 
"#" ) ) )
 
  948            bm_combo->SetString( selected, item->
GetColor( sublayerIdx ) );
 
  963        bm_combo->SetSelection( selected );
 
  974        wxTextCtrl* textCtrl = 
new wxTextCtrl( 
m_scGridWin, wxID_ANY, wxEmptyString,
 
  976        textCtrl->ChangeValue( txt );
 
  977        m_fgGridSizer->Insert( aPos++, textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
 
  988        wxTextCtrl* textCtrl = 
new wxTextCtrl( 
m_scGridWin, wxID_ANY, wxEmptyString,
 
  990        textCtrl->ChangeValue( txt );
 
  991        m_fgGridSizer->Insert( aPos++, textCtrl, 0, wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
 
 
 1017        if( ui_item.m_MaterialCtrl )
 
 1018            ui_item.m_MaterialCtrl->SetSizer( 
nullptr );
 
 1021        delete ui_item.m_Icon;             
 
 1022        delete ui_item.m_LayerName;        
 
 1023        delete ui_item.m_LayerTypeCtrl;    
 
 1024        delete ui_item.m_MaterialCtrl;     
 
 1025        delete ui_item.m_MaterialButt;     
 
 1026        delete ui_item.m_ThicknessCtrl;    
 
 1027        delete ui_item.m_ThicknessLockCtrl;
 
 1028        delete ui_item.m_ColorCtrl;        
 
 1029        delete ui_item.m_EpsilonCtrl;      
 
 1030        delete ui_item.m_LossTgCtrl;       
 
 1042    m_fgGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
 
 1047    const int sizer_flags = wxALIGN_CENTER_VERTICAL | wxALL | wxALIGN_CENTER_HORIZONTAL;
 
 
 1073                                                      bool aRelinkStackup )
 
 1077    if( aCreateInitialStackup || aRelinkStackup )
 
 1079        if( aCreateInitialStackup )
 
 1098                    if( item->GetBrdLayerId() == board_item->GetBrdLayerId() )
 
 1100                        *item = *board_item;
 
 1110                    if( item->GetDielectricLayerId() == board_item->GetDielectricLayerId() )
 
 1112                        *item = *board_item;
 
 1124        for( 
int sub_idx = 0; sub_idx < item->GetSublayersCount(); sub_idx++ )
 
 
 1137    bool success = 
true;
 
 1143        if( !ui_item.m_isEnabled )
 
 1149        int sub_item = ui_item.m_SubItem;
 
 1160            wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_EpsilonCtrl );
 
 1161            wxString    txt = textCtrl->GetValue();
 
 1163            if( txt.ToDouble( &value ) && value >= 0.0 )
 
 1165            else if( txt.ToCDouble( &value ) && value >= 0.0 )
 
 1170                error_msg << 
_( 
"Incorrect value for Epsilon R (Epsilon R must be positive or " 
 1171                                "null if not used)" );
 
 1177            wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_LossTgCtrl );
 
 1178            wxString    txt = textCtrl->GetValue();
 
 1180            if( txt.ToDouble( &value ) && value >= 0.0 )
 
 1182            else if( txt.ToCDouble( &value ) && value >= 0.0 )
 
 1188                if( !error_msg.IsEmpty() )
 
 1189                    error_msg << wxT( 
"\n" );
 
 1191                error_msg << 
_( 
"Incorrect value for Loss tg (Loss tg must be positive or null " 
 1198            wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_MaterialCtrl );
 
 1199            item->
SetMaterial( textCtrl->GetValue(), sub_item );
 
 1210            wxChoice* choice = 
dynamic_cast<wxChoice*
>( ui_item.m_LayerTypeCtrl );
 
 1214                int idx = choice->GetSelection();
 
 1225            wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( ui_item.m_ThicknessCtrl );
 
 1226            int         new_thickness = 
m_frame->ValueFromString( textCtrl->GetValue() );
 
 1230            if( new_thickness < 0 )
 
 1234                if( !error_msg.IsEmpty() )
 
 1235                    error_msg << wxT( 
"\n" );
 
 1237                error_msg << 
_( 
"A layer thickness is < 0. Fix it" );
 
 1243                wxCheckBox* cb_box = 
static_cast<wxCheckBox*
>( ui_item.m_ThicknessLockCtrl );
 
 1250            wxBitmapComboBox* choice = 
dynamic_cast<wxBitmapComboBox*
>( ui_item.m_ColorCtrl );
 
 1254                int idx = choice->GetSelection();
 
 1257                    item->
SetColor( ui_item.m_UserColor.ToHexString(), sub_item );
 
 1266        wxMessageBox( error_msg, 
_( 
"Errors" ) );
 
 
 1298        if( item->IsEnabled() )
 
 
 1380    int                 idx = 
event.GetSelection();
 
 1381    int                 item_id = 
event.GetId();
 
 1398            wxBitmapComboBox* combo = 
static_cast<wxBitmapComboBox*
>( FindWindowById( item_id ) );
 
 1403            combo->SetString( idx, 
color.ToHexString() );
 
 1407            combo->SetItemBitmap( combo->GetCount() - 1, layerbmp );
 
 1409            combo->SetSelection( idx );
 
 
 1438        for( 
int ii = 0; ii < item->GetSublayersCount(); ii++ )
 
 1441                                               item->GetEpsilonR( ii ),
 
 1442                                               item->GetLossTangent( ii ) );
 
 1444            if( idx < 0 && !item->GetMaterial().IsEmpty() )
 
 1448                new_mat.
m_Name = item->GetMaterial( ii );
 
 1449                new_mat.
m_EpsilonR = item->GetEpsilonR( ii );
 
 1466    default:                      item_mat_list = 
nullptr;              
break;
 
 1469    wxCHECK( item_mat_list,  );
 
 1478    if( substrate.
m_Name.IsEmpty() )    
 
 1486    wxTextCtrl* textCtrl = 
static_cast<wxTextCtrl*
>( 
m_rowUiItemsList[row].m_MaterialCtrl );
 
 1487    textCtrl->ChangeValue( item->
GetMaterial( sub_item ) );
 
 1490            && !item->
GetColor( sub_item ).StartsWith( 
"#" )  )
 
 1492        if( substrate.
m_Name.IsSameAs( 
"PTFE" )
 
 1493              || substrate.
m_Name.IsSameAs( 
"Teflon" ) )
 
 1495            item->
SetColor( 
"PTFE natural", sub_item );
 
 1497        else if( substrate.
m_Name.IsSameAs( 
"Polyimide" )
 
 1498              || substrate.
m_Name.IsSameAs( 
"Kapton" ) )
 
 1500            item->
SetColor( 
"Polyimide", sub_item );
 
 1502        else if( substrate.
m_Name.IsSameAs( 
"Al" ) )
 
 1504            item->
SetColor( 
"Aluminum", sub_item );
 
 1508            item->
SetColor( 
"FR4 natural", sub_item );
 
 1512    wxBitmapComboBox* picker = 
static_cast<wxBitmapComboBox*
>( 
m_rowUiItemsList[row].m_ColorCtrl );
 
 1518            picker->SetSelection( ii );
 
 1526        textCtrl = 
dynamic_cast<wxTextCtrl*
>( 
m_rowUiItemsList[row].m_EpsilonCtrl );
 
 1535        textCtrl = 
dynamic_cast<wxTextCtrl*
>( 
m_rowUiItemsList[row].m_LossTgCtrl );
 
 
 1546    wxString value = 
event.GetString();
 
 
 1573    wxASSERT( st_item );
 
 1589        wxFAIL_MSG( wxT( 
"PANEL_SETUP_BOARD_STACKUP::getColorIconItem: unrecognized item type" ) );
 
 1593    wxASSERT_MSG( 
color.IsOk(), wxT( 
"Invalid color in PCB stackup" ) );
 
 
 1602    const int bitmap_depth = 24;
 
 1610        st_bitmap->SetBitmap( bmp );
 
 
 1630                                                    wxEmptyString, wxDefaultPosition,
 
 1631                                                    wxDefaultSize, 0, 
nullptr, wxCB_READONLY );
 
 1644                && aStackupItem && aStackupItem->
GetColor().StartsWith( wxT( 
"#" ) ) )
 
 1647            curr_color = 
COLOR4D( label );
 
 1658        combo->Append( label, layerbmp );
 
 1666    int sel = combo->GetSelection();
 
 1667    combo->SetSelection( combo->GetCount() - 1 );
 
 1669    combo->SetMinSize( wxSize( -1, -1 ) );
 
 1670    wxSize bestSize = combo->GetBestSize();
 
 1673    combo->SetMinSize( bestSize );
 
 1674    combo->SetSelection( sel );
 
 1680    combo->Connect( wxEVT_COMMAND_COMBOBOX_SELECTED,
 
 1684    combo->Bind( wxEVT_COMBOBOX_DROPDOWN,
 
 1685            [combo]( wxCommandEvent& aEvent )
 
 1687                combo->SetString( combo->GetCount() - 1, 
_( 
"Custom..." ) );
 
 
 1696    wxNativePixelData data( aBitmap );
 
 1697    wxNativePixelData::Iterator p( data );
 
 1699    for( 
int yy = 0; yy < data.GetHeight(); yy++ )
 
 1701        wxNativePixelData::Iterator rowStart = p;
 
 1703        for( 
int xx = 0; xx < data.GetWidth(); xx++ )
 
 1705            p.Red() = aColor.Red();
 
 1706            p.Green() = aColor.Green();
 
 1707            p.Blue() = aColor.Blue();
 
 1712        p.OffsetY( data, 1 );
 
 
constexpr EDA_IU_SCALE pcbIUScale
 
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
 
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.
 
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.
 
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 FormatBoardStackup(OUTPUTFORMATTER *aFormatter, const BOARD *aBoard) const
Write the stackup info on board file.
 
Information pertinent to a Pcbnew printed circuit board.
 
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 const LSET & ExternalCuMask()
Return a mask holding the Front and Bottom layers.
 
static LSET AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
 
static const LSET & InternalCuMask()
Return a complete set of internal copper layers which is all Cu layers except F_Cu and B_Cu.
 
static PAGED_DIALOG * GetDialog(wxWindow *aWindow)
 
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
 
PANEL_SETUP_BOARD_STACKUP_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
 
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.
 
PANEL_SETUP_BOARD_STACKUP(wxWindow *aParentWindow, PCB_EDIT_FRAME *aFrame, PANEL_SETUP_LAYERS *aPanelLayers, PANEL_SETUP_BOARD_FINISH *aPanelFinish)
 
wxSize m_numericTextCtrlSize
 
std::vector< wxControl * > m_controlItemsList
 
void onColorSelected(wxCommandEvent &event)
 
bool TransferDataFromWindow() override
 
void onCopperLayersSelCount(wxCommandEvent &event) override
 
void onUnitsChanged(wxCommandEvent &event)
 
void ImportSettingsFrom(BOARD *aBoard)
 
wxColor getColorIconItem(int aRow)
 
PANEL_SETUP_BOARD_FINISH * m_panelFinish
 
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
 
wxControl * addSpacer(int aPos)
add a Spacer in m_fgGridSizer when a empty cell is needed
 
int computeBoardThickness()
Recompute the board thickness and update the textbox.
 
void setDefaultLayerWidths(int targetThickness)
Set the widths of dielectric layers to sensible defaults.
 
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
 
void lazyBuildRowUI(BOARD_STACKUP_ROW_UI_ITEM &ui_row_item, int aPos)
Creates the controls in a BOARD_STACKUP_ROW_UI_ITEM relative to the aStackupItem.
 
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 OnLayersOptionsChanged(const LSET &aNewLayerSet)
Must be called if the copper layers count has changed or solder mask, solder paste or silkscreen laye...
 
~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,...
 
The main frame for Pcbnew.
 
This file contains miscellaneous commonly used macros and functions.
 
KICOMMON_API long long int ValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Convert aTextValue in aUnits to internal units used by the application.
 
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Return the string from aValue according to aUnits (inch, mm ...) for display.
 
KICOMMON_API 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
 
int GetUserUnits()
Return the currently selected user unit value for the interface.
 
void Refresh()
Update the board display after modifying it by a python script (note: it is automatically called by a...
 
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