2007-08-20 01:20:48 +00:00
|
|
|
/******************************************/
|
2009-11-12 15:43:38 +00:00
|
|
|
/* Track editing: attribute flags editing */
|
2007-08-20 01:20:48 +00:00
|
|
|
/******************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Attribute change for 1 track segment.
|
2007-08-20 01:20:48 +00:00
|
|
|
* Attributes are
|
2011-02-13 17:53:48 +00:00
|
|
|
* TRACK_LOCKED protection against global delete
|
|
|
|
* TRACK_AR AutoRouted segment
|
2007-08-20 01:20:48 +00:00
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
if( track == NULL )
|
|
|
|
return;
|
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
2011-02-13 17:53:48 +00:00
|
|
|
track->SetState( TRACK_LOCKED, Flag_On );
|
2007-08-20 01:20:48 +00:00
|
|
|
track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOn( DC ); // Display cursor shape
|
2009-04-17 08:51:02 +00:00
|
|
|
track->DisplayInfo( this );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Attribute change for an entire track */
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-20 01:20:48 +00:00
|
|
|
TRACK* Track;
|
|
|
|
int nb_segm;
|
|
|
|
|
2008-12-04 04:28:11 +00:00
|
|
|
if( (track == NULL ) || (track->Type() == TYPE_ZONE) )
|
2007-08-20 01:20:48 +00:00
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
2011-08-20 14:46:48 +00:00
|
|
|
Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, NULL, true );
|
2009-10-10 17:27:53 +00:00
|
|
|
Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
|
|
|
|
{
|
2011-02-13 17:53:48 +00:00
|
|
|
Track->SetState( TRACK_LOCKED, Flag_On );
|
2007-08-20 01:20:48 +00:00
|
|
|
Track->SetState( BUSY, OFF );
|
2008-11-24 06:53:43 +00:00
|
|
|
Track = Track->Next();
|
2007-08-20 01:20:48 +00:00
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOn( DC ); // Display cursor shape
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-20 01:20:48 +00:00
|
|
|
|
2011-02-13 17:53:48 +00:00
|
|
|
/* Modify the flag TRACK_LOCKED according to Flag_On value,
|
2007-08-20 01:20:48 +00:00
|
|
|
* for all the segments related to net_code.
|
|
|
|
* if net_code < 0 all the segments are modified.
|
|
|
|
*/
|
2011-03-01 19:26:17 +00:00
|
|
|
void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
TRACK* Track = GetBoard()->m_Track;
|
2007-08-20 01:20:48 +00:00
|
|
|
|
|
|
|
/* search the first segment for the selected net_code */
|
|
|
|
if( net_code >= 0 )
|
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
for( ; Track != NULL; Track = Track->Next() )
|
2007-08-20 01:20:48 +00:00
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
if( net_code == Track->GetNet() )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOff( DC ); // Erase cursor shape
|
2007-08-20 01:20:48 +00:00
|
|
|
while( Track ) /* Flag change */
|
|
|
|
{
|
2007-10-13 06:18:44 +00:00
|
|
|
if( (net_code >= 0 ) && (net_code != Track->GetNet()) )
|
2007-08-20 01:20:48 +00:00
|
|
|
break;
|
2009-01-05 05:21:35 +00:00
|
|
|
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2011-02-13 17:53:48 +00:00
|
|
|
Track->SetState( TRACK_LOCKED, Flag_On );
|
2007-08-20 01:20:48 +00:00
|
|
|
Track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
|
|
|
|
Track = Track->Next();
|
|
|
|
}
|
|
|
|
|
2011-02-11 20:48:13 +00:00
|
|
|
DrawPanel->CrossHairOn( DC ); // Display cursor shape
|
2010-02-19 13:23:58 +00:00
|
|
|
OnModify();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|