KiCad PCB EDA Suite
gerbview/block.cpp File Reference

Block operations: displacement. More...

Go to the source code of this file.

Functions

static void DrawMovingBlockOutlines (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool erase)
 

Detailed Description

Block operations: displacement.

Definition in file gerbview/block.cpp.

Function Documentation

static void DrawMovingBlockOutlines ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  erase 
)
static

Definition at line 146 of file gerbview/block.cpp.

References BLOCK_SELECTOR::Draw(), g_XorMode, EDA_RECT::GetBottom(), EDA_DRAW_FRAME::GetCrossHairPosition(), BLOCK_SELECTOR::GetMoveVector(), EDA_DRAW_PANEL::GetParent(), EDA_RECT::GetRight(), EDA_DRAW_PANEL::GetScreen(), BLOCK_SELECTOR::GetState(), BASE_SCREEN::m_BlockLocate, BLOCK_SELECTOR::SetMoveVector(), STATE_BLOCK_STOP, wxPoint::x, wxPoint::y, and YELLOW.

Referenced by GERBVIEW_FRAME::HandleBlockEnd().

148 {
149  BASE_SCREEN* screen = aPanel->GetScreen();
150 
151  COLOR4D Color = COLOR4D( YELLOW );
152 
153  if( aErase )
154  {
155  screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
156 
157  if( screen->m_BlockLocate.GetMoveVector().x|| screen->m_BlockLocate.GetMoveVector().y )
158  {
159  screen->m_BlockLocate.Draw( aPanel,
160  aDC,
161  screen->m_BlockLocate.GetMoveVector(),
162  g_XorMode,
163  Color );
164  }
165  }
166 
167  if( screen->m_BlockLocate.GetState() != STATE_BLOCK_STOP )
168  {
169  const wxPoint& cross_hair = aPanel->GetParent()->GetCrossHairPosition();
170 
172  wxPoint( cross_hair.x - screen->m_BlockLocate.GetRight(),
173  cross_hair.y - screen->m_BlockLocate.GetBottom() ) );
174  }
175 
176  screen->m_BlockLocate.Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, Color );
177 
178  if( screen->m_BlockLocate.GetMoveVector().x || screen->m_BlockLocate.GetMoveVector().y )
179  {
180  screen->m_BlockLocate.Draw( aPanel, aDC,
181  screen->m_BlockLocate.GetMoveVector(),
182  g_XorMode, Color );
183  }
184 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor)
void SetMoveVector(const wxPoint &aMoveVector)
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
int GetBottom() const
int GetRight() const
BLOCK_STATE_T GetState() const
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
Definition: colors.h:68
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
wxPoint GetMoveVector() const
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39