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  * @author Maciej Suminski <maciej.suminski@cern.ch>
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
18  * along with this program; if not, you may find one here:
19  * https://www.gnu.org/licenses/gpl-3.0.html
20  * or you may search the http://www.gnu.org website for the version 3 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 #ifndef TUNER_SLIDER_H
26 #define TUNER_SLIDER_H
27 
28 #include "tuner_slider_base.h"
29 
30 #include <sim/spice_value.h>
31 
32 #include <wx/timer.h>
33 
34 class SIM_PLOT_FRAME;
35 class SCH_COMPONENT;
36 
41 {
42 public:
43  TUNER_SLIDER( SIM_PLOT_FRAME *aFrame, wxWindow* aParent, SCH_COMPONENT* aComponent );
44 
45  wxString GetComponentName() const
46  {
47  return m_name->GetLabel();
48  }
49 
50  const wxString& GetSpiceName() const
51  {
52  return m_spiceName;
53  }
54 
55  const SPICE_VALUE& GetValue() const
56  {
57  return m_value;
58  }
59 
60  const SPICE_VALUE& GetMin() const
61  {
62  return m_min;
63  }
64 
65  const SPICE_VALUE& GetMax() const
66  {
67  return m_max;
68  }
69 
70  bool SetValue( const SPICE_VALUE& aVal );
71  bool SetMin( const SPICE_VALUE& aVal );
72  bool SetMax( const SPICE_VALUE& aVal );
73 
74 private:
75  void updateComponentValue();
76  void updateSlider();
77  void updateValueText();
78 
79  void onClose( wxCommandEvent& event ) override;
80  void onSave( wxCommandEvent& event ) override;
81  void onSliderChanged( wxScrollEvent& event ) override;
82 
83  void onMaxTextEnter( wxCommandEvent& event ) override;
84  void onValueTextEnter( wxCommandEvent& event ) override;
85  void onMinTextEnter( wxCommandEvent& event ) override;
86 
87  void onSimTimer( wxTimerEvent& event );
88 
89  wxString m_spiceName;
90 
92  wxTimer m_simTimer;
93 
95 
97  bool m_changed;
98 
100 };
101 
102 #endif /* TUNER_SLIDER_H */
void onSimTimer(wxTimerEvent &event)
void updateSlider()
void onValueTextEnter(wxCommandEvent &event) override
wxTimer m_simTimer
Timer that restarts the simulation after the slider value has changed
Definition: tuner_slider.h:92
const SPICE_VALUE & GetValue() const
Definition: tuner_slider.h:55
wxStaticText * m_name
wxString GetComponentName() const
Definition: tuner_slider.h:45
const SPICE_VALUE & GetMax() const
Definition: tuner_slider.h:65
TUNER_SLIDER(SIM_PLOT_FRAME *aFrame, wxWindow *aParent, SCH_COMPONENT *aComponent)
SPICE_VALUE m_min
Definition: tuner_slider.h:96
wxString m_spiceName
Definition: tuner_slider.h:89
Helper class to handle Spice way of expressing values (e.g. 10.5 Meg)
Definition: spice_value.h:32
bool SetValue(const SPICE_VALUE &aVal)
Class TUNER_SLIDER_BASE.
SPICE_VALUE m_value
Definition: tuner_slider.h:96
void onSliderChanged(wxScrollEvent &event) override
SPICE_VALUE m_max
Definition: tuner_slider.h:96
const SPICE_VALUE & GetMin() const
Definition: tuner_slider.h:60
const wxString & GetSpiceName() const
Definition: tuner_slider.h:50
Implementing SIM_PLOT_FRAME_BASE.
void onClose(wxCommandEvent &event) override
void onSave(wxCommandEvent &event) override
void onMaxTextEnter(wxCommandEvent &event) override
bool SetMin(const SPICE_VALUE &aVal)
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:68
bool SetMax(const SPICE_VALUE &aVal)
void onMinTextEnter(wxCommandEvent &event) override
void updateValueText()
SCH_COMPONENT * m_component
Definition: tuner_slider.h:94
Custom widget to handle quick component values modification and simulation on the fly...
Definition: tuner_slider.h:40
SIM_PLOT_FRAME * m_frame
Definition: tuner_slider.h:99
void updateComponentValue()