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
|
2021-01-26 15:23:37 +00:00
|
|
|
* 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>
|
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 SIM_PLOT_FRAME;
|
2021-06-10 14:10:55 +00:00
|
|
|
class SCH_SYMBOL;
|
2016-08-11 12:41:44 +00:00
|
|
|
|
|
|
|
/**
|
2021-01-26 15:23:37 +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:
|
2022-12-23 22:02:59 +00:00
|
|
|
TUNER_SLIDER( SIM_PLOT_FRAME *aFrame, wxWindow* aParent, const SCH_SHEET_PATH& aSheetPath,
|
|
|
|
SCH_SYMBOL* aSymbol );
|
2016-08-11 12:41:44 +00:00
|
|
|
|
2022-12-23 22:02:59 +00:00
|
|
|
wxString GetSymbolRef() const
|
2016-08-11 12:41:44 +00:00
|
|
|
{
|
|
|
|
return m_name->GetLabel();
|
|
|
|
}
|
|
|
|
|
|
|
|
const SPICE_VALUE& GetMin() const
|
|
|
|
{
|
|
|
|
return m_min;
|
|
|
|
}
|
|
|
|
|
|
|
|
const SPICE_VALUE& GetMax() const
|
|
|
|
{
|
|
|
|
return m_max;
|
|
|
|
}
|
|
|
|
|
2022-12-23 22:02:59 +00:00
|
|
|
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();
|
|
|
|
|
2021-10-20 23:33:30 +00:00
|
|
|
void updateMax();
|
|
|
|
void updateValue();
|
|
|
|
void updateMin();
|
|
|
|
|
2022-12-26 10:29:52 +00:00
|
|
|
void onESeries( wxCommandEvent& event ) override;
|
2016-08-11 12:41:44 +00:00
|
|
|
void onClose( wxCommandEvent& event ) override;
|
|
|
|
void onSave( wxCommandEvent& event ) override;
|
2022-12-26 10:48:17 +00:00
|
|
|
void onSliderScroll( wxScrollEvent& event ) override;
|
2016-08-11 12:41:44 +00:00
|
|
|
void onSliderChanged( wxScrollEvent& event ) override;
|
|
|
|
|
2021-10-20 23:33:30 +00:00
|
|
|
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:
|
2022-12-23 22:02:59 +00:00
|
|
|
KIID m_symbol;
|
|
|
|
SCH_SHEET_PATH m_sheetPath;
|
2023-02-11 20:39:50 +00:00
|
|
|
wxString m_ref;
|
2016-08-11 12:41:44 +00:00
|
|
|
|
2022-12-23 22:02:59 +00:00
|
|
|
SPICE_VALUE m_min;
|
|
|
|
SPICE_VALUE m_max;
|
|
|
|
SPICE_VALUE m_value;
|
2016-08-11 12:42:00 +00:00
|
|
|
|
2022-12-23 22:02:59 +00:00
|
|
|
SIM_PLOT_FRAME* m_frame;
|
2016-08-11 12:41:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* TUNER_SLIDER_H */
|