KiCad PCB EDA Suite
dialog_hotkeys_editor.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) 1992-2018 Kicad Developers, see AUTHORS.txt for contributors.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, you may find one here:
18  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19  * or you may search the http://www.gnu.org website for the version 2 license,
20  * or you may write to the Free Software Foundation, Inc.,
21  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22  */
23 
24 #include <dialog_hotkeys_editor.h>
25 
27  EDA_HOTKEY_CONFIG* aShowHotkeys )
28 {
29  if( !aShowHotkeys )
30  aShowHotkeys = aHotkeys;
31 
32  HOTKEYS_EDITOR_DIALOG dialog( aParent, aHotkeys, aShowHotkeys );
33 
34  int diag = dialog.ShowModal();
35 
36  if( diag == wxID_OK )
37  {
38  aParent->ReCreateMenuBar();
39  aParent->Refresh();
40  }
41 }
42 
43 
45  EDA_HOTKEY_CONFIG* aHotkeys, EDA_HOTKEY_CONFIG* aShowHotkeys ) :
46  HOTKEYS_EDITOR_DIALOG_BASE( aParent ),
47  m_hotkeys( aHotkeys ),
48  m_showhotkeys( aShowHotkeys )
49 {
51  WIDGET_HOTKEY_LIST::GenSections( aShowHotkeys ) );
53 
54  m_sdbSizerOK->SetDefault();
55 
56  Layout();
57  SetSizeInDU( 350, 300 );
58  Center();
59 }
60 
61 
63 {
64  if( !wxDialog::TransferDataToWindow() )
65  return false;
66 
68  return false;
69 
70  return true;
71 }
72 
73 
75 {
76  if( !wxDialog::TransferDataToWindow() )
77  return false;
78 
80  return false;
81 
82  // save the hotkeys
84 
85  return true;
86 }
87 
88 
89 void HOTKEYS_EDITOR_DIALOG::ResetClicked( wxCommandEvent& aEvent )
90 {
92 }
93 
94 void HOTKEYS_EDITOR_DIALOG::DefaultsClicked( wxCommandEvent& aEvent )
95 {
97 }
Structure EDA_HOTKEY_CONFIG contains the information required to save hot key information to a config...
Definition: hotkeys_basic.h:89
HOTKEYS_EDITOR_DIALOG(EDA_BASE_FRAME *aParent, EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys)
bool TransferDataToControl()
Method TransferDataToControl Load the hotkey data into the control.
void DefaultsClicked(wxCommandEvent &aEvent) override
Function DefaultsClicked Set the hotkeys to the default values (values after installation) ...
WIDGET_HOTKEY_LIST * m_hotkeyListCtrl
static HOTKEY_SECTIONS GenSections(EDA_HOTKEY_CONFIG *aHotkeys)
Static method GenSections Generate a list of sections and names from an EDA_HOTKEY_CONFIG*.
void InstallOnPanel(wxPanel *aPanel)
Method InstallOnPanel Install this WIDGET_HOTKEY_LIST onto an empty panel.
Class HOTKEYS_EDITOR_DIALOG_BASE.
Class HOTKEYS_EDITOR_DIALOG is the child class of HOTKEYS_EDITOR_DIALOG_BASE.
void SetSizeInDU(int x, int y)
Set the dialog to the given dimensions in "dialog units".
void ResetClicked(wxCommandEvent &aEvent) override
Function ResetClicked Reinit the hotkeys to the initial state (removes all pending changes) ...
struct EDA_HOTKEY_CONFIG * m_hotkeys
virtual int WriteHotkeyConfig(struct EDA_HOTKEY_CONFIG *aDescList, wxString *aFullFileName=NULL)
Function WriteHotkeyConfig Store the current hotkey list It is stored using the standard wxConfig mec...
Class EDA_BASE_FRAME is the base frame for deriving all KiCad main window classes.
void InstallHotkeyFrame(EDA_BASE_FRAME *aParent, EDA_HOTKEY_CONFIG *aHotkeys, EDA_HOTKEY_CONFIG *aShowHotkeys)
Function InstallHotkeyFrame Create a hotkey editor dialog window with the provided hotkey configurati...
virtual EDA_BASE_FRAME * GetParent()
bool TransferDataFromWindow() override
bool TransferDataToWindow() override
bool TransferDefaultsToControl()
Method TransferDefaultsToControl Set hotkeys in the control to default values.
virtual void ReCreateMenuBar()
Function ReCreateMenuBar Creates recreates the menu bar.
bool TransferDataFromControl()
Method TransferDataFromControl Save the hotkey data from the control.