Stackup manager: Add a dielectric manager to handle more easily user defined dielectric substrates

panel_board_stackup.cpp: material selection:
 replace wxChoice by a better widget (wxTextCtrl+wxButton) to call the dielectric manager dialog
Move dielectric material class to a specific file
This commit is contained in:
jean-pierre charras 2019-09-09 20:30:43 +02:00
parent 6ef4d7879e
commit 271465a644
15 changed files with 1521 additions and 211 deletions

View File

@ -183,10 +183,13 @@ if( KICAD_SCRIPTING AND KICAD_SCRIPTING_ACTION_MENU )
endif()
set( PCBNEW_BRDSTACKUP_MGR
board_stackup_manager/dielectric_material.cpp
board_stackup_manager/stackup_predefined_prms.cpp
board_stackup_manager/panel_board_stackup.cpp
board_stackup_manager/panel_board_stackup_base.cpp
board_stackup_manager/board_stackup_reporter.cpp
board_stackup_manager/dialog_dielectric_list_manager_base.cpp
board_stackup_manager/dialog_dielectric_list_manager.cpp
)
set( PCBNEW_IMPORT_GFX

View File

@ -0,0 +1,125 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file dialog_dielectric_manager.h
*/
#include "dialog_dielectric_list_manager.h"
DIALOG_DIELECTRIC_MATERIAL::DIALOG_DIELECTRIC_MATERIAL( wxWindow* aParent,
DIELECTRIC_SUBSTRATE_LIST& aMaterialList )
:DIALOG_DIELECTRIC_MATERIAL_BASE( aParent ),
m_materialList( aMaterialList )
{
initMaterialList();
}
DIALOG_DIELECTRIC_MATERIAL::~DIALOG_DIELECTRIC_MATERIAL()
{
}
bool DIALOG_DIELECTRIC_MATERIAL::TransferDataFromWindow()
{
// Validate double values from wxTextCtrl
double dummy;
if( !m_tcEpsilonR->GetValue().ToDouble( &dummy ) || dummy < 0.0 )
{
wxMessageBox( _( " Incorrect value for Epsilon R" ) );
return false;
}
if( !m_tcLossTg->GetValue().ToDouble( &dummy ) || dummy < 0.0 )
{
wxMessageBox( _( " Incorrect value for Loss Tangent" ) );
return false;
}
return true;
}
bool DIALOG_DIELECTRIC_MATERIAL::TransferDataToWindow()
{
// Init m_tcEpsilonR and m_tcLossTg to a dummy (default) value
DIELECTRIC_SUBSTRATE dummy;
dummy.m_EpsilonR = 1.0;
dummy.m_LossTangent = 0.0;
m_tcEpsilonR->SetValue( dummy.FormatEpsilonR() );
m_tcLossTg->SetValue( dummy.FormatLossTangent() );
return true;
}
DIELECTRIC_SUBSTRATE DIALOG_DIELECTRIC_MATERIAL::GetSelectedSubstrate()
{
DIELECTRIC_SUBSTRATE substrate;
// return the selected/created substrate. A empty substrate can be returned
double dummy;
substrate.m_Name = m_tcMaterial->GetValue();
m_tcEpsilonR->GetValue().ToDouble( &dummy );
substrate.m_EpsilonR = dummy;
m_tcLossTg->GetValue().ToDouble( &dummy );
substrate.m_LossTangent = dummy;
return substrate;
}
void DIALOG_DIELECTRIC_MATERIAL::initMaterialList()
{
m_lcMaterials->AppendColumn( _( "Material" ) );
m_lcMaterials->AppendColumn( _( "Epsilon R" ) );
m_lcMaterials->AppendColumn( _( "Loss Tg" ) );
// Fills m_lcMaterials with available materials
for( int idx = 0; idx < m_materialList.GetCount(); ++idx )
{
DIELECTRIC_SUBSTRATE* item = m_materialList.GetSubstrate( idx );
if( item->m_Name == USER_DEFINED )
break;
long tmp = m_lcMaterials->InsertItem( idx, item->m_Name );
m_lcMaterials->SetItemData(tmp, idx);
m_lcMaterials->SetItem(tmp, 1, item->FormatEpsilonR() );
m_lcMaterials->SetItem(tmp, 2, item->FormatLossTangent() );
}
}
void DIALOG_DIELECTRIC_MATERIAL::onListItemSelected( wxListEvent& event )
{
int idx = event.GetIndex();
if( idx < 0 )
return;
m_tcMaterial->SetValue( m_materialList.GetSubstrate( idx )->m_Name );
m_tcEpsilonR->SetValue( m_materialList.GetSubstrate( idx )->FormatEpsilonR() );
m_tcLossTg->SetValue( m_materialList.GetSubstrate( idx )->FormatLossTangent() );
}

View File

@ -0,0 +1,56 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file dialog_dielectric_manager.h
*/
#ifndef DIALOG_DIELECTRIC_MANAGER_H
#define DIALOG_DIELECTRIC_MANAGER_H
#include "dialog_dielectric_list_manager_base.h"
#include "stackup_predefined_prms.h"
#include "dielectric_material.h"
/**
* a Dialog to select/change/add a dielectric material from a material list
*/
class DIALOG_DIELECTRIC_MATERIAL: public DIALOG_DIELECTRIC_MATERIAL_BASE
{
public:
DIALOG_DIELECTRIC_MATERIAL( wxWindow* aParent, DIELECTRIC_SUBSTRATE_LIST& aMaterialList );
~DIALOG_DIELECTRIC_MATERIAL();
/// @return the selected substrate. If no substrate selected
/// a empty substrate is returned
DIELECTRIC_SUBSTRATE GetSelectedSubstrate();
private:
void onListItemSelected( wxListEvent& event ) override;
bool TransferDataFromWindow() override;
bool TransferDataToWindow() override;
void initMaterialList(); // Fills the dialog with available materials
/// The list of available materials
DIELECTRIC_SUBSTRATE_LIST& m_materialList;
};
#endif // #ifndef DIALOG_DIELECTRIC_MANAGER_H

View File

@ -0,0 +1,108 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_dielectric_list_manager_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_DIELECTRIC_MATERIAL_BASE::DIALOG_DIELECTRIC_MATERIAL_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bSizerUpper;
bSizerUpper = new wxBoxSizer( wxVERTICAL );
m_staticTextNewDielectric = new wxStaticText( this, wxID_ANY, _("Dielectric material characteristics:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextNewDielectric->Wrap( -1 );
bSizerUpper->Add( m_staticTextNewDielectric, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerNewItem;
bSizerNewItem = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgSizerNewDielectric;
fgSizerNewDielectric = new wxFlexGridSizer( 2, 3, 0, 0 );
fgSizerNewDielectric->AddGrowableCol( 0 );
fgSizerNewDielectric->SetFlexibleDirection( wxBOTH );
fgSizerNewDielectric->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTexMaterial = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTexMaterial->Wrap( -1 );
fgSizerNewDielectric->Add( m_staticTexMaterial, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextEpsilonR = new wxStaticText( this, wxID_ANY, _("Epsilon R:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextEpsilonR->Wrap( -1 );
fgSizerNewDielectric->Add( m_staticTextEpsilonR, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_staticTextLossTg = new wxStaticText( this, wxID_ANY, _("Loss Tg:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextLossTg->Wrap( -1 );
fgSizerNewDielectric->Add( m_staticTextLossTg, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_tcMaterial = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerNewDielectric->Add( m_tcMaterial, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_tcEpsilonR = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerNewDielectric->Add( m_tcEpsilonR, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_tcLossTg = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerNewDielectric->Add( m_tcLossTg, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
bSizerNewItem->Add( fgSizerNewDielectric, 1, 0, 5 );
bSizerUpper->Add( bSizerNewItem, 0, wxEXPAND, 5 );
m_staticText = new wxStaticText( this, wxID_ANY, _("Available materials:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText->Wrap( -1 );
bSizerUpper->Add( m_staticText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_lcMaterials = new wxListCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxLC_SINGLE_SEL );
bSizerUpper->Add( m_lcMaterials, 1, wxALL|wxEXPAND, 5 );
bSizerMain->Add( bSizerUpper, 1, wxEXPAND, 5 );
m_staticline = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bSizerBottom;
bSizerBottom = new wxBoxSizer( wxHORIZONTAL );
bSizerBottom->Add( 0, 0, 1, wxEXPAND, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerBottom->Add( m_sdbSizer, 0, wxALL, 5 );
bSizerMain->Add( bSizerBottom, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
this->Centre( wxBOTH );
// Connect Events
m_lcMaterials->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_DIELECTRIC_MATERIAL_BASE::onListItemSelected ), NULL, this );
}
DIALOG_DIELECTRIC_MATERIAL_BASE::~DIALOG_DIELECTRIC_MATERIAL_BASE()
{
// Disconnect Events
m_lcMaterials->Disconnect( wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler( DIALOG_DIELECTRIC_MATERIAL_BASE::onListItemSelected ), NULL, this );
}

View File

@ -0,0 +1,763 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration">; </property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_dielectric_list_manager_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">DialogDielectricListManager</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">impl_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_DIELECTRIC_MATERIAL_BASE</property>
<property name="pos"></property>
<property name="size">581,353</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">; ; forward_declare</property>
<property name="title"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerUpper</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Dielectric material characteristics:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextNewDielectric</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerNewItem</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">0</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizerNewDielectric</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">2</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Name:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTexMaterial</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Epsilon R:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextEpsilonR</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Loss Tg:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextLossTg</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_tcMaterial</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_tcEpsilonR</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_tcLossTg</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Available materials:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxListCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_lcMaterials</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLC_REPORT|wxLC_SINGLE_SEL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnListItemSelected">onListItemSelected</event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerBottom</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,61 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/listctrl.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DIELECTRIC_MATERIAL_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DIELECTRIC_MATERIAL_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticTextNewDielectric;
wxStaticText* m_staticTexMaterial;
wxStaticText* m_staticTextEpsilonR;
wxStaticText* m_staticTextLossTg;
wxTextCtrl* m_tcMaterial;
wxTextCtrl* m_tcEpsilonR;
wxTextCtrl* m_tcLossTg;
wxStaticText* m_staticText;
wxListCtrl* m_lcMaterials;
wxStaticLine* m_staticline;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void onListItemSelected( wxListEvent& event ) { event.Skip(); }
public:
DIALOG_DIELECTRIC_MATERIAL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 581,353 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DIELECTRIC_MATERIAL_BASE();
};

View File

@ -0,0 +1,142 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dielectric_material.cpp
*/
//#include "class_board_stackup.h"
//#include <convert_to_biu.h>
//#include <board_design_settings.h>
//#include <macros.h>
#include "stackup_predefined_prms.h"
#include "dielectric_material.h"
// A list of available substrate material
// These names are used in .gbrjob file, so they are not fully free.
// So do not change name with "used in .gbrjob file" comment.
// These names are in fact usual substrate names.
// However one can add and use other names for material name.
// DO NOT translate them, as they are proper noun
static DIELECTRIC_SUBSTRATE substrateMaterial[] =
{
{ NOT_SPECIFIED, 0.0, 0.0 }, // Not specified, not in .gbrjob file
{ "FR4", 4.5, 0.02 }, // used in .gbrjob file
{ "Polyimide", 1.0, 0.0 }, // used in .gbrjob file
{ "Polyolefin", 1.0, 0.0 }, // used in .gbrjob file
{ "Al", 8.7, 0.001 }, // used in .gbrjob file
{ "PTFE", 2.1, 0.0002 }, // used in .gbrjob file
{ "Teflon", 2.1, 0.0002 }, // used in .gbrjob file
{ "Ceramic", 1.0, 0.0 } // used in .gbrjob file
// Other names are free
};
wxString DIELECTRIC_SUBSTRATE::FormatEpsilonR()
{
// return a wxString to print/display Epsilon R
wxString txt;
txt.Printf( "%.1f", m_EpsilonR );
return txt;
}
wxString DIELECTRIC_SUBSTRATE::FormatLossTangent()
{
// return a wxString to print/display Loss Tangent
wxString txt;
txt.Printf( "%g", m_LossTangent );
return txt;
}
DIELECTRIC_SUBSTRATE_LIST::DIELECTRIC_SUBSTRATE_LIST()
{
// Fills the m_substrateList with predefined params:
for( unsigned ii = 0; ii < arrayDim( substrateMaterial ); ++ii )
m_substrateList.push_back( substrateMaterial[ii] );
}
DIELECTRIC_SUBSTRATE* DIELECTRIC_SUBSTRATE_LIST::GetSubstrate( int aIdx )
{
if( aIdx >= 0 && aIdx < GetCount() )
return &m_substrateList[aIdx];
return nullptr;
}
DIELECTRIC_SUBSTRATE* DIELECTRIC_SUBSTRATE_LIST::GetSubstrate( const wxString& aName )
{
for( DIELECTRIC_SUBSTRATE& item : m_substrateList )
{
if( item.m_Name.CmpNoCase( aName ) == 0 )
return &item;
}
return nullptr;
}
int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( DIELECTRIC_SUBSTRATE* aItem )
{
// Find a item matching aItem. The comparison is for the name case insensitive
int idx = 0;
for( DIELECTRIC_SUBSTRATE& item : m_substrateList )
{
if( item.m_EpsilonR == aItem->m_EpsilonR &&
item.m_LossTangent == aItem->m_LossTangent &&
item.m_Name.CmpNoCase( aItem->m_Name ) == 0
)
return idx;
++idx;
}
return -1;
}
int DIELECTRIC_SUBSTRATE_LIST::FindSubstrate( const wxString& aName, double aEpsilonR, double aLossTg )
{
// Find a item matching parameters
int idx = 0;
for( DIELECTRIC_SUBSTRATE& item : m_substrateList )
{
if( item.m_EpsilonR == aEpsilonR &&
item.m_LossTangent == aLossTg &&
item.m_Name.CmpNoCase( aName ) == 0
)
return idx;
++idx;
}
return -1;
}

View File

@ -0,0 +1,102 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file dielectric_material.h
*/
#ifndef DIELECTRIC_MATERIAL_H
#define DIELECTRIC_MATERIAL_H
#include <wx/string.h>
// A class to handle substrates prms in gerber job file and dialog
struct DIELECTRIC_SUBSTRATE
{
wxString m_Name; // the name (in job file) of material
double m_EpsilonR; // the epsilon r of this material
double m_LossTangent; // the loss tangent (tanD) of this material
wxString FormatEpsilonR(); // return a wxString to print/display Epsilon R
wxString FormatLossTangent();// return a wxString to print/display Loss Tangent
};
// A struct to handle a list of substrates prms in gerber job file and dialogs
class DIELECTRIC_SUBSTRATE_LIST
{
///> The list of available substrates. It contians at least predefined substrates
std::vector<DIELECTRIC_SUBSTRATE> m_substrateList;
public:
DIELECTRIC_SUBSTRATE_LIST();
/**
* @return the number of substrates in list
*/
int GetCount() { return (int)m_substrateList.size(); }
/**
* @return the substrate in list of index aIdx
* if incorrect return nullptr
* @param aIdx is the index in substrate list.
*/
DIELECTRIC_SUBSTRATE* GetSubstrate( int aIdx );
/**
* @return the substrate in list of name aName
* if not found return nullptr
* @param aName is the name of the substrate in substrate list.
* the comparison is case insensitve
*/
DIELECTRIC_SUBSTRATE* GetSubstrate( const wxString& aName );
/** Find a item in list similar to aItem
* @param aItem is the item to match
* @return the index of similar item in list or -1 if not found
* the comparison is for the name case insensitive, and EpsilonR and LossTg must match
*/
int FindSubstrate( DIELECTRIC_SUBSTRATE* aItem );
/** Find a item in list having the sapme parameters
* @param aName is the name to match (case insensitive)
* @param aEpsilonR is the Repaltive Permeatbility to match
* @param aLossTg is the loss tangent to match
* @return the index of similar item in list or -1 if not found
*/
int FindSubstrate( const wxString& aName, double aEpsilonR, double aLossTg );
/** Append a item in list similar to aItem
* @param aItem is the item to append
* @return the index of the new item in list
*/
int AppendSubstrate( DIELECTRIC_SUBSTRATE& aItem )
{
m_substrateList.emplace_back( aItem );
return GetCount()-1;
}
};
#endif // #ifndef DIELECTRIC_MATERIAL_H

View File

@ -37,6 +37,7 @@
#include <bitmaps.h>
#include <wx/clipbrd.h>
#include <wx/dataobj.h>
#include "dialog_dielectric_list_manager.h"
// Some wx widget ID to know what widget has fired a event:
#define ID_INCREMENT 128 // space between 2 ID type. Bigger than the layer count max
@ -118,10 +119,10 @@ void PANEL_SETUP_BOARD_STACKUP::disconnectEvents()
wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP::onColorSelected ),
NULL, this );
wxChoice* choice = dynamic_cast<wxChoice*>( item );
wxButton* matButt = dynamic_cast<wxButton*>( item );
if( choice )
choice->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED,
if( matButt )
matButt->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP::onMaterialChange ),
NULL, this );
@ -258,17 +259,10 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync )
if( item->IsMaterialEditable() )
{
wxChoice* choice = dynamic_cast<wxChoice*>( ui_row_item.m_MaterialCtrl );
wxTextCtrl* matName = dynamic_cast<wxTextCtrl*>( ui_row_item.m_MaterialCtrl );
for( int ii = 0; ii < m_materialList.GetCount(); ii++ )
{
if( m_materialList.GetSubstrate( ii )->m_Name == item->m_Material )
{
if( choice )
choice->SetSelection( ii );
break;
}
}
if( matName )
matName->SetValue( item->m_Material );
}
if( item->IsThicknessEditable() )
@ -363,6 +357,10 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync )
ui_row_item.m_LayerName->Show( show_item );
ui_row_item.m_LayerTypeCtrl->Show( show_item );
ui_row_item.m_MaterialCtrl->Show( show_item );
if( ui_row_item.m_MaterialButt )
ui_row_item.m_MaterialButt->Show( show_item );
ui_row_item.m_ThicknessCtrl->Show( show_item );
ui_row_item.m_ThicknessLockCtrl->Show( show_item );
ui_row_item.m_ColorCtrl->Show( show_item );
@ -376,6 +374,34 @@ void PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard( bool aFullSync )
}
void PANEL_SETUP_BOARD_STACKUP::addMaterialChooser( wxWindowID aId,
const wxString * aMaterialName,
BOARD_STACKUP_ROW_UI_ITEM& aUiRowItem )
{
wxBoxSizer* bSizerMat = new wxBoxSizer( wxHORIZONTAL );
m_fgGridSizer->Add( bSizerMat, 1, wxEXPAND, 2 );
wxTextCtrl* textCtrl = new wxTextCtrl( m_scGridWin, wxID_ANY );
if( aMaterialName )
textCtrl->SetValue( *aMaterialName );
textCtrl->SetMinSize( m_numericTextCtrlSize );
bSizerMat->Add( textCtrl, 0, wxTOP|wxBOTTOM|wxLEFT, 5 );
wxButton* m_buttonMat = new wxButton( m_scGridWin, aId, _("..."),
wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT );
bSizerMat->Add( m_buttonMat, 0, wxALIGN_CENTER_VERTICAL, 2 );
m_buttonMat->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP::onMaterialChange ),
NULL, this );
m_controlItemsList.push_back( m_buttonMat );
aUiRowItem.m_MaterialCtrl = textCtrl;
aUiRowItem.m_MaterialButt = m_buttonMat;
}
wxControl* PANEL_SETUP_BOARD_STACKUP::addSpacer()
{
wxStaticText* emptyText = new wxStaticText( m_scGridWin, wxID_ANY, wxEmptyString );
@ -391,12 +417,6 @@ void PANEL_SETUP_BOARD_STACKUP::buildLayerStackPanel()
// for dielectric: layer type keyword is "prepreg"
m_core_prepreg_choice.Add( _( "PrePreg" ) );
// Build an array string of available materials (for substrate/dielectric)
wxArrayString materialChoices;
for( int ii = 0; ii < m_materialList.GetCount(); ii++ )
materialChoices.Add( wxGetTranslation( m_materialList.GetSubstrate( ii )->m_Name ) );
// Build a full stackup for the dialog, with a active copper layer count
// = current board layer count to calculate a reasonable default
// dielectric thickness, for board having no stackup initalized:
@ -459,22 +479,7 @@ void PANEL_SETUP_BOARD_STACKUP::buildLayerStackPanel()
if( item->IsMaterialEditable() )
{
wxChoice* choice = new wxChoice( m_scGridWin, ID_ITEM_MATERIAL+row, wxDefaultPosition,
wxDefaultSize, materialChoices );
for( int ii = 0; ii < m_materialList.GetCount(); ii++ )
{
if( m_materialList.GetSubstrate( ii )->m_Name == item->m_Material )
choice->SetSelection( ii );
}
m_fgGridSizer->Add( choice, 0, wxEXPAND|wxLEFT|wxRIGHT|wxALIGN_CENTER_VERTICAL, 2 );
choice->Connect( wxEVT_COMMAND_CHOICE_SELECTED,
wxCommandEventHandler( PANEL_SETUP_BOARD_STACKUP::onMaterialChange ),
NULL, this );
m_controlItemsList.push_back( choice );
ui_row_item.m_MaterialCtrl = choice;
addMaterialChooser( ID_ITEM_MATERIAL+row, &item->m_Material, ui_row_item );
}
else
{
@ -674,14 +679,14 @@ bool PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup()
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( m_rowUiItemsList[row].m_EpsilonCtrl );
txt = textCtrl->GetValue();
if( txt.ToDouble( &value ) )
if( txt.ToDouble( &value ) && value >= 0.0 )
item->m_EpsilonR = value;
else if( txt.ToCDouble( &value ) )
else if( txt.ToCDouble( &value ) && value >= 0.0 )
item->m_EpsilonR = value;
else
{
success = false;
error_msg << _( "Incorrect value for Epsilon R" );
error_msg << _( "Incorrect value for Epsilon R (Epsilon R must be positive or null if not used)" );
}
}
@ -690,24 +695,23 @@ bool PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup()
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( m_rowUiItemsList[row].m_LossTgCtrl );
txt = textCtrl->GetValue();
if( txt.ToDouble( &value ) )
if( txt.ToDouble( &value ) && value >= 0.0 )
item->m_LossTangent = value;
else if( txt.ToCDouble( &value ) )
else if( txt.ToCDouble( &value ) && value >= 0.0 )
item->m_LossTangent = value;
else
{
success = false;
if( !error_msg.IsEmpty() )
error_msg << "\n";
error_msg << _( "Incorrect value for Loss tangent" );
error_msg << _( "Incorrect value for Loss tg (Loss tg must be or null if not used)" );
}
}
if( item->IsMaterialEditable() )
{
wxChoice* choice = static_cast<wxChoice*>( m_rowUiItemsList[row].m_MaterialCtrl );
int idx = choice->GetSelection();
item->m_Material = m_materialList.GetSubstrate( idx )->m_Name;
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( m_rowUiItemsList[row].m_MaterialCtrl );
item->m_Material = textCtrl->GetValue();
}
if( item->m_Type == BS_ITEM_TYPE_DIELECTRIC )
@ -938,8 +942,6 @@ void PANEL_SETUP_BOARD_STACKUP::onColorSelected( wxCommandEvent& event )
int row = item_id - ID_ITEM_COLOR;
wxASSERT( (int)m_UserColors.size() > row );
wxColour color = GetColorStandardList()[idx].m_Color;
if( GetColorStandardListCount()-1 == idx ) // Set user color is the last option in list
{
wxColourDialog dlg( this );
@ -947,7 +949,7 @@ void PANEL_SETUP_BOARD_STACKUP::onColorSelected( wxCommandEvent& event )
if( dlg.ShowModal() == wxID_OK )
{
wxBitmapComboBox* combo = static_cast<wxBitmapComboBox*>( FindWindowById( item_id ) );
color = dlg.GetColourData().GetColour();
wxColour color = dlg.GetColourData().GetColour();
m_UserColors[row] = color;
combo->SetString( idx, color.GetAsString( wxC2S_HTML_SYNTAX ) );
@ -965,16 +967,54 @@ void PANEL_SETUP_BOARD_STACKUP::onColorSelected( wxCommandEvent& event )
void PANEL_SETUP_BOARD_STACKUP::onMaterialChange( wxCommandEvent& event )
{
// Ensure m_materialList contains all materials already in use in stacjup list
// and add it is missing
if( !transferDataFromUIToStackup() )
return;
for( BOARD_STACKUP_ITEM* item : m_stackup.GetList() )
{
if( item->m_Type == BS_ITEM_TYPE_DIELECTRIC )
{
int idx = m_materialList.FindSubstrate( item->m_Material,
item->m_EpsilonR,
item->m_LossTangent );
if( idx < 0 && !item->m_Material.IsEmpty() )
{
// This material is not in list: add it
DIELECTRIC_SUBSTRATE new_mat;
new_mat.m_Name = item->m_Material;
new_mat.m_EpsilonR = item->m_EpsilonR;
new_mat.m_LossTangent = item->m_LossTangent;
m_materialList.AppendSubstrate( new_mat );
}
}
}
DIALOG_DIELECTRIC_MATERIAL dlg( this, m_materialList );
if( dlg.ShowModal() != wxID_OK )
return;
DIELECTRIC_SUBSTRATE substrate = dlg.GetSelectedSubstrate();
if( substrate.m_Name.IsEmpty() ) // No substrate specified
return;
int row = event.GetId() - ID_ITEM_MATERIAL;
int selection = event.GetSelection();
// Update Epsilon R and Loss tg
// Update Name, Epsilon R and Loss tg
BOARD_STACKUP_ITEM* item = GetStackupItem( row );
item->m_Material = m_materialList.GetSubstrate( selection )->m_Name;
item->m_EpsilonR = m_materialList.GetSubstrate( selection )->m_EpsilonR;
item->m_LossTangent = m_materialList.GetSubstrate( selection )->m_LossTangent;
item->m_Material = substrate.m_Name;
item->m_EpsilonR = substrate.m_EpsilonR;
item->m_LossTangent = substrate.m_LossTangent;
wxTextCtrl* textCtrl = static_cast<wxTextCtrl*>( m_rowUiItemsList[row].m_EpsilonCtrl );
wxTextCtrl* textCtrl;
textCtrl = static_cast<wxTextCtrl*>( m_rowUiItemsList[row].m_MaterialCtrl );
textCtrl->SetValue( item->m_Material );
textCtrl = static_cast<wxTextCtrl*>( m_rowUiItemsList[row].m_EpsilonCtrl );
textCtrl->SetValue( item->FormatEpsilonR() );
textCtrl = static_cast<wxTextCtrl*>( m_rowUiItemsList[row].m_LossTgCtrl );

View File

@ -34,6 +34,7 @@
#include "panel_board_stackup_base.h"
#include "class_board_stackup.h"
#include "stackup_predefined_prms.h"
#include "dielectric_material.h"
class wxBitmapComboBox;
class PANEL_SETUP_LAYERS;
@ -52,7 +53,8 @@ struct BOARD_STACKUP_ROW_UI_ITEM
wxStaticBitmap* m_Icon; // Color icon in first column (column 1)
wxStaticText* m_LayerName; // string shown in column 2
wxControl* m_LayerTypeCtrl; // control shown in column 3
wxControl* m_MaterialCtrl; // control shown in column 4
wxControl* m_MaterialCtrl; // control shown in column 4, with m_MaterialButt
wxButton* m_MaterialButt; // control shown in column 4, with m_MaterialCtrl
wxControl* m_ThicknessCtrl; // control shown in column 5
wxControl* m_ThicknessLockCtrl;// control shown in column 6
wxControl* m_ColorCtrl; // control shown in column 7
@ -61,8 +63,10 @@ struct BOARD_STACKUP_ROW_UI_ITEM
BOARD_STACKUP_ROW_UI_ITEM() :
m_isEnabled( true ), m_Icon( nullptr ), m_LayerName( nullptr ),
m_LayerTypeCtrl( nullptr ), m_MaterialCtrl( nullptr ),
m_LayerTypeCtrl( nullptr ),
m_MaterialCtrl( nullptr ),m_MaterialButt( nullptr ),
m_ThicknessCtrl( nullptr ), m_ThicknessLockCtrl( nullptr ),
m_ColorCtrl( nullptr ),
m_EpsilonCtrl( nullptr ), m_LossTgCtrl( nullptr )
{}
};
@ -98,8 +102,19 @@ public:
std::vector<wxColor> m_UserColors; // the list of user colors for each grid row
// other colors are defined colors, and are not stored
private:
/** add a Spacer in m_fgGridSizer when a empty cell is needed
*/
wxControl* addSpacer();
/** add a control (a wxTextCtrl + a button) in m_fgGridSizer to select a material
* @param aId is the wxControl id, used to know the event source
* @param aMaterialName is the the name of the currently selected material (can be null)
* @param aUiRowItem is the the BOARD_STACKUP_ROW_UI_ITEM to store the controls
* created
*/
void addMaterialChooser( wxWindowID aId, const wxString * aMaterialName,
BOARD_STACKUP_ROW_UI_ITEM& aUiRowItem );
/** Populate m_fgGridSizer with items to handle stackup parameters
* This is a full list:
* all copper layers and all tech layers that are supported by the stackup
@ -167,7 +182,7 @@ private:
// restricted to allowed layers in stackup.
// when do not match the enabled layers
// in PANEL_SETUP_LAYERS the stackup is not up to date
FAB_SUBSTRATE_LIST m_materialList; // a list of currently available materials
DIELECTRIC_SUBSTRATE_LIST m_materialList; // a list of currently available materials
std::vector<BOARD_STACKUP_ROW_UI_ITEM> m_rowUiItemsList; // List of items in m_fgGridSizer
BOARD* m_board;
BOARD_DESIGN_SETTINGS* m_brdSettings;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -59,11 +59,11 @@ PANEL_SETUP_BOARD_STACKUP_BASE::PANEL_SETUP_BOARD_STACKUP_BASE( wxWindow* parent
m_fgGridSizer->SetFlexibleDirection( wxHORIZONTAL );
m_fgGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText7 = new wxStaticText( m_scGridWin, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText7->Wrap( -1 );
m_staticText7->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_staticTextLayer = new wxStaticText( m_scGridWin, wxID_ANY, _("Layer"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticTextLayer->Wrap( -1 );
m_staticTextLayer->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgGridSizer->Add( m_staticText7, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_fgGridSizer->Add( m_staticTextLayer, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_staticText8 = new wxStaticText( m_scGridWin, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText8->Wrap( -1 );
@ -71,44 +71,44 @@ PANEL_SETUP_BOARD_STACKUP_BASE::PANEL_SETUP_BOARD_STACKUP_BASE( wxWindow* parent
m_fgGridSizer->Add( m_staticText8, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticText9 = new wxStaticText( m_scGridWin, wxID_ANY, _("Type"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText9->Wrap( -1 );
m_staticText9->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_staticTextType = new wxStaticText( m_scGridWin, wxID_ANY, _("Type"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticTextType->Wrap( -1 );
m_staticTextType->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgGridSizer->Add( m_staticText9, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_fgGridSizer->Add( m_staticTextType, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_staticText10 = new wxStaticText( m_scGridWin, wxID_ANY, _("Material"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText10->Wrap( -1 );
m_staticText10->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_staticTextMaterial = new wxStaticText( m_scGridWin, wxID_ANY, _("Material"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticTextMaterial->Wrap( -1 );
m_staticTextMaterial->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgGridSizer->Add( m_staticText10, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_fgGridSizer->Add( m_staticTextMaterial, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_staticText101 = new wxStaticText( m_scGridWin, wxID_ANY, _("Thickness"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText101->Wrap( -1 );
m_staticText101->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_staticTextThickness = new wxStaticText( m_scGridWin, wxID_ANY, _("Thickness"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticTextThickness->Wrap( -1 );
m_staticTextThickness->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgGridSizer->Add( m_staticText101, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_fgGridSizer->Add( m_staticTextThickness, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_bitmapLockThickness = new wxStaticBitmap( m_scGridWin, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
m_fgGridSizer->Add( m_bitmapLockThickness, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticText102 = new wxStaticText( m_scGridWin, wxID_ANY, _("Color"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText102->Wrap( -1 );
m_staticText102->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_staticTextColor = new wxStaticText( m_scGridWin, wxID_ANY, _("Color"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticTextColor->Wrap( -1 );
m_staticTextColor->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgGridSizer->Add( m_staticText102, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_fgGridSizer->Add( m_staticTextColor, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_staticText103 = new wxStaticText( m_scGridWin, wxID_ANY, _("Epsilon R"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText103->Wrap( -1 );
m_staticText103->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_staticTextEpsilonR = new wxStaticText( m_scGridWin, wxID_ANY, _("Epsilon R"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticTextEpsilonR->Wrap( -1 );
m_staticTextEpsilonR->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgGridSizer->Add( m_staticText103, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_fgGridSizer->Add( m_staticTextEpsilonR, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_staticText104 = new wxStaticText( m_scGridWin, wxID_ANY, _("Loss Tan"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticText104->Wrap( -1 );
m_staticText104->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_staticTextLossTg = new wxStaticText( m_scGridWin, wxID_ANY, _("Loss Tan"), wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
m_staticTextLossTg->Wrap( -1 );
m_staticTextLossTg->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
m_fgGridSizer->Add( m_staticText104, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_fgGridSizer->Add( m_staticTextLossTg, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxLEFT, 2 );
m_scGridWin->SetSizer( m_fgGridSizer );

View File

@ -14,6 +14,7 @@
<property name="file">panel_board_stackup_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="image_path_wrapper_function_name"></property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">PANEL_BOARD_SETUP_BASE</property>
@ -25,6 +26,7 @@
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_array_enum">0</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Panel" expanded="1">
@ -595,7 +597,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText7</property>
<property name="name">m_staticTextLayer</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -717,7 +719,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText9</property>
<property name="name">m_staticTextType</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -778,7 +780,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText10</property>
<property name="name">m_staticTextMaterial</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -839,7 +841,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText101</property>
<property name="name">m_staticTextThickness</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -958,7 +960,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText102</property>
<property name="name">m_staticTextColor</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1019,7 +1021,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText103</property>
<property name="name">m_staticTextEpsilonR</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
@ -1080,7 +1082,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticText104</property>
<property name="name">m_staticTextLossTg</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// C++ code generated with wxFormBuilder (version Jul 10 2019)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -51,15 +51,15 @@ class PANEL_SETUP_BOARD_STACKUP_BASE : public wxPanel
wxBoxSizer* m_sizerStackup;
wxScrolledWindow* m_scGridWin;
wxFlexGridSizer* m_fgGridSizer;
wxStaticText* m_staticText7;
wxStaticText* m_staticTextLayer;
wxStaticText* m_staticText8;
wxStaticText* m_staticText9;
wxStaticText* m_staticText10;
wxStaticText* m_staticText101;
wxStaticText* m_staticTextType;
wxStaticText* m_staticTextMaterial;
wxStaticText* m_staticTextThickness;
wxStaticBitmap* m_bitmapLockThickness;
wxStaticText* m_staticText102;
wxStaticText* m_staticText103;
wxStaticText* m_staticText104;
wxStaticText* m_staticTextColor;
wxStaticText* m_staticTextEpsilonR;
wxStaticText* m_staticTextLossTg;
wxRadioBox* m_rbDielectricConstraint;
wxCheckBox* m_cbCastellatedPads;
wxCheckBox* m_cbEgdesPlated;

View File

@ -77,71 +77,6 @@ static FAB_LAYER_COLOR solderMaskColors[] =
};
// A list of available substrate material
// These names are used in .gbrjob file, so they are not fully free.
// Use only what is allowed in .gbrjob files.
// These names are in fact usual substrate names.
static FAB_SUBSTRATE substrateMaterial[] =
{
{ _HKI( NOT_SPECIFIED ), 0.0, 0.0 }, // Not specified, not in .gbrjob file
{ _HKI( "FR4" ), 4.5, 0.02 }, // used in .gbrjob file
{ _HKI( "Polyimide" ), 1.0, 0.0 }, // used in .gbrjob file
{ _HKI( "Polyolefin" ), 1.0, 0.0 }, // used in .gbrjob file
{ _HKI( "Al" ), 8.7, 0.001 }, // used in .gbrjob file
{ _HKI( "PTFE" ), 2.1, 0.0002 }, // used in .gbrjob file
{ _HKI( "Teflon" ), 2.1, 0.0002 }, // used in .gbrjob file
{ _HKI( "Ceramic" ), 1.0, 0.0 }, // used in .gbrjob file
{ _HKI( USER_DEFINED ), 1.0, 0.0 }, // Free string
};
wxString FAB_SUBSTRATE::FormatEpsilonR()
{
// return a wxString to print/display Epsilon R
wxString txt;
txt.Printf( "%.1f", m_EpsilonR );
return txt;
}
wxString FAB_SUBSTRATE::FormatLossTangent()
{
// return a wxString to print/display Loss Tangent
wxString txt;
txt.Printf( "%g", m_LossTangent );
return txt;
}
FAB_SUBSTRATE_LIST::FAB_SUBSTRATE_LIST()
{
// Fills the m_substrateList with predefined params:
for( unsigned ii = 0; ii < arrayDim( substrateMaterial ); ++ii )
m_substrateList.push_back( substrateMaterial[ii] );
}
FAB_SUBSTRATE* FAB_SUBSTRATE_LIST::GetSubstrate( int aIdx )
{
if( aIdx >= 0 && aIdx < GetCount() )
return &m_substrateList[aIdx];
return nullptr;
}
FAB_SUBSTRATE* FAB_SUBSTRATE_LIST::GetSubstrate( const wxString& aName )
{
for( FAB_SUBSTRATE& item : m_substrateList )
{
if( item.m_Name.CmpNoCase( aName ) == 0 )
return &item;
}
return nullptr;
}
wxArrayString GetCopperFinishStandardList( bool aTranslate )
{
wxArrayString list;

View File

@ -59,48 +59,6 @@ struct FAB_LAYER_COLOR
};
// A minor struct to handle substrates prms in gerber job file and dialog
struct FAB_SUBSTRATE
{
wxString m_Name; // the name (in job file) of material
double m_EpsilonR; // the epsilon r of this material
double m_LossTangent; // the loss tangent (tanD) of this material
wxString FormatEpsilonR(); // return a wxString to print/display Epsilon R
wxString FormatLossTangent();// return a wxString to print/display Loss Tangent
};
// A struct to handle a list of substrates prms in gerber job file and dialogs
class FAB_SUBSTRATE_LIST
{
///> The list of available substrates. It contians at least predefined substrates
std::vector<FAB_SUBSTRATE> m_substrateList;
public:
FAB_SUBSTRATE_LIST();
/**
* @return the number of substrates in list
*/
int GetCount() { return (int)m_substrateList.size(); }
/**
* @return the substrate in list of index aIdx
* if incorrect return nullptr
* @param aIdx is the index in substrate list.
*/
FAB_SUBSTRATE* GetSubstrate( int aIdx );
/**
* @return the substrate in list of name aName
* if not found return nullptr
* @param aName is the name of the substrate in substrate list.
* the comparison is case insensitve
*/
FAB_SUBSTRATE* GetSubstrate( const wxString& aName );
};
/**
* @return a wxArray of standard copper finish names.
* @param aTranslate = false for the initial names, true for translated names