Pcbnew, autoplacer: display more activity during footprint placement

This commit is contained in:
jean-pierre charras 2018-12-10 10:33:56 +01:00
parent 7d6081d329
commit 4013f6424d
2 changed files with 27 additions and 3 deletions

View File

@ -76,6 +76,14 @@ class PROGRESS_REPORTER
*/
bool KeepRefreshing( bool aWait = false );
/** change the title displayed on the window caption
* *MUST* only be called from the main thread.
* Has meaning only for some reporters.
* Do nothing for others
*/
virtual void SetTitle( const wxString& aTitle ) {}
protected:
int currentProgress() const;
@ -109,6 +117,13 @@ public:
bool aCanAbort = true );
~WX_PROGRESS_REPORTER();
/** change the title displayed on the window caption
*/
virtual void SetTitle( const wxString& aTitle ) override
{
wxProgressDialog::SetTitle( aTitle );
}
private:
virtual bool updateUI() override;

View File

@ -866,7 +866,8 @@ void AR_AUTOPLACER::drawPlacementRoutingMatrix( )
}
}
AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*> aModules, BOARD_COMMIT* aCommit, bool aPlaceOffboardModules )
AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*> aModules,
BOARD_COMMIT* aCommit, bool aPlaceOffboardModules )
{
wxPoint PosOK;
wxPoint memopos;
@ -943,12 +944,17 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*> aModules, BOARD_
m_progressReporter->SetMaxProgress( moduleCount );
}
wxSafeYield(); // allows refreshing screen and UI
while( ( module = pickModule( ) ) != nullptr )
{
// Display some info about activity, module placement can take a while:
//printf( _( "Place footprint %d of %d [%s]\n" ), cnt, moduleCount, (const char *)module->GetReference().c_str() );
//m_frame->SetStatusText( msg );
if( m_progressReporter )
m_progressReporter->SetTitle( wxString::Format(
_( "Autoplacing %s" ), module->GetReference() ) );
double initialOrient = module->GetOrientation();
// Display fill area of interest, barriers, penalties.
//drawPlacementRoutingMatrix( );
@ -990,6 +996,7 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*> aModules, BOARD_
// Determine if the best orientation of a module is 90.
rotAllowed = module->GetPlacementCost90();
if( rotAllowed != 0 )
{
rotateModule( module, 900.0, true );
@ -1055,10 +1062,10 @@ end_of_tst:
module->SetIsPlaced( true );
module->SetNeedsPlaced( false );
if( m_progressReporter )
{
m_progressReporter->AdvanceProgress();
if ( !m_progressReporter->KeepRefreshing( false ) )
{
cancelled = true;
@ -1066,6 +1073,8 @@ end_of_tst:
}
}
cnt++;
wxSafeYield(); // allows refreshing screen and UI
}
m_curPosition = memopos;