mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 23:13:43 +00:00
Remove dead code.
This commit is contained in:
parent
0c4ff6b640
commit
9083c9e6ab
common
design_block_info_impl.cppdesign_block_info_impl.hdesign_block_io.hdesign_block_lib_table.cppfp_lib_table.cpp
widgets
cvpcb
eeschema/widgets
include
pcbnew
@ -110,49 +110,36 @@ bool DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles( DESIGN_BLOCK_LIB_TABLE* aTabl
|
||||
|
||||
m_progress_reporter = aProgressReporter;
|
||||
|
||||
if( m_progress_reporter )
|
||||
{
|
||||
m_progress_reporter->SetMaxProgress( m_queue_in.size() );
|
||||
m_progress_reporter->Report( _( "Fetching design_block libraries..." ) );
|
||||
}
|
||||
|
||||
m_cancelled = false;
|
||||
m_lib_table = aTable;
|
||||
|
||||
// Clear data before reading files
|
||||
m_errors.clear();
|
||||
m_list.clear();
|
||||
m_queue_in.clear();
|
||||
m_queue_out.clear();
|
||||
m_queue.clear();
|
||||
|
||||
if( aNickname )
|
||||
{
|
||||
m_queue_in.push( *aNickname );
|
||||
m_queue.push( *aNickname );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( const wxString& nickname : aTable->GetLogicalLibs() )
|
||||
m_queue_in.push( nickname );
|
||||
m_queue.push( nickname );
|
||||
}
|
||||
|
||||
|
||||
loadLibs();
|
||||
|
||||
if( !m_cancelled )
|
||||
if( m_progress_reporter )
|
||||
{
|
||||
if( m_progress_reporter )
|
||||
{
|
||||
m_progress_reporter->SetMaxProgress( m_queue_out.size() );
|
||||
m_progress_reporter->AdvancePhase();
|
||||
m_progress_reporter->Report( _( "Loading design_blocks..." ) );
|
||||
}
|
||||
|
||||
loadDesignBlocks();
|
||||
|
||||
if( m_progress_reporter )
|
||||
m_progress_reporter->AdvancePhase();
|
||||
m_progress_reporter->SetMaxProgress( (int) m_queue.size() );
|
||||
m_progress_reporter->Report( _( "Loading design_blocks..." ) );
|
||||
}
|
||||
|
||||
loadDesignBlocks();
|
||||
|
||||
if( m_progress_reporter )
|
||||
m_progress_reporter->AdvancePhase();
|
||||
|
||||
if( m_cancelled )
|
||||
m_list_timestamp = 0; // God knows what we got before we were canceled
|
||||
else
|
||||
@ -162,53 +149,6 @@ bool DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles( DESIGN_BLOCK_LIB_TABLE* aTabl
|
||||
}
|
||||
|
||||
|
||||
void DESIGN_BLOCK_LIST_IMPL::loadLibs()
|
||||
{
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
size_t num_returns = m_queue_in.size();
|
||||
std::vector<std::future<size_t>> returns( num_returns );
|
||||
|
||||
auto loader_job =
|
||||
[this]() -> size_t
|
||||
{
|
||||
wxString nickname;
|
||||
size_t retval = 0;
|
||||
|
||||
if( !m_cancelled && m_queue_in.pop( nickname ) )
|
||||
{
|
||||
if( CatchErrors( [this, &nickname]()
|
||||
{
|
||||
m_lib_table->PrefetchLib( nickname );
|
||||
m_queue_out.push( nickname );
|
||||
} ) && m_progress_reporter )
|
||||
{
|
||||
m_progress_reporter->AdvanceProgress();
|
||||
}
|
||||
|
||||
++retval;
|
||||
}
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
for( size_t ii = 0; ii < num_returns; ++ii )
|
||||
returns[ii] = tp.submit( loader_job );
|
||||
|
||||
for( const std::future<size_t>& ret : returns )
|
||||
{
|
||||
std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
|
||||
|
||||
while( status != std::future_status::ready )
|
||||
{
|
||||
if( m_progress_reporter && !m_progress_reporter->KeepRefreshing() )
|
||||
m_cancelled = true;
|
||||
|
||||
status = ret.wait_for( std::chrono::milliseconds( 250 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks()
|
||||
{
|
||||
LOCALE_IO toggle_locale;
|
||||
@ -222,7 +162,7 @@ void DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks()
|
||||
|
||||
SYNC_QUEUE<std::unique_ptr<DESIGN_BLOCK_INFO>> queue_parsed;
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
size_t num_elements = m_queue_out.size();
|
||||
size_t num_elements = m_queue.size();
|
||||
std::vector<std::future<size_t>> returns( num_elements );
|
||||
|
||||
auto db_thread =
|
||||
@ -230,7 +170,7 @@ void DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks()
|
||||
{
|
||||
wxString nickname;
|
||||
|
||||
if( m_cancelled || !m_queue_out.pop( nickname ) )
|
||||
if( m_cancelled || !m_queue.pop( nickname ) )
|
||||
return 0;
|
||||
|
||||
wxArrayString dbnames;
|
||||
|
@ -87,7 +87,6 @@ public:
|
||||
PROGRESS_REPORTER* aProgressReporter = nullptr ) override;
|
||||
|
||||
protected:
|
||||
void loadLibs();
|
||||
void loadDesignBlocks();
|
||||
|
||||
private:
|
||||
@ -98,8 +97,7 @@ private:
|
||||
*/
|
||||
bool CatchErrors( const std::function<void()>& aFunc );
|
||||
|
||||
SYNC_QUEUE<wxString> m_queue_in;
|
||||
SYNC_QUEUE<wxString> m_queue_out;
|
||||
SYNC_QUEUE<wxString> m_queue;
|
||||
long long m_list_timestamp;
|
||||
PROGRESS_REPORTER* m_progress_reporter;
|
||||
std::atomic_bool m_cancelled;
|
||||
|
@ -106,11 +106,6 @@ public:
|
||||
|
||||
void DesignBlockDelete( const wxString& aLibraryPath, const wxString& aDesignBlockName,
|
||||
const std::map<std::string, UTF8>* aProperties = nullptr );
|
||||
|
||||
virtual void PrefetchLib( const wxString& aLibraryPath,
|
||||
const std::map<std::string, UTF8>* aProperties = nullptr )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -322,14 +322,6 @@ void DESIGN_BLOCK_LIB_TABLE::DesignBlockEnumerate( wxArrayString& aDesignBlockN
|
||||
}
|
||||
|
||||
|
||||
void DESIGN_BLOCK_LIB_TABLE::PrefetchLib( const wxString& aNickname )
|
||||
{
|
||||
const DESIGN_BLOCK_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||
wxASSERT( row->plugin );
|
||||
row->plugin->PrefetchLib( row->GetFullURI( true ), row->GetProperties() );
|
||||
}
|
||||
|
||||
|
||||
const DESIGN_BLOCK_LIB_TABLE_ROW* DESIGN_BLOCK_LIB_TABLE::FindRow( const wxString& aNickname,
|
||||
bool aCheckIfEnabled )
|
||||
{
|
||||
|
@ -316,14 +316,6 @@ void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxS
|
||||
}
|
||||
|
||||
|
||||
void FP_LIB_TABLE::PrefetchLib( const wxString& aNickname )
|
||||
{
|
||||
const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true );
|
||||
wxASSERT( row->plugin );
|
||||
row->plugin->PrefetchLib( row->GetFullURI( true ), row->GetProperties() );
|
||||
}
|
||||
|
||||
|
||||
const FP_LIB_TABLE_ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname, bool aCheckIfEnabled )
|
||||
{
|
||||
FP_LIB_TABLE_ROW* row = static_cast<FP_LIB_TABLE_ROW*>( findRow( aNickname, aCheckIfEnabled ) );
|
||||
|
@ -65,7 +65,7 @@ void FOOTPRINT_SELECT_WIDGET::Load( KIWAY& aKiway, PROJECT& aProject )
|
||||
// If the fp-info-cache is empty (or, more likely, hasn't been created in a new
|
||||
// project yet), load footprints the hard way.
|
||||
FP_LIB_TABLE* fpTable = aProject.PcbFootprintLibs( aKiway );
|
||||
WX_PROGRESS_REPORTER progressReporter( m_frame, _( "Loading Footprint Libraries" ), 3 );
|
||||
WX_PROGRESS_REPORTER progressReporter( m_frame, _( "Loading Footprint Libraries" ), 1 );
|
||||
FOOTPRINT_LIST_IMPL& fpList = static_cast<FOOTPRINT_LIST_IMPL&>( *m_fp_list );
|
||||
|
||||
fpList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
|
||||
|
@ -896,7 +896,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||
return false;
|
||||
}
|
||||
|
||||
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
|
||||
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 1 );
|
||||
|
||||
m_FootprintsList->ReadFootprintFiles( fptbl, nullptr, &progressReporter );
|
||||
|
||||
|
@ -64,7 +64,7 @@ PANEL_DESIGN_BLOCK_CHOOSER::PANEL_DESIGN_BLOCK_CHOOSER( SCH_EDIT_FRAME* aFrame,
|
||||
|
||||
// Load design block files:
|
||||
WX_PROGRESS_REPORTER* progressReporter =
|
||||
new WX_PROGRESS_REPORTER( aParent, _( "Loading Design Block Libraries" ), 3 );
|
||||
new WX_PROGRESS_REPORTER( aParent, _( "Loading Design Block Libraries" ), 1 );
|
||||
DESIGN_BLOCK_LIB_TABLE::GetGlobalList().ReadDesignBlockFiles( libs, nullptr, progressReporter );
|
||||
|
||||
// Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use
|
||||
|
@ -146,18 +146,6 @@ public:
|
||||
*/
|
||||
long long GenerateTimestamp( const wxString* aNickname );
|
||||
|
||||
/**
|
||||
* If possible, prefetches the specified library (e.g. performing downloads). Does not parse.
|
||||
* Threadsafe.
|
||||
*
|
||||
* This is a no-op for libraries that cannot be prefetched.
|
||||
*
|
||||
* @param aNickname is a locator for the library; it is a name in LIB_TABLE_ROW.
|
||||
*
|
||||
* @throw IO_ERROR if there is an error prefetching the library.
|
||||
*/
|
||||
void PrefetchLib( const wxString& aNickname );
|
||||
|
||||
/**
|
||||
* Load a design block having @a aDesignBlockName from the library given by @a aNickname.
|
||||
*
|
||||
|
@ -155,18 +155,6 @@ public:
|
||||
*/
|
||||
long long GenerateTimestamp( const wxString* aNickname );
|
||||
|
||||
/**
|
||||
* If possible, prefetches the specified library (e.g. performing downloads). Does not parse.
|
||||
* Threadsafe.
|
||||
*
|
||||
* This is a no-op for libraries that cannot be prefetched.
|
||||
*
|
||||
* @param aNickname is a locator for the library; it is a name in LIB_TABLE_ROW.
|
||||
*
|
||||
* @throw IO_ERROR if there is an error prefetching the library.
|
||||
*/
|
||||
void PrefetchLib( const wxString& aNickname );
|
||||
|
||||
/**
|
||||
* Load a footprint having @a aFootprintName from the library given by @a aNickname.
|
||||
*
|
||||
|
@ -1067,7 +1067,7 @@ void FOOTPRINT_EDIT_FRAME::initLibraryTree()
|
||||
{
|
||||
FP_LIB_TABLE* fpTable = PROJECT_PCB::PcbFootprintLibs( &Prj() );
|
||||
|
||||
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 2 );
|
||||
WX_PROGRESS_REPORTER progressReporter( this, _( "Loading Footprint Libraries" ), 1 );
|
||||
|
||||
if( GFootprintList.GetCount() == 0 )
|
||||
GFootprintList.ReadCacheFromFile( Prj().GetProjectPath() + wxT( "fp-info-cache" ) );
|
||||
@ -1095,7 +1095,7 @@ void FOOTPRINT_EDIT_FRAME::SyncLibraryTree( bool aProgress )
|
||||
// Sync FOOTPRINT_INFO list to the libraries on disk
|
||||
if( aProgress )
|
||||
{
|
||||
WX_PROGRESS_REPORTER progressReporter( this, _( "Updating Footprint Libraries" ), 2 );
|
||||
WX_PROGRESS_REPORTER progressReporter( this, _( "Updating Footprint Libraries" ), 1 );
|
||||
GFootprintList.ReadFootprintFiles( fpTable, nullptr, &progressReporter );
|
||||
progressReporter.Show( false );
|
||||
}
|
||||
|
@ -125,48 +125,35 @@ bool FOOTPRINT_LIST_IMPL::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxStri
|
||||
|
||||
m_progress_reporter = aProgressReporter;
|
||||
|
||||
if( m_progress_reporter )
|
||||
{
|
||||
m_progress_reporter->SetMaxProgress( m_queue_in.size() );
|
||||
m_progress_reporter->Report( _( "Fetching footprint libraries..." ) );
|
||||
}
|
||||
|
||||
m_cancelled = false;
|
||||
m_lib_table = aTable;
|
||||
|
||||
// Clear data before reading files
|
||||
m_errors.clear();
|
||||
m_list.clear();
|
||||
m_queue_in.clear();
|
||||
m_queue_out.clear();
|
||||
m_queue.clear();
|
||||
|
||||
if( aNickname )
|
||||
{
|
||||
m_queue_in.push( *aNickname );
|
||||
m_queue.push( *aNickname );
|
||||
}
|
||||
else
|
||||
{
|
||||
for( const wxString& nickname : aTable->GetLogicalLibs() )
|
||||
m_queue_in.push( nickname );
|
||||
m_queue.push( nickname );
|
||||
}
|
||||
|
||||
loadLibs();
|
||||
|
||||
if( !m_cancelled )
|
||||
if( m_progress_reporter )
|
||||
{
|
||||
if( m_progress_reporter )
|
||||
{
|
||||
m_progress_reporter->SetMaxProgress( m_queue_out.size() );
|
||||
m_progress_reporter->AdvancePhase();
|
||||
m_progress_reporter->Report( _( "Loading footprints..." ) );
|
||||
}
|
||||
|
||||
loadFootprints();
|
||||
|
||||
if( m_progress_reporter )
|
||||
m_progress_reporter->AdvancePhase();
|
||||
m_progress_reporter->SetMaxProgress( (int) m_queue.size() );
|
||||
m_progress_reporter->Report( _( "Loading footprints..." ) );
|
||||
}
|
||||
|
||||
loadFootprints();
|
||||
|
||||
if( m_progress_reporter )
|
||||
m_progress_reporter->AdvancePhase();
|
||||
|
||||
if( m_cancelled )
|
||||
m_list_timestamp = 0; // God knows what we got before we were canceled
|
||||
else
|
||||
@ -176,53 +163,6 @@ bool FOOTPRINT_LIST_IMPL::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxStri
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_LIST_IMPL::loadLibs()
|
||||
{
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
size_t num_returns = m_queue_in.size();
|
||||
std::vector<std::future<size_t>> returns( num_returns );
|
||||
|
||||
auto loader_job =
|
||||
[this]() -> size_t
|
||||
{
|
||||
wxString nickname;
|
||||
size_t retval = 0;
|
||||
|
||||
if( !m_cancelled && m_queue_in.pop( nickname ) )
|
||||
{
|
||||
if( CatchErrors( [this, &nickname]()
|
||||
{
|
||||
m_lib_table->PrefetchLib( nickname );
|
||||
m_queue_out.push( nickname );
|
||||
} ) && m_progress_reporter )
|
||||
{
|
||||
m_progress_reporter->AdvanceProgress();
|
||||
}
|
||||
|
||||
++retval;
|
||||
}
|
||||
|
||||
return retval;
|
||||
};
|
||||
|
||||
for( size_t ii = 0; ii < num_returns; ++ii )
|
||||
returns[ii] = tp.submit( loader_job );
|
||||
|
||||
for( const std::future<size_t>& ret : returns )
|
||||
{
|
||||
std::future_status status = ret.wait_for( std::chrono::milliseconds( 250 ) );
|
||||
|
||||
while( status != std::future_status::ready )
|
||||
{
|
||||
if( m_progress_reporter && !m_progress_reporter->KeepRefreshing() )
|
||||
m_cancelled = true;
|
||||
|
||||
status = ret.wait_for( std::chrono::milliseconds( 250 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_LIST_IMPL::loadFootprints()
|
||||
{
|
||||
LOCALE_IO toggle_locale;
|
||||
@ -236,7 +176,7 @@ void FOOTPRINT_LIST_IMPL::loadFootprints()
|
||||
|
||||
SYNC_QUEUE<std::unique_ptr<FOOTPRINT_INFO>> queue_parsed;
|
||||
thread_pool& tp = GetKiCadThreadPool();
|
||||
size_t num_elements = m_queue_out.size();
|
||||
size_t num_elements = m_queue.size();
|
||||
std::vector<std::future<size_t>> returns( num_elements );
|
||||
|
||||
auto fp_thread =
|
||||
@ -244,7 +184,7 @@ void FOOTPRINT_LIST_IMPL::loadFootprints()
|
||||
{
|
||||
wxString nickname;
|
||||
|
||||
if( m_cancelled || !m_queue_out.pop( nickname ) )
|
||||
if( m_cancelled || !m_queue.pop( nickname ) )
|
||||
return 0;
|
||||
|
||||
wxArrayString fpnames;
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
void Clear() override;
|
||||
|
||||
protected:
|
||||
void loadLibs();
|
||||
void loadFootprints();
|
||||
|
||||
private:
|
||||
@ -107,8 +106,7 @@ private:
|
||||
*/
|
||||
bool CatchErrors( const std::function<void()>& aFunc );
|
||||
|
||||
SYNC_QUEUE<wxString> m_queue_in;
|
||||
SYNC_QUEUE<wxString> m_queue_out;
|
||||
SYNC_QUEUE<wxString> m_queue;
|
||||
long long m_list_timestamp;
|
||||
PROGRESS_REPORTER* m_progress_reporter;
|
||||
std::atomic_bool m_cancelled;
|
||||
|
@ -3276,9 +3276,6 @@ bool PCB_IO_KICAD_LEGACY::DeleteLibrary( const wxString& aLibraryPath,
|
||||
|
||||
bool PCB_IO_KICAD_LEGACY::IsLibraryWritable( const wxString& aLibraryPath )
|
||||
{
|
||||
#if 0 // no support for 32 Cu layers in legacy format
|
||||
return false;
|
||||
#else
|
||||
LOCALE_IO toggle;
|
||||
|
||||
init( nullptr );
|
||||
@ -3286,7 +3283,6 @@ bool PCB_IO_KICAD_LEGACY::IsLibraryWritable( const wxString& aLibraryPath )
|
||||
cacheLib( aLibraryPath );
|
||||
|
||||
return m_cache->m_writable;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,11 +100,6 @@ void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString&
|
||||
}
|
||||
|
||||
|
||||
void PCB_IO::PrefetchLib( const wxString&, const std::map<std::string, UTF8>* )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
FOOTPRINT* PCB_IO::ImportFootprint( const wxString& aFootprintPath, wxString& aFootprintNameOut,
|
||||
const std::map<std::string, UTF8>* aProperties )
|
||||
{
|
||||
|
@ -184,26 +184,6 @@ public:
|
||||
*/
|
||||
virtual long long GetLibraryTimestamp( const wxString& aLibraryPath ) const = 0;
|
||||
|
||||
/**
|
||||
* If possible, prefetches the specified library (e.g. performing downloads). Does not parse.
|
||||
* Threadsafe.
|
||||
*
|
||||
* This is a no-op for libraries that cannot be prefetched. Plugins that cannot prefetch
|
||||
* need not override this; a default no-op is provided.
|
||||
*
|
||||
* @param aLibraryPath is a locator for the "library", usually a directory, file, or URL
|
||||
* containing several footprints.
|
||||
*
|
||||
* @param aProperties is an associative array that can be used to tell the plugin anything
|
||||
* needed about how to perform with respect to @a aLibraryPath. The
|
||||
* caller continues to own this object (plugin may not delete it), and
|
||||
* plugins should expect it to be optionally NULL.
|
||||
*
|
||||
* @throw IO_ERROR if there is an error prefetching the library.
|
||||
*/
|
||||
virtual void PrefetchLib( const wxString& aLibraryPath,
|
||||
const std::map<std::string, UTF8>* aProperties = nullptr );
|
||||
|
||||
/**
|
||||
* Load a single footprint from @a aFootprintPath and put its name in @a aFootprintNameOut.
|
||||
* If this is a footprint library, the first footprint should be loaded.
|
||||
|
@ -66,7 +66,7 @@ PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER( PCB_BASE_FRAME* aFrame, wxTopL
|
||||
|
||||
// Load footprint files:
|
||||
WX_PROGRESS_REPORTER* progressReporter = new WX_PROGRESS_REPORTER( aParent,
|
||||
_( "Loading Footprint Libraries" ), 3 );
|
||||
_( "Loading Footprint Libraries" ), 1 );
|
||||
GFootprintList.ReadFootprintFiles( fpTable, nullptr, progressReporter );
|
||||
|
||||
// Force immediate deletion of the WX_PROGRESS_REPORTER. Do not use Destroy(), or use
|
||||
|
Loading…
Reference in New Issue
Block a user