KiCad PCB EDA Suite
eeschema/block.cpp File Reference
#include <fctsys.h>
#include <pgm_base.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <schframe.h>
#include <general.h>
#include <class_library.h>
#include <lib_pin.h>
#include <list_operations.h>
#include <sch_bus_entry.h>
#include <sch_marker.h>
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_no_connect.h>
#include <sch_text.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_sheet_path.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

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

Definition at line 391 of file eeschema/block.cpp.

References BLOCK_SELECTOR::Draw(), SCH_ITEM::Draw(), g_GhostColor, g_XorMode, BLOCK_SELECTOR::GetColor(), BLOCK_SELECTOR::GetCount(), EDA_DRAW_FRAME::GetCrossHairPosition(), BLOCK_SELECTOR::GetItem(), BLOCK_SELECTOR::GetLastCursorPosition(), BLOCK_SELECTOR::GetMoveVector(), EDA_DRAW_PANEL::GetParent(), EDA_DRAW_PANEL::GetScreen(), BASE_SCREEN::m_BlockLocate, SCH_COMPONENT_T, BLOCK_SELECTOR::SetMoveVector(), and EDA_ITEM::Type().

Referenced by SCH_EDIT_FRAME::HandleBlockEnd(), and SCH_EDIT_FRAME::InitBlockPasteInfos().

393 {
394  BASE_SCREEN* screen = aPanel->GetScreen();
395  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
396  SCH_ITEM* schitem;
397 
398  /* Erase old block contents. */
399  if( aErase )
400  {
401  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
402 
403  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
404  {
405  schitem = (SCH_ITEM*) block->GetItem( ii );
406 
407  if( schitem->Type() == SCH_COMPONENT_T )
408  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
409  g_XorMode, g_GhostColor, false );
410  else
411  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
412  }
413  }
414 
415  /* Repaint new view. */
416  block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
417  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
418 
419  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
420  {
421  schitem = (SCH_ITEM*) block->GetItem( ii );
422 
423  if( schitem->Type() == SCH_COMPONENT_T )
424  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
425  g_XorMode, g_GhostColor, false );
426  else
427  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
428  }
429 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:51
KICAD_T Type() const
Function Type()
Definition: base_struct.h:212
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)
EDA_ITEM * GetItem(unsigned aIndex)
COLOR4D GetColor() const
Class BASE_SCREEN handles how to draw a screen (a board, a schematic ...)
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:174
Definition: solve.cpp:178
wxPoint GetLastCursorPosition() const
Class SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:69
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...
Class SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container clas...
unsigned GetCount() const
virtual void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor=COLOR4D::UNSPECIFIED)=0
Function Draw Draw a schematic item.
COLOR4D g_GhostColor
Draw color for moving objects.
Definition: common.cpp:57
wxPoint GetMoveVector() const