diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index 37566fd0a6..1bd7e003a9 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -132,9 +132,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) { if( IsGalCanvasActive() ) { - GetGalCanvas()->GetView()->SetCenter( VECTOR2D( module->GetPosition() ) ); - m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true ); - m_toolManager->RunAction( COMMON_ACTIONS::selectItem, true, module ); + GetToolManager()->RunAction( COMMON_ACTIONS::crossProbeSchToPcb, true, module ); } else { diff --git a/pcbnew/tools/common_actions.cpp b/pcbnew/tools/common_actions.cpp index dc60be456c..41228181f7 100644 --- a/pcbnew/tools/common_actions.cpp +++ b/pcbnew/tools/common_actions.cpp @@ -391,6 +391,10 @@ TOOL_ACTION COMMON_ACTIONS::drillOrigin( "pcbnew.EditorControl.drillOrigin", AS_GLOBAL, 0, "", "" ); +TOOL_ACTION COMMON_ACTIONS::crossProbeSchToPcb( "pcbnew.EditorControl.crossProbSchToPcb", + AS_GLOBAL, 0, + "", "" ); + TOOL_ACTION COMMON_ACTIONS::highlightNet( "pcbnew.EditorControl.highlightNet", AS_GLOBAL, 0, "", "" ); diff --git a/pcbnew/tools/common_actions.h b/pcbnew/tools/common_actions.h index 410838dfa4..c53ae75ef3 100644 --- a/pcbnew/tools/common_actions.h +++ b/pcbnew/tools/common_actions.h @@ -279,6 +279,7 @@ public: static TOOL_ACTION highlightNet; static TOOL_ACTION highlightNetCursor; static TOOL_ACTION drillOrigin; + static TOOL_ACTION crossProbeSchToPcb; static TOOL_ACTION showHelp; static TOOL_ACTION toBeDone; @@ -288,9 +289,6 @@ public: /// Find an item and start moving static TOOL_ACTION findMove; - /// Blocks CTRL+F, it is handled by wxWidgets - static TOOL_ACTION findDummy; - static TOOL_ACTION editFootprintInFpEditor; static TOOL_ACTION copyPadToSettings; static TOOL_ACTION copySettingsToPads; diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index b9fcae052f..6734765e32 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -86,6 +86,7 @@ PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() : { m_placeOrigin = new KIGFX::ORIGIN_VIEWITEM( KIGFX::COLOR4D( 0.8, 0.0, 0.0, 1.0 ), KIGFX::ORIGIN_VIEWITEM::CROSS ); + m_probingSchToPcb = false; } @@ -588,8 +589,14 @@ int PCB_EDITOR_CONTROL::ZoneMerge( const TOOL_EVENT& aEvent ) } -int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent ) +int PCB_EDITOR_CONTROL::CrossProbePcbToSch( const TOOL_EVENT& aEvent ) { + if( m_probingSchToPcb ) + { + m_probingSchToPcb = false; + return 0; + } + SELECTION_TOOL* selTool = m_toolMgr->GetTool(); const SELECTION& selection = selTool->GetSelection(); @@ -600,6 +607,22 @@ int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent ) } +int PCB_EDITOR_CONTROL::CrossProbeSchToPcb( const TOOL_EVENT& aEvent ) +{ + BOARD_ITEM* item = aEvent.Parameter(); + + if( item ) + { + m_probingSchToPcb = true; + getView()->SetCenter( VECTOR2D( item->GetPosition() ) ); + m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true ); + m_toolMgr->RunAction( COMMON_ACTIONS::selectItem, true, item ); + } + + return 0; +} + + static bool setDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame, KIGFX::ORIGIN_VIEWITEM* aItem, const VECTOR2D& aPosition ) { @@ -697,7 +720,8 @@ void PCB_EDITOR_CONTROL::SetTransitions() Go( &PCB_EDITOR_CONTROL::PlaceModule, COMMON_ACTIONS::placeModule.MakeEvent() ); // Other - Go( &PCB_EDITOR_CONTROL::SelectionCrossProbe, SELECTION_TOOL::SelectedEvent ); + Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, SELECTION_TOOL::SelectedEvent ); + Go( &PCB_EDITOR_CONTROL::CrossProbeSchToPcb, COMMON_ACTIONS::crossProbeSchToPcb.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::DrillOrigin, COMMON_ACTIONS::drillOrigin.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::HighlightNet, COMMON_ACTIONS::highlightNet.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, COMMON_ACTIONS::highlightNetCursor.MakeEvent() ); diff --git a/pcbnew/tools/pcb_editor_control.h b/pcbnew/tools/pcb_editor_control.h index 901a2f5c5e..f3536a588a 100644 --- a/pcbnew/tools/pcb_editor_control.h +++ b/pcbnew/tools/pcb_editor_control.h @@ -75,7 +75,10 @@ public: int PlaceModule( const TOOL_EVENT& aEvent ); ///> Notifies eeschema about the selected item. - int SelectionCrossProbe( const TOOL_EVENT& aEvent ); + int CrossProbePcbToSch( const TOOL_EVENT& aEvent ); + + ///> Reacts to selection change in eeschema. + int CrossProbeSchToPcb( const TOOL_EVENT& aEvent ); ///> Places the origin point for drill and pick-and-place files. int DrillOrigin( const TOOL_EVENT& aEvent ); @@ -96,6 +99,9 @@ private: ///> Place & drill origin marker. KIGFX::ORIGIN_VIEWITEM* m_placeOrigin; + ///> Flag to ignore a single crossprobe message from eeschema. + bool m_probingSchToPcb; + // How does line width change after one -/+ key press. static const int WIDTH_STEP; };