2014-10-16 01:17:51 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2021-10-06 02:46:53 +00:00
|
|
|
* Copyright (C) 2004-2020 KiCad Developers, see AUTHORS.TXT for contributors.
|
2014-10-16 01:17:51 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
2016-01-16 01:56:57 +00:00
|
|
|
* as published by the Free Software Foundation; either version 3
|
2014-10-16 01:17:51 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
#ifndef PANEL_HOTKEYS_EDITOR_H
|
|
|
|
#define PANEL_HOTKEYS_EDITOR_H
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <hotkeys_basic.h>
|
2018-09-26 14:26:26 +00:00
|
|
|
#include <hotkey_store.h>
|
|
|
|
|
2020-07-15 23:08:16 +00:00
|
|
|
#include <widgets/resettable_panel.h>
|
2016-01-16 01:56:57 +00:00
|
|
|
#include <widgets/widget_hotkey_list.h>
|
2014-10-16 01:17:46 +00:00
|
|
|
|
2018-10-01 16:18:29 +00:00
|
|
|
#include "wx/panel.h"
|
2018-05-14 17:34:18 +00:00
|
|
|
|
2018-10-01 16:18:29 +00:00
|
|
|
|
|
|
|
class wxPanel;
|
|
|
|
class wxSizer;
|
2019-06-09 21:57:23 +00:00
|
|
|
class TOOL_MANAGER;
|
2018-10-01 16:18:29 +00:00
|
|
|
|
|
|
|
|
2020-07-15 23:08:16 +00:00
|
|
|
class PANEL_HOTKEYS_EDITOR : public RESETTABLE_PANEL
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
|
|
|
public:
|
2019-06-10 15:58:32 +00:00
|
|
|
PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow, bool aReadOnly );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2019-06-09 21:57:23 +00:00
|
|
|
void AddHotKeys( TOOL_MANAGER* aToolMgr );
|
2020-07-15 23:08:16 +00:00
|
|
|
|
2018-10-02 21:37:15 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
|
2020-07-15 23:08:16 +00:00
|
|
|
void ResetPanel() override;
|
|
|
|
|
|
|
|
wxString GetResetTooltip() override
|
|
|
|
{
|
|
|
|
return _( "Reset all hotkeys to the built-in KiCad defaults" );
|
|
|
|
}
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
private:
|
2014-10-16 01:17:51 +00:00
|
|
|
/**
|
2018-10-01 16:18:29 +00:00
|
|
|
* Install the button panel (global reset/default, import/export)
|
2020-12-19 23:29:10 +00:00
|
|
|
*
|
|
|
|
* @param aSizer the dialog to install on.
|
2016-03-29 16:35:24 +00:00
|
|
|
*/
|
2018-10-01 16:18:29 +00:00
|
|
|
void installButtons( wxSizer* aSizer );
|
2018-08-01 09:15:05 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 23:29:10 +00:00
|
|
|
* Handle a change in the hotkey filter text.
|
2018-08-01 09:15:05 +00:00
|
|
|
*
|
2020-12-19 23:29:10 +00:00
|
|
|
* @param aEvent is the search event, used to get the search query.
|
2018-08-01 09:15:05 +00:00
|
|
|
*/
|
2018-10-01 16:18:29 +00:00
|
|
|
void OnFilterSearch( wxCommandEvent& aEvent );
|
2019-06-10 15:58:32 +00:00
|
|
|
|
|
|
|
/**
|
2020-12-19 23:29:10 +00:00
|
|
|
* Put up a dialog allowing the user to select a hotkeys file and then overlays those
|
2019-06-10 15:58:32 +00:00
|
|
|
* hotkeys onto the current hotkey store.
|
|
|
|
*/
|
|
|
|
void ImportHotKeys();
|
|
|
|
|
2021-02-20 18:41:42 +00:00
|
|
|
/**
|
|
|
|
* Dumps all actions and their hotkeys to a text file for inclusion in documentation.
|
|
|
|
* The format is asciidoc-compatible table rows.
|
|
|
|
* This function is hidden behind an advanced config flag and not intended for users.
|
|
|
|
*/
|
|
|
|
void dumpHotkeys();
|
|
|
|
|
2020-12-19 23:29:10 +00:00
|
|
|
protected:
|
|
|
|
EDA_BASE_FRAME* m_frame;
|
|
|
|
bool m_readOnly;
|
|
|
|
|
|
|
|
std::vector<TOOL_MANAGER*> m_toolManagers;
|
|
|
|
HOTKEY_STORE m_hotkeyStore;
|
|
|
|
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
|
2010-08-28 18:02:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2018-05-14 17:34:18 +00:00
|
|
|
#endif // PANEL_HOTKEYS_EDITOR_H
|