Open viewer even when FPID is invalid.
Just show an empty viewer.
This commit is contained in:
parent
a0364a1137
commit
d2d0660647
|
@ -617,20 +617,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler( wxCommandEvent& even
|
|||
|
||||
KIWAY_PLAYER* frame = Kiway().Player( FRAME_PCB_MODULE_VIEWER_MODAL, true, this );
|
||||
|
||||
try
|
||||
if( frame->ShowModal( &fpid, this ) )
|
||||
{
|
||||
if( frame->ShowModal( &fpid, this ) )
|
||||
{
|
||||
// DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
|
||||
fieldValueTextCtrl->SetValue( fpid );
|
||||
// DBG( printf( "%s: %s\n", __func__, TO_UTF8( fpid ) ); )
|
||||
fieldValueTextCtrl->SetValue( fpid );
|
||||
|
||||
setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid );
|
||||
}
|
||||
}
|
||||
catch( const IO_ERROR& aError )
|
||||
{
|
||||
// it may happen that the specified footprint is not available in the loaded
|
||||
// footprint libraries, no big deal
|
||||
setRowItem( fieldNdx, m_FieldsBuf[fieldNdx].GetName( false ), fpid );
|
||||
}
|
||||
|
||||
frame->Destroy();
|
||||
|
|
|
@ -626,14 +626,22 @@ bool FOOTPRINT_VIEWER_FRAME::ShowModal( wxString* aFootprint, wxWindow* aResulta
|
|||
{
|
||||
if( aFootprint && !aFootprint->IsEmpty() )
|
||||
{
|
||||
LIB_ID fpid( *aFootprint );
|
||||
|
||||
if( fpid.IsValid() )
|
||||
try
|
||||
{
|
||||
setCurNickname( fpid.GetLibNickname() );
|
||||
setCurFootprintName( fpid.GetLibItemName() );
|
||||
ReCreateFootprintList();
|
||||
SelectAndViewFootprint( NEW_PART );
|
||||
LIB_ID fpid( *aFootprint );
|
||||
|
||||
if( fpid.IsValid() )
|
||||
{
|
||||
setCurNickname( fpid.GetLibNickname() );
|
||||
setCurFootprintName( fpid.GetLibItemName() );
|
||||
ReCreateFootprintList();
|
||||
SelectAndViewFootprint( NEW_PART );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
// LIB_ID's constructor throws on some invalid footprint IDs. It'd be nicer
|
||||
// if it just set it to !IsValid(), but it is what it is.
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue