diff --git a/pcbnew/attribut.cpp b/pcbnew/attribut.cpp index 26286b9263..5ec824e015 100644 --- a/pcbnew/attribut.cpp +++ b/pcbnew/attribut.cpp @@ -40,7 +40,7 @@ void PCB_EDIT_FRAME::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On ) return; DrawPanel->CrossHairOff( DC ); // Erase cursor shape - Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, true ); + Track = Marque_Une_Piste( GetBoard(), track, &nb_segm, NULL, NULL, true ); Trace_Une_Piste( DrawPanel, DC, Track, nb_segm, GR_OR | GR_SURBRILL ); for( ; (Track != NULL) && (nb_segm > 0); nb_segm-- ) diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp index d7616f75c0..f579526b32 100644 --- a/pcbnew/class_netinfo_item.cpp +++ b/pcbnew/class_netinfo_item.cpp @@ -169,17 +169,17 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame ) txt.Printf( wxT( "%d" ), count ); frame->AppendMsgPanel( _( "Vias" ), txt, BLUE ); - // Displays the full net lenght (tacks on pcb + internal ICs connections ): - valeur_param( (int) (lengthnet + lengthdie), txt ); + // Displays the full net lenght (tracks on pcb + internal ICs connections ): + txt = frame->CoordinateToString( lengthnet + lengthdie ); frame->AppendMsgPanel( _( "Net Length:" ), txt, RED ); // Displays the net lenght of tracks only: - valeur_param( (int) lengthnet, txt ); - frame->AppendMsgPanel( _( "on pcb" ), txt, RED ); + txt = frame->CoordinateToString( lengthnet ); + frame->AppendMsgPanel( _( "On Board" ), txt, RED ); // Displays the net lenght of internal ICs connections (wires inside ICs): - valeur_param( (int) lengthdie, txt ); - frame->AppendMsgPanel( _( "on die" ), txt, RED ); + txt = frame->CoordinateToString( lengthdie ); + frame->AppendMsgPanel( _( "On Die" ), txt, RED ); } diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index 973d1730b8..4260f7237b 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -997,9 +997,18 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame ) if( frame->m_Ident == PCB_FRAME ) { int trackLen = 0; - Marque_Une_Piste( board, this, NULL, &trackLen, false ); + int lenDie = 0; + Marque_Une_Piste( board, this, NULL, &trackLen, &lenDie, false ); msg = frame->CoordinateToString( trackLen ); - frame->AppendMsgPanel( _( "Track Length" ), msg, DARKCYAN ); + frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN ); + if( lenDie != 0 ) + { + msg = frame->CoordinateToString( trackLen + lenDie ); + frame->AppendMsgPanel( _( "Full Len" ), msg, DARKCYAN ); + + msg = frame->CoordinateToString( lenDie ); + frame->AppendMsgPanel( _( "On Die" ), msg, DARKCYAN ); + } } NETCLASS* netclass = GetNetClass(); diff --git a/pcbnew/deltrack.cpp b/pcbnew/deltrack.cpp index 61d4e64bff..2bbe6ba1a0 100644 --- a/pcbnew/deltrack.cpp +++ b/pcbnew/deltrack.cpp @@ -180,7 +180,7 @@ void PCB_EDIT_FRAME::Remove_One_Track( wxDC* DC, TRACK* pt_segm ) return; TRACK* trackList = Marque_Une_Piste( GetBoard(), pt_segm, - &segments_to_delete_count, NULL, true ); + &segments_to_delete_count, NULL, NULL, true ); if( segments_to_delete_count == 0 ) return; diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index 74f6a60311..f211a867be 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -150,7 +150,7 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment ) if( aTrackSegment == NULL ) return; - pt_track = Marque_Une_Piste( GetBoard(), aTrackSegment, &nb_segm, NULL, true ); + pt_track = Marque_Une_Piste( GetBoard(), aTrackSegment, &nb_segm, NULL, NULL, true ); PICKED_ITEMS_LIST itemsListPicker; bool change = false; diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index d3f479fd80..625a09cecf 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -34,7 +34,7 @@ void PCB_EDIT_FRAME::ExChange_Track_Layer( TRACK* pt_segm, wxDC* DC ) l1 = Route_Layer_TOP; l2 = Route_Layer_BOTTOM; - pt_track = Marque_Une_Piste( GetBoard(), pt_segm, &nb_segm, NULL, true ); + pt_track = Marque_Une_Piste( GetBoard(), pt_segm, &nb_segm, NULL, NULL, true ); if ( DC ) Trace_Une_Piste( DrawPanel, DC, pt_track, nb_segm, GR_XOR ); diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index 80eba3b451..721543a74f 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -783,15 +783,32 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo // display interesting segment info only: isegm->DisplayInfoBase( frame ); - // Add current track length + // Diosplay current track length (on board) and the the actual track len + // if there is an extra len due to the len die on the starting pad (if any) double trackLen = 0.0; + double lenDie = 0.0; wxString msg; + // If the starting point is on a pad, add current track length+ lenght die + if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) ) + { + D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start; + lenDie = (double) pad->m_LengthDie; + } + // calculate track len on board: for( TRACK* track = g_FirstTrackSegment; track; track = track->Next() ) trackLen += track->GetLength(); valeur_param( wxRound( trackLen ), msg ); frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN ); + if( lenDie != 0 ) // display the track len on board and the actual track len + { + frame->AppendMsgPanel( _( "Full Len" ), msg, DARKCYAN ); + valeur_param( wxRound( trackLen+lenDie ), msg ); + frame->AppendMsgPanel( _( "On Die" ), msg, DARKCYAN ); + } + + // Add current segments count (number of segments in this new track): msg.Printf( wxT( "%d" ), g_CurrentTrackList.GetCount() ); frame->AppendMsgPanel( _( "Segs Count" ), msg, DARKCYAN ); @@ -1035,7 +1052,7 @@ void DeleteNullTrackSegments( BOARD* pcb, DLIST& aTrackList ) } -/* Ensure the end point of g_CurrentTrackSegment is on the pas "Pad" +/* Ensure the end point of g_CurrentTrackSegment is on the pad "Pad" * if no, create a new track segment if necessary * and move current (or new) end segment on pad */ diff --git a/pcbnew/protos.h b/pcbnew/protos.h index ec5fa470dc..da58e33998 100644 --- a/pcbnew/protos.h +++ b/pcbnew/protos.h @@ -224,6 +224,8 @@ void Calcule_Coord_Extremite_45( const wxPoint& aPosition, int ox, int oy, int* * interesting segments * @param aTrackLen = a pointer to an integer where to return the lenght of the * track + * @param aLengthDie = a pointer to an integer where to return the extra lengths inside integrated circuits + * from the pads connected to this track to the die (if any) * @param aReorder = true for reorder the interesting segments (useful for * track edition/deletion) in this case the flag BUSY is * set (the user is responsible of flag clearing). False @@ -235,6 +237,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb, TRACK* aStartSegm, int* aSegmCount, int* aTrackLen, + int* aLengthDie, bool aReorder ); /* Calculate end coordinate of a trace. diff --git a/pcbnew/tr_modif.cpp b/pcbnew/tr_modif.cpp index 0c4e7b39dc..7413421d45 100644 --- a/pcbnew/tr_modif.cpp +++ b/pcbnew/tr_modif.cpp @@ -39,7 +39,6 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, wxPoint start; wxPoint end; int startmasklayer, endmasklayer; - TRACK* BufDeb, * BufEnd; int netcode = aNewTrack->GetNet(); @@ -57,7 +56,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, aNewTrack = aNewTrack->Next(); aNewTrack = Marque_Une_Piste( GetBoard(), aNewTrack, - &aNewTrackSegmentsCount, NULL, true ); + &aNewTrackSegmentsCount, NULL, NULL, true ); wxASSERT( aNewTrack ); #if 0 && defined(DEBUG) @@ -81,20 +80,16 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, #endif - /* Calculate search in terms of segments of track, 1st edge BufDeb useful - * segment. */ - BufDeb = m_Pcb->m_Track->GetStartNetCode( netcode ); - - /* Point BufEnd the last segment. */ - BufEnd = BufDeb->GetEndNetCode( netcode ); + TRACK* bufStart = m_Pcb->m_Track->GetStartNetCode( netcode ); // Beginning of tracks of the net + TRACK* bufEnd = bufStart->GetEndNetCode( netcode ); // Enf of tracks of the net /* Flags for cleaning the net. */ - for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) + for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() ) { //D( printf( "track %p turning off BUSY | IN_EDIT | IS_LINKED\n", pt_del ); ) D( std::cout<<"track "<SetState( BUSY | IN_EDIT | IS_LINKED, OFF ); - if( pt_del == BufEnd ) // Last segment reached + if( pt_del == bufEnd ) // Last segment reached break; } @@ -146,7 +141,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, /* A segment must be connected to the starting point, otherwise * it is unnecessary to analyze the other point */ - pt_segm = Fast_Locate_Piste( BufDeb, BufEnd, start, startmasklayer ); + pt_segm = Fast_Locate_Piste( bufStart, bufEnd, start, startmasklayer ); if( pt_segm == NULL ) /* Not connected to the track starting point. */ { @@ -159,9 +154,9 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, * Note: the vias are not taken into account because they do * not define a track, since they are on an intersection. */ - for( pt_del = BufDeb, nbconnect = 0; ; ) + for( pt_del = bufStart, nbconnect = 0; ; ) { - pt_segm = Fast_Locate_Piste( pt_del, BufEnd, end, endmasklayer ); + pt_segm = Fast_Locate_Piste( pt_del, bufEnd, end, endmasklayer ); if( pt_segm == NULL ) break; @@ -173,7 +168,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, nbconnect++; } } - if( pt_del == BufEnd ) + if( pt_del == bufEnd ) break; pt_del = pt_segm->Next(); @@ -182,10 +177,10 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, if( nbconnect == 0 ) { /* Clear used flags */ - for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) + for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() ) { pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF ); - if( pt_del == BufEnd ) // Last segment reached + if( pt_del == bufEnd ) // Last segment reached break; } @@ -201,20 +196,20 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, /* Test all marked segments. */ while( nbconnect ) { - for( pt_del = BufDeb; pt_del; pt_del = pt_del->Next() ) + for( pt_del = bufStart; pt_del; pt_del = pt_del->Next() ) { if( pt_del->GetState( IS_LINKED ) ) break; - if( pt_del == BufEnd ) // Last segment reached + if( pt_del == bufEnd ) // Last segment reached break; } nbconnect--; pt_del->SetState( IS_LINKED, OFF ); - pt_del = Marque_Une_Piste( GetBoard(), pt_del, &nb_segm, NULL, true ); + pt_del = Marque_Une_Piste( GetBoard(), pt_del, &nb_segm, NULL, NULL, true ); - /* Test if the marked track is redundant, ie if one of marked segments + /* Test if the marked track is redundant, i.e. if one of marked segments * is connected to the starting point of the new track. */ ii = 0; @@ -272,7 +267,7 @@ int PCB_EDIT_FRAME::EraseRedundantTrack( wxDC* aDC, for( pt_del = m_Pcb->m_Track; pt_del; pt_del = pt_del->Next() ) { pt_del->SetState( BUSY | IS_DELETED | IN_EDIT | IS_LINKED, OFF ); - if( pt_del == BufEnd ) // Last segment reached + if( pt_del == bufEnd ) // Last segment reached break; } diff --git a/pcbnew/track.cpp b/pcbnew/track.cpp index 354b465b76..eef61bbb38 100644 --- a/pcbnew/track.cpp +++ b/pcbnew/track.cpp @@ -40,7 +40,9 @@ static void Marque_Chaine_segments( BOARD* Pcb, * @param aSegmCount = a pointer to an integer where to return the number of * interesting segments * @param aTrackLen = a pointer to an integer where to return the length of the - * track + * track on board + * @param aLengthDie = a pointer to an integer where to return the extra lengths inside integrated circuits + * from the pads connected to this track to the die (if any) * @param aReorder = bool: * true for reorder the interesting segments (useful for track *edition/deletion) @@ -54,6 +56,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb, TRACK* aStartSegm, int* aSegmCount, int* aTrackLen, + int* aLengthDie, bool aReorder ) { int NbSegmBusy; @@ -220,6 +223,7 @@ TRACK* Marque_Une_Piste( BOARD* aPcb, return NULL; double full_len = 0; + double lenDie = 0; if( aReorder ) { DLIST* list = (DLIST*)firstTrack->GetList(); @@ -240,6 +244,21 @@ TRACK* Marque_Une_Piste( BOARD* aPcb, list->Insert( track, firstTrack->Next() ); if( aTrackLen ) full_len += track->GetLength(); + if( aLengthDie ) // Add now length die. + { + // In fact only 2 pads (maximum) will be taken in account: + // that are on each end of the track, if any + if( track->GetState( BEGIN_ONPAD ) ) + { + D_PAD * pad = (D_PAD *) track->start; + lenDie += (double) pad->m_LengthDie; + } + if( track->GetState( END_ONPAD ) ) + { + D_PAD * pad = (D_PAD *) track->end; + lenDie += (double) pad->m_LengthDie; + } + } } } } @@ -253,12 +272,27 @@ TRACK* Marque_Une_Piste( BOARD* aPcb, NbSegmBusy++; track->SetState( BUSY, OFF ); full_len += track->GetLength(); + // Add now length die. + // In fact only 2 pads (maximum) will be taken in account: + // that are on each end of the track, if any + if( track->GetState( BEGIN_ONPAD ) ) + { + D_PAD * pad = (D_PAD *) track->start; + lenDie += (double) pad->m_LengthDie; + } + if( track->GetState( END_ONPAD ) ) + { + D_PAD * pad = (D_PAD *) track->end; + lenDie += (double) pad->m_LengthDie; + } } } } if( aTrackLen ) *aTrackLen = wxRound( full_len ); + if( aLengthDie ) + *aLengthDie = wxRound( lenDie ); if( aSegmCount ) *aSegmCount = NbSegmBusy;