Commit 0fdf71a8 authored by Vladimir Ur's avatar Vladimir Ur

General design rules tab converted to nanoscale. A bit of refactorisation in...

General design rules tab converted to nanoscale. A bit of refactorisation in via sizes. And build key is KICAD_NANOMETRE not KICAD_NANOMETRIC (as I stated in previous commit).
parent a273b7bd
...@@ -450,29 +450,25 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue, ...@@ -450,29 +450,25 @@ int ReturnValueFromString( EDA_UNITS_T aUnit, const wxString& TextValue,
const LENGTH_UNIT_DESC g_MillimetreDesc = const LENGTH_UNIT_DESC g_MillimetreDesc =
{ {
LENGTH_UNITS<LENGTH_DEF>::millimetre(), LENGTH_UNITS<LENGTH_DEF>::millimetre(),
_(" mm"), wxT( "mm" ),
wxT("mm"),
6 6
}; };
const LENGTH_UNIT_DESC g_InchDesc = const LENGTH_UNIT_DESC g_InchDesc =
{ {
LENGTH_UNITS<LENGTH_DEF>::inch(), LENGTH_UNITS<LENGTH_DEF>::inch(),
_(" \""), wxT( "\"" ),
wxT("in"),
7 7
}; };
const LENGTH_UNIT_DESC g_MilDesc = const LENGTH_UNIT_DESC g_MilDesc =
{ {
LENGTH_UNITS<LENGTH_DEF>::mil(), LENGTH_UNITS<LENGTH_DEF>::mil(),
_(" mil"), wxT( "mil" ),
wxT("mil"),
5 5
}; };
const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */ const LENGTH_UNIT_DESC g_UnscaledDesc = /* stub */
{ {
LENGTH_DEF::quantum(), LENGTH_DEF::quantum(),
wxT(""), wxT( "" ),
wxT(""),
4 4
}; };
...@@ -487,14 +483,23 @@ const LENGTH_UNIT_DESC *UnitDescription( EDA_UNITS_T aUnit ) { ...@@ -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, wxString LengthToString( const LENGTH_UNIT_DESC *aUnit, LENGTH_DEF aValue,
bool aAdd_unit_symbol ) { bool aAdd_unit_symbol ) {
wxString StringValue; wxString StringValue;
double value_to_print; double value_to_print;
value_to_print = LENGTH<double>(aValue) / LENGTH<double>(aUnit->m_Value); value_to_print = LENGTH<double>(aValue) / LENGTH<double>(aUnit->m_Value);
StringValue.Printf( wxT( "%.*f" ), aUnit->m_Precision, value_to_print); StringValue.Printf( wxT( "%.*f" ), aUnit->m_Precision, value_to_print);
if( aAdd_unit_symbol ) { size_t zero_tail = StringValue.find_last_not_of( wxT( "0" ) );
StringValue += aUnit->m_Postfix; 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; return StringValue;
} }
......
...@@ -344,10 +344,9 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr, ...@@ -344,10 +344,9 @@ int ReturnValueFromTextCtrl( const wxTextCtrl& TextCtr,
struct LENGTH_UNIT_DESC struct LENGTH_UNIT_DESC
{ {
LENGTH_DEF m_Value; LENGTH_DEF m_Value;
wxString m_Postfix; const wxString m_Symbol;
wxString m_IntlSymbol; int m_Precision;
int m_Precision;
}; };
extern const LENGTH_UNIT_DESC g_MillimetreDesc, g_InchDesc, g_MilDesc; extern const LENGTH_UNIT_DESC g_MillimetreDesc, g_InchDesc, g_MilDesc;
......
...@@ -38,6 +38,8 @@ static LENGTH_PCB_DBL from_legacy_lu_dbl( double x ) { ...@@ -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( x ) ( from_legacy_lu( x ) )
#define FROM_LEGACY_LU_DBL( x ) ( from_legacy_lu_dbl( x ) ) #define FROM_LEGACY_LU_DBL( x ) ( from_legacy_lu_dbl( x ) )
#define ZERO_LENGTH ( LENGTH_PCB::zero() )
#else #else
...@@ -52,6 +54,8 @@ typedef double LENGTH_PCB_DBL; ...@@ -52,6 +54,8 @@ typedef double LENGTH_PCB_DBL;
#define FROM_LEGACY_LU( x ) ( x ) #define FROM_LEGACY_LU( x ) ( x )
#define FROM_LEGACY_LU_DBL( x ) ( double( x ) ) #define FROM_LEGACY_LU_DBL( x ) ( double( x ) )
#define ZERO_LENGTH 0
#endif #endif
......
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#include "class_zone.h" #include "class_zone.h"
#include "class_marker_pcb.h" #include "class_marker_pcb.h"
#include "lengthpcb.h"
/* This is an odd place for this, but CvPcb won't link if it is /* 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. * in class_board_item.cpp like I first tried it.
...@@ -237,21 +239,22 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName ) ...@@ -237,21 +239,22 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName )
if( m_TrackWidthList.size() == 0 ) if( m_TrackWidthList.size() == 0 )
{ {
lists_sizes_modified = true; 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 /* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
* are always the Netclass 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; 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; lists_sizes_modified = true;
m_TrackWidthList[0] = netClass->GetTrackWidth(); m_TrackWidthList[0] = FROM_LEGACY_LU( netClass->GetTrackWidth() );
if( m_ViaSizeSelector >= m_ViasDimensionsList.size() ) if( m_ViaSizeSelector >= m_ViasDimensionsList.size() )
m_ViaSizeSelector = m_ViasDimensionsList.size(); m_ViaSizeSelector = m_ViasDimensionsList.size();
......
...@@ -9,12 +9,14 @@ ...@@ -9,12 +9,14 @@
#include "dlist.h" #include "dlist.h"
#include "lengthpcb.h"
#include "layers_id_colors_and_visibility.h" #include "layers_id_colors_and_visibility.h"
#include "class_netinfo.h" #include "class_netinfo.h"
#include "class_pad.h" #include "class_pad.h"
#include "class_colors_design_settings.h" #include "class_colors_design_settings.h"
#include "class_board_design_settings.h" #include "class_board_design_settings.h"
#include "class_via_dimension.h"
class PCB_BASE_FRAME; class PCB_BASE_FRAME;
class PCB_EDIT_FRAME; class PCB_EDIT_FRAME;
...@@ -80,35 +82,6 @@ struct LAYER ...@@ -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 // Helper class to handle high light nets
...@@ -206,7 +179,7 @@ public: ...@@ -206,7 +179,7 @@ public:
// The first value is the current netclass via size // The first value is the current netclass via size
// tracks widths (max count = HISTORY_MAX_COUNT) // tracks widths (max count = HISTORY_MAX_COUNT)
// The first value is the current netclass track width // The first value is the current netclass track width
std::vector <int> m_TrackWidthList; std::vector <LENGTH_PCB> m_TrackWidthList;
/// Index for m_ViaSizeList to select the value. /// Index for m_ViaSizeList to select the value.
/// 0 is the index selection of the default value Netclass /// 0 is the index selection of the default value Netclass
...@@ -768,7 +741,7 @@ public: ...@@ -768,7 +741,7 @@ public:
*/ */
int GetCurrentTrackWidth() int GetCurrentTrackWidth()
{ {
return m_TrackWidthList[m_TrackWidthSelector]; return TO_LEGACY_LU( m_TrackWidthList[m_TrackWidthSelector] );
} }
...@@ -780,7 +753,7 @@ public: ...@@ -780,7 +753,7 @@ public:
*/ */
int GetCurrentViaSize() int GetCurrentViaSize()
{ {
return m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter; return TO_LEGACY_LU( m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter );
} }
...@@ -792,8 +765,8 @@ public: ...@@ -792,8 +765,8 @@ public:
*/ */
int GetCurrentViaDrill() int GetCurrentViaDrill()
{ {
return m_ViasDimensionsList[m_ViaSizeSelector].m_Drill > 0 ? int drill = TO_LEGACY_LU( m_ViasDimensionsList[m_ViaSizeSelector].m_Drill );
m_ViasDimensionsList[m_ViaSizeSelector].m_Drill : -1; return drill > 0 ? drill : -1;
} }
......
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
#include <wx/string.h> #include <wx/string.h>
#include "lengthpcb.h"
#include "class_via_dimension.h"
class LINE_READER; class LINE_READER;
class BOARD; class BOARD;
...@@ -67,14 +70,12 @@ protected: ...@@ -67,14 +70,12 @@ protected:
/// The units on these parameters is 1/10000 of an inch, see define #PCB_INTERNAL_UNIT /// 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 LENGTH_PCB m_TrackWidth; ///< track width used to route NETs in this NETCLASS
int m_uViaDrill; ///< microvia drill hole diameter
VIA_DIMENSION m_Via; ///< Specific normal via
VIA_DIMENSION m_uVia; ///< Specific microvia
public: public:
...@@ -171,28 +172,28 @@ public: ...@@ -171,28 +172,28 @@ public:
const wxString& GetDescription() const { return m_Description; } const wxString& GetDescription() const { return m_Description; }
void SetDescription( const wxString& aDesc ) { m_Description = aDesc; } void SetDescription( const wxString& aDesc ) { m_Description = aDesc; }
int GetClearance() const { return m_Clearance; } int GetClearance() const { return TO_LEGACY_LU( m_Clearance ); }
void SetClearance( int aClearance ) { m_Clearance = aClearance; } 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; 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; 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; 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; 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; int GetuViaMinDrill() const;
void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; } void SetuViaDrill( int aSize ) { m_uVia.m_Drill = FROM_LEGACY_LU( aSize ); }
/** /**
......
/**
* @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
...@@ -212,24 +212,42 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings() ...@@ -212,24 +212,42 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings()
m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) ); m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) );
// Display min values: // Display min values:
#ifdef KICAD_NANOMETRE
value = LengthToString( UnitDescription( g_UserUnit ),
m_BrdSettings->m_TrackMinWidth,
true );
#else
value = ReturnStringFromValue( g_UserUnit, value = ReturnStringFromValue( g_UserUnit,
TO_LEGACY_LU( m_BrdSettings->m_TrackMinWidth ), TO_LEGACY_LU( m_BrdSettings->m_TrackMinWidth ),
internal_units, internal_units,
true ); true );
#endif
msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) );
m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg );
#ifdef KICAD_NANOMETRE
value = LengthToString( UnitDescription( g_UserUnit ),
m_BrdSettings->m_ViasMinSize,
true );
#else
value = ReturnStringFromValue( g_UserUnit, value = ReturnStringFromValue( g_UserUnit,
TO_LEGACY_LU( m_BrdSettings->m_ViasMinSize ), TO_LEGACY_LU( m_BrdSettings->m_ViasMinSize ),
internal_units, internal_units,
true ); true );
#endif
msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg );
#ifdef KICAD_NANOMETRE
value = LengthToString( UnitDescription( g_UserUnit ),
m_BrdSettings->m_MicroViasMinSize,
true );
#else
value = ReturnStringFromValue( g_UserUnit, value = ReturnStringFromValue( g_UserUnit,
TO_LEGACY_LU( m_BrdSettings->m_MicroViasMinSize ), TO_LEGACY_LU( m_BrdSettings->m_MicroViasMinSize ),
internal_units, internal_units,
true ); true );
#endif
msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) ); msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
m_MessagesList->AppendToPage( msg ); m_MessagesList->AppendToPage( msg );
} }
...@@ -364,19 +382,39 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists() ...@@ -364,19 +382,39 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists()
for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ ) 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 ); msg = ReturnStringFromValue( g_UserUnit, m_TracksWidthList[ii], Internal_Unit, false );
#endif
m_gridTrackWidthList->SetCellValue( ii, 0, msg ); m_gridTrackWidthList->SetCellValue( ii, 0, msg );
} }
for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ ) 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 ); Internal_Unit, false );
#endif
m_gridViaSizeList->SetCellValue( ii, 0, msg ); 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 ); Internal_Unit, false );
#endif
m_gridViaSizeList->SetCellValue( ii, 1, msg ); m_gridViaSizeList->SetCellValue( ii, 1, msg );
} }
} }
...@@ -676,28 +714,40 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() ...@@ -676,28 +714,40 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
msg = m_gridTrackWidthList->GetCellValue( row, 0 ); msg = m_gridTrackWidthList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; continue;
#ifdef KICAD_NANOMETRE
m_TracksWidthList.push_back( StringToLength( UnitDescription( g_UserUnit ), msg ) );
#else
int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits );
m_TracksWidthList.push_back( value ); m_TracksWidthList.push_back( value );
#endif
} }
// Sort new list by by increasing value // Sort new list by by increasing value
sort( m_TracksWidthList.begin(), m_TracksWidthList.end() ); sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
// Reinitialize m_TrackWidthList // Reinitialize m_ViaSizeList
m_ViasDimensionsList.clear(); m_ViasDimensionsList.clear();
for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row ) for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
{ {
msg = m_gridViaSizeList->GetCellValue( row, 0 ); msg = m_gridViaSizeList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; continue;
int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits );
VIA_DIMENSION via_dim; 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 ); msg = m_gridViaSizeList->GetCellValue( row, 1 );
if( !msg.IsEmpty() ) 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 ); 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 ); m_ViasDimensionsList.push_back( via_dim );
} }
...@@ -705,7 +755,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() ...@@ -705,7 +755,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
// Sort new list by by increasing value // Sort new list by by increasing value
sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() ); sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
std::vector <int>* 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->erase( tlist->begin() + 1, tlist->end() ); // Remove old "custom" sizes
tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes
......
...@@ -57,7 +57,7 @@ private: ...@@ -57,7 +57,7 @@ private:
// List of values to "customize" some tracks and vias // List of values to "customize" some tracks and vias
std::vector <VIA_DIMENSION> m_ViasDimensionsList; std::vector <VIA_DIMENSION> m_ViasDimensionsList;
std::vector <int> m_TracksWidthList; std::vector <LENGTH_PCB> m_TracksWidthList;
private: private:
void OnNetClassesNameLeftClick( wxGridEvent& event ){ event.Skip(); } void OnNetClassesNameLeftClick( wxGridEvent& event ){ event.Skip(); }
......
...@@ -436,8 +436,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -436,8 +436,8 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "TrackWidthList" ) == 0 ) if( stricmp( line, "TrackWidthList" ) == 0 )
{ {
int tmp = atoi( data ); double tmp = atof( data );
GetBoard()->m_TrackWidthList.push_back( tmp ); GetBoard()->m_TrackWidthList.push_back( FROM_LEGACY_LU( tmp ) );
continue; continue;
} }
...@@ -498,15 +498,15 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader ) ...@@ -498,15 +498,15 @@ int PCB_BASE_FRAME::ReadSetup( LINE_READER* aReader )
if( stricmp( line, "ViaSizeList" ) == 0 ) if( stricmp( line, "ViaSizeList" ) == 0 )
{ {
int tmp = atoi( data ); double tmp = atof( data );
VIA_DIMENSION via_dim; VIA_DIMENSION via_dim;
via_dim.m_Diameter = tmp; via_dim.m_Diameter = FROM_LEGACY_LU( tmp );
data = strtok( NULL, " \n\r" ); data = strtok( NULL, " \n\r" );
if( data ) if( data )
{ {
tmp = atoi( data ); tmp = atof( data );
via_dim.m_Drill = tmp > 0 ? tmp : 0; via_dim.m_Drill = FROM_LEGACY_LU( tmp > 0 ? tmp : 0 );
} }
GetBoard()->m_ViasDimensionsList.push_back( via_dim ); GetBoard()->m_ViasDimensionsList.push_back( via_dim );
...@@ -693,7 +693,7 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) ...@@ -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 // 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++ ) 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() ); fprintf( aFile, "TrackClearence %d\n", netclass_default->GetClearance() );
...@@ -718,9 +718,9 @@ static int WriteSetup( FILE* aFile, PCB_EDIT_FRAME* aFrame, BOARD* aBoard ) ...@@ -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 // Save custom vias diameters list (the first is not saved here: this is
// the netclass value // the netclass value
for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
fprintf( aFile, "ViaSizeList %d %d\n", fprintf( aFile, "ViaSizeList %f %f\n",
aBoard->m_ViasDimensionsList[ii].m_Diameter, TO_LEGACY_LU_DBL( aBoard->m_ViasDimensionsList[ii].m_Diameter ),
aBoard->m_ViasDimensionsList[ii].m_Drill ); TO_LEGACY_LU_DBL( aBoard->m_ViasDimensionsList[ii].m_Drill ) );
// for old versions compatibility: // for old versions compatibility:
fprintf( aFile, "MicroViaSize %d\n", netclass_default->GetuViaDiameter() ); fprintf( aFile, "MicroViaSize %d\n", netclass_default->GetuViaDiameter() );
......
...@@ -839,7 +839,8 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -839,7 +839,8 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ ) 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 ); PCB_INTERNAL_UNIT, true );
msg.Printf( _( "Track %s" ), GetChars( value ) ); msg.Printf( _( "Track %s" ), GetChars( value ) );
...@@ -853,13 +854,14 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -853,13 +854,14 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
for( unsigned ii = 0; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) 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 ); PCB_INTERNAL_UNIT, true );
wxString drill = ReturnStringFromValue( g_UserUnit, wxString drill = ReturnStringFromValue( g_UserUnit,
aBoard->m_ViasDimensionsList[ii].m_Drill, TO_LEGACY_LU( aBoard->m_ViasDimensionsList[ii].m_Drill ),
PCB_INTERNAL_UNIT, true ); 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 ) ); msg.Printf( _( "Via %s" ), GetChars( value ) );
} }
......
...@@ -1309,8 +1309,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR ) ...@@ -1309,8 +1309,8 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
// using LookupVia(). // using LookupVia().
for( unsigned i=0; i < aBoard->m_ViasDimensionsList.size(); ++i ) for( unsigned i=0; i < aBoard->m_ViasDimensionsList.size(); ++i )
{ {
int viaSize = aBoard->m_ViasDimensionsList[i].m_Diameter; int viaSize = TO_LEGACY_LU( aBoard->m_ViasDimensionsList[i].m_Diameter );
int viaDrill = aBoard->m_ViasDimensionsList[i].m_Drill; int viaDrill = TO_LEGACY_LU( aBoard->m_ViasDimensionsList[i].m_Drill );
via = makeVia( viaSize, viaDrill, via = makeVia( viaSize, viaDrill,
0, aBoard->GetCopperLayerCount()-1 ); 0, aBoard->GetCopperLayerCount()-1 );
......
...@@ -576,7 +576,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox() ...@@ -576,7 +576,7 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthList.size(); ii++ ) 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 ) if( ii == 0 )
msg << _( " *" ); msg << _( " *" );
...@@ -601,11 +601,11 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() ...@@ -601,11 +601,11 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ )
{ {
msg = _( "Via " ); 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("/ ") msg << wxT("/ ")
<< CoordinateToString( GetBoard()->m_ViasDimensionsList[ii].m_Drill, true ); << CoordinateToString( TO_LEGACY_LU( GetBoard()->m_ViasDimensionsList[ii].m_Drill ), true );
if( ii == 0 ) if( ii == 0 )
msg << _( " *" ); msg << _( " *" );
...@@ -625,7 +625,7 @@ LAYER_BOX_SELECTOR* PCB_EDIT_FRAME::ReCreateLayerBox( EDA_TOOLBAR* parent ) ...@@ -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->m_hotkeys = g_Board_Editor_Hokeys_Descr;
m_SelLayerBox->Resync(); m_SelLayerBox->Resync();
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) ); m_SelLayerBox->SetToolTip( _( "+/- to switch" ) ); // TODO: actual hotkeys
return m_SelLayerBox; return m_SelLayerBox;
} }
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