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.

101 lines
2.9 KiB

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