kicad/eeschema/widgets/tuner_slider.h

117 lines
3.2 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-2023 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>
2022-10-24 01:47:48 +00:00
#include <sim/spice_generator.h>
2016-08-11 12:41:44 +00:00
#include <wx/timer.h>
class SIMULATOR_FRAME_UI;
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:
TUNER_SLIDER( SIMULATOR_FRAME_UI* aPanel, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath,
SCH_SYMBOL* aSymbol );
2016-08-11 12:41:44 +00:00
wxString GetSymbolRef() const
2016-08-11 12:41:44 +00:00
{
return m_ref;
2016-08-11 12:41:44 +00:00
}
const SPICE_VALUE& GetMin() const
{
return m_min;
}
const SPICE_VALUE& GetMax() const
{
return m_max;
}
const SPICE_VALUE& GetValue() const
{
return m_value;
}
KIID GetSymbol( SCH_SHEET_PATH* aSheetPath ) const
{
*aSheetPath = m_sheetPath;
return m_symbol;
}
2022-10-24 01:47:48 +00:00
2016-08-11 12:41:44 +00:00
bool SetValue( const SPICE_VALUE& aVal );
bool SetMin( const SPICE_VALUE& aVal );
bool SetMax( const SPICE_VALUE& aVal );
2023-02-11 20:39:50 +00:00
void ShowChangedLanguage();
2016-08-11 12:41:44 +00:00
private:
void updateComponentValue();
void updateSlider();
void updateValueText();
void updateMax();
void updateValue();
void updateMin();
void onESeries( wxCommandEvent& event ) override;
2016-08-11 12:41:44 +00:00
void onClose( wxCommandEvent& event ) override;
void onSave( wxCommandEvent& event ) override;
void onSliderScroll( wxScrollEvent& event ) override;
2016-08-11 12:41:44 +00:00
void onSliderChanged( wxScrollEvent& event ) override;
void onMaxKillFocus( wxFocusEvent& event ) override;
void onValueKillFocus( wxFocusEvent& event ) override;
void onMinKillFocus( wxFocusEvent& event ) override;
2016-08-11 12:41:44 +00:00
void onMaxTextEnter( wxCommandEvent& event ) override;
void onValueTextEnter( wxCommandEvent& event ) override;
void onMinTextEnter( wxCommandEvent& event ) override;
2023-02-11 20:39:50 +00:00
private:
KIID m_symbol;
SCH_SHEET_PATH m_sheetPath;
wxString m_ref;
2016-08-11 12:41:44 +00:00
SPICE_VALUE m_min;
SPICE_VALUE m_max;
SPICE_VALUE m_value;
SIMULATOR_FRAME_UI* m_frame;
2016-08-11 12:41:44 +00:00
};
#endif /* TUNER_SLIDER_H */