/* abort function in moving outline. */ static void Abort_Move_ModuleOutline( EDA_DRAW_PANEL* Panel, wxDC* DC ) { EDGE_MODULE* edge = (EDGE_MODULE*) Panel->GetScreen()->GetCurItem(); Panel->SetMouseCapture( NULL, NULL ); if( edge && ( edge->Type() == PCB_MODULE_EDGE_T ) ) { if( edge->IsNew() ) // On aborting, delete new outline. { MODULE* module = (MODULE*) edge->GetParent(); edge->Draw( Panel, DC, GR_XOR, MoveVector ); edge->DeleteStructure(); module->CalculateBoundingBox(); } else // On aborting, move existing outline to its initial position. { edge->Draw( Panel, DC, GR_XOR, MoveVector ); edge->ClearFlags(); edge->Draw( Panel, DC, GR_OR ); } } Panel->GetScreen()->SetCurItem( NULL ); }
/* Redraw the current graphic item during its creation * Use this function to show a new outline, in begin command */ static void ShowNewEdgeModule( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); EDGE_MODULE* edge = (EDGE_MODULE*) screen->GetCurItem(); if( edge == NULL ) return; MODULE* module = (MODULE*) edge->GetParent(); // if( erase ) { edge->Draw( aPanel, aDC, GR_XOR ); } edge->SetEnd( aPanel->GetParent()->GetCrossHairPosition() ); // Update relative coordinate. edge->SetEnd0( edge->GetEnd() - module->GetPosition() ); wxPoint pt( edge->GetEnd0() ); RotatePoint( &pt, -module->GetOrientation() ); edge->SetEnd0( pt ); edge->Draw( aPanel, aDC, GR_XOR ); module->CalculateBoundingBox(); }
/* Redraw the current moved graphic item when mouse is moving * Use this function to show an existing outline, in move command */ static void ShowCurrentOutlineWhileMoving( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); EDGE_MODULE* edge = (EDGE_MODULE*) screen->GetCurItem(); if( edge == NULL ) return; MODULE* module = (MODULE*) edge->GetParent(); if( aErase ) { edge->Draw( aPanel, aDC, GR_XOR, MoveVector ); } MoveVector = -(aPanel->GetParent()->GetCrossHairPosition() - CursorInitialPosition); edge->Draw( aPanel, aDC, GR_XOR, MoveVector ); module->CalculateBoundingBox(); }