Commit c4bc7bb4 authored by charras's avatar charras

enhancements about hot keys

parent 5861a43d
...@@ -1344,6 +1344,13 @@ void WinEDA_DrawPanel::OnKeyEvent( wxKeyEvent& event ) ...@@ -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();
......
This diff is collapsed.
...@@ -233,10 +233,6 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -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, ...@@ -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() ...@@ -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() ...@@ -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, ...@@ -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, ...@@ -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, ...@@ -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 ...@@ -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, ...@@ -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';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment