diff --git a/common/common.cpp b/common/common.cpp index af58602152..1603ede765 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -450,29 +450,25 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, const LENGTH_UNIT_DESC g_MillimetreDesc = { LENGTH_UNITS::millimetre(), - _(" mm"), - wxT("mm"), + wxT( "mm" ), 6 }; const LENGTH_UNIT_DESC g_InchDesc = { LENGTH_UNITS::inch(), - _(" \""), - wxT("in"), + wxT( "\"" ), 7 }; const LENGTH_UNIT_DESC g_MilDesc = { LENGTH_UNITS::mil(), - _(" mil"), - wxT("mil"), + wxT( "mil" ), 5 }; const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */ { LENGTH_DEF::quantum(), - wxT(""), - wxT(""), + wxT( "" ), 4 }; @@ -487,14 +483,23 @@ const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ) { } } +/* TODO: localisation */ wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValue, bool aAdd_unit_symbol ) { wxString StringValue; double value_to_print; value_to_print = LENGTH(aValue) / LENGTH(aUnit->m_Value); StringValue.Printf( wxT( "%.*f" ), aUnit->m_Precision, value_to_print); - if( aAdd_unit_symbol ) { - StringValue += aUnit->m_Postfix; + size_t zero_tail = StringValue.find_last_not_of( wxT( "0" ) ); + if( zero_tail != std::string::npos ) { + //fprintf( stderr, "pos : %d", (int) zero_tail ); + size_t delim_pos = StringValue.Length() - aUnit->m_Precision; + if( zero_tail < delim_pos) zero_tail = delim_pos; + StringValue.Truncate( zero_tail + 1 ); + } + if( aAdd_unit_symbol && aUnit->m_Symbol != wxT( "" ) ) { + StringValue += wxT( " " ); + StringValue += wxGetTranslation( aUnit->m_Symbol ); } return StringValue; } diff --git a/include/common.h b/include/common.h index e28d5e54a5..e312b6da7e 100644 --- a/include/common.h +++ b/include/common.h @@ -344,10 +344,9 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, struct LENGTH_UNIT_DESC { - LENGTH_DEF m_Value; - wxString m_Postfix; - wxString m_IntlSymbol; - int m_Precision; + LENGTH_DEF m_Value; + const wxString m_Symbol; + int m_Precision; }; extern const LENGTH_UNIT_DESC g_MillimetreDesc, g_InchDesc, g_MilDesc; diff --git a/include/lengthpcb.h b/include/lengthpcb.h index 98bebea342..040d7f8874 100644 --- a/include/lengthpcb.h +++ b/include/lengthpcb.h @@ -38,6 +38,8 @@ static LENGTH_PCB_DBL from_legacy_lu_dbl( double x ) { #define FROM_LEGACY_LU( x ) ( from_legacy_lu( x ) ) #define FROM_LEGACY_LU_DBL( x ) ( from_legacy_lu_dbl( x ) ) +#define ZERO_LENGTH ( LENGTH_PCB::zero() ) + #else @@ -52,6 +54,8 @@ typedef double LENGTH_PCB_DBL; #define FROM_LEGACY_LU( x ) ( x ) #define FROM_LEGACY_LU_DBL( x ) ( double( x ) ) +#define ZERO_LENGTH 0 + #endif diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 1810ed99c2..8f8df2d740 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -20,6 +20,8 @@ #include "class_zone.h" #include "class_marker_pcb.h" +#include "lengthpcb.h" + /* This is an odd place for this, but CvPcb won't link if it is * in class_board_item.cpp like I first tried it. @@ -237,21 +239,22 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName ) if( m_TrackWidthList.size() == 0 ) { lists_sizes_modified = true; - m_TrackWidthList.push_back( 0 ); + m_TrackWidthList.push_back( ZERO_LENGTH ); } /* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values * are always the Netclass values */ - if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() ) + if( TO_LEGACY_LU( m_ViasDimensionsList[0].m_Diameter ) != netClass->GetViaDiameter() ) lists_sizes_modified = true; - m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter(); + m_ViasDimensionsList[0].m_Diameter = FROM_LEGACY_LU( netClass->GetViaDiameter() ); - if( m_TrackWidthList[0] != netClass->GetTrackWidth() ) + /* NOTE: equality comparison on real values is bad... */ + if( TO_LEGACY_LU( m_TrackWidthList[0] ) != netClass->GetTrackWidth() ) lists_sizes_modified = true; - m_TrackWidthList[0] = netClass->GetTrackWidth(); + m_TrackWidthList[0] = FROM_LEGACY_LU( netClass->GetTrackWidth() ); if( m_ViaSizeSelector >= m_ViasDimensionsList.size() ) m_ViaSizeSelector = m_ViasDimensionsList.size(); diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 0baf68968e..cf17307a17 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -9,12 +9,14 @@ #include "dlist.h" +#include "lengthpcb.h" + #include "layers_id_colors_and_visibility.h" #include "class_netinfo.h" #include "class_pad.h" #include "class_colors_design_settings.h" #include "class_board_design_settings.h" - +#include "class_via_dimension.h" class PCB_BASE_FRAME; class PCB_EDIT_FRAME; @@ -80,35 +82,6 @@ struct LAYER }; -/** a small helper class to handle a stock of specific vias diameter and drill pair - * in the BOARD class - */ -class VIA_DIMENSION -{ -public: - int m_Diameter; // <= 0 means use Netclass via diameter - int m_Drill; // <= 0 means use Netclass via drill - - VIA_DIMENSION() - { - m_Diameter = 0; m_Drill = 0; - } - - - bool operator ==( const VIA_DIMENSION& other ) const - { - return (m_Diameter == other.m_Diameter) && (m_Drill == other.m_Drill); - } - - - bool operator <( const VIA_DIMENSION& other ) const - { - if( m_Diameter != other.m_Diameter ) - return m_Diameter < other.m_Diameter; - - return m_Drill < other.m_Drill; - } -}; // Helper class to handle high light nets @@ -206,7 +179,7 @@ public: // The first value is the current netclass via size // tracks widths (max count = HISTORY_MAX_COUNT) // The first value is the current netclass track width - std::vector m_TrackWidthList; + std::vector m_TrackWidthList; /// Index for m_ViaSizeList to select the value. /// 0 is the index selection of the default value Netclass @@ -768,7 +741,7 @@ public: */ int GetCurrentTrackWidth() { - return m_TrackWidthList[m_TrackWidthSelector]; + return TO_LEGACY_LU( m_TrackWidthList[m_TrackWidthSelector] ); } @@ -780,7 +753,7 @@ public: */ int GetCurrentViaSize() { - return m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter; + return TO_LEGACY_LU( m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter ); } @@ -792,8 +765,8 @@ public: */ int GetCurrentViaDrill() { - return m_ViasDimensionsList[m_ViaSizeSelector].m_Drill > 0 ? - m_ViasDimensionsList[m_ViaSizeSelector].m_Drill : -1; + int drill = TO_LEGACY_LU( m_ViasDimensionsList[m_ViaSizeSelector].m_Drill ); + return drill > 0 ? drill : -1; } diff --git a/pcbnew/class_netclass.h b/pcbnew/class_netclass.h index 8dc981b4c6..c42cb1f2e1 100644 --- a/pcbnew/class_netclass.h +++ b/pcbnew/class_netclass.h @@ -36,6 +36,9 @@ #include +#include "lengthpcb.h" + +#include "class_via_dimension.h" class LINE_READER; class BOARD; @@ -67,14 +70,12 @@ protected: /// The units on these parameters is 1/10000 of an inch, see define #PCB_INTERNAL_UNIT - int m_Clearance; ///< clearance when routing + LENGTH_PCB m_Clearance; ///< clearance when routing - int m_TrackWidth; ///< track width used to route NETs in this NETCLASS - int m_ViaDia; ///< via diameter - int m_ViaDrill; ///< via drill hole diameter - - int m_uViaDia; ///< microvia diameter - int m_uViaDrill; ///< microvia drill hole diameter + LENGTH_PCB m_TrackWidth; ///< track width used to route NETs in this NETCLASS + + VIA_DIMENSION m_Via; ///< Specific normal via + VIA_DIMENSION m_uVia; ///< Specific microvia public: @@ -171,28 +172,28 @@ public: const wxString& GetDescription() const { return m_Description; } void SetDescription( const wxString& aDesc ) { m_Description = aDesc; } - int GetClearance() const { return m_Clearance; } - void SetClearance( int aClearance ) { m_Clearance = aClearance; } + int GetClearance() const { return TO_LEGACY_LU( m_Clearance ); } + void SetClearance( int aClearance ) { m_Clearance = FROM_LEGACY_LU( aClearance ); } - int GetTrackWidth() const { return m_TrackWidth; } + int GetTrackWidth() const { return TO_LEGACY_LU( m_TrackWidth ); } int GetTrackMinWidth() const; - void SetTrackWidth( int aWidth ) { m_TrackWidth = aWidth; } + void SetTrackWidth( int aWidth ) { m_TrackWidth = FROM_LEGACY_LU( aWidth ); } - int GetViaDiameter() const { return m_ViaDia; } + int GetViaDiameter() const { return TO_LEGACY_LU( m_Via.m_Diameter ); } int GetViaMinDiameter() const; - void SetViaDiameter( int aDia ) { m_ViaDia = aDia; } + void SetViaDiameter( int aDia ) { m_Via.m_Diameter = FROM_LEGACY_LU( aDia ); } - int GetViaDrill() const { return m_ViaDrill; } + int GetViaDrill() const { return TO_LEGACY_LU( m_Via.m_Drill ); } int GetViaMinDrill() const; - void SetViaDrill( int aSize ) { m_ViaDrill = aSize; } + void SetViaDrill( int aSize ) { m_Via.m_Drill = FROM_LEGACY_LU( aSize ); } - int GetuViaDiameter() const { return m_uViaDia; } + int GetuViaDiameter() const { return TO_LEGACY_LU( m_uVia.m_Diameter ); } int GetuViaMinDiameter() const; - void SetuViaDiameter( int aSize ) { m_uViaDia = aSize; } + void SetuViaDiameter( int aSize ) { m_uVia.m_Diameter = FROM_LEGACY_LU( aSize ); } - int GetuViaDrill() const { return m_uViaDrill; } + int GetuViaDrill() const { return TO_LEGACY_LU( m_uVia.m_Drill ); } int GetuViaMinDrill() const; - void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; } + void SetuViaDrill( int aSize ) { m_uVia.m_Drill = FROM_LEGACY_LU( aSize ); } /** diff --git a/pcbnew/class_via_dimension.h b/pcbnew/class_via_dimension.h new file mode 100644 index 0000000000..bd1154f70b --- /dev/null +++ b/pcbnew/class_via_dimension.h @@ -0,0 +1,41 @@ +/** + * @file class_via_dimension.h + * @brief Class via dimension. + */ + +#ifndef CLASS_VIA_DIMENSION_H +#define CLASS_VIA_DIMENSION_H + +#include "lengthpcb.h" +/** a small helper class to handle a stock of specific vias diameter and drill pair + * in the BOARD class + */ +class VIA_DIMENSION +{ +public: + LENGTH_PCB m_Diameter; // <= 0 means use Netclass via diameter + LENGTH_PCB m_Drill; // <= 0 means use Netclass via drill + + VIA_DIMENSION() + { + m_Diameter = FROM_LEGACY_LU( 0 ); + m_Drill = FROM_LEGACY_LU( 0 ); + } + + + bool operator ==( const VIA_DIMENSION& other ) const + { + return (m_Diameter == other.m_Diameter) && (m_Drill == other.m_Drill); + } + + + bool operator <( const VIA_DIMENSION& other ) const + { + if( m_Diameter != other.m_Diameter ) + return m_Diameter < other.m_Diameter; + + return m_Drill < other.m_Drill; + } +}; + +#endif /* CLASS_VIA_DIMENSION_H */ \ No newline at end of file diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp index 313eb2b1e5..570dc4cf7a 100644 --- a/pcbnew/dialogs/dialog_design_rules.cpp +++ b/pcbnew/dialogs/dialog_design_rules.cpp @@ -212,24 +212,42 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings() m_MessagesList->AppendToPage( _( "Current general settings:
" ) ); // Display min values: +#ifdef KICAD_NANOMETRE + value = LengthToString( UnitDescription( g_UserUnit ), + m_BrdSettings->m_TrackMinWidth, + true ); +#else value = ReturnStringFromValue( g_UserUnit, TO_LEGACY_LU( m_BrdSettings->m_TrackMinWidth ), internal_units, true ); +#endif msg.Printf( _( "Minimum value for tracks width: %s
\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); +#ifdef KICAD_NANOMETRE + value = LengthToString( UnitDescription( g_UserUnit ), + m_BrdSettings->m_ViasMinSize, + true ); +#else value = ReturnStringFromValue( g_UserUnit, TO_LEGACY_LU( m_BrdSettings->m_ViasMinSize ), internal_units, true ); +#endif msg.Printf( _( "Minimum value for vias diameter: %s
\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); +#ifdef KICAD_NANOMETRE + value = LengthToString( UnitDescription( g_UserUnit ), + m_BrdSettings->m_MicroViasMinSize, + true ); +#else value = ReturnStringFromValue( g_UserUnit, TO_LEGACY_LU( m_BrdSettings->m_MicroViasMinSize ), internal_units, true ); +#endif msg.Printf( _( "Minimum value for microvias diameter: %s
\n" ), GetChars( value ) ); m_MessagesList->AppendToPage( msg ); } @@ -364,19 +382,39 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists() for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ ) { +#ifdef KICAD_NANOMETRE + msg = LengthToString( UnitDescription( g_UserUnit ), + m_TracksWidthList[ii], + false ); +#else msg = ReturnStringFromValue( g_UserUnit, m_TracksWidthList[ii], Internal_Unit, false ); +#endif m_gridTrackWidthList->SetCellValue( ii, 0, msg ); } for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ ) { - msg = ReturnStringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Diameter, +#ifdef KICAD_NANOMETRE + msg = LengthToString( UnitDescription( g_UserUnit ), + m_ViasDimensionsList[ii].m_Diameter, + false ); +#else + msg = ReturnStringFromValue( g_UserUnit, + TO_LEGACY_LU( m_ViasDimensionsList[ii].m_Diameter ), Internal_Unit, false ); +#endif m_gridViaSizeList->SetCellValue( ii, 0, msg ); - if( m_ViasDimensionsList[ii].m_Drill > 0 ) + if( m_ViasDimensionsList[ii].m_Drill > ZERO_LENGTH ) { - msg = ReturnStringFromValue( g_UserUnit, m_ViasDimensionsList[ii].m_Drill, +#ifdef KICAD_NANOMETRE + msg = LengthToString( UnitDescription( g_UserUnit ), + m_ViasDimensionsList[ii].m_Drill, + false ); +#else + msg = ReturnStringFromValue( g_UserUnit, + TO_LEGACY_LU( m_ViasDimensionsList[ii].m_Drill ), Internal_Unit, false ); +#endif m_gridViaSizeList->SetCellValue( ii, 1, msg ); } } @@ -676,28 +714,40 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() msg = m_gridTrackWidthList->GetCellValue( row, 0 ); if( msg.IsEmpty() ) continue; +#ifdef KICAD_NANOMETRE + m_TracksWidthList.push_back( StringToLength( UnitDescription( g_UserUnit ), msg ) ); +#else int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); m_TracksWidthList.push_back( value ); +#endif } // Sort new list by by increasing value sort( m_TracksWidthList.begin(), m_TracksWidthList.end() ); - // Reinitialize m_TrackWidthList + // Reinitialize m_ViaSizeList m_ViasDimensionsList.clear(); for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row ) { msg = m_gridViaSizeList->GetCellValue( row, 0 ); if( msg.IsEmpty() ) continue; - int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); VIA_DIMENSION via_dim; - via_dim.m_Diameter = value; +#ifdef KICAD_NANOMETRE + via_dim.m_Diameter = StringToLength( UnitDescription( g_UserUnit ), msg ); +#else + int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); + via_dim.m_Diameter = FROM_LEGACY_LU( value ); +#endif msg = m_gridViaSizeList->GetCellValue( row, 1 ); if( !msg.IsEmpty() ) { +#ifdef KICAD_NANOMETRE + via_dim.m_Drill = StringToLength( UnitDescription( g_UserUnit ), msg ); +#else value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); - via_dim.m_Drill = value; + via_dim.m_Drill = FROM_LEGACY_LU( value ); +#endif } m_ViasDimensionsList.push_back( via_dim ); } @@ -705,7 +755,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() // Sort new list by by increasing value sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() ); - std::vector * tlist = &m_Parent->GetBoard()->m_TrackWidthList; + std::vector < LENGTH_PCB >* tlist = &m_Parent->GetBoard()->m_TrackWidthList; tlist->erase( tlist->begin() + 1, tlist->end() ); // Remove old "custom" sizes tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes diff --git a/pcbnew/dialogs/dialog_design_rules.h b/pcbnew/dialogs/dialog_design_rules.h index e5bdcd190b..c02f19abe4 100644 --- a/pcbnew/dialogs/dialog_design_rules.h +++ b/pcbnew/dialogs/dialog_design_rules.h @@ -57,7 +57,7 @@ private: // List of values to "customize" some tracks and vias std::vector m_ViasDimensionsList; - std::vector m_TracksWidthList; + std::vector m_TracksWidthList; private: void OnNetClassesNameLeftClick( wxGridEvent& event ){ event.Skip(); } diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index e67f84e97c..91754be465 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -436,8 +436,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) if( stricmp( line, "TrackWidthList" ) == 0 ) { - int tmp = atoi( data ); - GetBoard()->m_TrackWidthList.push_back( tmp ); + double tmp = atof( data ); + GetBoard()->m_TrackWidthList.push_back( FROM_LEGACY_LU( tmp ) ); continue; } @@ -498,15 +498,15 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) if( stricmp( line, "ViaSizeList" ) == 0 ) { - int tmp = atoi( data ); + double tmp = atof( data ); VIA_DIMENSION via_dim; - via_dim.m_Diameter = tmp; + via_dim.m_Diameter = FROM_LEGACY_LU( tmp ); data = strtok( NULL, " \n\r" ); if( data ) { - tmp = atoi( data ); - via_dim.m_Drill = tmp > 0 ? tmp : 0; + tmp = atof( data ); + via_dim.m_Drill = FROM_LEGACY_LU( tmp > 0 ? tmp : 0 ); } GetBoard()->m_ViasDimensionsList.push_back( via_dim ); @@ -693,7 +693,7 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) // Save custom tracks width list (the first is not saved here: this is the netclass value for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ ) - fprintf( aFile, "TrackWidthList %d\n", aBoard->m_TrackWidthList[ii] ); + fprintf( aFile, "TrackWidthList %f\n", TO_LEGACY_LU_DBL( aBoard->m_TrackWidthList[ii] ) ); fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() ); @@ -718,9 +718,9 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) // Save custom vias diameters list (the first is not saved here: this is // the netclass value for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) - fprintf( aFile, "ViaSizeList %d %d\n", - aBoard->m_ViasDimensionsList[ii].m_Diameter, - aBoard->m_ViasDimensionsList[ii].m_Drill ); + fprintf( aFile, "ViaSizeList %f %f\n", + TO_LEGACY_LU_DBL( aBoard->m_ViasDimensionsList[ii].m_Diameter ), + TO_LEGACY_LU_DBL( aBoard->m_ViasDimensionsList[ii].m_Drill ) ); // for old versions compatibility: fprintf( aFile, "MicroViaSize %d\n", netclass_default->GetuViaDiameter() ); diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 92fb54b6a3..915ed934ba 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -839,7 +839,8 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ ) { - value = ReturnStringFromValue( g_UserUnit, aBoard->m_TrackWidthList[ii], + value = ReturnStringFromValue( g_UserUnit, + TO_LEGACY_LU( aBoard->m_TrackWidthList[ii] ), PCB_INTERNAL_UNIT, true ); msg.Printf( _( "Track %s" ), GetChars( value ) ); @@ -853,13 +854,14 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) for( unsigned ii = 0; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) { - value = ReturnStringFromValue( g_UserUnit, aBoard->m_ViasDimensionsList[ii].m_Diameter, + value = ReturnStringFromValue( g_UserUnit, + TO_LEGACY_LU( aBoard->m_ViasDimensionsList[ii].m_Diameter ), PCB_INTERNAL_UNIT, true ); wxString drill = ReturnStringFromValue( g_UserUnit, - aBoard->m_ViasDimensionsList[ii].m_Drill, + TO_LEGACY_LU( aBoard->m_ViasDimensionsList[ii].m_Drill ), PCB_INTERNAL_UNIT, true ); - if( aBoard->m_ViasDimensionsList[ii].m_Drill <= 0 ) + if( TO_LEGACY_LU( aBoard->m_ViasDimensionsList[ii].m_Drill ) <= 0 ) { msg.Printf( _( "Via %s" ), GetChars( value ) ); } diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index f0b24eecb8..a7749cc53b 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -1309,8 +1309,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) // using LookupVia(). for( unsigned i=0; i < aBoard->m_ViasDimensionsList.size(); ++i ) { - int viaSize = aBoard->m_ViasDimensionsList[i].m_Diameter; - int viaDrill = aBoard->m_ViasDimensionsList[i].m_Drill; + int viaSize = TO_LEGACY_LU( aBoard->m_ViasDimensionsList[i].m_Diameter ); + int viaDrill = TO_LEGACY_LU( aBoard->m_ViasDimensionsList[i].m_Drill ); via = makeVia( viaSize, viaDrill, 0, aBoard->GetCopperLayerCount()-1 ); diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index dfec27be5e..f9de65c8b6 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -576,7 +576,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox() for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthList.size(); ii++ ) { - msg = _( "Track " ) + CoordinateToString( GetBoard()->m_TrackWidthList[ii], true ); + msg = _( "Track " ) + CoordinateToString( TO_LEGACY_LU( GetBoard()->m_TrackWidthList[ii] ), true ); if( ii == 0 ) msg << _( " *" ); @@ -601,11 +601,11 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ ) { msg = _( "Via " ); - msg << CoordinateToString( GetBoard()->m_ViasDimensionsList[ii].m_Diameter, true ); + msg << CoordinateToString( TO_LEGACY_LU( GetBoard()->m_ViasDimensionsList[ii].m_Diameter ), true ); - if( GetBoard()->m_ViasDimensionsList[ii].m_Drill ) + if( 0 != TO_LEGACY_LU( GetBoard()->m_ViasDimensionsList[ii].m_Drill ) ) msg << wxT("/ ") - << CoordinateToString( GetBoard()->m_ViasDimensionsList[ii].m_Drill, true ); + << CoordinateToString( TO_LEGACY_LU( GetBoard()->m_ViasDimensionsList[ii].m_Drill ), true ); if( ii == 0 ) msg << _( " *" ); @@ -625,7 +625,7 @@ LAYER_BOX_SELECTOR* PCB_EDIT_FRAME::ReCreateLayerBox( EDA_TOOLBAR* parent ) m_SelLayerBox->m_hotkeys = g_Board_Editor_Hokeys_Descr; m_SelLayerBox->Resync(); - m_SelLayerBox->SetToolTip( _( "+/- to switch" ) ); + m_SelLayerBox->SetToolTip( _( "+/- to switch" ) ); // TODO: actual hotkeys return m_SelLayerBox; }