Commit 2cfe92de authored by CHARRAS's avatar CHARRAS
Browse files

hotkey enhancement

parent 542b9441
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with 
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
	* hotkeys handling finished
+44 −0
Original line number Diff line number Diff line
@@ -639,4 +639,48 @@ void AddHotheyConfigMenu( wxMenu* menu )
										_( "Hotkey config location" ),
                                        _( "Hotkey config file location selection (home directory or kicad tree)" ),
                                        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;
	}
}
+1 −12
Original line number Diff line number Diff line
@@ -99,19 +99,8 @@ wxString FullFileName;
			}

		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:
			if ( g_ConfigFileLocationChoice != 1 )
			{
				g_ConfigFileLocationChoice = 1;
				m_Parent->m_EDA_CommonConfig->Write(HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice);
			}
			HandleHotheyConfigMenuSelection( this, id );
			break;

		default:
+1 −12
Original line number Diff line number Diff line
@@ -68,19 +68,8 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
        break;

    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:
        if( g_ConfigFileLocationChoice != 1 )
        {
            g_ConfigFileLocationChoice = 1;
            m_Parent->m_EDA_CommonConfig->Write( HOTKEY_CFG_PATH_OPT, g_ConfigFileLocationChoice );
        }
 		HandleHotheyConfigMenuSelection( this, id );
        break;

    default:
+2 −1
Original line number Diff line number Diff line
@@ -92,6 +92,7 @@ COMMON_GLOBL int g_ConfigFileLocationChoice; /* 0 = files are in Home directo
 */
wxString    ReturnHotkeyConfigFilePath( int choice );
void        AddHotheyConfigMenu( wxMenu* menu );
void        HandleHotheyConfigMenuSelection( 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 );
Loading