KiCad PCB EDA Suite
tuner_slider.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) 2016 CERN
5  * Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * @author Maciej Suminski <maciej.suminski@cern.ch>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * as published by the Free Software Foundation; either version 3
12  * of the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, you may find one here:
21  * https://www.gnu.org/licenses/gpl-3.0.html
22  * or you may search the http://www.gnu.org website for the version 3 license,
23  * or you may write to the Free Software Foundation, Inc.,
24  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25  */
26 
27 #ifndef TUNER_SLIDER_H
28 #define TUNER_SLIDER_H
29 
30 #include "tuner_slider_base.h"
31 
32 #include <sim/spice_value.h>
33 
34 #include <wx/timer.h>
35 
36 class SIM_PLOT_FRAME;
37 class SCH_SYMBOL;
38 
43 {
44 public:
45  TUNER_SLIDER( SIM_PLOT_FRAME *aFrame, wxWindow* aParent, SCH_SYMBOL* aSymbol );
46 
47  wxString GetComponentName() const
48  {
49  return m_name->GetLabel();
50  }
51 
52  const wxString& GetSpiceName() const
53  {
54  return m_spiceName;
55  }
56 
57  const SPICE_VALUE& GetValue() const
58  {
59  return m_value;
60  }
61 
62  const SPICE_VALUE& GetMin() const
63  {
64  return m_min;
65  }
66 
67  const SPICE_VALUE& GetMax() const
68  {
69  return m_max;
70  }
71 
72  bool SetValue( const SPICE_VALUE& aVal );
73  bool SetMin( const SPICE_VALUE& aVal );
74  bool SetMax( const SPICE_VALUE& aVal );
75 
76 private:
77  void updateComponentValue();
78  void updateSlider();
79  void updateValueText();
80 
81  void updateMax();
82  void updateValue();
83  void updateMin();
84 
85  void onClose( wxCommandEvent& event ) override;
86  void onSave( wxCommandEvent& event ) override;
87  void onSliderChanged( wxScrollEvent& event ) override;
88 
89  void onMaxKillFocus( wxFocusEvent& event ) override;
90  void onValueKillFocus( wxFocusEvent& event ) override;
91  void onMinKillFocus( wxFocusEvent& event ) override;
92 
93  void onMaxTextEnter( wxCommandEvent& event ) override;
94  void onValueTextEnter( wxCommandEvent& event ) override;
95  void onMinTextEnter( wxCommandEvent& event ) override;
96 
97  void onSimTimer( wxTimerEvent& event );
98 
99  wxString m_spiceName;
100 
102  wxTimer m_simTimer;
103 
105 
107  bool m_changed;
108 
110 };
111 
112 #endif /* TUNER_SLIDER_H */
const SPICE_VALUE & GetValue() const
Definition: tuner_slider.h:57
void onSimTimer(wxTimerEvent &event)
void updateSlider()
wxString GetComponentName() const
Definition: tuner_slider.h:47
void onValueTextEnter(wxCommandEvent &event) override
const SPICE_VALUE & GetMin() const
Definition: tuner_slider.h:62
wxTimer m_simTimer
Definition: tuner_slider.h:102
wxStaticText * m_name
SPICE_VALUE m_min
Definition: tuner_slider.h:106
const SPICE_VALUE & GetMax() const
Definition: tuner_slider.h:67
wxString m_spiceName
Timer that restarts the simulation after the slider value has changed.
Definition: tuner_slider.h:99
const wxString & GetSpiceName() const
Definition: tuner_slider.h:52
< Helper class to handle Spice way of expressing values (e.g. 10.5 Meg) Helper class to recognize Spi...
Definition: spice_value.h:34
bool SetValue(const SPICE_VALUE &aVal)
Class TUNER_SLIDER_BASE.
SPICE_VALUE m_value
Definition: tuner_slider.h:106
void onSliderChanged(wxScrollEvent &event) override
SPICE_VALUE m_max
Definition: tuner_slider.h:106
void onMaxKillFocus(wxFocusEvent &event) override
Implementing SIM_PLOT_FRAME_BASE.
SCH_SYMBOL * m_symbol
Definition: tuner_slider.h:104
void onClose(wxCommandEvent &event) override
void updateValue()
void onValueKillFocus(wxFocusEvent &event) override
void onSave(wxCommandEvent &event) override
void onMaxTextEnter(wxCommandEvent &event) override
Schematic symbol object.
Definition: sch_symbol.h:78
bool SetMin(const SPICE_VALUE &aVal)
void onMinKillFocus(wxFocusEvent &event) override
bool SetMax(const SPICE_VALUE &aVal)
TUNER_SLIDER(SIM_PLOT_FRAME *aFrame, wxWindow *aParent, SCH_SYMBOL *aSymbol)
void onMinTextEnter(wxCommandEvent &event) override
void updateValueText()
Custom widget to handle quick component values modification and simulation on the fly.
Definition: tuner_slider.h:42
SIM_PLOT_FRAME * m_frame
Definition: tuner_slider.h:109
void updateComponentValue()