Minor tweaks to GerbView for performance

This commit is contained in:
Jon Evans 2017-09-24 21:12:58 -04:00 committed by Maciej Suminski
parent 1994cc3ae2
commit e5df4304a6
4 changed files with 14 additions and 10 deletions

View File

@ -220,6 +220,9 @@ bool GERBVIEW_FRAME::LoadGerberFiles( const wxString& aFullFileName )
m_mruPath = currentPath; m_mruPath = currentPath;
} }
// Set the busy cursor
wxBusyCursor wait;
// Read gerber files: each file is loaded on a new GerbView layer // Read gerber files: each file is loaded on a new GerbView layer
bool success = true; bool success = true;
int layer = GetActiveLayer(); int layer = GetActiveLayer();

View File

@ -820,12 +820,11 @@ void GERBVIEW_FRAME::SetActiveLayer( int aLayer, bool doLayerWidgetUpdate )
m_toolManager->RunAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools m_toolManager->RunAction( GERBVIEW_ACTIONS::layerChanged ); // notify other tools
GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere GetGalCanvas()->SetFocus(); // otherwise hotkeys are stuck somewhere
// NOTE(JE) The next two calls are slow (scales with number of items)
GetGalCanvas()->SetTopLayer( GERBER_DRAW_LAYER( aLayer ) ); GetGalCanvas()->SetTopLayer( GERBER_DRAW_LAYER( aLayer ) );
GetGalCanvas()->SetHighContrastLayer( GERBER_DRAW_LAYER( aLayer ) ); GetGalCanvas()->SetHighContrastLayer( GERBER_DRAW_LAYER( aLayer ) );
GetGalCanvas()->Refresh();
GetGalCanvas()->GetView()->RecacheAllItems(); GetGalCanvas()->Refresh();
} }
} }

View File

@ -704,7 +704,6 @@ EDA_ITEM* GERBVIEW_SELECTION_TOOL::disambiguationMenu( GERBER_COLLECTOR* aCollec
getView()->Remove( &highlightGroup ); getView()->Remove( &highlightGroup );
return current; return current;
} }
@ -732,9 +731,9 @@ void GERBVIEW_SELECTION_TOOL::select( EDA_ITEM* aItem )
return; return;
} }
selectVisually( aItem );
m_selection.Add( aItem ); m_selection.Add( aItem );
getView()->Add( &m_selection ); getView()->Add( &m_selection );
selectVisually( aItem );
if( m_selection.Size() == 1 ) if( m_selection.Size() == 1 )
{ {
@ -765,7 +764,7 @@ void GERBVIEW_SELECTION_TOOL::unselect( EDA_ITEM* aItem )
} }
void GERBVIEW_SELECTION_TOOL::selectVisually( EDA_ITEM* aItem ) const void GERBVIEW_SELECTION_TOOL::selectVisually( EDA_ITEM* aItem )
{ {
// Move the item's layer to the front // Move the item's layer to the front
int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer(); int layer = static_cast<GERBER_DRAW_ITEM*>( aItem )->GetLayer();
@ -774,16 +773,19 @@ void GERBVIEW_SELECTION_TOOL::selectVisually( EDA_ITEM* aItem ) const
// Hide the original item, so it is shown only on overlay // Hide the original item, so it is shown only on overlay
aItem->SetSelected(); aItem->SetSelected();
getView()->Hide( aItem, true ); getView()->Hide( aItem, true );
getView()->Update( aItem, KIGFX::GEOMETRY );
getView()->Update( &m_selection );
} }
void GERBVIEW_SELECTION_TOOL::unselectVisually( EDA_ITEM* aItem ) const void GERBVIEW_SELECTION_TOOL::unselectVisually( EDA_ITEM* aItem )
{ {
// Restore original item visibility // Restore original item visibility
aItem->ClearSelected(); aItem->ClearSelected();
getView()->Hide( aItem, false ); getView()->Hide( aItem, false );
getView()->Update( aItem, KIGFX::ALL ); getView()->Update( aItem, KIGFX::ALL );
getView()->Update( &m_selection );
} }

View File

@ -203,14 +203,14 @@ private:
* Marks item as selected, but does not add it to the ITEMS_PICKED_LIST. * Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
* @param aItem is an item to be be marked. * @param aItem is an item to be be marked.
*/ */
void selectVisually( EDA_ITEM* aItem ) const; void selectVisually( EDA_ITEM* aItem );
/** /**
* Function unselectVisually() * Function unselectVisually()
* Marks item as selected, but does not add it to the ITEMS_PICKED_LIST. * Marks item as selected, but does not add it to the ITEMS_PICKED_LIST.
* @param aItem is an item to be be marked. * @param aItem is an item to be be marked.
*/ */
void unselectVisually( EDA_ITEM* aItem ) const; void unselectVisually( EDA_ITEM* aItem );
/** /**
* Function selectionContains() * Function selectionContains()