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 329 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().

331 {
333  BASE_SCREEN* screen = aPanel->GetScreen();
334  block = &screen->m_BlockLocate;
335 
336  LIB_EDIT_FRAME* parent = (LIB_EDIT_FRAME*) aPanel->GetParent();
337  wxASSERT( parent != NULL );
338 
339  LIB_PART* component = parent->GetCurPart();
340 
341  if( component == NULL )
342  return;
343 
344  int unit = parent->GetUnit();
345  int convert = parent->GetConvert();
346 
347  auto opts = PART_DRAW_OPTIONS::Default();
348  opts.draw_mode = g_XorMode;
349  opts.only_selected = true;
350 
351  if( aErase )
352  {
353  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
354  component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert, opts );
355  }
356 
357  // Repaint new view
358  block->SetMoveVector( parent->GetCrossHairPosition() - block->GetLastCursorPosition() );
359 
360  GRSetDrawMode( aDC, g_XorMode );
361  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
362 
363  component->Draw( aPanel, aDC, block->GetMoveVector(), unit, convert, opts );
364 }
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:174
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:187
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...
wxPoint GetMoveVector() const