From bc6e9e855c86811edf840e5cc2aa25bcc75def9b Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Wed, 14 Oct 2015 14:12:17 -0400 Subject: [PATCH] Pcbnew: fix broken board ratsnest visibility storage behavior. * The board ratsnest visibility state was being saved in both the board file and the Pcbnew configuration files causing visibility state issues. Use the board file to save the board ratsnest visibility state. * Remove all of the board ratsnest save visibility state to configuration file code. * Add code to set the board modified property when layer visibility states change to give the user a chance to save the state in the board file. * Some minor code cleaning and coding policy fixes. --- pcbnew/class_pcb_layer_widget.cpp | 39 ++++--- pcbnew/class_pcb_layer_widget.h | 10 +- pcbnew/dialogs/dialog_general_options.cpp | 111 +------------------ pcbnew/pcbframe.cpp | 13 +-- pcbnew/tool_pcb.cpp | 125 ++++++++++++++++++---- pcbnew/toolbars_update_user_interface.cpp | 3 +- 6 files changed, 143 insertions(+), 158 deletions(-) diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp index 013326c2cb..561648e820 100644 --- a/pcbnew/class_pcb_layer_widget.cpp +++ b/pcbnew/class_pcb_layer_widget.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2010-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -54,7 +54,7 @@ /// This is a read only template that is copied and modified before adding to LAYER_WIDGET const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { -#define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width +#define RR LAYER_WIDGET::ROW // Render Row abbreviation to reduce source width // text id color tooltip RR( _( "Through Via" ), VIA_THROUGH_VISIBLE, WHITE, _( "Show through vias" ) ), @@ -85,6 +85,7 @@ static int s_allowed_in_FpEditor[] = GRID_VISIBLE, MOD_VALUES_VISIBLE, MOD_REFERENCES_VISIBLE }; + PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwner, int aPointSize, bool aFpEditorMode ) : LAYER_WIDGET( aParent, aFocusOwner, aPointSize ), @@ -113,9 +114,6 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn } -/* return true if item aId has meaning in footprint editor mode, - * i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel - */ bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId ) { for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ ) @@ -125,12 +123,7 @@ bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId ) return false; } -/* return true if item aId has meaning in footprint editor mode, - * i.e. is in s_allowed_in_FpEditor and therefore is shown in render panel - * Note: User layers, which are not paired, are not shown in layers manager. - * However a not listed layer can be reachable in the graphic item proprerties - * dialog. - */ + bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer ) { static LSET allowed = LSET::AllTechMask(); @@ -140,9 +133,11 @@ bool PCB_LAYER_WIDGET::isLayerAllowedInFpMode( LAYER_ID aLayer ) return allowed.test( aLayer ); } + void PCB_LAYER_WIDGET::installRightLayerClickHandler() { int rowCount = GetLayerRowCount(); + for( int row=0; row < rowCount; ++row ) { for( int col=0; col------------------------------------------- void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) @@ -468,6 +464,7 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal brd->SetVisibleLayers( visibleLayers ); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); + if( galCanvas ) { KIGFX::VIEW* view = galCanvas->GetView(); @@ -491,6 +488,14 @@ void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled ) { BOARD* brd = myframe->GetBoard(); + LSET visibleLayers = brd->GetVisibleLayers(); + visibleLayers.set( aId, isEnabled ); + + // The layer visibility status is saved in the board file so set the board modified + // state so the user has the option to save the changes. + if( brd->IsElementVisible( aId ) != isEnabled ) + myframe->OnModify(); + brd->SetElementVisibility( aId, isEnabled ); EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas(); diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h index a3a1aa7a3b..7908d80e7b 100644 --- a/pcbnew/class_pcb_layer_widget.h +++ b/pcbnew/class_pcb_layer_widget.h @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gpisa-lab.inpg.fr * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2010-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,7 +35,7 @@ /** * Class PCB_LAYER_WIDGET - * is here to implement the abtract functions of LAYER_WIDGET so they + * is here to implement the abstract functions of LAYER_WIDGET so they * may be tied into the PCB_EDIT_FRAME's data and so we can add a popup * menu which is specific to PCBNEW's needs. */ @@ -48,7 +48,7 @@ public: * @param aParent is the parent window * @param aFocusOwner is the window that should be sent the focus after * @param aPointSize is the font point size to use within the widget. This - * effectively sets the overal size of the widget via the row height and bitmap + * effectively sets the overall size of the widget via the row height and bitmap * button sizes. * @param aFpEditorMode false for the board editor (default), true for fp editor * when true, some options or layers which cannot be used in editor mode are not @@ -132,6 +132,10 @@ protected: /** * Function isLayerAllowedInFpMode + * + * User layers, which are not paired, are not shown in layers manager. However a not + * listed layer can be reachable in the graphic item properties dialog. + * * @param aLayer is the layer id to test * @return true if LAYER_ID aLayer has meaning in footprint editor mode. * and therefore is shown in render panel diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 7a1cb82662..ee82299753 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,6 +42,7 @@ #include #include + DIALOG_GENERALOPTIONS::DIALOG_GENERALOPTIONS( PCB_EDIT_FRAME* parent ) : DIALOG_GENERALOPTIONS_BOARDEDITOR_BASE( parent ) { @@ -89,10 +90,8 @@ void DIALOG_GENERALOPTIONS::init() m_OptMiddleButtonPanLimited->Enable( m_MiddleButtonPANOpt->GetValue() ); m_AutoPANOpt->SetValue( GetParent()->GetCanvas()->GetEnableAutoPan() ); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild ); - m_MagneticPadOptCtrl->SetSelection( g_MagneticPadOption ); m_MagneticTrackOptCtrl->SetSelection( g_MagneticTrackOption ); - m_DumpZonesWhenFilling->SetValue ( g_DumpZonesWhenFilling ); } @@ -127,8 +126,9 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) if( m_Board->IsElementVisible(RATSNEST_VISIBLE) != m_ShowGlobalRatsnest->GetValue() ) { - GetParent()->SetElementVisibility(RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); - GetParent()->GetCanvas()->Refresh( ); + GetParent()->SetElementVisibility( RATSNEST_VISIBLE, m_ShowGlobalRatsnest->GetValue() ); + GetParent()->GetCanvas()->Refresh(); + GetParent()->OnModify(); } displ_opts->m_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); @@ -148,104 +148,3 @@ void DIALOG_GENERALOPTIONS::OnOkClick( wxCommandEvent& event ) EndModal( wxID_OK ); } - - -/* Must be called on a click on the left toolbar (options toolbar - * Update variables according to tools states - */ -void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) -{ - int id = event.GetId(); - bool state = event.IsChecked(); - DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); - - switch( id ) - { - case ID_TB_OPTIONS_DRC_OFF: - g_Drc_On = !state; - - if( GetToolId() == ID_TRACK_BUTT ) - { - if( g_Drc_On ) - m_canvas->SetCursor( wxCURSOR_PENCIL ); - else - m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW ); - } - break; - - case ID_TB_OPTIONS_SHOW_RATSNEST: - SetElementVisibility( RATSNEST_VISIBLE, state ); - - if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 ) - Compile_Ratsnest( NULL, true ); - - m_canvas->Refresh(); - break; - - case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST: - displ_opts->m_Show_Module_Ratsnest = state; // TODO: see if we can use the visibility list - break; - - case ID_TB_OPTIONS_AUTO_DEL_TRACK: - g_AutoDeleteOldTrack = state; - break; - - case ID_TB_OPTIONS_SHOW_ZONES: - displ_opts->m_DisplayZonesMode = 0; - m_canvas->Refresh(); - break; - - case ID_TB_OPTIONS_SHOW_ZONES_DISABLE: - displ_opts->m_DisplayZonesMode = 1; - m_canvas->Refresh(); - break; - - case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY: - displ_opts->m_DisplayZonesMode = 2; - m_canvas->Refresh(); - break; - - case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: - displ_opts->m_DisplayViaFill = !state; - m_canvas->Refresh(); - break; - - case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH: - displ_opts->m_DisplayPcbTrackFill = !state; - m_canvas->Refresh(); - break; - - case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: - { - displ_opts->m_ContrastModeDisplay = state; - m_canvas->Refresh(); - break; - } - - case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE: - m_show_microwave_tools = state; - m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); - m_auimgr.Update(); - - GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, - m_show_microwave_tools ? - _( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" )); - break; - - case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR: - // show auxiliary Vertical layers and visibility manager toolbar - m_show_layer_manager_tools = state; - m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); - m_auimgr.Update(); - - GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, - m_show_layer_manager_tools ? - _( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ) ); - break; - - default: - DisplayError( this, - wxT( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) ); - break; - } -} diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index db870b9894..7e5744274f 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2013 Wayne Stambaugh - * Copyright (C) 2013 KiCad Developers, see change_log.txt for contributors. + * Copyright (C) 2013-2015 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -82,7 +82,6 @@ // Keys used in read/write config #define OPTKEY_DEFAULT_LINEWIDTH_VALUE wxT( "PlotLineWidth_mm" ) -#define PCB_SHOW_FULL_RATSNET_OPT wxT( "PcbFullRatsnest" ) #define PCB_MAGNETIC_PADS_OPT wxT( "PcbMagPadOpt" ) #define PCB_MAGNETIC_TRACKS_OPT wxT( "PcbMagTrackOpt" ) #define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" ) @@ -740,11 +739,6 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) g_DrawDefaultLineThickness = Millimeter2iu( dtmp ); - long tmp; - - aCfg->Read( PCB_SHOW_FULL_RATSNET_OPT, &tmp ); - GetBoard()->SetElementVisibility(RATSNEST_VISIBLE, tmp); - aCfg->Read( PCB_MAGNETIC_PADS_OPT, &g_MagneticPadOption ); aCfg->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); aCfg->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); @@ -759,10 +753,7 @@ void PCB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg ) wxConfigSaveSetups( aCfg, GetConfigurationSettings() ); // This value is stored in mm ) - aCfg->Write( OPTKEY_DEFAULT_LINEWIDTH_VALUE, - MM_PER_IU * g_DrawDefaultLineThickness ); - long tmp = GetBoard()->IsElementVisible(RATSNEST_VISIBLE); - aCfg->Write( PCB_SHOW_FULL_RATSNET_OPT, tmp ); + aCfg->Write( OPTKEY_DEFAULT_LINEWIDTH_VALUE, MM_PER_IU * g_DrawDefaultLineThickness ); aCfg->Write( PCB_MAGNETIC_PADS_OPT, (long) g_MagneticPadOption ); aCfg->Write( PCB_MAGNETIC_TRACKS_OPT, (long) g_MagneticTrackOption ); aCfg->Write( SHOW_MICROWAVE_TOOLS, (long) m_show_microwave_tools ); diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 1fb73a8493..f2eb7c77a2 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -3,8 +3,8 @@ * * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012=2015 Wayne Stambaugh + * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -36,6 +36,8 @@ #include #include #include +#include +#include #include @@ -87,8 +89,6 @@ static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] = }; -/* Draw the icon for the "Select layer pair" bitmap tool - */ void PCB_EDIT_FRAME::PrepareLayerIndicator() { int ii, jj; @@ -199,8 +199,6 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() } -/* Creates or updates the main horizontal toolbar for the board editor -*/ void PCB_EDIT_FRAME::ReCreateHToolbar() { wxString msg; @@ -411,8 +409,6 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() } -/* Create the main vertical right toolbar, showing usual tools - */ void PCB_EDIT_FRAME::ReCreateVToolbar() { if( m_drawToolBar ) @@ -533,15 +529,6 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar() } -/* Creates auxiliary horizontal toolbar - * displays: - * existing track width choice - * selection for auto track width - * existing via size choice - * Current strategy (to choose the track and via sizes) - * grid size choice - * zoom level choice - */ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar() { wxString msg; @@ -590,8 +577,8 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar() m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, wxEmptyString, KiBitmap( auto_track_width_xpm ), - _( "Auto track width: when starting on \ -an existing track use its width\notherwise, use current width setting" ), + _( "Auto track width: when starting on an existing track " + "use its width\notherwise, use current width setting" ), wxITEM_CHECK ); // Add the box to display and select the current grid size: @@ -614,7 +601,6 @@ an existing track use its width\notherwise, use current width setting" ), // after adding the buttons to the toolbar, must call Realize() m_auxiliaryToolBar->Realize(); -// m_auxiliaryToolBar->AddSeparator(); } @@ -729,3 +715,102 @@ void PCB_EDIT_FRAME::ReCreateLayerBox( bool aForceResizeToolbar ) m_auimgr.Update(); } } + + +void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) +{ + int id = event.GetId(); + bool state = event.IsChecked(); + DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)GetDisplayOptions(); + + switch( id ) + { + case ID_TB_OPTIONS_DRC_OFF: + g_Drc_On = !state; + + if( GetToolId() == ID_TRACK_BUTT ) + { + if( g_Drc_On ) + m_canvas->SetCursor( wxCURSOR_PENCIL ); + else + m_canvas->SetCursor( wxCURSOR_QUESTION_ARROW ); + } + break; + + case ID_TB_OPTIONS_SHOW_RATSNEST: + SetElementVisibility( RATSNEST_VISIBLE, state ); + OnModify(); + + if( state && (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 ) + Compile_Ratsnest( NULL, true ); + + m_canvas->Refresh(); + break; + + case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST: + displ_opts->m_Show_Module_Ratsnest = state; // TODO: see if we can use the visibility list + break; + + case ID_TB_OPTIONS_AUTO_DEL_TRACK: + g_AutoDeleteOldTrack = state; + break; + + case ID_TB_OPTIONS_SHOW_ZONES: + displ_opts->m_DisplayZonesMode = 0; + m_canvas->Refresh(); + break; + + case ID_TB_OPTIONS_SHOW_ZONES_DISABLE: + displ_opts->m_DisplayZonesMode = 1; + m_canvas->Refresh(); + break; + + case ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY: + displ_opts->m_DisplayZonesMode = 2; + m_canvas->Refresh(); + break; + + case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: + displ_opts->m_DisplayViaFill = !state; + m_canvas->Refresh(); + break; + + case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH: + displ_opts->m_DisplayPcbTrackFill = !state; + m_canvas->Refresh(); + break; + + case ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE: + { + displ_opts->m_ContrastModeDisplay = state; + m_canvas->Refresh(); + break; + } + + case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE: + m_show_microwave_tools = state; + m_auimgr.GetPane( wxT( "m_microWaveToolBar" ) ).Show( m_show_microwave_tools ); + m_auimgr.Update(); + + GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, + m_show_microwave_tools ? + _( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" )); + break; + + case ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR: + // show auxiliary Vertical layers and visibility manager toolbar + m_show_layer_manager_tools = state; + m_auimgr.GetPane( wxT( "m_LayersManagerToolBar" ) ).Show( m_show_layer_manager_tools ); + m_auimgr.Update(); + + GetMenuBar()->SetLabel( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, + m_show_layer_manager_tools ? + _( "Hide &Layers Manager" ) : _( "Show &Layers Manager" ) ); + break; + + default: + DisplayError( this, + wxT( "PCB_EDIT_FRAME::OnSelectOptionToolbar error \n (event not handled!)" ) ); + break; + } +} diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 6b5f7d4535..a4156663ad 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh - * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012-2015 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -114,6 +114,7 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent ) aEvent.Check( pythonPanelShown ); } + void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ) { int selected = aEvent.GetId() - ID_TB_OPTIONS_SHOW_ZONES;