Commit 597833b5 authored by Dick Hollenbeck's avatar Dick Hollenbeck

touch ups

parent e88bc8e5
......@@ -120,15 +120,17 @@ StructColors ColorRefs[NBCOLOR] =
bool g_DisableFloatingPointLocalNotation = false;
void SetLocaleTo_C_standard( void )
int LOCALE_IO::C_count;
void SetLocaleTo_C_standard()
{
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
}
void SetLocaleTo_Default( void )
void SetLocaleTo_Default()
{
if( ! g_DisableFloatingPointLocalNotation )
if( !g_DisableFloatingPointLocalNotation )
setlocale( LC_NUMERIC, "" ); // revert to the current locale
}
......
......@@ -16,8 +16,6 @@
#include <pcbcommon.h>
#include <pcbstruct.h>
#include <richio.h>
#include <filter_reader.h>
#include <footprint_info.h>
#include <io_mgr.h>
......@@ -42,57 +40,68 @@
*/
bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
{
wxFileName filename;
wxString libname;
// Clear data before reading files
m_filesNotFound.Empty();
m_filesInvalid.Empty();
m_List.clear();
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
// Parse Libraries Listed
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
// try
{
filename = aFootprintsLibNames[ii];
filename.SetExt( FootprintLibFileExtension );
libname = wxGetApp().FindLibraryPath( filename );
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::LEGACY ) );
if( libname.IsEmpty() )
// Parse Libraries Listed
for( unsigned ii = 0; ii < aFootprintsLibNames.GetCount(); ii++ )
{
m_filesNotFound << filename.GetFullName() << wxT("\n");
continue;
}
wxFileName filename = aFootprintsLibNames[ii];
try
{
wxArrayString fpnames = pi->FootprintEnumerate( libname );
filename.SetExt( FootprintLibFileExtension );
for( unsigned i=0; i<fpnames.GetCount(); ++i )
wxString libPath = wxGetApp().FindLibraryPath( filename );
if( !libPath )
{
std::auto_ptr<MODULE> m( pi->FootprintLoad( libname, fpnames[i] ) );
m_filesNotFound << filename.GetFullName() << wxT("\n");
continue;
}
try
{
wxArrayString fpnames = pi->FootprintEnumerate( libPath );
for( unsigned i=0; i<fpnames.GetCount(); ++i )
{
auto_ptr<MODULE> m( pi->FootprintLoad( libPath, fpnames[i] ) );
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
// we're loading what we enumerated, all must be there.
wxASSERT( m.get() );
fpinfo->m_Module = fpnames[i];
fpinfo->m_LibName = libname;
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
FOOTPRINT_INFO* fpinfo = new FOOTPRINT_INFO();
AddItem( fpinfo );
fpinfo->m_Module = fpnames[i];
fpinfo->m_LibName = libPath;
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
AddItem( fpinfo );
}
}
catch( IO_ERROR ioe )
{
m_filesInvalid << ioe.errorText << wxT("\n");
}
}
catch( IO_ERROR ioe )
{
m_filesInvalid << ioe.errorText << wxT("\n");
}
}
/* caller should catch this, UI seems not wanted here.
catch( IO_ERROR ioe )
{
DisplayError( NULL, ioe.errorText );
return false;
}
*/
m_List.sort();
return true;
}
......@@ -454,6 +454,7 @@ void SetLocaleTo_C_standard();
*/
void SetLocaleTo_Default();
/**
* Class LOCALE_IO
* is a class that can be instantiated within a scope in which you are expecting
......@@ -464,10 +465,23 @@ void SetLocaleTo_Default();
class LOCALE_IO
{
public:
LOCALE_IO() { SetLocaleTo_C_standard(); }
~LOCALE_IO() { SetLocaleTo_Default(); }
LOCALE_IO()
{
if( C_count++ == 0 )
SetLocaleTo_C_standard();
}
~LOCALE_IO()
{
if( --C_count == 0 )
SetLocaleTo_Default();
}
private:
static int C_count; // allow for nesting of LOCALE_IO instantiations
};
/**
* Function EnsureTextCtrlWidth
* sets the minimum pixel width on a text control in order to make a text
......
......@@ -4186,6 +4186,17 @@ bool LEGACY_PLUGIN::IsFootprintLibWritable( const wxString& aLibraryPath )
}
LEGACY_PLUGIN::LEGACY_PLUGIN() :
m_board( 0 ),
m_props( 0 ),
m_reader( 0 ),
m_fp( 0 ),
m_cache( 0 )
{
init( NULL );
}
LEGACY_PLUGIN::~LEGACY_PLUGIN()
{
delete m_cache;
......
......@@ -55,7 +55,7 @@ struct FPL_CACHE;
/**
* Class LEGACY_PLUGIN
* is a PLUGIN derivation which could possibly be put into a DLL/DSO.
* It is not thread safe, but it is re-entrant multiple times in sequence.
* As with any PLUGIN, there is no UI, i.e. windowing calls allowed.
*/
class LEGACY_PLUGIN : public PLUGIN
{
......@@ -99,14 +99,7 @@ public:
//-----</PLUGIN IMPLEMENTATION>---------------------------------------------
LEGACY_PLUGIN() :
m_board( 0 ),
m_props( 0 ),
m_reader( 0 ),
m_fp( 0 ),
m_cache( 0 )
{}
LEGACY_PLUGIN();
~LEGACY_PLUGIN();
void SetReader( LINE_READER* aReader ) { m_reader = aReader; }
......
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