Added autozooming and display of the last chosen module for module viewer using GAL.

This commit is contained in:
Maciej Suminski 2014-07-09 11:22:42 +02:00
parent 13e67e1f3c
commit 8059f4ddd4
1 changed files with 7 additions and 15 deletions

View File

@ -151,7 +151,6 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
SetGalCanvas( drawPanel ); SetGalCanvas( drawPanel );
SetBoard( new BOARD() ); SetBoard( new BOARD() );
drawPanel->DisplayBoard( m_Pcb );
// Ensure all layers and items are visible: // Ensure all layers and items are visible:
GetBoard()->SetVisibleAlls(); GetBoard()->SetVisibleAlls();
@ -178,6 +177,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
id.SetLibNickname( getCurNickname() ); id.SetLibNickname( getCurNickname() );
id.SetFootprintName( getCurFootprintName() ); id.SetFootprintName( getCurFootprintName() );
GetBoard()->Add( loadFootprint( id ) ); GetBoard()->Add( loadFootprint( id ) );
drawPanel->DisplayBoard( m_Pcb );
} }
if( m_canvas ) if( m_canvas )
@ -438,17 +438,13 @@ void FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList( wxCommandEvent& event )
if( IsGalCanvasActive() ) if( IsGalCanvasActive() )
{ {
KIGFX::VIEW* view = GetGalCanvas()->GetView(); static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->DisplayBoard( m_Pcb );
view->Clear();
// Load modules and its additional elements // Autozoom
for( MODULE* module = GetBoard()->m_Modules; module; module = module->Next() ) m_Pcb->ComputeBoundingBox( false );
{ EDA_RECT boardBbox = m_Pcb->GetBoundingBox();
module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) ); GetGalCanvas()->GetView()->SetViewport( BOX2D( boardBbox.GetOrigin(),
view->Add( module ); boardBbox.GetSize() ) );
}
// view->Add( loadFootprint( id ) );
} }
Zoom_Automatique( false ); Zoom_Automatique( false );
@ -864,9 +860,5 @@ void FOOTPRINT_VIEWER_FRAME::UseGalCanvas( bool aEnable )
EDA_DRAW_FRAME::UseGalCanvas( aEnable ); EDA_DRAW_FRAME::UseGalCanvas( aEnable );
if( aEnable ) if( aEnable )
{
SetBoard( m_Pcb );
GetGalCanvas()->StartDrawing(); GetGalCanvas()->StartDrawing();
}
} }