Commit b19010ff authored by Maciej Suminski's avatar Maciej Suminski

Cross-probing pcbnew<->eeschema (GAL).

parent bb861b81
......@@ -25,6 +25,8 @@
#include <collectors.h>
#include <pcbnew.h>
#include <tools/common_actions.h>
#include <pcb_draw_panel_gal.h>
/* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER
......@@ -126,10 +128,19 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
}
if( module ) // if found, center the module on screen, and redraw the screen.
{
if( IsGalCanvasActive() )
{
GetGalCanvas()->GetView()->SetCenter( VECTOR2D( module->GetPosition() ) );
m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true );
m_toolManager->RunAction( COMMON_ACTIONS::selectItem, true, module );
}
else
{
SetCrossHairPosition( pos );
RedrawScreen( pos, false );
}
}
}
......
......@@ -238,6 +238,20 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
if( selection.Size() == 1 )
m_frame->SendMessageToEESCHEMA( selection.Item<BOARD_ITEM>( 0 ) );
setTransitions();
return 0;
}
void PCB_EDITOR_CONTROL::setTransitions()
{
// Track & via size control
......@@ -251,4 +265,6 @@ void PCB_EDITOR_CONTROL::setTransitions()
Go( &PCB_EDITOR_CONTROL::ZoneFillAll, COMMON_ACTIONS::zoneFillAll.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneUnfill, COMMON_ACTIONS::zoneUnfill.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneUnfillAll, COMMON_ACTIONS::zoneUnfillAll.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SelectionCrossProbe, SELECTION_TOOL::SelectedEvent );
}
......@@ -57,6 +57,9 @@ public:
int ZoneUnfill( const TOOL_EVENT& aEvent );
int ZoneUnfillAll( const TOOL_EVENT& aEvent );
///> Notifies eeschema about the selected item.
int SelectionCrossProbe( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
void setTransitions();
......
......@@ -511,6 +511,7 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
{
clearSelection();
select( aItem );
getView()->SetCenter( VECTOR2D( aItem->GetPosition() ) );
// Inform other potentially interested tools
m_toolMgr->ProcessEvent( SelectedEvent );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment