From 7ec1313cbcff4df62c039bb79ef1ef1caa1ce909 Mon Sep 17 00:00:00 2001 From: Maciej Suminski Date: Tue, 13 May 2014 11:22:51 +0200 Subject: [PATCH] Custom width settings taken into account in wxUpdateUIEvent handlers. --- include/wxPcbStruct.h | 1 + pcbnew/pcbframe.cpp | 2 ++ pcbnew/pcbnew_id.h | 2 +- pcbnew/toolbars_update_user_interface.cpp | 16 +++++++++++++--- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 0e19dc8e22..b9321922a8 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -248,6 +248,7 @@ public: void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ); void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); + void OnUpdateSelectCustomTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent ); void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent ); void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 9f66d54d21..212dd6a83c 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -275,6 +275,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth ) EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth ) + EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, + PCB_EDIT_FRAME::OnUpdateSelectCustomTrackWidth ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize ) EVT_UPDATE_UI( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnUpdateAutoPlaceModulesMode ) EVT_UPDATE_UI( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode ) diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 421aad1e70..785c92417f 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -170,7 +170,7 @@ enum pcbnew_ids ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH, - ID_POPUP_PCB_SELECT_CUSTOM, + ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, ID_POPUP_PCB_SELECT_AUTO_WIDTH, ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, ID_POPUP_PCB_SELECT_WIDTH1, diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index ac2f65a490..78b44145bb 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -62,7 +62,9 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) { bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 + (int) GetBoard()->GetTrackWidthIndex() ) == aEvent.GetId() ) && - !GetDesignSettings().m_UseConnectedTrackWidth ); + !GetDesignSettings().m_UseConnectedTrackWidth && + !GetBoard()->UseCustomTrackViaSize() ); + aEvent.Check( check ); } } @@ -70,7 +72,14 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ) { - aEvent.Check( GetDesignSettings().m_UseConnectedTrackWidth ); + aEvent.Check( GetDesignSettings().m_UseConnectedTrackWidth && + !GetBoard()->UseCustomTrackViaSize() ); +} + + +void PCB_EDIT_FRAME::OnUpdateSelectCustomTrackWidth( wxUpdateUIEvent& aEvent ) +{ + aEvent.Check( GetBoard()->UseCustomTrackViaSize() ); } @@ -87,7 +96,8 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent ) { bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 + (int) GetBoard()->GetViaSizeIndex() ) == aEvent.GetId() ) && - !GetDesignSettings().m_UseConnectedTrackWidth ); + !GetDesignSettings().m_UseConnectedTrackWidth && + !GetBoard()->UseCustomTrackViaSize() ); aEvent.Check( check ); }