KiCad PCB EDA Suite
move-drag_pads.cpp File Reference

Edit footprint pads. More...

#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
#include <class_drawpanel.h>
#include <trigo.h>
#include <block_commande.h>
#include <wxBasePcbFrame.h>
#include <class_board.h>
#include <class_module.h>
#include <pcbnew.h>
#include <drag.h>

Go to the source code of this file.

Functions

static void Abort_Move_Pad (EDA_DRAW_PANEL *Panel, wxDC *DC)
 
static void Show_Pad_Move (EDA_DRAW_PANEL *aPanel, wxDC *aDC, const wxPoint &aPosition, bool aErase)
 

Variables

static D_PADs_CurrentSelectedPad
 
static wxPoint Pad_OldPos
 

Detailed Description

Edit footprint pads.

Definition in file move-drag_pads.cpp.

Function Documentation

static void Abort_Move_Pad ( EDA_DRAW_PANEL Panel,
wxDC *  DC 
)
static

Definition at line 29 of file move-drag_pads.cpp.

References EDA_ITEM::ClearFlags(), TRACK::Draw(), D_PAD::Draw(), EraseDragList(), g_DragSegmentList, GR_OR, GR_XOR, IN_EDIT, s_CurrentSelectedPad, EDA_DRAW_PANEL::SetMouseCapture(), D_PAD::SetPosition(), and EDA_ITEM::SetState().

Referenced by PCB_BASE_FRAME::StartMovePad().

30 {
32 
33  Panel->SetMouseCapture( NULL, NULL );
34 
35  if( pad == NULL )
36  return;
37 
38  pad->Draw( Panel, DC, GR_XOR );
39  pad->ClearFlags();
40  pad->SetPosition( Pad_OldPos );
41  pad->Draw( Panel, DC, GR_XOR );
42 
43  // Pad move in progress: restore origin of dragged tracks, if any.
44  for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
45  {
46  TRACK* track = g_DragSegmentList[ii].m_Track;
47  track->Draw( Panel, DC, GR_XOR );
48  track->SetState( IN_EDIT, false );
49  track->ClearFlags();
50  g_DragSegmentList[ii].RestoreInitialValues();
51  track->Draw( Panel, DC, GR_OR );
52  }
53 
54  EraseDragList();
55  s_CurrentSelectedPad = NULL;
56 }
#define IN_EDIT
Item currently edited.
Definition: base_struct.h:111
static wxPoint Pad_OldPos
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void EraseDragList()
Function EraseDragList clear the .m_Flags of all track segments stored in g_DragSegmentList and clear...
Definition: dragsegm.cpp:293
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:169
std::vector< DRAG_SEGM_PICKER > g_DragSegmentList
Definition: dragsegm.cpp:47
Definition: gr_basic.h:42
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void SetState(int type, int state)
Definition: base_struct.h:242
static D_PAD * s_CurrentSelectedPad
void ClearFlags(STATUS_FLAGS aMask=EDA_ITEM_ALL_FLAGS)
Definition: base_struct.h:254
void SetMouseCapture(MOUSE_CAPTURE_CALLBACK aMouseCaptureCallback, END_MOUSE_CAPTURE_CALLBACK aEndMouseCaptureCallback)
Function SetMouseCapture sets the mouse capture and end mouse capture callbacks to aMouseCaptureCallb...
static void Show_Pad_Move ( EDA_DRAW_PANEL aPanel,
wxDC *  aDC,
const wxPoint aPosition,
bool  aErase 
)
static

Definition at line 61 of file move-drag_pads.cpp.

References TRACK::Draw(), D_PAD::Draw(), g_DragSegmentList, EDA_DRAW_FRAME::GetCrossHairPosition(), EDA_DRAW_PANEL::GetParent(), GR_XOR, s_CurrentSelectedPad, and D_PAD::SetPosition().

Referenced by PCB_BASE_FRAME::StartMovePad().

63 {
64  TRACK* Track;
66 
67  if( pad == NULL ) // Should not occur
68  return;
69 
70  if( aErase )
71  pad->Draw( aPanel, aDC, GR_XOR );
72 
73  pad->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
74  pad->Draw( aPanel, aDC, GR_XOR );
75 
76  for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
77  {
78  Track = g_DragSegmentList[ii].m_Track;
79 
80  if( aErase )
81  Track->Draw( aPanel, aDC, GR_XOR );
82 
83  g_DragSegmentList[ii].SetTrackEndsCoordinates( wxPoint(0, 0) );
84 
85  Track->Draw( aPanel, aDC, GR_XOR );
86  }
87 }
void Draw(EDA_DRAW_PANEL *aPanel, wxDC *aDC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
void SetPosition(const wxPoint &aPos) override
Definition: class_pad.h:169
std::vector< DRAG_SEGM_PICKER > g_DragSegmentList
Definition: dragsegm.cpp:47
EDA_DRAW_FRAME * GetParent() const
Definition: draw_panel.cpp:175
void Draw(EDA_DRAW_PANEL *panel, wxDC *DC, GR_DRAWMODE aDrawMode, const wxPoint &aOffset=ZeroOffset) override
Function Draw BOARD_ITEMs have their own color information.
static D_PAD * s_CurrentSelectedPad
wxPoint GetCrossHairPosition(bool aInvertY=false) const
Function GetCrossHairPosition return the current cross hair position in logical (drawing) coordinates...

Variable Documentation

wxPoint Pad_OldPos
static

Definition at line 24 of file move-drag_pads.cpp.

D_PAD* s_CurrentSelectedPad
static

Definition at line 23 of file move-drag_pads.cpp.

Referenced by Abort_Move_Pad(), and Show_Pad_Move().