You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.7 KiB

4 years ago
4 years ago
  1. /*
  2. * This program source code file is part of KICAD, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2018-2021 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. #include <dialogs/dialog_hotkey_list.h>
  24. #include <kiface_base.h>
  25. #include <panel_hotkeys_editor.h>
  26. #include <widgets/ui_common.h>
  27. #include <wx/sizer.h>
  28. #include <wx/button.h>
  29. DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent ):
  30. DIALOG_SHIM( aParent, wxID_ANY, _( "Hotkey List" ) )
  31. {
  32. const int margin = KIUI::GetStdMargin();
  33. wxBoxSizer* main_sizer = new wxBoxSizer( wxVERTICAL );
  34. KIFACE* kiface = nullptr;
  35. m_hk_list = new PANEL_HOTKEYS_EDITOR( aParent, this, true );
  36. Kiway().GetActions( m_hk_list->ActionsList() );
  37. kiface = Kiway().KiFACE( KIWAY::FACE_SCH );
  38. kiface->GetActions( m_hk_list->ActionsList() );
  39. kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
  40. kiface->GetActions( m_hk_list->ActionsList() );
  41. kiface = Kiway().KiFACE( KIWAY::FACE_GERBVIEW );
  42. kiface->GetActions( m_hk_list->ActionsList() );
  43. kiface = Kiway().KiFACE( KIWAY::FACE_PL_EDITOR );
  44. kiface->GetActions( m_hk_list->ActionsList() );
  45. // Update all of the action hotkeys. The process of loading the actions through
  46. // the KiFACE will only get us the default hotkeys
  47. ReadHotKeyConfigIntoActions( wxEmptyString, m_hk_list->ActionsList() );
  48. main_sizer->Add( m_hk_list, 1, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, margin );
  49. wxStdDialogButtonSizer* sdb_sizer = new wxStdDialogButtonSizer;
  50. sdb_sizer->AddButton( new wxButton( this, wxID_OK ) );
  51. sdb_sizer->Realize();
  52. main_sizer->Add( sdb_sizer, 0, wxEXPAND | wxALL, margin );
  53. SetSizer( main_sizer );
  54. main_sizer->SetMinSize( 600, 400 );
  55. finishDialogSettings();
  56. }
  57. bool DIALOG_LIST_HOTKEYS::TransferDataToWindow()
  58. {
  59. return m_hk_list->TransferDataToWindow();
  60. }