mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
Refactor hotkey editor to use tab control instead of one giant list. Each tab is a separate hotkey section. Modify EDA_HOTKEY_CONFIG to change the m_Comment member to m_Title for a new purpose. We want a pretty title in the hotkey editor. We use m_Title for the key export comment which still conveys the purpose just as easily. Refactored usage of wxGrid into wxListCtrl which allows capturing navigation characters and also works better (single selection is built in). Add hotkey overwrite prompts that are paired with "Common" section. It will check if a hotkey overlaps with the proper sections. i.e. Common with the all other sections; or Section 1 with just Common. Right-click menu removed due to wxListCtrl being able to catch the special keys properly.
99 lines
2.6 KiB
C++
99 lines
2.6 KiB
C++
|
|
#ifndef __dialog_hotkeys_editor__
|
|
#define __dialog_hotkeys_editor__
|
|
|
|
#include <wx/intl.h>
|
|
|
|
#include <wx/string.h>
|
|
#include <wx/choice.h>
|
|
#include <wx/gdicmn.h>
|
|
#include <wx/font.h>
|
|
#include <wx/settings.h>
|
|
#include <wx/textctrl.h>
|
|
#include <wx/stattext.h>
|
|
#include <wx/button.h>
|
|
#include <wx/listctrl.h>
|
|
#include <wx/dialog.h>
|
|
#include <wx/grid.h>
|
|
|
|
#include <hotkeys_basic.h>
|
|
#include <draw_frame.h>
|
|
#include <../common/dialogs/dialog_hotkeys_editor_base.h>
|
|
|
|
class HOTKEYS_EDITOR_DIALOG;
|
|
|
|
class HOTKEY_LIST_CTRL : public wxListCtrl
|
|
{
|
|
public:
|
|
HOTKEY_LIST_CTRL( wxWindow* aParent, struct EDA_HOTKEY_CONFIG* aSection );
|
|
~HOTKEY_LIST_CTRL() {};
|
|
|
|
void DeselectRow( int aRow );
|
|
std::vector< EDA_HOTKEY* >& GetHotkeys() { return m_hotkeys; }
|
|
void RestoreFrom( struct EDA_HOTKEY_CONFIG* aSection );
|
|
|
|
private:
|
|
int m_curEditingRow;
|
|
wxString* m_sectionTag;
|
|
std::vector< EDA_HOTKEY* > m_hotkeys;
|
|
|
|
protected:
|
|
wxString OnGetItemText( long aRow, long aColumn ) const;
|
|
void OnChar( wxKeyEvent& aEvent );
|
|
void OnListItemSelected( wxListEvent& aEvent );
|
|
void OnSize( wxSizeEvent& aEvent );
|
|
};
|
|
|
|
class HOTKEY_SECTION_PAGE : public wxPanel
|
|
{
|
|
public:
|
|
private:
|
|
EDA_HOTKEY_CONFIG* m_hotkeySection;
|
|
HOTKEY_LIST_CTRL *m_hotkeyList;
|
|
HOTKEYS_EDITOR_DIALOG* m_dialog;
|
|
|
|
public:
|
|
/** Constructor to create a setup page for one netlist format.
|
|
* Used in Netlist format Dialog box creation
|
|
* @param parent = wxNotebook * parent
|
|
* @param title = title (name) of the notebook page
|
|
* @param id_NetType = netlist type id
|
|
*/
|
|
HOTKEY_SECTION_PAGE( HOTKEYS_EDITOR_DIALOG* aDialog, wxNotebook* aParent,
|
|
const wxString& aTitle,
|
|
EDA_HOTKEY_CONFIG* aSection );
|
|
~HOTKEY_SECTION_PAGE() {};
|
|
void Restore();
|
|
|
|
std::vector< EDA_HOTKEY* >& GetHotkeys() { return m_hotkeyList->GetHotkeys(); }
|
|
EDA_HOTKEY_CONFIG* GetHotkeySection() { return m_hotkeySection; }
|
|
|
|
HOTKEYS_EDITOR_DIALOG* GetDialog() { return m_dialog; }
|
|
};
|
|
|
|
|
|
class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE
|
|
{
|
|
protected:
|
|
EDA_DRAW_FRAME* m_parent;
|
|
struct EDA_HOTKEY_CONFIG* m_hotkeys;
|
|
|
|
std::vector<HOTKEY_SECTION_PAGE*> m_hotkeySectionPages;
|
|
|
|
public:
|
|
HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys );
|
|
|
|
~HOTKEYS_EDITOR_DIALOG() {};
|
|
|
|
bool CanSetKey( long aKey, const wxString* aSectionTag );
|
|
|
|
private:
|
|
void OnOKClicked( wxCommandEvent& aEvent );
|
|
void CancelClicked( wxCommandEvent& aEvent );
|
|
void UndoClicked( wxCommandEvent& aEvent );
|
|
};
|
|
|
|
void InstallHotkeyFrame( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys );
|
|
|
|
#endif
|