kicad/eeschema/widgets/tuner_slider.h

105 lines
2.8 KiB
C
Raw Normal View History

2016-08-11 12:41:44 +00:00
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 CERN
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
*
2016-08-11 12:41:44 +00:00
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* https://www.gnu.org/licenses/gpl-3.0.html
* or you may search the http://www.gnu.org website for the version 3 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef TUNER_SLIDER_H
#define TUNER_SLIDER_H
#include "tuner_slider_base.h"
#include <sim/spice_value.h>
#include <wx/timer.h>
class SIM_PLOT_FRAME;
2021-06-10 14:10:55 +00:00
class SCH_SYMBOL;
2016-08-11 12:41:44 +00:00
/**
* Custom widget to handle quick component values modification and simulation on the fly.
2016-08-11 12:41:44 +00:00
*/
class TUNER_SLIDER : public TUNER_SLIDER_BASE
{
public:
2021-06-10 14:10:55 +00:00
TUNER_SLIDER( SIM_PLOT_FRAME *aFrame, wxWindow* aParent, SCH_SYMBOL* aComponent );
2016-08-11 12:41:44 +00:00
wxString GetComponentName() const
{
return m_name->GetLabel();
}
const wxString& GetSpiceName() const
{
return m_spiceName;
}
const SPICE_VALUE& GetValue() const
{
return m_value;
}
const SPICE_VALUE& GetMin() const
{
return m_min;
}
const SPICE_VALUE& GetMax() const
{
return m_max;
}
bool SetValue( const SPICE_VALUE& aVal );
bool SetMin( const SPICE_VALUE& aVal );
bool SetMax( const SPICE_VALUE& aVal );
private:
void updateComponentValue();
void updateSlider();
void updateValueText();
void onClose( wxCommandEvent& event ) override;
void onSave( wxCommandEvent& event ) override;
void onSliderChanged( wxScrollEvent& event ) override;
void onMaxTextEnter( wxCommandEvent& event ) override;
void onValueTextEnter( wxCommandEvent& event ) override;
void onMinTextEnter( wxCommandEvent& event ) override;
void onSimTimer( wxTimerEvent& event );
wxString m_spiceName;
///< Timer that restarts the simulation after the slider value has changed
2016-08-11 12:41:44 +00:00
wxTimer m_simTimer;
2021-06-10 14:10:55 +00:00
SCH_SYMBOL* m_symbol;
2016-08-11 12:41:44 +00:00
SPICE_VALUE m_min, m_max, m_value;
bool m_changed;
SIM_PLOT_FRAME *m_frame;
2016-08-11 12:41:44 +00:00
};
#endif /* TUNER_SLIDER_H */