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

This commit is contained in:
Maciej Suminski 2015-02-14 21:52:22 +01:00
parent bb861b81b2
commit b19010ff8b
4 changed files with 33 additions and 2 deletions

View File

@ -25,6 +25,8 @@
#include <collectors.h> #include <collectors.h>
#include <pcbnew.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, /* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER * port KICAD_PCB_PORT_SERVICE_NUMBER
@ -127,8 +129,17 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( module ) // if found, center the module on screen, and redraw the screen. if( module ) // if found, center the module on screen, and redraw the screen.
{ {
SetCrossHairPosition( pos ); if( IsGalCanvasActive() )
RedrawScreen( pos, false ); {
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 );
}
} }
} }

View File

@ -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() void PCB_EDITOR_CONTROL::setTransitions()
{ {
// Track & via size control // 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::ZoneFillAll, COMMON_ACTIONS::zoneFillAll.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneUnfill, COMMON_ACTIONS::zoneUnfill.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::ZoneUnfill, COMMON_ACTIONS::zoneUnfill.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneUnfillAll, COMMON_ACTIONS::zoneUnfillAll.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::ZoneUnfillAll, COMMON_ACTIONS::zoneUnfillAll.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SelectionCrossProbe, SELECTION_TOOL::SelectedEvent );
} }

View File

@ -57,6 +57,9 @@ public:
int ZoneUnfill( const TOOL_EVENT& aEvent ); int ZoneUnfill( const TOOL_EVENT& aEvent );
int ZoneUnfillAll( const TOOL_EVENT& aEvent ); int ZoneUnfillAll( const TOOL_EVENT& aEvent );
///> Notifies eeschema about the selected item.
int SelectionCrossProbe( const TOOL_EVENT& aEvent );
private: private:
///> Sets up handlers for various events. ///> Sets up handlers for various events.
void setTransitions(); void setTransitions();

View File

@ -511,6 +511,7 @@ void SELECTION_TOOL::findCallback( BOARD_ITEM* aItem )
{ {
clearSelection(); clearSelection();
select( aItem ); select( aItem );
getView()->SetCenter( VECTOR2D( aItem->GetPosition() ) );
// Inform other potentially interested tools // Inform other potentially interested tools
m_toolMgr->ProcessEvent( SelectedEvent ); m_toolMgr->ProcessEvent( SelectedEvent );