Fixes: lp:1694456

https://bugs.launchpad.net/kicad/+bug/1694456

EEschema load: report "unit value out of range" in sub-sheet, although it is not the case.
This commit is contained in:
jean-pierre charras 2017-05-31 10:20:49 +02:00
parent e6baaa6164
commit c0bb8a30c2
2 changed files with 4 additions and 3 deletions

View File

@ -35,7 +35,7 @@
#include <general.h>
#include <libeditframe.h>
#include <class_library.h>
#include <eeschema_id.h> // for ID_POPUP_SCH_SELECT_UNIT_CMP_MAX and ID_POPUP_SCH_SELECT_UNIT1
#include <eeschema_id.h> // for MAX_UNIT_COUNT_PER_PACKAGE definition
#include <dialog_edit_component_in_lib.h>
@ -158,7 +158,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
if( m_Parent->GetShowDeMorgan() )
m_AsConvertButt->SetValue( true );
int maxUnits = ID_POPUP_SCH_SELECT_UNIT_CMP_MAX - ID_POPUP_SCH_SELECT_UNIT1;
int maxUnits = MAX_UNIT_COUNT_PER_PACKAGE;
m_SelNumberOfUnits->SetRange (1, maxUnits );
m_staticTextNbUnits->SetLabel( wxString::Format(

View File

@ -57,6 +57,7 @@
#include <lib_polyline.h>
#include <lib_rectangle.h>
#include <lib_text.h>
#include <eeschema_id.h> // for MAX_UNIT_COUNT_PER_PACKAGE definition
// Must be the first line of part library document (.dcm) files.
@ -1397,7 +1398,7 @@ SCH_COMPONENT* SCH_LEGACY_PLUGIN::loadComponent( FILE_LINE_READER& aReader )
if( !unit.ToLong( &tmp, 10 ) )
SCH_PARSE_ERROR( "expected integer value", aReader, line );
if( tmp < 0 || tmp > 26 )
if( tmp < 0 || tmp > MAX_UNIT_COUNT_PER_PACKAGE )
SCH_PARSE_ERROR( "unit value out of range", aReader, line );
component->AddHierarchicalReference( path, reference, (int)tmp );