code cleanup and enhancements about hotkeys

This commit is contained in:
charras 2010-02-16 11:02:20 +00:00
parent 1ee86d4a52
commit 8dd82dfbd4
2 changed files with 31 additions and 16 deletions

View File

@ -353,22 +353,22 @@ static int ReturnKeyCodeFromKeyName( const wxString& keyname )
/** function DisplayHotkeyList /** function DisplayHotkeyList
* Displays the current hotkey list * Displays the current hotkey list
* @param frame = current active frame * @param aFrame = current active frame
* @param List = pointer to a Ki_HotkeyInfoSectionDescriptor list * @param aList = pointer to a Ki_HotkeyInfoSectionDescriptor list
*(Null terminated) *(Null terminated)
* @return none * @return none
*/ */
void DisplayHotkeyList( WinEDA_DrawFrame* frame, void DisplayHotkeyList( WinEDA_DrawFrame* aFrame,
struct Ki_HotkeyInfoSectionDescriptor* DescList ) struct Ki_HotkeyInfoSectionDescriptor* aDescList )
{ {
wxString keyname; wxString keyname;
Ki_HotkeyInfo** List; Ki_HotkeyInfo** List;
wxString msg = _( "Current hotkey list:\n\n" ); wxString msg = _( "Current hotkey list:\n\n" );
for( ; DescList->m_HK_InfoList != NULL; DescList++ ) for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
{ {
List = DescList->m_HK_InfoList; List = aDescList->m_HK_InfoList;
for( ; *List != NULL; List++ ) for( ; *List != NULL; List++ )
{ {
Ki_HotkeyInfo* hk_decr = *List; Ki_HotkeyInfo* hk_decr = *List;
@ -378,22 +378,22 @@ void DisplayHotkeyList( WinEDA_DrawFrame* frame,
} }
} }
DisplayInfoMessage( frame, msg ); DisplayInfoMessage( aFrame, msg );
} }
/** function GetDescriptorFromHotkey /** function GetDescriptorFromHotkey
* Return a Ki_HotkeyInfo * pointer fron a key code for OnHotKey() function * Return a Ki_HotkeyInfo * pointer fron a key code for OnHotKey() function
* @param key = key code (ascii value, or wxWidgets value for function keys * @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param List = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a Ki_HotkeyInfo list of commands
* @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List * @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List
*/ */
Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List ) Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList )
{ {
for( ; *List != NULL; List++ ) for( ; *aList != NULL; aList++ )
{ {
Ki_HotkeyInfo* hk_decr = *List; Ki_HotkeyInfo* hk_decr = *aList;
if( hk_decr->m_KeyCode == key ) if( hk_decr->m_KeyCode == aKey )
return hk_decr; return hk_decr;
} }

View File

@ -109,12 +109,27 @@ wxString AddHotkeyName( const wxString& aText,
int aCommandId, int aCommandId,
bool aIsShortCut = true); bool aIsShortCut = true);
void DisplayHotkeyList( WinEDA_DrawFrame* frame, /** function DisplayHotkeyList
struct Ki_HotkeyInfoSectionDescriptor* List ); * Displays the current hotkey list
Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List ); * @param aFrame = current active frame
* @param aList = pointer to a Ki_HotkeyInfoSectionDescriptor list
*(Null terminated)
* @return none
*/
void DisplayHotkeyList( WinEDA_DrawFrame* aFrame,
struct Ki_HotkeyInfoSectionDescriptor* aList );
/** function GetDescriptorFromHotkey
* Return a Ki_HotkeyInfo * pointer fron a key code for OnHotKey() function
* @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param aList = pointer to a Ki_HotkeyInfo list of commands
* @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List
*/
Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList );
// common hotkeys event id // common hotkeys event id
// these hotkey ID are used in many files, so they are define here only once.
enum common_hotkey_id_commnand { enum common_hotkey_id_commnand {
HK_NOT_FOUND = 0, HK_NOT_FOUND = 0,
HK_RESET_LOCAL_COORD, HK_RESET_LOCAL_COORD,