Performance improvements for Gerber loading.
The entire issue (at least on OSX) was the layers palette. Go figure. Fixes https://gitlab.com/kicad/code/kicad/issues/1892
This commit is contained in:
parent
67f2d454e9
commit
cf7ffda5f6
|
@ -39,9 +39,10 @@ INDICATOR_ICON::INDICATOR_ICON( wxWindow* aParent, ICON_PROVIDER& aIconProvider,
|
|||
|
||||
sizer->Add( m_bitmap, 0, 0 );
|
||||
|
||||
auto evtSkipper = [this] ( wxEvent& aEvent ) {
|
||||
wxPostEvent( this, aEvent );
|
||||
};
|
||||
auto evtSkipper = [this] ( wxEvent& aEvent )
|
||||
{
|
||||
wxPostEvent( this, aEvent );
|
||||
};
|
||||
|
||||
m_bitmap->Bind( wxEVT_LEFT_DOWN, evtSkipper );
|
||||
}
|
||||
|
@ -166,16 +167,11 @@ const wxBitmap& ROW_ICON_PROVIDER::GetIndicatorIcon( INDICATOR_ICON::ICON_ID aId
|
|||
{
|
||||
switch( aId )
|
||||
{
|
||||
case STATE::UP:
|
||||
return m_upArrowBitmap;
|
||||
case STATE::DOWN:
|
||||
return m_downArrowBitmap;
|
||||
case STATE::ON:
|
||||
return m_rightArrowBitmap;
|
||||
case STATE::DIMMED:
|
||||
return m_dotBitmap;
|
||||
case STATE::OFF:
|
||||
default:
|
||||
return m_blankBitmap;
|
||||
case STATE::UP: return m_upArrowBitmap;
|
||||
case STATE::DOWN: return m_downArrowBitmap;
|
||||
case STATE::ON: return m_rightArrowBitmap;
|
||||
case STATE::DIMMED: return m_dotBitmap;
|
||||
case STATE::OFF: return m_blankBitmap;
|
||||
default: return m_blankBitmap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
#include <dialogs/panel_gerbview_settings.h>
|
||||
#include <dialogs/panel_gerbview_display_options.h>
|
||||
#include <panel_hotkeys_editor.h>
|
||||
|
||||
#include <wx/wupdlock.h>
|
||||
|
||||
GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
|
||||
: EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ), wxDefaultPosition,
|
||||
|
@ -350,6 +350,8 @@ void GERBVIEW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
void GERBVIEW_FRAME::ReFillLayerWidget()
|
||||
{
|
||||
wxWindowUpdateLocker no_update( m_LayersManager );
|
||||
|
||||
m_LayersManager->ReFill();
|
||||
m_SelLayerBox->Resync();
|
||||
ReCreateAuxiliaryToolbar();
|
||||
|
@ -852,7 +854,7 @@ void GERBVIEW_FRAME::SetActiveLayer( int aLayer, bool doLayerWidgetUpdate )
|
|||
( (GBR_SCREEN*) GetScreen() )->m_Active_Layer = aLayer;
|
||||
|
||||
if( doLayerWidgetUpdate )
|
||||
m_LayersManager->SelectLayer( GetActiveLayer() );
|
||||
m_LayersManager->SelectLayer( aLayer );
|
||||
|
||||
UpdateTitleAndInfo();
|
||||
|
||||
|
|
|
@ -216,22 +216,22 @@ void GERBER_LAYER_WIDGET::ReFill()
|
|||
{
|
||||
Freeze();
|
||||
|
||||
ClearLayerRows();
|
||||
|
||||
for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
|
||||
{
|
||||
int aRow = findLayerRow( layer );
|
||||
bool visible = true;
|
||||
COLOR4D color = myframe->GetLayerColor( GERBER_DRAW_LAYER( layer ) );
|
||||
wxString msg = GetImagesList()->GetDisplayName( layer );
|
||||
|
||||
bool visible = true;
|
||||
|
||||
if( myframe->GetCanvas() )
|
||||
visible = myframe->GetCanvas()->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( layer ) );
|
||||
else
|
||||
visible = myframe->IsLayerVisible( layer );
|
||||
|
||||
AppendLayerRow( LAYER_WIDGET::ROW( msg, layer,
|
||||
myframe->GetLayerColor( GERBER_DRAW_LAYER( layer ) ),
|
||||
wxEmptyString, visible, true ) );
|
||||
if( aRow >= 0 )
|
||||
updateLayerRow( findLayerRow( layer ), msg );
|
||||
else
|
||||
AppendLayerRow( LAYER_WIDGET::ROW( msg, layer, color, wxEmptyString, visible, true ) );
|
||||
}
|
||||
|
||||
UpdateLayouts();
|
||||
|
|
|
@ -182,13 +182,14 @@ void LAYER_WIDGET::OnRightDownRender( wxMouseEvent& aEvent, COLOR_SWATCH* aColor
|
|||
_( "Change Render Color for " ) + aRenderName,
|
||||
KiBitmap( setcolor_board_body_xpm ) );
|
||||
|
||||
menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event ) {
|
||||
if ( event.GetId() == ID_CHANGE_RENDER_COLOR ) {
|
||||
aColorSwatch->GetNewSwatchColor();
|
||||
} else {
|
||||
event.Skip();
|
||||
}
|
||||
} );
|
||||
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
|
||||
[aColorSwatch]( wxCommandEvent& event )
|
||||
{
|
||||
if( event.GetId() == ID_CHANGE_RENDER_COLOR )
|
||||
aColorSwatch->GetNewSwatchColor();
|
||||
else
|
||||
event.Skip();
|
||||
} );
|
||||
|
||||
PopupMenu( &menu );
|
||||
passOnFocus();
|
||||
|
@ -209,18 +210,22 @@ void LAYER_WIDGET::OnRenderSwatchChanged( wxCommandEvent& aEvent )
|
|||
int count = GetLayerRowCount();
|
||||
int row;
|
||||
int col = 1; // bitmap button is column 1 in layers tab
|
||||
|
||||
for( row = 0; row < count; ++row )
|
||||
{
|
||||
COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
|
||||
|
||||
if( swatch )
|
||||
swatch->SetSwatchBackground( newColor );
|
||||
}
|
||||
|
||||
count = GetRenderRowCount();
|
||||
col = 0; // bitmap button is column 0 in render tab
|
||||
|
||||
for( row = 0; row < count; ++row )
|
||||
{
|
||||
COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getRenderComp( row, col ) );
|
||||
|
||||
if( swatch )
|
||||
swatch->SetSwatchBackground( newColor );
|
||||
}
|
||||
|
@ -359,18 +364,43 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
|
|||
// Bind right click eventhandler to all columns
|
||||
wxString layerName( aSpec.rowName );
|
||||
|
||||
sbm->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
st->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
sbm->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt )
|
||||
{
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt )
|
||||
{
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt )
|
||||
{
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
st->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt )
|
||||
{
|
||||
OnRightDownLayer( aEvt, bmb, layerName );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
void LAYER_WIDGET::updateLayerRow( int aRow, const wxString& aName )
|
||||
{
|
||||
wxStaticText* label = dynamic_cast<wxStaticText*>( getLayerComp( aRow, COLUMN_COLOR_LYRNAME ) );
|
||||
|
||||
if( label )
|
||||
label->SetLabel( aName );
|
||||
|
||||
INDICATOR_ICON* indicator = (INDICATOR_ICON*) getLayerComp( aRow, 0 );
|
||||
|
||||
if( indicator )
|
||||
{
|
||||
if( aRow == m_CurrentRow )
|
||||
indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::ON );
|
||||
if( useAlternateBitmap( aRow ) )
|
||||
indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::DIMMED );
|
||||
else
|
||||
indicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::OFF );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -638,6 +668,7 @@ void LAYER_WIDGET::SelectLayerRow( int aRow )
|
|||
m_notebook->SetSelection( 0 );
|
||||
|
||||
INDICATOR_ICON* oldIndicator = (INDICATOR_ICON*) getLayerComp( m_CurrentRow, 0 );
|
||||
|
||||
if( oldIndicator )
|
||||
{
|
||||
if( useAlternateBitmap( m_CurrentRow ) )
|
||||
|
@ -647,6 +678,7 @@ void LAYER_WIDGET::SelectLayerRow( int aRow )
|
|||
}
|
||||
|
||||
INDICATOR_ICON* newIndicator = (INDICATOR_ICON*) getLayerComp( aRow, 0 );
|
||||
|
||||
if( newIndicator )
|
||||
{
|
||||
newIndicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::ON );
|
||||
|
|
|
@ -238,6 +238,8 @@ protected:
|
|||
|
||||
void setLayerCheckbox( LAYER_NUM aLayer, bool isVisible );
|
||||
|
||||
void updateLayerRow( int aRow, const wxString& aName );
|
||||
|
||||
/**
|
||||
* Function passOnFocus
|
||||
* gives away the keyboard focus up to the main parent window.
|
||||
|
|
Loading…
Reference in New Issue