2007-08-30 08:15:05 +00:00
|
|
|
/*******************/
|
|
|
|
/* hotkeys_basic.h */
|
|
|
|
/*******************/
|
2007-08-20 11:33:45 +00:00
|
|
|
|
|
|
|
/* Some functions to handle hotkeys in kicad
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2007-08-20 11:33:45 +00:00
|
|
|
|
|
|
|
#ifndef HOTKEYS_BASIC_H
|
|
|
|
#define HOTKEYS_BASIC_H
|
|
|
|
|
2007-09-06 11:52:26 +00:00
|
|
|
#ifndef COMMON_GLOBL
|
|
|
|
#define COMMON_GLOBL extern
|
|
|
|
#endif
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( ".key" )
|
2007-08-21 19:37:31 +00:00
|
|
|
|
|
|
|
/* define default path for config key file */
|
2007-09-22 14:31:20 +00:00
|
|
|
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_HOME wxGetHomeDir() + wxT( "/" )
|
2007-10-26 06:08:19 +00:00
|
|
|
#define DEFAULT_HOTKEY_FILENAME_PATH_IS_KICAD g_EDA_Appl->m_BinDir + wxT( "../template/" )
|
2007-09-19 15:29:50 +00:00
|
|
|
|
|
|
|
/* keyword idetifier in kicad config use ti store/retrieve path option */
|
2007-09-22 14:31:20 +00:00
|
|
|
#define HOTKEY_CFG_PATH_OPT wxT( "HotkeyPathOption" )
|
2007-08-21 19:37:31 +00:00
|
|
|
|
|
|
|
|
2007-08-20 11:33:45 +00:00
|
|
|
/* Class to handle hotkey commnands. hotkeys have a default value
|
2007-09-19 15:29:50 +00:00
|
|
|
* This class allows the real key code changed by user(from a key code list file)
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2007-08-20 11:33:45 +00:00
|
|
|
class Ki_HotkeyInfo
|
|
|
|
{
|
|
|
|
public:
|
2007-08-30 08:15:05 +00:00
|
|
|
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
|
|
|
|
wxString m_InfoMsg; // info message.
|
|
|
|
int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list)
|
2007-09-22 14:31:20 +00:00
|
|
|
int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h)
|
2007-08-20 11:33:45 +00:00
|
|
|
|
|
|
|
public:
|
2007-09-22 14:31:20 +00:00
|
|
|
Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 );
|
2007-08-20 11:33:45 +00:00
|
|
|
};
|
|
|
|
|
2007-09-19 15:29:50 +00:00
|
|
|
/* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list)
|
|
|
|
* hotkeys are grouped by section.
|
|
|
|
* a section is a list of hotkey infos ( a Ki_HotkeyInfo list).
|
|
|
|
* A full list of hoteys can used one or many sections
|
|
|
|
* for instance:
|
|
|
|
* the schematic editor uses a common section (zoom hotkeys list ..) and a specific section
|
|
|
|
* the library editor uses the same common section and a specific section
|
|
|
|
* this feature avoid duplications and made hotkey file config easier to understand ane edit
|
|
|
|
*/
|
2007-09-06 11:52:26 +00:00
|
|
|
struct Ki_HotkeyInfoSectionDescriptor
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxString* m_SectionTag; // The section name
|
2007-09-19 15:29:50 +00:00
|
|
|
Ki_HotkeyInfo** m_HK_InfoList; // List of Ki_HotkeyInfo pointers
|
2007-11-05 07:07:00 +00:00
|
|
|
const char* m_Comment; // comment: will be printed in the config file
|
2007-09-19 15:29:50 +00:00
|
|
|
// Info usage only
|
2007-09-06 11:52:26 +00:00
|
|
|
};
|
|
|
|
|
2007-09-19 15:29:50 +00:00
|
|
|
/* Identifiers (tags) in key code configuration file (or section names)
|
2007-09-06 11:52:26 +00:00
|
|
|
* .m_SectionTag member of a Ki_HotkeyInfoSectionDescriptor
|
|
|
|
*/
|
|
|
|
COMMON_GLOBL wxString g_CommonSectionTag
|
|
|
|
#ifdef EDA_BASE
|
|
|
|
( wxT( "[common]" ) )
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
COMMON_GLOBL wxString g_SchematicSectionTag
|
|
|
|
#ifdef EDA_BASE
|
|
|
|
( wxT( "[eeschema]" ) )
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
COMMON_GLOBL wxString g_LibEditSectionTag
|
|
|
|
#ifdef EDA_BASE
|
|
|
|
( wxT( "[libedit]" ) )
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
COMMON_GLOBL wxString g_BoardEditorSectionTag
|
|
|
|
#ifdef EDA_BASE
|
|
|
|
( wxT( "[pcbnew]" ) )
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
COMMON_GLOBL wxString g_ModuleEditSectionTag
|
|
|
|
#ifdef EDA_BASE
|
|
|
|
( wxT( "[footprinteditor]" ) )
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
|
2007-09-19 15:29:50 +00:00
|
|
|
COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directory (usefull under unix)
|
2007-09-22 14:31:20 +00:00
|
|
|
* 1 = kicad/template ( usefull only under windows )
|
|
|
|
* 2 ... = unused
|
2007-09-19 15:29:50 +00:00
|
|
|
*/
|
|
|
|
|
2007-08-20 11:33:45 +00:00
|
|
|
/* Functions:
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2007-09-22 14:31:20 +00:00
|
|
|
wxString ReturnHotkeyConfigFilePath( int choice );
|
|
|
|
void AddHotkeyConfigMenu( wxMenu* menu );
|
|
|
|
void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id );
|
|
|
|
wxString ReturnKeyNameFromKeyCode( int keycode );
|
|
|
|
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
|
|
|
|
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
|
|
|
|
wxString AddHotkeyName( const wxString& text,
|
|
|
|
struct Ki_HotkeyInfoSectionDescriptor* DescrList,
|
|
|
|
int CommandId );
|
|
|
|
void DisplayHotkeyList( WinEDA_DrawFrame* frame,
|
|
|
|
struct Ki_HotkeyInfoSectionDescriptor* List );
|
|
|
|
Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List );
|
2007-08-20 11:33:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif // HOTKEYS_BASIC_H
|