From ae7cc5c868787b6597e20697fde5268fcddf7e28 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 29 Dec 2017 10:26:05 -0500 Subject: [PATCH] Eeschema: only show the symbol library load progress dialog once. --- eeschema/cmp_tree_model_adapter_base.cpp | 23 ++++++++++++++++------- eeschema/cmp_tree_model_adapter_base.h | 5 +++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/eeschema/cmp_tree_model_adapter_base.cpp b/eeschema/cmp_tree_model_adapter_base.cpp index 3e4293f501..0e95de0126 100644 --- a/eeschema/cmp_tree_model_adapter_base.cpp +++ b/eeschema/cmp_tree_model_adapter_base.cpp @@ -30,6 +30,7 @@ CMP_TREE_MODEL_ADAPTER_BASE::WIDTH_CACHE CMP_TREE_MODEL_ADAPTER_BASE::m_width_cache; +bool CMP_TREE_MODEL_ADAPTER_BASE::m_show_progress = true; static const int kDataViewIndent = 20; @@ -109,21 +110,29 @@ void CMP_TREE_MODEL_ADAPTER_BASE::SetPreselectNode( LIB_ID const& aLibId, int aU void CMP_TREE_MODEL_ADAPTER_BASE::AddLibrariesWithProgress( const std::vector& aNicknames, wxWindow* aParent ) { - auto* prg = new wxProgressDialog( - _( "Loading symbol libraries" ), - wxEmptyString, - aNicknames.size(), - aParent ); + wxProgressDialog* prg = nullptr; + + if( m_show_progress ) + prg = new wxProgressDialog( _( "Loading Symbol Libraries" ), + wxEmptyString, + aNicknames.size(), + aParent ); unsigned int ii = 0; for( auto nickname : aNicknames ) { - prg->Update( ii++, wxString::Format( _( "Loading library \"%s\"" ), nickname ) ); + if( prg ) + prg->Update( ii++, wxString::Format( _( "Loading library \"%s\"" ), nickname ) ); + AddLibrary( nickname ); } - prg->Destroy(); + if( prg ) + { + prg->Destroy(); + m_show_progress = false; + } } diff --git a/eeschema/cmp_tree_model_adapter_base.h b/eeschema/cmp_tree_model_adapter_base.h index 026be485c8..dd611c11ec 100644 --- a/eeschema/cmp_tree_model_adapter_base.h +++ b/eeschema/cmp_tree_model_adapter_base.h @@ -348,6 +348,11 @@ private: static WIDTH_CACHE m_width_cache; + /** + * Flag to only show the symbol library table load progress dialog the first time. + */ + static bool m_show_progress; + /** * Compute the width required for the given column of a node and its * children.