KiCad PCB EDA Suite
panel_transline.cpp
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KICAD, a free EDA CAD application.
3  *
4  * Copyright (C) 2011 jean-pierre.charras
5  * Copyright (C) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #include "transline_ident.h"
23 #include <bitmaps.h>
26 
27 
28 PANEL_TRANSLINE::PANEL_TRANSLINE( wxWindow* parent, wxWindowID id,
29  const wxPoint& pos, const wxSize& size,
30  long style, const wxString& name ) :
31  PANEL_TRANSLINE_BASE( parent, id, pos, size, style, name ),
32  m_currTransLine( nullptr ),
33  m_currTransLineType( DEFAULT_TYPE )
34 {
37 
38 
39  // Populate transline list ordered like in dialog menu list
40  const static TRANSLINE_TYPE_ID tltype_list[8] =
41  {
43  CPW_TYPE,
46  COAX_TYPE,
50  };
51 
52  for( int ii = 0; ii < 8; ii++ )
53  m_transline_list.push_back( new TRANSLINE_IDENT( tltype_list[ii] ) );
54 
55  m_EpsilonR_label->SetLabel( wxT( "╬Ár" ) );
56 }
57 
58 
60 {
61  for( TRANSLINE_IDENT* transline : m_transline_list )
62  delete transline;
63 }
64 
65 
67 {
68  // Update the bitmaps
71  m_translineBitmap->SetBitmap( KiBitmap( m_transline_list[m_currTransLineType]->m_BitmapName ) );
72 }
73 
74 
76 {
78 
79  for( TRANSLINE_IDENT* transline : m_transline_list )
80  transline->WriteConfig();
81 }
82 
83 
85 {
86  m_currTransLineType = static_cast<TRANSLINE_TYPE_ID>( aCfg->m_TransLine.type );
87 
88  for( TRANSLINE_IDENT* transline : m_transline_list )
89  transline->ReadConfig();
90 
93 
94  // Needed on wxWidgets 3.0 to ensure sizers are correctly set
95  // It also remove a minor cosmetic issue on wxWidgets 3.5 on MSW
96  // Called here after the current selected transline bitmaps are enabled/disabled
97  GetSizer()->SetSizeHints( this );
98 }
99 
100 
101 
102 void PANEL_TRANSLINE::OnTranslineAnalyse( wxCommandEvent& event )
103 {
104  if( m_currTransLine )
105  {
108  }
109 }
110 
111 
112 void PANEL_TRANSLINE::OnTranslineSynthetize( wxCommandEvent& event )
113 {
114  if( m_currTransLine )
115  {
118  }
119 }
TRANSLINE * m_currTransLine
enum TRANSLINE_TYPE_ID m_currTransLineType
wxStaticText * m_EpsilonR_label
A class to handle a list of parameters of a given transline.
wxRadioBox * m_TranslineSelection
wxStaticBitmap * m_translineBitmap
wxBitmapButton * m_bpButtonAnalyze
void OnTranslineAnalyse(wxCommandEvent &event) override
Run a new analyze for the current transline with current parameters and displays the electrical param...
void OnTranslineSynthetize(wxCommandEvent &event) override
Run a new synthesis for the current transline with current parameters and displays the geometrical pa...
void TransfDlgDataToTranslineParams()
Read values entered in dialog frame, and transfer these values in current transline parameters,...
void analyze()
Definition: transline.cpp:211
wxBitmapButton * m_bpButtonSynthetize
Class PANEL_TRANSLINE_BASE.
wxBitmap KiBitmap(BITMAPS aBitmap, int aHeightTag)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:105
void TranslineTypeSelection(enum TRANSLINE_TYPE_ID aType)
Must be called after selection of a new transline.
TRANSLINE_TYPE_ID
const char * name
Definition: DXF_plotter.cpp:56
void LoadSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Load the settings into the panel.
PANEL_TRANSLINE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
virtual void synthesize()
Definition: transline.cpp:220
void SaveSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Save the settings from the panel.
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
std::vector< TRANSLINE_IDENT * > m_transline_list