Commit 2cfe92de authored by CHARRAS's avatar CHARRAS

hotkey enhancement

parent 542b9441
...@@ -4,7 +4,7 @@ Started 2007-June-11 ...@@ -4,7 +4,7 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-sept-19 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+ all + all
* hotkeys handling finished * hotkeys handling finished
......
...@@ -639,4 +639,48 @@ void AddHotheyConfigMenu( wxMenu* menu ) ...@@ -639,4 +639,48 @@ void AddHotheyConfigMenu( wxMenu* menu )
_( "Hotkey config location" ), _( "Hotkey config location" ),
_( "Hotkey config file location selection (home directory or kicad tree)" ), _( "Hotkey config file location selection (home directory or kicad tree)" ),
right_xpm ); right_xpm );
submenu_hkcfg->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME,
g_ConfigFileLocationChoice == 0);
submenu_hkcfg->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD,
g_ConfigFileLocationChoice == 1);
} }
/************************************************************************/
void HandleHotheyConfigMenuSelection( WinEDA_DrawFrame * frame, int id )
/************************************************************************/
/* called on hotkey file location selecton menu
* @param frame = current WinEDA_DrawFrame
* @param id = selected menu id
* @return g_ConfigFileLocationChoice (global) = new selection
*/
{
wxMenuBar * menu = frame->GetMenuBar();
switch (id )
{
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if ( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME, true);
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, false);
frame->m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if ( g_ConfigFileLocationChoice != 1 )
{
g_ConfigFileLocationChoice = 1;
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_HOME, false);
menu->Check(ID_PREFERENCES_HOTKEY_PATH_IS_KICAD, true);
frame->m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
default:
break;
}
}
...@@ -99,19 +99,8 @@ wxString FullFileName; ...@@ -99,19 +99,8 @@ wxString FullFileName;
} }
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME: case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if ( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD: case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if ( g_ConfigFileLocationChoice != 1 ) HandleHotheyConfigMenuSelection( this, id );
{
g_ConfigFileLocationChoice = 1;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
}
break; break;
default: default:
......
...@@ -68,19 +68,8 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event ) ...@@ -68,19 +68,8 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
break; break;
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME: case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
if( g_ConfigFileLocationChoice != 0 )
{
g_ConfigFileLocationChoice = 0;
m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
}
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD: case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
if( g_ConfigFileLocationChoice != 1 ) HandleHotheyConfigMenuSelection( this, id );
{
g_ConfigFileLocationChoice = 1;
m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
}
break; break;
default: default:
......
...@@ -92,6 +92,7 @@ COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directo ...@@ -92,6 +92,7 @@ COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directo
*/ */
wxString ReturnHotkeyConfigFilePath( int choice ); wxString ReturnHotkeyConfigFilePath( int choice );
void AddHotheyConfigMenu( wxMenu* menu ); void AddHotheyConfigMenu( wxMenu* menu );
void HandleHotheyConfigMenuSelection( WinEDA_DrawFrame * frame, int id );
wxString ReturnKeyNameFromKeyCode( int keycode ); wxString ReturnKeyNameFromKeyCode( int keycode );
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId ); wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** List, int CommandId );
wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId ); wxString AddHotkeyName( const wxString& text, Ki_HotkeyInfo** List, int CommandId );
......
No preview for this file type
This diff is collapsed.
...@@ -107,13 +107,8 @@ wxString FullFileName; ...@@ -107,13 +107,8 @@ wxString FullFileName;
} }
case ID_PREFERENCES_HOTKEY_PATH_IS_HOME: case ID_PREFERENCES_HOTKEY_PATH_IS_HOME:
g_ConfigFileLocationChoice = 0;
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
break;
case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD: case ID_PREFERENCES_HOTKEY_PATH_IS_KICAD:
g_ConfigFileLocationChoice = 1; HandleHotheyConfigMenuSelection( this, id );
m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
break; break;
default: default:
......
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