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
|
2021-06-08 19:39:47 +00:00
|
|
|
* Copyright (C) 2004-2021 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
|
|
|
*/
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
/**
|
|
|
|
* @file transline_ident.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TRANSLINE_IDENT_H
|
|
|
|
#define TRANSLINE_IDENT_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2020-10-13 01:55:32 +00:00
|
|
|
#include "transline/transline.h"
|
2013-05-26 04:36:44 +00:00
|
|
|
|
2021-10-08 16:30:36 +00:00
|
|
|
// Forward declare the bitmaps enum from bitmaps/bitmap_list.h
|
|
|
|
enum class BITMAPS : unsigned int;
|
|
|
|
|
2013-05-26 04:36:44 +00:00
|
|
|
// An enum to handle muwave shapes:
|
2014-03-22 08:28:39 +00:00
|
|
|
enum TRANSLINE_TYPE_ID {
|
|
|
|
START_OF_LIST_TYPE = 0,
|
|
|
|
DEFAULT_TYPE = START_OF_LIST_TYPE,
|
|
|
|
MICROSTRIP_TYPE = DEFAULT_TYPE,
|
|
|
|
CPW_TYPE,
|
|
|
|
GROUNDED_CPW_TYPE,
|
|
|
|
RECTWAVEGUIDE_TYPE,
|
|
|
|
COAX_TYPE,
|
|
|
|
C_MICROSTRIP_TYPE,
|
|
|
|
STRIPLINE_TYPE,
|
|
|
|
TWISTEDPAIR_TYPE,
|
|
|
|
END_OF_LIST_TYPE
|
2013-05-26 04:36:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// A Class to handle parameters
|
|
|
|
enum PRM_TYPE {
|
|
|
|
PRM_TYPE_SUBS,
|
|
|
|
PRM_TYPE_PHYS,
|
|
|
|
PRM_TYPE_ELEC,
|
|
|
|
PRM_TYPE_FREQUENCY
|
|
|
|
};
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A class to handle one parameter of transline.
|
|
|
|
*/
|
2013-05-26 04:36:44 +00:00
|
|
|
class TRANSLINE_PRM
|
|
|
|
{
|
|
|
|
public:
|
2020-08-24 11:35:38 +00:00
|
|
|
/**
|
|
|
|
* @param aKeywordCfg is the keyword used in config to identify the parameter
|
2021-06-08 19:39:47 +00:00
|
|
|
* only ASCII7 keyword is valid.
|
2020-08-24 11:35:38 +00:00
|
|
|
* @param aDlgLabel is a I18n string used to identify the parameter in dialog.
|
2021-06-08 19:39:47 +00:00
|
|
|
* usually aDlgLabel is same as aKeywordCfg, but translatable.
|
2020-08-24 11:35:38 +00:00
|
|
|
*/
|
2021-07-18 14:06:48 +00:00
|
|
|
TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId, const char* aKeywordCfg = "",
|
2020-08-24 11:35:38 +00:00
|
|
|
const wxString& aDlgLabel = wxEmptyString,
|
|
|
|
const wxString& aToolTip = wxEmptyString,
|
2021-07-18 14:06:48 +00:00
|
|
|
double aValue = 0.0, bool aConvUnit = false );
|
2013-05-26 04:36:44 +00:00
|
|
|
|
|
|
|
double ToUserUnit();
|
|
|
|
double FromUserUnit();
|
2021-06-08 19:39:47 +00:00
|
|
|
|
2021-10-10 15:03:24 +00:00
|
|
|
PRM_TYPE m_Type; // Type of parameter: substr, physical, elect
|
|
|
|
PRMS_ID m_Id; // Id of parameter ( link to transline functions )
|
|
|
|
std::string m_KeyWord; // keyword for this parameter in json config file in ASCII7 only
|
|
|
|
wxString m_DlgLabel; // name for this parameter in dialog (usually translated
|
|
|
|
wxString m_ToolTip; // Tool tip for this parameter in dialog
|
|
|
|
double m_Value; // Value for this parameter in dialog
|
|
|
|
double m_NormalizedValue; // actual value for this parameter
|
|
|
|
bool m_ConvUnit; // true if an unit selector must be used
|
|
|
|
void* m_ValueCtrl; // The text ctrl containing the value in dialog
|
|
|
|
void* m_UnitCtrl; // The UNIT_SELECTOR containing the unit in dialog
|
|
|
|
int m_UnitSelection; // last selection for units
|
2013-05-26 04:36:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-07-18 14:06:48 +00:00
|
|
|
/**
|
|
|
|
* A class to handle a list of parameters of a given transline.
|
|
|
|
*
|
|
|
|
* @note The first string of TRANSLINE_PRM (m_KeyWord) is a keyword in config file.
|
|
|
|
* It can contain only ASCII7 chars. The second string of TRANSLINE_PRM is a
|
|
|
|
* string translated for dialog so mark it for translation. Do not mark translatable
|
|
|
|
* m_DlgLabel that obviously cannot be translated, like "H" or "H_t".
|
|
|
|
*/
|
2013-05-26 04:36:44 +00:00
|
|
|
class TRANSLINE_IDENT
|
|
|
|
{
|
2014-10-23 17:53:38 +00:00
|
|
|
public:
|
|
|
|
TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType );
|
2013-05-26 04:36:44 +00:00
|
|
|
~TRANSLINE_IDENT();
|
|
|
|
|
|
|
|
// Add a new param in list
|
|
|
|
void AddPrm( TRANSLINE_PRM* aParam )
|
|
|
|
{
|
|
|
|
m_prms_List.push_back( aParam );
|
|
|
|
}
|
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
TRANSLINE_PRM* GetPrm( unsigned aIdx ) const
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
2021-03-06 09:27:41 +00:00
|
|
|
if( aIdx < m_prms_List.size() )
|
2013-05-26 04:36:44 +00:00
|
|
|
return m_prms_List[aIdx];
|
|
|
|
else
|
2021-07-18 14:06:48 +00:00
|
|
|
return nullptr;
|
2013-05-26 04:36:44 +00:00
|
|
|
}
|
|
|
|
|
2021-03-06 09:27:41 +00:00
|
|
|
unsigned GetPrmsCount() const
|
2013-05-26 04:36:44 +00:00
|
|
|
{
|
|
|
|
return m_prms_List.size();
|
|
|
|
}
|
|
|
|
|
2020-01-13 01:44:19 +00:00
|
|
|
void ReadConfig();
|
|
|
|
void WriteConfig();
|
2021-06-08 19:39:47 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
enum TRANSLINE_TYPE_ID m_Type; // The type of transline handled
|
2021-10-08 16:30:36 +00:00
|
|
|
BITMAPS m_BitmapName; // The name of the bitmap to display in dialogs
|
2021-06-08 19:39:47 +00:00
|
|
|
TRANSLINE* m_TLine; // The TRANSLINE itself
|
|
|
|
wxArrayString m_Messages; // messages for results
|
|
|
|
|
|
|
|
// true if selection of parameters must be enabled in dialog menu.
|
|
|
|
bool m_HasPrmSelection;
|
|
|
|
|
|
|
|
private:
|
2021-10-10 15:03:24 +00:00
|
|
|
std::vector<TRANSLINE_PRM*> m_prms_List;
|
2013-05-26 04:36:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TRANSLINE_IDENT_H
|