KiCad PCB EDA Suite
config_params.cpp
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) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
6  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, you may find one here:
20  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21  * or you may search the http://www.gnu.org website for the version 2 license,
22  * or you may write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24  */
25 
26 
27 #include <colors.h> // for ColorByName, EDA_COLOR_T, UNSPECIFIE...
28 #include <common.h> // for LOCALE_IO
29 #include <config_params.h> // for PARAM_CFG_INT_WITH_SCALE, PARAM_CFG_...
30 #include <gal/color4d.h> // for COLOR4D
31 #include <math/util.h> // for KiROUND
32 #include <wx/config.h> // for wxConfigBase
33 #include <wx/debug.h> // for wxASSERT
34 #include <wx/wx.h> // for wxString, operator!=, operator==
35 
36 void wxConfigLoadParams( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList,
37  const wxString& aGroup )
38 {
39  wxASSERT( aCfg );
40 
41  for( PARAM_CFG* param : aList )
42  {
43  if( !!param->m_Group )
44  aCfg->SetPath( param->m_Group );
45  else
46  aCfg->SetPath( aGroup );
47 
48  if( param->m_Setup )
49  continue;
50 
51  param->ReadParam( aCfg );
52  }
53 }
54 
55 
56 void wxConfigLoadSetups( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList )
57 {
58  wxASSERT( aCfg );
59 
60  for( PARAM_CFG* param : aList )
61  {
62  if( !param->m_Setup )
63  continue;
64 
65  param->ReadParam( aCfg );
66  }
67 }
68 
69 
70 void wxConfigSaveParams( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList,
71  const wxString& aGroup )
72 {
73  wxASSERT( aCfg );
74 
75  for( PARAM_CFG* param : aList )
76  {
77  if( !!param->m_Group )
78  aCfg->SetPath( param->m_Group );
79  else
80  aCfg->SetPath( aGroup );
81 
82  if( param->m_Setup )
83  continue;
84 
85  if( param->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
86  {
87  if( !!param->m_Ident )
88  aCfg->DeleteGroup( param->m_Ident );
89  }
90  else
91  {
92  param->SaveParam( aCfg );
93  }
94  }
95 }
96 
97 
98 void wxConfigSaveSetups( wxConfigBase* aCfg, const std::vector<PARAM_CFG*>& aList )
99 {
100  wxASSERT( aCfg );
101 
102  for( PARAM_CFG* param : aList )
103  {
104  if( !param->m_Setup )
105  continue;
106 
107  if( param->m_Type == PARAM_COMMAND_ERASE ) // Erase all data
108  {
109  if( !!param->m_Ident )
110  aCfg->DeleteGroup( param->m_Ident );
111  }
112  else
113  {
114  param->SaveParam( aCfg );
115  }
116  }
117 }
118 
119 
120 void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue )
121 {
122  // Use a single strategy, regardless of wx version.
123  // Want C locale float string.
124 
125  LOCALE_IO toggle;
126  wxString tnumber = wxString::Format( wxT( "%.16g" ), aValue );
127 
128  aConfig->Write( aKey, tnumber );
129 }
130 
131 
132 PARAM_CFG::PARAM_CFG( const wxString& ident, const paramcfg_id type,
133  const wxChar* group, const wxString& legacy )
134 {
135  m_Ident = ident;
136  m_Type = type;
137  m_Group = group;
138  m_Setup = false;
139 
140  m_Ident_legacy = legacy;
141 }
142 
143 
144 PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_val,
145  int min, int max, const wxChar* group, const wxString& legacy ) :
146  PARAM_CFG( ident, PARAM_INT, group, legacy )
147 {
148  m_Pt_param = ptparam;
149  m_Default = default_val;
150  m_Min = min;
151  m_Max = max;
152 }
153 
154 
155 PARAM_CFG_INT::PARAM_CFG_INT( bool setup, const wxString& ident, int* ptparam, int default_val,
156  int min, int max, const wxChar* group, const wxString& legacy ) :
157  PARAM_CFG( ident, PARAM_INT, group, legacy )
158 {
159  m_Pt_param = ptparam;
160  m_Default = default_val;
161  m_Min = min;
162  m_Max = max;
163  m_Setup = setup;
164 }
165 
166 
167 void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
168 {
169  if( !m_Pt_param || !aConfig )
170  return;
171 
172  int itmp = m_Default;
173 
174  if( !aConfig->Read( m_Ident, &itmp ) && m_Ident_legacy != wxEmptyString )
175  aConfig->Read( m_Ident_legacy, &itmp );
176 
177  if( (itmp < m_Min) || (itmp > m_Max) )
178  itmp = m_Default;
179 
180  *m_Pt_param = itmp;
181 }
182 
183 
184 void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
185 {
186  if( !m_Pt_param || !aConfig )
187  return;
188 
189  aConfig->Write( m_Ident, *m_Pt_param );
190 }
191 
192 
193 PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam,
194  int default_val, int min, int max,
195  const wxChar* group, double aBiu2cfgunit,
196  const wxString& legacy_ident ) :
197  PARAM_CFG_INT( ident, ptparam, default_val, min, max, group, legacy_ident )
198 {
200  m_BIU_to_cfgunit = aBiu2cfgunit;
201 }
202 
203 
204 PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool setup, const wxString& ident, int* ptparam,
205  int default_val, int min, int max,
206  const wxChar* group, double aBiu2cfgunit,
207  const wxString& legacy_ident ) :
208  PARAM_CFG_INT( setup, ident, ptparam, default_val, min, max, group, legacy_ident )
209 {
211  m_BIU_to_cfgunit = aBiu2cfgunit;
212 }
213 
214 
215 void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
216 {
217  if( !m_Pt_param || !aConfig )
218  return;
219 
220  double dtmp = (double) m_Default * m_BIU_to_cfgunit;
221  if( !aConfig->Read( m_Ident, &dtmp ) && m_Ident_legacy != wxEmptyString )
222  aConfig->Read( m_Ident_legacy, &dtmp );
223 
224  int itmp = KiROUND( dtmp / m_BIU_to_cfgunit );
225 
226  if( (itmp < m_Min) || (itmp > m_Max) )
227  itmp = m_Default;
228 
229  *m_Pt_param = itmp;
230 }
231 
232 
233 void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
234 {
235  if( !m_Pt_param || !aConfig )
236  return;
237 
238  // We cannot use aConfig->Write for a double, because
239  // this function uses a format with very few digits in mantissa,
240  // and truncature issues are frequent.
241  // We uses our function.
243 }
244 
245 
246 PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, COLOR4D* ptparam,
247  COLOR4D default_val,
248  const wxChar* group ) :
249  PARAM_CFG( ident, PARAM_SETCOLOR, group )
250 {
251  m_Pt_param = ptparam;
252  m_Default = default_val;
253 }
254 
255 
257  const wxString& ident,
258  COLOR4D* ptparam,
259  COLOR4D default_val,
260  const wxChar* group ) :
261  PARAM_CFG( ident, PARAM_SETCOLOR, group )
262 {
263  m_Pt_param = ptparam;
264  m_Default = default_val;
265  m_Setup = Insetup;
266 }
267 
268 
269 void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
270 {
271  if( !m_Pt_param || !aConfig )
272  return;
273 
274  COLOR4D temp;
275 
276  if( aConfig->HasEntry( m_Ident ) )
277  {
278  if( temp.SetFromWxString( aConfig->Read( m_Ident, wxT( "NONE" ) ) ) )
279  {
280  *m_Pt_param = temp;
281  return;
282  }
283  }
284 
285  // If no luck, try reading legacy format
286  wxString legacy_Ident = m_Ident;
287  legacy_Ident.Replace( wxT( "4D" ), wxEmptyString );
288 
289  EDA_COLOR_T old = ColorByName( aConfig->Read( legacy_Ident, wxT( "NONE" ) ) );
290 
291  if( old != UNSPECIFIED_COLOR )
292  {
293  if( m_Ident == wxT( "Color4DErcWEx" ) || m_Ident == wxT( "Color4DErcEEx" ) )
294  *m_Pt_param = COLOR4D( old ).WithAlpha( 0.8 );
295  else
296  *m_Pt_param = COLOR4D( old );
297  return;
298  }
299 
301 }
302 
303 
304 void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
305 {
306  if( !m_Pt_param || !aConfig )
307  return;
308 
309  aConfig->Write( m_Ident, m_Pt_param->ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
310 }
311 
312 
313 PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxString& ident, double* ptparam,
314  double default_val, double min, double max,
315  const wxChar* group ) :
316  PARAM_CFG( ident, PARAM_DOUBLE, group )
317 {
318  m_Pt_param = ptparam;
319  m_Default = default_val;
320  m_Min = min;
321  m_Max = max;
322 }
323 
324 
326  const wxString& ident,
327  double* ptparam,
328  double default_val,
329  double min,
330  double max,
331  const wxChar* group ) :
332  PARAM_CFG( ident, PARAM_DOUBLE, group )
333 {
334  m_Pt_param = ptparam;
335  m_Default = default_val;
336  m_Min = min;
337  m_Max = max;
338  m_Setup = Insetup;
339 }
340 
341 
342 void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
343 {
344  if( !m_Pt_param || !aConfig )
345  return;
346 
347  double dtmp = m_Default;
348  aConfig->Read( m_Ident, &dtmp );
349 
350  if( (dtmp < m_Min) || (dtmp > m_Max) )
351  dtmp = m_Default;
352 
353  *m_Pt_param = dtmp;
354 }
355 
356 
357 void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
358 {
359  if( !m_Pt_param || !aConfig )
360  return;
361 
362  // We cannot use aConfig->Write for a double, because
363  // this function uses a format with very few digits in mantissa,
364  // and truncature issues are frequent.
365  // We uses our function.
367 }
368 
369 
370 PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxString& ident, bool* ptparam, int default_val,
371  const wxChar* group, const wxString& legacy ) :
372  PARAM_CFG( ident, PARAM_BOOL, group, legacy )
373 {
374  m_Pt_param = ptparam;
375  m_Default = default_val ? true : false;
376 }
377 
378 
379 PARAM_CFG_BOOL::PARAM_CFG_BOOL( bool Insetup, const wxString& ident, bool* ptparam,
380  int default_val, const wxChar* group, const wxString& legacy ) :
381  PARAM_CFG( ident, PARAM_BOOL, group, legacy )
382 {
383  m_Pt_param = ptparam;
384  m_Default = default_val ? true : false;
385  m_Setup = Insetup;
386 }
387 
388 
389 void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
390 {
391  if( !m_Pt_param || !aConfig )
392  return;
393 
394  int itmp = (int) m_Default;
395 
396  if( !aConfig->Read( m_Ident, &itmp ) && m_Ident_legacy != wxEmptyString )
397  aConfig->Read( m_Ident_legacy, &itmp );
398 
399  *m_Pt_param = itmp ? true : false;
400 }
401 
402 
403 void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
404 {
405  if( !m_Pt_param || !aConfig )
406  return;
407 
408  aConfig->Write( m_Ident, *m_Pt_param );
409 }
410 
411 
412 PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( const wxString& ident, wxString* ptparam,
413  const wxChar* group ) :
414  PARAM_CFG( ident, PARAM_WXSTRING, group )
415 {
416  m_Pt_param = ptparam;
417 }
418 
419 
420 PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxString& ident, wxString* ptparam,
421  const wxString& default_val, const wxChar* group ) :
422  PARAM_CFG( ident, PARAM_WXSTRING, group )
423 {
424  m_Pt_param = ptparam;
425  m_Setup = Insetup;
426  m_default = default_val;
427 }
428 
429 
430 void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
431 {
432  if( !m_Pt_param || !aConfig )
433  return;
434 
435  *m_Pt_param = aConfig->Read( m_Ident, m_default );
436 }
437 
438 
439 void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
440 {
441  if( !m_Pt_param || !aConfig )
442  return;
443 
444  aConfig->Write( m_Ident, *m_Pt_param );
445 }
446 
447 
448 PARAM_CFG_WXSTRING_SET::PARAM_CFG_WXSTRING_SET( const wxString& ident, std::set<wxString>* ptparam,
449  const wxChar* group ) :
450  PARAM_CFG( ident, PARAM_WXSTRING_SET, group )
451 {
452  m_Pt_param = ptparam;
453 }
454 
455 
456 PARAM_CFG_WXSTRING_SET::PARAM_CFG_WXSTRING_SET( bool Insetup, const wxString& ident,
457  std::set<wxString>* ptparam, const wxChar* group ) :
458  PARAM_CFG( ident, PARAM_WXSTRING, group )
459 {
460  m_Pt_param = ptparam;
461  m_Setup = Insetup;
462 }
463 
464 
465 void PARAM_CFG_WXSTRING_SET::ReadParam( wxConfigBase* aConfig ) const
466 {
467  if( !m_Pt_param || !aConfig )
468  return;
469 
470  for( int i = 1; true; ++i )
471  {
472  wxString key, data;
473 
474  key = m_Ident;
475  key << i;
476  data = aConfig->Read( key, wxT( "" ) );
477 
478  if( data.IsEmpty() )
479  break;
480 
481  m_Pt_param->insert( data );
482  }
483 }
484 
485 
486 void PARAM_CFG_WXSTRING_SET::SaveParam( wxConfigBase* aConfig ) const
487 {
488  if( !m_Pt_param || !aConfig )
489  return;
490 
491  int i = 1;
492 
493  for( const wxString& str : *m_Pt_param )
494  {
495  wxString key, data;
496 
497  key = m_Ident;
498  key << i++;
499 
500  aConfig->Write( key, str );
501  }
502 }
503 
504 
506  wxString* ptparam,
507  const wxChar* group ) :
508  PARAM_CFG( ident, PARAM_FILENAME, group )
509 {
510  m_Pt_param = ptparam;
511 }
512 
513 
514 void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
515 {
516  if( !m_Pt_param || !aConfig )
517  return;
518 
519  wxString prm = aConfig->Read( m_Ident );
520  // file names are stored using Unix notation
521  // under Window we must use \ instead of /
522  // mainly if there is a server name in path (something like \\server\kicad)
523 #ifdef __WINDOWS__
524  prm.Replace(wxT("/"), wxT("\\"));
525 #endif
526  *m_Pt_param = prm;
527 }
528 
529 
530 void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
531 {
532  if( !m_Pt_param || !aConfig )
533  return;
534 
535  wxString prm = *m_Pt_param;
536  // filenames are stored using Unix notation
537  prm.Replace(wxT("\\"), wxT("/") );
538  aConfig->Write( m_Ident, prm );
539 }
540 
541 
543  wxArrayString* ptparam,
544  const wxChar* group ) :
545  PARAM_CFG( ident, PARAM_LIBNAME_LIST, group )
546 {
547  m_Pt_param = ptparam;
548 }
549 
550 
551 void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
552 {
553  if( !m_Pt_param || !aConfig )
554  return;
555 
556  int indexlib = 1; // We start indexlib to 1 because first
557  // lib name is LibName1
558  wxString libname, id_lib;
559  wxArrayString* libname_list = m_Pt_param;
560 
561  while( 1 )
562  {
563  id_lib = m_Ident;
564  id_lib << indexlib;
565  indexlib++;
566  libname = aConfig->Read( id_lib, wxT( "" ) );
567 
568  if( libname.IsEmpty() )
569  break;
570  // file names are stored using Unix notation
571  // under Window we must use \ instead of /
572  // mainly if there is a server name in path (something like \\server\kicad)
573 #ifdef __WINDOWS__
574  libname.Replace(wxT("/"), wxT("\\"));
575 #endif
576  libname_list->Add( libname );
577  }
578 }
579 
580 
581 void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
582 {
583  if( !m_Pt_param || !aConfig )
584  return;
585 
586  wxArrayString* libname_list = m_Pt_param;
587 
588  wxString configkey;
589  wxString libname;
590 
591  for( unsigned indexlib = 0; indexlib < libname_list->GetCount(); indexlib++ )
592  {
593  configkey = m_Ident;
594 
595  // We use indexlib+1 because first lib name is LibName1
596  configkey << (indexlib + 1);
597  libname = libname_list->Item( indexlib );
598 
599  // filenames are stored using Unix notation
600  libname.Replace(wxT("\\"), wxT("/") );
601  aConfig->Write( configkey, libname );
602  }
603 }
bool m_Setup
Install or Project based parameter, true == install.
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
wxString m_Group
Group name (this is like a path in the config data)
int m_Default
The default value of the parameter.
EDA_COLOR_T
NOTE: EDA_COLOR_T is deprecated and is kept around for compatibility with legacy canvas.
Definition: colors.h:42
wxString * m_Pt_param
Pointer to the parameter value.
EDA_COLOR_T ColorByName(const wxString &aName)
Find a color by name.
Definition: colors.cpp:72
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
COLOR4D * m_Pt_param
Pointer to the parameter value.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:214
wxString m_default
The default value of the parameter.
void wxConfigLoadParams(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList, const wxString &aGroup)
Function wxConfigLoadParams uses aList of PARAM_CFG to load configuration values from aCfg.
PARAM_CFG_WXSTRING_SET(const wxString &ident, std::set< wxString > *ptparam, const wxChar *group=NULL)
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
void wxConfigLoadSetups(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG to load configuration values from aCfg.
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
wxString m_Ident
Keyword in config data.
int m_Default
The default value of the parameter.
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
COLOR4D WithAlpha(double aAlpha) const
Function WithAlpha Returns a colour with the same colour, but the given alpha.
Definition: color4d.h:248
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
wxString m_Ident_legacy
double * m_Pt_param
Pointer to the parameter value.
int * m_Pt_param
Pointer to the parameter value.
void wxConfigSaveSetups(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList)
Function wxConfigSaveSetups writes aList of PARAM_CFG to save configuration values to aCfg.
PARAM_CFG_BOOL(const wxString &ident, bool *ptparam, int default_val=false, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
double m_BIU_to_cfgunit
the factor to convert the saved value in internal value
std::set< wxString > * m_Pt_param
Pointer to the parameter value.
PARAM_CFG_LIBNAME_LIST(const wxChar *ident, wxArrayString *ptparam, const wxChar *group=NULL)
wxArrayString * m_Pt_param
Pointer to the parameter value.
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
Configuration parameter - Integer Class.
int m_Max
Minimum and maximum values of the param type.
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
double m_Max
Minimum and maximum values of the param type.
paramcfg_id
Type of parameter in the configuration file.
Definition: config_params.h:70
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
double m_Default
The default value of the parameter.
PARAM_CFG_INT(const wxString &ident, int *ptparam, int default_val=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), const wxChar *group=nullptr, const wxString &legacy_ident=wxEmptyString)
PARAM_CFG_WXSTRING(const wxString &ident, wxString *ptparam, const wxChar *group=NULL)
bool * m_Pt_param
Pointer to the parameter value.
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
void ConfigBaseWriteDouble(wxConfigBase *aConfig, const wxString &aKey, double aValue)
Function ConfigBaseWriteDouble This is a helper function to write doubles in config We cannot use wxC...
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
COLOR4D m_Default
The default value of the parameter.
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
PARAM_CFG is a base class which establishes the interface functions ReadParam and SaveParam,...
Definition: config_params.h:99
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
paramcfg_id m_Type
Type of parameter.
void wxConfigSaveParams(wxConfigBase *aCfg, const std::vector< PARAM_CFG * > &aList, const wxString &aGroup)
Function wxConfigSaveParams writes aList of PARAM_CFG to save configuration values to aCfg.
wxString * m_Pt_param
Pointer to the parameter value.
constexpr ret_type KiROUND(fp_type v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: util.h:61
The common library.
PARAM_CFG_SETCOLOR(const wxString &ident, COLOR4D *ptparam, COLOR4D default_val, const wxChar *group=NULL)
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
PARAM_CFG_DOUBLE(const wxString &ident, double *ptparam, double default_val=0.0, double min=0.0, double max=10000.0, const wxChar *group=NULL)
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
PARAM_CFG_FILENAME(const wxString &ident, wxString *ptparam, const wxChar *group=NULL)
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
PARAM_CFG_INT_WITH_SCALE(const wxString &ident, int *ptparam, int default_val=0, int min=std::numeric_limits< int >::min(), int max=std::numeric_limits< int >::max(), const wxChar *group=NULL, double aBiu2cfgunit=1.0, const wxString &legacy_ident=wxEmptyString)
COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:40