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 
31 #include <fctsys.h>
32 #include <id.h>
33 #include <common.h>
34 #include <class_drawpanel.h>
35 #include <config_params.h>
36 #include <gerbview_frame.h>
37 #include <hotkeys.h>
38 #include <widgets/paged_dialog.h>
41 
42 void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
43 {
44  int id = event.GetId();
45 
46  switch( id )
47  {
48  case wxID_PREFERENCES:
50  break;
51 
53  // Display current hotkey list for GerbView.
55  break;
56 
57  default:
58  wxMessageBox( wxT( "GERBVIEW_FRAME::Process_Config error" ) );
59  break;
60  }
61 }
62 
63 
65 {
66  wxTreebook* book = aParent->GetTreebook();
67 
68  book->AddPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Gerbview" ) );
69  book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
70 }
71 
72 
74 {
75  if( !m_configSettings.empty() )
76  return m_configSettings;
77 
78  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "DrawModeOption" ),
79  &m_displayMode, 2, 0, 2 ) );
80  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
81  true, wxT( "DCodeColorEx" ),
83  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
84  true, wxT( "NegativeObjectsColorEx" ),
86  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
87  true, wxT( "GridColorEx" ),
89  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
90  true, wxT( "WorksheetColorEx" ),
92  m_configSettings.push_back( new PARAM_CFG_SETCOLOR(
93  true, wxT( "BackgroundColorEx" ),
95  m_configSettings.push_back( new PARAM_CFG_BOOL(
96  true, wxT( "DisplayPolarCoordinates" ),
98 
99  // Default colors for layers 0 to 31
100  static const COLOR4D color_default[] = {
109  };
110 
111  // List of keywords used as identifiers in config.
112  // They *must* be static const and not temporarily created,
113  // because the parameter list that use these keywords does not store them,
114  // just points to them.
115  static const wxChar* keys[] = {
116  wxT("ColorLayer0Ex"), wxT("ColorLayer1Ex"), wxT("ColorLayer2Ex"), wxT("ColorLayer3Ex"),
117  wxT("ColorLayer4Ex"), wxT("ColorLayer5Ex"), wxT("ColorLayer6Ex"), wxT("ColorLayer7Ex"),
118  wxT("ColorLayer8Ex"), wxT("ColorLayer9Ex"), wxT("ColorLayer10Ex"), wxT("ColorLayer11Ex"),
119  wxT("ColorLayer12Ex"), wxT("ColorLayer13Ex"), wxT("ColorLayer14Ex"), wxT("ColorLayer15Ex"),
120  wxT("ColorLayer16Ex"), wxT("ColorLayer17Ex"), wxT("ColorLayer18Ex"), wxT("ColorLayer19Ex"),
121  wxT("ColorLayer20Ex"), wxT("ColorLayer21Ex"), wxT("ColorLayer22Ex"), wxT("ColorLayer23Ex"),
122  wxT("ColorLayer24Ex"), wxT("ColorLayer25Ex"), wxT("ColorLayer26Ex"), wxT("ColorLayer27Ex"),
123  wxT("ColorLayer28Ex"), wxT("ColorLayer29Ex"), wxT("ColorLayer30Ex"), wxT("ColorLayer31Ex"),
124  };
125 
126  wxASSERT( DIM(keys) == DIM(color_default) );
127  wxASSERT( DIM(keys) <= DIM(g_ColorsSettings.m_LayersColors) && DIM(keys) <= DIM(color_default) );
128 
129  for( unsigned i = 0; i < DIM(keys); ++i )
130  {
132 
133  PARAM_CFG_SETCOLOR* prm_entry =
134  new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
135 
136  m_configSettings.push_back( prm_entry );
137  }
138 
139  return m_configSettings;
140 }
Definition: colors.h:57
#define DIM(x)
of elements in an array
Definition: macros.h:98
A list of parameters type.
Definition: colors.h:61
The common library.
void Process_Config(wxCommandEvent &event)
Definition: colors.h:54
wxTreebook * GetTreebook()
Definition: paged_dialog.h:43
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
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) override
Allows Gerbview to install its preferences panels into the preferences dialog.
GBR_DISPLAY_OPTIONS m_DisplayOptions
Configuration parameter - Integer Class.
Definition: colors.h:59
Configuration parameter - Boolean Class.
Definition: colors.h:60
bool m_DisplayPolarCood
Option to display coordinates in status bar in X,Y or Polar coords.
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
struct EDA_HOTKEY_CONFIG GerbviewHokeysDescr[]
The common library.
Definition: colors.h:49
bool ShowPreferences(EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys, const wxString &aHotkeysNickname)
#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