/// Redraws the zone outline when moving a corner according to the cursor position void Show_Zone_Corner_Or_Outline_While_Move_Mouse( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) aPanel->GetParent(); ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem(); if( aErase ) // Undraw edge in old position { zone->Draw( aPanel, aDC, GR_XOR ); } wxPoint pos = pcbframe->GetScreen()->GetCrossHairPosition(); if( zone->IsMoving() ) { wxPoint offset; offset = pos - s_CursorLastPosition; zone->Move( offset ); s_CursorLastPosition = pos; } else if( zone->IsDragging() ) { wxPoint offset; offset = pos - s_CursorLastPosition; zone->MoveEdge( offset ); s_CursorLastPosition = pos; } else { zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y ); } zone->Draw( aPanel, aDC, GR_XOR ); }
/* Function called to abort a track creation */ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC ) { PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent(); BOARD* pcb = frame->GetBoard(); TRACK* track = (TRACK*) frame->GetCurItem(); if( track && ( track->Type()==PCB_VIA_T || track->Type()==PCB_TRACE_T ) ) { // Erase the current drawing ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false ); if( pcb->IsHighLightNetON() ) frame->HighLight( DC ); pcb->PopHighLight(); if( pcb->IsHighLightNetON() ) pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() ); frame->ClearMsgPanel(); // Undo pending changes (mainly a lock point creation) and clear the // undo picker list: frame->PutDataInPreviousState( &s_ItemsListPicker, false, false ); s_ItemsListPicker.ClearListAndDeleteItems(); // Delete current (new) track g_CurrentTrackList.DeleteAll(); } frame->SetCurItem( NULL ); }
/** * Function Abort_Zone_Move_Corner_Or_Outlines * cancels the Begin_Zone state if at least one EDGE_ZONE has been created. */ void Abort_Zone_Move_Corner_Or_Outlines( EDA_DRAW_PANEL* Panel, wxDC* DC ) { PCB_EDIT_FRAME* pcbframe = (PCB_EDIT_FRAME*) Panel->GetParent(); ZONE_CONTAINER* zone = (ZONE_CONTAINER*) pcbframe->GetCurItem(); if( zone->IsMoving() ) { wxPoint offset; offset = s_CornerInitialPosition - s_CursorLastPosition; zone->Move( offset ); } else if( zone->IsDragging() ) { wxPoint offset; offset = s_CornerInitialPosition - s_CursorLastPosition; zone->MoveEdge( offset ); } else { if( s_CornerIsNew ) { zone->m_Poly->DeleteCorner( zone->m_CornerSelection ); } else { wxPoint pos = s_CornerInitialPosition; zone->m_Poly->MoveCorner( zone->m_CornerSelection, pos.x, pos.y ); } } Panel->SetMouseCapture( NULL, NULL ); s_AuxiliaryList.ClearListAndDeleteItems(); s_PickedList. ClearListAndDeleteItems(); Panel->Refresh(); pcbframe->SetCurItem( NULL ); zone->ClearFlags(); s_AddCutoutToCurrentZone = false; s_CurrentZone = NULL; }