You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.5 KiB

16 years ago
  1. /******************************************/
  2. /* Track editing: attribute flags editing */
  3. /******************************************/
  4. #include "fctsys.h"
  5. #include "common.h"
  6. #include "class_drawpanel.h"
  7. #include "pcbnew.h"
  8. #include "wxPcbStruct.h"
  9. #include "protos.h"
  10. /* Attribute change for 1 track segment.
  11. * Attributes are
  12. * TRACK_LOCKED protection against global delete
  13. * TRACK_AR AutoRouted segment
  14. */
  15. void PCB_EDIT_FRAME::Attribut_Segment( TRACK* track, wxDC* DC, bool Flag_On )
  16. {
  17. if( track == NULL )
  18. return;
  19. OnModify();
  20. DrawPanel->CrossHairOff( DC ); // Erase cursor shape
  21. track->SetState( TRACK_LOCKED, Flag_On );
  22. track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
  23. DrawPanel->CrossHairOn( DC ); // Display cursor shape
  24. track->DisplayInfo( this );
  25. }
  26. /* Attribute change for an entire track */
  27. void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
  28. {
  29. TRACK* Track;
  30. int nb_segm;
  31. if( (track == NULL ) || (track->Type() == TYPE_ZONE) )
  32. return;
  33. DrawPanel->CrossHairOff( DC ); // Erase cursor shape
  34. Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, NULL, true );
  35. Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL );
  36. for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- )
  37. {
  38. Track->SetState( TRACK_LOCKED, Flag_On );
  39. Track->SetState( BUSY, OFF );
  40. Track = Track->Next();
  41. }
  42. DrawPanel->CrossHairOn( DC ); // Display cursor shape
  43. OnModify();
  44. }
  45. /* Modify the flag TRACK_LOCKED according to Flag_On value,
  46. * for all the segments related to net_code.
  47. * if net_code < 0 all the segments are modified.
  48. */
  49. void PCB_EDIT_FRAME::Attribut_net( wxDC* DC, int net_code, bool Flag_On )
  50. {
  51. TRACK* Track = GetBoard()->m_Track;
  52. /* search the first segment for the selected net_code */
  53. if( net_code >= 0 )
  54. {
  55. for( ; Track != NULL; Track = Track->Next() )
  56. {
  57. if( net_code == Track->GetNet() )
  58. break;
  59. }
  60. }
  61. DrawPanel->CrossHairOff( DC ); // Erase cursor shape
  62. while( Track ) /* Flag change */
  63. {
  64. if( (net_code >= 0 ) && (net_code != Track->GetNet()) )
  65. break;
  66. OnModify();
  67. Track->SetState( TRACK_LOCKED, Flag_On );
  68. Track->Draw( DrawPanel, DC, GR_OR | GR_SURBRILL );
  69. Track = Track->Next();
  70. }
  71. DrawPanel->CrossHairOn( DC ); // Display cursor shape
  72. OnModify();
  73. }