PCB items are refreshed on GAL switching (changes made using default renderer are displayed by GAL).
This commit is contained in:
parent
4f0aa1c07c
commit
5659dd479e
|
@ -981,18 +981,18 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
|||
// Switch to GAL rendering
|
||||
if( !m_galCanvasActive )
|
||||
{
|
||||
// Change view settings only if GAL was not active previously
|
||||
double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
|
||||
view->SetScale( zoom );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
}
|
||||
|
||||
// Set up grid settings
|
||||
gal->SetGridVisibility( IsGridVisible() );
|
||||
gal->SetGridSize( VECTOR2D( screen->GetGridSize().x, screen->GetGridSize().y ) );
|
||||
gal->SetGridOrigin( VECTOR2D( screen->GetGridOrigin() ) );
|
||||
gal->SetGridOriginMarkerSize( 15 );
|
||||
gal->SetGridDrawThreshold( 10 );
|
||||
|
||||
// Set up viewport
|
||||
double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
|
||||
view->SetScale( zoom );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -174,6 +174,8 @@ public:
|
|||
return m_Pcb;
|
||||
}
|
||||
|
||||
void ViewReloadBoard( const BOARD* aBoard ) const;
|
||||
|
||||
// General
|
||||
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
|
||||
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) { }
|
||||
|
@ -671,6 +673,8 @@ public:
|
|||
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
|
|
@ -903,7 +903,7 @@ public:
|
|||
*
|
||||
* @param aEnable True for GAL-based canvas, false for standard canvas.
|
||||
*/
|
||||
void UseGalCanvas( bool aEnable );
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
|
||||
/**
|
||||
* Function IsNewCanvasActive
|
||||
|
|
|
@ -136,31 +136,44 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
|||
if( m_galCanvas )
|
||||
{
|
||||
KiGfx::VIEW* view = m_galCanvas->GetView();
|
||||
|
||||
ViewReloadBoard( m_Pcb );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
if( m_toolManager )
|
||||
m_toolManager->SetEnvironment( m_Pcb, view, m_galCanvas->GetViewControls(), this );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
|
||||
{
|
||||
KiGfx::VIEW* view = m_galCanvas->GetView();
|
||||
view->Clear();
|
||||
|
||||
// All of PCB drawing elements should be added to the VIEW
|
||||
// in order to be displayed
|
||||
|
||||
// Load zones
|
||||
for( int i = 0; i < m_Pcb->GetAreaCount(); ++i )
|
||||
for( int i = 0; i < aBoard->GetAreaCount(); ++i )
|
||||
{
|
||||
view->Add( (KiGfx::VIEW_ITEM*) ( m_Pcb->GetArea( i ) ) );
|
||||
view->Add( (KiGfx::VIEW_ITEM*) ( aBoard->GetArea( i ) ) );
|
||||
}
|
||||
|
||||
// Load drawings
|
||||
for( BOARD_ITEM* drawing = m_Pcb->m_Drawings; drawing; drawing = drawing->Next() )
|
||||
for( BOARD_ITEM* drawing = aBoard->m_Drawings; drawing; drawing = drawing->Next() )
|
||||
{
|
||||
view->Add( drawing );
|
||||
}
|
||||
|
||||
// Load tracks
|
||||
for( TRACK* track = m_Pcb->m_Track; track; track = track->Next() )
|
||||
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
|
||||
{
|
||||
view->Add( track );
|
||||
}
|
||||
|
||||
// Load modules and its additional elements
|
||||
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
|
||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
// Load module's pads
|
||||
for( D_PAD* pad = module->Pads().GetFirst(); pad; pad = pad->Next() )
|
||||
|
@ -184,20 +197,15 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
|||
}
|
||||
|
||||
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
|
||||
for( SEGZONE* zone = m_Pcb->m_Zone; zone; zone = zone->Next() )
|
||||
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() )
|
||||
{
|
||||
view->Add( zone );
|
||||
}
|
||||
|
||||
view->RecacheAllItems( true );
|
||||
|
||||
if( m_galCanvasActive )
|
||||
m_galCanvas->Refresh();
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
if( m_toolManager )
|
||||
m_toolManager->SetEnvironment( m_Pcb, view, m_galCanvas->GetViewControls(), this );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -523,6 +531,14 @@ void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
|
||||
ViewReloadBoard( m_Pcb );
|
||||
}
|
||||
|
||||
|
||||
void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent )
|
||||
{
|
||||
int id = aEvent.GetId();
|
||||
|
|
Loading…
Reference in New Issue