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 <sch_edit_frame.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 400 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().

402 {
403  BASE_SCREEN* screen = aPanel->GetScreen();
404  BLOCK_SELECTOR* block = &screen->m_BlockLocate;
405  SCH_ITEM* schitem;
406 
407  /* Erase old block contents. */
408  if( aErase )
409  {
410  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
411 
412  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
413  {
414  schitem = (SCH_ITEM*) block->GetItem( ii );
415 
416  if( schitem->Type() == SCH_COMPONENT_T )
417  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
418  g_XorMode, g_GhostColor, false );
419  else
420  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
421  }
422  }
423 
424  /* Repaint new view. */
425  block->SetMoveVector( aPanel->GetParent()->GetCrossHairPosition() - block->GetLastCursorPosition() );
426  block->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, block->GetColor() );
427 
428  for( unsigned ii = 0; ii < block->GetCount(); ii++ )
429  {
430  schitem = (SCH_ITEM*) block->GetItem( ii );
431 
432  if( schitem->Type() == SCH_COMPONENT_T )
433  ((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
434  g_XorMode, g_GhostColor, false );
435  else
436  schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
437  }
438 }
GR_DRAWMODE g_XorMode
Definition: gr_basic.cpp:73
KICAD_T Type() const
Function Type()
Definition: base_struct.h:227
BLOCK_SELECTOR m_BlockLocate
Block description for block commands.
Definition: base_screen.h:214
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 ...)
Definition: base_screen.h:76
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:181
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:194
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