Fixed dragging offset in eeschema after crossprobing a multipart component in pcbnew GAL canvas.

This commit is contained in:
Maciej Suminski 2015-06-26 17:32:48 +02:00
parent 37db33cbca
commit 15857f22ca
5 changed files with 39 additions and 9 deletions

View File

@ -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
{

View File

@ -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,
"", "" );

View File

@ -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;

View File

@ -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<SELECTION_TOOL>();
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<BOARD_ITEM*>();
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() );

View File

@ -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;
};