gr_basic: fix incorrect clipping of thick lines (due to changes in code, the thickness was not taken in account to calculate the clip box size)
Pcbnew: fix a very minor bug.
This commit is contained in:
commit
14e3507e16
|
@ -43,7 +43,7 @@ after calling this conversion function, the comma is changed in point.
|
||||||
(Happens after reading a parameter stored in a wxConfig structure, if this
|
(Happens after reading a parameter stored in a wxConfig structure, if this
|
||||||
parameter is a double)
|
parameter is a double)
|
||||||
Workaround:
|
Workaround:
|
||||||
Use a version > 2.9.2
|
Use a version > 2.9.1
|
||||||
|
|
||||||
Currently ( 2011, april 12 ) the 2.9.2 is not yet finalized
|
Currently ( 2011, april 12 ) the 2.9.2 is not yet finalized
|
||||||
(and can be found only on the wxWidgets snv server)
|
(and can be found only on the wxWidgets snv server)
|
||||||
|
|
|
@ -63,7 +63,6 @@ static void ClipAndDrawFilledPoly( EDA_RECT * ClipBox, wxDC * DC, wxPoint Points
|
||||||
* ( GRSCircle is called by GRCircle for instance) after mapping coordinates
|
* ( GRSCircle is called by GRCircle for instance) after mapping coordinates
|
||||||
* from user units to screen units(pixels coordinates)
|
* from user units to screen units(pixels coordinates)
|
||||||
*/
|
*/
|
||||||
static void GRSMoveTo( int x, int y );
|
|
||||||
static void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1,
|
static void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1,
|
||||||
int x2, int y2, int aWidth, int aColor,
|
int x2, int y2, int aWidth, int aColor,
|
||||||
wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
wxPenStyle aStyle = wxPENSTYLE_SOLID );
|
||||||
|
@ -326,18 +325,9 @@ static void WinClipAndDrawLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int
|
||||||
|
|
||||||
if( ClipBox )
|
if( ClipBox )
|
||||||
{
|
{
|
||||||
xcliplo = ClipBox->GetX();
|
EDA_RECT clipbox(*ClipBox);
|
||||||
ycliplo = ClipBox->GetY();
|
clipbox.Inflate(width/2);
|
||||||
xcliphi = ClipBox->GetRight();
|
if( clipLine( &clipbox, x1, y1, x2, y2 ) )
|
||||||
ycliphi = ClipBox->GetBottom();
|
|
||||||
|
|
||||||
xcliplo -= width;
|
|
||||||
ycliplo -= width;
|
|
||||||
|
|
||||||
xcliphi += width;
|
|
||||||
ycliphi += width;
|
|
||||||
|
|
||||||
if( clipLine( ClipBox, x1, y1, x2, y2 ) )
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -591,15 +581,6 @@ void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Move to a new position, in screen (pixels) space.
|
|
||||||
*/
|
|
||||||
void GRSMoveTo( int x, int y )
|
|
||||||
{
|
|
||||||
GRLastMoveToX = x;
|
|
||||||
GRLastMoveToY = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GRLineArray
|
* Function GRLineArray
|
||||||
|
@ -634,15 +615,22 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
||||||
gc->ResetClip();
|
gc->ResetClip();
|
||||||
delete gc;
|
delete gc;
|
||||||
#else
|
#else
|
||||||
for( unsigned i = 0; i < aLines.size(); )
|
|
||||||
|
if( aClipBox )
|
||||||
|
aClipBox->Inflate(aWidth/2);
|
||||||
|
for( unsigned i = 0; i < aLines.size(); i += 2)
|
||||||
{
|
{
|
||||||
WinClipAndDrawLine( aClipBox, aDC, aLines[i].x, aLines[i].y,
|
int x1 = aLines[i].x;
|
||||||
aLines[i + 1].x, aLines[i + 1].y, aColor, aWidth );
|
int y1 = aLines[i].y;
|
||||||
i++;
|
int x2 = aLines[i+1].x;
|
||||||
GRLastMoveToX = aLines[i].x;
|
int y2 = aLines[i+1].y;
|
||||||
GRLastMoveToY = aLines[i].y;
|
GRLastMoveToX = x2;
|
||||||
i++;
|
GRLastMoveToY = y2;
|
||||||
|
if( ( aClipBox == NULL ) || clipLine( aClipBox, x1, y1, x2, y2 ) )
|
||||||
|
aDC->DrawLine( x1, y1, x2, y2 );
|
||||||
}
|
}
|
||||||
|
if( aClipBox )
|
||||||
|
aClipBox->Inflate(-aWidth/2);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,18 +651,10 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
|
|
||||||
if( ClipBox )
|
if( ClipBox )
|
||||||
{
|
{
|
||||||
xcliplo = ClipBox->GetX();
|
EDA_RECT clipbox(*ClipBox);
|
||||||
ycliplo = ClipBox->GetY();
|
clipbox.Inflate(width/2);
|
||||||
xcliphi = ClipBox->GetRight();
|
|
||||||
ycliphi = ClipBox->GetHeight();
|
|
||||||
|
|
||||||
xcliplo -= width;
|
if( clipLine( &clipbox, x1, y1, x2, y2 ) )
|
||||||
ycliplo -= width;
|
|
||||||
|
|
||||||
xcliphi += width;
|
|
||||||
ycliphi += width;
|
|
||||||
|
|
||||||
if( clipLine( ClipBox, x1, y1, x2, y2 ) )
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -935,7 +915,8 @@ static void GRSClosedPoly( EDA_RECT* ClipBox,
|
||||||
|
|
||||||
if( Fill && ( aPointCount > 2 ) )
|
if( Fill && ( aPointCount > 2 ) )
|
||||||
{
|
{
|
||||||
GRSMoveTo( aPoints[aPointCount - 1].x, aPoints[aPointCount - 1].y );
|
GRLastMoveToX = aPoints[aPointCount - 1].x;
|
||||||
|
GRLastMoveToY = aPoints[aPointCount - 1].y;
|
||||||
GRSetBrush( DC, BgColor, FILLED );
|
GRSetBrush( DC, BgColor, FILLED );
|
||||||
#ifdef USE_CLIP_FILLED_POLYGONS
|
#ifdef USE_CLIP_FILLED_POLYGONS
|
||||||
ClipAndDrawFilledPoly( ClipBox, DC, aPoints, aPointCount );
|
ClipAndDrawFilledPoly( ClipBox, DC, aPoints, aPointCount );
|
||||||
|
@ -1345,12 +1326,19 @@ void GRSRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
|
||||||
points[4] = points[0];
|
points[4] = points[0];
|
||||||
GRSetColorPen( aDC, aColor, aWidth, aStyle );
|
GRSetColorPen( aDC, aColor, aWidth, aStyle );
|
||||||
GRSetBrush( aDC, BLACK );
|
GRSetBrush( aDC, BLACK );
|
||||||
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5); // polygon approach is more accurate
|
if( aClipBox )
|
||||||
|
{
|
||||||
|
EDA_RECT clipbox(*aClipBox);
|
||||||
|
clipbox.Inflate(aWidth);
|
||||||
|
ClipAndDrawFilledPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
void GRSFilledRect( EDA_RECT* aClipBox, wxDC* aDC, int x1, int y1, int x2, int y2,
|
||||||
int width, int Color, int BgColor )
|
int aWidth, int aColor, int aBgColor )
|
||||||
{
|
{
|
||||||
|
|
||||||
wxPoint points[5];
|
wxPoint points[5];
|
||||||
|
@ -1359,9 +1347,16 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
|
||||||
points[2] = wxPoint(x2, y2);
|
points[2] = wxPoint(x2, y2);
|
||||||
points[3] = wxPoint(x2, y1);
|
points[3] = wxPoint(x2, y1);
|
||||||
points[4] = points[0];
|
points[4] = points[0];
|
||||||
GRSetBrush( DC, BgColor, FILLED );
|
GRSetBrush( aDC, aBgColor, FILLED );
|
||||||
GRSetColorPen( DC, BgColor, width );
|
GRSetColorPen( aDC, aBgColor, aWidth );
|
||||||
ClipAndDrawFilledPoly(ClipBox, DC, points, 5); // polygon approach is more accurate
|
if( aClipBox && (aWidth > 0) )
|
||||||
|
{
|
||||||
|
EDA_RECT clipbox(*aClipBox);
|
||||||
|
clipbox.Inflate(aWidth);
|
||||||
|
ClipAndDrawFilledPoly(&clipbox, aDC, points, 5); // polygon approach is more accurate
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ClipAndDrawFilledPoly(aClipBox, aDC, points, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -818,8 +818,32 @@ public:
|
||||||
*/
|
*/
|
||||||
void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem );
|
void Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem );
|
||||||
|
|
||||||
TRACK* Begin_Route( TRACK* track, wxDC* DC );
|
/**
|
||||||
void End_Route( TRACK* track, wxDC* DC );
|
* Function Begin_Route
|
||||||
|
* Starts a new track and/or establish of a new track point.
|
||||||
|
*
|
||||||
|
* For a new track:
|
||||||
|
* - Search the netname of the new track from the starting point
|
||||||
|
* if it is on a pad or an existing track
|
||||||
|
* - Highlight all this net
|
||||||
|
* If a track is in progress:
|
||||||
|
* - Call DRC
|
||||||
|
* - If DRC is OK: finish the track segment and starts a new one.
|
||||||
|
* @param aTrack = the current track segment, or NULL to start a new track
|
||||||
|
* @param aDC = the current device context
|
||||||
|
* @return a pointer to the new track segment or null if not created (DRC error)
|
||||||
|
*/
|
||||||
|
TRACK* Begin_Route( TRACK* aTrack, wxDC* aDC );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function End_Route
|
||||||
|
* Terminates a track currently being created
|
||||||
|
* @param aTrack = the current track segment in progress
|
||||||
|
* @param aDC = the current device context
|
||||||
|
* @return true if the track was created, false if not (due to a DRC error)
|
||||||
|
*/
|
||||||
|
bool End_Route( TRACK* aTrack, wxDC* aDC );
|
||||||
|
|
||||||
void ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC );
|
void ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC );
|
||||||
void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
|
void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
|
||||||
void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
|
void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
|
||||||
|
|
|
@ -88,6 +88,24 @@ BOARD::~BOARD()
|
||||||
delete m_NetInfo;
|
delete m_NetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function PushHightLight
|
||||||
|
* save current hight light info for later use
|
||||||
|
*/
|
||||||
|
void BOARD::PushHightLight()
|
||||||
|
{
|
||||||
|
m_hightLightPrevious = m_hightLight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Function PopHightLight
|
||||||
|
* retrieve a previously saved hight light info
|
||||||
|
*/
|
||||||
|
void BOARD::PopHightLight()
|
||||||
|
{
|
||||||
|
m_hightLight = m_hightLightPrevious;
|
||||||
|
m_hightLightPrevious.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetCurrentNetClass
|
* Function SetCurrentNetClass
|
||||||
|
|
|
@ -321,17 +321,13 @@ public:
|
||||||
* Function PushHightLight
|
* Function PushHightLight
|
||||||
* save current hight light info for later use
|
* save current hight light info for later use
|
||||||
*/
|
*/
|
||||||
void PushHightLight() { m_hightLightPrevious = m_hightLight; }
|
void PushHightLight();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function PopHightLight
|
* Function PopHightLight
|
||||||
* retrieve a previously saved hight light info
|
* retrieve a previously saved hight light info
|
||||||
*/
|
*/
|
||||||
void PopHightLight()
|
void PopHightLight();
|
||||||
{
|
|
||||||
m_hightLight = m_hightLightPrevious;
|
|
||||||
m_hightLightPrevious.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetCopperLayerCount
|
* Function GetCopperLayerCount
|
||||||
|
|
|
@ -187,8 +187,7 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double dist = ( (double) dx * dx ) + ( (double) dy * dy );
|
double dist = hypot( (double)dx, (double) dy );
|
||||||
dist = sqrt( dist );
|
|
||||||
if( min_dist >= (int) dist )
|
if( min_dist >= (int) dist )
|
||||||
result |= STARTPOINT;
|
result |= STARTPOINT;
|
||||||
}
|
}
|
||||||
|
@ -202,8 +201,7 @@ int TRACK::IsPointOnEnds( const wxPoint& point, int min_dist )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double dist = ( (double) dx * dx ) + ( (double) dy * dy );
|
double dist = hypot( (double) dx, (double) dy );
|
||||||
dist = sqrt( dist );
|
|
||||||
if( min_dist >= (int) dist )
|
if( min_dist >= (int) dist )
|
||||||
result |= ENDPOINT;
|
result |= ENDPOINT;
|
||||||
}
|
}
|
||||||
|
@ -626,17 +624,13 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
|
|
||||||
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
if( DC->LogicalToDeviceXRel( l_piste ) < L_MIN_DESSIN )
|
||||||
{
|
{
|
||||||
GRLine( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRLine( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, 0, color );
|
||||||
m_Start.y + aOffset.y,
|
|
||||||
m_End.x + aOffset.x, m_End.y + aOffset.y, 0, color );
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
|
if( !DisplayOpt.DisplayPcbTrackFill || GetState( FORCE_SKETCH ) )
|
||||||
{
|
{
|
||||||
GRCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCSegm( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset, m_Width, color );
|
||||||
m_Start.y + aOffset.y,
|
|
||||||
m_End.x + aOffset.x, m_End.y + aOffset.y, m_Width, color );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -651,9 +645,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint&
|
||||||
// Show clearance for tracks, not for zone segments
|
// Show clearance for tracks, not for zone segments
|
||||||
if( ShowClearance( this ) )
|
if( ShowClearance( this ) )
|
||||||
{
|
{
|
||||||
GRCSegm( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCSegm( &panel->m_ClipBox, DC, m_Start + aOffset, m_End + aOffset,
|
||||||
m_Start.y + aOffset.y,
|
|
||||||
m_End.x + aOffset.x, m_End.y + aOffset.y,
|
|
||||||
m_Width + (GetClearance() * 2), color );
|
m_Width + (GetClearance() * 2), color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,18 +776,14 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
}
|
}
|
||||||
|
|
||||||
if( fillvia )
|
if( fillvia )
|
||||||
GRFilledCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRFilledCircle( &panel->m_ClipBox, DC, m_Start + aOffset, rayon, color );
|
||||||
m_Start.y + aOffset.y, rayon, 0, color, color );
|
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset,rayon, 0, color );
|
||||||
m_Start.y + aOffset.y, rayon, color );
|
|
||||||
if ( fast_draw )
|
if ( fast_draw )
|
||||||
return;
|
return;
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, inner_rayon, 0, color );
|
||||||
m_Start.y + aOffset.y,
|
|
||||||
inner_rayon, color );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the via hole if the display option allows it
|
// Draw the via hole if the display option allows it
|
||||||
|
@ -831,17 +819,14 @@ void SEGVIA::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wxPoint
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( drill_rayon < inner_rayon ) // We can show the via hole
|
if( drill_rayon < inner_rayon ) // We can show the via hole
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset, drill_rayon, 0, color );
|
||||||
m_Start.y + aOffset.y,
|
|
||||||
drill_rayon, color );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
|
if( DisplayOpt.ShowTrackClearanceMode == SHOW_CLEARANCE_ALWAYS )
|
||||||
GRCircle( &panel->m_ClipBox, DC, m_Start.x + aOffset.x,
|
GRCircle( &panel->m_ClipBox, DC, m_Start + aOffset,
|
||||||
m_Start.y + aOffset.y,
|
rayon + GetClearance(), 0, color );
|
||||||
rayon + GetClearance(), color );
|
|
||||||
|
|
||||||
// for Micro Vias, draw a partial cross :
|
// for Micro Vias, draw a partial cross :
|
||||||
// X on component layer, or + on copper layer
|
// X on component layer, or + on copper layer
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#include "protos.h"
|
#include "protos.h"
|
||||||
|
|
||||||
|
|
||||||
static void Exit_Editrack( EDA_DRAW_PANEL* panel, wxDC* DC );
|
static void Abort_Create_Track( EDA_DRAW_PANEL* panel, wxDC* DC );
|
||||||
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
const wxPoint& aPosition, bool aErase );
|
const wxPoint& aPosition, bool aErase );
|
||||||
static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
|
static void ComputeBreakPoint( TRACK* track, int n, wxPoint end );
|
||||||
|
@ -30,7 +30,7 @@ static PICKED_ITEMS_LIST s_ItemsListPicker;
|
||||||
/* Routine to cancel the route if a track is being drawn, or exit the
|
/* Routine to cancel the route if a track is being drawn, or exit the
|
||||||
* application EDITRACK.
|
* application EDITRACK.
|
||||||
*/
|
*/
|
||||||
static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent();
|
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Panel->GetParent();
|
||||||
BOARD * pcb = frame->GetBoard();
|
BOARD * pcb = frame->GetBoard();
|
||||||
|
@ -45,11 +45,11 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
|
|
||||||
pcb->PopHightLight();
|
pcb->PopHightLight();
|
||||||
if( pcb->IsHightLightNetON() )
|
if( pcb->IsHightLightNetON() )
|
||||||
frame->High_Light( DC );
|
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
|
||||||
|
|
||||||
frame->MsgPanel->EraseMsgBox();
|
frame->MsgPanel->EraseMsgBox();
|
||||||
|
|
||||||
// Undo pending changes (mainly a lock point cretion) and clear the
|
// Undo pending changes (mainly a lock point creation) and clear the
|
||||||
// undo picker list:
|
// undo picker list:
|
||||||
frame->PutDataInPreviousState( &s_ItemsListPicker, false, false );
|
frame->PutDataInPreviousState( &s_ItemsListPicker, false, false );
|
||||||
s_ItemsListPicker.ClearListAndDeleteItems();
|
s_ItemsListPicker.ClearListAndDeleteItems();
|
||||||
|
@ -63,16 +63,19 @@ static void Exit_Editrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Begin drawing a new track and/or establish of a new track point.
|
* Function Begin_Route
|
||||||
|
* Starts a new track and/or establish of a new track point.
|
||||||
*
|
*
|
||||||
* If no current track record of:
|
* For a new track:
|
||||||
* - Search netname of the new track (pad out departure netname
|
* - Search the netname of the new track from the starting point
|
||||||
* if the departure runway on an old track
|
* if it is on a pad or an existing track
|
||||||
* - Highlight all the net
|
* - Highlight all this net
|
||||||
* - Initialize the various trace pointers.
|
* If a track is in progress:
|
||||||
* If current track:
|
* - Call DRC
|
||||||
* - Control DRC
|
* - If DRC is OK: finish the track segment and starts a new one.
|
||||||
* - OK if DRC: adding a new track.
|
* param aTrack = the current track segment, or NULL to start a new track
|
||||||
|
* param aDC = the current device context
|
||||||
|
* return a pointer to the new track segment or null if not created (DRC error)
|
||||||
*/
|
*/
|
||||||
TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
{
|
{
|
||||||
|
@ -83,10 +86,10 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
BOARD_ITEM* LockPoint;
|
BOARD_ITEM* LockPoint;
|
||||||
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
wxPoint pos = GetScreen()->GetCrossHairPosition();
|
||||||
|
|
||||||
DrawPanel->SetMouseCapture( ShowNewTrackWhenMovingCursor, Exit_Editrack );
|
|
||||||
|
|
||||||
if( aTrack == NULL ) /* Starting a new track */
|
if( aTrack == NULL ) /* Starting a new track */
|
||||||
{
|
{
|
||||||
|
DrawPanel->SetMouseCapture( ShowNewTrackWhenMovingCursor, Abort_Create_Track );
|
||||||
|
|
||||||
// Prepare the undo command info
|
// Prepare the undo command info
|
||||||
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be
|
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be
|
||||||
// necessary,
|
// necessary,
|
||||||
|
@ -141,7 +144,8 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
|
||||||
|
|
||||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||||
|
|
||||||
High_Light( DC );
|
GetBoard()->HightLightON();
|
||||||
|
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
|
||||||
|
|
||||||
// Display info about track Net class, and init track and vias sizes:
|
// Display info about track Net class, and init track and vias sizes:
|
||||||
g_CurrentTrackSegment->SetNet( GetBoard()->GetHightLightNetCode() );
|
g_CurrentTrackSegment->SetNet( GetBoard()->GetHightLightNetCode() );
|
||||||
|
@ -408,19 +412,22 @@ bool PCB_EDIT_FRAME::Add_45_degrees_Segment( wxDC* DC )
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* End trace route in progress.
|
* Function End_Route
|
||||||
|
* Terminates a track currently being created
|
||||||
|
* param aTrack = the current track segment in progress
|
||||||
|
* @return true if the track was created, false if not (due to a DRC error)
|
||||||
*/
|
*/
|
||||||
void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
{
|
{
|
||||||
int masquelayer =
|
int masquelayer =
|
||||||
g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
|
g_TabOneLayerMask[( (PCB_SCREEN*) GetScreen() )->m_Active_Layer];
|
||||||
|
|
||||||
if( aTrack == NULL )
|
if( aTrack == NULL )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if( Drc_On && BAD_DRC==
|
if( Drc_On && BAD_DRC==
|
||||||
m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
/* Sauvegarde des coord du point terminal de la piste */
|
/* Sauvegarde des coord du point terminal de la piste */
|
||||||
wxPoint pos = g_CurrentTrackSegment->m_End;
|
wxPoint pos = g_CurrentTrackSegment->m_End;
|
||||||
|
@ -428,7 +435,7 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
D( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||||
|
|
||||||
if( Begin_Route( aTrack, DC ) == NULL )
|
if( Begin_Route( aTrack, DC ) == NULL )
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, true );
|
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, true );
|
||||||
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
|
ShowNewTrackWhenMovingCursor( DrawPanel, DC, wxDefaultPosition, false );
|
||||||
|
@ -531,10 +538,12 @@ void PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
|
||||||
GetBoard()->PopHightLight();
|
GetBoard()->PopHightLight();
|
||||||
|
|
||||||
if( GetBoard()->IsHightLightNetON() )
|
if( GetBoard()->IsHightLightNetON() )
|
||||||
High_Light( DC );
|
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
|
||||||
|
|
||||||
DrawPanel->SetMouseCapture( NULL, NULL );
|
DrawPanel->SetMouseCapture( NULL, NULL );
|
||||||
SetCurItem( NULL );
|
SetCurItem( NULL );
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -410,8 +410,8 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case TYPE_VIA:
|
case TYPE_VIA:
|
||||||
if( DrawStruct->IsNew() )
|
if( DrawStruct->IsNew() )
|
||||||
{
|
{
|
||||||
End_Route( (TRACK*) DrawStruct, aDC );
|
if( End_Route( (TRACK*) DrawStruct, aDC ) )
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
}
|
}
|
||||||
else if( DrawStruct->m_Flags == 0 )
|
else if( DrawStruct->m_Flags == 0 )
|
||||||
{
|
{
|
||||||
|
@ -448,8 +448,8 @@ void PCB_EDIT_FRAME::OnLeftDClick( wxDC* aDC, const wxPoint& aPosition )
|
||||||
case ID_TRACK_BUTT:
|
case ID_TRACK_BUTT:
|
||||||
if( DrawStruct && DrawStruct->IsNew() )
|
if( DrawStruct && DrawStruct->IsNew() )
|
||||||
{
|
{
|
||||||
End_Route( (TRACK*) DrawStruct, aDC );
|
if( End_Route( (TRACK*) DrawStruct, aDC ) )
|
||||||
DrawPanel->m_AutoPAN_Request = false;
|
DrawPanel->m_AutoPAN_Request = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,6 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC,
|
||||||
Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
|
Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo: this high-light functionality could be built into me.
|
|
||||||
if( IsHightLightNetON() )
|
if( IsHightLightNetON() )
|
||||||
DrawHighLight( aPanel, DC, GetHightLightNetCode() );
|
DrawHighLight( aPanel, DC, GetHightLightNetCode() );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue