KiCad PCB EDA Suite
block_libedit.cpp File Reference
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <general.h>
#include <class_library.h>
#include <libeditframe.h>

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 328 of file block_libedit.cpp.

References PART_DRAW_OPTIONS::Default(), BLOCK_SELECTOR::Draw(), LIB_PART::Draw(), g_XorMode, BLOCK_SELECTOR::GetColor(), LIB_EDIT_FRAME::GetConvert(), EDA_DRAW_FRAME::GetCrossHairPosition(), LIB_EDIT_FRAME::GetCurPart(), BLOCK_SELECTOR::GetLastCursorPosition(), BLOCK_SELECTOR::GetMoveVector(), EDA_DRAW_PANEL::GetParent(), EDA_DRAW_PANEL::GetScreen(), LIB_EDIT_FRAME::GetUnit(), GRSetDrawMode(), BASE_SCREEN::m_BlockLocate, and BLOCK_SELECTOR::SetMoveVector().

Referenced by LIB_EDIT_FRAME::HandleBlockEnd().

330 {
332  BASE_SCREEN* screen = aPanel->GetScreen();
333  block = &screen->m_BlockLocate;
334 
335  LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) aPanel->GetParent();
336  wxASSERT( parent != NULL );
337 
338  LIB_PART* component = parent->GetCurPart();
339 
340  if( component == NULL )
341  return;
342 
343  int unit = parent->GetUnit();
344  int convert = parent->GetConvert();
345 
346  auto opts = PART_DRAW_OPTIONS::Default();
347  opts.draw_mode = g_XorMode;
348  opts.only_selected = true;
349 
350  if( aErase )
351  {
352  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
353  component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert, opts );
354  }
355 
356  // Repaint new view
357  block->SetMoveVector( parent->GetCrossHairPosition() - block->GetLastCursorPosition() );
358 
359  GRSetDrawMode( aDC, g_XorMode );
360  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
361 
362  component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert, opts );
363 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDc, const wxPoint &aOffset, int aMulti, int aConvert, const PART_DRAW_OPTIONS &aOpts)
Draw part.
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
void GRSetDrawMode(wxDC *DC, GR_DRAWMODE draw_mode)
Definition: gr_basic.cpp:290
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor)
void SetMoveVector(const wxPoint &aMoveVector)
COLOR4D GetColor() const
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
Class LIB_PART defines a library part object.
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
static PART_DRAW_OPTIONS Default()
Definition: solve.cpp:178
wxPoint GetLastCursorPosition() const
The component library editor main window.
Definition: libeditframe.h:51
LIB_PART * GetCurPart()
Function GetCurPart returns the current part being edited, or NULL if none selected.
BASE_SCREEN * GetScreen()
Definition: draw_panel.cpp:188
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
wxPoint GetMoveVector() const