Commit d583280b authored by Maciej Suminski's avatar Maciej Suminski

Minor code cleaning and optimizations.

parent de637d2b
...@@ -127,11 +127,10 @@ void VIEW::Remove( VIEW_ITEM* aItem ) ...@@ -127,11 +127,10 @@ void VIEW::Remove( VIEW_ITEM* aItem )
int prevGroup = aItem->getGroup( layers[i] ); int prevGroup = aItem->getGroup( layers[i] );
if( prevGroup >= 0 ) if( prevGroup >= 0 )
{
m_gal->DeleteGroup( prevGroup ); m_gal->DeleteGroup( prevGroup );
aItem->setGroup( layers[i], -1 );
}
} }
aItem->deleteGroups();
} }
...@@ -199,13 +198,9 @@ VECTOR2D VIEW::ToWorld( const VECTOR2D& aCoord, bool aAbsolute ) const ...@@ -199,13 +198,9 @@ VECTOR2D VIEW::ToWorld( const VECTOR2D& aCoord, bool aAbsolute ) const
const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix(); const MATRIX3x3D& matrix = m_gal->GetScreenWorldMatrix();
if( aAbsolute ) if( aAbsolute )
{
return VECTOR2D( matrix * aCoord ); return VECTOR2D( matrix * aCoord );
}
else else
{
return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y ); return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
}
} }
...@@ -214,13 +209,9 @@ VECTOR2D VIEW::ToScreen( const VECTOR2D& aCoord, bool aAbsolute ) const ...@@ -214,13 +209,9 @@ VECTOR2D VIEW::ToScreen( const VECTOR2D& aCoord, bool aAbsolute ) const
const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix(); const MATRIX3x3D& matrix = m_gal->GetWorldScreenMatrix();
if( aAbsolute ) if( aAbsolute )
{
return VECTOR2D( matrix * aCoord ); return VECTOR2D( matrix * aCoord );
}
else else
{
return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y ); return VECTOR2D( matrix.GetScale().x * aCoord.x, matrix.GetScale().y * aCoord.y );
}
} }
...@@ -699,6 +690,7 @@ struct VIEW::recacheItem ...@@ -699,6 +690,7 @@ struct VIEW::recacheItem
} }
else else
{ {
aItem->ViewUpdate( VIEW_ITEM::ALL );
aItem->setGroup( layer, -1 ); aItem->setGroup( layer, -1 );
} }
...@@ -730,6 +722,7 @@ void VIEW::Clear() ...@@ -730,6 +722,7 @@ void VIEW::Clear()
} }
m_gal->ClearCache(); m_gal->ClearCache();
m_needsUpdate.clear();
} }
...@@ -889,7 +882,10 @@ void VIEW::updateItemGeometry( VIEW_ITEM* aItem, int aLayer ) ...@@ -889,7 +882,10 @@ void VIEW::updateItemGeometry( VIEW_ITEM* aItem, int aLayer )
group = m_gal->BeginGroup(); group = m_gal->BeginGroup();
aItem->setGroup( aLayer, group ); aItem->setGroup( aLayer, group );
m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), aLayer );
if( !m_painter->Draw( static_cast<EDA_ITEM*>( aItem ), aLayer ) );
aItem->ViewDraw( aLayer, m_gal ); // Alternative drawing method
m_gal->EndGroup(); m_gal->EndGroup();
} }
...@@ -900,7 +896,7 @@ void VIEW::updateBbox( VIEW_ITEM* aItem ) ...@@ -900,7 +896,7 @@ void VIEW::updateBbox( VIEW_ITEM* aItem )
aItem->ViewGetLayers( layers, layers_count ); aItem->ViewGetLayers( layers, layers_count );
for( int i = 0; i < layers_count; i++ ) for( int i = 0; i < layers_count; ++i )
{ {
VIEW_LAYER& l = m_layers[layers[i]]; VIEW_LAYER& l = m_layers[layers[i]];
l.items->Remove( aItem ); l.items->Remove( aItem );
...@@ -917,7 +913,7 @@ void VIEW::updateLayers( VIEW_ITEM* aItem ) ...@@ -917,7 +913,7 @@ void VIEW::updateLayers( VIEW_ITEM* aItem )
// Remove the item from previous layer set // Remove the item from previous layer set
aItem->getLayers( layers, layers_count ); aItem->getLayers( layers, layers_count );
for( int i = 0; i < layers_count; i++ ) for( int i = 0; i < layers_count; ++i )
{ {
VIEW_LAYER& l = m_layers[layers[i]]; VIEW_LAYER& l = m_layers[layers[i]];
l.items->Remove( aItem ); l.items->Remove( aItem );
......
...@@ -578,13 +578,7 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const ...@@ -578,13 +578,7 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
std::string( aBoard->GetFileName().mb_str() ), std::string( aBoard->GetFileName().mb_str() ),
std::string( GetScreenDesc().mb_str() ), std::string( GetScreenDesc().mb_str() ),
&GetPageSettings(), &GetTitleBlock() ); &GetPageSettings(), &GetTitleBlock() );
BASE_SCREEN* screen = GetScreen(); worksheet->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
if( screen != NULL )
{
worksheet->SetSheetNumber( GetScreen()->m_ScreenNumber );
worksheet->SetSheetCount( GetScreen()->m_NumberOfScreens );
}
view->Add( worksheet ); view->Add( worksheet );
// Add an entry for the ratsnest // Add an entry for the ratsnest
...@@ -715,10 +709,10 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable ) ...@@ -715,10 +709,10 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
{ {
EDA_DRAW_FRAME::UseGalCanvas( aEnable ); EDA_DRAW_FRAME::UseGalCanvas( aEnable );
ViewReloadBoard( m_Pcb );
if( aEnable ) if( aEnable )
{ {
ViewReloadBoard( m_Pcb );
// Update potential changes in the ratsnest // Update potential changes in the ratsnest
m_Pcb->GetRatsnest()->Recalculate(); m_Pcb->GetRatsnest()->Recalculate();
......
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