Loading pcbnew/class_board.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,12 @@ BOARD::BOARD() : SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() ); SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() ); // Set sensible initial values for custom track width & via size m_useCustomTrackVia = false; m_customTrackWidth = GetCurrentTrackWidth(); m_customViaSize.m_Diameter = GetCurrentViaSize(); m_customViaSize.m_Drill = GetCurrentViaDrill(); // Initialize ratsnest // Initialize ratsnest m_ratsnest = new RN_DATA( this ); m_ratsnest = new RN_DATA( this ); m_ratsnestViewItem = new KIGFX::RATSNEST_VIEWITEM( m_ratsnest ); m_ratsnestViewItem = new KIGFX::RATSNEST_VIEWITEM( m_ratsnest ); Loading pcbnew/class_board.h +115 −10 Original line number Original line Diff line number Diff line Loading @@ -258,6 +258,15 @@ private: // Index for m_TrackWidthList to select the value. // Index for m_TrackWidthList to select the value. unsigned m_trackWidthIndex; 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 Loading Loading @@ -303,15 +312,14 @@ public: // the first value is always the value of the current NetClass // the first value is always the value of the current NetClass // The others values are extra values // The others values are extra values // The first value is the current netclass via size // TODO verify // The first value is the current netclass via size /// Vias size and drill list /// Vias size and drill list std::vector<VIA_DIMENSION> m_ViasDimensionsList; std::vector<VIA_DIMENSION> m_ViasDimensionsList; // The first value is the current netclass track width // TODO verify // The first value is the current netclass track width /// Track width list /// Track width list std::vector<int> m_TrackWidthList; std::vector<int> m_TrackWidthList; BOARD(); BOARD(); ~BOARD(); ~BOARD(); Loading Loading @@ -1074,14 +1082,38 @@ public: /** /** * Function GetCurrentTrackWidth * Function GetCurrentTrackWidth * @return the current track width, according to the selected options * @return the current track width, according to the selected options * ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0] */ */ int GetCurrentTrackWidth() const int GetCurrentTrackWidth() const { { if( m_useCustomTrackVia ) return m_customTrackWidth; else return m_TrackWidthList[m_trackWidthIndex]; 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 * Function GetViaSizeIndex * @return the current via size list index. * @return the current via size list index. Loading @@ -1099,24 +1131,76 @@ public: /** /** * Function GetCurrentViaSize * Function GetCurrentViaSize * @return the current via size, according to the selected options * @return the current via size, according to the selected options * ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0] */ */ int GetCurrentViaSize() int GetCurrentViaSize() { { if( m_useCustomTrackVia ) return m_customViaSize.m_Diameter; else return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter; 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 * Function GetCurrentViaDrill * @return the current via size, according to the selected options * @return the current via size, according to the selected options * ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0] */ */ int GetCurrentViaDrill() int GetCurrentViaDrill() { { return m_ViasDimensionsList[m_viaSizeIndex].m_Drill > 0 ? int drill; m_ViasDimensionsList[m_viaSizeIndex].m_Drill : -1; 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; } } /** /** Loading @@ -1133,6 +1217,27 @@ 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 Loading Loading
pcbnew/class_board.cpp +6 −0 Original line number Original line Diff line number Diff line Loading @@ -106,6 +106,12 @@ BOARD::BOARD() : SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() ); SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() ); // Set sensible initial values for custom track width & via size m_useCustomTrackVia = false; m_customTrackWidth = GetCurrentTrackWidth(); m_customViaSize.m_Diameter = GetCurrentViaSize(); m_customViaSize.m_Drill = GetCurrentViaDrill(); // Initialize ratsnest // Initialize ratsnest m_ratsnest = new RN_DATA( this ); m_ratsnest = new RN_DATA( this ); m_ratsnestViewItem = new KIGFX::RATSNEST_VIEWITEM( m_ratsnest ); m_ratsnestViewItem = new KIGFX::RATSNEST_VIEWITEM( m_ratsnest ); Loading
pcbnew/class_board.h +115 −10 Original line number Original line Diff line number Diff line Loading @@ -258,6 +258,15 @@ private: // Index for m_TrackWidthList to select the value. // Index for m_TrackWidthList to select the value. unsigned m_trackWidthIndex; 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 Loading Loading @@ -303,15 +312,14 @@ public: // the first value is always the value of the current NetClass // the first value is always the value of the current NetClass // The others values are extra values // The others values are extra values // The first value is the current netclass via size // TODO verify // The first value is the current netclass via size /// Vias size and drill list /// Vias size and drill list std::vector<VIA_DIMENSION> m_ViasDimensionsList; std::vector<VIA_DIMENSION> m_ViasDimensionsList; // The first value is the current netclass track width // TODO verify // The first value is the current netclass track width /// Track width list /// Track width list std::vector<int> m_TrackWidthList; std::vector<int> m_TrackWidthList; BOARD(); BOARD(); ~BOARD(); ~BOARD(); Loading Loading @@ -1074,14 +1082,38 @@ public: /** /** * Function GetCurrentTrackWidth * Function GetCurrentTrackWidth * @return the current track width, according to the selected options * @return the current track width, according to the selected options * ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0] */ */ int GetCurrentTrackWidth() const int GetCurrentTrackWidth() const { { if( m_useCustomTrackVia ) return m_customTrackWidth; else return m_TrackWidthList[m_trackWidthIndex]; 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 * Function GetViaSizeIndex * @return the current via size list index. * @return the current via size list index. Loading @@ -1099,24 +1131,76 @@ public: /** /** * Function GetCurrentViaSize * Function GetCurrentViaSize * @return the current via size, according to the selected options * @return the current via size, according to the selected options * ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0] */ */ int GetCurrentViaSize() int GetCurrentViaSize() { { if( m_useCustomTrackVia ) return m_customViaSize.m_Diameter; else return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter; 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 * Function GetCurrentViaDrill * @return the current via size, according to the selected options * @return the current via size, according to the selected options * ( using the default netclass value or a preset value ) * ( using the default netclass value or a preset/custom value ) * the default netclass is always in m_TrackWidthList[0] * the default netclass is always in m_TrackWidthList[0] */ */ int GetCurrentViaDrill() int GetCurrentViaDrill() { { return m_ViasDimensionsList[m_viaSizeIndex].m_Drill > 0 ? int drill; m_ViasDimensionsList[m_viaSizeIndex].m_Drill : -1; 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; } } /** /** Loading @@ -1133,6 +1217,27 @@ 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 Loading