forked from KiCad/kicad-source-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
footprint_wizard.h
224 lines (192 loc) · 7.5 KB
/
footprint_wizard.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 NBEE Embedded Systems SL, Miguel Angel Ajo <[email protected]>
* Copyright (C) 2013-2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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 2
* 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:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file footprint_wizard.h
* @brief Class FOOTPRINT_WIZARD and FOOTPRINT_WIZARDS
*/
#ifndef FOOTPRINT_WIZARD_H
#define FOOTPRINT_WIZARD_H
#include <vector>
#include <pcb_edit_frame.h>
// Allowable parameter types for PCB wizards
const wxString WIZARD_PARAM_UNITS_MM = "mm"; // Millimetres
const wxString WIZARD_PARAM_UNITS_MILS = "mils"; // Mils / thou
const wxString WIZARD_PARAM_UNITS_FLOAT = "float"; // Floating point (dimensionless)
const wxString WIZARD_PARAM_UNITS_INTEGER = "integer"; // Integer (dimensionless)
const wxString WIZARD_PARAM_UNITS_BOOL = "bool"; // Boolean option
const wxString WIZARD_PARAM_UNITS_RADIANS = "radians"; // Angle (radians)
const wxString WIZARD_PARAM_UNITS_DEGREES = "degrees"; // Angle (degrees)
const wxString WIZARD_PARAM_UNITS_PERCENT = "%"; // Percent (0% -> 100%)
const wxString WIZARD_PARAM_UNITS_STRING = "string"; // String
/**
* FOOTPRINT_WIZARD
* This is the parent class from where any footprint wizard class must derive
*/
class FOOTPRINT_WIZARD
{
public:
FOOTPRINT_WIZARD() {}
virtual ~FOOTPRINT_WIZARD();
/**
* Function GetName
* @return the name of the wizard
*/
virtual wxString GetName() = 0;
/**
* Function GetImage
* @return an svg image of the wizard to be rendered
*/
virtual wxString GetImage() = 0;
/**
* Function GetDescription
* @return a description of the footprint wizard
*/
virtual wxString GetDescription() = 0;
/**
* Function GetNumParameterPages
* @return the number of parameter pages that this wizard will show to the user
*/
virtual int GetNumParameterPages() = 0;
/**
* Function GetParameterPageName
* @param aPage is the page we want the name of
* @return a string with the page name
*/
virtual wxString GetParameterPageName( int aPage ) = 0;
/**
* Function GetParameterNames
* @param aPage is the page we want the parameter names of
* @return an array string with the parameter names on a certain page
*/
virtual wxArrayString GetParameterNames( int aPage ) = 0;
/**
* Function GetParameterTypes
* @param aPage is the page we want the parameter types of
* @return an array string with the parameter types on a certain page
* "IU" for internal units, "UNITS" for units (0,1,2,3...,N)
*/
virtual wxArrayString GetParameterTypes( int aPage ) = 0;
/**
* Function GetParameterValues
* @param aPage is the page we want the parameter values of
* @return an array of parameter values
*/
virtual wxArrayString GetParameterValues( int aPage ) = 0;
/**
* Function GetParameterErrors
* @param aPage is the page we want to know the errors of
* @return an array of errors (if any) for the parameters, empty strings for OK parameters
*/
virtual wxArrayString GetParameterErrors( int aPage ) = 0;
/**
* Function GetParameterHints
* @param aPage is the page we want to know the hints of
* @return an array of hints (if any) for the parameters, empty string for no hints
*/
virtual wxArrayString GetParameterHints( int aPage ) = 0;
/**
* Function GetParamaterDesignators
* @param aPage is the page we want to know the designators of
* @return an array of designators (blank strings for no designators
*/
virtual wxArrayString GetParameterDesignators( int aPage ) = 0;
/**
* Function SetParameterValues
* @param aPage is the page we want to set the parameters in
* @param aValues are the values we want to set into the parameters
* @return an array of parameter values
*/
virtual wxString SetParameterValues( int aPage, wxArrayString& aValues ) = 0;
/**
* Function ResetParameters
* Reset all wizard parameters to default values
*/
virtual void ResetParameters() = 0;
/**
* Function GetFootprint
* This method builds the footprint itself and returns it to the caller function
* @return PCB footprint built from the parameters given to the class
* @param aMessage a wxString to store messages (if any) generated by the
* footprint generator
*/
virtual FOOTPRINT* GetFootprint( wxString* aMessage ) = 0;
/**
* Function GetObject
* This method gets the pointer to the object from where this wizard constructs
* @return it's a void pointer, as it could be a PyObject or any other
*/
virtual void* GetObject() = 0;
/**
* Function register_wizard
* It's the standard method of a "FOOTPRINT_WIZARD" to register itself into
* the FOOTPRINT_WIZARD_LIST singleton manager
*/
void register_wizard();
};
class FOOTPRINT_WIZARD_LIST
{
private:
/**
* FOOTPRINT_WIZARD system wide static list
*/
static std::vector<FOOTPRINT_WIZARD*> m_FootprintWizards;
public:
/**
* Function register_wizard
* A footprint wizard calls this static method when it wants to register itself
* into the system wizards
* Note: if it is already registered, this function do nothing
* if n existing wizard with the same name exists, this existing wizard will be
* unregistered.
* @param aWizard is the footprint wizard to be registered
*/
static void register_wizard( FOOTPRINT_WIZARD* aWizard );
/**
* Function deregister_object
* Anyone calls this method to deregister an object which builds a wizard,
* it will lookup on the vector calling GetObject until find, then removed
* and deleted
*
* @param aObject is the footprint wizard object to be deregistered
*/
static bool deregister_object( void* aObject );
/**
* Function GetWizard
* @param aName is the footprint wizard name
* @return a wizard object by it's name or NULL if it isn't available.
*/
static FOOTPRINT_WIZARD* GetWizard( const wxString& aName );
/**
* Function GetWizard
* @return a wizard object by it's number or NULL if it isn't available.
* @param aIndex is the wizard index in list
*/
static FOOTPRINT_WIZARD* GetWizard( int aIndex );
/**
* Function GetWizardsCount
* @return the number of wizards available into the system
*/
static int GetWizardsCount();
};
#endif /* PCBNEW_FOOTPRINT_WIZARDS_H */