2007-08-04 04:40:07 +00:00
|
|
|
|
/*******************************/
|
|
|
|
|
/* Edition des pistes */
|
|
|
|
|
/* Routines de trace de pistes */
|
|
|
|
|
/*******************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "gr_basic.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"
|
|
|
|
|
#include "autorout.h"
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Routines Locales */
|
|
|
|
|
|
|
|
|
|
/* variables locales */
|
|
|
|
|
|
|
|
|
|
/***********************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
|
void WinEDA_PcbFrame::DisplayTrackSettings()
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/***********************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Display the current track width and via diameter
|
2007-08-04 04:40:07 +00:00
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
|
wxString msg;
|
|
|
|
|
wxString buftrc, bufvia;
|
|
|
|
|
|
|
|
|
|
valeur_param( g_DesignSettings.m_CurrentTrackWidth, buftrc );
|
|
|
|
|
valeur_param( g_DesignSettings.m_CurrentViaSize, bufvia );
|
|
|
|
|
msg.Printf( _( "Track Width: %s Vias Size : %s" ),
|
|
|
|
|
buftrc.GetData(), bufvia.GetData() );
|
|
|
|
|
Affiche_Message( msg );
|
|
|
|
|
m_SelTrackWidthBox_Changed = TRUE;
|
|
|
|
|
m_SelViaSizeBox_Changed = TRUE;
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/***********************************************/
|
|
|
|
|
|
|
|
|
|
/* Affiche ou efface le chevelu selon l'etat du bouton d'appel */
|
|
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
|
int ii;
|
|
|
|
|
CHEVELU* pt_chevelu;
|
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_OK) == 0 )
|
2007-08-04 04:40:07 +00:00
|
|
|
|
{
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
Compile_Ratsnest( DC, TRUE );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawGeneralRatsnest( DC, 0 ); /* effacement eventuel du chevelu affiche */
|
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pt_chevelu = GetBoard()->m_Ratsnest;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
if( pt_chevelu == NULL )
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if( g_Show_Ratsnest )
|
|
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
|
for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
|
2007-08-04 04:40:07 +00:00
|
|
|
|
{
|
|
|
|
|
pt_chevelu->status |= CH_VISIBLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawGeneralRatsnest( DC, 0 );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
|
for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
|
2007-08-04 04:40:07 +00:00
|
|
|
|
{
|
|
|
|
|
pt_chevelu->status &= ~CH_VISIBLE;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
void WinEDA_PcbFrame::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*************************************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*
|
2007-08-04 04:40:07 +00:00
|
|
|
|
* change de couche la piste pointee par la souris :
|
|
|
|
|
* la piste doit etre sur une des couches de travail,
|
|
|
|
|
* elle est mise sur l'autre couche de travail, si cela est possible
|
|
|
|
|
* (ou si DRC = Off ).
|
|
|
|
|
*/
|
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;
|
|
|
|
|
|
2008-12-04 04:28:11 +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;
|
|
|
|
|
|
|
|
|
|
pt_track = Marque_Une_Piste( this, DC, pt_segm, &nb_segm, GR_XOR );
|
|
|
|
|
|
|
|
|
|
/* effacement du flag BUSY et sauvegarde en membre .param de la couche
|
|
|
|
|
* initiale */
|
|
|
|
|
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 );
|
2007-08-23 04:28:46 +00:00
|
|
|
|
pt_segm->m_Param = pt_segm->GetLayer(); /* pour sauvegarde */
|
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;
|
|
|
|
|
|
|
|
|
|
/* inversion des couches */
|
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
|
|
|
|
{
|
2007-12-01 03:42:52 +00:00
|
|
|
|
/* Annulation du changement */
|
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; 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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR );
|
|
|
|
|
DisplayError( this, _( "Drc error, cancelled" ), 10 );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_OR | GR_SURBRILL );
|
|
|
|
|
/* controle des extremites de segments: sont-ils sur un pad */
|
|
|
|
|
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() );
|
2007-08-20 19:33:15 +00:00
|
|
|
|
pt_track->Display_Infos( this );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
GetScreen()->SetModify();
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-12-14 22:31:45 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/****************************************************************/
|
2008-12-04 04:28:11 +00:00
|
|
|
|
bool WinEDA_PcbFrame::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
|
|
|
|
{
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer != ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
|
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
else
|
2008-02-12 21:12:46 +00:00
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM;
|
2008-12-04 04:28:11 +00:00
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
|
Affiche_Status_Box();
|
|
|
|
|
SetToolbars();
|
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-01-05 05:21:35 +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
|
|
|
|
{
|
2008-12-04 04:28:11 +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
|
|
|
|
|
2007-09-20 06:45:17 +00:00
|
|
|
|
if( g_TwoSegmentTrackBuild && g_CurrentTrackSegment->Back() ) // We must handle 2 segments
|
|
|
|
|
{
|
2009-01-05 05:21:35 +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.
|
|
|
|
|
* If the via canot be placed this current state will be reused
|
|
|
|
|
*/
|
|
|
|
|
itmp = g_CurrentTrackList.GetCount();
|
2007-08-04 04:40:07 +00:00
|
|
|
|
Begin_Route( g_CurrentTrackSegment, DC );
|
|
|
|
|
|
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
|
|
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;
|
|
|
|
|
via->m_Shape = g_DesignSettings.m_CurrentViaType;
|
|
|
|
|
via->m_Width = g_DesignSettings.m_CurrentViaSize;
|
|
|
|
|
via->SetNet( g_HightLigth_NetCode );
|
|
|
|
|
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
int old_layer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-10-16 20:52:49 +00:00
|
|
|
|
//swap the layers.
|
2008-02-12 21:12:46 +00:00
|
|
|
|
if( ((PCB_SCREEN*)GetScreen())->m_Active_Layer != ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP )
|
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
else
|
2008-02-12 21:12:46 +00:00
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = ((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM;
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-10-16 20:52:49 +00:00
|
|
|
|
/* Adjust the 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:
|
2008-12-04 04:28:11 +00:00
|
|
|
|
via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case VIA_MICROVIA: // from external to the near neghbour inner layer
|
|
|
|
|
if ( old_layer == COPPER_LAYER_N )
|
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_N_2;
|
|
|
|
|
else if ( old_layer == LAYER_CMP_N )
|
2009-01-05 05:21:35 +00:00
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = GetBoard()->m_BoardSettings->m_CopperLayerCount - 2;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
else if ( old_layer == LAYER_N_2 )
|
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = COPPER_LAYER_N;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
else if ( old_layer == GetBoard()->m_BoardSettings->m_CopperLayerCount - 2 )
|
2008-04-01 05:21:50 +00:00
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_CMP_N;
|
|
|
|
|
// else error
|
2008-12-04 04:28:11 +00:00
|
|
|
|
via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
|
|
|
|
|
via->m_Width = g_DesignSettings.m_CurrentMicroViaSize;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
// Usual via is from copper to component; layer pair is 0 and 0x0F.
|
2008-12-04 04:28:11 +00:00
|
|
|
|
via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N );
|
2008-04-01 05:21:50 +00:00
|
|
|
|
break;
|
2007-10-01 04:34:11 +00:00
|
|
|
|
}
|
2007-10-15 07:50:59 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +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
|
|
|
|
|
2008-02-12 21:12:46 +00:00
|
|
|
|
((PCB_SCREEN*)GetScreen())->m_Active_Layer = old_layer;
|
2008-04-01 05:21:50 +00:00
|
|
|
|
|
2007-12-18 02:34:54 +00:00
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
|
|
|
|
|
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.
|
2008-04-01 05:21:50 +00:00
|
|
|
|
// WinEDA_PcbFrame::SetCurItem() calls Display_Infos().
|
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
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
*/
|
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
|
track->SetLayer( ((PCB_SCREEN*)GetScreen())->m_Active_Layer ); // set the layer to the new value
|
2007-09-20 06:45:17 +00:00
|
|
|
|
|
2008-12-04 04:28:11 +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)
|
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
|
2008-12-04 04:28:11 +00:00
|
|
|
|
via->Display_Infos( this );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
|
|
|
|
Affiche_Status_Box();
|
2008-04-29 13:35:26 +00:00
|
|
|
|
|
2007-08-04 04:40:07 +00:00
|
|
|
|
SetToolbars();
|
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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
void WinEDA_PcbFrame::Affiche_Status_Net( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Affiche:
|
2007-08-04 04:40:07 +00:00
|
|
|
|
* le status du net en haut d'ecran du segment pointe par la souris
|
|
|
|
|
* ou le status PCB en bas d'ecran si pas de segment pointe
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
|
TRACK* pt_segm;
|
2008-02-12 21:12:46 +00:00
|
|
|
|
int masquelayer = g_TabOneLayerMask[((PCB_SCREEN*)GetScreen())->m_Active_Layer];
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pt_segm = Locate_Pistes( GetBoard()->m_Track, masquelayer, CURSEUR_OFF_GRILLE );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
if( pt_segm == NULL )
|
2009-01-05 05:21:35 +00:00
|
|
|
|
GetBoard()->Display_Infos( 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
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**********************************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
void WinEDA_PcbFrame::Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/**********************************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Affiche le ratsnest relatif
|
2007-08-04 04:40:07 +00:00
|
|
|
|
* au net du pad pointe par la souris
|
|
|
|
|
* ou au module localise par la souris
|
|
|
|
|
* Efface le chevelu affiche si aucun module ou pad n'est selectionne
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
|
int ii;
|
|
|
|
|
CHEVELU* pt_chevelu;
|
|
|
|
|
D_PAD* pt_pad = NULL;
|
|
|
|
|
MODULE* Module = NULL;
|
|
|
|
|
|
|
|
|
|
if( g_Show_Ratsnest )
|
2007-09-20 06:45:17 +00:00
|
|
|
|
return; // Deja Affich<63>
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
if( (GetBoard()->m_Status_Pcb & LISTE_CHEVELU_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
|
|
|
|
|
2007-08-04 05:08:19 +00:00
|
|
|
|
if( pt_pad ) /* Affichage du chevelu du net correspondant */
|
2007-08-04 04:40:07 +00:00
|
|
|
|
{
|
2007-08-04 05:08:19 +00:00
|
|
|
|
pt_pad->Display_Infos( this );
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest;
|
|
|
|
|
for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
|
2007-08-04 05:08:19 +00:00
|
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
|
if( pt_chevelu->GetNet() == pt_pad->GetNet() )
|
2007-08-04 05:08:19 +00:00
|
|
|
|
{
|
|
|
|
|
if( (pt_chevelu->status & CH_VISIBLE) != 0 )
|
|
|
|
|
continue;
|
|
|
|
|
pt_chevelu->status |= CH_VISIBLE;
|
|
|
|
|
if( (pt_chevelu->status & CH_ACTIF) == 0 )
|
|
|
|
|
continue;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
|
2007-08-04 05:08:19 +00:00
|
|
|
|
GRSetDrawMode( DC, GR_XOR );
|
|
|
|
|
GRLine( &DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x,
|
|
|
|
|
pt_chevelu->pad_start->m_Pos.y,
|
|
|
|
|
pt_chevelu->pad_end->m_Pos.x,
|
|
|
|
|
pt_chevelu->pad_end->m_Pos.y,
|
|
|
|
|
0,
|
|
|
|
|
g_DesignSettings.m_RatsnestColor );
|
|
|
|
|
}
|
|
|
|
|
}
|
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
|
|
|
|
{
|
2008-12-04 04:28:11 +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 )
|
|
|
|
|
{
|
|
|
|
|
Module->Display_Infos( this );
|
|
|
|
|
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-01-05 05:21:35 +00:00
|
|
|
|
pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest;
|
|
|
|
|
for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
|
2007-08-04 04:40:07 +00:00
|
|
|
|
{
|
2007-08-04 05:08:19 +00:00
|
|
|
|
if( (pt_chevelu->pad_start == pt_pad)
|
|
|
|
|
|| (pt_chevelu->pad_end == pt_pad) )
|
|
|
|
|
{
|
|
|
|
|
if( pt_chevelu->status & CH_VISIBLE )
|
|
|
|
|
continue;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
|
2007-08-04 05:08:19 +00:00
|
|
|
|
pt_chevelu->status |= CH_VISIBLE;
|
|
|
|
|
if( (pt_chevelu->status & CH_ACTIF) == 0 )
|
|
|
|
|
continue;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
|
2007-08-04 05:08:19 +00:00
|
|
|
|
GRSetDrawMode( DC, GR_XOR );
|
|
|
|
|
GRLine( &DrawPanel->m_ClipBox, DC, pt_chevelu->pad_start->m_Pos.x,
|
|
|
|
|
pt_chevelu->pad_start->m_Pos.y,
|
|
|
|
|
pt_chevelu->pad_end->m_Pos.x,
|
|
|
|
|
pt_chevelu->pad_end->m_Pos.y,
|
|
|
|
|
0,
|
|
|
|
|
g_DesignSettings.m_RatsnestColor );
|
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Effacement complet des selections
|
|
|
|
|
* si aucun pad ou module n'a ete localise */
|
|
|
|
|
if( (pt_pad == NULL) && (Module == NULL) )
|
|
|
|
|
{
|
|
|
|
|
DrawGeneralRatsnest( DC );
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest;
|
2007-09-20 06:45:17 +00:00
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
for( ii = GetBoard()->GetNumRatsnests(); (ii > 0) && pt_chevelu; pt_chevelu++, ii-- )
|
2007-08-04 04:40:07 +00:00
|
|
|
|
pt_chevelu->status &= ~CH_VISIBLE;
|
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
void WinEDA_PcbFrame::Affiche_PadsNoConnect( wxDC* DC )
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/*****************************************************/
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
|
/* Met en surbrillance les pads non encore connectes ( correspondants aux
|
2007-08-04 04:40:07 +00:00
|
|
|
|
* chevelus actifs
|
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
{
|
2007-08-04 04:40:07 +00:00
|
|
|
|
int ii;
|
|
|
|
|
CHEVELU* pt_chevelu;
|
|
|
|
|
D_PAD* pt_pad;
|
|
|
|
|
|
2009-01-05 05:21:35 +00:00
|
|
|
|
pt_chevelu = (CHEVELU*) GetBoard()->m_Ratsnest;
|
|
|
|
|
for( ii = GetBoard()->GetNumRatsnests(); ii > 0; pt_chevelu++, ii-- )
|
2007-08-04 04:40:07 +00:00
|
|
|
|
{
|
|
|
|
|
if( (pt_chevelu->status & CH_ACTIF) == 0 )
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
pt_pad = pt_chevelu->pad_start;
|
|
|
|
|
|
|
|
|
|
if( pt_pad )
|
2008-04-01 05:21:50 +00:00
|
|
|
|
pt_pad->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
|
|
|
|
|
pt_pad = pt_chevelu->pad_end;
|
|
|
|
|
if( pt_pad )
|
2008-04-01 05:21:50 +00:00
|
|
|
|
pt_pad->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
|
2007-08-04 04:40:07 +00:00
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
|
}
|