Library viewer: fix broken behavior of unit selector (could be Windows specific).

Remove a useless message in debug mode about LIB_ALIAS bounding box.
This commit is contained in:
jean-pierre charras 2018-10-30 17:51:12 +01:00
parent 49c94fb928
commit 7b10490256
3 changed files with 23 additions and 6 deletions

View File

@ -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

View File

@ -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.
*

View File

@ -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 <stambaughw@gmail.com>
* 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 <view/view_controls.h>
#include <sch_painter.h>
// 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;