enhancements about hot keys
This commit is contained in:
parent
5861a43dd4
commit
c4bc7bb46b
|
@ -1344,6 +1344,13 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event )
|
||||||
if( event.ShiftDown() && (key > 256) )
|
if( event.ShiftDown() && (key > 256) )
|
||||||
localkey |= GR_KB_SHIFT;
|
localkey |= GR_KB_SHIFT;
|
||||||
|
|
||||||
|
/* Normalize keys code to easily handle keys from Ctrl+A to Ctrl+Z
|
||||||
|
* They have an ascii code from 1 to 27 remapped
|
||||||
|
* GR_KB_CTRL + 'A' to GR_KB_CTRL + 'Z'
|
||||||
|
*/
|
||||||
|
if( (localkey & (GR_KB_CTRL|GR_KB_ALT|GR_KB_SHIFT)) == GR_KB_CTRL )
|
||||||
|
localkey += 'A' - 1;
|
||||||
|
|
||||||
INSTALL_DC( DC, this );
|
INSTALL_DC( DC, this );
|
||||||
|
|
||||||
BASE_SCREEN* Screen = GetScreen();
|
BASE_SCREEN* Screen = GetScreen();
|
||||||
|
|
|
@ -43,13 +43,13 @@ int g_ConfigFileLocationChoice;
|
||||||
Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand,
|
Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand,
|
||||||
int keycode, int idmenuevent )
|
int keycode, int idmenuevent )
|
||||||
{
|
{
|
||||||
m_KeyCode = keycode; // Key code (ascii value for ascii keys
|
m_KeyCode = keycode; // Key code (ascii value for ascii keys
|
||||||
// or wxWidgets code for function key
|
// or wxWidgets code for function key
|
||||||
m_InfoMsg = infomsg; // info message.
|
m_InfoMsg = infomsg; // info message.
|
||||||
m_Idcommand = idcommand; // internal id for the corresponding
|
m_Idcommand = idcommand; // internal id for the corresponding
|
||||||
// command (see hotkey_id_commnand list)
|
// command (see hotkey_id_commnand list)
|
||||||
m_IdMenuEvent = idmenuevent; // id to call the corresponding event
|
m_IdMenuEvent = idmenuevent; // id to call the corresponding event
|
||||||
// (if any) (see id.h)
|
// (if any) (see id.h)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,107 +58,140 @@ Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand,
|
||||||
struct hotkey_name_descr
|
struct hotkey_name_descr
|
||||||
{
|
{
|
||||||
const wxChar* m_Name;
|
const wxChar* m_Name;
|
||||||
int m_KeyCode;
|
int m_KeyCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static struct hotkey_name_descr s_Hotkey_Name_List[] =
|
static struct hotkey_name_descr s_Hotkey_Name_List[] =
|
||||||
{
|
{
|
||||||
{ wxT( "F1" ), WXK_F1 },
|
{ wxT( "F1" ), WXK_F1 },
|
||||||
{ wxT( "F2" ), WXK_F2 },
|
{ wxT( "F2" ), WXK_F2 },
|
||||||
{ wxT( "F3" ), WXK_F3 },
|
{ wxT( "F3" ), WXK_F3 },
|
||||||
{ wxT( "F4" ), WXK_F4 },
|
{ wxT( "F4" ), WXK_F4 },
|
||||||
{ wxT( "F5" ), WXK_F5 },
|
{ wxT( "F5" ), WXK_F5 },
|
||||||
{ wxT( "F6" ), WXK_F6 },
|
{ wxT( "F6" ), WXK_F6 },
|
||||||
{ wxT( "F7" ), WXK_F7 },
|
{ wxT( "F7" ), WXK_F7 },
|
||||||
{ wxT( "F8" ), WXK_F8 },
|
{ wxT( "F8" ), WXK_F8 },
|
||||||
{ wxT( "F9" ), WXK_F9 },
|
{ wxT( "F9" ), WXK_F9 },
|
||||||
{ wxT( "F10" ), WXK_F10 },
|
{ wxT( "F10" ), WXK_F10 },
|
||||||
{ wxT( "F11" ), WXK_F11 },
|
{ wxT( "F11" ), WXK_F11 },
|
||||||
{ wxT( "F12" ), WXK_F12 },
|
{ wxT( "F12" ), WXK_F12 },
|
||||||
|
|
||||||
{ wxT( "Esc" ), WXK_ESCAPE },
|
{ wxT( "Esc" ), WXK_ESCAPE },
|
||||||
{ wxT( "Delete" ), WXK_DELETE },
|
{ wxT( "Del" ), WXK_DELETE },
|
||||||
{ wxT( "Tab" ), '\t' },
|
{ wxT( "Tab" ), '\t' },
|
||||||
{ wxT( "Backspace" ), WXK_BACK },
|
{ wxT( "BkSp" ), WXK_BACK },
|
||||||
{ wxT( "Insert" ), WXK_INSERT },
|
{ wxT( "Ins" ), WXK_INSERT },
|
||||||
|
|
||||||
{ wxT( "Home" ), WXK_HOME },
|
{ wxT( "Home" ), WXK_HOME },
|
||||||
{ wxT( "End" ), WXK_END },
|
{ wxT( "End" ), WXK_END },
|
||||||
{ wxT( "Page Up" ), WXK_PAGEUP },
|
{ wxT( "PgUp" ), WXK_PAGEUP },
|
||||||
{ wxT( "Page Down" ), WXK_PAGEDOWN },
|
{ wxT( "PgDn" ), WXK_PAGEDOWN },
|
||||||
{ wxT( "+" ), '+' },
|
{ wxT( "+" ), '+' },
|
||||||
{ wxT( "-" ), '-' },
|
{ wxT( "-" ), '-' },
|
||||||
|
|
||||||
{ wxT( "Up" ), WXK_UP },
|
{ wxT( "Up" ), WXK_UP },
|
||||||
{ wxT( "Down" ), WXK_DOWN },
|
{ wxT( "Down" ), WXK_DOWN },
|
||||||
{ wxT( "Left" ), WXK_LEFT },
|
{ wxT( "Left" ), WXK_LEFT },
|
||||||
{ wxT( "Right" ), WXK_RIGHT },
|
{ wxT( "Right" ), WXK_RIGHT },
|
||||||
|
|
||||||
{ wxT( "space" ), ' ' },
|
{ wxT( "space" ), ' ' },
|
||||||
{ wxT( "?" ), '?' },
|
{ wxT( "?" ), '?' },
|
||||||
{ wxT( "!" ), '!' },
|
{ wxT( "!" ), '!' },
|
||||||
{ wxT( ":" ), ':' },
|
{ wxT( ":" ), ':' },
|
||||||
{ wxT( "," ), ',' },
|
{ wxT( "," ), ',' },
|
||||||
{ wxT( "*" ), '*' },
|
{ wxT( "*" ), '*' },
|
||||||
{ wxT( "+" ), '+' },
|
{ wxT( "+" ), '+' },
|
||||||
{ wxT( "-" ), '-' },
|
{ wxT( "-" ), '-' },
|
||||||
{ wxT( "%%" ), '%' },
|
{ wxT( "%%" ), '%' },
|
||||||
{ wxT( "A" ), 'A' },
|
{ wxT( "A" ), 'A' },
|
||||||
{ wxT( "B" ), 'B' },
|
{ wxT( "B" ), 'B' },
|
||||||
{ wxT( "C" ), 'C' },
|
{ wxT( "C" ), 'C' },
|
||||||
{ wxT( "D" ), 'D' },
|
{ wxT( "D" ), 'D' },
|
||||||
{ wxT( "E" ), 'E' },
|
{ wxT( "E" ), 'E' },
|
||||||
{ wxT( "F" ), 'F' },
|
{ wxT( "F" ), 'F' },
|
||||||
{ wxT( "G" ), 'G' },
|
{ wxT( "G" ), 'G' },
|
||||||
{ wxT( "H" ), 'H' },
|
{ wxT( "H" ), 'H' },
|
||||||
{ wxT( "I" ), 'I' },
|
{ wxT( "I" ), 'I' },
|
||||||
{ wxT( "J" ), 'J' },
|
{ wxT( "J" ), 'J' },
|
||||||
{ wxT( "K" ), 'K' },
|
{ wxT( "K" ), 'K' },
|
||||||
{ wxT( "L" ), 'L' },
|
{ wxT( "L" ), 'L' },
|
||||||
{ wxT( "M" ), 'M' },
|
{ wxT( "M" ), 'M' },
|
||||||
{ wxT( "N" ), 'N' },
|
{ wxT( "N" ), 'N' },
|
||||||
{ wxT( "O" ), 'O' },
|
{ wxT( "O" ), 'O' },
|
||||||
{ wxT( "P" ), 'P' },
|
{ wxT( "P" ), 'P' },
|
||||||
{ wxT( "Q" ), 'Q' },
|
{ wxT( "Q" ), 'Q' },
|
||||||
{ wxT( "R" ), 'R' },
|
{ wxT( "R" ), 'R' },
|
||||||
{ wxT( "S" ), 'S' },
|
{ wxT( "S" ), 'S' },
|
||||||
{ wxT( "T" ), 'T' },
|
{ wxT( "T" ), 'T' },
|
||||||
{ wxT( "U" ), 'U' },
|
{ wxT( "U" ), 'U' },
|
||||||
{ wxT( "V" ), 'V' },
|
{ wxT( "V" ), 'V' },
|
||||||
{ wxT( "W" ), 'W' },
|
{ wxT( "W" ), 'W' },
|
||||||
{ wxT( "X" ), 'X' },
|
{ wxT( "X" ), 'X' },
|
||||||
{ wxT( "Y" ), 'Y' },
|
{ wxT( "Y" ), 'Y' },
|
||||||
{ wxT( "Z" ), 'Z' },
|
{ wxT( "Z" ), 'Z' },
|
||||||
|
|
||||||
{ wxT( "Ctrl A" ), GR_KB_CTRL + 'A' },
|
{ wxT( "Ctrl++" ), GR_KB_CTRL + '+' },
|
||||||
{ wxT( "Ctrl B" ), GR_KB_CTRL + 'B' },
|
{ wxT( "Ctrl+-" ), GR_KB_CTRL + '-' },
|
||||||
{ wxT( "Ctrl C" ), GR_KB_CTRL + 'C' },
|
|
||||||
{ wxT( "Ctrl D" ), GR_KB_CTRL + 'D' },
|
|
||||||
{ wxT( "Ctrl E" ), GR_KB_CTRL + 'E' },
|
|
||||||
{ wxT( "Ctrl F" ), GR_KB_CTRL + 'F' },
|
|
||||||
{ wxT( "Ctrl G" ), GR_KB_CTRL + 'G' },
|
|
||||||
{ wxT( "Ctrl H" ), GR_KB_CTRL + 'H' },
|
|
||||||
{ wxT( "Ctrl I" ), GR_KB_CTRL + 'I' },
|
|
||||||
{ wxT( "Ctrl J" ), GR_KB_CTRL + 'J' },
|
|
||||||
{ wxT( "Ctrl K" ), GR_KB_CTRL + 'K' },
|
|
||||||
{ wxT( "Ctrl L" ), GR_KB_CTRL + 'L' },
|
|
||||||
{ wxT( "Ctrl M" ), GR_KB_CTRL + 'M' },
|
|
||||||
{ wxT( "Ctrl N" ), GR_KB_CTRL + 'N' },
|
|
||||||
{ wxT( "Ctrl O" ), GR_KB_CTRL + 'O' },
|
|
||||||
{ wxT( "Ctrl P" ), GR_KB_CTRL + 'P' },
|
|
||||||
{ wxT( "Ctrl Q" ), GR_KB_CTRL + 'Q' },
|
|
||||||
{ wxT( "Ctrl R" ), GR_KB_CTRL + 'R' },
|
|
||||||
{ wxT( "Ctrl S" ), GR_KB_CTRL + 'S' },
|
|
||||||
{ wxT( "Ctrl T" ), GR_KB_CTRL + 'T' },
|
|
||||||
{ wxT( "Ctrl U" ), GR_KB_CTRL + 'U' },
|
|
||||||
{ wxT( "Ctrl V" ), GR_KB_CTRL + 'V' },
|
|
||||||
{ wxT( "Ctrl W" ), GR_KB_CTRL + 'W' },
|
|
||||||
{ wxT( "Ctrl X" ), GR_KB_CTRL + 'X' },
|
|
||||||
{ wxT( "Ctrl Y" ), GR_KB_CTRL + 'Y' },
|
|
||||||
{ wxT( "Ctrl Z" ), GR_KB_CTRL + 'Z' },
|
|
||||||
|
|
||||||
{ wxT( "" ), 0 } // Do not change: end of list
|
{ wxT( "Ctrl+A" ), GR_KB_CTRL + 'A' },
|
||||||
|
{ wxT( "Ctrl+B" ), GR_KB_CTRL + 'B' },
|
||||||
|
{ wxT( "Ctrl+C" ), GR_KB_CTRL + 'C' },
|
||||||
|
{ wxT( "Ctrl+D" ), GR_KB_CTRL + 'D' },
|
||||||
|
{ wxT( "Ctrl+E" ), GR_KB_CTRL + 'E' },
|
||||||
|
{ wxT( "Ctrl+F" ), GR_KB_CTRL + 'F' },
|
||||||
|
{ wxT( "Ctrl+G" ), GR_KB_CTRL + 'G' },
|
||||||
|
{ wxT( "Ctrl+H" ), GR_KB_CTRL + 'H' },
|
||||||
|
{ wxT( "Ctrl+I" ), GR_KB_CTRL + 'I' },
|
||||||
|
{ wxT( "Ctrl+J" ), GR_KB_CTRL + 'J' },
|
||||||
|
{ wxT( "Ctrl+K" ), GR_KB_CTRL + 'K' },
|
||||||
|
{ wxT( "Ctrl+L" ), GR_KB_CTRL + 'L' },
|
||||||
|
{ wxT( "Ctrl+M" ), GR_KB_CTRL + 'M' },
|
||||||
|
{ wxT( "Ctrl+N" ), GR_KB_CTRL + 'N' },
|
||||||
|
{ wxT( "Ctrl+O" ), GR_KB_CTRL + 'O' },
|
||||||
|
{ wxT( "Ctrl+P" ), GR_KB_CTRL + 'P' },
|
||||||
|
{ wxT( "Ctrl+Q" ), GR_KB_CTRL + 'Q' },
|
||||||
|
{ wxT( "Ctrl+R" ), GR_KB_CTRL + 'R' },
|
||||||
|
{ wxT( "Ctrl+S" ), GR_KB_CTRL + 'S' },
|
||||||
|
{ wxT( "Ctrl+T" ), GR_KB_CTRL + 'T' },
|
||||||
|
{ wxT( "Ctrl+U" ), GR_KB_CTRL + 'U' },
|
||||||
|
{ wxT( "Ctrl+V" ), GR_KB_CTRL + 'V' },
|
||||||
|
{ wxT( "Ctrl+W" ), GR_KB_CTRL + 'W' },
|
||||||
|
{ wxT( "Ctrl+X" ), GR_KB_CTRL + 'X' },
|
||||||
|
{ wxT( "Ctrl+Y" ), GR_KB_CTRL + 'Y' },
|
||||||
|
{ wxT( "Ctrl+Z" ), GR_KB_CTRL + 'Z' },
|
||||||
|
|
||||||
|
{ wxT( "Shift+Ctrl++" ), GR_KB_SHIFT + GR_KB_CTRL + '+' },
|
||||||
|
{ wxT( "Shift+Ctrl+-" ), GR_KB_SHIFT + GR_KB_CTRL + '-' },
|
||||||
|
|
||||||
|
{ wxT( "Shift+Ctrl+A" ), GR_KB_SHIFT + GR_KB_CTRL + 'A' },
|
||||||
|
{ wxT( "Shift+Ctrl+B" ), GR_KB_SHIFT + GR_KB_CTRL + 'B' },
|
||||||
|
{ wxT( "Shift+Ctrl+C" ), GR_KB_SHIFT + GR_KB_CTRL + 'C' },
|
||||||
|
{ wxT( "Shift+Ctrl+D" ), GR_KB_SHIFT + GR_KB_CTRL + 'D' },
|
||||||
|
{ wxT( "Shift+Ctrl+E" ), GR_KB_SHIFT + GR_KB_CTRL + 'E' },
|
||||||
|
{ wxT( "Shift+Ctrl+F" ), GR_KB_SHIFT + GR_KB_CTRL + 'F' },
|
||||||
|
{ wxT( "Shift+Ctrl+G" ), GR_KB_SHIFT + GR_KB_CTRL + 'G' },
|
||||||
|
{ wxT( "Shift+Ctrl+H" ), GR_KB_SHIFT + GR_KB_CTRL + 'H' },
|
||||||
|
{ wxT( "Shift+Ctrl+I" ), GR_KB_SHIFT + GR_KB_CTRL + 'I' },
|
||||||
|
{ wxT( "Shift+Ctrl+J" ), GR_KB_SHIFT + GR_KB_CTRL + 'J' },
|
||||||
|
{ wxT( "Shift+Ctrl+K" ), GR_KB_SHIFT + GR_KB_CTRL + 'K' },
|
||||||
|
{ wxT( "Shift+Ctrl+L" ), GR_KB_SHIFT + GR_KB_CTRL + 'L' },
|
||||||
|
{ wxT( "Shift+Ctrl+M" ), GR_KB_SHIFT + GR_KB_CTRL + 'M' },
|
||||||
|
{ wxT( "Shift+Ctrl+N" ), GR_KB_SHIFT + GR_KB_CTRL + 'N' },
|
||||||
|
{ wxT( "Shift+Ctrl+O" ), GR_KB_SHIFT + GR_KB_CTRL + 'O' },
|
||||||
|
{ wxT( "Shift+Ctrl+P" ), GR_KB_SHIFT + GR_KB_CTRL + 'P' },
|
||||||
|
{ wxT( "Shift+Ctrl+Q" ), GR_KB_SHIFT + GR_KB_CTRL + 'Q' },
|
||||||
|
{ wxT( "Shift+Ctrl+R" ), GR_KB_SHIFT + GR_KB_CTRL + 'R' },
|
||||||
|
{ wxT( "Shift+Ctrl+S" ), GR_KB_SHIFT + GR_KB_CTRL + 'S' },
|
||||||
|
{ wxT( "Shift+Ctrl+T" ), GR_KB_SHIFT + GR_KB_CTRL + 'T' },
|
||||||
|
{ wxT( "Shift+Ctrl+U" ), GR_KB_SHIFT + GR_KB_CTRL + 'U' },
|
||||||
|
{ wxT( "Shift+Ctrl+V" ), GR_KB_SHIFT + GR_KB_CTRL + 'V' },
|
||||||
|
{ wxT( "Shift+Ctrl+W" ), GR_KB_SHIFT + GR_KB_CTRL + 'W' },
|
||||||
|
{ wxT( "Shift+Ctrl+X" ), GR_KB_SHIFT + GR_KB_CTRL + 'X' },
|
||||||
|
{ wxT( "Shift+Ctrl+Y" ), GR_KB_SHIFT + GR_KB_CTRL + 'Y' },
|
||||||
|
{ wxT( "Shift+Ctrl+Z" ), GR_KB_SHIFT + GR_KB_CTRL + 'Z' },
|
||||||
|
|
||||||
|
// Do not change this line: end of list
|
||||||
|
{ wxT( "" ), 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -175,11 +208,11 @@ wxString ReturnKeyNameFromKeyCode( int keycode )
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
if( (keycode & GR_KB_CTRL) != 0 )
|
if( (keycode & GR_KB_CTRL) != 0 )
|
||||||
modifier << wxT( "Ctrl " );
|
modifier << wxT( "Ctrl+" );
|
||||||
if( (keycode & GR_KB_ALT) != 0 )
|
if( (keycode & GR_KB_ALT) != 0 )
|
||||||
modifier << wxT( "Alt " );
|
modifier << wxT( "Alt+" );
|
||||||
if( (keycode & GR_KB_SHIFT) != 0 )
|
if( (keycode & GR_KB_SHIFT) != 0 )
|
||||||
modifier << wxT( "Shift " );
|
modifier << wxT( "Shift+" );
|
||||||
|
|
||||||
keycode &= ~( GR_KB_CTRL | GR_KB_ALT | GR_KB_SHIFT );
|
keycode &= ~( GR_KB_CTRL | GR_KB_ALT | GR_KB_SHIFT );
|
||||||
for( ii = 0; ; ii++ )
|
for( ii = 0; ; ii++ )
|
||||||
|
@ -214,7 +247,7 @@ wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List,
|
||||||
wxString keyname = ReturnKeyNameFromCommandId( List, CommandId );
|
wxString keyname = ReturnKeyNameFromCommandId( List, CommandId );
|
||||||
|
|
||||||
if( !keyname.IsEmpty() )
|
if( !keyname.IsEmpty() )
|
||||||
msg << wxT( " (" ) << keyname << wxT( ")" );
|
msg << wxT( "\t" ) << keyname;
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,7 +273,7 @@ wxString AddHotkeyName( const wxString& text,
|
||||||
keyname = ReturnKeyNameFromCommandId( List, CommandId );
|
keyname = ReturnKeyNameFromCommandId( List, CommandId );
|
||||||
if( !keyname.IsEmpty() )
|
if( !keyname.IsEmpty() )
|
||||||
{
|
{
|
||||||
msg << wxT( " (" ) << keyname << wxT( ")" );
|
msg << wxT( "\t" ) << keyname;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,7 +310,7 @@ wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId )
|
||||||
* return the key code from its key name
|
* return the key code from its key name
|
||||||
* Only some wxWidgets key values are handled for function key
|
* Only some wxWidgets key values are handled for function key
|
||||||
* @param keyname = wxString key name to find in s_Hotkey_Name_List[],
|
* @param keyname = wxString key name to find in s_Hotkey_Name_List[],
|
||||||
* like F2 or space or an usual (ascii) char.
|
* like F2 or space or an usual (ascii) char.
|
||||||
* @return the key code
|
* @return the key code
|
||||||
*/
|
*/
|
||||||
static int ReturnKeyCodeFromKeyName( const wxString& keyname )
|
static int ReturnKeyCodeFromKeyName( const wxString& keyname )
|
||||||
|
@ -304,7 +337,7 @@ static int ReturnKeyCodeFromKeyName( const wxString& keyname )
|
||||||
* Displays the current hotkey list
|
* Displays the current hotkey list
|
||||||
* @param frame = current active frame
|
* @param frame = current active frame
|
||||||
* @param List = pointer to a Ki_HotkeyInfoSectionDescriptor list
|
* @param List = pointer to a Ki_HotkeyInfoSectionDescriptor list
|
||||||
* (Null terminated)
|
*(Null terminated)
|
||||||
* @return none
|
* @return none
|
||||||
*/
|
*/
|
||||||
void DisplayHotkeyList( WinEDA_DrawFrame* frame,
|
void DisplayHotkeyList( WinEDA_DrawFrame* frame,
|
||||||
|
@ -323,7 +356,7 @@ void DisplayHotkeyList( WinEDA_DrawFrame* frame,
|
||||||
Ki_HotkeyInfo* hk_decr = *List;
|
Ki_HotkeyInfo* hk_decr = *List;
|
||||||
msg += _( "key " );
|
msg += _( "key " );
|
||||||
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
|
||||||
msg += keyname + wxT( ": " ) + hk_decr->m_InfoMsg + wxT( "\n" );
|
msg += keyname + wxT( ": " ) + hk_decr->m_InfoMsg + wxT( "\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +386,7 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int key, Ki_HotkeyInfo** List )
|
||||||
/*
|
/*
|
||||||
* Create a configuration file (*.key) from the current hotkey list
|
* Create a configuration file (*.key) from the current hotkey list
|
||||||
* @param Filename = default full file name to create. If void, A filename
|
* @param Filename = default full file name to create. If void, A filename
|
||||||
* will be asked
|
* will be asked
|
||||||
* @param List = pointer to the current hotkey list.
|
* @param List = pointer to the current hotkey list.
|
||||||
* the ouput format is: shortcut "key" "function"
|
* the ouput format is: shortcut "key" "function"
|
||||||
* lines starting with # are comments
|
* lines starting with # are comments
|
||||||
|
@ -468,7 +501,7 @@ int WinEDA_BasicFrame::WriteHotkeyConfigFile(
|
||||||
* Read a configuration file (<file>.key) and fill the current hotkey list
|
* Read a configuration file (<file>.key) and fill the current hotkey list
|
||||||
* with hotkeys
|
* with hotkeys
|
||||||
* @param Filename = default full file name to create. If void, A filename
|
* @param Filename = default full file name to create. If void, A filename
|
||||||
* will be asked
|
* will be asked
|
||||||
* @param DescList = current hotkey list descr. to initialise.
|
* @param DescList = current hotkey list descr. to initialise.
|
||||||
* the input format is: shortcut "key" "function"
|
* the input format is: shortcut "key" "function"
|
||||||
* lines starting by # are ignored (comments)
|
* lines starting by # are ignored (comments)
|
||||||
|
@ -556,7 +589,7 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile(
|
||||||
|
|
||||||
/* Get the command name */
|
/* Get the command name */
|
||||||
fctname = strtok( NULL, "\"\n\r" );
|
fctname = strtok( NULL, "\"\n\r" );
|
||||||
msg = CONV_FROM_UTF8( fctname );
|
msg = CONV_FROM_UTF8( fctname );
|
||||||
|
|
||||||
/* search the hotkey in current hotkey list */
|
/* search the hotkey in current hotkey list */
|
||||||
for( Ki_HotkeyInfo** List = CurrentHotkeyList; *List != NULL; List++ )
|
for( Ki_HotkeyInfo** List = CurrentHotkeyList; *List != NULL; List++ )
|
||||||
|
@ -585,16 +618,17 @@ int WinEDA_BasicFrame::ReadHotkeyConfigFile(
|
||||||
*/
|
*/
|
||||||
wxString ReturnHotkeyConfigFilePath( int choice )
|
wxString ReturnHotkeyConfigFilePath( int choice )
|
||||||
{
|
{
|
||||||
wxString path;
|
wxString path;
|
||||||
wxAppTraits* traits = wxGetApp().GetTraits();
|
wxAppTraits* traits = wxGetApp().GetTraits();
|
||||||
|
|
||||||
switch( choice )
|
switch( choice )
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
path = traits->GetStandardPaths().GetUserConfigDir() +
|
path = traits->GetStandardPaths().GetUserConfigDir() +
|
||||||
wxFileName::GetPathSeparator();
|
wxFileName::GetPathSeparator();
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
|
||||||
/* TODO: This is broken under a normal Poxis system. Users
|
/* TODO: This is broken under a normal Poxis system. Users
|
||||||
* generally do no have write permissions to this path
|
* generally do no have write permissions to this path
|
||||||
* and there is no provision for prompting for the root
|
* and there is no provision for prompting for the root
|
||||||
|
@ -621,28 +655,29 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxMenuItem* item;
|
wxMenuItem* item;
|
||||||
wxMenu* HotkeySubmenu = new wxMenu();
|
wxMenu* HotkeySubmenu = new wxMenu();
|
||||||
|
|
||||||
/* List existing hotkey menu*/
|
/* List existing hotkey menu*/
|
||||||
item = new wxMenuItem( HotkeySubmenu,
|
item = new wxMenuItem( HotkeySubmenu,
|
||||||
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST,
|
||||||
_( "List Current Keys" ),
|
_( "List Current Keys" ),
|
||||||
_( "Displays the current hotkeys list and corresponding commands" ) );
|
_( "Displays the current hotkeys list and corresponding commands" ) );
|
||||||
item->SetBitmap( info_xpm );
|
item->SetBitmap( info_xpm );
|
||||||
HotkeySubmenu->Append( item );
|
HotkeySubmenu->Append( item );
|
||||||
|
|
||||||
/* (Re)create hotkey file */
|
/* (Re)create hotkey file */
|
||||||
item = new wxMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_CREATE_CONFIG,
|
item = new wxMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_CREATE_CONFIG,
|
||||||
_( "(Re)create Hotkeys File" ),
|
_( "(Re)create Hotkeys File" ),
|
||||||
_( "Create or recreate the hotkey configuration file from current hotkey list" )
|
_(
|
||||||
|
"Create or recreate the hotkey configuration file from current hotkey list" )
|
||||||
);
|
);
|
||||||
item->SetBitmap( save_setup_xpm );
|
item->SetBitmap( save_setup_xpm );
|
||||||
HotkeySubmenu->Append( item );
|
HotkeySubmenu->Append( item );
|
||||||
|
|
||||||
/* Reload hotkey file */
|
/* Reload hotkey file */
|
||||||
item = new wxMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_READ_CONFIG,
|
item = new wxMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_READ_CONFIG,
|
||||||
_( "Reload Hotkeys File" ),
|
_( "Reload Hotkeys File" ),
|
||||||
_( "Reload the hotkey configuration file" ) );
|
_( "Reload the hotkey configuration file" ) );
|
||||||
item->SetBitmap( reload_xpm );
|
item->SetBitmap( reload_xpm );
|
||||||
HotkeySubmenu->Append( item );
|
HotkeySubmenu->Append( item );
|
||||||
|
|
||||||
|
@ -656,7 +691,7 @@ void AddHotkeyConfigMenu( wxMenu* aMenu )
|
||||||
/* Append HotkeySubmenu to menu */
|
/* Append HotkeySubmenu to menu */
|
||||||
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( aMenu, HotkeySubmenu,
|
ADD_MENUITEM_WITH_HELP_AND_SUBMENU( aMenu, HotkeySubmenu,
|
||||||
ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ),
|
ID_PREFERENCES_HOTKEY_SUBMENU, _( "Hotkeys" ),
|
||||||
_("Hotkeys configuration and preferences" ), hotkeys_xpm );
|
_( "Hotkeys configuration and preferences" ), hotkeys_xpm );
|
||||||
|
|
||||||
/* Hotkey path */
|
/* Hotkey path */
|
||||||
wxMenu* HotkeyLocationSubmenu = new wxMenu();
|
wxMenu* HotkeyLocationSubmenu = new wxMenu();
|
||||||
|
@ -698,7 +733,7 @@ void HandleHotkeyConfigMenuSelection( WinEDA_DrawFrame* frame, int id )
|
||||||
{
|
{
|
||||||
wxMenuBar* menu = frame->GetMenuBar();
|
wxMenuBar* menu = frame->GetMenuBar();
|
||||||
|
|
||||||
wxConfig* config = wxGetApp().m_EDA_CommonConfig;
|
wxConfig* config = wxGetApp().m_EDA_CommonConfig;
|
||||||
|
|
||||||
switch( id )
|
switch( id )
|
||||||
{
|
{
|
||||||
|
|
|
@ -233,10 +233,6 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
|
|
||||||
wxPoint MousePos = GetScreen()->m_MousePosition;
|
wxPoint MousePos = GetScreen()->m_MousePosition;
|
||||||
|
|
||||||
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to
|
|
||||||
// handle...)
|
|
||||||
if( (hotkey & GR_KB_CTRL) != 0 )
|
|
||||||
hotkey += 'A' - 1;
|
|
||||||
/* Convert lower to upper case (the usual toupper function has problem
|
/* Convert lower to upper case (the usual toupper function has problem
|
||||||
* with non ascii codes like function keys */
|
* with non ascii codes like function keys */
|
||||||
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
||||||
|
@ -640,11 +636,6 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
if( hotkey == 0 )
|
if( hotkey == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to
|
|
||||||
// handle...)
|
|
||||||
if( (hotkey & GR_KB_CTRL) != 0 )
|
|
||||||
hotkey += 'A' - 1;
|
|
||||||
|
|
||||||
/* Convert lower to upper case (the usual toupper function has problem
|
/* Convert lower to upper case (the usual toupper function has problem
|
||||||
* with non ascii codes like function keys */
|
* with non ascii codes like function keys */
|
||||||
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
||||||
|
|
|
@ -151,11 +151,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
||||||
wxMenu* editMenu = new wxMenu;
|
wxMenu* editMenu = new wxMenu;
|
||||||
|
|
||||||
/* Undo */
|
/* Undo */
|
||||||
#if !defined( __WXMAC__)
|
|
||||||
text = AddHotkeyName( _( "Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO);
|
text = AddHotkeyName( _( "Undo" ), s_Schematic_Hokeys_Descr, HK_UNDO);
|
||||||
#else
|
|
||||||
text = _( "Undo\tCtrl+Z" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
item = new wxMenuItem( editMenu, wxID_UNDO, text,
|
item = new wxMenuItem( editMenu, wxID_UNDO, text,
|
||||||
_( "Undo last edition" ), wxITEM_NORMAL );
|
_( "Undo last edition" ), wxITEM_NORMAL );
|
||||||
|
@ -163,11 +159,7 @@ void WinEDA_SchematicFrame::ReCreateMenuBar()
|
||||||
editMenu->Append( item );
|
editMenu->Append( item );
|
||||||
|
|
||||||
/* Redo */
|
/* Redo */
|
||||||
#if !defined( __WXMAC__)
|
|
||||||
text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO);
|
text = AddHotkeyName( _( "Redo" ), s_Schematic_Hokeys_Descr, HK_REDO);
|
||||||
#else
|
|
||||||
text = _( "Redo\tShift+Ctrl+Z" );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
item = new wxMenuItem( editMenu, wxID_REDO, text,
|
item = new wxMenuItem( editMenu, wxID_REDO, text,
|
||||||
_( "Redo the last undo command" ), wxITEM_NORMAL );
|
_( "Redo the last undo command" ), wxITEM_NORMAL );
|
||||||
|
|
|
@ -60,16 +60,10 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DrawStruct)
|
|
||||||
cout << "Drawstruct Type before: " << DrawStruct -> Type() << endl;
|
|
||||||
|
|
||||||
// Try to locate items at cursor position.
|
// Try to locate items at cursor position.
|
||||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||||
{
|
{
|
||||||
DrawStruct = SchematicGeneralLocateAndDisplay( false );
|
DrawStruct = SchematicGeneralLocateAndDisplay( false );
|
||||||
if (DrawStruct)
|
|
||||||
cout << "Drawstruct Type locate : " << DrawStruct -> Type() << endl;
|
|
||||||
|
|
||||||
|
|
||||||
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
|
||||||
{
|
{
|
||||||
|
@ -81,9 +75,6 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DrawStruct)
|
|
||||||
cout << "Drawstruct Type : " << DrawStruct -> Type() << endl;
|
|
||||||
|
|
||||||
// If Command in progress: add "cancel" and "end tool" menu
|
// If Command in progress: add "cancel" and "end tool" menu
|
||||||
if( m_ID_current_state )
|
if( m_ID_current_state )
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,9 +84,6 @@ void WinEDA_GerberFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
|
|
||||||
if( (hotkey & GR_KB_CTRL) != 0 )
|
|
||||||
hotkey += 'A' - 1;
|
|
||||||
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
|
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
|
||||||
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
||||||
hotkey += 'A' - 'a';
|
hotkey += 'A' - 'a';
|
||||||
|
|
|
@ -218,10 +218,6 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct
|
||||||
|
|
||||||
MODULE* module = NULL;
|
MODULE* module = NULL;
|
||||||
|
|
||||||
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (just easier to handle...)
|
|
||||||
if( (hotkey & GR_KB_CTRL) != 0 )
|
|
||||||
hotkey += 'A' - 1;
|
|
||||||
|
|
||||||
/* Convert lower to upper case
|
/* Convert lower to upper case
|
||||||
* (the usual toupper function has problem with non ascii codes like function keys
|
* (the usual toupper function has problem with non ascii codes like function keys
|
||||||
*/
|
*/
|
||||||
|
@ -676,10 +672,6 @@ void WinEDA_ModuleEditFrame::OnHotKey( wxDC* DC, int hotkey,
|
||||||
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
|
||||||
cmd.SetEventObject( this );
|
cmd.SetEventObject( this );
|
||||||
|
|
||||||
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (just easier to handle...)
|
|
||||||
if( (hotkey & GR_KB_CTRL) != 0 )
|
|
||||||
hotkey += 'A' - 1;
|
|
||||||
|
|
||||||
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
|
/* Convert lower to upper case (the usual toupper function has problem with non ascii codes like function keys */
|
||||||
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
if( (hotkey >= 'a') && (hotkey <= 'z') )
|
||||||
hotkey += 'A' - 'a';
|
hotkey += 'A' - 'a';
|
||||||
|
|
Loading…
Reference in New Issue