コード例 #1
0
int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString&           aFilename,
                                          struct EDA_HOTKEY_CONFIG* aDescList )
{
    wxFileName fn( aFilename );
    fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );

    wxFile cfgfile( fn.GetFullPath() );

    if( !cfgfile.IsOpened() )       // There is a problem to open file
        return 0;

    // get length
    cfgfile.SeekEnd();
    wxFileOffset size = cfgfile.Tell();
    cfgfile.Seek( 0 );

    // read data
    char*    buffer = new char[size];
    cfgfile.Read( buffer, size );

    wxString data( buffer, wxConvUTF8 );

    // parse
    ParseHotkeyConfig( data, aDescList );

    // cleanup
    delete[] buffer;
    cfgfile.Close();
    return 1;
}
コード例 #2
0
void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList )
{
    wxConfig config( Appname );

    if( !config.HasEntry( HOTKEYS_CONFIG_KEY ) )
    {
        // assume defaults are ok
        return;
    }

    wxString data;
    config.Read( HOTKEYS_CONFIG_KEY, &data );

    ParseHotkeyConfig( data, aDescList );
}
コード例 #3
0
void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList )
{
    wxFileName fn( Appname );
    fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );

    wxConfigBase* config = GetNewConfig( fn.GetFullPath() );

    if( !config->HasEntry( HOTKEYS_CONFIG_KEY ) )
    {
        // assume defaults are ok
        return;
    }

    wxString data;
    config->Read( HOTKEYS_CONFIG_KEY, &data );
    delete config;

    ParseHotkeyConfig( data, aDescList );
}
コード例 #4
0
/**
 * Function ReadHotkeyConfigFile
 * Read an old configuration file (&ltfile&gt.key) and fill the current hotkey list
 * with hotkeys
 * @param aFilename = file name to read.
 * @param aDescList = current hotkey list descr. to initialise.
 */
int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString&           aFilename,
                                          struct EDA_HOTKEY_CONFIG* aDescList )
{
    wxFile cfgfile( aFilename );

    // get length
    cfgfile.SeekEnd();
    wxFileOffset size = cfgfile.Tell();
    cfgfile.Seek( 0 );

    // read data
    char*    buffer = new char[size];
    cfgfile.Read( buffer, size );

    wxString data( buffer, wxConvUTF8 );

    // parse
    ParseHotkeyConfig( data, aDescList );

    // cleanup
    delete[] buffer;
    cfgfile.Close();
    return 1;
}