KiCad PCB EDA Suite
gerbview_config.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) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
5  * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
6  * Copyright (C) 1992-2011 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 <id.h>
28 #include <common.h>
29 #include <config_params.h>
30 #include <gerbview_frame.h>
31 #include <widgets/paged_dialog.h>
34 #include <panel_hotkeys_editor.h>
35 
36 
38  PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
39 {
40  wxTreebook* book = aParent->GetTreebook();
41 
42  book->AddPage( new wxPanel( book ), _( "Gerbview" ) );
43  book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
44  book->AddSubPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Editing Options" ) );
45 
46  aHotkeysPanel->AddHotKeys( GetToolManager() );
47 }
48 
49 
51 {
52  if( !m_configSettings.empty() )
53  return m_configSettings;
54 
55  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
56  &m_displayMode, 2, 0, 2 ) );
57  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
58  true, wxT( "DCodeColorEx" ),
60  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
61  true, wxT( "NegativeObjectsColorEx" ),
63  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
64  true, wxT( "GridColorEx" ),
66  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
67  true, wxT( "WorksheetColorEx" ),
69  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
70  true, wxT( "BackgroundColorEx" ),
72  m_configSettings.push_back( new PARAM_CFG_BOOL(
73  true, wxT( "DisplayPolarCoordinates" ),
74  &m_PolarCoords, false ) );
75 
76  // Default colors for layers 0 to 31
77  static const COLOR4D color_default[] = {
86  };
87 
88  // List of keywords used as identifiers in config.
89  // They *must* be static const and not temporarily created,
90  // because the parameter list that use these keywords does not store them,
91  // just points to them.
92  static const wxChar* keys[] = {
93  wxT("ColorLayer0Ex"), wxT("ColorLayer1Ex"), wxT("ColorLayer2Ex"), wxT("ColorLayer3Ex"),
94  wxT("ColorLayer4Ex"), wxT("ColorLayer5Ex"), wxT("ColorLayer6Ex"), wxT("ColorLayer7Ex"),
95  wxT("ColorLayer8Ex"), wxT("ColorLayer9Ex"), wxT("ColorLayer10Ex"), wxT("ColorLayer11Ex"),
96  wxT("ColorLayer12Ex"), wxT("ColorLayer13Ex"), wxT("ColorLayer14Ex"), wxT("ColorLayer15Ex"),
97  wxT("ColorLayer16Ex"), wxT("ColorLayer17Ex"), wxT("ColorLayer18Ex"), wxT("ColorLayer19Ex"),
98  wxT("ColorLayer20Ex"), wxT("ColorLayer21Ex"), wxT("ColorLayer22Ex"), wxT("ColorLayer23Ex"),
99  wxT("ColorLayer24Ex"), wxT("ColorLayer25Ex"), wxT("ColorLayer26Ex"), wxT("ColorLayer27Ex"),
100  wxT("ColorLayer28Ex"), wxT("ColorLayer29Ex"), wxT("ColorLayer30Ex"), wxT("ColorLayer31Ex"),
101  };
102 
103  wxASSERT( arrayDim(keys) == arrayDim(color_default) );
104  wxASSERT( arrayDim(keys) <= arrayDim(g_ColorsSettings.m_LayersColors) && arrayDim(keys) <= arrayDim(color_default) );
105 
106  for( unsigned i = 0; i < arrayDim(keys); ++i )
107  {
109 
110  PARAM_CFG_SETCOLOR* prm_entry =
111  new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
112 
113  m_configSettings.push_back( prm_entry );
114  }
115 
116  return m_configSettings;
117 }
Definition: colors.h:57
A list of parameters type.
TOOL_MANAGER * GetToolManager() const
Return the MVC controller.
Definition: colors.h:61
The common library.
void AddHotKeys(TOOL_MANAGER *aToolMgr)
Definition: colors.h:54
wxTreebook * GetTreebook()
Definition: paged_dialog.h:43
COLOR4D m_LayersColors[LAYER_ID_COUNT]
Layer colors (tracks and graphic items)
PARAM_CFG_ARRAY m_configSettings
Configuration parameter - SetColor Class.
void InstallPreferences(PAGED_DIALOG *aParent, PANEL_HOTKEYS_EDITOR *aHotkeysPanel) override
Allows Gerbview to install its preferences panels into the preferences dialog.
Configuration parameter - Integer Class.
Definition: colors.h:59
Configuration parameter - Boolean Class.
Definition: colors.h:60
#define _(s)
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
Definition: colors.h:58
PARAM_CFG_ARRAY & GetConfigurationSettings(void)
Function GetConfigurationSettings Populates the GerbView applications settings list.
COLORS_DESIGN_SETTINGS g_ColorsSettings(FRAME_CVPCB_DISPLAY)
size_t i
Definition: json11.cpp:597
The common library.
Definition: colors.h:49
#define GERBER_DRAW_LAYER(x)
Definition: colors.h:45
Definition: colors.h:68
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
Definition: colors.h:62