2011-09-23 13:57:12 +00:00
|
|
|
/**
|
|
|
|
* @file drag.h
|
|
|
|
* @brief Useful class and functions used to drag tracks
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <wx/gdicmn.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_track.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
|
|
|
|
|
|
|
class wxDC;
|
|
|
|
class EDA_DRAW_PANEL;
|
|
|
|
class MODULE;
|
|
|
|
class D_PAD;
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
/** Helper class to handle a list of track segments to drag
|
|
|
|
* and has info to undo/abort the move command
|
|
|
|
* a DRAG_SEGM manage one track segment or a via
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
class DRAG_SEGM
|
|
|
|
{
|
|
|
|
public:
|
2011-09-07 19:41:04 +00:00
|
|
|
TRACK* m_Segm; /* pointer to the segment a "dragger */
|
|
|
|
D_PAD* m_Pad_Start; /* pointer to the pad origin if origin segment of pad */
|
|
|
|
D_PAD* m_Pad_End; /* pointer to the pad end if end segment of pad */
|
|
|
|
int m_Flag; /* indicator flags */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
private:
|
2010-08-31 15:54:05 +00:00
|
|
|
wxPoint m_StartInitialValue;
|
|
|
|
wxPoint m_EndInitialValue; // For abort: initial m_Start and m_End values for m_Segm
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
public:
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
DRAG_SEGM( TRACK* segm );
|
|
|
|
~DRAG_SEGM() {};
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
void SetInitialValues()
|
|
|
|
{
|
|
|
|
m_Segm->m_Start = m_StartInitialValue;
|
|
|
|
m_Segm->m_End = m_EndInitialValue;
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
};
|
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
/* Variables */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
// a list of DRAG_SEGM items used to move or drag tracks.
|
|
|
|
// Each DRAG_SEGM item points a segment to move.
|
|
|
|
extern std::vector<DRAG_SEGM> g_DragSegmentList;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
/* Functions */
|
2011-09-07 19:41:04 +00:00
|
|
|
void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC );
|
2011-01-21 19:30:59 +00:00
|
|
|
void Build_Drag_Liste( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* Module );
|
|
|
|
void Build_1_Pad_SegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC, D_PAD* PtPad );
|
|
|
|
void Collect_TrackSegmentsToDrag( EDA_DRAW_PANEL* panel, wxDC* DC,
|
2011-09-07 19:41:04 +00:00
|
|
|
wxPoint& point, int LayerMask, int net_code );
|
2007-11-02 18:21:43 +00:00
|
|
|
|
|
|
|
|
2010-11-12 16:59:16 +00:00
|
|
|
/**
|
|
|
|
* Function EraseDragList
|
2010-08-31 15:54:05 +00:00
|
|
|
* clear the .m_Flags of all track segments managed by in g_DragSegmentList
|
|
|
|
* and clear the list.
|
|
|
|
* In order to avoid useless memory allocation, the memory is not freed
|
|
|
|
* and will be reused when creating a new list
|
|
|
|
*/
|
|
|
|
void EraseDragList();
|
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
/* Add the segment"Track" to the drag list, and erase it from screen
|
2010-08-31 15:54:05 +00:00
|
|
|
* flag = STARTPOINT (if the point to drag is the start point of Track)
|
|
|
|
* or ENDPOINT
|
2007-11-02 18:21:43 +00:00
|
|
|
*/
|
2011-01-21 19:30:59 +00:00
|
|
|
void AddSegmentToDragList( EDA_DRAW_PANEL* panel, wxDC* DC, int flag, TRACK* Track );
|