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-2014 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 #include <wx/bitmap.h>
30 
31 #include <transline.h>
32 
33 // An enum to handle muwave shapes:
46 };
47 
48 // A Class to handle parameters
49 enum PRM_TYPE {
54 };
55 
57 {
58 public:
59  PRM_TYPE m_Type; // Type of parameter: substr, physical, elect
60  PRMS_ID m_Id; // Id of parameter ( link to transline functions )
61  std::string m_KeyWord; // keyword for this parameter in json config file in ASCII7 only
62  wxString m_DlgLabel; // name for this parameter in dialog (usually translated
63  wxString m_ToolTip; // Tool tip for this parameter in dialog
64  double m_Value; // Value for this parameter in dialog
65  double m_NormalizedValue; // actual value for this parameter
66  bool m_ConvUnit; // true if an unit selector must be used
67  void* m_ValueCtrl; // The text ctrl containing the value in dialog
68  void* m_UnitCtrl; // The UNIT_SELECTOR containing the unit in dialog
69  int m_UnitSelection; // last selection for units
70 
71 public:
72 
80  TRANSLINE_PRM( PRM_TYPE aType, PRMS_ID aId,
81  const char* aKeywordCfg = "",
82  const wxString& aDlgLabel = wxEmptyString,
83  const wxString& aToolTip = wxEmptyString,
84  double aValue = 0.0,
85  bool aConvUnit = false );
86 
87  double ToUserUnit();
88  double FromUserUnit();
89 };
90 
91 
92 // A class to handle the list of availlable transm. lines
93 // with messages, tooptips ...
95 {
96 public:
97  enum TRANSLINE_TYPE_ID m_Type; // The type of transline handled
98  wxBitmap * m_Icon; // An icon to display in dialogs
99  TRANSLINE* m_TLine; // The TRANSLINE itself
100  wxArrayString m_Messages; // messages for results
101  bool m_HasPrmSelection; // true if selection of parameters must be enabled in dialog menu
102 
103 private:
104  std::vector <TRANSLINE_PRM*> m_prms_List;
105 
106 public:
107  TRANSLINE_IDENT( enum TRANSLINE_TYPE_ID aType );
109 
110  // Add a new param in list
111  void AddPrm( TRANSLINE_PRM* aParam )
112  {
113  m_prms_List.push_back( aParam );
114  }
115 
116 
117  TRANSLINE_PRM* GetPrm( unsigned aIdx )
118  {
119  if( aIdx < m_prms_List.size() )
120  return m_prms_List[aIdx];
121  else
122  return NULL;
123  }
124 
125 
126  unsigned GetPrmsCount()
127  {
128  return m_prms_List.size();
129  }
130 
131 
132  void ReadConfig();
133  void WriteConfig();
134 };
135 
136 #endif // TRANSLINE_IDENT_H
wxBitmap * m_Icon
double FromUserUnit()
double m_NormalizedValue
wxString m_DlgLabel
void AddPrm(TRANSLINE_PRM *aParam)
wxArrayString m_Messages
wxString m_ToolTip
unsigned GetPrmsCount()
PRM_TYPE
enum TRANSLINE_TYPE_ID m_Type
#define NULL
std::vector< TRANSLINE_PRM * > m_prms_List
PRMS_ID
Definition: transline.h:37
TRANSLINE_TYPE_ID
std::string m_KeyWord
TRANSLINE * m_TLine
TRANSLINE_PRM * GetPrm(unsigned aIdx)
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)
TRANSLINE_PRM ctor.