2014-10-23 17:53:38 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011-2014 Jean-Pierre Charras
|
2022-09-07 23:16:57 +00:00
|
|
|
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-23 17:53:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2019-05-01 18:57:59 +00:00
|
|
|
* as published by the Free Software Foundation; either version 3
|
2014-10-23 17:53:38 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2019-05-01 18:57:59 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2014-10-23 17:53:38 +00:00
|
|
|
*/
|
|
|
|
|
2022-09-07 23:16:57 +00:00
|
|
|
/**
|
2011-08-12 05:21:36 +00:00
|
|
|
* @file UnitSelector.h
|
|
|
|
* a wxChoiceBox to select units in Pcb_Calculator
|
|
|
|
*/
|
|
|
|
|
2020-10-13 01:55:32 +00:00
|
|
|
#ifndef UNIT_SELECTOR_H
|
|
|
|
#define UNIT_SELECTOR_H
|
2011-08-12 05:21:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/choice.h>
|
|
|
|
|
|
|
|
|
|
|
|
class UNIT_SELECTOR: public wxChoice
|
|
|
|
{
|
|
|
|
public:
|
2014-10-23 17:53:38 +00:00
|
|
|
UNIT_SELECTOR( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 ):
|
2011-08-12 05:21:36 +00:00
|
|
|
wxChoice( parent, id, pos, size, choices, style )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units (meter, herz, ohm, radian )
|
|
|
|
*/
|
|
|
|
virtual double GetUnitScale() = 0;
|
|
|
|
|
|
|
|
wxString GetUnitName()
|
|
|
|
{
|
|
|
|
return GetStringSelection();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class UNIT_SELECTOR_LEN: public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
2014-10-23 17:53:38 +00:00
|
|
|
UNIT_SELECTOR_LEN( wxWindow *parent, wxWindowID id,
|
2011-08-12 05:21:36 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units (meter)
|
|
|
|
*/
|
2021-10-10 15:03:24 +00:00
|
|
|
double GetUnitScale() override;
|
2011-08-12 05:21:36 +00:00
|
|
|
};
|
|
|
|
|
2016-01-06 00:04:45 +00:00
|
|
|
class UNIT_SELECTOR_THICKNESS: public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UNIT_SELECTOR_THICKNESS( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units (meter) including oz/ft^2
|
|
|
|
*/
|
2021-10-10 15:03:24 +00:00
|
|
|
double GetUnitScale() override;
|
2016-01-06 00:04:45 +00:00
|
|
|
};
|
|
|
|
|
2011-08-12 05:21:36 +00:00
|
|
|
class UNIT_SELECTOR_FREQUENCY: public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
2014-10-23 17:53:38 +00:00
|
|
|
UNIT_SELECTOR_FREQUENCY( wxWindow *parent, wxWindowID id,
|
2011-08-12 05:21:36 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units (Hz)
|
|
|
|
*/
|
2021-10-10 15:03:24 +00:00
|
|
|
double GetUnitScale() override;
|
2011-08-12 05:21:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class UNIT_SELECTOR_ANGLE: public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
2014-10-23 17:53:38 +00:00
|
|
|
UNIT_SELECTOR_ANGLE( wxWindow *parent, wxWindowID id,
|
2011-08-12 05:21:36 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units (Hz)
|
|
|
|
*/
|
2021-10-10 15:03:24 +00:00
|
|
|
double GetUnitScale() override;
|
2011-08-12 05:21:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class UNIT_SELECTOR_RESISTOR: public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
2014-10-23 17:53:38 +00:00
|
|
|
UNIT_SELECTOR_RESISTOR( wxWindow *parent, wxWindowID id,
|
2011-08-12 05:21:36 +00:00
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units (Hz)
|
|
|
|
*/
|
2021-10-10 15:03:24 +00:00
|
|
|
double GetUnitScale() override;
|
2011-08-12 05:21:36 +00:00
|
|
|
};
|
2014-10-23 17:53:38 +00:00
|
|
|
|
2022-06-16 22:04:45 +00:00
|
|
|
class UNIT_SELECTOR_LINEAR_RESISTANCE : public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UNIT_SELECTOR_LINEAR_RESISTANCE( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units ( ohm/m )
|
|
|
|
*/
|
|
|
|
double GetUnitScale() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class UNIT_SELECTOR_LEN_CABLE : public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UNIT_SELECTOR_LEN_CABLE( wxWindow *parent, wxWindowID id,
|
|
|
|
const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
2022-09-07 23:16:57 +00:00
|
|
|
* to normalized units ( m )
|
|
|
|
*/
|
|
|
|
double GetUnitScale() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class UNIT_SELECTOR_VOLTAGE : public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UNIT_SELECTOR_VOLTAGE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units ( V )
|
|
|
|
*/
|
|
|
|
double GetUnitScale() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class UNIT_SELECTOR_POWER : public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UNIT_SELECTOR_POWER( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units ( W )
|
2022-06-16 22:04:45 +00:00
|
|
|
*/
|
|
|
|
double GetUnitScale() override;
|
|
|
|
};
|
|
|
|
|
2022-07-06 18:28:59 +00:00
|
|
|
class UNIT_SELECTOR_SPEED : public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UNIT_SELECTOR_SPEED( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units ( ohm/m )
|
|
|
|
*/
|
|
|
|
double GetUnitScale() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
class UNIT_SELECTOR_TIME : public UNIT_SELECTOR
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
UNIT_SELECTOR_TIME( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
|
|
|
|
const wxArrayString& choices, long style = 0 );
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function GetUnitScale
|
|
|
|
* @return the scaling factor to convert users units
|
|
|
|
* to normalized units ( ohm/m )
|
|
|
|
*/
|
|
|
|
double GetUnitScale() override;
|
|
|
|
};
|
|
|
|
|
2020-10-13 01:55:32 +00:00
|
|
|
#endif // UNIT_SELECTOR_H
|
2011-08-12 05:21:36 +00:00
|
|
|
|