From 9de24b15ae1fe80b85a47a05277cb9c5d3fe1ebe Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 9 Aug 2015 11:03:25 +0200 Subject: [PATCH] Pcb_calculator: Fix a bug which prevents the pcb_calculator to write and read correctly its configuration file. * Cosmetic enhancements in transmission lines panel. * Fix very minor cosmetic issues in track width versus current panel --- .../dialogs/pcb_calculator_frame_base.cpp | 84 ++++--- .../dialogs/pcb_calculator_frame_base.fbp | 214 +++++++++++++----- .../dialogs/pcb_calculator_frame_base.h | 5 +- pcb_calculator/pcb_calculator.cpp | 4 +- pcb_calculator/pcb_calculator.h | 14 +- pcb_calculator/pcb_calculator_frame.cpp | 125 +++++----- .../tracks_width_versus_current.cpp | 106 +++++---- pcb_calculator/transline_dlg_funct.cpp | 3 + pcb_calculator/transline_ident.cpp | 9 +- 9 files changed, 329 insertions(+), 235 deletions(-) diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp index f2ec27c835..aeab7acf93 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 21 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -15,12 +15,13 @@ #include "../bitmaps/color_code_tolerance.xpm" #include "../bitmaps/color_code_value.xpm" #include "../bitmaps/color_code_value_and_name.xpm" +#include "../bitmaps/microstrip_zodd_zeven.xpm" #include "../bitmaps/regul.xpm" #include "../bitmaps/regul_3pins.xpm" /////////////////////////////////////////////////////////////////////////// -PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : KIWAY_PLAYER( parent, id, title, pos, size, style ) +PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name ) : KIWAY_PLAYER( parent, id, title, pos, size, style, name ) { this->SetSizeHints( wxDefaultSize, wxDefaultSize ); @@ -247,7 +248,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_panelRegulators->SetSizer( bSizerMainReg ); m_panelRegulators->Layout(); bSizerMainReg->Fit( m_panelRegulators ); - m_Notebook->AddPage( m_panelRegulators, _("Regulators"), false ); + m_Notebook->AddPage( m_panelRegulators, _("Regulators"), true ); m_panelTrackWidth = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerTrackWidth; bSizerTrackWidth = new wxBoxSizer( wxHORIZONTAL ); @@ -282,7 +283,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_TrackDeltaTValue = new wxTextCtrl( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TrackDeltaTValue->SetMaxLength( 0 ); - fgSizerTWprms->Add( m_TrackDeltaTValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + fgSizerTWprms->Add( m_TrackDeltaTValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); m_staticText64 = new wxStaticText( sbSizerTW_Prms->GetStaticBox(), wxID_ANY, _("deg C"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText64->Wrap( -1 ); @@ -322,7 +323,7 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_htmlWinFormulas->SetForegroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); m_htmlWinFormulas->SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOW ) ); - bSizeLeft->Add( m_htmlWinFormulas, 1, wxEXPAND|wxTOP, 5 ); + bSizeLeft->Add( m_htmlWinFormulas, 1, wxTOP|wxEXPAND, 5 ); bSizerTrackWidth->Add( bSizeLeft, 1, wxEXPAND, 5 ); @@ -367,51 +368,51 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_staticTextArea = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Cross-section area"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextArea->Wrap( -1 ); - fgSizerTW_Results->Add( m_staticTextArea, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + fgSizerTW_Results->Add( m_staticTextArea, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - m_ExtTrackAreaValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_ExtTrackAreaValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_ExtTrackAreaValue->Wrap( -1 ); - fgSizerTW_Results->Add( m_ExtTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + fgSizerTW_Results->Add( m_ExtTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); m_ExtTrackAreaUnitLabel = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("mm ^ 2"), wxDefaultPosition, wxDefaultSize, 0 ); m_ExtTrackAreaUnitLabel->Wrap( -1 ); - fgSizerTW_Results->Add( m_ExtTrackAreaUnitLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results->Add( m_ExtTrackAreaUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText651 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Resistance"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText651->Wrap( -1 ); - fgSizerTW_Results->Add( m_staticText651, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); + fgSizerTW_Results->Add( m_staticText651, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - m_ExtTrackResistValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_ExtTrackResistValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_ExtTrackResistValue->Wrap( -1 ); - fgSizerTW_Results->Add( m_ExtTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + fgSizerTW_Results->Add( m_ExtTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); m_staticText84 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Ohm"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText84->Wrap( -1 ); - fgSizerTW_Results->Add( m_staticText84, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results->Add( m_staticText84, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText661 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Voltage drop"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText661->Wrap( -1 ); - fgSizerTW_Results->Add( m_staticText661, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); + fgSizerTW_Results->Add( m_staticText661, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - m_ExtTrackVDropValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_ExtTrackVDropValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_ExtTrackVDropValue->Wrap( -1 ); - fgSizerTW_Results->Add( m_ExtTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + fgSizerTW_Results->Add( m_ExtTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); m_staticText83 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Volt"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText83->Wrap( -1 ); - fgSizerTW_Results->Add( m_staticText83, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results->Add( m_staticText83, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText79 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Power loss"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText79->Wrap( -1 ); - fgSizerTW_Results->Add( m_staticText79, 0, wxRIGHT|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results->Add( m_staticText79, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_ExtTrackLossValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_ExtTrackLossValue = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_ExtTrackLossValue->Wrap( -1 ); fgSizerTW_Results->Add( m_ExtTrackLossValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); m_staticText791 = new wxStaticText( sbSizerTW_Result->GetStaticBox(), wxID_ANY, _("Watt"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText791->Wrap( -1 ); - fgSizerTW_Results->Add( m_staticText791, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results->Add( m_staticText791, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); sbSizerTW_Result->Add( fgSizerTW_Results, 0, wxEXPAND, 5 ); @@ -456,51 +457,51 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow m_staticTextArea1 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Cross-section area"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextArea1->Wrap( -1 ); - fgSizerTW_Results1->Add( m_staticTextArea1, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 ); + fgSizerTW_Results1->Add( m_staticTextArea1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - m_IntTrackAreaValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_IntTrackAreaValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_IntTrackAreaValue->Wrap( -1 ); - fgSizerTW_Results1->Add( m_IntTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + fgSizerTW_Results1->Add( m_IntTrackAreaValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); m_IntTrackAreaUnitLabel = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("mm ^ 2"), wxDefaultPosition, wxDefaultSize, 0 ); m_IntTrackAreaUnitLabel->Wrap( -1 ); - fgSizerTW_Results1->Add( m_IntTrackAreaUnitLabel, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results1->Add( m_IntTrackAreaUnitLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText6511 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Resistance"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText6511->Wrap( -1 ); - fgSizerTW_Results1->Add( m_staticText6511, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); + fgSizerTW_Results1->Add( m_staticText6511, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - m_IntTrackResistValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_IntTrackResistValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_IntTrackResistValue->Wrap( -1 ); - fgSizerTW_Results1->Add( m_IntTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + fgSizerTW_Results1->Add( m_IntTrackResistValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); m_staticText841 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Ohm"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText841->Wrap( -1 ); - fgSizerTW_Results1->Add( m_staticText841, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results1->Add( m_staticText841, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText6611 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Voltage drop"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText6611->Wrap( -1 ); - fgSizerTW_Results1->Add( m_staticText6611, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); + fgSizerTW_Results1->Add( m_staticText6611, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 5 ); - m_IntTrackVDropValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_IntTrackVDropValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_IntTrackVDropValue->Wrap( -1 ); - fgSizerTW_Results1->Add( m_IntTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + fgSizerTW_Results1->Add( m_IntTrackVDropValue, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL, 5 ); m_staticText831 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Volt"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText831->Wrap( -1 ); - fgSizerTW_Results1->Add( m_staticText831, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results1->Add( m_staticText831, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); m_staticText792 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Power loss"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText792->Wrap( -1 ); - fgSizerTW_Results1->Add( m_staticText792, 0, wxRIGHT|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results1->Add( m_staticText792, 0, wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL, 5 ); - m_IntTrackLossValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_IntTrackLossValue = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("dummy"), wxDefaultPosition, wxDefaultSize, 0 ); m_IntTrackLossValue->Wrap( -1 ); fgSizerTW_Results1->Add( m_IntTrackLossValue, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); m_staticText7911 = new wxStaticText( sbSizerTW_Result1->GetStaticBox(), wxID_ANY, _("Watt"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText7911->Wrap( -1 ); - fgSizerTW_Results1->Add( m_staticText7911, 0, wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 ); + fgSizerTW_Results1->Add( m_staticText7911, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); sbSizerTW_Result1->Add( fgSizerTW_Results1, 0, wxEXPAND, 5 ); @@ -509,13 +510,13 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow bSizeRight->Add( sbSizerTW_Result1, 1, wxEXPAND|wxALL, 5 ); - bSizerTrackWidth->Add( bSizeRight, 1, wxEXPAND, 5 ); + bSizerTrackWidth->Add( bSizeRight, 0, wxEXPAND, 5 ); m_panelTrackWidth->SetSizer( bSizerTrackWidth ); m_panelTrackWidth->Layout(); bSizerTrackWidth->Fit( m_panelTrackWidth ); - m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), true ); + m_Notebook->AddPage( m_panelTrackWidth, _("Track Width"), false ); m_panelElectricalSpacing = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); wxBoxSizer* bSizerElectricalClearance; bSizerElectricalClearance = new wxBoxSizer( wxHORIZONTAL ); @@ -791,6 +792,15 @@ PCB_CALCULATOR_FRAME_BASE::PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindow bMiddleSizer->Add( sbCmpPrmsSizer, 0, wxEXPAND|wxTOP, 5 ); + wxBoxSizer* bSizerHelpBitmaps; + bSizerHelpBitmaps = new wxBoxSizer( wxHORIZONTAL ); + + m_bmCMicrostripZoddZeven = new wxStaticBitmap( m_panelTransline, wxID_ANY, wxBitmap( microstrip_zodd_zeven_xpm ), wxDefaultPosition, wxDefaultSize, 0 ); + bSizerHelpBitmaps->Add( m_bmCMicrostripZoddZeven, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); + + + bMiddleSizer->Add( bSizerHelpBitmaps, 1, wxALIGN_CENTER_HORIZONTAL, 5 ); + bSizeTransline->Add( bMiddleSizer, 1, wxALL|wxEXPAND, 5 ); diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp index cbc415a99d..4a8e96f67f 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.fbp @@ -44,13 +44,13 @@ PCB_CALCULATOR_FRAME_BASE - 753,485 + 754,485 wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER KIWAY_PLAYER; kiway_player.h PCB Calculator - + pcb_calculator wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL 1 @@ -270,7 +270,7 @@ Regulators - 0 + 1 1 1 @@ -3267,7 +3267,7 @@ Track Width - 1 + 0 1 1 @@ -3726,7 +3726,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 1 @@ -4423,7 +4423,7 @@ 5 - wxEXPAND|wxTOP + wxTOP|wxEXPAND 1 1 @@ -4507,11 +4507,11 @@ - + 5 wxEXPAND - 1 - + 0 + bSizeRight wxVERTICAL @@ -4806,11 +4806,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -4889,11 +4889,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -4980,11 +4980,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP 0 - + 1 1 1 @@ -5068,9 +5068,9 @@ - + 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -5153,9 +5153,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 - + 1 1 1 @@ -5183,7 +5183,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -5236,7 +5236,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -5319,7 +5319,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -5402,9 +5402,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT 0 - + 1 1 1 @@ -5432,7 +5432,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -5485,7 +5485,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -5568,7 +5568,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -5651,9 +5651,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 - + 1 1 1 @@ -5681,7 +5681,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -5734,7 +5734,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -5817,7 +5817,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -5902,7 +5902,7 @@ 5 wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - + 1 1 1 @@ -5930,7 +5930,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -5983,7 +5983,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -6358,11 +6358,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 - + 1 1 1 @@ -6441,11 +6441,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - + 1 1 1 @@ -6532,11 +6532,11 @@ - + 5 wxALL 0 - + 1 1 1 @@ -6620,9 +6620,9 @@ - + 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -6705,9 +6705,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 - + 1 1 1 @@ -6735,7 +6735,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -6788,7 +6788,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -6871,7 +6871,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -6954,9 +6954,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 - + 1 1 1 @@ -6984,7 +6984,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -7037,7 +7037,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -7120,7 +7120,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL 0 1 @@ -7203,9 +7203,9 @@ 5 - wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxALL 0 - + 1 1 1 @@ -7233,7 +7233,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -7286,7 +7286,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -7369,7 +7369,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -7454,7 +7454,7 @@ 5 wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND 0 - + 1 1 1 @@ -7482,7 +7482,7 @@ 0 0 wxID_ANY - + dummy 0 @@ -7535,7 +7535,7 @@ 5 - wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL + wxALIGN_CENTER_VERTICAL|wxALL 0 1 @@ -11511,6 +11511,98 @@ + + 5 + wxALIGN_CENTER_HORIZONTAL + 1 + + + bSizerHelpBitmaps + wxHORIZONTAL + none + + 5 + wxALL|wxALIGN_CENTER_VERTICAL + 0 + + 1 + 1 + 1 + 1 + + + + + + + Load From File; ..\bitmaps\microstrip_zodd_zeven.xpm + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_bmCMicrostripZoddZeven + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcb_calculator/dialogs/pcb_calculator_frame_base.h b/pcb_calculator/dialogs/pcb_calculator_frame_base.h index f85b765cd2..ff718f42aa 100644 --- a/pcb_calculator/dialogs/pcb_calculator_frame_base.h +++ b/pcb_calculator/dialogs/pcb_calculator_frame_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 21 2015) +// C++ code generated with wxFormBuilder (version Jun 17 2015) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -184,6 +184,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER wxStaticText* m_Frequency_label; wxTextCtrl* m_Value_Frequency_Ctrl; UNIT_SELECTOR_FREQUENCY* m_choiceUnit_Frequency; + wxStaticBitmap* m_bmCMicrostripZoddZeven; wxStaticText* m_phys_prm1_label; wxTextCtrl* m_Phys_prm1_Value; UNIT_SELECTOR_LEN* m_choiceUnit_Param1; @@ -300,7 +301,7 @@ class PCB_CALCULATOR_FRAME_BASE : public KIWAY_PLAYER public: - PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Calculator"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 753,485 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL ); + PCB_CALCULATOR_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("PCB Calculator"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 754,485 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL, const wxString& name = wxT("pcb_calculator") ); ~PCB_CALCULATOR_FRAME_BASE(); diff --git a/pcb_calculator/pcb_calculator.cpp b/pcb_calculator/pcb_calculator.cpp index 31f27c7a61..6a9f970cb3 100644 --- a/pcb_calculator/pcb_calculator.cpp +++ b/pcb_calculator/pcb_calculator.cpp @@ -1,8 +1,8 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 2011 jean-pierre.charras - * Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors. + * Copyright (C) 2015 jean-pierre.charras + * Copyright (C) 2015 Kicad Developers, see change_log.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 diff --git a/pcb_calculator/pcb_calculator.h b/pcb_calculator/pcb_calculator.h index a3562c99aa..05cc6348df 100644 --- a/pcb_calculator/pcb_calculator.h +++ b/pcb_calculator/pcb_calculator.h @@ -59,13 +59,11 @@ private: bool m_TWNested; // Used to stop events caused by setting the answers. - wxSize m_FrameSize; - wxPoint m_FramePos; - wxConfigBase* m_Config; enum TRANSLINE_TYPE_ID m_currTransLineType; TRANSLINE * m_currTransLine; // a pointer to the active transline // List of translines: ordered like in dialog menu list std::vector m_transline_list; + ATTENUATOR * m_currAttenuator; // List ofattenuators: ordered like in dialog menu list std::vector m_attenuator_list; @@ -88,9 +86,9 @@ private: void OnPaintAttenuatorPanel( wxPaintEvent& event ); void OnPaintAttFormulaPanel( wxPaintEvent& event ); - // Config read-write - void ReadConfig(); - void WriteConfig(); + // Config read-write, virtual from EDA_BASE_FRAME + void LoadSettings( wxConfigBase* aCfg ); + void SaveSettings( wxConfigBase* aCfg ); // R/W data files: bool ReadDataFile(); @@ -114,13 +112,13 @@ private: * Function TW_Init * Read config and init dialog widgets values */ - void TW_Init(); + void TW_Init( wxConfigBase* aCfg ); /** * Function TW_WriteConfig * Write Track width prameters in config */ - void TW_WriteConfig(); + void TW_WriteConfig( wxConfigBase* aCfg ); /** * Function OnTWParametersChanged diff --git a/pcb_calculator/pcb_calculator_frame.cpp b/pcb_calculator/pcb_calculator_frame.cpp index 87098e4aaf..476dee9a9d 100644 --- a/pcb_calculator/pcb_calculator_frame.cpp +++ b/pcb_calculator/pcb_calculator_frame.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KICAD, a free EDA CAD application. * - * Copyright (C) 1992-2011 jean-pierre.charras + * Copyright (C) 1992-2015 jean-pierre.charras * Copyright (C) 1992-2015 Kicad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -64,7 +64,6 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_RegulatorListChanged = false; m_TWMode = TW_MASTER_CURRENT; m_TWNested = false; - m_Config = GetNewConfig( Pgm().App().GetAppName() ); // Populate transline list ordered like in dialog menu list const static TRANSLINE_TYPE_ID tltype_list[8] = @@ -84,14 +83,15 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : m_attenuator_list.push_back( new ATTENUATOR_SPLITTER() ); m_currAttenuator = m_attenuator_list[0]; - ReadConfig(); + wxConfigBase* config = GetNewConfig( Pgm().App().GetAppName() ); + LoadSettings( config ); ReadDataFile(); TranslineTypeSelection( m_currTransLineType ); m_TranslineSelection->SetSelection( m_currTransLineType ); - TW_Init(); + TW_Init( config ); SetAttenuator( m_AttenuatorsSelection->GetSelection() ); @@ -121,16 +121,12 @@ PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) : PCB_CALCULATOR_FRAME::~PCB_CALCULATOR_FRAME() { - WriteConfig(); - for( unsigned ii = 0; ii < m_transline_list.size(); ii++ ) delete m_transline_list[ii]; for( unsigned ii = 0; ii < m_attenuator_list.size(); ii++ ) delete m_attenuator_list[ii]; - delete m_Config; - /* This needed for OSX: avoids furter OnDraw processing after this * destructor and before the native window is destroyed */ @@ -144,10 +140,12 @@ void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event ) { if( GetDataFilename().IsEmpty() ) { - int opt = wxMessageBox( _("Data modified, and no data filename to save modifications\n"\ -"Do you want to exit and abandon your change?"), - _("Regulator list change"), - wxYES_NO | wxICON_QUESTION ); + int opt = wxMessageBox( + _("Data modified, and no data filename to save modifications\n"\ + "Do you want to exit and abandon your change?"), + _("Regulator list change"), + wxYES_NO | wxICON_QUESTION ); + if( opt == wxNO ) return; } @@ -157,57 +155,57 @@ void PCB_CALCULATOR_FRAME::OnClosePcbCalc( wxCloseEvent& event ) { wxString msg; msg.Printf( _("Unable to write file<%s>\n"\ -"Do you want to exit and abandon your change?"), GetDataFilename().c_str() ); + "Do you want to exit and abandon your change?"), + GetDataFilename().c_str() ); int opt = wxMessageBox( msg, _("Write Data File Error"), - wxYES_NO | wxICON_QUESTION ); + wxYES_NO | wxICON_ERROR ); if( opt == wxNO ) return; } } } - Destroy(); + event.Skip(); +// Destroy(); } -void PCB_CALCULATOR_FRAME::ReadConfig() +void PCB_CALCULATOR_FRAME::LoadSettings( wxConfigBase* aCfg ) { - if( m_Config == NULL ) + if( aCfg == NULL ) return; + EDA_BASE_FRAME::LoadSettings( aCfg ); + long ltmp; wxString msg; - m_Config->Read( KEYWORD_FRAME_POSX, &m_FramePos.x, -1 ); - m_Config->Read( KEYWORD_FRAME_POSY, &m_FramePos.y, -1 ); - m_Config->Read( KEYWORD_FRAME_SIZEX, &m_FrameSize.x, -1 ); - m_Config->Read( KEYWORD_FRAME_SIZEY, &m_FrameSize.y, -1 ); - m_Config->Read( KEYWORD_TRANSLINE_SELECTION, <mp, (long) DEFAULT_TYPE ); + aCfg->Read( KEYWORD_TRANSLINE_SELECTION, <mp, (long) DEFAULT_TYPE ); m_currTransLineType = (enum TRANSLINE_TYPE_ID) ltmp; - m_Config->Read( KEYWORD_PAGE_SELECTION, <mp, 0 ); + aCfg->Read( KEYWORD_PAGE_SELECTION, <mp, 0 ); m_Notebook->ChangeSelection( ltmp ); - m_Config->Read( KEYWORD_COLORCODE_SELECTION, <mp, 1 ); + aCfg->Read( KEYWORD_COLORCODE_SELECTION, <mp, 1 ); m_rbToleranceSelection->SetSelection( ltmp ); - m_Config->Read( KEYWORD_ATTENUATORS_SELECTION, <mp, 0 ); + aCfg->Read( KEYWORD_ATTENUATORS_SELECTION, <mp, 0 ); m_AttenuatorsSelection->SetSelection( ltmp ); - m_Config->Read( KEYWORD_BRDCLASS_SELECTION, <mp, 0 ); + aCfg->Read( KEYWORD_BRDCLASS_SELECTION, <mp, 0 ); m_BoardClassesUnitsSelector->SetSelection( ltmp ); // Regul panel config: - m_Config->Read( KEYWORD_REGUL_R1, &msg, wxT( "10" ) ); + aCfg->Read( KEYWORD_REGUL_R1, &msg, wxT( "10" ) ); m_RegulR1Value->SetValue( msg ); - m_Config->Read( KEYWORD_REGUL_R2, &msg, wxT( "10" ) ); + aCfg->Read( KEYWORD_REGUL_R2, &msg, wxT( "10" ) ); m_RegulR2Value->SetValue( msg ); - m_Config->Read( KEYWORD_REGUL_VREF, &msg, wxT( "3" ) ); + aCfg->Read( KEYWORD_REGUL_VREF, &msg, wxT( "3" ) ); m_RegulVrefValue->SetValue( msg ); - m_Config->Read( KEYWORD_REGUL_VOUT, &msg, wxT( "12" ) ); + aCfg->Read( KEYWORD_REGUL_VOUT, &msg, wxT( "12" ) ); m_RegulVoutValue->SetValue( msg ); - m_Config->Read( KEYWORD_DATAFILE_FILENAME, &msg, wxT( "" ) ); + aCfg->Read( KEYWORD_DATAFILE_FILENAME, &msg, wxT( "" ) ); SetDataFilename( msg ); - m_Config->Read( KEYWORD_REGUL_SELECTED, &msg, wxT( "" ) ); + aCfg->Read( KEYWORD_REGUL_SELECTED, &msg, wxT( "" ) ); m_lastSelectedRegulatorName = msg; - m_Config->Read( KEYWORD_REGUL_TYPE, <mp, 0 ); + aCfg->Read( KEYWORD_REGUL_TYPE, <mp, 0 ); m_choiceRegType->SetSelection( ltmp ); - m_Config->Read( KEYWORD_REGUL_LAST_PARAM, <mp, 0 ); + aCfg->Read( KEYWORD_REGUL_LAST_PARAM, <mp, 0 ); wxRadioButton * regprms[3] = { m_rbRegulR1, m_rbRegulR2, m_rbRegulVout }; @@ -217,48 +215,39 @@ void PCB_CALCULATOR_FRAME::ReadConfig() regprms[ii]->SetValue( ltmp == ii ); // Electrical panel config - m_Config->Read( KEYWORD_ELECTRICAL_SPACING_SELECTION, <mp, 0 ); + aCfg->Read( KEYWORD_ELECTRICAL_SPACING_SELECTION, <mp, 0 ); m_ElectricalSpacingUnitsSelector->SetSelection( ltmp ); - m_Config->Read( KEYWORD_ELECTRICAL_SPACING_VOLTAGE, &msg, wxT( "500" ) ); + aCfg->Read( KEYWORD_ELECTRICAL_SPACING_VOLTAGE, &msg, wxT( "500" ) ); m_ElectricalSpacingVoltage->SetValue( msg ); for( unsigned ii = 0; ii < m_transline_list.size(); ii++ ) - m_transline_list[ii]->ReadConfig( m_Config ); + m_transline_list[ii]->ReadConfig( aCfg ); for( unsigned ii = 0; ii < m_attenuator_list.size(); ii++ ) - m_attenuator_list[ii]->ReadConfig( m_Config ); + m_attenuator_list[ii]->ReadConfig( aCfg ); } -void PCB_CALCULATOR_FRAME::WriteConfig() +void PCB_CALCULATOR_FRAME::SaveSettings( wxConfigBase* aCfg ) { - if( m_Config == NULL ) + if( aCfg == NULL ) return; - if( !IsIconized() ) - { - m_FrameSize = GetSize(); - m_FramePos = GetPosition(); + EDA_BASE_FRAME::SaveSettings( aCfg ); - m_Config->Write( KEYWORD_FRAME_POSX, (long) m_FramePos.x ); - m_Config->Write( KEYWORD_FRAME_POSY, (long) m_FramePos.y ); - m_Config->Write( KEYWORD_FRAME_SIZEX, (long) m_FrameSize.x ); - m_Config->Write( KEYWORD_FRAME_SIZEY, (long) m_FrameSize.y ); - } + aCfg->Write( KEYWORD_TRANSLINE_SELECTION, (long) m_currTransLineType ); + aCfg->Write( KEYWORD_PAGE_SELECTION, m_Notebook->GetSelection() ); + aCfg->Write( KEYWORD_COLORCODE_SELECTION, m_rbToleranceSelection->GetSelection() ); + aCfg->Write( KEYWORD_ATTENUATORS_SELECTION, m_AttenuatorsSelection->GetSelection() ); + aCfg->Write( KEYWORD_BRDCLASS_SELECTION, m_BoardClassesUnitsSelector->GetSelection() ); - m_Config->Write( KEYWORD_TRANSLINE_SELECTION, (long) m_currTransLineType ); - m_Config->Write( KEYWORD_PAGE_SELECTION, m_Notebook->GetSelection() ); - m_Config->Write( KEYWORD_COLORCODE_SELECTION, m_rbToleranceSelection->GetSelection() ); - m_Config->Write( KEYWORD_ATTENUATORS_SELECTION, m_AttenuatorsSelection->GetSelection() ); - m_Config->Write( KEYWORD_BRDCLASS_SELECTION, m_BoardClassesUnitsSelector->GetSelection() ); - - m_Config->Write( KEYWORD_REGUL_R1, m_RegulR1Value->GetValue() ); - m_Config->Write( KEYWORD_REGUL_R2, m_RegulR2Value->GetValue() ); - m_Config->Write( KEYWORD_REGUL_VREF, m_RegulVrefValue->GetValue() ); - m_Config->Write( KEYWORD_REGUL_VOUT, m_RegulVoutValue->GetValue() ); - m_Config->Write( KEYWORD_DATAFILE_FILENAME, GetDataFilename() ); - m_Config->Write( KEYWORD_REGUL_SELECTED, m_lastSelectedRegulatorName ); - m_Config->Write( KEYWORD_REGUL_TYPE, + aCfg->Write( KEYWORD_REGUL_R1, m_RegulR1Value->GetValue() ); + aCfg->Write( KEYWORD_REGUL_R2, m_RegulR2Value->GetValue() ); + aCfg->Write( KEYWORD_REGUL_VREF, m_RegulVrefValue->GetValue() ); + aCfg->Write( KEYWORD_REGUL_VOUT, m_RegulVoutValue->GetValue() ); + aCfg->Write( KEYWORD_DATAFILE_FILENAME, GetDataFilename() ); + aCfg->Write( KEYWORD_REGUL_SELECTED, m_lastSelectedRegulatorName ); + aCfg->Write( KEYWORD_REGUL_TYPE, m_choiceRegType->GetSelection() ); wxRadioButton * regprms[3] = { m_rbRegulR1, m_rbRegulR2, m_rbRegulVout @@ -267,24 +256,24 @@ void PCB_CALCULATOR_FRAME::WriteConfig() { if( regprms[ii]->GetValue() ) { - m_Config->Write( KEYWORD_REGUL_LAST_PARAM, ii ); + aCfg->Write( KEYWORD_REGUL_LAST_PARAM, ii ); break; } } - m_Config->Write( KEYWORD_ELECTRICAL_SPACING_SELECTION, + aCfg->Write( KEYWORD_ELECTRICAL_SPACING_SELECTION, m_ElectricalSpacingUnitsSelector->GetSelection() ); - m_Config->Write( KEYWORD_ELECTRICAL_SPACING_VOLTAGE, + aCfg->Write( KEYWORD_ELECTRICAL_SPACING_VOLTAGE, m_ElectricalSpacingVoltage->GetValue() ); - TW_WriteConfig(); + TW_WriteConfig( aCfg ); for( unsigned ii = 0; ii < m_transline_list.size(); ii++ ) - m_transline_list[ii]->WriteConfig( m_Config ); + m_transline_list[ii]->WriteConfig( aCfg ); for( unsigned ii = 0; ii < m_attenuator_list.size(); ii++ ) - m_attenuator_list[ii]->WriteConfig( m_Config ); + m_attenuator_list[ii]->WriteConfig( aCfg ); } diff --git a/pcb_calculator/tracks_width_versus_current.cpp b/pcb_calculator/tracks_width_versus_current.cpp index f2355c72d5..78b82bc52d 100644 --- a/pcb_calculator/tracks_width_versus_current.cpp +++ b/pcb_calculator/tracks_width_versus_current.cpp @@ -56,22 +56,22 @@ extern double DoubleFromString( const wxString& TextValue ); #define KEYWORD_TW_INTTRACK_THICKNESS wxT( "TW_IntTrack_Thickness" ) #define KEYWORD_TW_INTTRACK_THICKNESS_UNIT wxT( "TW_IntTrack_Thickness_Unit" ) -void PCB_CALCULATOR_FRAME::TW_WriteConfig() +void PCB_CALCULATOR_FRAME::TW_WriteConfig( wxConfigBase* aCfg ) { // Save current parameters values in config. - m_Config->Write( KEYWORD_TW_CURRENT, m_TrackCurrentValue->GetValue() ); - m_Config->Write( KEYWORD_TW_DELTA_TC, m_TrackDeltaTValue->GetValue() ); - m_Config->Write( KEYWORD_TW_TRACK_LEN, m_TrackLengthValue->GetValue() ); - m_Config->Write( KEYWORD_TW_TRACK_LEN_UNIT, m_TW_CuLength_choiceUnit->GetSelection() ); - m_Config->Write( KEYWORD_TW_RESISTIVITY, m_TWResistivity->GetValue() ); - m_Config->Write( KEYWORD_TW_EXTTRACK_WIDTH, m_ExtTrackWidthValue->GetValue() ); - m_Config->Write( KEYWORD_TW_EXTTRACK_WIDTH_UNIT, m_TW_ExtTrackWidth_choiceUnit->GetSelection() ); - m_Config->Write( KEYWORD_TW_EXTTRACK_THICKNESS, m_ExtTrackThicknessValue->GetValue() ); - m_Config->Write( KEYWORD_TW_EXTTRACK_THICKNESS_UNIT, m_ExtTrackThicknessUnit->GetSelection() ); - m_Config->Write( KEYWORD_TW_INTTRACK_WIDTH, m_IntTrackWidthValue->GetValue() ); - m_Config->Write( KEYWORD_TW_INTTRACK_WIDTH_UNIT, m_TW_IntTrackWidth_choiceUnit->GetSelection() ); - m_Config->Write( KEYWORD_TW_INTTRACK_THICKNESS, m_IntTrackThicknessValue->GetValue() ); - m_Config->Write( KEYWORD_TW_INTTRACK_THICKNESS_UNIT, m_IntTrackThicknessUnit->GetSelection() ); + aCfg->Write( KEYWORD_TW_CURRENT, m_TrackCurrentValue->GetValue() ); + aCfg->Write( KEYWORD_TW_DELTA_TC, m_TrackDeltaTValue->GetValue() ); + aCfg->Write( KEYWORD_TW_TRACK_LEN, m_TrackLengthValue->GetValue() ); + aCfg->Write( KEYWORD_TW_TRACK_LEN_UNIT, m_TW_CuLength_choiceUnit->GetSelection() ); + aCfg->Write( KEYWORD_TW_RESISTIVITY, m_TWResistivity->GetValue() ); + aCfg->Write( KEYWORD_TW_EXTTRACK_WIDTH, m_ExtTrackWidthValue->GetValue() ); + aCfg->Write( KEYWORD_TW_EXTTRACK_WIDTH_UNIT, m_TW_ExtTrackWidth_choiceUnit->GetSelection() ); + aCfg->Write( KEYWORD_TW_EXTTRACK_THICKNESS, m_ExtTrackThicknessValue->GetValue() ); + aCfg->Write( KEYWORD_TW_EXTTRACK_THICKNESS_UNIT, m_ExtTrackThicknessUnit->GetSelection() ); + aCfg->Write( KEYWORD_TW_INTTRACK_WIDTH, m_IntTrackWidthValue->GetValue() ); + aCfg->Write( KEYWORD_TW_INTTRACK_WIDTH_UNIT, m_TW_IntTrackWidth_choiceUnit->GetSelection() ); + aCfg->Write( KEYWORD_TW_INTTRACK_THICKNESS, m_IntTrackThicknessValue->GetValue() ); + aCfg->Write( KEYWORD_TW_INTTRACK_THICKNESS_UNIT, m_IntTrackThicknessUnit->GetSelection() ); } @@ -407,7 +407,7 @@ double PCB_CALCULATOR_FRAME::TWCalculateCurrent( double aWidth, double aThicknes } -void PCB_CALCULATOR_FRAME::TW_Init() +void PCB_CALCULATOR_FRAME::TW_Init( wxConfigBase* aCfg ) { int tmp; wxString msg; @@ -416,61 +416,57 @@ void PCB_CALCULATOR_FRAME::TW_Init() m_TWNested = true; // Read parameter values. - m_Config->Read( KEYWORD_TW_CURRENT, &msg, wxT( "1.0" ) ); + aCfg->Read( KEYWORD_TW_CURRENT, &msg, wxT( "1.0" ) ); m_TrackCurrentValue->SetValue( msg ); - m_Config->Read( KEYWORD_TW_DELTA_TC, &msg, wxT( "10.0" ) ); + aCfg->Read( KEYWORD_TW_DELTA_TC, &msg, wxT( "10.0" ) ); m_TrackDeltaTValue->SetValue( msg ); - m_Config->Read( KEYWORD_TW_TRACK_LEN, &msg, wxT( "20" ) ); + aCfg->Read( KEYWORD_TW_TRACK_LEN, &msg, wxT( "20" ) ); m_TrackLengthValue->SetValue( msg ); - m_Config->Read( KEYWORD_TW_TRACK_LEN_UNIT, &tmp, 0 ); + aCfg->Read( KEYWORD_TW_TRACK_LEN_UNIT, &tmp, 0 ); m_TW_CuLength_choiceUnit->SetSelection( tmp ); - m_Config->Read( KEYWORD_TW_RESISTIVITY, &msg, wxT( "1.72e-8" ) ); + aCfg->Read( KEYWORD_TW_RESISTIVITY, &msg, wxT( "1.72e-8" ) ); m_TWResistivity->SetValue( msg ); - m_Config->Read( KEYWORD_TW_EXTTRACK_WIDTH, &msg, wxT( "0.2" ) ); + aCfg->Read( KEYWORD_TW_EXTTRACK_WIDTH, &msg, wxT( "0.2" ) ); m_ExtTrackWidthValue->SetValue( msg ); - m_Config->Read( KEYWORD_TW_EXTTRACK_WIDTH_UNIT, &tmp, 0 ); + aCfg->Read( KEYWORD_TW_EXTTRACK_WIDTH_UNIT, &tmp, 0 ); m_TW_ExtTrackWidth_choiceUnit->SetSelection( tmp ); - m_Config->Read( KEYWORD_TW_EXTTRACK_THICKNESS, &msg, wxT( "0.035" ) ); + aCfg->Read( KEYWORD_TW_EXTTRACK_THICKNESS, &msg, wxT( "0.035" ) ); m_ExtTrackThicknessValue->SetValue( msg ); - m_Config->Read( KEYWORD_TW_EXTTRACK_THICKNESS_UNIT, &tmp, 0 ); + aCfg->Read( KEYWORD_TW_EXTTRACK_THICKNESS_UNIT, &tmp, 0 ); m_ExtTrackThicknessUnit->SetSelection( tmp ); - m_Config->Read( KEYWORD_TW_INTTRACK_WIDTH, &msg, wxT( "0.2" ) ); + aCfg->Read( KEYWORD_TW_INTTRACK_WIDTH, &msg, wxT( "0.2" ) ); m_IntTrackWidthValue->SetValue( msg ); - m_Config->Read( KEYWORD_TW_INTTRACK_WIDTH_UNIT, &tmp, 0 ); + aCfg->Read( KEYWORD_TW_INTTRACK_WIDTH_UNIT, &tmp, 0 ); m_TW_IntTrackWidth_choiceUnit->SetSelection( tmp ); - m_Config->Read( KEYWORD_TW_INTTRACK_THICKNESS, &msg, wxT( "0.035" ) ); + aCfg->Read( KEYWORD_TW_INTTRACK_THICKNESS, &msg, wxT( "0.035" ) ); m_IntTrackThicknessValue->SetValue( msg ); - m_Config->Read( KEYWORD_TW_INTTRACK_THICKNESS_UNIT, &tmp, 0 ); + aCfg->Read( KEYWORD_TW_INTTRACK_THICKNESS_UNIT, &tmp, 0 ); m_IntTrackThicknessUnit->SetSelection( tmp ); // Init formulas text - m_htmlWinFormulas->AppendToPage( "
" ); - m_htmlWinFormulas->AppendToPage( _( "If you specify the maximum current, then the trace " - "widths will be calculated to suit." ) ); - m_htmlWinFormulas->AppendToPage( "
" ); - m_htmlWinFormulas->AppendToPage( _( "If you specify one of the trace widths, the maximum " - "current it can handle will be calculated. The width " - "for the other trace to also handle this current will " - "then be calculated." ) ); - m_htmlWinFormulas->AppendToPage( "
" ); - m_htmlWinFormulas->AppendToPage( _( "The controlling value is shown in bold." ) ); - m_htmlWinFormulas->AppendToPage( "

" ); - m_htmlWinFormulas->AppendToPage( _( "The calculations are valid for currents up to 35A " - "(external) or 17.5A (internal), temperature rises " - "up to 100 deg C, and widths of up to 400mil (10mm)." ) ); - m_htmlWinFormulas->AppendToPage( "
" ); - m_htmlWinFormulas->AppendToPage( _( "The formula, from IPC 2221, is" ) ); - m_htmlWinFormulas->AppendToPage( "
I = K * dT0.44 * " - "(W*H)0.725
" ); - m_htmlWinFormulas->AppendToPage( _( "where:" ) ); - m_htmlWinFormulas->AppendToPage( "
I = " ); - m_htmlWinFormulas->AppendToPage( _( "maximum current in amps" ) ); - m_htmlWinFormulas->AppendToPage( "
dT = " ); - m_htmlWinFormulas->AppendToPage( _( "temperature rise above ambient in deg C" ) ); - m_htmlWinFormulas->AppendToPage( "
W,H = " ); - m_htmlWinFormulas->AppendToPage( _( "width and thickness in mils" ) ); - m_htmlWinFormulas->AppendToPage( "
K = " ); - m_htmlWinFormulas->AppendToPage( _( "0.024 for internal traces or 0.048 for external traces" ) ); + msg = "
"; + msg << _( "If you specify the maximum current, then the trace " + "widths will be calculated to suit." ) + << "
" << _( "If you specify one of the trace widths, the maximum " + "current it can handle will be calculated. The width " + "for the other trace to also handle this current will " + "then be calculated." ) + << "
" << _( "The controlling value is shown in bold." ) << "

" + << _( "The calculations are valid for currents up to 35A " + "(external) or 17.5A (internal), temperature rises " + "up to 100 deg C, and widths of up to 400mil (10mm)." )<< "
" + << _( "The formula, from IPC 2221, is" ) + << "
I = K * dT0.44 * (W*H)0.725
" + << _( "where:" ) << "
I = " + << _( "maximum current in amps" ) + << "
dT = " + << _( "temperature rise above ambient in deg C" ) + << "
W,H = " + << _( "width and thickness in mils" ) << "
" + << "K = " + << _( "0.024 for internal traces or 0.048 for external traces" ); + + m_htmlWinFormulas->AppendToPage( msg ); // Make sure the correct master mode is displayed. TWUpdateModeDisplay(); diff --git a/pcb_calculator/transline_dlg_funct.cpp b/pcb_calculator/transline_dlg_funct.cpp index f6ca6a4208..fdfebbe3cf 100644 --- a/pcb_calculator/transline_dlg_funct.cpp +++ b/pcb_calculator/transline_dlg_funct.cpp @@ -152,6 +152,9 @@ void PCB_CALCULATOR_FRAME::TranslineTypeSelection( enum TRANSLINE_TYPE_ID aType || ( m_currTransLineType >= END_OF_LIST_TYPE ) ) m_currTransLineType = DEFAULT_TYPE; + // This helper bitmap is shown for coupled microstrip only: + m_bmCMicrostripZoddZeven->Show( aType == C_MICROSTRIP_TYPE ); + TRANSLINE_IDENT* tr_ident = m_transline_list[m_currTransLineType]; m_currTransLine = tr_ident->m_TLine; diff --git a/pcb_calculator/transline_ident.cpp b/pcb_calculator/transline_ident.cpp index 0346d2d166..b123a682e4 100644 --- a/pcb_calculator/transline_ident.cpp +++ b/pcb_calculator/transline_ident.cpp @@ -82,9 +82,11 @@ void TRANSLINE_PRM::ReadConfig( wxConfigBase* aConfig ) { if( m_Id == UNKNOWN_ID || m_Id == DUMMY_PRM ) return; + wxString key; key.Printf( TRANSLINE_PRM_KEY, (int) m_Id ); aConfig->Read( key, &m_Value ); + key += wxT( "unit" ); aConfig->Read( key, &m_UnitSelection ); } @@ -94,9 +96,11 @@ void TRANSLINE_PRM::WriteConfig( wxConfigBase* aConfig ) { if( m_Id == UNKNOWN_ID || m_Id == DUMMY_PRM ) return; + wxString key; key.Printf( TRANSLINE_PRM_KEY, (int) m_Id ); aConfig->Write( key, m_Value ); + key += wxT( "unit" ); aConfig->Write( key, m_UnitSelection ); } @@ -151,6 +155,7 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType ) AddPrm( new TRANSLINE_PRM( PRM_TYPE_FREQUENCY, FREQUENCY_PRM, _( "Frequency" ), _( "Height of Substrate" ), 1.0, true ) ); + switch( m_Type ) { case MICROSTRIP_TYPE: // microstrip @@ -352,9 +357,9 @@ TRANSLINE_IDENT::TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType ) _( "L" ), _( "Line Length" ), 50.0, true ) ); AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, Z0_E_PRM, - _( "Z0e (Zdiff)" ), _( "Even-Mode impedance (diff impedance)" ), 50.0, true ) ); + _( "Zeven" ), _( "Even mode impedance (lines driven by common voltages)" ), 50.0, true ) ); AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, Z0_O_PRM, - _( "Z0o (Z0)" ), _( "Odd-Mode impedance" ), 50.0, true ) ); + _( "Zodd" ), _( "Odd mode impedance (lines driven by opposite (differential) voltages)" ), 50.0, true ) ); AddPrm( new TRANSLINE_PRM( PRM_TYPE_ELEC, ANG_L_PRM, _( "Ang_l" ), _( "Electrical length" ), 0.0, true ) ); break;