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.

96 lines
2.8 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 2004-2020 KiCad Developers, see CHANGELOG.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 3
  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. #ifndef PANEL_HOTKEYS_EDITOR_H
  24. #define PANEL_HOTKEYS_EDITOR_H
  25. #include <hotkeys_basic.h>
  26. #include <hotkey_store.h>
  27. #include <widgets/resettable_panel.h>
  28. #include <widgets/widget_hotkey_list.h>
  29. #include "wx/panel.h"
  30. class wxPanel;
  31. class wxSizer;
  32. class TOOL_MANAGER;
  33. class PANEL_HOTKEYS_EDITOR : public RESETTABLE_PANEL
  34. {
  35. public:
  36. PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow, bool aReadOnly );
  37. void AddHotKeys( TOOL_MANAGER* aToolMgr );
  38. bool TransferDataToWindow() override;
  39. bool TransferDataFromWindow() override;
  40. void ResetPanel() override;
  41. wxString GetResetTooltip() override
  42. {
  43. return _( "Reset all hotkeys to the built-in KiCad defaults" );
  44. }
  45. private:
  46. /**
  47. * Install the button panel (global reset/default, import/export)
  48. *
  49. * @param aSizer the dialog to install on.
  50. */
  51. void installButtons( wxSizer* aSizer );
  52. /**
  53. * Handle a change in the hotkey filter text.
  54. *
  55. * @param aEvent is the search event, used to get the search query.
  56. */
  57. void OnFilterSearch( wxCommandEvent& aEvent );
  58. /**
  59. * Put up a dialog allowing the user to select a hotkeys file and then overlays those
  60. * hotkeys onto the current hotkey store.
  61. */
  62. void ImportHotKeys();
  63. /**
  64. * Dumps all actions and their hotkeys to a text file for inclusion in documentation.
  65. * The format is asciidoc-compatible table rows.
  66. * This function is hidden behind an advanced config flag and not intended for users.
  67. */
  68. void dumpHotkeys();
  69. protected:
  70. EDA_BASE_FRAME* m_frame;
  71. bool m_readOnly;
  72. std::vector<TOOL_MANAGER*> m_toolManagers;
  73. HOTKEY_STORE m_hotkeyStore;
  74. WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
  75. };
  76. #endif // PANEL_HOTKEYS_EDITOR_H