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-2017 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 #include <fctsys.h>
27 #include <gr_basic.h>
28 #include <pgm_base.h>
29 #include <common.h>
30 #include <kicad_string.h>
31 #include <gestfich.h>
32 #include <eda_base_frame.h>
33 #include <config_params.h>
34 
35 #include <wx/apptrait.h>
36 #include <wx/stdpaths.h>
37 
39 
40 
41 void wxConfigLoadParams( wxConfigBase* aCfg,
42  const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
43 {
44  wxASSERT( aCfg );
45 
46  for( const PARAM_CFG_BASE& param : aList )
47  {
48  if( !!param.m_Group )
49  aCfg->SetPath( param.m_Group );
50  else
51  aCfg->SetPath( aGroup );
52 
53  if( param.m_Setup )
54  continue;
55 
56  param.ReadParam( aCfg );
57  }
58 }
59 
60 
61 void wxConfigLoadSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
62 {
63  wxASSERT( aCfg );
64 
65  for( const PARAM_CFG_BASE& param : aList )
66  {
67  if( !param.m_Setup )
68  continue;
69 
70  param.ReadParam( aCfg );
71  }
72 }
73 
74 
75 void wxConfigSaveParams( wxConfigBase* aCfg,
76  const PARAM_CFG_ARRAY& aList, const wxString& aGroup )
77 {
78  wxASSERT( aCfg );
79 
80  for( const PARAM_CFG_BASE& param : aList )
81  {
82  if( !!param.m_Group )
83  aCfg->SetPath( param.m_Group );
84  else
85  aCfg->SetPath( aGroup );
86 
87  if( param.m_Setup )
88  continue;
89 
90  if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
91  {
92  if( !!param.m_Ident )
93  aCfg->DeleteGroup( param.m_Ident );
94  }
95  else
96  {
97  param.SaveParam( aCfg );
98  }
99  }
100 }
101 
102 
103 void wxConfigSaveSetups( wxConfigBase* aCfg, const PARAM_CFG_ARRAY& aList )
104 {
105  wxASSERT( aCfg );
106 
107  for( const PARAM_CFG_BASE& param : aList )
108  {
109  if( !param.m_Setup )
110  continue;
111 
112  if( param.m_Type == PARAM_COMMAND_ERASE ) // Erase all data
113  {
114  if( !!param.m_Ident )
115  aCfg->DeleteGroup( param.m_Ident );
116  }
117  else
118  {
119  param.SaveParam( aCfg );
120  }
121  }
122 }
123 
124 
125 void ConfigBaseWriteDouble( wxConfigBase* aConfig, const wxString& aKey, double aValue )
126 {
127  // Use a single strategy, regardless of wx version.
128  // Want C locale float string.
129 
130  LOCALE_IO toggle;
131  wxString tnumber = wxString::Format( wxT( "%.16g" ), aValue );
132 
133  aConfig->Write( aKey, tnumber );
134 }
135 
136 
137 PARAM_CFG_BASE::PARAM_CFG_BASE( const wxString& ident, const paramcfg_id type,
138  const wxChar* group, const wxString& legacy )
139 {
140  m_Ident = ident;
141  m_Type = type;
142  m_Group = group;
143  m_Setup = false;
144 
145  m_Ident_legacy = legacy;
146 }
147 
148 
149 PARAM_CFG_INT::PARAM_CFG_INT( const wxString& ident, int* ptparam, int default_val,
150  int min, int max, const wxChar* group, const wxString& legacy ) :
151  PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
152 {
153  m_Pt_param = ptparam;
154  m_Default = default_val;
155  m_Min = min;
156  m_Max = max;
157 }
158 
159 
160 PARAM_CFG_INT::PARAM_CFG_INT( bool setup, const wxString& ident, int* ptparam, int default_val,
161  int min, int max, const wxChar* group, const wxString& legacy ) :
162  PARAM_CFG_BASE( ident, PARAM_INT, group, legacy )
163 {
164  m_Pt_param = ptparam;
165  m_Default = default_val;
166  m_Min = min;
167  m_Max = max;
168  m_Setup = setup;
169 }
170 
171 
172 void PARAM_CFG_INT::ReadParam( wxConfigBase* aConfig ) const
173 {
174  if( !m_Pt_param || !aConfig )
175  return;
176 
177  int itmp = m_Default;
178 
179  if( !aConfig->Read( m_Ident, &itmp ) && m_Ident_legacy != wxEmptyString )
180  aConfig->Read( m_Ident_legacy, &itmp );
181 
182  if( (itmp < m_Min) || (itmp > m_Max) )
183  itmp = m_Default;
184 
185  *m_Pt_param = itmp;
186 }
187 
188 
189 void PARAM_CFG_INT::SaveParam( wxConfigBase* aConfig ) const
190 {
191  if( !m_Pt_param || !aConfig )
192  return;
193 
194  aConfig->Write( m_Ident, *m_Pt_param );
195 }
196 
197 
198 PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( const wxString& ident, int* ptparam,
199  int default_val, int min, int max,
200  const wxChar* group, double aBiu2cfgunit,
201  const wxString& legacy_ident ) :
202  PARAM_CFG_INT( ident, ptparam, default_val, min, max, group, legacy_ident )
203 {
205  m_BIU_to_cfgunit = aBiu2cfgunit;
206 }
207 
208 
209 PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE( bool setup, const wxString& ident, int* ptparam,
210  int default_val, int min, int max,
211  const wxChar* group, double aBiu2cfgunit,
212  const wxString& legacy_ident ) :
213  PARAM_CFG_INT( setup, ident, ptparam, default_val, min, max, group, legacy_ident )
214 {
216  m_BIU_to_cfgunit = aBiu2cfgunit;
217 }
218 
219 
220 void PARAM_CFG_INT_WITH_SCALE::ReadParam( wxConfigBase* aConfig ) const
221 {
222  if( !m_Pt_param || !aConfig )
223  return;
224 
225  double dtmp = (double) m_Default * m_BIU_to_cfgunit;
226  if( !aConfig->Read( m_Ident, &dtmp ) && m_Ident_legacy != wxEmptyString )
227  aConfig->Read( m_Ident_legacy, &dtmp );
228 
229  int itmp = KiROUND( dtmp / m_BIU_to_cfgunit );
230 
231  if( (itmp < m_Min) || (itmp > m_Max) )
232  itmp = m_Default;
233 
234  *m_Pt_param = itmp;
235 }
236 
237 
238 void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
239 {
240  if( !m_Pt_param || !aConfig )
241  return;
242 
243  // We cannot use aConfig->Write for a double, because
244  // this function uses a format with very few digits in mantissa,
245  // and truncature issues are frequent.
246  // We uses our function.
248 }
249 
250 
251 PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, COLOR4D* ptparam,
252  COLOR4D default_val,
253  const wxChar* group ) :
254  PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
255 {
256  m_Pt_param = ptparam;
257  m_Default = default_val;
258 }
259 
260 
262  const wxString& ident,
263  COLOR4D* ptparam,
264  COLOR4D default_val,
265  const wxChar* group ) :
266  PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
267 {
268  m_Pt_param = ptparam;
269  m_Default = default_val;
270  m_Setup = Insetup;
271 }
272 
273 
274 void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
275 {
276  if( !m_Pt_param || !aConfig )
277  return;
278 
279  COLOR4D temp;
280 
281  if( aConfig->HasEntry( m_Ident ) )
282  {
283  if( temp.SetFromWxString( aConfig->Read( m_Ident, wxT( "NONE" ) ) ) )
284  {
285  *m_Pt_param = temp;
286  return;
287  }
288  }
289 
290  // If no luck, try reading legacy format
291  wxString legacy_Ident = m_Ident;
292  legacy_Ident.Replace( wxT( "4D" ), wxEmptyString );
293 
294  EDA_COLOR_T old = ColorByName( aConfig->Read( legacy_Ident, wxT( "NONE" ) ) );
295 
296  if( old != UNSPECIFIED_COLOR )
297  {
298  if( m_Ident == wxT( "Color4DErcWEx" ) || m_Ident == wxT( "Color4DErcEEx" ) )
299  *m_Pt_param = COLOR4D( old ).WithAlpha( 0.8 );
300  else
301  *m_Pt_param = COLOR4D( old );
302  return;
303  }
304 
306 }
307 
308 
309 void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
310 {
311  if( !m_Pt_param || !aConfig )
312  return;
313 
314  aConfig->Write( m_Ident, m_Pt_param->ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
315 }
316 
317 
318 PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE( const wxString& ident, double* ptparam,
319  double default_val, double min, double max,
320  const wxChar* group ) :
321  PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
322 {
323  m_Pt_param = ptparam;
324  m_Default = default_val;
325  m_Min = min;
326  m_Max = max;
327 }
328 
329 
331  const wxString& ident,
332  double* ptparam,
333  double default_val,
334  double min,
335  double max,
336  const wxChar* group ) :
337  PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
338 {
339  m_Pt_param = ptparam;
340  m_Default = default_val;
341  m_Min = min;
342  m_Max = max;
343  m_Setup = Insetup;
344 }
345 
346 
347 void PARAM_CFG_DOUBLE::ReadParam( wxConfigBase* aConfig ) const
348 {
349  if( !m_Pt_param || !aConfig )
350  return;
351 
352  double dtmp = m_Default;
353  aConfig->Read( m_Ident, &dtmp );
354 
355  if( (dtmp < m_Min) || (dtmp > m_Max) )
356  dtmp = m_Default;
357 
358  *m_Pt_param = dtmp;
359 }
360 
361 
362 void PARAM_CFG_DOUBLE::SaveParam( wxConfigBase* aConfig ) const
363 {
364  if( !m_Pt_param || !aConfig )
365  return;
366 
367  // We cannot use aConfig->Write for a double, because
368  // this function uses a format with very few digits in mantissa,
369  // and truncature issues are frequent.
370  // We uses our function.
372 }
373 
374 
375 PARAM_CFG_BOOL::PARAM_CFG_BOOL( const wxString& ident, bool* ptparam,
376  int default_val, const wxChar* group ) :
377  PARAM_CFG_BASE( ident, PARAM_BOOL, group )
378 {
379  m_Pt_param = ptparam;
380  m_Default = default_val ? true : false;
381 }
382 
383 
385  const wxString& ident,
386  bool* ptparam,
387  int default_val,
388  const wxChar* group ) :
389  PARAM_CFG_BASE( ident, PARAM_BOOL, group )
390 {
391  m_Pt_param = ptparam;
392  m_Default = default_val ? true : false;
393  m_Setup = Insetup;
394 }
395 
396 
397 void PARAM_CFG_BOOL::ReadParam( wxConfigBase* aConfig ) const
398 {
399  if( !m_Pt_param || !aConfig )
400  return;
401 
402  int itmp = aConfig->Read( m_Ident, (int) m_Default );
403 
404  *m_Pt_param = itmp ? true : false;
405 }
406 
407 
408 void PARAM_CFG_BOOL::SaveParam( wxConfigBase* aConfig ) const
409 {
410  if( !m_Pt_param || !aConfig )
411  return;
412 
413  aConfig->Write( m_Ident, *m_Pt_param );
414 }
415 
416 
418  wxString* ptparam,
419  const wxChar* group ) :
420  PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
421 {
422  m_Pt_param = ptparam;
423 }
424 
425 
426 PARAM_CFG_WXSTRING::PARAM_CFG_WXSTRING( bool Insetup, const wxString& ident,
427  wxString* ptparam,
428  const wxString& default_val,
429  const wxChar* group ) :
430  PARAM_CFG_BASE( ident, PARAM_WXSTRING, group )
431 {
432  m_Pt_param = ptparam;
433  m_Setup = Insetup;
434  m_default = default_val;
435 }
436 
437 
438 void PARAM_CFG_WXSTRING::ReadParam( wxConfigBase* aConfig ) const
439 {
440  if( !m_Pt_param || !aConfig )
441  return;
442 
443  *m_Pt_param = aConfig->Read( m_Ident, m_default );
444 }
445 
446 
447 void PARAM_CFG_WXSTRING::SaveParam( wxConfigBase* aConfig ) const
448 {
449  if( !m_Pt_param || !aConfig )
450  return;
451 
452  aConfig->Write( m_Ident, *m_Pt_param );
453 }
454 
455 
457  wxString* ptparam,
458  const wxChar* group ) :
459  PARAM_CFG_BASE( ident, PARAM_FILENAME, group )
460 {
461  m_Pt_param = ptparam;
462 }
463 
464 
465 void PARAM_CFG_FILENAME::ReadParam( wxConfigBase* aConfig ) const
466 {
467  if( !m_Pt_param || !aConfig )
468  return;
469 
470  wxString prm = aConfig->Read( m_Ident );
471  // file names are stored using Unix notation
472  // under Window we must use \ instead of /
473  // mainly if there is a server name in path (something like \\server\kicad)
474 #ifdef __WINDOWS__
475  prm.Replace(wxT("/"), wxT("\\"));
476 #endif
477  *m_Pt_param = prm;
478 }
479 
480 
481 void PARAM_CFG_FILENAME::SaveParam( wxConfigBase* aConfig ) const
482 {
483  if( !m_Pt_param || !aConfig )
484  return;
485 
486  wxString prm = *m_Pt_param;
487  // filenames are stored using Unix notation
488  prm.Replace(wxT("\\"), wxT("/") );
489  aConfig->Write( m_Ident, prm );
490 }
491 
492 
494  wxArrayString* ptparam,
495  const wxChar* group ) :
496  PARAM_CFG_BASE( ident, PARAM_LIBNAME_LIST, group )
497 {
498  m_Pt_param = ptparam;
499 }
500 
501 
502 void PARAM_CFG_LIBNAME_LIST::ReadParam( wxConfigBase* aConfig ) const
503 {
504  if( !m_Pt_param || !aConfig )
505  return;
506 
507  int indexlib = 1; // We start indexlib to 1 because first
508  // lib name is LibName1
509  wxString libname, id_lib;
510  wxArrayString* libname_list = m_Pt_param;
511 
512  while( 1 )
513  {
514  id_lib = m_Ident;
515  id_lib << indexlib;
516  indexlib++;
517  libname = aConfig->Read( id_lib, wxT( "" ) );
518 
519  if( libname.IsEmpty() )
520  break;
521  // file names are stored using Unix notation
522  // under Window we must use \ instead of /
523  // mainly if there is a server name in path (something like \\server\kicad)
524 #ifdef __WINDOWS__
525  libname.Replace(wxT("/"), wxT("\\"));
526 #endif
527  libname_list->Add( libname );
528  }
529 }
530 
531 
532 void PARAM_CFG_LIBNAME_LIST::SaveParam( wxConfigBase* aConfig ) const
533 {
534  if( !m_Pt_param || !aConfig )
535  return;
536 
537  wxArrayString* libname_list = m_Pt_param;
538 
539  wxString configkey;
540  wxString libname;
541 
542  for( unsigned indexlib = 0; indexlib < libname_list->GetCount(); indexlib++ )
543  {
544  configkey = m_Ident;
545 
546  // We use indexlib+1 because first lib name is LibName1
547  configkey << (indexlib + 1);
548  libname = libname_list->Item( indexlib );
549 
550  // filenames are stored using Unix notation
551  libname.Replace(wxT("\\"), wxT("/") );
552  aConfig->Write( configkey, libname );
553  }
554 }
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
wxString m_Ident_legacy
A list of parameters type.
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.
This file is part of the common library TODO brief description.
static int KiROUND(double v)
Round a floating point number to an integer using "round halfway cases away from zero".
Definition: common.h:120
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
wxString 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.
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
int m_Default
The default value of the parameter.
The common library.
void wxConfigSaveParams(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList, const wxString &aGroup)
Function wxConfigSaveParams writes aList of PARAM_CFG_ARRAY elements to save configuration values to ...
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
PARAM_CFG_BOOL(const wxString &ident, bool *ptparam, int default_val=false, const wxChar *group=NULL)
double * m_Pt_param
Pointer to the parameter value.
int * m_Pt_param
Pointer to the parameter value.
void wxConfigLoadParams(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList, const wxString &aGroup)
Function wxConfigLoadParams uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
bool m_Setup
Install or Project based parameter, true == install.
double m_BIU_to_cfgunit
the factor to convert the saved value in internal 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.
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
Configuration parameter - Integer Class.
COLOR4D WithAlpha(double aAlpha) const
Function WithAlpha Returns a colour with the same colour, but the given alpha.
Definition: color4d.h:233
The common library.
Base window classes and related definitions.
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.
Class PARAM_CFG_BASE is a base class which establishes the interface functions ReadParam and SavePara...
Definition: config_params.h:99
paramcfg_id
Type of parameter in the configuration file.
Definition: config_params.h:71
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.
void wxConfigSaveSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigSaveSetups writes aList of PARAM_CFG_ARRAY elements to save configuration values to ...
virtual void ReadParam(wxConfigBase *aConfig) const override
Function ReadParam reads the value of the parameter stored in aConfig.
see class PGM_BASE
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
#define max(a, b)
Definition: auxiliary.h:86
virtual void SaveParam(wxConfigBase *aConfig) const override
Function SaveParam saves the value of the parameter stored in aConfig.
wxString * m_Pt_param
Pointer to the parameter value.
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.
wxString m_Group
Group name (this is like a path in the config data)
void wxConfigLoadSetups(wxConfigBase *aCfg, const PARAM_CFG_ARRAY &aList)
Function wxConfigLoadSetups uses aList of PARAM_CFG_ARRAY elements to load configuration values from ...
paramcfg_id m_Type
Type of parameter.
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)
wxString m_Ident
Keyword in config data.
#define min(a, b)
Definition: auxiliary.h:85
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39