예제 #1
0
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList,
                                            const wxString& aDefaultShortname )
{
    wxString ext  = DEFAULT_HOTKEY_FILENAME_EXT;
    wxString mask = wxT( "*." ) + ext;

#if 0   // pass in the project dir as an argument
    wxString path = wxPathOnly( Prj().GetProjectFullName() );
#else
    wxString path = wxGetCwd();
#endif
    wxFileName fn( aDefaultShortname );
    fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );

    wxString  filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
                                 path,
                                 fn.GetFullPath(),
                                 ext,
                                 mask,
                                 this,
                                 wxFD_OPEN,
                                 true );

    if( filename.IsEmpty() )
        return;

    ReadHotkeyConfigFile( filename, aDescList );
}
/**
 * Function ImportHotkeyConfigFromFile
 * Prompt the user for an old hotkey file to read, and read it.
 * @param aDescList = current hotkey list descr. to initialize.
 */
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDescList )
{
    wxString ext  = DEFAULT_HOTKEY_FILENAME_EXT;
    wxString mask = wxT( "*." ) + ext;
    wxString path = wxGetCwd();
    wxString filename = Kiface().Name() + wxT( '.' ) + ext;

    filename = EDA_FileSelector( _( "Read Hotkey Configuration File:" ),
                                 path,
                                 filename,
                                 ext,
                                 mask,
                                 this,
                                 wxFD_OPEN,
                                 true );

    if( filename.IsEmpty() )
        return;

    ReadHotkeyConfigFile( filename, aDescList );
}