Commit 72605c34 authored by jean-pierre charras's avatar jean-pierre charras

Modview: fix minor issues.

parent 623ae37f
......@@ -109,7 +109,6 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentLibrary( wxCommandEvent& event )
*/
void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
{
wxString libname = m_libraryName + wxT(".") + ModuleFileExtension;
MODULE* oldmodule = GetBoard()->m_Modules;
MODULE * module = Load_Module_From_Library( libname, false );
......@@ -126,10 +125,12 @@ void FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint( wxCommandEvent& event )
m_footprintName = module->GetLibRef();
module->ClearFlags();
SetCurItem( NULL );
}
Zoom_Automatique( false );
m_canvas->Refresh( );
Update3D_Frame();
m_FootprintList->SetStringSelection( m_footprintName );
}
}
......
......@@ -512,12 +512,26 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
EDA_DRAW_FRAME::OnActivate( event );
// Ensure we do not have old selection:
if( m_FrameIsActive )
if( ! m_FrameIsActive )
return;
m_selectedFootprintName.Empty();
if( m_LibList )
ReCreateLibraryList();
// Ensure we have the right library list:
if( g_LibraryNames.GetCount() == m_LibList->GetCount() )
{
unsigned ii;
for( ii = 0; ii < g_LibraryNames.GetCount(); ii++ )
{
if( m_LibList->GetString(ii) != g_LibraryNames[ii] )
break;
}
if( ii == g_LibraryNames.GetCount() )
return;
}
// If we are here, the library list has changed, rebuild it
ReCreateLibraryList();
DisplayLibInfos();
}
......@@ -631,7 +645,7 @@ void FOOTPRINT_VIEWER_FRAME::Show3D_Frame( wxCommandEvent& event )
}
m_Draw3DFrame = new EDA_3D_FRAME( this, wxEmptyString );
Update3D_Frame();
Update3D_Frame( false );
m_Draw3DFrame->Show( true );
}
......@@ -640,7 +654,7 @@ void FOOTPRINT_VIEWER_FRAME::Show3D_Frame( wxCommandEvent& event )
* must be called after a footprint selection
* Updates the 3D view and 3D frame title.
*/
void FOOTPRINT_VIEWER_FRAME::Update3D_Frame()
void FOOTPRINT_VIEWER_FRAME::Update3D_Frame( bool aForceReloadFootprint )
{
if( m_Draw3DFrame == NULL )
return;
......@@ -648,8 +662,12 @@ void FOOTPRINT_VIEWER_FRAME::Update3D_Frame()
wxString frm3Dtitle;
frm3Dtitle.Printf( _( "ModView: 3D Viewer [%s]" ), GetChars( m_footprintName ) );
m_Draw3DFrame->SetTitle( frm3Dtitle );
if( aForceReloadFootprint )
{
m_Draw3DFrame->ReloadRequest();
// Force 3D screen refresh immediately
if( GetBoard()->m_Modules )
m_Draw3DFrame->NewDisplay();
}
}
......@@ -161,8 +161,10 @@ private:
* Function Update3D_Frame
* must be called after a footprint selection
* Updates the 3D view and 3D frame title.
* @param aForceReloadFootprint = true to reload data (default)
* = false to update title only -(aftre creating the 3D viewer)
*/
void Update3D_Frame();
void Update3D_Frame( bool aForceReloadFootprint = true );
/*
* Virtual functions, not used here, but needed by PCB_BASE_FRAME
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment