Commit cd8aaee1 authored by Maciej Suminski's avatar Maciej Suminski

Moved most of the board design rules related fields & methods to BOARD_DESIGN_SETTINGS class.

parent 7ec1313c
...@@ -10,6 +10,41 @@ ...@@ -10,6 +10,41 @@
#include <class_track.h> #include <class_track.h>
#include <config_params.h> #include <config_params.h>
/**
* Struct VIA_DIMENSION
* is a small helper container to handle a stock of specific vias each with
* unique diameter and drill sizes in the BOARD class.
*/
struct VIA_DIMENSION
{
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;
}
VIA_DIMENSION( int aDiameter, int aDrill )
{
m_Diameter = aDiameter;
m_Drill = aDrill;
}
bool operator==( const VIA_DIMENSION& aOther ) const
{
return ( m_Diameter == aOther.m_Diameter ) && ( m_Drill == aOther.m_Drill );
}
bool operator<( const VIA_DIMENSION& aOther ) const
{
if( m_Diameter != aOther.m_Diameter )
return m_Diameter < aOther.m_Diameter;
return m_Drill < aOther.m_Drill;
}
};
/** /**
* Class BOARD_DESIGN_SETTINGS * Class BOARD_DESIGN_SETTINGS
...@@ -18,6 +53,14 @@ ...@@ -18,6 +53,14 @@
class BOARD_DESIGN_SETTINGS class BOARD_DESIGN_SETTINGS
{ {
public: public:
// The first value is the current netclass via size
/// Vias size and drill list
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
// The first value is the current netclass track width
/// Track width list
std::vector<int> m_TrackWidthList;
bool m_MicroViasAllowed; ///< true to allow micro vias bool m_MicroViasAllowed; ///< true to allow micro vias
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
VIATYPE_T m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA) VIATYPE_T m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
...@@ -52,9 +95,155 @@ public: ...@@ -52,9 +95,155 @@ public:
D_PAD m_Pad_Master; D_PAD m_Pad_Master;
public:
BOARD_DESIGN_SETTINGS(); BOARD_DESIGN_SETTINGS();
/**
* Function GetTrackWidthIndex
* @return the current track width list index.
*/
unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
/**
* Function SetTrackWidthIndex
* sets the current track width list index to \a aIndex.
*
* @param aIndex is the track width list index.
*/
void SetTrackWidthIndex( unsigned aIndex );
/**
* Function GetCurrentTrackWidth
* @return the current track width, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentTrackWidth() const
{
return m_useCustomTrackVia ? m_customTrackWidth : m_TrackWidthList[m_trackWidthIndex];
}
/**
* Function SetCustomTrackWidth
* Sets custom width for track (i.e. not available in netclasses or preset list). To have
* it returned with GetCurrentTrackWidth() you need to enable custom track & via sizes
* (UseCustomTrackViaSize()).
* @param aWidth is the new track width.
*/
void SetCustomTrackWidth( int aWidth )
{
m_customTrackWidth = aWidth;
}
/**
* Function GetCustomTrackWidth
* @return Current custom width for a track.
*/
int GetCustomTrackWidth() const
{
return m_customTrackWidth;
}
/**
* Function GetViaSizeIndex
* @return the current via size list index.
*/
unsigned GetViaSizeIndex() const { return m_viaSizeIndex; }
/**
* Function SetViaSizeIndex
* sets the current via size list index to \a aIndex.
*
* @param aIndex is the via size list index.
*/
void SetViaSizeIndex( unsigned aIndex );
/**
* Function GetCurrentViaSize
* @return the current via size, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentViaSize() const
{
if( m_useCustomTrackVia )
return m_customViaSize.m_Diameter;
else
return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
}
/**
* Function SetCustomViaSize
* Sets custom size for via diameter (i.e. not available in netclasses or preset list). To have
* it returned with GetCurrentViaSize() you need to enable custom track & via sizes
* (UseCustomTrackViaSize()).
* @param aSize is the new drill diameter.
*/
void SetCustomViaSize( int aSize )
{
m_customViaSize.m_Diameter = aSize;
}
/**
* Function GetCustomViaSize
* @return Current custom size for the via diameter.
*/
int GetCustomViaSize() const
{
return m_customViaSize.m_Diameter;
}
/**
* Function GetCurrentViaDrill
* @return the current via size, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentViaDrill() const;
/**
* Function SetCustomViaDrill
* Sets custom size for via drill (i.e. not available in netclasses or preset list). To have
* it returned with GetCurrentViaDrill() you need to enable custom track & via sizes
* (UseCustomTrackViaSize()).
* @param aDrill is the new drill size.
*/
void SetCustomViaDrill( int aDrill )
{
m_customViaSize.m_Drill = aDrill;
}
/**
* Function GetCustomViaDrill
* @return Current custom size for the via drill.
*/
int GetCustomViaDrill() const
{
return m_customViaSize.m_Drill;
}
// TODO microvia methods should go here
/**
* Function UseCustomTrackViaSize
* Enables/disables custom track/via size settings. If enabled, values set with
* SetCustomTrackWidth()/SetCustomViaSize()/SetCustomViaDrill() are used for newly created
* tracks and vias.
* @param aEnabled decides if custom settings should be used for new tracks/vias.
*/
void UseCustomTrackViaSize( bool aEnabled )
{
m_useCustomTrackVia = aEnabled;
}
/**
* Function UseCustomTrackViaSize
* @return True if custom sizes of tracks & vias are enabled, false otherwise.
*/
bool UseCustomTrackViaSize() const
{
return m_useCustomTrackVia;
}
/** /**
* Function GetVisibleLayers * Function GetVisibleLayers
* returns a bit-mask of all the layers that are visible * returns a bit-mask of all the layers that are visible
...@@ -196,6 +385,23 @@ public: ...@@ -196,6 +385,23 @@ public:
void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; } void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
private: private:
/// Index for #m_ViasDimensionsList to select the current via size.
/// 0 is the index selection of the default value Netclass
unsigned m_viaSizeIndex;
// Index for m_TrackWidthList to select the value.
/// 0 is the index selection of the default value Netclass
unsigned m_trackWidthIndex;
///> Use custom values for track/via sizes (not specified in net class nor in the size lists).
bool m_useCustomTrackVia;
///> Custom track width (used after UseCustomTrackViaSize( true ) was called).
int m_customTrackWidth;
///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
VIA_DIMENSION m_customViaSize;
int m_CopperLayerCount; ///< Number of copper layers for this design int m_CopperLayerCount; ///< Number of copper layers for this design
LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling
LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility
......
...@@ -428,7 +428,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe, ...@@ -428,7 +428,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
result = NOSUCCESS; result = NOSUCCESS;
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 ); marge = s_Clearance + ( pcbframe->GetDesignSettings().GetCurrentTrackWidth() / 2 );
/* clear direction flags */ /* clear direction flags */
i = RoutingMatrix.m_Nrows * RoutingMatrix.m_Ncols * sizeof(DIR_CELL); i = RoutingMatrix.m_Nrows * RoutingMatrix.m_Ncols * sizeof(DIR_CELL);
...@@ -1174,7 +1174,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -1174,7 +1174,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
( RoutingMatrix.m_GridRouting * col ))); ( RoutingMatrix.m_GridRouting * col )));
g_CurrentTrackSegment->SetEnd( g_CurrentTrackSegment->GetStart() ); g_CurrentTrackSegment->SetEnd( g_CurrentTrackSegment->GetStart() );
g_CurrentTrackSegment->SetWidth( pcb->GetCurrentViaSize() ); g_CurrentTrackSegment->SetWidth( pcb->GetDesignSettings().GetCurrentViaSize() );
newVia->SetViaType( pcb->GetDesignSettings().m_CurrentViaType ); newVia->SetViaType( pcb->GetDesignSettings().m_CurrentViaType );
g_CurrentTrackSegment->SetNetCode( current_net_code ); g_CurrentTrackSegment->SetNetCode( current_net_code );
...@@ -1233,7 +1233,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row, ...@@ -1233,7 +1233,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
} }
} }
g_CurrentTrackSegment->SetWidth( pcb->GetCurrentTrackWidth() ); g_CurrentTrackSegment->SetWidth( pcb->GetDesignSettings().GetCurrentTrackWidth() );
if( g_CurrentTrackSegment->GetStart() != g_CurrentTrackSegment->GetEnd() ) if( g_CurrentTrackSegment->GetStart() != g_CurrentTrackSegment->GetEnd() )
{ {
...@@ -1275,8 +1275,8 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC ) ...@@ -1275,8 +1275,8 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
EDA_DRAW_PANEL* panel = pcbframe->GetCanvas(); EDA_DRAW_PANEL* panel = pcbframe->GetCanvas();
PCB_SCREEN* screen = pcbframe->GetScreen(); PCB_SCREEN* screen = pcbframe->GetScreen();
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 ); marge = s_Clearance + ( pcbframe->GetDesignSettings().GetCurrentTrackWidth() / 2 );
via_marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentViaSize() / 2 ); via_marge = s_Clearance + ( pcbframe->GetDesignSettings().GetCurrentViaSize() / 2 );
dx1 = g_CurrentTrackSegment->GetEnd().x - g_CurrentTrackSegment->GetStart().x; dx1 = g_CurrentTrackSegment->GetEnd().x - g_CurrentTrackSegment->GetStart().x;
dy1 = g_CurrentTrackSegment->GetEnd().y - g_CurrentTrackSegment->GetStart().y; dy1 = g_CurrentTrackSegment->GetEnd().y - g_CurrentTrackSegment->GetStart().y;
......
...@@ -94,8 +94,8 @@ BOARD::BOARD() : ...@@ -94,8 +94,8 @@ BOARD::BOARD() :
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) ); m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
m_viaSizeIndex = 0; m_designSettings.SetViaSizeIndex( 0 );
m_trackWidthIndex = 0; m_designSettings.SetTrackWidthIndex( 0 );
/* Dick 5-Feb-2012: this seems unnecessary. I don't believe the comment /* Dick 5-Feb-2012: this seems unnecessary. I don't believe the comment
near line 70 of class_netclass.cpp. I stepped through with debugger. near line 70 of class_netclass.cpp. I stepped through with debugger.
...@@ -107,10 +107,10 @@ BOARD::BOARD() : ...@@ -107,10 +107,10 @@ BOARD::BOARD() :
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() ); SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
// Set sensible initial values for custom track width & via size // Set sensible initial values for custom track width & via size
m_useCustomTrackVia = false; m_designSettings.UseCustomTrackViaSize( false );
m_customTrackWidth = GetCurrentTrackWidth(); m_designSettings.SetCustomTrackWidth( m_designSettings.GetCurrentTrackWidth() );
m_customViaSize.m_Diameter = GetCurrentViaSize(); m_designSettings.SetCustomViaSize( m_designSettings.GetCurrentViaSize() );
m_customViaSize.m_Drill = GetCurrentViaDrill(); m_designSettings.SetCustomViaDrill( m_designSettings.GetCurrentViaDrill() );
// Initialize ratsnest // Initialize ratsnest
m_ratsnest = new RN_DATA( this ); m_ratsnest = new RN_DATA( this );
...@@ -331,37 +331,37 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName ) ...@@ -331,37 +331,37 @@ bool BOARD::SetCurrentNetClass( const wxString& aNetClassName )
m_currentNetClassName = netClass->GetName(); m_currentNetClassName = netClass->GetName();
// Initialize others values: // Initialize others values:
if( m_ViasDimensionsList.size() == 0 ) if( m_designSettings.m_ViasDimensionsList.size() == 0 )
{ {
VIA_DIMENSION viadim; VIA_DIMENSION viadim;
lists_sizes_modified = true; lists_sizes_modified = true;
m_ViasDimensionsList.push_back( viadim ); m_designSettings.m_ViasDimensionsList.push_back( viadim );
} }
if( m_TrackWidthList.size() == 0 ) if( m_designSettings.m_TrackWidthList.size() == 0 )
{ {
lists_sizes_modified = true; lists_sizes_modified = true;
m_TrackWidthList.push_back( 0 ); m_designSettings.m_TrackWidthList.push_back( 0 );
} }
/* 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( m_designSettings.m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
lists_sizes_modified = true; lists_sizes_modified = true;
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter(); m_designSettings.m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
if( m_TrackWidthList[0] != netClass->GetTrackWidth() ) if( m_designSettings.m_TrackWidthList[0] != netClass->GetTrackWidth() )
lists_sizes_modified = true; lists_sizes_modified = true;
m_TrackWidthList[0] = netClass->GetTrackWidth(); m_designSettings.m_TrackWidthList[0] = netClass->GetTrackWidth();
if( m_viaSizeIndex >= m_ViasDimensionsList.size() ) if( m_designSettings.GetViaSizeIndex() >= m_designSettings.m_ViasDimensionsList.size() )
m_viaSizeIndex = m_ViasDimensionsList.size(); m_designSettings.SetViaSizeIndex( m_designSettings.m_ViasDimensionsList.size() );
if( m_trackWidthIndex >= m_TrackWidthList.size() ) if( m_designSettings.GetTrackWidthIndex() >= m_designSettings.m_TrackWidthList.size() )
m_trackWidthIndex = m_TrackWidthList.size(); m_designSettings.SetTrackWidthIndex( m_designSettings.m_TrackWidthList.size() );
return lists_sizes_modified; return lists_sizes_modified;
} }
...@@ -2200,24 +2200,6 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS ...@@ -2200,24 +2200,6 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
} }
void BOARD::SetViaSizeIndex( unsigned aIndex )
{
if( aIndex >= m_ViasDimensionsList.size() )
m_viaSizeIndex = m_ViasDimensionsList.size();
else
m_viaSizeIndex = aIndex;
}
void BOARD::SetTrackWidthIndex( unsigned aIndex )
{
if( aIndex >= m_TrackWidthList.size() )
m_trackWidthIndex = m_TrackWidthList.size();
else
m_trackWidthIndex = aIndex;
}
ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode, ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch ) LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch )
{ {
......
...@@ -111,8 +111,6 @@ public: ...@@ -111,8 +111,6 @@ public:
/** The type of the layer */ /** The type of the layer */
LAYER_T m_Type; LAYER_T m_Type;
// int m_Color;
/** /**
* Function ShowType * Function ShowType
* converts a LAYER_T enum to a const char* * converts a LAYER_T enum to a const char*
...@@ -136,52 +134,15 @@ private: ...@@ -136,52 +134,15 @@ private:
}; };
/**
* Struct VIA_DIMENSION
* is a small helper container to handle a stock of specific vias each with
* unique diameter and drill sizes in the BOARD class.
*/
struct VIA_DIMENSION
{
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;
}
VIA_DIMENSION( int aDiameter, int aDrill )
{
m_Diameter = aDiameter;
m_Drill = aDrill;
}
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
class HIGH_LIGHT_INFO class HIGH_LIGHT_INFO
{ {
friend class BOARD; friend class BOARD;
protected: protected:
int m_netCode; // net selected for highlight (-1 when no net selected ) int m_netCode; // net selected for highlight (-1 when no net selected )
bool m_highLightOn; // highlight active bool m_highLightOn; // highlight active
protected:
void Clear() void Clear()
{ {
m_netCode = -1; m_netCode = -1;
...@@ -251,22 +212,6 @@ private: ...@@ -251,22 +212,6 @@ private:
/// This is also the last used netclass after starting a track. /// This is also the last used netclass after starting a track.
wxString m_currentNetClassName; wxString m_currentNetClassName;
/// Index for #m_ViasDimensionsList to select the current via size.
/// 0 is the index selection of the default value Netclass
unsigned m_viaSizeIndex;
// Index for m_TrackWidthList to select the value.
unsigned m_trackWidthIndex;
///> Use custom values for track/via sizes (not specified in net class nor in the size lists).
bool m_useCustomTrackVia;
///> Custom track width (used after UseCustomTrackViaSize( true ) was called).
int m_customTrackWidth;
///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
VIA_DIMENSION m_customViaSize;
/** /**
* Function chainMarkedSegments * Function chainMarkedSegments
* is used by MarkTrace() to set the BUSY flag of connected segments of the trace * is used by MarkTrace() to set the BUSY flag of connected segments of the trace
...@@ -308,18 +253,6 @@ public: ...@@ -308,18 +253,6 @@ public:
/// List of current netclasses. There is always the default netclass. /// List of current netclasses. There is always the default netclass.
NETCLASSES m_NetClasses; NETCLASSES m_NetClasses;
// handling of vias and tracks size:
// the first value is always the value of the current NetClass
// The others values are extra values
// The first value is the current netclass via size
/// Vias size and drill list
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
// The first value is the current netclass track width
/// Track width list
std::vector<int> m_TrackWidthList;
BOARD(); BOARD();
~BOARD(); ~BOARD();
...@@ -647,7 +580,10 @@ public: ...@@ -647,7 +580,10 @@ public:
* Function SetDesignSettings * Function SetDesignSettings
* @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use * @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use
*/ */
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings ) { m_designSettings = aDesignSettings; } void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings )
{
m_designSettings = aDesignSettings;
}
const PAGE_INFO& GetPageSettings() const { return m_paper; } const PAGE_INFO& GetPageSettings() const { return m_paper; }
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; } void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
...@@ -778,7 +714,6 @@ public: ...@@ -778,7 +714,6 @@ public:
return m_FullRatsnest.size(); return m_FullRatsnest.size();
} }
/** /**
* Function GetNodesCount * Function GetNodesCount
* @return the number of pads members of nets (i.e. with netcode > 0) * @return the number of pads members of nets (i.e. with netcode > 0)
...@@ -1029,10 +964,9 @@ public: ...@@ -1029,10 +964,9 @@ public:
*/ */
int SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount ); int SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
/**************************************/ /**************************************
/** * Functions related to NetClasses:
* Function relative to NetClasses: **/ **************************************/
/**************************************/
/** /**
* Function SynchronizeNetsAndNetClasses * Function SynchronizeNetsAndNetClasses
...@@ -1065,144 +999,6 @@ public: ...@@ -1065,144 +999,6 @@ public:
*/ */
int GetSmallestClearanceValue(); int GetSmallestClearanceValue();
/**
* Function GetTrackWidthIndex
* @return the current track width list index.
*/
unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
/**
* Function SetTrackWidthIndex
* sets the current track width list index to \a aIndex.
*
* @param aIndex is the track width list index.
*/
void SetTrackWidthIndex( unsigned aIndex );
/**
* Function GetCurrentTrackWidth
* @return the current track width, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentTrackWidth() const
{
if( m_useCustomTrackVia )
return m_customTrackWidth;
else
return m_TrackWidthList[m_trackWidthIndex];
}
/**
* Function SetCustomTrackWidth
* Sets custom width for track (i.e. not available in netclasses or preset list). To have
* it returned with GetCurrentTrackWidth() you need to enable custom track & via sizes
* (UseCustomTrackViaSize()).
* @param aWidth is the new track width.
*/
void SetCustomTrackWidth( int aWidth )
{
m_customTrackWidth = aWidth;
}
/**
* Function GetCustomTrackWidth
* @return Current custom width for a track.
*/
int GetCustomTrackWidth() const
{
return m_customTrackWidth;
}
/**
* Function GetViaSizeIndex
* @return the current via size list index.
*/
unsigned GetViaSizeIndex() const { return m_viaSizeIndex; }
/**
* Function SetViaSizeIndex
* sets the current via size list index to \a aIndex.
*
* @param aIndex is the via size list index.
*/
void SetViaSizeIndex( unsigned aIndex );
/**
* Function GetCurrentViaSize
* @return the current via size, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentViaSize()
{
if( m_useCustomTrackVia )
return m_customViaSize.m_Diameter;
else
return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
}
/**
* Function SetCustomViaSize
* Sets custom size for via diameter (i.e. not available in netclasses or preset list). To have
* it returned with GetCurrentViaSize() you need to enable custom track & via sizes
* (UseCustomTrackViaSize()).
* @param aSize is the new drill diameter.
*/
void SetCustomViaSize( int aSize )
{
m_customViaSize.m_Diameter = aSize;
}
/**
* Function GetCustomViaSize
* @return Current custom size for the via diameter.
*/
int GetCustomViaSize() const
{
return m_customViaSize.m_Diameter;
}
/**
* Function GetCurrentViaDrill
* @return the current via size, according to the selected options
* ( using the default netclass value or a preset/custom value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentViaDrill()
{
int drill;
if( m_useCustomTrackVia )
drill = m_customViaSize.m_Drill;
else
drill = m_ViasDimensionsList[m_viaSizeIndex].m_Drill;
return drill > 0 ? drill : -1;
}
/**
* Function SetCustomViaDrill
* Sets custom size for via drill (i.e. not available in netclasses or preset list). To have
* it returned with GetCurrentViaDrill() you need to enable custom track & via sizes
* (UseCustomTrackViaSize()).
* @param aDrill is the new drill size.
*/
void SetCustomViaDrill( int aDrill )
{
m_customViaSize.m_Drill = aDrill;
}
/**
* Function GetCustomViaDrill
* @return Current custom size for the via drill.
*/
int GetCustomViaDrill() const
{
return m_customViaSize.m_Drill;
}
/** /**
* Function GetCurrentMicroViaSize * Function GetCurrentMicroViaSize
* @return the current micro via size, * @return the current micro via size,
...@@ -1217,27 +1013,6 @@ public: ...@@ -1217,27 +1013,6 @@ public:
*/ */
int GetCurrentMicroViaDrill(); int GetCurrentMicroViaDrill();
/**
* Function UseCustomTrackViaSize
* Enables/disables custom track/via size settings. If enabled, values set with
* SetCustomTrackWidth()/SetCustomViaSize()/SetCustomViaDrill() are used for newly created
* tracks and vias.
* @param aEnabled decides if custom settings should be used for new tracks/vias.
*/
void UseCustomTrackViaSize( bool aEnabled )
{
m_useCustomTrackVia = aEnabled;
}
/**
* Function UseCustomTrackViaSize
* @return True if custom sizes of tracks & vias are enabled, false otherwise.
*/
bool UseCustomTrackViaSize() const
{
return m_useCustomTrackVia;
}
/***************************************************************************/ /***************************************************************************/
wxString GetClass() const wxString GetClass() const
......
...@@ -81,7 +81,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() : ...@@ -81,7 +81,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE, m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE,
DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size
m_TrackMinWidth = DMils2iu( 100 ); // track min value for width ((min copper size value m_TrackMinWidth = DMils2iu( 100 ); // track min value for width (min copper size value)
m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter
m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter
m_MicroViasMinSize = DMils2iu( 200 ); // micro vias (not vias) min diameter m_MicroViasMinSize = DMils2iu( 200 ); // micro vias (not vias) min diameter
...@@ -171,6 +171,37 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult ) ...@@ -171,6 +171,37 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
} }
void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( unsigned aIndex )
{
if( aIndex >= m_ViasDimensionsList.size() )
m_viaSizeIndex = m_ViasDimensionsList.size();
else
m_viaSizeIndex = aIndex;
}
int BOARD_DESIGN_SETTINGS::GetCurrentViaDrill() const
{
int drill;
if( m_useCustomTrackVia )
drill = m_customViaSize.m_Drill;
else
drill = m_ViasDimensionsList[m_viaSizeIndex].m_Drill;
return drill > 0 ? drill : -1;
}
void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
{
if( aIndex >= m_TrackWidthList.size() )
m_trackWidthIndex = m_TrackWidthList.size();
else
m_trackWidthIndex = aIndex;
}
// see pcbstruct.h // see pcbstruct.h
LAYER_MSK BOARD_DESIGN_SETTINGS::GetVisibleLayers() const LAYER_MSK BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
{ {
......
...@@ -276,9 +276,9 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() ...@@ -276,9 +276,9 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
// Initialize Vias and Tracks sizes lists. // Initialize Vias and Tracks sizes lists.
// note we display only extra values, never the current netclass value. // note we display only extra values, never the current netclass value.
// (the first value in history list) // (the first value in history list)
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList; m_TracksWidthList = m_BrdSettings.m_TrackWidthList;
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList; m_ViasDimensionsList = m_BrdSettings.m_ViasDimensionsList;
m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value
InitDimensionsLists(); InitDimensionsLists();
} }
...@@ -634,12 +634,12 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() ...@@ -634,12 +634,12 @@ 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<int>* tlist = &m_BrdSettings.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
// Reinitialize m_ViaSizeList // Reinitialize m_ViaSizeList
std::vector <VIA_DIMENSION>* vialist = &m_Parent->GetBoard()->m_ViasDimensionsList; std::vector<VIA_DIMENSION>* vialist = &m_BrdSettings.m_ViasDimensionsList;
vialist->erase( vialist->begin() + 1, vialist->end() ); vialist->erase( vialist->begin() + 1, vialist->end() );
vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() ); vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
} }
......
...@@ -60,7 +60,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -60,7 +60,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
/* Disable the option "copy current to net" if we have only default netclass values /* Disable the option "copy current to net" if we have only default netclass values
* i.e. when m_TrackWidthSelector and m_ViaSizeSelector are set to 0 * i.e. when m_TrackWidthSelector and m_ViaSizeSelector are set to 0
*/ */
if( !board->GetTrackWidthIndex() && !board->GetViaSizeIndex() ) if( !board->GetDesignSettings().GetTrackWidthIndex() && !board->GetDesignSettings().GetViaSizeIndex() )
{ {
m_Net2CurrValueButton->Enable( false ); m_Net2CurrValueButton->Enable( false );
m_OptionID = ID_NETCLASS_VALUES_TO_CURRENT_NET; m_OptionID = ID_NETCLASS_VALUES_TO_CURRENT_NET;
...@@ -77,9 +77,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -77,9 +77,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
msg = StringFromValue( g_UserUnit, value, true ); msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg );
if( board->GetTrackWidthIndex() ) if( board->GetDesignSettings().GetTrackWidthIndex() )
{ {
value = board->GetCurrentTrackWidth(); value = board->GetDesignSettings().GetCurrentTrackWidth();
msg = StringFromValue( g_UserUnit, value, true ); msg = StringFromValue( g_UserUnit, value, true );
} }
else else
...@@ -91,9 +91,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -91,9 +91,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
msg = StringFromValue( g_UserUnit, value, true ); msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg );
if( board->GetViaSizeIndex() ) if( board->GetDesignSettings().GetViaSizeIndex() )
{ {
value = board->GetCurrentViaSize(); value = board->GetDesignSettings().GetCurrentViaSize();
msg = StringFromValue( g_UserUnit, value, true ); msg = StringFromValue( g_UserUnit, value, true );
} }
else else
...@@ -103,7 +103,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() ...@@ -103,7 +103,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
value = netclass->GetViaDrill(); // Display via drill value = netclass->GetViaDrill(); // Display via drill
msg = StringFromValue( g_UserUnit, value, true ); msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg ); m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg );
value = board->GetCurrentViaDrill(); value = board->GetDesignSettings().GetCurrentViaDrill();
if( value >= 0 ) if( value >= 0 )
msg = StringFromValue( g_UserUnit, value, true ); msg = StringFromValue( g_UserUnit, value, true );
else else
......
...@@ -43,7 +43,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -43,7 +43,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
if( net ) if( net )
new_width = net->GetTrackWidth(); new_width = net->GetTrackWidth();
else else
new_width = GetBoard()->GetCurrentTrackWidth(); new_width = GetDesignSettings().GetCurrentTrackWidth();
if( aTrackItem->Type() == PCB_VIA_T ) if( aTrackItem->Type() == PCB_VIA_T )
{ {
...@@ -58,8 +58,8 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem, ...@@ -58,8 +58,8 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
} }
else else
{ {
new_width = GetBoard()->GetCurrentViaSize(); new_width = GetDesignSettings().GetCurrentViaSize();
new_drill = GetBoard()->GetCurrentViaDrill(); new_drill = GetDesignSettings().GetCurrentViaDrill();
} }
if( via->GetViaType() == VIA_MICROVIA ) if( via->GetViaType() == VIA_MICROVIA )
......
...@@ -98,7 +98,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -98,7 +98,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
VIA* via = new VIA( GetBoard() ); VIA* via = new VIA( GetBoard() );
via->SetFlags( IS_NEW ); via->SetFlags( IS_NEW );
via->SetViaType( GetDesignSettings().m_CurrentViaType ); via->SetViaType( GetDesignSettings().m_CurrentViaType );
via->SetWidth( GetBoard()->GetCurrentViaSize()); via->SetWidth( GetDesignSettings().GetCurrentViaSize());
via->SetNetCode( GetBoard()->GetHighLightNetCode() ); via->SetNetCode( GetBoard()->GetHighLightNetCode() );
via->SetEnd( g_CurrentTrackSegment->GetEnd() ); via->SetEnd( g_CurrentTrackSegment->GetEnd() );
via->SetStart( g_CurrentTrackSegment->GetEnd() ); via->SetStart( g_CurrentTrackSegment->GetEnd() );
...@@ -106,7 +106,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC ) ...@@ -106,7 +106,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
// Usual via is from copper to component. // Usual via is from copper to component.
// layer pair is LAYER_N_BACK and LAYER_N_FRONT. // layer pair is LAYER_N_BACK and LAYER_N_FRONT.
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT ); via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
via->SetDrill( GetBoard()->GetCurrentViaDrill() ); via->SetDrill( GetDesignSettings().GetCurrentViaDrill() );
LAYER_NUM first_layer = GetActiveLayer(); LAYER_NUM first_layer = GetActiveLayer();
LAYER_NUM last_layer; LAYER_NUM last_layer;
......
...@@ -170,9 +170,9 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -170,9 +170,9 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() ); GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->SetWidth( GetBoard()->GetCurrentTrackWidth() ); g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
if( GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth ) if( GetDesignSettings().m_UseConnectedTrackWidth )
{ {
if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T ) if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T )
g_CurrentTrackSegment->SetWidth( TrackOnStartPoint->GetWidth()); g_CurrentTrackSegment->SetWidth( TrackOnStartPoint->GetWidth());
...@@ -282,8 +282,8 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC ) ...@@ -282,8 +282,8 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
newTrack->SetLayer( GetScreen()->m_Active_Layer ); newTrack->SetLayer( GetScreen()->m_Active_Layer );
if( !GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth ) if( !GetDesignSettings().m_UseConnectedTrackWidth )
newTrack->SetWidth( GetBoard()->GetCurrentTrackWidth() ); newTrack->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
DBG( g_CurrentTrackList.VerifyListIntegrity(); ); DBG( g_CurrentTrackList.VerifyListIntegrity(); );
...@@ -691,7 +691,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -691,7 +691,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS; DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
// Values to Via circle // Values to Via circle
int boardViaRadius = frame->GetBoard()->GetCurrentViaSize()/2; int boardViaRadius = frame->GetDesignSettings().GetCurrentViaSize()/2;
int viaRadiusWithClearence = boardViaRadius+netclass->GetClearance(); int viaRadiusWithClearence = boardViaRadius+netclass->GetClearance();
EDA_RECT* panelClipBox=aPanel->GetClipBox(); EDA_RECT* panelClipBox=aPanel->GetClipBox();
...@@ -718,8 +718,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -718,8 +718,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
// Set track parameters, that can be modified while creating the track // Set track parameters, that can be modified while creating the track
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer ); g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth ) if( !frame->GetDesignSettings().m_UseConnectedTrackWidth )
g_CurrentTrackSegment->SetWidth( frame->GetBoard()->GetCurrentTrackWidth() ); g_CurrentTrackSegment->SetWidth( frame->GetDesignSettings().GetCurrentTrackWidth() );
if( g_TwoSegmentTrackBuild ) if( g_TwoSegmentTrackBuild )
{ {
...@@ -729,8 +729,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo ...@@ -729,8 +729,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
{ {
previous_track->SetLayer( screen->m_Active_Layer ); previous_track->SetLayer( screen->m_Active_Layer );
if( !frame->GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth ) if( !frame->GetDesignSettings().m_UseConnectedTrackWidth )
previous_track->SetWidth( frame->GetBoard()->GetCurrentTrackWidth() ); previous_track->SetWidth( frame->GetDesignSettings().GetCurrentTrackWidth() );
} }
} }
......
...@@ -41,8 +41,8 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -41,8 +41,8 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES: case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetDesignSettings().m_UseConnectedTrackWidth = false; GetDesignSettings().m_UseConnectedTrackWidth = false;
GetBoard()->SetTrackWidthIndex( 0 ); GetDesignSettings().SetTrackWidthIndex( 0 );
GetBoard()->SetViaSizeIndex( 0 ); GetDesignSettings().SetViaSizeIndex( 0 );
break; break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH: case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
...@@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
GetDesignSettings().m_UseConnectedTrackWidth = false; GetDesignSettings().m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1; ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->SetTrackWidthIndex( ii ); GetDesignSettings().SetTrackWidthIndex( ii );
break; break;
case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
...@@ -91,17 +91,17 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event ) ...@@ -91,17 +91,17 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
// select the new current value for via size (via diameter) // select the new current value for via size (via diameter)
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1; ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->SetViaSizeIndex( ii ); GetDesignSettings().SetViaSizeIndex( ii );
break; break;
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH: case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
ii = m_SelTrackWidthBox->GetCurrentSelection(); ii = m_SelTrackWidthBox->GetCurrentSelection();
GetBoard()->SetTrackWidthIndex( ii ); GetDesignSettings().SetTrackWidthIndex( ii );
break; break;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE: case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
ii = m_SelViaSizeBox->GetCurrentSelection(); ii = m_SelViaSizeBox->GetCurrentSelection();
GetBoard()->SetViaSizeIndex( ii ); GetDesignSettings().SetViaSizeIndex( ii );
break; break;
default: default:
......
...@@ -199,10 +199,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -199,10 +199,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( GetCanvas()->IsMouseCaptured() ) if( GetCanvas()->IsMouseCaptured() )
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
if( GetBoard()->GetTrackWidthIndex() < GetBoard()->m_TrackWidthList.size() - 1 ) if( GetDesignSettings().GetTrackWidthIndex() < GetDesignSettings().m_TrackWidthList.size() - 1 )
GetBoard()->SetTrackWidthIndex( GetBoard()->GetTrackWidthIndex() + 1 ); GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().GetTrackWidthIndex() + 1 );
else else
GetBoard()->SetTrackWidthIndex( 0 ); GetDesignSettings().SetTrackWidthIndex( 0 );
if( GetCanvas()->IsMouseCaptured() ) if( GetCanvas()->IsMouseCaptured() )
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
...@@ -213,10 +213,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -213,10 +213,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( GetCanvas()->IsMouseCaptured() ) if( GetCanvas()->IsMouseCaptured() )
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
if( GetBoard()->GetTrackWidthIndex() <= 0 ) if( GetDesignSettings().GetTrackWidthIndex() <= 0 )
GetBoard()->SetTrackWidthIndex( GetBoard()->m_TrackWidthList.size() -1 ); GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().m_TrackWidthList.size() -1 );
else else
GetBoard()->SetTrackWidthIndex( GetBoard()->GetTrackWidthIndex() - 1 ); GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().GetTrackWidthIndex() - 1 );
if( GetCanvas()->IsMouseCaptured() ) if( GetCanvas()->IsMouseCaptured() )
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false ); GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
......
...@@ -551,12 +551,12 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const ...@@ -551,12 +551,12 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
// Save current default track width, for compatibility with older Pcbnew version; // Save current default track width, for compatibility with older Pcbnew version;
m_out->Print( aNestLevel+1, "(last_trace_width %s)\n", m_out->Print( aNestLevel+1, "(last_trace_width %s)\n",
FMTIU( aBoard->GetCurrentTrackWidth() ).c_str() ); FMTIU( aBoard->GetDesignSettings().GetCurrentTrackWidth() ).c_str() );
// 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->GetDesignSettings().m_TrackWidthList.size(); ii++ )
m_out->Print( aNestLevel+1, "(user_trace_width %s)\n", m_out->Print( aNestLevel+1, "(user_trace_width %s)\n",
FMTIU( aBoard->m_TrackWidthList[ii] ).c_str() ); FMTIU( aBoard->GetDesignSettings().m_TrackWidthList[ii] ).c_str() );
m_out->Print( aNestLevel+1, "(trace_clearance %s)\n", m_out->Print( aNestLevel+1, "(trace_clearance %s)\n",
FMTIU( aBoard->m_NetClasses.GetDefault()->GetClearance() ).c_str() ); FMTIU( aBoard->m_NetClasses.GetDefault()->GetClearance() ).c_str() );
...@@ -587,10 +587,10 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const ...@@ -587,10 +587,10 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
// 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->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
m_out->Print( aNestLevel+1, "(user_via %s %s)\n", m_out->Print( aNestLevel+1, "(user_via %s %s)\n",
FMTIU( aBoard->m_ViasDimensionsList[ii].m_Diameter ).c_str(), FMTIU( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter ).c_str(),
FMTIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() ); FMTIU( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill ).c_str() );
// for old versions compatibility: // for old versions compatibility:
if( aBoard->GetDesignSettings().m_BlindBuriedViaAllowed ) if( aBoard->GetDesignSettings().m_BlindBuriedViaAllowed )
......
...@@ -633,6 +633,8 @@ void LEGACY_PLUGIN::loadSHEET() ...@@ -633,6 +633,8 @@ void LEGACY_PLUGIN::loadSHEET()
void LEGACY_PLUGIN::loadSETUP() void LEGACY_PLUGIN::loadSETUP()
{ {
NETCLASS* netclass_default = m_board->m_NetClasses.GetDefault(); NETCLASS* netclass_default = m_board->m_NetClasses.GetDefault();
// TODO Orson: is it really necessary to first operate on a copy and then apply it?
// would not it be better to use reference here and apply all the changes instantly?
BOARD_DESIGN_SETTINGS bds = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS bds = m_board->GetDesignSettings();
ZONE_SETTINGS zs = m_board->GetZoneSettings(); ZONE_SETTINGS zs = m_board->GetZoneSettings();
char* line; char* line;
...@@ -692,7 +694,7 @@ void LEGACY_PLUGIN::loadSETUP() ...@@ -692,7 +694,7 @@ void LEGACY_PLUGIN::loadSETUP()
else if( TESTLINE( "TrackWidthList" ) ) else if( TESTLINE( "TrackWidthList" ) )
{ {
BIU tmp = biuParse( line + SZ( "TrackWidthList" ) ); BIU tmp = biuParse( line + SZ( "TrackWidthList" ) );
m_board->m_TrackWidthList.push_back( tmp ); bds.m_TrackWidthList.push_back( tmp );
} }
else if( TESTLINE( "TrackClearence" ) ) else if( TESTLINE( "TrackClearence" ) )
...@@ -754,7 +756,8 @@ void LEGACY_PLUGIN::loadSETUP() ...@@ -754,7 +756,8 @@ void LEGACY_PLUGIN::loadSETUP()
if( data ) // DRILL may not be present ? if( data ) // DRILL may not be present ?
drill = biuParse( data ); drill = biuParse( data );
m_board->m_ViasDimensionsList.push_back( VIA_DIMENSION( diameter, drill ) ); bds.m_ViasDimensionsList.push_back( VIA_DIMENSION( diameter,
drill ) );
} }
else if( TESTLINE( "ViaDrill" ) ) else if( TESTLINE( "ViaDrill" ) )
...@@ -907,23 +910,24 @@ void LEGACY_PLUGIN::loadSETUP() ...@@ -907,23 +910,24 @@ void LEGACY_PLUGIN::loadSETUP()
* Sort lists by by increasing value and remove duplicates * Sort lists by by increasing value and remove duplicates
* (the first value is not tested, because it is the netclass value * (the first value is not tested, because it is the netclass value
*/ */
sort( m_board->m_ViasDimensionsList.begin() + 1, m_board->m_ViasDimensionsList.end() ); BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
sort( m_board->m_TrackWidthList.begin() + 1, m_board->m_TrackWidthList.end() ); sort( designSettings.m_ViasDimensionsList.begin() + 1, designSettings.m_ViasDimensionsList.end() );
sort( designSettings.m_TrackWidthList.begin() + 1, designSettings.m_TrackWidthList.end() );
for( unsigned ii = 1; ii < m_board->m_ViasDimensionsList.size() - 1; ii++ ) for( unsigned ii = 1; ii < designSettings.m_ViasDimensionsList.size() - 1; ii++ )
{ {
if( m_board->m_ViasDimensionsList[ii] == m_board->m_ViasDimensionsList[ii + 1] ) if( designSettings.m_ViasDimensionsList[ii] == designSettings.m_ViasDimensionsList[ii + 1] )
{ {
m_board->m_ViasDimensionsList.erase( m_board->m_ViasDimensionsList.begin() + ii ); designSettings.m_ViasDimensionsList.erase( designSettings.m_ViasDimensionsList.begin() + ii );
ii--; ii--;
} }
} }
for( unsigned ii = 1; ii < m_board->m_TrackWidthList.size() - 1; ii++ ) for( unsigned ii = 1; ii < designSettings.m_TrackWidthList.size() - 1; ii++ )
{ {
if( m_board->m_TrackWidthList[ii] == m_board->m_TrackWidthList[ii + 1] ) if( designSettings.m_TrackWidthList[ii] == designSettings.m_TrackWidthList[ii + 1] )
{ {
m_board->m_TrackWidthList.erase( m_board->m_TrackWidthList.begin() + ii ); designSettings.m_TrackWidthList.erase( designSettings.m_TrackWidthList.begin() + ii );
ii--; ii--;
} }
} }
...@@ -3005,11 +3009,12 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const ...@@ -3005,11 +3009,12 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
} }
// Save current default track width, for compatibility with older Pcbnew version; // Save current default track width, for compatibility with older Pcbnew version;
fprintf( m_fp, "TrackWidth %s\n", fmtBIU( aBoard->GetCurrentTrackWidth() ).c_str() ); fprintf( m_fp, "TrackWidth %s\n",
fmtBIU( aBoard->GetDesignSettings().GetCurrentTrackWidth() ).c_str() );
// 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->GetDesignSettings().m_TrackWidthList.size(); ii++ )
fprintf( m_fp, "TrackWidthList %s\n", fmtBIU( aBoard->m_TrackWidthList[ii] ).c_str() ); fprintf( m_fp, "TrackWidthList %s\n", fmtBIU( aBoard->GetDesignSettings().m_TrackWidthList[ii] ).c_str() );
fprintf( m_fp, "TrackClearence %s\n", fmtBIU( netclass_default->GetClearance() ).c_str() ); fprintf( m_fp, "TrackClearence %s\n", fmtBIU( netclass_default->GetClearance() ).c_str() );
...@@ -3030,10 +3035,10 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const ...@@ -3030,10 +3035,10 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
// 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->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
fprintf( m_fp, "ViaSizeList %s %s\n", fprintf( m_fp, "ViaSizeList %s %s\n",
fmtBIU( aBoard->m_ViasDimensionsList[ii].m_Diameter ).c_str(), fmtBIU( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter ).c_str(),
fmtBIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() ); fmtBIU( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill ).c_str() );
// for old versions compatibility: // for old versions compatibility:
fprintf( m_fp, "MicroViaSize %s\n", fmtBIU( netclass_default->GetuViaDiameter() ).c_str() ); fprintf( m_fp, "MicroViaSize %s\n", fmtBIU( netclass_default->GetuViaDiameter() ).c_str() );
......
...@@ -215,7 +215,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC ) ...@@ -215,7 +215,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
} }
// Calculate the elements. // Calculate the elements.
Mself.m_Width = GetBoard()->GetCurrentTrackWidth(); Mself.m_Width = GetDesignSettings().GetCurrentTrackWidth();
std::vector <wxPoint> buffer; std::vector <wxPoint> buffer;
ll = BuildCornersList_S_Shape( buffer, Mself.m_Start, Mself.m_End, Mself.lng, Mself.m_Width ); ll = BuildCornersList_S_Shape( buffer, Mself.m_Start, Mself.m_End, Mself.lng, Mself.m_Width );
...@@ -561,7 +561,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c ...@@ -561,7 +561,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
module->Pads().PushFront( pad ); module->Pads().PushFront( pad );
int tw = GetBoard()->GetCurrentTrackWidth(); int tw = GetDesignSettings().GetCurrentTrackWidth();
pad->SetSize( wxSize( tw, tw ) ); pad->SetSize( wxSize( tw, tw ) );
pad->SetPosition( module->GetPosition() ); pad->SetPosition( module->GetPosition() );
...@@ -588,7 +588,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type ) ...@@ -588,7 +588,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
int angle = 0; int angle = 0;
// Enter the size of the gap or stub // Enter the size of the gap or stub
int gap_size = GetBoard()->GetCurrentTrackWidth(); int gap_size = GetDesignSettings().GetCurrentTrackWidth();
switch( shape_type ) switch( shape_type )
{ {
...@@ -1104,7 +1104,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule ) ...@@ -1104,7 +1104,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
gap_size = ValueFromString( g_UserUnit, msg ); gap_size = ValueFromString( g_UserUnit, msg );
// Updating sizes of pads forming the gap. // Updating sizes of pads forming the gap.
int tw = GetBoard()->GetCurrentTrackWidth(); int tw = GetDesignSettings().GetCurrentTrackWidth();
pad->SetSize( wxSize( tw, tw ) ); pad->SetSize( wxSize( tw, tw ) );
pad->SetY0( 0 ); pad->SetY0( 0 );
...@@ -1118,7 +1118,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule ) ...@@ -1118,7 +1118,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
pad->SetPosition( padpos ); pad->SetPosition( padpos );
tw = GetBoard()->GetCurrentTrackWidth(); tw = GetDesignSettings().GetCurrentTrackWidth();
next_pad->SetSize( wxSize( tw, tw ) ); next_pad->SetSize( wxSize( tw, tw ) );
next_pad->SetY0( 0 ); next_pad->SetY0( 0 );
......
...@@ -532,7 +532,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) ...@@ -532,7 +532,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
AddMenuItem( PopMenu, ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA, AddMenuItem( PopMenu, ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA,
msg, KiBitmap( select_w_layer_xpm ) ); msg, KiBitmap( select_w_layer_xpm ) );
if( GetBoard()->GetDesignSettings().m_BlindBuriedViaAllowed ) if( GetDesignSettings().m_BlindBuriedViaAllowed )
{ {
msg = AddHotkeyName( _( "Place Blind/Buried Via" ), msg = AddHotkeyName( _( "Place Blind/Buried Via" ),
g_Board_Editor_Hokeys_Descr, HK_ADD_BLIND_BURIED_VIA ); g_Board_Editor_Hokeys_Descr, HK_ADD_BLIND_BURIED_VIA );
...@@ -957,17 +957,17 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -957,17 +957,17 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
if( aBoard->GetDesignSettings().m_UseConnectedTrackWidth ) if( aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true ); trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
if( aBoard->GetViaSizeIndex() != 0 if( aBoard->GetDesignSettings().GetViaSizeIndex() != 0
|| aBoard->GetTrackWidthIndex() != 0 || aBoard->GetDesignSettings().GetTrackWidthIndex() != 0
|| aBoard->GetDesignSettings().m_UseConnectedTrackWidth ) || aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
_( "Use Netclass Values" ), _( "Use Netclass Values" ),
_( "Use track and via sizes from their Netclass values" ), _( "Use track and via sizes from their Netclass values" ),
true ); true );
for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ ) for( unsigned ii = 0; ii < aBoard->GetDesignSettings().m_TrackWidthList.size(); ii++ )
{ {
value = StringFromValue( g_UserUnit, aBoard->m_TrackWidthList[ii], true ); value = StringFromValue( g_UserUnit, aBoard->GetDesignSettings().m_TrackWidthList[ii], true );
msg.Printf( _( "Track %s" ), GetChars( value ) ); msg.Printf( _( "Track %s" ), GetChars( value ) );
if( ii == 0 ) if( ii == 0 )
...@@ -978,15 +978,16 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard ) ...@@ -978,15 +978,16 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
trackwidth_menu->AppendSeparator(); trackwidth_menu->AppendSeparator();
for( unsigned ii = 0; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 0; ii < aBoard->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
{ {
value = StringFromValue( g_UserUnit, aBoard->m_ViasDimensionsList[ii].m_Diameter, value = StringFromValue( g_UserUnit,
aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter,
true ); true );
wxString drill = StringFromValue( g_UserUnit, wxString drill = StringFromValue( g_UserUnit,
aBoard->m_ViasDimensionsList[ii].m_Drill, aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill,
true ); true );
if( aBoard->m_ViasDimensionsList[ii].m_Drill <= 0 ) if( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill <= 0 )
{ {
msg.Printf( _( "Via %s" ), GetChars( value ) ); msg.Printf( _( "Via %s" ), GetChars( value ) );
} }
......
...@@ -809,6 +809,8 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) ...@@ -809,6 +809,8 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
T token; T token;
NETCLASS* defaultNetclass = m_board->m_NetClasses.GetDefault(); NETCLASS* defaultNetclass = m_board->m_NetClasses.GetDefault();
// TODO Orson: is it really necessary to first operate on a copy and then apply it?
// would not it be better to use reference here and apply all the changes instantly?
BOARD_DESIGN_SETTINGS designSettings = m_board->GetDesignSettings(); BOARD_DESIGN_SETTINGS designSettings = m_board->GetDesignSettings();
ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings(); ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings();
...@@ -827,7 +829,7 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) ...@@ -827,7 +829,7 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
break; break;
case T_user_trace_width: case T_user_trace_width:
m_board->m_TrackWidthList.push_back( parseBoardUnits( T_user_trace_width ) ); designSettings.m_TrackWidthList.push_back( parseBoardUnits( T_user_trace_width ) );
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -885,7 +887,7 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR ) ...@@ -885,7 +887,7 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
{ {
int viaSize = parseBoardUnits( "user via size" ); int viaSize = parseBoardUnits( "user via size" );
int viaDrill = parseBoardUnits( "user via drill" ); int viaDrill = parseBoardUnits( "user via drill" );
m_board->m_ViasDimensionsList.push_back( VIA_DIMENSION( viaSize, viaDrill ) ); designSettings.m_ViasDimensionsList.push_back( VIA_DIMENSION( viaSize, viaDrill ) );
NeedRIGHT(); NeedRIGHT();
} }
break; break;
......
...@@ -620,9 +620,9 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox() ...@@ -620,9 +620,9 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
m_SelTrackWidthBox->Clear(); m_SelTrackWidthBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthList.size(); ii++ ) for( unsigned ii = 0; ii < GetDesignSettings().m_TrackWidthList.size(); ii++ )
{ {
msg = _( "Track " ) + CoordinateToString( GetBoard()->m_TrackWidthList[ii], true ); msg = _( "Track " ) + CoordinateToString( GetDesignSettings().m_TrackWidthList[ii], true );
if( ii == 0 ) if( ii == 0 )
msg << _( " *" ); msg << _( " *" );
...@@ -630,10 +630,10 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox() ...@@ -630,10 +630,10 @@ void PCB_EDIT_FRAME::updateTraceWidthSelectBox()
m_SelTrackWidthBox->Append( msg ); m_SelTrackWidthBox->Append( msg );
} }
if( GetBoard()->GetTrackWidthIndex() >= GetBoard()->m_TrackWidthList.size() ) if( GetDesignSettings().GetTrackWidthIndex() >= GetDesignSettings().m_TrackWidthList.size() )
GetBoard()->SetTrackWidthIndex( 0 ); GetDesignSettings().SetTrackWidthIndex( 0 );
m_SelTrackWidthBox->SetSelection( GetBoard()->GetTrackWidthIndex() ); m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
} }
...@@ -646,14 +646,14 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() ...@@ -646,14 +646,14 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
m_SelViaSizeBox->Clear(); m_SelViaSizeBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 0; ii < GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
{ {
msg = _( "Via " ); msg = _( "Via " );
msg << CoordinateToString( GetBoard()->m_ViasDimensionsList[ii].m_Diameter, true ); msg << CoordinateToString( GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter, true );
if( GetBoard()->m_ViasDimensionsList[ii].m_Drill ) if( GetDesignSettings().m_ViasDimensionsList[ii].m_Drill )
msg << wxT("/ ") msg << wxT("/ ")
<< CoordinateToString( GetBoard()->m_ViasDimensionsList[ii].m_Drill, true ); << CoordinateToString( GetDesignSettings().m_ViasDimensionsList[ii].m_Drill, true );
if( ii == 0 ) if( ii == 0 )
msg << _( " *" ); msg << _( " *" );
...@@ -661,10 +661,10 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() ...@@ -661,10 +661,10 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
m_SelViaSizeBox->Append( msg ); m_SelViaSizeBox->Append( msg );
} }
if( GetBoard()->GetViaSizeIndex() >= GetBoard()->m_ViasDimensionsList.size() ) if( GetDesignSettings().GetViaSizeIndex() >= GetDesignSettings().m_ViasDimensionsList.size() )
GetBoard()->SetViaSizeIndex( 0 ); GetDesignSettings().SetViaSizeIndex( 0 );
m_SelViaSizeBox->SetSelection( GetBoard()->GetViaSizeIndex() ); m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
} }
......
...@@ -55,15 +55,15 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) ...@@ -55,15 +55,15 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
{ {
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH ) if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_TRACK_WIDTH )
{ {
if( m_SelTrackWidthBox->GetSelection() != (int) GetBoard()->GetTrackWidthIndex() ) if( m_SelTrackWidthBox->GetSelection() != (int) GetDesignSettings().GetTrackWidthIndex() )
m_SelTrackWidthBox->SetSelection( GetBoard()->GetTrackWidthIndex() ); m_SelTrackWidthBox->SetSelection( GetDesignSettings().GetTrackWidthIndex() );
} }
else else
{ {
bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 + bool check = ( ( ( ID_POPUP_PCB_SELECT_WIDTH1 +
(int) GetBoard()->GetTrackWidthIndex() ) == aEvent.GetId() ) && (int) GetDesignSettings().GetTrackWidthIndex() ) == aEvent.GetId() ) &&
!GetDesignSettings().m_UseConnectedTrackWidth && !GetDesignSettings().m_UseConnectedTrackWidth &&
!GetBoard()->UseCustomTrackViaSize() ); !GetDesignSettings().UseCustomTrackViaSize() );
aEvent.Check( check ); aEvent.Check( check );
} }
...@@ -73,13 +73,13 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ) ...@@ -73,13 +73,13 @@ void PCB_EDIT_FRAME::OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( GetDesignSettings().m_UseConnectedTrackWidth && aEvent.Check( GetDesignSettings().m_UseConnectedTrackWidth &&
!GetBoard()->UseCustomTrackViaSize() ); !GetDesignSettings().UseCustomTrackViaSize() );
} }
void PCB_EDIT_FRAME::OnUpdateSelectCustomTrackWidth( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateSelectCustomTrackWidth( wxUpdateUIEvent& aEvent )
{ {
aEvent.Check( GetBoard()->UseCustomTrackViaSize() ); aEvent.Check( GetDesignSettings().UseCustomTrackViaSize() );
} }
...@@ -89,15 +89,15 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent ) ...@@ -89,15 +89,15 @@ void PCB_EDIT_FRAME::OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent )
if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE ) if( aEvent.GetId() == ID_AUX_TOOLBAR_PCB_VIA_SIZE )
{ {
if( m_SelViaSizeBox->GetSelection() != (int) GetBoard()->GetViaSizeIndex() ) if( m_SelViaSizeBox->GetSelection() != (int) GetDesignSettings().GetViaSizeIndex() )
m_SelViaSizeBox->SetSelection( GetBoard()->GetViaSizeIndex() ); m_SelViaSizeBox->SetSelection( GetDesignSettings().GetViaSizeIndex() );
} }
else else
{ {
bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 + bool check = ( ( ( ID_POPUP_PCB_SELECT_VIASIZE1 +
(int) GetBoard()->GetViaSizeIndex() ) == aEvent.GetId() ) && (int) GetDesignSettings().GetViaSizeIndex() ) == aEvent.GetId() ) &&
!GetDesignSettings().m_UseConnectedTrackWidth && !GetDesignSettings().m_UseConnectedTrackWidth &&
!GetBoard()->UseCustomTrackViaSize() ); !GetDesignSettings().UseCustomTrackViaSize() );
aEvent.Check( check ); aEvent.Check( check );
} }
......
...@@ -416,13 +416,13 @@ int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent ) ...@@ -416,13 +416,13 @@ int PCBNEW_CONTROL::GridPrev( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
{ {
BOARD* board = getModel<BOARD>( PCB_T ); BOARD* board = getModel<BOARD>( PCB_T );
int widthIndex = board->GetTrackWidthIndex() + 1; int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() + 1;
if( widthIndex >= (int) board->m_TrackWidthList.size() ) if( widthIndex >= (int) board->GetDesignSettings().m_TrackWidthList.size() )
widthIndex = board->m_TrackWidthList.size() - 1; widthIndex = board->GetDesignSettings().m_TrackWidthList.size() - 1;
board->SetTrackWidthIndex( widthIndex ); board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
board->UseCustomTrackViaSize( false ); board->GetDesignSettings().UseCustomTrackViaSize( false );
wxUpdateUIEvent dummy; wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy ); getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy );
...@@ -437,13 +437,13 @@ int PCBNEW_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent ) ...@@ -437,13 +437,13 @@ int PCBNEW_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
{ {
BOARD* board = getModel<BOARD>( PCB_T ); BOARD* board = getModel<BOARD>( PCB_T );
int widthIndex = board->GetTrackWidthIndex() - 1; int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() - 1;
if( widthIndex < 0 ) if( widthIndex < 0 )
widthIndex = 0; widthIndex = 0;
board->SetTrackWidthIndex( widthIndex ); board->GetDesignSettings().SetTrackWidthIndex( widthIndex );
board->UseCustomTrackViaSize( false ); board->GetDesignSettings().UseCustomTrackViaSize( false );
wxUpdateUIEvent dummy; wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy ); getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectTrackWidth( dummy );
...@@ -458,13 +458,13 @@ int PCBNEW_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent ) ...@@ -458,13 +458,13 @@ int PCBNEW_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
{ {
BOARD* board = getModel<BOARD>( PCB_T ); BOARD* board = getModel<BOARD>( PCB_T );
int sizeIndex = board->GetViaSizeIndex() + 1; int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() + 1;
if( sizeIndex >= (int) board->m_ViasDimensionsList.size() ) if( sizeIndex >= (int) board->GetDesignSettings().m_ViasDimensionsList.size() )
sizeIndex = board->m_ViasDimensionsList.size() - 1; sizeIndex = board->GetDesignSettings().m_ViasDimensionsList.size() - 1;
board->SetViaSizeIndex( sizeIndex ); board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
board->UseCustomTrackViaSize( false ); board->GetDesignSettings().UseCustomTrackViaSize( false );
wxUpdateUIEvent dummy; wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy ); getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy );
...@@ -479,13 +479,13 @@ int PCBNEW_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent ) ...@@ -479,13 +479,13 @@ int PCBNEW_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
int PCBNEW_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent ) int PCBNEW_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
{ {
BOARD* board = getModel<BOARD>( PCB_T ); BOARD* board = getModel<BOARD>( PCB_T );
int sizeIndex = board->GetViaSizeIndex() - 1; int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() - 1;
if( sizeIndex < 0 ) if( sizeIndex < 0 )
sizeIndex = 0; sizeIndex = 0;
board->SetViaSizeIndex( sizeIndex ); board->GetDesignSettings().SetViaSizeIndex( sizeIndex );
board->UseCustomTrackViaSize( false ); board->GetDesignSettings().UseCustomTrackViaSize( false );
wxUpdateUIEvent dummy; wxUpdateUIEvent dummy;
getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy ); getEditFrame<PCB_EDIT_FRAME>()->OnUpdateSelectViaSize( dummy );
......
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