Handle active layer overloading

Setting the active layer should be tied to the events that are triggered
by the layer change and overloaded for each frame.  This ties the hotkey
back to these events.

Note: In the 5.1 cherry-pick this also adds the missing hotkey to
footprint editor

Fixes: lp:1838244
* https://bugs.launchpad.net/kicad/+bug/1838244

(cherry picked from commit 494d0de9b8)
This commit is contained in:
Seth Hillbrand 2019-08-27 21:27:39 -07:00
parent 93d191d7c9
commit 4500b064d8
4 changed files with 9 additions and 3 deletions

View File

@ -280,7 +280,7 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod
return;
wxPoint seg_start, seg_end;
PCB_LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
PCB_LAYER_ID curr_layer = ( ( PCB_SCREEN* ) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard();
auto frame = static_cast<PCB_BASE_FRAME*> ( panel->GetParent() );

View File

@ -1066,11 +1066,13 @@ void FOOTPRINT_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
{
PCB_BASE_FRAME::SetActiveLayer( aLayer );
m_Layers->SelectLayer( GetActiveLayer() );
m_Layers->SelectLayer( aLayer );
m_Layers->OnLayerSelected();
if( IsGalCanvasActive() )
{
m_toolManager->RunAction( PCB_ACTIONS::layerChanged ); // notify other tools
GetCanvas()->SetFocus(); // allow capture of hotkeys
GetGalCanvas()->SetHighContrastLayer( aLayer );
GetGalCanvas()->Refresh();
}

View File

@ -512,6 +512,10 @@ EDA_HOTKEY* module_edit_Hotkey_List[] = {
&HkSwitchGridToNext,
&HkSwitchGridToPrevious,
// Active Layer
&HkSwitch2ComponentLayer,
&HkSwitch2CopperLayer,
// Display
&HkSwitchHighContrastMode,
&HkCanvasDefault,

View File

@ -526,7 +526,7 @@ void PCB_BASE_FRAME::SwitchLayer( wxDC* DC, PCB_LAYER_ID layer )
// and a non-copper layer, or vice-versa?
// ...
GetScreen()->m_Active_Layer = layer;
SetActiveLayer( layer );
if( displ_opts->m_ContrastModeDisplay )
m_canvas->Refresh();