diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 4a6ef1e9e5..8696b16a48 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -147,6 +147,15 @@ wxString LIB_ALIAS::GetUnitReference( int aUnit ) } +const EDA_RECT LIB_ALIAS::GetBoundingBox() const +{ + // a LIB_ALIAS does not really have a bounding box. + // return a 0 size rect. + EDA_RECT dummy; + return dummy; +}; + + wxString LIB_ALIAS::GetSearchText() { // Matches are scored by offset from front of string, so inclusion of this spacer diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index cc2743ddd3..60df422b93 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -101,6 +101,11 @@ public: return wxT( "LIB_ALIAS" ); } + // a LIB_ALIAS does not really have a bounding box. + // But because it is derived from EDA_ITEM, returns a dummy bounding box + // to avoid useless messages in debug mode + const EDA_RECT GetBoundingBox() const override; + /** * Get the shared LIB_PART. * diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 4496393aa6..6b1da33031 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -1,9 +1,9 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr + * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -48,6 +48,7 @@ #include #include + // Save previous component library viewer state. wxString LIB_VIEW_FRAME::m_libraryName; wxString LIB_VIEW_FRAME::m_entryName; @@ -374,16 +375,18 @@ void LIB_VIEW_FRAME::onUpdateUnitChoice( wxUpdateUIEvent& aEvent ) if( unit_count > 1 ) { - // rebuild the unit list if it is not suitable + // rebuild the unit list if it is not suitable (after a new selection for instance) if( unit_count != (int)m_unitChoice->GetCount() ) { m_unitChoice->Clear(); for( int ii = 0; ii < unit_count; ii++ ) m_unitChoice->Append( wxString::Format( _( "Unit %c" ), 'A' + ii ) ); + } - m_unitChoice->SetSelection( std::max( 0, m_unit - 1 ) ); + if( m_unitChoice->GetSelection() != std::max( 0, m_unit - 1 ) ) + m_unitChoice->SetSelection( std::max( 0, m_unit - 1 ) ); } else if( m_unitChoice->GetCount() ) m_unitChoice->Clear(); @@ -510,8 +513,6 @@ bool LIB_VIEW_FRAME::ReCreateListCmp() if( m_cmpList == NULL ) return false; - m_cmpList->Clear(); - wxArrayString aliasNames; try @@ -521,6 +522,8 @@ bool LIB_VIEW_FRAME::ReCreateListCmp() } catch( const IO_ERROR& ) {} // ignore, it is handled below + m_cmpList->Clear(); + if( aliasNames.IsEmpty() ) { m_libraryName = wxEmptyString;