From 3a8f32c38095ea4d980c545c9983ac1e4e32ac0b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 9 Jul 2019 00:43:08 +0100 Subject: [PATCH] Convert ShowEEschema to an ACTION so it can get a hotkey assignment. Fixes: lp:1686010 * https://bugs.launchpad.net/kicad/+bug/1686010 --- eeschema/tools/ee_actions.cpp | 2 +- pcbnew/pcb_edit_frame.cpp | 4 +--- pcbnew/pcb_edit_frame.h | 3 ++- pcbnew/pcbnew_id.h | 1 - pcbnew/toolbars_pcb_editor.cpp | 2 +- pcbnew/tools/pcb_actions.cpp | 14 +++++++++----- pcbnew/tools/pcb_actions.h | 1 + pcbnew/tools/pcb_editor_control.cpp | 8 ++++++++ pcbnew/tools/pcb_editor_control.h | 1 + 9 files changed, 24 insertions(+), 12 deletions(-) diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 84ae183289..0cc3b5a560 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -565,7 +565,7 @@ TOOL_ACTION EE_ACTIONS::drawSheetOnClipboard( "eeschema.EditorControl.drawSheetO TOOL_ACTION EE_ACTIONS::showPcbNew( "eeschema.EditorControl.showPcbNew", AS_GLOBAL, 0, "", - _( "Open PCB Editor" ), _( "Run Pcbnew" ), + _( "Switch to PCB Editor" ), _( "Open PCB in Pcbnew" ), pcbnew_xpm ); TOOL_ACTION EE_ACTIONS::exportNetlist( "eeschema.EditorControl.exportNetlist", diff --git a/pcbnew/pcb_edit_frame.cpp b/pcbnew/pcb_edit_frame.cpp index d04dc1ce07..43ca7e5d20 100644 --- a/pcbnew/pcb_edit_frame.cpp +++ b/pcbnew/pcb_edit_frame.cpp @@ -158,8 +158,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, PCB_EDIT_FRAME::OnActionPluginRefresh ) #endif - EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema ) - // Tracks and vias sizes general options EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, @@ -987,7 +985,7 @@ void PCB_EDIT_FRAME::DoUpdatePCBFromNetlist( NETLIST& aNetlist, bool aUseTimesta } -void PCB_EDIT_FRAME::OnRunEeschema( wxCommandEvent& event ) +void PCB_EDIT_FRAME::RunEeschema() { wxString msg; wxFileName schfn( Prj().GetProjectPath(), Prj().GetProjectName(), SchematicFileExtension ); diff --git a/pcbnew/pcb_edit_frame.h b/pcbnew/pcb_edit_frame.h index f88d02703d..96feb5440e 100644 --- a/pcbnew/pcb_edit_frame.h +++ b/pcbnew/pcb_edit_frame.h @@ -303,7 +303,8 @@ public: void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent ); void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ); void OnLayerColorChange( wxCommandEvent& aEvent ); - void OnRunEeschema( wxCommandEvent& event ); + + void RunEeschema(); void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aEdit = true ); void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aEdit = true ); diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 01c01e13c1..f55eead7ec 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -146,7 +146,6 @@ enum pcbnew_ids ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, ID_ADD_FOOTPRINT_TO_BOARD, - ID_RUN_EESCHEMA, ID_PCBNEW_END_LIST }; diff --git a/pcbnew/toolbars_pcb_editor.cpp b/pcbnew/toolbars_pcb_editor.cpp index 2c2ed50393..09b07ef3b7 100644 --- a/pcbnew/toolbars_pcb_editor.cpp +++ b/pcbnew/toolbars_pcb_editor.cpp @@ -285,7 +285,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() PrepareLayerIndicator(); // Initialize the bitmap with the active layer colors KiScaledSeparator( m_mainToolBar, this ); - ADD_TOOL( ID_RUN_EESCHEMA, eeschema_xpm, _( "Open schematic in Eeschema" ) ); + m_mainToolBar->Add( PCB_ACTIONS::showEeschema ); // Access to the scripting console #if defined(KICAD_SCRIPTING_WXPYTHON) diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index ea2316eabb..24c3c1a6f5 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -594,6 +594,15 @@ TOOL_ACTION PCB_ACTIONS::highlightNetSelection( "pcbnew.EditorControl.highlightN _( "Highlight Net" ), _( "Highlight all copper items of a net" ), net_highlight_xpm ); +TOOL_ACTION PCB_ACTIONS::showEeschema( "pcbnew.EditorControl.showEeschema", + AS_GLOBAL, 0, "", + _( "Switch to Schematic Editor" ), _( "Open schematic in Eeschema" ), + eeschema_xpm ); + + +// PCBNEW_CONTROL +// + TOOL_ACTION PCB_ACTIONS::localRatsnestTool( "pcbnew.Control.localRatsnestTool", AS_GLOBAL, 0, "", _( "Highlight Ratsnest" ), _( "Show ratsnest of selected item(s)" ), @@ -630,10 +639,6 @@ TOOL_ACTION PCB_ACTIONS::flipBoard( "pcbnew.Control.flipBoard", _( "Flip Board View" ), _( "Flip (mirror) the board view" ), flip_board_xpm ); - -// PCBNEW_CONTROL -// - // Display modes TOOL_ACTION PCB_ACTIONS::showRatsnest( "pcbnew.Control.showRatsnest", AS_GLOBAL, 0, "", @@ -1175,4 +1180,3 @@ TOOL_ACTION PCB_ACTIONS::dragFreeAngle( "pcbnew.InteractiveRouter.DragFreeAngle" _( "Drags the nearest joint in the track without restricting the track angle." ), move_xpm ); - diff --git a/pcbnew/tools/pcb_actions.h b/pcbnew/tools/pcb_actions.h index 57269d3fa9..35523fa91a 100644 --- a/pcbnew/tools/pcb_actions.h +++ b/pcbnew/tools/pcb_actions.h @@ -413,6 +413,7 @@ public: static TOOL_ACTION highlightNetSelection; static TOOL_ACTION drillOrigin; static TOOL_ACTION appendBoard; + static TOOL_ACTION showEeschema; // Ratsnest static TOOL_ACTION localRatsnestTool; diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 49875cefe2..cb7dc7265f 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -413,6 +413,13 @@ int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent ) } +int PCB_EDITOR_CONTROL::ShowEeschema( const TOOL_EVENT& aEvent ) +{ + m_frame->RunEeschema(); + return 0; +} + + int PCB_EDITOR_CONTROL::ToggleLayersManager( const TOOL_EVENT& aEvent ) { getEditFrame()->ToggleLayersManager(); @@ -1549,6 +1556,7 @@ void PCB_EDITOR_CONTROL::setTransitions() Go( &PCB_EDITOR_CONTROL::ListNets, PCB_ACTIONS::listNets.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() ); + Go( &PCB_EDITOR_CONTROL::ShowEeschema, PCB_ACTIONS::showEeschema.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::ToggleMicrowaveToolbar, PCB_ACTIONS::showMicrowaveToolbar.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() ); diff --git a/pcbnew/tools/pcb_editor_control.h b/pcbnew/tools/pcb_editor_control.h index 2c9a3f0485..fe050f46db 100644 --- a/pcbnew/tools/pcb_editor_control.h +++ b/pcbnew/tools/pcb_editor_control.h @@ -68,6 +68,7 @@ public: int GenerateFabFiles( const TOOL_EVENT& aEvent ); int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent ); + int ShowEeschema( const TOOL_EVENT& aEvent ); int ToggleLayersManager( const TOOL_EVENT& aEvent ); int ToggleMicrowaveToolbar( const TOOL_EVENT& aEvent ); int TogglePythonConsole( const TOOL_EVENT& aEvent );