2007-08-04 04:40:07 +00:00
|
|
|
/*******************************/
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Edit tracks */
|
2007-08-04 04:40:07 +00:00
|
|
|
/*******************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2010-09-18 08:29:40 +00:00
|
|
|
#include "drc_stuff.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2009-11-14 22:15:22 +00:00
|
|
|
* 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).
|
2007-08-04 04:40:07 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
int ii;
|
|
|
|
TRACK* pt_track;
|
|
|
|
int l1, l2, nb_segm;
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
if( ( pt_segm == NULL ) || ( pt_segm->Type() == TYPE_ZONE ) )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM;
|
|
|
|
|
2009-10-10 17:27:53 +00:00
|
|
|
pt_track = Marque_Une_Piste( GetBoard(), pt_segm, &nb_segm, NULL, true );
|
2010-01-24 13:46:01 +00:00
|
|
|
if ( DC )
|
|
|
|
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_XOR );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Clear the BUSY flag and backup member. Param layer original. */
|
2007-08-04 04:40:07 +00:00
|
|
|
ii = nb_segm; pt_segm = pt_track;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; ii > 0; ii--, pt_segm = (TRACK*) pt_segm->Next() )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
|
|
|
pt_segm->SetState( BUSY, OFF );
|
2009-11-14 22:15:22 +00:00
|
|
|
pt_segm->m_Param = pt_segm->GetLayer(); /* For backup. */
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ii = 0; pt_segm = pt_track;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; ii < nb_segm; ii++, pt_segm = (TRACK*) pt_segm->Next() )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( pt_segm->Type() == TYPE_VIA )
|
2007-08-04 04:40:07 +00:00
|
|
|
continue;
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Invert layers. */
|
2007-08-23 04:28:46 +00:00
|
|
|
if( pt_segm->GetLayer() == l1 )
|
|
|
|
pt_segm->SetLayer( l2 );
|
|
|
|
else if( pt_segm->GetLayer() == l2 )
|
|
|
|
pt_segm->SetLayer( l1 );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
if( Drc_On && BAD_DRC==m_drc->Drc( pt_segm, GetBoard()->m_Track ) )
|
2008-04-01 05:21:50 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Discard changes. */
|
|
|
|
ii = 0;
|
|
|
|
pt_segm = pt_track;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
for( ; ii < nb_segm; ii++, pt_segm = pt_segm->Next() )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2007-08-23 04:28:46 +00:00
|
|
|
pt_segm->SetLayer( pt_segm->m_Param );
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
2010-01-24 13:46:01 +00:00
|
|
|
if( DC )
|
|
|
|
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR );
|
2009-11-14 22:15:22 +00:00
|
|
|
DisplayError( this, _( "Drc error, canceled" ), 10 );
|
2007-08-04 04:40:07 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL );
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Control of segment end point, is it on a pad? */
|
2007-08-04 04:40:07 +00:00
|
|
|
ii = 0; pt_segm = pt_track;
|
2008-12-04 04:28:11 +00:00
|
|
|
for( ; ii < nb_segm; pt_segm = pt_segm->Next(), ii++ )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
pt_segm->start = Locate_Pad_Connecte( GetBoard(), pt_segm, START );
|
|
|
|
pt_segm->end = Locate_Pad_Connecte( GetBoard(), pt_segm, END );
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
2007-10-13 06:18:44 +00:00
|
|
|
test_1_net_connexion( DC, pt_track->GetNet() );
|
2009-04-17 08:51:02 +00:00
|
|
|
pt_track->DisplayInfo( this );
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2011-03-01 19:26:17 +00:00
|
|
|
bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
unsigned itmp;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( aTrack == NULL )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2010-01-24 02:05:07 +00:00
|
|
|
if( getActiveLayer() !=
|
2009-11-14 22:15:22 +00:00
|
|
|
((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
|
2010-01-24 02:05:07 +00:00
|
|
|
setActiveLayer( ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP );
|
2007-08-04 04:40:07 +00:00
|
|
|
else
|
2010-01-24 02:05:07 +00:00
|
|
|
setActiveLayer(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM );
|
2008-12-04 04:28:11 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar();
|
2007-12-14 22:31:45 +00:00
|
|
|
return true;
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
2007-09-04 14:28:20 +00:00
|
|
|
/* Avoid more than one via on the current location: */
|
2009-11-14 22:15:22 +00:00
|
|
|
if( Locate_Via( GetBoard(), g_CurrentTrackSegment->m_End,
|
|
|
|
g_CurrentTrackSegment->GetLayer() ) )
|
2007-12-14 22:31:45 +00:00
|
|
|
return false;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
for( TRACK* segm = g_FirstTrackSegment; segm; segm = segm->Next() )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
if( segm->Type()==TYPE_VIA
|
|
|
|
&& g_CurrentTrackSegment->m_End==segm->m_Start )
|
2007-12-14 22:31:45 +00:00
|
|
|
return false;
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
2007-09-20 06:45:17 +00:00
|
|
|
/* Is the current segment Ok (no DRC error) ? */
|
2007-08-04 04:40:07 +00:00
|
|
|
if( Drc_On )
|
2007-09-20 06:45:17 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
if( BAD_DRC==m_drc->Drc( g_CurrentTrackSegment, GetBoard()->m_Track ) )
|
2007-09-20 06:45:17 +00:00
|
|
|
/* DRC error, the change layer is not made */
|
2007-12-14 22:31:45 +00:00
|
|
|
return false;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// Handle 2 segments.
|
|
|
|
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() )
|
2007-09-20 06:45:17 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
if( BAD_DRC == m_drc->Drc( g_CurrentTrackSegment->Back(),
|
|
|
|
GetBoard()->m_Track ) )
|
2007-12-14 22:31:45 +00:00
|
|
|
return false;
|
2007-09-20 06:45:17 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
/* Save current state before placing a via.
|
2009-11-14 22:15:22 +00:00
|
|
|
* If the via cannot be placed this current state will be reused
|
2008-12-04 04:28:11 +00:00
|
|
|
*/
|
|
|
|
itmp = g_CurrentTrackList.GetCount();
|
2007-08-04 04:40:07 +00:00
|
|
|
Begin_Route( g_CurrentTrackSegment, DC );
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2007-10-16 20:52:49 +00:00
|
|
|
/* create the via */
|
2009-01-05 05:21:35 +00:00
|
|
|
SEGVIA* via = new SEGVIA( GetBoard() );
|
2008-12-04 04:28:11 +00:00
|
|
|
via->m_Flags = IS_NEW;
|
2010-01-31 20:01:46 +00:00
|
|
|
via->m_Shape = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
|
2009-10-30 17:58:15 +00:00
|
|
|
via->m_Width = GetBoard()->GetCurrentViaSize();
|
2010-01-24 13:46:01 +00:00
|
|
|
via->SetNet( g_HighLight_NetCode );
|
2008-12-04 04:28:11 +00:00
|
|
|
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
|
2010-01-25 20:06:56 +00:00
|
|
|
// Usual via is from copper to component.
|
|
|
|
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
|
|
|
|
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
|
|
|
|
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
|
|
|
|
|
|
|
|
int first_layer = getActiveLayer();
|
|
|
|
int last_layer;
|
|
|
|
// prepare switch to new active layer:
|
|
|
|
if( first_layer != GetScreen()->m_Route_Layer_TOP )
|
|
|
|
last_layer = GetScreen()->m_Route_Layer_TOP;
|
2007-08-04 04:40:07 +00:00
|
|
|
else
|
2010-01-25 20:06:56 +00:00
|
|
|
last_layer = GetScreen()->m_Route_Layer_BOTTOM;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2010-01-25 20:06:56 +00:00
|
|
|
/* Adjust the actual via layer pair */
|
2008-12-04 04:28:11 +00:00
|
|
|
switch ( via->Shape() )
|
2008-04-01 05:21:50 +00:00
|
|
|
{
|
|
|
|
case VIA_BLIND_BURIED:
|
2010-01-25 20:06:56 +00:00
|
|
|
via->SetLayerPair( first_layer, last_layer );
|
2008-04-01 05:21:50 +00:00
|
|
|
break;
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
case VIA_MICROVIA: // from external to the near neighbor inner layer
|
2010-01-25 20:06:56 +00:00
|
|
|
{
|
2010-01-31 20:01:46 +00:00
|
|
|
int last_inner_layer = GetBoard()->GetCopperLayerCount() - 2;
|
2010-01-25 20:06:56 +00:00
|
|
|
if ( first_layer == LAYER_N_BACK )
|
|
|
|
last_layer = LAYER_N_2;
|
|
|
|
else if ( first_layer == LAYER_N_FRONT )
|
|
|
|
last_layer = last_inner_layer;
|
|
|
|
else if ( first_layer == LAYER_N_2 )
|
|
|
|
last_layer = LAYER_N_BACK;
|
|
|
|
else if ( first_layer == last_inner_layer )
|
|
|
|
last_layer = LAYER_N_FRONT;
|
|
|
|
// else error: will be removed later
|
|
|
|
via->SetLayerPair( first_layer, last_layer );
|
2009-10-30 17:58:15 +00:00
|
|
|
{
|
|
|
|
NETINFO_ITEM* net = GetBoard()->FindNet( via->GetNet() );
|
2009-11-14 22:15:22 +00:00
|
|
|
via->m_Width = net->GetMicroViaSize();
|
2009-10-30 17:58:15 +00:00
|
|
|
}
|
2010-01-25 20:06:56 +00:00
|
|
|
}
|
2008-04-01 05:21:50 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2007-10-01 04:34:11 +00:00
|
|
|
}
|
2007-10-15 07:50:59 +00:00
|
|
|
|
2010-01-25 20:06:56 +00:00
|
|
|
if( Drc_On && BAD_DRC == m_drc->Drc( via, GetBoard()->m_Track ) )
|
2007-09-20 06:45:17 +00:00
|
|
|
{
|
2007-09-04 14:28:20 +00:00
|
|
|
/* DRC fault: the Via cannot be placed here ... */
|
2008-12-04 04:28:11 +00:00
|
|
|
delete via;
|
2007-12-18 00:04:08 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
2007-12-18 02:34:54 +00:00
|
|
|
|
2008-04-01 05:21:50 +00:00
|
|
|
// delete the track(s) added in Begin_Route()
|
2008-12-04 04:28:11 +00:00
|
|
|
while( g_CurrentTrackList.GetCount() > itmp )
|
2007-12-18 00:04:08 +00:00
|
|
|
{
|
|
|
|
Delete_Segment( DC, g_CurrentTrackSegment );
|
|
|
|
}
|
2007-12-18 02:34:54 +00:00
|
|
|
|
|
|
|
// use the form of SetCurItem() which does not write to the msg panel,
|
|
|
|
// SCREEN::SetCurItem(), so the DRC error remains on screen.
|
2011-03-01 19:26:17 +00:00
|
|
|
// PCB_EDIT_FRAME::SetCurItem() calls DisplayInfo().
|
2007-12-18 02:34:54 +00:00
|
|
|
GetScreen()->SetCurItem( g_CurrentTrackSegment );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-12-14 22:31:45 +00:00
|
|
|
return false;
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
2010-01-25 20:06:56 +00:00
|
|
|
setActiveLayer( last_layer );
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
TRACK* lastNonVia = g_CurrentTrackSegment;
|
|
|
|
|
2007-09-04 14:28:20 +00:00
|
|
|
/* A new via was created. It was Ok.
|
2007-09-20 06:45:17 +00:00
|
|
|
*/
|
2008-12-04 04:28:11 +00:00
|
|
|
g_CurrentTrackList.PushBack( via );
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
/* The via is now in linked list and we need a new track segment
|
|
|
|
* after the via, starting at via location.
|
|
|
|
* it will become the new current segment (from via to the mouse cursor)
|
|
|
|
*/
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
TRACK* track = lastNonVia->Copy();
|
|
|
|
|
|
|
|
/* the above creates a new segment from the last entered segment, with the
|
|
|
|
* current width, flags, netcode, etc... values.
|
|
|
|
* layer, start and end point are not correct,
|
|
|
|
* and will be modified next
|
2007-09-20 06:45:17 +00:00
|
|
|
*/
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
// set the layer to the new value
|
2010-01-24 02:05:07 +00:00
|
|
|
track->SetLayer( getActiveLayer() );
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* the start point is the via position and the end point is the cursor
|
|
|
|
* which also is on the via (will change when moving mouse)
|
2008-12-04 04:28:11 +00:00
|
|
|
*/
|
|
|
|
track->m_Start = track->m_End = via->m_Start;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
g_CurrentTrackList.PushBack( track );
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
if( g_TwoSegmentTrackBuild )
|
2007-09-20 06:45:17 +00:00
|
|
|
{
|
2007-08-30 22:20:52 +00:00
|
|
|
// Create a second segment (we must have 2 track segments to adjust)
|
2008-12-04 04:28:11 +00:00
|
|
|
g_CurrentTrackList.PushBack( g_CurrentTrackSegment->Copy() );
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->m_mouseCaptureCallback( DrawPanel, DC, wxDefaultPosition, FALSE );
|
2009-04-17 08:51:02 +00:00
|
|
|
via->DisplayInfo( this );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
UpdateStatusBar();
|
2008-04-01 05:21:50 +00:00
|
|
|
|
2007-12-14 22:31:45 +00:00
|
|
|
return true;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* 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.
|
2007-08-04 04:40:07 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Affiche_Status_Net( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
TRACK* pt_segm;
|
2010-01-24 02:05:07 +00:00
|
|
|
int masquelayer = (1 << getActiveLayer());
|
2011-02-01 15:46:25 +00:00
|
|
|
wxPoint pos = GetScreen()->RefPos( true );
|
|
|
|
|
|
|
|
pt_segm = Locate_Pistes( GetBoard(), GetBoard()->m_Track, pos, masquelayer );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
|
|
if( pt_segm == NULL )
|
2009-04-17 08:51:02 +00:00
|
|
|
GetBoard()->DisplayInfo( this );
|
2007-08-04 04:40:07 +00:00
|
|
|
else
|
2007-10-13 06:18:44 +00:00
|
|
|
test_1_net_connexion( DC, pt_segm->GetNet() );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Draw ratsnest.
|
|
|
|
*
|
|
|
|
* The net edge pad with mouse or module locates the mouse.
|
|
|
|
* Delete if the ratsnest if no module or pad is selected.
|
2007-08-04 04:40:07 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Show_1_Ratsnest( EDA_ITEM* item, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
D_PAD* pt_pad = NULL;
|
|
|
|
MODULE* Module = NULL;
|
|
|
|
|
2010-01-29 20:36:12 +00:00
|
|
|
if( GetBoard()->IsElementVisible(RATSNEST_VISIBLE) )
|
2009-05-28 08:42:24 +00:00
|
|
|
return;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
if( ( GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK ) == 0 )
|
2007-08-04 04:40:07 +00:00
|
|
|
Compile_Ratsnest( DC, TRUE );
|
|
|
|
|
2007-08-04 05:08:19 +00:00
|
|
|
if( item )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( item->Type() == TYPE_PAD )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2007-08-04 05:08:19 +00:00
|
|
|
pt_pad = (D_PAD*) item;
|
2008-11-24 06:53:43 +00:00
|
|
|
Module = (MODULE*) pt_pad->GetParent();
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
if( pt_pad ) /* Displaying the ratsnest of the corresponding net. */
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2009-04-17 08:51:02 +00:00
|
|
|
pt_pad->DisplayInfo( this );
|
2009-05-28 08:42:24 +00:00
|
|
|
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
2007-08-04 05:08:19 +00:00
|
|
|
{
|
2009-05-28 08:42:24 +00:00
|
|
|
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
|
|
|
if( net->GetNet() == pt_pad->GetNet() )
|
2007-08-04 05:08:19 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
if( ( net->m_Status & CH_VISIBLE ) != 0 )
|
2007-08-04 05:08:19 +00:00
|
|
|
continue;
|
2009-05-28 08:42:24 +00:00
|
|
|
net->m_Status |= CH_VISIBLE;
|
2009-11-14 22:15:22 +00:00
|
|
|
if( ( net->m_Status & CH_ACTIF ) == 0 )
|
2007-08-04 05:08:19 +00:00
|
|
|
continue;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
net->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
2007-08-04 05:08:19 +00:00
|
|
|
}
|
|
|
|
}
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
2007-08-04 05:08:19 +00:00
|
|
|
else
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2008-12-04 04:28:11 +00:00
|
|
|
if( item->Type() == TYPE_TEXTE_MODULE )
|
2007-08-04 05:08:19 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
if( item->GetParent()
|
|
|
|
&& ( item->GetParent()->Type() == TYPE_MODULE ) )
|
2008-11-24 06:53:43 +00:00
|
|
|
Module = (MODULE*) item->GetParent();
|
2007-08-04 05:08:19 +00:00
|
|
|
}
|
2008-12-04 04:28:11 +00:00
|
|
|
else if( item->Type() == TYPE_MODULE )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2007-08-04 05:08:19 +00:00
|
|
|
Module = (MODULE*) item;
|
|
|
|
}
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2007-08-04 05:08:19 +00:00
|
|
|
if( Module )
|
|
|
|
{
|
2009-04-17 08:51:02 +00:00
|
|
|
Module->DisplayInfo( this );
|
2007-08-04 05:08:19 +00:00
|
|
|
pt_pad = Module->m_Pads;
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Next() )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2009-11-14 22:15:22 +00:00
|
|
|
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount();
|
|
|
|
ii++ )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2009-05-28 08:42:24 +00:00
|
|
|
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
2009-11-14 22:15:22 +00:00
|
|
|
if( ( net->m_PadStart == pt_pad )
|
|
|
|
|| ( net->m_PadEnd == pt_pad ) )
|
2007-08-04 05:08:19 +00:00
|
|
|
{
|
2009-05-28 08:42:24 +00:00
|
|
|
if( net->m_Status & CH_VISIBLE )
|
2007-08-04 05:08:19 +00:00
|
|
|
continue;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2009-05-28 08:42:24 +00:00
|
|
|
net->m_Status |= CH_VISIBLE;
|
|
|
|
if( (net->m_Status & CH_ACTIF) == 0 )
|
2007-08-04 05:08:19 +00:00
|
|
|
continue;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
net->Draw( DrawPanel, DC, GR_XOR, wxPoint( 0, 0 ) );
|
2007-08-04 05:08:19 +00:00
|
|
|
}
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
}
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2007-08-04 05:08:19 +00:00
|
|
|
pt_pad = NULL;
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* Erase if no pad or module has been selected. */
|
|
|
|
if( ( pt_pad == NULL ) && ( Module == NULL ) )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
|
|
|
DrawGeneralRatsnest( DC );
|
2007-09-20 06:45:17 +00:00
|
|
|
|
2009-05-28 08:42:24 +00:00
|
|
|
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
|
|
|
GetBoard()->m_FullRatsnest[ii].m_Status &= ~CH_VISIBLE;
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-14 22:15:22 +00:00
|
|
|
/* High light the unconnected pads
|
2007-08-04 04:40:07 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Affiche_PadsNoConnect( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2009-05-28 08:42:24 +00:00
|
|
|
for( unsigned ii = 0; ii < GetBoard()->GetRatsnestsCount(); ii++ )
|
2007-08-04 04:40:07 +00:00
|
|
|
{
|
2009-05-28 08:42:24 +00:00
|
|
|
RATSNEST_ITEM* net = &GetBoard()->m_FullRatsnest[ii];
|
|
|
|
if( (net->m_Status & CH_ACTIF) == 0 )
|
2007-08-04 04:40:07 +00:00
|
|
|
continue;
|
|
|
|
|
2009-05-28 08:42:24 +00:00
|
|
|
net->m_PadStart->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
|
|
|
|
net->m_PadEnd->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
|
2007-08-04 04:40:07 +00:00
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|