static void drawMovingBlock( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); if( aErase ) { if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, GR_XOR, BLOCK_OUTLINE_COLOR ); if( blockDrawItems ) drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } } if( screen->m_BlockLocate.m_State != STATE_BLOCK_STOP ) { screen->m_BlockLocate.m_MoveVector = screen->GetCrossHairPosition() - screen->m_BlockLocate.m_BlockLastCursorPosition; } if( screen->m_BlockLocate.m_MoveVector.x || screen->m_BlockLocate.m_MoveVector.y ) { screen->m_BlockLocate.Draw( aPanel, aDC, screen->m_BlockLocate.m_MoveVector, GR_XOR, BLOCK_OUTLINE_COLOR ); if( blockDrawItems ) drawPickedItems( aPanel, aDC, screen->m_BlockLocate.m_MoveVector ); } }
/* Traces the outline of the search block structures * The entire block follows the cursor */ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BASE_SCREEN* screen = aPanel->GetScreen(); BLOCK_SELECTOR* block = &screen->m_BlockLocate; SCH_ITEM* schitem; /* Erase old block contents. */ if( aErase ) { block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color ); for( unsigned ii = 0; ii < block->GetCount(); ii++ ) { schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor ); } } /* Repaint new view. */ block->m_MoveVector = screen->GetCrossHairPosition() - block->m_BlockLastCursorPosition; block->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, block->m_Color ); for( unsigned ii = 0; ii < block->GetCount(); ii++ ) { schitem = (SCH_ITEM*) block->m_ItemsSelection.GetPickedItem( ii ); schitem->Draw( aPanel, aDC, block->m_MoveVector, g_XorMode, g_GhostColor ); } }
/* Draw in drag mode when moving a pad. */ static void Show_Pad_Move( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { TRACK* Track; BASE_SCREEN* screen = aPanel->GetScreen(); D_PAD* pad = s_CurrentSelectedPad; if( pad == NULL ) // Should not occur return; if( aErase ) pad->Draw( aPanel, aDC, GR_XOR ); pad->SetPosition( screen->GetCrossHairPosition() ); pad->Draw( aPanel, aDC, GR_XOR ); for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ ) { Track = g_DragSegmentList[ii].m_Track; if( aErase ) Track->Draw( aPanel, aDC, GR_XOR ); g_DragSegmentList[ii].SetTrackEndsCoordinates( wxPoint(0, 0) ); Track->Draw( aPanel, aDC, GR_XOR ); } }
/* 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( screen->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 = -(screen->GetCrossHairPosition() - CursorInitialPosition); edge->Draw( aPanel, aDC, GR_XOR, MoveVector ); module->CalculateBoundingBox(); }
/* * Traces the outline of the search block structures * The entire block follows the cursor */ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) { BLOCK_SELECTOR* PtBlock; BASE_SCREEN* screen = aPanel->GetScreen(); wxPoint move_offset; PtBlock = &screen->m_BlockLocate; LIB_EDIT_FRAME* parent = ( LIB_EDIT_FRAME* ) aPanel->GetParent(); wxASSERT( parent != NULL ); LIB_COMPONENT* component = parent->GetComponent(); if( component == NULL ) return; int unit = parent->GetUnit(); int convert = parent->GetConvert(); if( aErase ) { PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); component->Draw( aPanel, aDC, PtBlock->m_MoveVector, unit, convert, g_XorMode, -1, DefaultTransform, true, true, true ); } /* Repaint new view */ PtBlock->m_MoveVector = screen->GetCrossHairPosition() - PtBlock->m_BlockLastCursorPosition; GRSetDrawMode( aDC, g_XorMode ); PtBlock->Draw( aPanel, aDC, PtBlock->m_MoveVector, g_XorMode, PtBlock->m_Color ); component->Draw( aPanel, aDC, PtBlock->m_MoveVector, unit, convert, g_XorMode, -1, DefaultTransform, true, true, true ); }