From 29e7638a3c15c207f873fb48f3892164ce2a7b8f Mon Sep 17 00:00:00 2001 From: Martin Janitschke Date: Thu, 27 Feb 2014 19:48:18 +0100 Subject: [PATCH] make microwave toolbar accessible from menu (Bug #1285425 ) --- include/wxPcbStruct.h | 1 + pcbnew/dialogs/dialog_general_options.cpp | 4 ++++ pcbnew/help_common_strings.h | 2 ++ pcbnew/menubar_pcbframe.cpp | 7 +++++++ pcbnew/pcbframe.cpp | 3 +++ pcbnew/pcbnew_config.cpp | 11 +++++++++++ pcbnew/pcbnew_id.h | 1 + pcbnew/tool_pcb.cpp | 17 +++++++++++------ pcbnew/toolbars_update_user_interface.cpp | 6 ++++++ 9 files changed, 46 insertions(+), 6 deletions(-) diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 394698aa4f..b46756fe5e 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -279,6 +279,7 @@ public: void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent ); void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent ); + void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ); /** * Function RecordMacros. diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index c01e433f3e..cf2e5b607f 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -237,6 +237,10 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) 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: diff --git a/pcbnew/help_common_strings.h b/pcbnew/help_common_strings.h index e628f9771a..cbc1d6b378 100644 --- a/pcbnew/help_common_strings.h +++ b/pcbnew/help_common_strings.h @@ -22,3 +22,5 @@ #define HELP_ZOOM_REDRAW _( "Redraw the screen of the board" ) #define HELP_SHOW_HIDE_LAYERMANAGER _( "Show/hide the layers manager toolbar" ) + +#define HELP_SHOW_HIDE_MICROWAVE_TOOLS _( "Show/hide the toolbar for microwave tools\nThis is a experimental feature (under development)" ) diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index b82f2d7202..81bf1d9fa7 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -482,6 +482,13 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() HELP_SHOW_HIDE_LAYERMANAGER, KiBitmap( layers_manager_xpm ) ); + AddMenuItem( configmenu, ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, + m_show_microwave_tools ? + _( "Hide Microwave Toolbar" ): _( "Show Microwave Toolbar" ), + HELP_SHOW_HIDE_MICROWAVE_TOOLS, + KiBitmap( mw_toolbar_xpm ) ); + + // General #ifdef __WXMAC__ configmenu->Append(wxID_PREFERENCES); diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 5f9cc9c09a..c2cb9fb4da 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -141,6 +141,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_MENU_RANGE( ID_PREFERENCES_HOTKEY_START, ID_PREFERENCES_HOTKEY_END, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, PCB_EDIT_FRAME::Process_Config ) + EVT_MENU( ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( wxID_PREFERENCES, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_LAYERS_SETUP, PCB_EDIT_FRAME::Process_Config ) EVT_MENU( ID_PCB_MASK_CLEARANCE, PCB_EDIT_FRAME::Process_Config ) @@ -292,6 +293,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) PCB_EDIT_FRAME::OnUpdateVerticalToolbar ) EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SHOW_ZONES, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle ) + EVT_UPDATE_UI_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, + PCB_EDIT_FRAME::OnUpdateMuWaveToolbar ) END_EVENT_TABLE() diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 50ab5bbc59..46315ab1da 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -77,6 +77,17 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event ) _("Hide &Layers Manager" ) : _("Show &Layers Manager" )); break; + case ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR: + m_show_microwave_tools = ! m_show_microwave_tools; + 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_PCB_LAYERS_SETUP: InstallDialogLayerSetup(); break; diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index d4acbfedf8..85aa832862 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -280,6 +280,7 @@ enum pcbnew_ids ID_PCB_LIB_TABLE_EDIT, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG, ID_MENU_PCB_SHOW_HIDE_LAYERS_MANAGER_DIALOG, + ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, ID_TB_OPTIONS_SHOW_ZONES, diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index e0f4647a2e..6038bf41ff 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -398,7 +398,7 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, wxEmptyString, KiBitmap( mw_toolbar_xpm ), - _( "Show/hide the toolbar for microwaves tools\n This is a experimental feature (under development)" ), + HELP_SHOW_HIDE_MICROWAVE_TOOLS, wxITEM_CHECK ); @@ -500,25 +500,30 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar() // Set up toolbar m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, KiBitmap( mw_add_line_xpm ), - _( "Create line of specified length for microwave applications" ) ); + _( "Create line of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString, KiBitmap( mw_add_gap_xpm ), - _( "Create gap of specified length for microwave applications" ) ); + _( "Create gap of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddSeparator(); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString, KiBitmap( mw_add_stub_xpm ), - _( "Create stub of specified length for microwave applications" ) ); + _( "Create stub of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString, KiBitmap( mw_add_stub_arc_xpm ), - _( "Create stub (arc) of specified length for microwave applications" ) ); + _( "Create stub (arc) of specified length for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString, KiBitmap( mw_add_shape_xpm ), - _( "Create a polynomial shape for microwave applications" ) ); + _( "Create a polynomial shape for microwave applications" ), + wxITEM_CHECK ); m_microWaveToolBar->Realize(); } diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 23d850d2b1..6e8ceaac2c 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -204,6 +204,12 @@ void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ) aEvent.Check( GetToolId() == aEvent.GetId() ); } +void PCB_EDIT_FRAME::OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ) +{ + if( aEvent.GetEventObject() == m_microWaveToolBar ) + aEvent.Check( GetToolId() == aEvent.GetId() ); +} + void PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent ) {