KiCad PCB EDA Suite
panel_track_width.h
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) 1992-2021 Kicad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 3
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef PANEL_TRACK_WIDTH_H
21 #define PANEL_TRACK_WIDTH_H
22 
23 #include "panel_track_width_base.h"
24 
26 
27 
29 {
30 public:
31  PANEL_TRACK_WIDTH( wxWindow* parent, wxWindowID id = wxID_ANY,
32  const wxPoint& pos = wxDefaultPosition,
33  const wxSize& size = wxDefaultSize,
34  long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
36 
37  // Methods from CALCULATOR_PANEL that must be overriden
38  void LoadSettings( PCB_CALCULATOR_SETTINGS* aCfg ) override;
39  void SaveSettings( PCB_CALCULATOR_SETTINGS* aCfg ) override;
40  void ThemeChanged() override;
41 
45  void OnTWParametersChanged( wxCommandEvent& event ) override;
46 
50  void OnTWCalculateFromCurrent( wxCommandEvent& event ) override;
51 
55  void OnTWCalculateFromExtWidth( wxCommandEvent& event ) override;
56 
60  void OnTWCalculateFromIntWidth( wxCommandEvent& event ) override;
61 
65  void OnTWResetButtonClick( wxCommandEvent& event ) override;
66 
70  double TWCalculateWidth( double aCurrent, double aThickness, double aDeltaT_C,
71  bool aUseInternalLayer );
72 
76  double TWCalculateCurrent( double aWidth, double aThickness, double aDeltaT_C,
77  bool aUseInternalLayer );
78 
83  void TWDisplayValues( double aCurrent, double aExtWidth, double aIntWidth,
84  double aExtThickness, double aIntThickness );
85 
90  void TWUpdateModeDisplay();
91 
92 private:
93  enum // Which dimension is controlling the track width / current
94  { // calculations:
95  TW_MASTER_CURRENT, // the maximum current,
96  TW_MASTER_EXT_WIDTH, // the external trace width,
97  TW_MASTER_INT_WIDTH // or the internal trace width?
98  } m_TWMode;
99 
100  bool m_TWNested; // Used to stop events caused by setting the answers.
101 };
102 
103 #endif
void OnTWCalculateFromIntWidth(wxCommandEvent &event) override
Update the calculations when the user changes the desired internal trace width.
void TWDisplayValues(double aCurrent, double aExtWidth, double aIntWidth, double aExtThickness, double aIntThickness)
Display the results of a calculation (including resulting values such as the resistance and power los...
void OnTWCalculateFromExtWidth(wxCommandEvent &event) override
Update the calculations when the user changes the desired external trace width.
Class PANEL_TRACK_WIDTH_BASE.
double TWCalculateCurrent(double aWidth, double aThickness, double aDeltaT_C, bool aUseInternalLayer)
Calculate maximum current based on given width and temperature rise.
void OnTWParametersChanged(wxCommandEvent &event) override
Update the calculations the user changes the general parameters.
double TWCalculateWidth(double aCurrent, double aThickness, double aDeltaT_C, bool aUseInternalLayer)
Calculate track width required based on given current and temperature rise.
enum PANEL_TRACK_WIDTH::@37 m_TWMode
void ThemeChanged() override
Update UI elements of the panel when the theme changes to ensure the images and fonts/colors are appr...
const char * name
Definition: DXF_plotter.cpp:56
void TWUpdateModeDisplay()
Update the fields to show whether the maximum current, external trace width, or internal trace width ...
PANEL_TRACK_WIDTH(wxWindow *parent, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL, const wxString &name=wxEmptyString)
void OnTWCalculateFromCurrent(wxCommandEvent &event) override
Update the calculations when the user changes the desired maximum current.
void SaveSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Save the settings from the panel.
void OnTWResetButtonClick(wxCommandEvent &event) override
Update the calculations when the user clicks the reset button.
void LoadSettings(PCB_CALCULATOR_SETTINGS *aCfg) override
Load the settings into the panel.