Commit b4f02306 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: fix Bug #1089120. Also change "Length Die" expression to "Length Pad To Die" in code

parent a9ccf495
......@@ -207,7 +207,6 @@ set(PCBNEW_CLASS_SRCS
toolbars_update_user_interface.cpp
tracepcb.cpp
tr_modif.cpp
trpiste.cpp
xchgmod.cpp
zones_convert_brd_items_to_polygons_with_Boost.cpp
zones_convert_to_polygons_aux_functions.cpp
......
......@@ -1822,10 +1822,8 @@ TRACK* BOARD::GetTrace( TRACK* aTrace, const wxPoint& aPosition, int aLayerMask
}
TRACK* BOARD::MarkTrace( TRACK* aTrace,
int* aCount,
int* aTraceLength,
int* aDieLength,
TRACK* BOARD::MarkTrace( TRACK* aTrace, int* aCount,
double* aTraceLength, double* aPadToDieLength,
bool aReorder )
{
int NbSegmBusy;
......@@ -1976,7 +1974,7 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
return NULL;
double full_len = 0;
double lenDie = 0;
double lenPadToDie = 0;
if( aReorder )
{
......@@ -2002,20 +2000,20 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( aTraceLength )
full_len += track->GetLength();
if( aDieLength ) // Add now length die.
if( aPadToDieLength ) // 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->GetDieLength();
lenPadToDie += (double) pad->GetPadToDieLength();
}
if( track->GetState( END_ONPAD ) )
{
D_PAD * pad = (D_PAD *) track->end;
lenDie += (double) pad->GetDieLength();
lenPadToDie += (double) pad->GetPadToDieLength();
}
}
}
......@@ -2039,13 +2037,13 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( track->GetState( BEGIN_ONPAD ) )
{
D_PAD * pad = (D_PAD *) track->start;
lenDie += (double) pad->GetDieLength();
lenPadToDie += (double) pad->GetPadToDieLength();
}
if( track->GetState( END_ONPAD ) )
{
D_PAD * pad = (D_PAD *) track->end;
lenDie += (double) pad->GetDieLength();
lenPadToDie += (double) pad->GetPadToDieLength();
}
}
}
......@@ -2054,8 +2052,8 @@ TRACK* BOARD::MarkTrace( TRACK* aTrace,
if( aTraceLength )
*aTraceLength = KiROUND( full_len );
if( aDieLength )
*aDieLength = KiROUND( lenDie );
if( aPadToDieLength )
*aPadToDieLength = KiROUND( lenPadToDie );
if( aCount )
*aCount = NbSegmBusy;
......
......@@ -1252,9 +1252,9 @@ public:
* @param aTrace The segment within a list of trace segments to test.
* @param aCount A pointer to an integer where to return the number of
* marked segments.
* @param aTraceLength A pointer to an integer where to return the length of the
* @param aTraceLength A pointer to an double where to return the length of the
* trace.
* @param aDieLength A pointer to an integer where to return the extra lengths inside
* @param aInPackageLength A pointer to an double 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
......@@ -1264,8 +1264,8 @@ public:
* track length in this case, flags are reset
* @return TRACK* The first in the chain of interesting segments.
*/
TRACK* MarkTrace( TRACK* aTrace, int* aCount, int* aTraceLength,
int* aDieLength, bool aReorder );
TRACK* MarkTrace( TRACK* aTrace, int* aCount, double* aTraceLength,
double* aInPackageLength, bool aReorder );
/**
* Function GetFootprint
......
......@@ -724,8 +724,8 @@ bool MODULE::IsLibNameValid( const wxString & aName )
*/
const wxChar* MODULE::ReturnStringLibNameInvalidChars( bool aUserReadable )
{
static const wxChar invalidChars[] = wxT("\t \"\\/");
static const wxChar invalidCharsReadable[] = wxT("'tab' 'space' \\ \" /");
static const wxChar invalidChars[] = wxT("%$\t \"\\/");
static const wxChar invalidCharsReadable[] = wxT("% $ 'tab' 'space' \\ \" /");
if( aUserReadable )
return invalidCharsReadable;
......
......@@ -111,7 +111,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
MODULE* module;
D_PAD* pad;
double lengthnet = 0; // This is the lenght of tracks on pcb
double lengthdie = 0; // this is the lenght of internal ICs connections
double lengthPadToDie = 0; // this is the lenght of internal ICs connections
frame->ClearMsgPanel();
......@@ -129,7 +129,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
if( pad->GetNet() == GetNet() )
{
count++;
lengthdie += pad->GetDieLength();
lengthPadToDie += pad->GetPadToDieLength();
}
}
}
......@@ -159,7 +159,7 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "Vias" ), txt, BLUE );
// Displays the full net lenght (tracks on pcb + internal ICs connections ):
txt = frame->CoordinateToString( lengthnet + lengthdie );
txt = frame->CoordinateToString( lengthnet + lengthPadToDie );
frame->AppendMsgPanel( _( "Net Length:" ), txt, RED );
// Displays the net lenght of tracks only:
......@@ -167,8 +167,8 @@ void NETINFO_ITEM::DisplayInfo( EDA_DRAW_FRAME* frame )
frame->AppendMsgPanel( _( "On Board" ), txt, RED );
// Displays the net lenght of internal ICs connections (wires inside ICs):
txt = frame->CoordinateToString( lengthdie );
frame->AppendMsgPanel( _( "On Die" ), txt, RED );
txt = frame->CoordinateToString( lengthPadToDie );
frame->AppendMsgPanel( _( "In Package" ), txt, RED );
}
......
......@@ -58,7 +58,7 @@ D_PAD::D_PAD( MODULE* parent ) :
m_Size.x = m_Size.y = 500; // give it a reasonable size
m_Orient = 0; // Pad rotation in 1/10 degrees
m_LengthDie = 0;
m_LengthPadToDie = 0;
if( m_Parent && m_Parent->Type() == PCB_MODULE_T )
{
......@@ -313,7 +313,7 @@ void D_PAD::Copy( D_PAD* source )
m_PadShape = source->m_PadShape;
m_Attribute = source->m_Attribute;
m_Orient = source->m_Orient;
m_LengthDie = source->m_LengthDie;
m_LengthPadToDie = source->m_LengthPadToDie;
m_LocalClearance = source->m_LocalClearance;
m_LocalSolderMaskMargin = source->m_LocalSolderMaskMargin;
m_LocalSolderPasteMargin = source->m_LocalSolderPasteMargin;
......@@ -662,10 +662,10 @@ void D_PAD::DisplayInfo( EDA_DRAW_FRAME* frame )
Line = frame->CoordinateToString( m_Pos.y );
frame->AppendMsgPanel( _( "Y pos" ), Line, LIGHTBLUE );
if( GetDieLength() )
if( GetPadToDieLength() )
{
Line = frame->CoordinateToString( GetDieLength() );
frame->AppendMsgPanel( _( "Length on die" ), Line, CYAN );
Line = frame->CoordinateToString( GetPadToDieLength() );
frame->AppendMsgPanel( _( "Length in package" ), Line, CYAN );
}
}
......
......@@ -190,8 +190,8 @@ public:
void SetAttribute( PAD_ATTR_T aAttribute ) { m_Attribute = aAttribute; }
PAD_ATTR_T GetAttribute() const { return m_Attribute; }
void SetDieLength( int aLength ) { m_LengthDie = aLength; }
int GetDieLength() const { return m_LengthDie; }
void SetPadToDieLength( int aLength ) { m_LengthPadToDie = aLength; }
int GetPadToDieLength() const { return m_LengthPadToDie; }
int GetLocalSolderMaskMargin() const { return m_LocalSolderMaskMargin; }
void SetLocalSolderMaskMargin( int aMargin ) { m_LocalSolderMaskMargin = aMargin; }
......@@ -464,7 +464,7 @@ private:
PAD_ATTR_T m_Attribute; ///< NORMAL, PAD_SMD, PAD_CONN, PAD_HOLE_NOT_PLATED
double m_Orient; ///< in 1/10 degrees
int m_LengthDie; ///< Length net from pad to die on chip
int m_LengthPadToDie; ///< Length net from pad to die, inside the package
/// Local clearance. When null, the module default value is used.
/// when the module default value is null, the netclass value is used
......
......@@ -968,19 +968,19 @@ void TRACK::DisplayInfo( EDA_DRAW_FRAME* frame )
// Display full track length (in Pcbnew)
if( frame->IsType( PCB_FRAME_TYPE ) )
{
int trackLen = 0;
int lenDie = 0;
board->MarkTrace( this, NULL, &trackLen, &lenDie, false );
double trackLen = 0;
double lenPadToDie = 0;
board->MarkTrace( this, NULL, &trackLen, &lenPadToDie, false );
msg = frame->CoordinateToString( trackLen );
frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
if( lenDie != 0 )
if( lenPadToDie != 0 )
{
msg = frame->CoordinateToString( trackLen + lenDie );
msg = frame->LengthDoubleToString( trackLen + lenPadToDie );
frame->AppendMsgPanel( _( "Full Len" ), msg, DARKCYAN );
msg = frame->CoordinateToString( lenDie );
frame->AppendMsgPanel( _( "On Die" ), msg, DARKCYAN );
msg = frame->LengthDoubleToString( lenPadToDie );
frame->AppendMsgPanel( _( "In Package" ), msg, DARKCYAN );
}
}
......
......@@ -342,7 +342,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_trapDeltaDirChoice->SetSelection( 1 );
}
PutValueInLocalUnits( *m_LengthDieCtrl, m_dummyPad->GetDieLength() );
PutValueInLocalUnits( *m_LengthPadToDieCtrl, m_dummyPad->GetPadToDieLength() );
PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_dummyPad->GetLocalClearance() );
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, m_dummyPad->GetLocalSolderMaskMargin() );
......@@ -468,7 +468,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
m_PadNumCtrl->Enable( enable );
m_PadNetNameCtrl->Enable( enable );
m_LengthDieCtrl->Enable( enable );
m_LengthPadToDieCtrl->Enable( enable );
if( m_dummyPad->GetDrillShape() != PAD_OVAL )
m_DrillShapeCtrl->SetSelection( 0 );
......@@ -612,7 +612,7 @@ void DIALOG_PAD_PROPERTIES::PadTypeSelected( wxCommandEvent& event )
bool enable = ii != 3;
m_PadNumCtrl->Enable( enable );
m_PadNetNameCtrl->Enable( enable );
m_LengthDieCtrl->Enable( enable );
m_LengthPadToDieCtrl->Enable( enable );
}
......@@ -788,7 +788,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
offset.y *= isign;
m_CurrentPad->SetOffset( offset );
m_CurrentPad->SetDieLength( m_Pad_Master.GetDieLength() );
m_CurrentPad->SetPadToDieLength( m_Pad_Master.GetPadToDieLength() );
if( m_CurrentPad->GetLayerMask() != m_Pad_Master.GetLayerMask() )
{
......@@ -925,7 +925,7 @@ bool DIALOG_PAD_PROPERTIES::transferDataToPad( D_PAD* aPad )
aPad->SetSize( wxSize( x, y ) );
// Read pad length die
aPad->SetDieLength( ReturnValueFromTextCtrl( *m_LengthDieCtrl ) );
aPad->SetPadToDieLength( ReturnValueFromTextCtrl( *m_LengthPadToDieCtrl ) );
// Read pad shape delta size:
// m_DeltaSize.x or m_DeltaSize.y must be NULL. for a trapezoid.
......
......@@ -170,14 +170,14 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind
m_PadShapeOffsetY_Unit->Wrap( -1 );
fgSizerShapeType->Add( m_PadShapeOffsetY_Unit, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
m_staticText38 = new wxStaticText( m_panelGeneral, wxID_ANY, _("Die length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText38 = new wxStaticText( m_panelGeneral, wxID_ANY, _("Pad to die length:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText38->Wrap( -1 );
m_staticText38->SetToolTip( _("Wire length from pad to die on chip ( used to calculate actual track length)") );
fgSizerShapeType->Add( m_staticText38, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxLEFT, 5 );
m_LengthDieCtrl = new wxTextCtrl( m_panelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShapeType->Add( m_LengthDieCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_LengthPadToDieCtrl = new wxTextCtrl( m_panelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerShapeType->Add( m_LengthPadToDieCtrl, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
m_PadLengthDie_Unit = new wxStaticText( m_panelGeneral, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 );
m_PadLengthDie_Unit->Wrap( -1 );
......
......@@ -2167,7 +2167,7 @@
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="selection">0</property>
<property name="selection">4</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
......@@ -3093,7 +3093,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Die length:</property>
<property name="label">Pad to die length:</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......@@ -3184,7 +3184,7 @@
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_LengthDieCtrl</property>
<property name="name">m_LengthPadToDieCtrl</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
......
......@@ -83,7 +83,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM
wxTextCtrl* m_ShapeOffset_Y_Ctrl;
wxStaticText* m_PadShapeOffsetY_Unit;
wxStaticText* m_staticText38;
wxTextCtrl* m_LengthDieCtrl;
wxTextCtrl* m_LengthPadToDieCtrl;
wxStaticText* m_PadLengthDie_Unit;
wxStaticText* m_staticText21;
wxTextCtrl* m_ShapeDelta_Ctrl;
......
......@@ -791,14 +791,14 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
// Display 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;
double lenPadToDie = 0.0;
wxString msg;
// If the starting point is on a pad, add current track length+ length die
if( g_FirstTrackSegment->GetState( BEGIN_ONPAD ) )
{
D_PAD * pad = (D_PAD *) g_FirstTrackSegment->start;
lenDie = (double) pad->GetDieLength();
lenPadToDie = (double) pad->GetPadToDieLength();
}
// calculate track len on board:
......@@ -808,11 +808,11 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
msg = frame->LengthDoubleToString( trackLen );
frame->AppendMsgPanel( _( "Track Len" ), msg, DARKCYAN );
if( lenDie != 0 ) // display the track len on board and the actual track len
if( lenPadToDie != 0 ) // display the track len on board and the actual track len
{
frame->AppendMsgPanel( _( "Full Len" ), msg, DARKCYAN );
msg = frame->LengthDoubleToString( trackLen+lenDie );
frame->AppendMsgPanel( _( "On Die" ), msg, DARKCYAN );
msg = frame->LengthDoubleToString( trackLen+lenPadToDie );
frame->AppendMsgPanel( _( "Pad to die" ), msg, DARKCYAN );
}
// Add current segments count (number of segments in this new track):
......
......@@ -1127,9 +1127,9 @@ void PCB_IO::format( D_PAD* aPad, int aNestLevel ) const
aPad->GetNet(), m_out->Quotew( aPad->GetNetname() ).c_str() );
}
if( aPad->GetDieLength() != 0 )
if( aPad->GetPadToDieLength() != 0 )
m_out->Print( aNestLevel+1, "(die_length %s)\n",
FMT_IU( aPad->GetDieLength() ).c_str() );
FMT_IU( aPad->GetPadToDieLength() ).c_str() );
if( aPad->GetLocalSolderMaskMargin() != 0 )
m_out->Print( aNestLevel+1, "(solder_mask_margin %s)\n",
......
......@@ -1288,7 +1288,7 @@ void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
else if( TESTLINE( "Le" ) )
{
BIU tmp = biuParse( line + SZ( "Le" ) );
pad->SetDieLength( tmp );
pad->SetPadToDieLength( tmp );
}
else if( TESTLINE( ".SolderMask" ) )
......@@ -3331,8 +3331,8 @@ void LEGACY_PLUGIN::savePAD( const D_PAD* me ) const
fprintf( m_fp, "Po %s\n", fmtBIUPoint( me->GetPos0() ).c_str() );
if( me->GetDieLength() != 0 )
fprintf( m_fp, "Le %s\n", fmtBIU( me->GetDieLength() ).c_str() );
if( me->GetPadToDieLength() != 0 )
fprintf( m_fp, "Le %s\n", fmtBIU( me->GetPadToDieLength() ).c_str() );
if( me->GetLocalSolderMaskMargin() != 0 )
fprintf( m_fp, ".SolderMask %s\n", fmtBIU( me->GetLocalSolderMaskMargin() ).c_str() );
......
......@@ -2156,7 +2156,7 @@ D_PAD* PCB_PARSER::parseD_PAD() throw( IO_ERROR, PARSE_ERROR )
break;
case T_die_length:
pad->SetDieLength( parseBoardUnits( T_die_length ) );
pad->SetPadToDieLength( parseBoardUnits( T_die_length ) );
NeedRIGHT();
break;
......
......@@ -44,6 +44,16 @@
static void ListSetState( EDA_ITEM* Start, int NbItem, int State, int onoff );
void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList, int nbsegment,
GR_DRAWMODE draw_mode )
{
// preserve the start of the list for debugging.
for( TRACK* track = aTrackList; nbsegment > 0 && track; nbsegment--, track = track->Next() )
{
track->Draw( panel, DC, draw_mode );
}
}
/*
* This function try to remove an old track, when a new track is created,
* and the old track is no more needed
......
/**
* @file trpiste.cpp
* @brief Routine for plotting traces.
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
#include <trigo.h>
#include <class_track.h>
#include <pcbnew.h>
#include <protos.h>
void DrawTraces( EDA_DRAW_PANEL* panel, wxDC* DC, TRACK* aTrackList, int nbsegment,
GR_DRAWMODE draw_mode )
{
// preserve the start of the list for debugging.
for( TRACK* track = aTrackList; nbsegment > 0 && track; nbsegment--, track = track->Next() )
{
track->Draw( panel, DC, draw_mode );
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment