KiCad PCB EDA Suite
pl_editor_config.cpp
Go to the documentation of this file.
1 
6 /*
7  * This program source code file is part of KiCad, a free EDA CAD application.
8  *
9  * Copyright (C) 2013 CERN
10  * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 #include <fctsys.h>
31 #include <common.h>
32 #include <class_drawpanel.h>
33 #include <gestfich.h>
34 #include <config_params.h>
35 
36 #include <pl_editor_frame.h>
37 #include <hotkeys.h>
38 #include <dialog_hotkeys_editor.h>
39 #include <pl_editor_id.h>
40 
41 #define GROUP wxT("/pl_editor")
42 
43 
44 void PL_EDITOR_FRAME::Process_Config( wxCommandEvent& event )
45 {
46  int id = event.GetId();
47 
48  switch( id )
49  {
51  if( GetDrawBgColor() == WHITE )
53  else
55 
56  GetMenuBar()->SetLabel( ID_MENU_SWITCH_BGCOLOR,
57  GetDrawBgColor() == WHITE ?
58  _( "&Background Black" ) :
59  _( "&Background White" ) );
60  m_canvas->Refresh();
61  break;
62 
63  case ID_MENU_GRID_ONOFF:
65  GetMenuBar()->SetLabel( ID_MENU_GRID_ONOFF,
66  IsGridVisible() ? _( "Hide &Grid" ) :
67  _( "Show &Grid" ) );
68  m_canvas->Refresh();
69  break;
70 
71  // Standard basic hotkey IDs
74  break;
75 
77  ExportHotkeyConfigToFile( PlEditorHokeysDescr, wxT( "pl_editor" ) );
78  break;
79 
81  ImportHotkeyConfigFromFile( PlEditorHokeysDescr, wxT( "pl_editor" ) );
82  break;
83 
86  break;
87 
88  default:
89  wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Config error" ) );
90  break;
91  }
92 }
93 
94 
96 {
97  if( !m_configSettings.empty() )
98  return m_configSettings;
99 
100  m_configSettings.push_back( new PARAM_CFG_INT( true, wxT( "Units" ),
101  (int*) &g_UserUnit, 0, 0, 1 ) );
102 
103  return m_configSettings;
104 }
A list of parameters type.
PARAM_CFG_ARRAY m_configSettings
This file is part of the common library TODO brief description.
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Definition: draw_panel.cpp:326
void ExportHotkeyConfigToFile(EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
Function ExportHotkeyConfigToFile Prompt the user for an old hotkey file to read, and read it...
virtual void SetDrawBgColor(COLOR4D aColor)
Definition: draw_frame.h:291
The common library.
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:416
PARAM_CFG_ARRAY & GetConfigurationSettings(void)
Populates the applicatios settings list.
void Process_Config(wxCommandEvent &event)
void DisplayHotkeyList(EDA_BASE_FRAME *aFrame, struct EDA_HOTKEY_CONFIG *aDescList)
Function DisplayHotkeyList Displays the current hotkey list.
virtual COLOR4D GetDrawBgColor() const
Definition: draw_frame.h:286
Configuration parameter - Integer Class.
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void InstallHotkeyFrame(EDA_BASE_FRAME *aParent, EDA_HOTKEY_CONFIG *aHotkeys)
Function InstallHotkeyFrame Create a hotkey editor dialog window with the provided hotkey configurati...
EDA_DRAW_PANEL * m_canvas
The area to draw on.
Definition: draw_frame.h:92
struct EDA_HOTKEY_CONFIG PlEditorHokeysDescr[]
The common library.
Definition: colors.h:49
virtual void SetGridVisibility(bool aVisible)
Function SetGridVisibility() , virtual It may be overloaded by derived classes.
Definition: draw_frame.h:426
Definition: colors.h:45
void ImportHotkeyConfigFromFile(EDA_HOTKEY_CONFIG *aDescList, const wxString &aDefaultShortname)
Function ImportHotkeyConfigFromFile Prompt the user for an old hotkey file to read, and read it.