KiCad PCB EDA Suite
transline_ident.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2011-2014 Jean-Pierre Charras
5  * Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef TRANSLINE_IDENT_H
26 #define TRANSLINE_IDENT_H
27 
28 #include <vector>
29 
30 #include "transline/transline.h"
31 
32 // Forward declare the bitmaps enum from bitmaps/bitmap_list.h
33 enum class BITMAPS : unsigned int;
34 
35 // An enum to handle muwave shapes:
40  CPW_TYPE,
43  COAX_TYPE,
48 };
49 
50 // A Class to handle parameters
51 enum PRM_TYPE {
56 };
57 
58 
63 {
64 public:
71  TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId, const char* aKeywordCfg = "",
72  const wxString& aDlgLabel = wxEmptyString,
73  const wxString& aToolTip = wxEmptyString,
74  double aValue = 0.0, bool aConvUnit = false );
75 
76  double ToUserUnit();
77  double FromUserUnit();
78 
79  PRM_TYPE m_Type; // Type of parameter: substr, physical, elect
80  PRMS_ID m_Id; // Id of parameter ( link to transline functions )
81  std::string m_KeyWord; // keyword for this parameter in json config file in ASCII7 only
82  wxString m_DlgLabel; // name for this parameter in dialog (usually translated
83  wxString m_ToolTip; // Tool tip for this parameter in dialog
84  double m_Value; // Value for this parameter in dialog
85  double m_NormalizedValue; // actual value for this parameter
86  bool m_ConvUnit; // true if an unit selector must be used
87  void* m_ValueCtrl; // The text ctrl containing the value in dialog
88  void* m_UnitCtrl; // The UNIT_SELECTOR containing the unit in dialog
89  int m_UnitSelection; // last selection for units
90 };
91 
92 
102 {
103 public:
104  TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType );
106 
107  // Add a new param in list
108  void AddPrm( TRANSLINE_PRM* aParam )
109  {
110  m_prms_List.push_back( aParam );
111  }
112 
113  TRANSLINE_PRM* GetPrm( unsigned aIdx ) const
114  {
115  if( aIdx < m_prms_List.size() )
116  return m_prms_List[aIdx];
117  else
118  return nullptr;
119  }
120 
121  unsigned GetPrmsCount() const
122  {
123  return m_prms_List.size();
124  }
125 
126  void ReadConfig();
127  void WriteConfig();
128 
129 public:
130  enum TRANSLINE_TYPE_ID m_Type; // The type of transline handled
131  BITMAPS m_BitmapName; // The name of the bitmap to display in dialogs
132  TRANSLINE* m_TLine; // The TRANSLINE itself
133  wxArrayString m_Messages; // messages for results
134 
135  // true if selection of parameters must be enabled in dialog menu.
137 
138 private:
139  std::vector<TRANSLINE_PRM*> m_prms_List;
140 };
141 
142 #endif // TRANSLINE_IDENT_H
double FromUserUnit()
double m_NormalizedValue
wxString m_DlgLabel
void AddPrm(TRANSLINE_PRM *aParam)
A class to handle one parameter of transline.
wxArrayString m_Messages
A class to handle a list of parameters of a given transline.
wxString m_ToolTip
PRM_TYPE
enum TRANSLINE_TYPE_ID m_Type
std::vector< TRANSLINE_PRM * > m_prms_List
PRMS_ID
Definition: transline.h:36
unsigned GetPrmsCount() const
TRANSLINE_TYPE_ID
std::string m_KeyWord
TRANSLINE_PRM * GetPrm(unsigned aIdx) const
BITMAPS
A list of all bitmap identifiers.
Definition: bitmaps_list.h:32
TRANSLINE * m_TLine
TRANSLINE_IDENT(enum TRANSLINE_TYPE_ID aType)
TRANSLINE_PRM(PRM_TYPE aType, PRMS_ID aId, const char *aKeywordCfg="", const wxString &aDlgLabel=wxEmptyString, const wxString &aToolTip=wxEmptyString, double aValue=0.0, bool aConvUnit=false)