2012-09-11 07:33:17 +00:00
|
|
|
/**
|
|
|
|
* @file dragsegm.cpp
|
|
|
|
* @brief Classes to find track segments connected to a pad or a module
|
|
|
|
* for drag commands
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
|
|
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
|
|
|
#include <common.h>
|
2012-09-11 07:33:17 +00:00
|
|
|
#include <trigo.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <gr_basic.h>
|
|
|
|
#include <class_drawpanel.h>
|
|
|
|
#include <wxBasePcbFrame.h>
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <drag.h>
|
|
|
|
#include <pcbnew.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <class_module.h>
|
|
|
|
#include <class_board.h>
|
2012-09-11 07:33:17 +00:00
|
|
|
#include <connect.h>
|
2011-09-23 13:57:12 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/* a list of DRAG_SEGM_PICKER items used to move or drag tracks */
|
|
|
|
std::vector<DRAG_SEGM_PICKER> g_DragSegmentList;
|
2009-04-05 20:49:15 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
/* helper class to handle a list of track segments to drag or move
|
|
|
|
*/
|
2012-09-11 07:33:17 +00:00
|
|
|
DRAG_SEGM_PICKER::DRAG_SEGM_PICKER( TRACK* aTrack )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
m_Track = aTrack;
|
|
|
|
m_startInitialValue = m_Track->m_Start;
|
|
|
|
m_endInitialValue = m_Track->m_End;
|
|
|
|
m_Pad_Start = m_Track->GetState( START_ON_PAD ) ? (D_PAD*)m_Track->start : NULL;
|
|
|
|
m_Pad_End = m_Track->GetState( END_ON_PAD ) ? (D_PAD*)m_Track->end : NULL;
|
2007-11-02 18:21:43 +00:00
|
|
|
m_Flag = 0;
|
2012-09-11 07:33:17 +00:00
|
|
|
m_RotationOffset = 0.0;
|
|
|
|
m_Flipped = false;
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/* Set auxiliary parameters relative to calucaltions needed
|
|
|
|
* to find track ends positions while dragging pads
|
|
|
|
* and when modules are rotated, flipped ..
|
|
|
|
*/
|
|
|
|
void DRAG_SEGM_PICKER::SetAuxParameters()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
MODULE * module = NULL;
|
|
|
|
if( m_Pad_Start )
|
|
|
|
{
|
|
|
|
module = (MODULE *) m_Pad_Start->GetParent();
|
|
|
|
m_PadStartOffset = m_Track->GetStart() - m_Pad_Start->GetPosition();
|
|
|
|
}
|
2007-11-02 18:21:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
if( m_Pad_End )
|
2007-11-02 18:21:43 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
if( module == NULL )
|
|
|
|
module = (MODULE *) m_Pad_End->GetParent();
|
|
|
|
m_PadEndOffset = m_Track->GetEnd() - m_Pad_End->GetPosition();
|
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
if( module )
|
|
|
|
{
|
|
|
|
m_Flipped = module->IsFlipped();
|
|
|
|
m_RotationOffset = module->GetOrientation();
|
|
|
|
}
|
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/*
|
|
|
|
* Calculate track ends positions while dragging pads
|
|
|
|
* and when modules are rotated, flipped ..
|
|
|
|
* aOffset = module or pad position offset when moving the module or pad
|
|
|
|
* (the actual position is the module/pad position - offset)
|
|
|
|
*/
|
|
|
|
void DRAG_SEGM_PICKER::SetTrackEndsCoordinates(wxPoint aOffset)
|
|
|
|
{
|
|
|
|
// the track start position is the pad position + m_PadStartOffset
|
|
|
|
// however m_PadStartOffset is known for the initial rotation/flip
|
|
|
|
// this is also true for track end position and m_PadEndOffset
|
|
|
|
// Therefore, because rotation/flipping is allowed during a drag
|
|
|
|
// and move module, we should recalculate the pad offset,
|
|
|
|
// depending on the current orientation/flip state of the module
|
|
|
|
// relative to its initial orientation.
|
|
|
|
// (although most of time, offset is 0,0)
|
|
|
|
|
|
|
|
double curr_rot_offset = m_RotationOffset;
|
|
|
|
MODULE * module = NULL;
|
|
|
|
bool flip = false;
|
|
|
|
|
|
|
|
if( m_Pad_Start )
|
|
|
|
module = (MODULE *) m_Pad_Start->GetParent();
|
|
|
|
|
|
|
|
if( module == NULL && m_Pad_End )
|
|
|
|
module = (MODULE *) m_Pad_End->GetParent();
|
|
|
|
|
|
|
|
if( module )
|
|
|
|
{
|
|
|
|
flip = m_Flipped != module->IsFlipped();
|
|
|
|
curr_rot_offset = module->GetOrientation() - m_RotationOffset;
|
|
|
|
if( flip ) // when flipping, module orientation is negated
|
|
|
|
curr_rot_offset = - module->GetOrientation() - m_RotationOffset;
|
|
|
|
}
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
if( m_Pad_Start )
|
|
|
|
{
|
|
|
|
wxPoint padoffset = m_PadStartOffset;
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
if( curr_rot_offset != 0.0 )
|
|
|
|
RotatePoint(&padoffset, curr_rot_offset);
|
2007-11-02 18:21:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
if( flip )
|
|
|
|
NEGATE( padoffset.y );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
m_Track->m_Start = m_Pad_Start->GetPosition() - aOffset + padoffset;
|
|
|
|
}
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
if( m_Pad_End )
|
|
|
|
{
|
|
|
|
wxPoint padoffset = m_PadEndOffset;
|
|
|
|
|
|
|
|
if( curr_rot_offset != 0.0 )
|
|
|
|
RotatePoint(&padoffset, curr_rot_offset);
|
|
|
|
|
|
|
|
if( flip )
|
|
|
|
NEGATE( padoffset.y );
|
|
|
|
|
|
|
|
m_Track->m_End = m_Pad_End->GetPosition() - aOffset + padoffset;
|
2007-11-02 18:21:43 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
// A sort function needed to build ordered pads lists
|
|
|
|
extern bool sortPadsByXthenYCoord( D_PAD* const & ref, D_PAD* const & comp );
|
|
|
|
|
|
|
|
void DRAG_LIST::BuildDragListe( MODULE* aModule )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
m_Pad = NULL;
|
|
|
|
m_Module = aModule;
|
|
|
|
|
|
|
|
// Build connections info
|
|
|
|
CONNECTIONS connections( m_Brd );
|
|
|
|
std::vector<D_PAD*>&padList = connections.GetPadsList();
|
|
|
|
|
2012-02-19 04:02:19 +00:00
|
|
|
for( D_PAD* pad = aModule->m_Pads; pad; pad = pad->Next() )
|
2012-09-11 07:33:17 +00:00
|
|
|
padList.push_back( pad );
|
2007-11-02 18:21:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
sort( padList.begin(), padList.end(), sortPadsByXthenYCoord );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
fillList( connections );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
void DRAG_LIST::BuildDragListe( D_PAD* aPad )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
m_Pad = aPad;
|
|
|
|
m_Module = NULL;
|
2007-11-02 18:21:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
// Build connections info
|
|
|
|
CONNECTIONS connections( m_Brd );
|
|
|
|
std::vector<D_PAD*>&padList = connections.GetPadsList();
|
|
|
|
padList.push_back( aPad );
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
fillList( connections );
|
|
|
|
}
|
2012-02-19 04:02:19 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
// A helper function to sort track list per tracks
|
|
|
|
bool sort_tracklist( const DRAG_SEGM_PICKER& ref, const DRAG_SEGM_PICKER& tst )
|
|
|
|
{
|
|
|
|
return ref.m_Track < tst.m_Track;
|
|
|
|
}
|
|
|
|
/** Fills m_DragList with track segments connected to pads in aConnections
|
|
|
|
* For each selected track segment the EDIT flag is set
|
|
|
|
*/
|
|
|
|
void DRAG_LIST::fillList(CONNECTIONS& aConnections)
|
|
|
|
{
|
|
|
|
aConnections.BuildTracksCandidatesList( m_Brd->m_Track, NULL);
|
2007-11-02 18:21:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
// Build connections info tracks to pads
|
|
|
|
// Rebuild pads to track info only)
|
|
|
|
aConnections.SearchTracksConnectedToPads( false, true );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
std::vector<D_PAD*>padList = aConnections.GetPadsList();
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
// clear flags and variables of selected tracks
|
|
|
|
for( unsigned ii = 0; ii < padList.size(); ii++ )
|
|
|
|
{
|
|
|
|
D_PAD * pad = padList[ii];
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
// store track connected to the pad
|
|
|
|
for( unsigned jj = 0; jj < pad->m_TracksConnected.size(); jj++ )
|
2007-11-02 18:21:43 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
TRACK * track = pad->m_TracksConnected[jj];
|
|
|
|
track->start = NULL;
|
|
|
|
track->end = NULL;
|
|
|
|
track->SetState( START_ON_PAD|END_ON_PAD|BUSY, OFF );
|
2007-11-02 18:21:43 +00:00
|
|
|
}
|
2012-09-11 07:33:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// store tracks connected to pads
|
|
|
|
for( unsigned ii = 0; ii < padList.size(); ii++ )
|
|
|
|
{
|
|
|
|
D_PAD * pad = padList[ii];
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
// store track connected to the pad
|
|
|
|
for( unsigned jj = 0; jj < pad->m_TracksConnected.size(); jj++ )
|
2007-11-02 18:21:43 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
TRACK * track = pad->m_TracksConnected[jj];
|
|
|
|
|
|
|
|
if( pad->HitTest( track->GetStart() ) )
|
|
|
|
{
|
|
|
|
track->start = pad;
|
|
|
|
track->SetState( START_ON_PAD, ON );
|
|
|
|
}
|
|
|
|
|
|
|
|
if( pad->HitTest( track->GetEnd() ) )
|
|
|
|
{
|
|
|
|
track->end = pad;
|
|
|
|
track->SetState( END_ON_PAD, ON );
|
|
|
|
}
|
|
|
|
DRAG_SEGM_PICKER wrapper( track );
|
|
|
|
m_DragList.push_back( wrapper );
|
2007-11-02 18:21:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-09-11 07:33:17 +00:00
|
|
|
|
|
|
|
// remove duplicate in m_DragList:
|
|
|
|
// a track can be stored more than once if connected to 2 overlapping pads, or
|
|
|
|
// each track end connected to 2 moving pads
|
|
|
|
// to avoid artifact in draw function, items should be not duplicated
|
|
|
|
// However, there is not a lot of items to be removed, so there ir no optimization.
|
|
|
|
|
|
|
|
// sort the drag list by track pointers
|
|
|
|
sort( m_DragList.begin(), m_DragList.end(), sort_tracklist );
|
|
|
|
|
|
|
|
// Explore the list, merge duplicates
|
|
|
|
for( int ii = 0; ii < (int)m_DragList.size()-1; ii++ )
|
|
|
|
{
|
|
|
|
int jj = ii+1;
|
|
|
|
if( m_DragList[ii].m_Track != m_DragList[jj].m_Track )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
// duplicate found: merge info and remove duplicate
|
|
|
|
if( m_DragList[ii].m_Pad_Start == NULL )
|
|
|
|
m_DragList[ii].m_Pad_Start = m_DragList[jj].m_Pad_Start;
|
|
|
|
if( m_DragList[ii].m_Pad_End == NULL )
|
|
|
|
m_DragList[ii].m_Pad_End = m_DragList[jj].m_Pad_End;
|
|
|
|
|
|
|
|
m_DragList.erase(m_DragList.begin() + jj );
|
|
|
|
ii--;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize pad offsets and other params
|
|
|
|
for( unsigned ii = 0; ii < m_DragList.size(); ii++ )
|
|
|
|
m_DragList[ii].SetAuxParameters();
|
|
|
|
|
|
|
|
// Copy the list in global list
|
|
|
|
g_DragSegmentList = m_DragList;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DRAG_LIST::ClearList()
|
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < m_DragList.size(); ii++ )
|
|
|
|
m_DragList[ii].m_Track->ClearFlags();
|
|
|
|
|
|
|
|
m_DragList.clear();
|
|
|
|
|
|
|
|
m_Module = NULL;
|
|
|
|
m_Pad = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Redraw the list of segments stored in g_DragSegmentList, while moving a footprint
|
|
|
|
void DrawSegmentWhileMovingFootprint( EDA_DRAW_PANEL* panel, wxDC* DC )
|
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
|
|
|
{
|
|
|
|
TRACK* track = g_DragSegmentList[ii].m_Track;
|
|
|
|
|
|
|
|
#ifndef USE_WX_OVERLAY
|
|
|
|
track->Draw( panel, DC, GR_XOR ); // erase from screen at old position
|
|
|
|
#endif
|
|
|
|
g_DragSegmentList[ii].SetTrackEndsCoordinates( g_Offset_Module );
|
|
|
|
track->Draw( panel, DC, GR_XOR );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Function EraseDragList
|
|
|
|
* clear the .m_Flags of all track segments found in g_DragSegmentList
|
|
|
|
* and clear the list.
|
|
|
|
*/
|
|
|
|
void EraseDragList()
|
|
|
|
{
|
|
|
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
|
|
|
g_DragSegmentList[ii].m_Track->ClearFlags();
|
|
|
|
|
|
|
|
g_DragSegmentList.clear();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/* Add Track to the drag list, and erase it from screen
|
2007-11-02 18:21:43 +00:00
|
|
|
* flag = STARTPOINT (if the point to drag is the start point of Track) or ENDPOINT
|
|
|
|
*/
|
2012-09-11 07:33:17 +00:00
|
|
|
void AddSegmentToDragList( int flag, TRACK* aTrack )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
DRAG_SEGM_PICKER wrapper( aTrack );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
if( (flag & STARTPOINT) )
|
2010-08-31 15:54:05 +00:00
|
|
|
wrapper.m_Flag |= 1;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
if( (flag & ENDPOINT) )
|
2010-08-31 15:54:05 +00:00
|
|
|
wrapper.m_Flag |= 2;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
if( (flag & STARTPOINT) )
|
2012-09-11 07:33:17 +00:00
|
|
|
aTrack->SetFlags( STARTPOINT );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
if( (flag & ENDPOINT) )
|
2012-09-11 07:33:17 +00:00
|
|
|
aTrack->SetFlags( ENDPOINT );
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
g_DragSegmentList.push_back( wrapper );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-02 18:21:43 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
/* Build the list of tracks connected to the ref point
|
2011-09-22 19:16:55 +00:00
|
|
|
* Net codes must be up to date, because only tracks having the right net code are tested.
|
2012-09-11 07:33:17 +00:00
|
|
|
* aRefPos = reference point of connection
|
2007-11-02 18:21:43 +00:00
|
|
|
*/
|
2012-09-11 07:33:17 +00:00
|
|
|
void Collect_TrackSegmentsToDrag( BOARD* aPcb, wxPoint& aRefPos, int LayerMask, int net_code )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
TRACK* track = aPcb->m_Track->GetStartNetCode( net_code );
|
2010-08-31 15:54:05 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
for( ; track; track = track->Next() )
|
2007-11-02 18:21:43 +00:00
|
|
|
{
|
2011-09-22 19:16:55 +00:00
|
|
|
if( track->GetNet() != net_code ) // not the same netcodenet code: all candidates tested
|
2010-08-31 15:54:05 +00:00
|
|
|
break;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2011-09-07 19:41:04 +00:00
|
|
|
if( ( LayerMask & track->ReturnMaskLayer() ) == 0 )
|
2010-08-31 15:54:05 +00:00
|
|
|
continue; // Cannot be connected, not on the same layer
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( track->IsDragging() )
|
2010-08-31 15:54:05 +00:00
|
|
|
continue; // already put in list
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
int flag = 0;
|
2010-11-12 16:36:43 +00:00
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( (track->m_Start == aRefPos) && ((track->GetFlags() & STARTPOINT) == 0) )
|
2010-08-31 15:54:05 +00:00
|
|
|
flag |= STARTPOINT;
|
|
|
|
|
2011-12-21 13:42:02 +00:00
|
|
|
if( track->m_End == aRefPos && ((track->GetFlags() & ENDPOINT) == 0) )
|
2010-08-31 15:54:05 +00:00
|
|
|
flag |= ENDPOINT;
|
2008-11-24 06:53:43 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
// Note: vias will be flagged with both STARTPOINT and ENDPOINT
|
|
|
|
// and must not be entered twice.
|
|
|
|
if( flag )
|
2007-11-02 18:21:43 +00:00
|
|
|
{
|
2012-09-11 07:33:17 +00:00
|
|
|
AddSegmentToDragList( flag, track );
|
2011-09-07 19:41:04 +00:00
|
|
|
|
2010-08-31 15:54:05 +00:00
|
|
|
// If a connected via is found at location aRefPos,
|
|
|
|
// collect also tracks connected by this via.
|
2011-10-01 19:24:27 +00:00
|
|
|
if( track->Type() == PCB_VIA_T )
|
2012-09-11 07:33:17 +00:00
|
|
|
Collect_TrackSegmentsToDrag( aPcb, aRefPos, track->ReturnMaskLayer(),
|
2011-09-07 19:41:04 +00:00
|
|
|
net_code );
|
2007-11-02 18:21:43 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
/*
|
|
|
|
* Undraw the track segments in list, and set the IN_EDIT flag
|
|
|
|
* Usually called after the track list is built, to prepare
|
|
|
|
* the redraw of the list when the mouse is moved
|
2007-11-02 18:21:43 +00:00
|
|
|
*/
|
2012-09-11 07:33:17 +00:00
|
|
|
void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2010-08-31 15:54:05 +00:00
|
|
|
for( unsigned ii = 0; ii < g_DragSegmentList.size(); ii++ )
|
2012-09-11 07:33:17 +00:00
|
|
|
{
|
|
|
|
TRACK* track = g_DragSegmentList[ii].m_Track;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2012-09-11 07:33:17 +00:00
|
|
|
track->Draw( aCanvas, aDC, GR_XOR );
|
|
|
|
track->SetState( IN_EDIT, ON );
|
|
|
|
|
|
|
|
if( (g_DragSegmentList[ii].m_Flag & STARTPOINT) )
|
|
|
|
track->SetFlags( STARTPOINT );
|
|
|
|
|
|
|
|
if( (g_DragSegmentList[ii].m_Flag & ENDPOINT) )
|
|
|
|
track->SetFlags( ENDPOINT );
|
|
|
|
|
|
|
|
track->Draw( aCanvas, aDC, GR_XOR );
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
2012-09-11 07:33:17 +00:00
|
|
|
|