Commit 3d7c91af authored by Wayne Stambaugh's avatar Wayne Stambaugh

PCBNew locate via code refactoring and other minor fixes.

* Refactor via locate code into the appropriate object.
* Rename all HightLight code to HighLight.
* Dead code removal.
parent 5bf7f4cd
......@@ -831,7 +831,14 @@ public:
*/
bool Other_Layer_Route( TRACK* track, wxDC* DC );
void HighlightUnconnectedPads( wxDC* DC );
/**
* Function DisplayNetStatus
* shows the status of the net at the current mouse position or the
* PCB status if no segment selected.
*/
void DisplayNetStatus( wxDC* DC );
TRACK* Delete_Segment( wxDC* DC, TRACK* Track );
void Delete_Track( wxDC* DC, TRACK* Track );
void Delete_net( wxDC* DC, TRACK* Track );
......@@ -900,7 +907,6 @@ public:
*/
bool End_Route( TRACK* aTrack, wxDC* aDC );
void ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC );
void Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On );
void Attribut_net( wxDC* DC, int net_code, bool Flag_On );
......@@ -1177,7 +1183,15 @@ public:
void ReadAutoroutedTracks( wxDC* DC );
void GlobalRoute( wxDC* DC );
/**
* Function Show_1_Ratsnest
* draw ratsnest.
*
* The net edge pad with mouse or module locates the mouse.
* Delete the ratsnest if no module or pad is selected.
*/
void Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC );
void Clean_Pcb( wxDC* DC );
void InstallFindFrame( const wxPoint& pos, wxDC* DC );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*******************************************************************/
/* class_track.h: definitions relatives to tracks, vias and zones */
/*******************************************************************/
/**
* @file class_track.h
* @brief Definitions for tracks, vias and zones.
*/
#ifndef CLASS_TRACK_H
#define CLASS_TRACK_H
......@@ -52,6 +53,12 @@ public:
* Function Copy
* will copy this object whether it is a TRACK or a SEGVIA returning
* the corresponding type.
* Because of the way SEGVIA and SEGZONE are derived from TRACK and because there are
* virtual functions being used, we can no longer simply copy a TRACK and
* expect it to be a via or zone. We must construct a true SEGVIA or SEGZONE so its
* constructor can initialize the virtual function table properly. This factory type
* of function called Copy() can duplicate either a TRACK, SEGVIA, or SEGZONE.
*
* @return - TRACK*, SEGVIA*, or SEGZONE*, declared as the least common
* denominator: TRACK
*/
......@@ -60,7 +67,6 @@ public:
TRACK* Next() const { return (TRACK*) Pnext; }
TRACK* Back() const { return (TRACK*) Pback; }
/**
* Function Move
* move this object.
......@@ -198,6 +204,13 @@ public:
*/
int ReturnMaskLayer();
/**
* Function IsPointOnEnds
* returns STARTPOINT if point if near (dist = min_dist) start point, ENDPOINT if
* point if near (dist = min_dist) end point,STARTPOINT|ENDPOINT if point if near
* (dist = min_dist) both ends, or 0 if none of the above.
* if min_dist < 0: min_dist = track_width/2
*/
int IsPointOnEnds( const wxPoint& point, int min_dist = 0 );
/**
......@@ -265,6 +278,28 @@ public:
*/
bool HitTest( EDA_RECT& refArea );
/**
* Function GetVia
* finds the first SEGVIA object at \a aPosition on \a aLayer starting at the trace.
*
* @param aPosition The wxPoint to HitTest() against.
* @param aLayerMask The layer to match, pass -1 for a don't care.
* @return A pointer to a SEGVIA object if found, else NULL.
*/
TRACK* GetVia( const wxPoint& aPosition, int aLayerMask = -1 );
/**
* Function GetVia
* finds the first SEGVIA object at \a aPosition on \a aLayer starting at the trace
* and ending at \a aEndTrace.
*
* @param aEndTrace Pointer to the last TRACK object to end search.
* @param aPosition The wxPoint to HitTest() against.
* @param aLayerMask The layers to match, pass -1 for a don't care.
* @return A pointer to a SEGVIA object if found, else NULL.
*/
TRACK* GetVia( TRACK* aEndTrace, const wxPoint& aPosition, int aLayerMask );
/**
* Function GetClass
* returns the class name.
......@@ -351,7 +386,6 @@ public:
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int aDrawMode,
const wxPoint& aOffset = ZeroOffset );
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual
......@@ -361,7 +395,25 @@ public:
*/
bool IsOnLayer( int aLayer ) const;
/**
* Function SetLayerPair
* set the .m_Layer member param:
* For a via m_Layer contains the 2 layers :
* top layer and bottom layer used by the via.
* The via connect all layers from top layer to bottom layer
* 4 bits for the first layer and 4 next bits for the secaon layer
* @param top_layer = first layer connected by the via
* @param bottom_layer = last layer connected by the via
*/
void SetLayerPair( int top_layer, int bottom_layer );
/**
* Function ReturnLayerPair
* Return the 2 layers used by the via (the via actually uses
* all layers between these 2 layers)
* @param top_layer = pointer to the first layer (can be null)
* @param bottom_layer = pointer to the last layer (can be null)
*/
void ReturnLayerPair( int* top_layer, int* bottom_layer ) const;
/**
......
......@@ -96,17 +96,19 @@ void RemoteCommand( const char* cmdline )
if( netcode > 0 ) /* highlight the pad net*/
{
pcb->HightLightON();
pcb->SetHightLightNet( netcode );
pcb->HighLightON();
pcb->SetHighLightNet( netcode );
}
else
{
pcb->HightLightOFF();
pcb->SetHightLightNet( -1 );
pcb->HighLightOFF();
pcb->SetHighLightNet( -1 );
}
if( module == NULL )
{
msg.Printf( _( "%s not found" ), GetChars( modName ) );
}
else if( pad == NULL )
{
msg.Printf( _( "%s pin %s not found" ), GetChars( modName ), GetChars( pinName ) );
......
......@@ -78,7 +78,7 @@ TRACK* PCB_EDIT_FRAME::Delete_Segment( wxDC* DC, TRACK* aTrack )
{
DrawPanel->SetMouseCapture( NULL, NULL );
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( DC );
SetCurItem( NULL );
......
......@@ -1290,8 +1290,7 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
if( DisplayOpt.DisplayZonesMode != 0 )
DisplayInfoMessage( this, _( "Warning: zone display is OFF!!!" ) );
if( !GetBoard()->IsHightLightNetON() &&
(GetBoard()->GetHightLightNetCode() > 0 ) )
if( !GetBoard()->IsHighLightNetON() && (GetBoard()->GetHighLightNetCode() > 0 ) )
High_Light( &dc );
break;
......
......@@ -14,89 +14,6 @@
#include "protos.h"
/*
* Exchange layer the track pointed to by the mouse:
* The track must be on one layer of work,
* It is put on another layer of work, if possible
* (Or DRC = Off).
*/
void PCB_EDIT_FRAME::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
{
int ii;
TRACK* pt_track;
int l1, l2, nb_segm;
if( ( pt_segm == NULL ) || ( pt_segm->Type() == TYPE_ZONE ) )
{
return;
}
l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM;
pt_track = MarkTrace( GetBoard(), pt_segm, &nb_segm, NULL, NULL, true );
if ( DC )
DrawTraces( DrawPanel, DC, pt_track, nb_segm, GR_XOR );
/* Clear the BUSY flag and backup member. Param layer original. */
ii = nb_segm; pt_segm = pt_track;
for( ; ii > 0; ii--, pt_segm = (TRACK*) pt_segm->Next() )
{
pt_segm->SetState( BUSY, OFF );
pt_segm->m_Param = pt_segm->GetLayer(); /* For backup. */
}
ii = 0; pt_segm = pt_track;
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Next() )
{
if( pt_segm->Type() == TYPE_VIA )
continue;
/* Invert layers. */
if( pt_segm->GetLayer() == l1 )
pt_segm->SetLayer( l2 );
else if( pt_segm->GetLayer() == l2 )
pt_segm->SetLayer( l1 );
if( Drc_On && BAD_DRC==m_drc->Drc( pt_segm, GetBoard()->m_Track ) )
{
/* Discard changes. */
ii = 0;
pt_segm = pt_track;
for( ; ii < nb_segm; ii++, pt_segm = pt_segm->Next() )
{
pt_segm->SetLayer( pt_segm->m_Param );
}
if( DC )
DrawTraces( DrawPanel, DC, pt_track, nb_segm, GR_OR );
DisplayError( this, _( "Drc error, canceled" ) );
return;
}
}
DrawTraces( DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL );
/* Control of segment end point, is it on a pad? */
ii = 0;
pt_segm = pt_track;
for( ; ii < nb_segm; pt_segm = pt_segm->Next(), ii++ )
{
pt_segm->start = Locate_Pad_Connecte( GetBoard(), pt_segm, START );
pt_segm->end = Locate_Pad_Connecte( GetBoard(), pt_segm, END );
}
test_1_net_connexion( DC, pt_track->GetNet() );
pt_track->DisplayInfo( this );
OnModify();
}
bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
{
unsigned itmp;
......@@ -113,7 +30,8 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
}
/* Avoid more than one via on the current location: */
if( Locate_Via( GetBoard(), g_CurrentTrackSegment->m_End, g_CurrentTrackSegment->GetLayer() ) )
if( GetBoard()->GetViaByPosition( g_CurrentTrackSegment->m_End,
g_CurrentTrackSegment->GetLayer() ) )
return false;
for( TRACK* segm = g_FirstTrackSegment; segm; segm = segm->Next() )
......@@ -150,7 +68,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
via->m_Flags = IS_NEW;
via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( GetBoard()->GetHightLightNetCode() );
via->SetNet( GetBoard()->GetHighLightNetCode() );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
// Usual via is from copper to component.
......@@ -267,10 +185,6 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
}
/* Displays:
* The status of the net on top of the screen segment advanced by mouse.
* PCB status or bottom of screen if no segment peak.
*/
void PCB_EDIT_FRAME::DisplayNetStatus( wxDC* DC )
{
TRACK* pt_segm;
......@@ -286,11 +200,6 @@ void PCB_EDIT_FRAME::DisplayNetStatus( wxDC* DC )
}
/* Draw ratsnest.
*
* The net edge pad with mouse or module locates the mouse.
* Delete if the ratsnest if no module or pad is selected.
*/
void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
{
D_PAD* pt_pad = NULL;
......@@ -386,8 +295,6 @@ void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
}
/* High light the unconnected pads
*/
void PCB_EDIT_FRAME::HighlightUnconnectedPads( wxDC* DC )
{
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
......
......@@ -39,13 +39,13 @@ static void Abort_Create_Track( EDA_DRAW_PANEL* Panel, wxDC* DC )
/* Erase the current drawing */
ShowNewTrackWhenMovingCursor( Panel, DC, wxDefaultPosition, false );
if( pcb->IsHightLightNetON() )
if( pcb->IsHighLightNetON() )
frame->High_Light( DC );
pcb->PopHightLight();
pcb->PopHighLight();
if( pcb->IsHightLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
if( pcb->IsHighLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() );
frame->MsgPanel->EraseMsgBox();
......@@ -92,16 +92,16 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
// Prepare the undo command info
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
GetBoard()->PushHightLight();
GetBoard()->PushHighLight();
// erase old highlight
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( DC );
g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) );
g_CurrentTrackSegment->m_Flags = IS_NEW;
GetBoard()->SetHightLightNet(0);
GetBoard()->SetHighLightNet( 0 );
// Search for a starting point of the new track, a track or pad
LockPoint = LocateLockPoint( GetBoard(), pos, layerMask );
......@@ -114,12 +114,12 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
/* A pad is found: put the starting point on pad centre */
pos = pt_pad->m_Pos;
GetBoard()->SetHightLightNet( pt_pad->GetNet() );
GetBoard()->SetHighLightNet( pt_pad->GetNet() );
}
else /* A track segment is found */
{
TrackOnStartPoint = (TRACK*) LockPoint;
GetBoard()->SetHightLightNet( TrackOnStartPoint->GetNet() );
GetBoard()->SetHighLightNet( TrackOnStartPoint->GetNet() );
CreateLockPoint( GetBoard(), pos, TrackOnStartPoint, &s_ItemsListPicker );
}
}
......@@ -130,7 +130,7 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
zone = GetBoard()->HitTestForAnyFilledArea( pos, GetScreen()-> m_Active_Layer );
if( zone )
GetBoard()->SetHightLightNet( zone->GetNet() );
GetBoard()->SetHighLightNet( zone->GetNet() );
}
D( g_CurrentTrackList.VerifyListIntegrity(); );
......@@ -139,11 +139,11 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* DC )
D( g_CurrentTrackList.VerifyListIntegrity(); );
GetBoard()->HightLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
GetBoard()->HighLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
// Display info about track Net class, and init track and vias sizes:
g_CurrentTrackSegment->SetNet( GetBoard()->GetHightLightNetCode() );
g_CurrentTrackSegment->SetNet( GetBoard()->GetHighLightNetCode() );
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
......@@ -463,7 +463,7 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
* possibly create an anchor. */
{
TRACK* adr_buf = (TRACK*) LockPoint;
GetBoard()->SetHightLightNet( adr_buf->GetNet() );
GetBoard()->SetHighLightNet( adr_buf->GetNet() );
/* Possible establishment of a hanging point. */
LockPoint = CreateLockPoint( GetBoard(),
......@@ -527,13 +527,13 @@ bool PCB_EDIT_FRAME::End_Route( TRACK* aTrack, wxDC* DC )
wxASSERT( g_CurrentTrackSegment == NULL );
wxASSERT( g_CurrentTrackList.GetCount() == 0 );
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( DC );
GetBoard()->PopHightLight();
GetBoard()->PopHighLight();
if( GetBoard()->IsHightLightNetON() )
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
if( GetBoard()->IsHighLightNetON() )
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
DrawPanel->SetMouseCapture( NULL, NULL );
SetCurItem( NULL );
......
......@@ -51,7 +51,7 @@ bool PCB_EDIT_FRAME::Clear_Pcb( bool aQuery )
GetScreen()->Init();
GetScreen()->SetGrid( gridsize );
GetBoard()->ResetHightLight();
GetBoard()->ResetHighLight();
// Enable all layers (SetCopperLayerCount() will adjust the copper layers enabled)
GetBoard()->SetEnabledLayers(ALL_LAYERS);
......
......@@ -13,68 +13,6 @@
/* Locates a via point pX, pY
* If layer < 0 will be located via whatever layer
* If layer = 0 .. 15 Via will be located according to its type:
* - Traverse: all layers
* - = Blind between layers useful
* - Blind idem
* Entry: coord point of reference, layer
* Output: NULL if not via
* (* TRACK) address via
*/
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer )
{
TRACK* track;
for( track = Pcb->m_Track; track; track = track->Next() )
{
if( track->Type() != TYPE_VIA )
continue;
if( track->m_Start != pos )
continue;
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( layer < 0 )
break;
if( track->IsOnLayer( layer ) )
break;
}
return track;
}
TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& pos, int layer )
{
TRACK* track;
for( track = aStart; track; track = track->Next() )
{
if( track->Type() != TYPE_VIA )
continue;
if( !track->HitTest(pos) )
continue;
if( track->GetState( BUSY | IS_DELETED ) )
continue;
if( layer < 0 )
break;
if( track->IsOnLayer( layer ) )
break;
}
return track;
}
/* Locate the pad CONNECTED to a track
* input: ptr_trace: pointer to the segment of track
* Extr = flag = START -> beginning of the test segment
......@@ -553,34 +491,3 @@ TRACK* GetTrace( TRACK* start_adr, TRACK* end_adr, const wxPoint& ref_pos, int M
return NULL;
}
/* Locates via through the point x, y, on layer data by masklayer.
* Search is done to address start_adr has end_adr.
* If end_adr = NULL, end search list
* Vias whose parameter has the State or IS_DELETED bit BUSY = 1 are ignored
*/
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, int MaskLayer )
{
TRACK* PtSegm;
for( PtSegm = start_adr; PtSegm != NULL; PtSegm = PtSegm->Next() )
{
if( PtSegm->Type() == TYPE_VIA )
{
if( pos == PtSegm->m_Start )
{
if( PtSegm->GetState( BUSY | IS_DELETED ) == 0 )
{
if( MaskLayer & PtSegm->ReturnMaskLayer() )
return PtSegm;
}
}
}
if( PtSegm == end_adr )
break;
}
return NULL;
}
/********************************************************/
/*********************************/
/* magnetic_tracks_functions.cpp */
/********************************************************/
/*********************************/
/* functions used to controle the cursor position, when creating a track
/* functions used to control the cursor position, when creating a track
* and when the "magnetic tracks" option is on
* (the current created track is kept near existing tracks
* the distance is the clearance between tracks)
......@@ -171,7 +171,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
int layer = screen->m_Active_Layer;
for( TRACK* via = m_Pcb->m_Track;
via && (via = Locate_Via_Area( via, *curpos, layer )) != NULL;
via && (via = via->GetVia( *curpos, layer )) != NULL;
via = via->Next() )
{
if( via != currTrack ) // a via cannot influence itself
......@@ -206,8 +206,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
}
/*
* In two segment mode, ignore the final segment if it's inside a grid
* square.
* In two segment mode, ignore the final segment if it's inside a grid square.
*/
if( !amMovingVia && currTrack && g_TwoSegmentTrackBuild && currTrack->Back()
&& currTrack->m_Start.x - grid.x < currTrack->m_End.x
......@@ -275,8 +274,7 @@ bool Magnetize( BOARD* m_Pcb, PCB_EDIT_FRAME* frame, int aCurrentTool, wxSize gr
return true;
}
// @todo otherwise confine curpos such that it stays centered
// within "track"
// @todo otherwise confine curpos such that it stays centered within "track"
}
}
}
......
......@@ -62,8 +62,8 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
Panel->m_mouseCaptureCallback( Panel, DC, wxDefaultPosition, true );
Panel->GetScreen()->SetCrossHairPosition( oldpos );
pcb->HightLightOFF();
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
pcb->HighLightOFF();
pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() );
if( NewTrack )
{
......@@ -119,10 +119,10 @@ static void Abort_MoveTrack( EDA_DRAW_PANEL* Panel, wxDC* DC )
// Clear the undo picker list:
s_ItemsListPicker.ClearListAndDeleteItems();
pcb->PopHightLight();
pcb->PopHighLight();
if( pcb->IsHightLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHightLightNetCode() );
if( pcb->IsHighLightNetON() )
pcb->DrawHighLight( Panel, DC, pcb->GetHighLightNetCode() );
EraseDragList();
Panel->SetMouseCapture( NULL, NULL );
......@@ -665,9 +665,9 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
EraseDragList();
/* Change highlighted net: the new one will be highlighted */
GetBoard()->PushHightLight();
GetBoard()->PushHighLight();
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( DC );
PosInit = GetScreen()->GetCrossHairPosition();
......@@ -742,10 +742,10 @@ void PCB_EDIT_FRAME::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int com
s_LastPos = PosInit;
DrawPanel->SetMouseCapture( Show_MoveNode, Abort_MoveTrack );
GetBoard()->SetHightLightNet( track->GetNet() );
GetBoard()->HightLightON();
GetBoard()->SetHighLightNet( track->GetNet() );
GetBoard()->HighLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, true );
}
......@@ -904,9 +904,9 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_EndSegmentPresent = false;
/* Change high light net: the new one will be highlighted */
GetBoard()->PushHightLight();
GetBoard()->PushHighLight();
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( DC );
EraseDragList();
......@@ -944,9 +944,9 @@ void PCB_EDIT_FRAME::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
s_LastPos = GetScreen()->GetCrossHairPosition();
DrawPanel->SetMouseCapture( Show_Drag_Track_Segment_With_Cte_Slope, Abort_MoveTrack );
GetBoard()->SetHightLightNet( track->GetNet() );
GetBoard()->HightLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
GetBoard()->SetHighLightNet( track->GetNet() );
GetBoard()->HighLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
// Prepare the Undo command
ITEM_PICKER picker( NULL, UR_CHANGED );
......@@ -1038,13 +1038,13 @@ bool PCB_EDIT_FRAME::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
SaveCopyInUndoList( s_ItemsListPicker, UR_UNSPECIFIED );
s_ItemsListPicker.ClearItemsList(); // s_ItemsListPicker is no more owner of picked items
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( DC );
GetBoard()->PopHightLight();
GetBoard()->PopHighLight();
if( GetBoard()->IsHightLightNetON() )
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
if( GetBoard()->IsHighLightNetON() )
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
OnModify();
DrawPanel->SetMouseCapture( NULL, NULL );
......
......@@ -66,25 +66,6 @@ void DrawTraces( EDA_DRAW_PANEL* panel,
/* LOCATE.CPP : */
/****************/
/* Find a pad by it's name om the module. */
TRACK* Locate_Via( BOARD* Pcb, const wxPoint& pos, int layer = -1 );
/**
* Function Locate_Via_Area
* finds the first SEGVIA which covers the given aPos with a matching layer.
* @param aStart The starting TRACK or SEGVIA in the BOARD's list.
* @param aPos The wxPoint to HitTest() against.
* @param aLayer The layer to match, pass -1 for a don't care.
* @return TRACK* - actually a SEGVIA* if found, else NULL.
*/
TRACK* Locate_Via_Area( TRACK* aStart, const wxPoint& aPos, int aLayer = ALL_LAYERS );
/* Locates the center through the point x, y, on layer data
* by masquelayer.
* Search is done to address start_adr has end_adr (not included)
*/
TRACK* Fast_Locate_Via( TRACK* start_adr, TRACK* end_adr, const wxPoint& pos, int masquelayer );
/* Locates the center through the point x, y, on layer data
* by masquelayer.
* Search is done to address start_adr has end_adr (not included)
......
......@@ -80,10 +80,10 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
{
INSTALL_UNBUFFERED_DC( dc, DrawPanel );
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( &dc );
GetBoard()->SetHightLightNet( netcode );
GetBoard()->SetHighLightNet( netcode );
High_Light( &dc );
}
}
......@@ -95,7 +95,8 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC )
{
int netcode = -1;
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
High_Light( DC );
// use this scheme because a pad is a higher priority than a track in the
......@@ -139,7 +140,7 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC )
}
if( netcode >= 0 )
{
GetBoard()->SetHightLightNet( netcode );
GetBoard()->SetHighLightNet( netcode );
High_Light( DC );
}
......@@ -155,10 +156,10 @@ int PCB_EDIT_FRAME::Select_High_Light( wxDC* DC )
*/
void PCB_EDIT_FRAME::High_Light( wxDC* DC )
{
if( GetBoard()->IsHightLightNetON() )
GetBoard()->HightLightOFF();
if( GetBoard()->IsHighLightNetON() )
GetBoard()->HighLightOFF();
else
GetBoard()->HightLightON();
GetBoard()->HighLightON();
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHightLightNetCode() );
GetBoard()->DrawHighLight( DrawPanel, DC, GetBoard()->GetHighLightNetCode() );
}
......@@ -14,18 +14,6 @@ extern int ReturnEndsTrack( TRACK* RefTrack, int NbSegm,
TRACK** StartTrack, TRACK** EndTrack );
/**
* Function EraseRedundantTrack
* Called after creating a track
* Remove (if exists) the old track that have the same starting and the same
* ending point as the new created track (this is the redunding track)
* @param aDC = the current device context (can be NULL)
* @param aNewTrack = the new created track (a pointer to a segment of the
* track list)
* @param aNewTrackSegmentsCount = number of segments in this new track
* @param aItemsListPicker = the list picker to use for an undo command (can
* be NULL)
*/
int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
TRACK* aNewTrack,
int aNewTrackSegmentsCount,
......@@ -41,9 +29,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
int netcode = aNewTrack->GetNet();
/* Reconstruct the complete track (the new track has to start on a
* segment of track).
/* Reconstruct the complete track (the new track has to start on a segment of track).
*/
ListSetState( aNewTrack, aNewTrackSegmentsCount, BUSY, OFF );
......@@ -58,8 +44,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
wxASSERT( aNewTrack );
#if 0 && defined(DEBUG)
TRACK* EndNewTrack; /* The last segment of the list chained to
* the track */
TRACK* EndNewTrack; /* The last segment of the list chained to the track */
EndNewTrack = aNewTrack;
......@@ -110,7 +95,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
endmasklayer = EndTrack->ReturnMaskLayer();
/* There may be a via or a pad on the end points. */
pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, start, startmasklayer );
pt_segm = m_Pcb->m_Track->GetVia( NULL, start, startmasklayer );
if( pt_segm )
startmasklayer |= pt_segm->ReturnMaskLayer();
......@@ -122,7 +107,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
startmasklayer |= pt_pad->m_layerMask;
}
pt_segm = Fast_Locate_Via( m_Pcb->m_Track, NULL, end, endmasklayer );
pt_segm = m_Pcb->m_Track->GetVia( NULL, end, endmasklayer );
if( pt_segm )
endmasklayer |= pt_segm->ReturnMaskLayer();
......@@ -133,8 +118,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
endmasklayer |= pt_pad->m_layerMask;
}
/* Mark as deleted a new track (which is not involved in the search for
* other connections)
/* Mark as deleted a new track (which is not involved in the search for other connections)
*/
ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, ON );
......@@ -190,9 +174,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
return 0;
}
/* Mark trace as edited (which does not involve searching for other
* tracks)
*/
// Mark trace as edited (which does not involve searching for other tracks)
ListSetState( aNewTrack, aNewTrackSegmentsCount, IS_DELETED, OFF );
ListSetState( aNewTrack, aNewTrackSegmentsCount, IN_EDIT, ON );
......@@ -285,8 +267,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC,
}
/* Set the bits of .m_State member to onoff value, using bit mask State
/* Set the bits of .m_State member to on off value, using bit mask State
* of a list of EDA_ITEM
*/
static void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff )
......
......@@ -194,8 +194,8 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* DC, int aDrawMode, const wxPoint
Trace_Pads_Only( aPanel, DC, module, 0, 0, layerMask, aDrawMode );
}
if( IsHightLightNetON() )
DrawHighLight( aPanel, DC, GetHightLightNetCode() );
if( IsHighLightNetON() )
DrawHighLight( aPanel, DC, GetHighLightNetCode() );
// draw the BOARD's markers last, otherwise the high light will erase any marker on a pad
for( unsigned i=0; i < m_markers.size(); ++i )
......@@ -209,7 +209,7 @@ void BOARD::DrawHighLight( EDA_DRAW_PANEL* aDrawPanel, wxDC* DC, int aNetCode )
{
int draw_mode;
if( IsHightLightNetON() )
if( IsHighLightNetON() )
draw_mode = GR_SURBRILL | GR_OR;
else
draw_mode = GR_AND | GR_SURBRILL;
......
......@@ -10,10 +10,8 @@
#include "protos.h"
/* Functions to recognize a track.
* A track is a list of connected segments (or/and vias)
* from a starting to an ending point
* starting and ending points are a pad or a point with more than 2 segments
*connected
* A track is a list of connected segments (or/and vias) from a starting to an ending point
* starting and ending points are a pad or a point with more than 2 segments connected
* (and obviously a dangling segment end)
*/
......@@ -22,10 +20,7 @@ typedef std::vector<TRACK*> TRACK_PTRS; // buffer of item candidates when
/* Local functions */
static void ChainMarkedSegments( BOARD* Pcb,
wxPoint ref_pos,
int masklayer,
TRACK_PTRS* aList );
static void ChainMarkedSegments( BOARD* Pcb, wxPoint ref_pos, int masklayer, TRACK_PTRS* aList );
TRACK* MarkTrace( BOARD* aPcb,
......@@ -108,8 +103,7 @@ TRACK* MarkTrace( BOARD* aPcb,
}
// Now examine selected vias and flag them if they are on the track
// If a via is connected to only one or 2 segments, it is flagged (is on
// the track)
// If a via is connected to only one or 2 segments, it is flagged (is on the track)
// If a via is connected to more than 2 segments, it is a track end, and it
// is removed from the list
// go through the list backwards.
......@@ -327,7 +321,7 @@ static void ChainMarkedSegments( BOARD* aPcb,
* is found we do not know at this time the number of connected items
* and we do not know if this via is on the track or finish the track
*/
pt_via = Fast_Locate_Via( aPcb->m_Track, NULL, aRef_pos, aLayerMask );
pt_via = aPcb->m_Track->GetVia( NULL, aRef_pos, aLayerMask );
if( pt_via )
{
......@@ -442,7 +436,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, TRACK** StartTrack, TRACK** En
continue;
layerMask = Track->ReturnMaskLayer();
via = Fast_Locate_Via( RefTrack, TrackListEnd, Track->m_Start, layerMask );
via = RefTrack->GetVia( TrackListEnd, Track->m_Start, layerMask );
if( via )
{
......@@ -489,7 +483,7 @@ int ReturnEndsTrack( TRACK* RefTrack, int NbSegm, TRACK** StartTrack, TRACK** En
}
layerMask = Track->ReturnMaskLayer();
via = Fast_Locate_Via( RefTrack, TrackListEnd, Track->m_End, layerMask );
via = RefTrack->GetVia( TrackListEnd, Track->m_End, layerMask );
if( via )
{
......
......@@ -158,13 +158,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_cont
{
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
{
if( GetBoard()->IsHightLightNetON() && DC )
if( GetBoard()->IsHighLightNetON() && DC )
{
High_Light( DC ); // Remove old hightlight selection
}
g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
GetBoard()->SetHightLightNet( zone_container->GetNet() );
GetBoard()->SetHighLightNet( zone_container->GetNet() );
if( DC )
High_Light( DC );
......@@ -230,13 +230,13 @@ void PCB_EDIT_FRAME::Start_Move_Zone_Outlines( wxDC* DC, ZONE_CONTAINER* zone_co
/* Show the Net */
if( zone_container->IsOnCopperLayer() ) /* Show the Net */
{
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
{
High_Light( DC ); // Remove old hightlight selection
}
g_Zone_Default_Setting.m_NetcodeSelection = zone_container->GetNet();
GetBoard()->SetHightLightNet( zone_container->GetNet() );
GetBoard()->SetHighLightNet( zone_container->GetNet() );
High_Light( DC );
}
......@@ -495,9 +495,9 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
if( zone->IsOnCopperLayer() )
{ // Put a zone on a copper layer
if ( GetBoard()->GetHightLightNetCode() > 0 )
if ( GetBoard()->GetHighLightNetCode() > 0 )
{
g_Zone_Default_Setting.m_NetcodeSelection = GetBoard()->GetHightLightNetCode();
g_Zone_Default_Setting.m_NetcodeSelection = GetBoard()->GetHighLightNetCode();
zone->SetNet( g_Zone_Default_Setting.m_NetcodeSelection );
zone->SetNetNameFromNetCode( );
......@@ -541,12 +541,12 @@ int PCB_EDIT_FRAME::Begin_Zone( wxDC* DC )
if( s_CurrentZone )
g_Zone_Default_Setting.m_NetcodeSelection = s_CurrentZone->GetNet();
if( GetBoard()->IsHightLightNetON() )
if( GetBoard()->IsHighLightNetON() )
{
High_Light( DC ); // Remove old hightlight selection
}
GetBoard()->SetHightLightNet( g_Zone_Default_Setting.m_NetcodeSelection );
GetBoard()->SetHighLightNet( g_Zone_Default_Setting.m_NetcodeSelection );
High_Light( DC );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment