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