Commit 4fb9bce3 authored by Maciej Suminski's avatar Maciej Suminski

Code formatting.

parent 112adccb
......@@ -35,7 +35,7 @@ bool SEG::PointCloserThan( const VECTOR2I& aP, int aDist ) const
{
VECTOR2I d = B - A;
ecoord dist_sq = (ecoord) aDist * aDist;
ecoord dist_sq_thr = (ecoord) (aDist + 1) * (aDist + 1);
ecoord dist_sq_thr = (ecoord) ( aDist + 1 ) * ( aDist + 1 );
SEG::ecoord l_squared = d.Dot( d );
SEG::ecoord t = d.Dot( aP - A );
......
......@@ -29,35 +29,37 @@
#include <wx_status_popup.h>
#include <wxPcbStruct.h>
WX_STATUS_POPUP::WX_STATUS_POPUP ( PCB_EDIT_FRAME *parent ) :
wxPopupWindow ( parent )
WX_STATUS_POPUP::WX_STATUS_POPUP( PCB_EDIT_FRAME* aParent ) :
wxPopupWindow( aParent )
{
m_panel = new wxPanel( this, wxID_ANY );
m_panel->SetBackgroundColour( *wxLIGHT_GREY );
m_topSizer = new wxBoxSizer( wxVERTICAL );
m_panel->SetSizer( m_topSizer );
}
void WX_STATUS_POPUP::updateSize()
{
m_topSizer->Fit( m_panel );
SetClientSize( m_panel->GetSize( ) );
SetClientSize( m_panel->GetSize() );
}
WX_STATUS_POPUP::~WX_STATUS_POPUP()
{
}
void WX_STATUS_POPUP::Popup(wxWindow *focus)
void WX_STATUS_POPUP::Popup( wxWindow* )
{
Show(true);
Show( true );
Raise();
}
void WX_STATUS_POPUP::Move( const wxPoint& aWhere )
{
SetPosition ( aWhere );
}
\ No newline at end of file
......@@ -35,14 +35,14 @@
#include "wx_unit_binder.h"
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl *aTextInput, wxStaticText *aUnitLabel, wxSpinButton *aSpinButton )
WX_UNIT_BINDER::WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput, wxStaticText* aUnitLabel, wxSpinButton* aSpinButton )
{
// Use the currently selected units
m_units = g_UserUnit;
m_textCtrl = aTextInput;
m_textCtrl->SetValue ( wxT("0") );
m_textCtrl->SetValue( wxT( "0" ) );
m_unitLabel = aUnitLabel;
m_unitLabel->SetLabel ( GetAbbreviatedUnitsLabel (m_units));
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
}
......@@ -50,15 +50,17 @@ WX_UNIT_BINDER::~WX_UNIT_BINDER()
{
}
void WX_UNIT_BINDER::SetValue( int aValue )
{
wxString s = StringFromValue( m_units, aValue, false );
m_textCtrl->SetValue ( s );
m_textCtrl->SetValue( s );
m_unitLabel->SetLabel ( GetAbbreviatedUnitsLabel (m_units));
m_unitLabel->SetLabel( GetAbbreviatedUnitsLabel( m_units ) );
}
int WX_UNIT_BINDER::GetValue() const
{
wxString s = m_textCtrl->GetValue();
......@@ -66,8 +68,9 @@ int WX_UNIT_BINDER::GetValue() const
return ValueFromString( m_units, s );
}
void WX_UNIT_BINDER::Enable ( bool aEnable )
void WX_UNIT_BINDER::Enable( bool aEnable )
{
m_textCtrl->Enable ( aEnable );
m_unitLabel->Enable ( aEnable );
}
m_textCtrl->Enable( aEnable );
m_unitLabel->Enable( aEnable );
}
\ No newline at end of file
......@@ -147,7 +147,7 @@ public:
#define BRIGHTENED (1 << 26) ///< item is drawn with a bright contour
#define DP_COUPLED (1 << 27) ///< item is coupled with another item making a differential pair
///< (applies to segments only)
///< (applies to segments only)
#define EDA_ITEM_ALL_FLAGS -1
......
......@@ -134,7 +134,7 @@ public:
* removes the item aItem (if exists in the collector).
* @param aItem the item to be removed.
*/
void Remove( const EDA_ITEM *aItem )
void Remove( const EDA_ITEM* aItem )
{
for( size_t i = 0; i < m_List.size(); i++ )
{
......@@ -257,7 +257,6 @@ public:
return cnt;
}
/**
* Function Collect
* scans an EDA_ITEM using this class's Inspector method, which does
......
......@@ -50,7 +50,7 @@ public:
/**
* Function GetSize()
* Returns information about number of vertices stored.
* @param Number of vertices.
* @return Number of vertices.
*/
inline unsigned int GetSize() const
{
......
......@@ -206,7 +206,7 @@ public:
return sqrt( SquaredDistance( aP ) );
}
void CanonicalCoefs ( ecoord& qA, ecoord& qB, ecoord& qC) const
void CanonicalCoefs( ecoord& qA, ecoord& qB, ecoord& qC ) const
{
qA = A.y - B.y;
qB = B.x - A.x;
......@@ -223,8 +223,8 @@ public:
bool Collinear( const SEG& aSeg ) const
{
ecoord qa, qb, qc;
CanonicalCoefs ( qa, qb, qc );
CanonicalCoefs( qa, qb, qc );
ecoord d1 = std::abs( aSeg.A.x * qa + aSeg.A.y * qb + qc );
ecoord d2 = std::abs( aSeg.B.x * qa + aSeg.B.y * qb + qc );
......@@ -234,23 +234,23 @@ public:
bool ApproxCollinear( const SEG& aSeg ) const
{
ecoord p, q, r;
CanonicalCoefs ( p, q, r );
ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
CanonicalCoefs( p, q, r );
ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
return std::abs(dist1) <= 1 && std::abs(dist2) <= 1;
return std::abs( dist1 ) <= 1 && std::abs( dist2 ) <= 1;
}
bool ApproxParallel ( const SEG& aSeg ) const
{
ecoord p, q, r;
CanonicalCoefs ( p, q, r );
ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
CanonicalCoefs( p, q, r );
ecoord dist1 = ( p * aSeg.A.x + q * aSeg.A.y + r ) / sqrt( p * p + q * q );
ecoord dist2 = ( p * aSeg.B.x + q * aSeg.B.y + r ) / sqrt( p * p + q * q );
return std::abs(dist1 - dist2) <= 1;
return std::abs( dist1 - dist2 ) <= 1;
}
......@@ -291,7 +291,7 @@ public:
return ( A - B ).SquaredEuclideanNorm();
}
ecoord TCoef ( const VECTOR2I& aP ) const;
ecoord TCoef( const VECTOR2I& aP ) const;
/**
* Function Index()
......@@ -310,7 +310,7 @@ public:
void Reverse()
{
std::swap ( A, B );
std::swap( A, B );
}
private:
......@@ -320,7 +320,6 @@ private:
int m_index;
};
inline VECTOR2I SEG::LineProject( const VECTOR2I& aP ) const
{
VECTOR2I d = B - A;
......@@ -337,7 +336,6 @@ inline VECTOR2I SEG::LineProject( const VECTOR2I& aP ) const
return A + VECTOR2I( xp, yp );
}
inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
{
ecoord p = A.y - B.y;
......@@ -349,10 +347,10 @@ inline int SEG::LineDistance( const VECTOR2I& aP, bool aDetermineSide ) const
return aDetermineSide ? dist : abs( dist );
}
inline SEG::ecoord SEG::TCoef ( const VECTOR2I& aP ) const
inline SEG::ecoord SEG::TCoef( const VECTOR2I& aP ) const
{
VECTOR2I d = B - A;
return d.Dot ( aP - A);
return d.Dot( aP - A);
}
inline const VECTOR2I SEG::NearestPoint( const VECTOR2I& aP ) const
......@@ -376,7 +374,6 @@ inline const VECTOR2I SEG::NearestPoint( const VECTOR2I& aP ) const
return A + VECTOR2I( xp, yp );
}
inline std::ostream& operator<<( std::ostream& aStream, const SEG& aSeg )
{
aStream << "[ " << aSeg.A << " - " << aSeg.B << " ]";
......
......@@ -76,16 +76,15 @@ public:
ALL = 0xff
};
/**
* Enum VIEW_VISIBILITY_FLAGS.
* Defines the visibility of the item (temporarily hidden, invisible, etc).
/**
* Enum VIEW_VISIBILITY_FLAGS.
* Defines the visibility of the item (temporarily hidden, invisible, etc).
*/
enum VIEW_VISIBILITY_FLAGS {
VISIBLE = 0x01, /// Item is visible (in general)
HIDDEN = 0x02 /// Item is temporarily hidden (e.g. being used by a tool). Overrides VISIBLE flag.
};
VIEW_ITEM() : m_view( NULL ), m_flags( VISIBLE ), m_requiredUpdate( ALL ),
m_groups( NULL ), m_groupsSize( 0 ) {}
......@@ -141,13 +140,14 @@ public:
void ViewSetVisible( bool aIsVisible = true )
{
bool cur_visible = m_flags & VISIBLE;
if( cur_visible != aIsVisible )
{
if(aIsVisible)
if( aIsVisible )
m_flags |= VISIBLE;
else
m_flags &= ~VISIBLE;
ViewUpdate( APPEARANCE | COLOR );
}
}
......@@ -158,12 +158,12 @@ public:
*
* @param aHide: whether the item is hidden (on all layers), or not.
*/
void ViewHide ( bool aHide = true )
void ViewHide( bool aHide = true )
{
if(! (m_flags & VISIBLE) )
if( !( m_flags & VISIBLE ) )
return;
if(aHide)
if( aHide )
m_flags |= HIDDEN;
else
m_flags &= ~HIDDEN;
......@@ -242,7 +242,7 @@ protected:
}
VIEW* m_view; ///< Current dynamic view the item is assigned to.
int m_flags; ///< Visibility flags
int m_flags; ///< Visibility flags
int m_requiredUpdate; ///< Flag required for updating
///* Helper for storing cached items group ids
......@@ -341,7 +341,7 @@ protected:
* Function isRenderable()
* Returns if the item should be drawn or not.
*/
bool isRenderable() const
bool isRenderable() const
{
return m_flags == VISIBLE;
}
......
......@@ -41,18 +41,18 @@ class PCB_EDIT_FRAME;
class WX_STATUS_POPUP: public wxPopupWindow
{
public:
WX_STATUS_POPUP ( PCB_EDIT_FRAME *parent );
WX_STATUS_POPUP( PCB_EDIT_FRAME* aParent );
virtual ~WX_STATUS_POPUP();
virtual void Popup(wxWindow *focus = NULL);
virtual void Popup(wxWindow* aFocus = NULL);
virtual void Move( const wxPoint &aWhere );
protected:
void updateSize();
wxPanel *m_panel;
wxBoxSizer *m_topSizer;
wxPanel* m_panel;
wxBoxSizer* m_topSizer;
};
#endif /* __WX_STATUS_POPUP_H_*/
......@@ -43,7 +43,7 @@ public:
* @param aUnitLabel is the units label displayed next to the text field.
* @param aSpinButton is an optional spin button (for adjusting the input value)
*/
WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl *aTextInput, wxStaticText *aUnitLabel, wxSpinButton *aSpinButton = NULL );
WX_UNIT_BINDER( wxWindow* aParent, wxTextCtrl* aTextInput, wxStaticText* aUnitLabel, wxSpinButton* aSpinButton = NULL );
virtual ~WX_UNIT_BINDER();
......@@ -64,20 +64,20 @@ public:
* Function Enable
* Enables/diasables the binded widgets
*/
void Enable ( bool aEnable );
void Enable( bool aEnable );
protected:
void onTextChanged ( wxEvent& aEvent );
void onTextChanged( wxEvent& aEvent );
///> Text input control.
wxTextCtrl* m_textCtrl;
///> Label showing currently used units.
wxStaticText* m_unitLabel;
wxStaticText* m_unitLabel;
///> Currently used units.
EDA_UNITS_T m_units;
EDA_UNITS_T m_units;
///> Step size (added/subtracted difference if spin buttons are used).
int m_step;
......
......@@ -69,7 +69,7 @@ public:
/// skip the linked list stuff, and parent
const DRAWSEGMENT& operator = ( const DRAWSEGMENT& rhs );
static inline bool ClassOf( const EDA_ITEM *aItem )
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_LINE_T == aItem->Type();
}
......
......@@ -815,12 +815,14 @@ void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction )
}
}
const BOX2I MODULE::ViewBBox() const
{
return BOX2I( VECTOR2I( GetFootprintRect().GetOrigin() ),
VECTOR2I( GetFootprintRect().GetSize() ) );
VECTOR2I( GetFootprintRect().GetSize() ) );
}
void MODULE::ViewUpdate( int aUpdateFlags )
{
if( !m_view )
......@@ -1115,6 +1117,7 @@ void MODULE::SetOrientation( double newangle )
CalculateBoundingBox();
}
double MODULE::PadCoverageRatio() const
{
double padArea = 0.0;
......@@ -1128,5 +1131,5 @@ double MODULE::PadCoverageRatio() const
double ratio = padArea / moduleArea;
return std::min(ratio, 1.0);
return std::min( ratio, 1.0 );
}
......@@ -262,7 +262,8 @@ public:
m_ModuleStatus &= ~MODULE_to_PLACE;
}
bool PadsLocked() const { return (m_ModuleStatus & MODULE_PADS_LOCKED ); }
bool PadsLocked() const { return ( m_ModuleStatus & MODULE_PADS_LOCKED ); }
void SetPadsLocked( bool aPadsLocked )
{
if( aPadsLocked )
......@@ -569,9 +570,9 @@ public:
m_initial_comments = aInitialComments;
}
/**
* Function PadCoverageRatio
* Calculates the ratio of total area of the footprint pads to the area of the
/**
* Function PadCoverageRatio
* Calculates the ratio of total area of the footprint pads to the area of the
* footprint. Used by selection tool heuristics.
* @return the ratio
*/
......
......@@ -94,7 +94,7 @@ public:
///< used for edge board connectors
static LSET UnplatedHoleMask(); ///< layer set for a mechanical unplated through hole pad
static inline bool ClassOf( const EDA_ITEM *aItem )
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_PAD_T == aItem->Type();
}
......
......@@ -49,7 +49,7 @@ public:
~TEXTE_PCB();
static inline bool ClassOf( const EDA_ITEM *aItem )
static inline bool ClassOf( const EDA_ITEM* aItem )
{
return aItem && PCB_TEXT_T == aItem->Type();
}
......
......@@ -313,9 +313,9 @@ void DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties()
break;
}
if (m_CurrentModule->IsLocked() )
if( m_CurrentModule->IsLocked() )
m_AutoPlaceCtrl->SetSelection( 2 );
else if (m_CurrentModule->PadsLocked() )
else if( m_CurrentModule->PadsLocked() )
m_AutoPlaceCtrl->SetSelection( 1 );
else
m_AutoPlaceCtrl->SetSelection( 0 );
......
......@@ -27,23 +27,22 @@
DIALOG_PNS_DIFF_PAIR_DIMENSIONS::DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes ) :
DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE( aParent ),
m_traceWidth ( this, m_traceWidthText, m_traceWidthUnit ),
m_traceGap (this, m_traceGapText, m_traceGapUnit ),
m_viaGap ( this, m_viaGapText, m_viaGapUnit ),
m_traceWidth( this, m_traceWidthText, m_traceWidthUnit ),
m_traceGap( this, m_traceGapText, m_traceGapUnit ),
m_viaGap( this, m_viaGapText, m_viaGapUnit ),
m_sizes( aSizes )
{
m_traceWidth.SetValue ( aSizes.DiffPairWidth() );
m_traceGap.SetValue ( aSizes.DiffPairGap() );
m_viaGap.SetValue ( aSizes.DiffPairViaGap() );
m_viaTraceGapEqual->SetValue ( m_sizes.DiffPairViaGapSameAsTraceGap() );
m_traceWidth.SetValue( aSizes.DiffPairWidth() );
m_traceGap.SetValue( aSizes.DiffPairGap() );
m_viaGap.SetValue( aSizes.DiffPairViaGap() );
m_viaTraceGapEqual->SetValue( m_sizes.DiffPairViaGapSameAsTraceGap() );
updateCheckbox();
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::updateCheckbox()
{
printf("Checked: %d", m_viaTraceGapEqual->GetValue());
if( m_viaTraceGapEqual->GetValue() )
{
m_sizes.SetDiffPairViaGapSameAsTraceGap( true );
......@@ -58,6 +57,7 @@ void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::updateCheckbox()
}
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnClose( wxCloseEvent& aEvent )
{
// Do nothing, it is result of ESC pressing
......@@ -71,7 +71,7 @@ void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnOkClick( wxCommandEvent& aEvent )
m_sizes.SetDiffPairGap ( m_traceGap.GetValue() );
m_sizes.SetDiffPairViaGap ( m_viaGap.GetValue() );
m_sizes.SetDiffPairWidth ( m_traceWidth.GetValue() );
// todo: verify against design rules
EndModal( 1 );
}
......@@ -83,9 +83,10 @@ void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnCancelClick( wxCommandEvent& aEvent )
EndModal( 0 );
}
void DIALOG_PNS_DIFF_PAIR_DIMENSIONS::OnViaTraceGapEqualCheck( wxCommandEvent& event )
{
event.Skip();
updateCheckbox();
}
\ No newline at end of file
......@@ -33,23 +33,22 @@ class PNS_SIZES_SETTINGS;
class DIALOG_PNS_DIFF_PAIR_DIMENSIONS : public DIALOG_PNS_DIFF_PAIR_DIMENSIONS_BASE
{
public:
DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes );
public:
DIALOG_PNS_DIFF_PAIR_DIMENSIONS( wxWindow* aParent, PNS_SIZES_SETTINGS& aSizes );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
virtual void OnViaTraceGapEqualCheck( wxCommandEvent& event );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
virtual void OnViaTraceGapEqualCheck( wxCommandEvent& event );
private:
void updateCheckbox( );
private:
void updateCheckbox();
WX_UNIT_BINDER m_traceWidth;
WX_UNIT_BINDER m_traceGap;
WX_UNIT_BINDER m_viaGap;
WX_UNIT_BINDER m_traceWidth;
WX_UNIT_BINDER m_traceGap;
WX_UNIT_BINDER m_viaGap;
PNS_SIZES_SETTINGS& m_sizes;
PNS_SIZES_SETTINGS& m_sizes;
};
#endif // __dialog_pns_settings__
......@@ -20,63 +20,59 @@
/**
* Length tuner settings dialog.
*/
*/
#include "dialog_pns_length_tuning_settings.h"
#include <router/pns_meander_placer.h>
DIALOG_PNS_LENGTH_TUNING_SETTINGS::DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode ) :
DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE( aParent ),
m_minAmpl ( this, m_minAmplText, m_minAmplUnit ),
m_maxAmpl (this, m_maxAmplText, m_maxAmplUnit ),
m_spacing ( this, m_spacingText, m_spacingUnit ),
m_targetLength ( this, m_targetLengthText, m_targetLengthUnit ),
m_minAmpl( this, m_minAmplText, m_minAmplUnit ),
m_maxAmpl( this, m_maxAmplText, m_maxAmplUnit ),
m_spacing( this, m_spacingText, m_spacingUnit ),
m_targetLength( this, m_targetLengthText, m_targetLengthUnit ),
m_settings( aSettings ),
m_mode ( aMode )
m_mode( aMode )
{
m_miterStyle->Enable ( false );
m_radiusText->Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR );
m_miterStyle->Enable( false );
m_radiusText->Enable( aMode != PNS_MODE_TUNE_DIFF_PAIR );
//m_minAmpl.Enable ( aMode != PNS_MODE_TUNE_DIFF_PAIR_SKEW );
m_minAmpl.SetValue ( m_settings.m_minAmplitude );
m_maxAmpl.SetValue ( m_settings.m_maxAmplitude );
m_spacing.SetValue ( m_settings.m_spacing );
m_radiusText->SetValue ( wxString::Format(wxT("%i"), m_settings.m_cornerRadiusPercentage) );
m_minAmpl.SetValue( m_settings.m_minAmplitude );
m_maxAmpl.SetValue( m_settings.m_maxAmplitude );
m_spacing.SetValue( m_settings.m_spacing );
m_radiusText->SetValue( wxString::Format( wxT( "%i" ), m_settings.m_cornerRadiusPercentage ) );
m_miterStyle->SetSelection ( m_settings.m_cornerType == PNS_MEANDER_SETTINGS::ROUND ? 1 : 0 );
m_miterStyle->SetSelection( m_settings.m_cornerType == PNS_MEANDER_SETTINGS::ROUND ? 1 : 0 );
switch( aMode )
{
case PNS_MODE_TUNE_SINGLE:
SetTitle ( _("Single track length tuning") );
SetTitle( _( "Single track length tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_single_track_length_legend_xpm ) );
m_targetLength.SetValue ( m_settings.m_targetLength );
m_targetLength.SetValue( m_settings.m_targetLength );
break;
case PNS_MODE_TUNE_DIFF_PAIR:
SetTitle ( _("Differential pair length tuning") );
SetTitle( _( "Differential pair length tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_length_legend_xpm ) );
m_targetLength.SetValue ( m_settings.m_targetLength );
m_targetLength.SetValue( m_settings.m_targetLength );
break;
case PNS_MODE_TUNE_DIFF_PAIR_SKEW:
SetTitle ( _("Differential pair skew tuning") );
SetTitle( _( "Differential pair skew tuning" ) );
m_legend->SetBitmap( KiBitmap( tune_diff_pair_skew_legend_xpm ) );
m_targetLengthLabel->SetLabel( _("Target skew: ") );
m_targetLengthLabel->SetLabel( _( "Target skew: " ) );
m_targetLength.SetValue ( m_settings.m_targetSkew );
break;
default:
break;
}
m_stdButtonsOK->SetDefault();
m_targetLengthText->SetSelection(-1, -1);
m_targetLengthText->SetSelection( -1, -1 );
m_targetLengthText->SetFocus();
}
......@@ -90,26 +86,22 @@ void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnClose( wxCloseEvent& aEvent )
void DIALOG_PNS_LENGTH_TUNING_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
{
// fixme: use validators and TransferDataFromWindow
m_settings.m_minAmplitude = m_minAmpl.GetValue();
m_settings.m_maxAmplitude = m_maxAmpl.GetValue();
m_settings.m_spacing = m_spacing.GetValue();
m_settings.m_cornerRadiusPercentage = wxAtoi( m_radiusText->GetValue() );
if (m_mode == PNS_MODE_TUNE_DIFF_PAIR_SKEW)
if( m_mode == PNS_MODE_TUNE_DIFF_PAIR_SKEW )
m_settings.m_targetSkew = m_targetLength.GetValue();
else
m_settings.m_targetLength = m_targetLength.GetValue();
if ( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
if( m_settings.m_maxAmplitude < m_settings.m_minAmplitude )
m_settings.m_maxAmplitude = m_settings.m_maxAmplitude;
m_settings.m_cornerType = m_miterStyle->GetSelection( ) ? PNS_MEANDER_SETTINGS::CHAMFER : PNS_MEANDER_SETTINGS::ROUND;
m_settings.m_cornerType = m_miterStyle->GetSelection() ? PNS_MEANDER_SETTINGS::CHAMFER : PNS_MEANDER_SETTINGS::ROUND;
EndModal( 1 );
}
......
......@@ -35,22 +35,21 @@ class PNS_MEANDER_SETTINGS;
class DIALOG_PNS_LENGTH_TUNING_SETTINGS : public DIALOG_PNS_LENGTH_TUNING_SETTINGS_BASE
{
public:
DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
private:
WX_UNIT_BINDER m_minAmpl;
WX_UNIT_BINDER m_maxAmpl;
WX_UNIT_BINDER m_spacing;
WX_UNIT_BINDER m_targetLength;
PNS_MEANDER_SETTINGS& m_settings;
PNS_ROUTER_MODE m_mode;
public:
DIALOG_PNS_LENGTH_TUNING_SETTINGS( wxWindow* aParent, PNS_MEANDER_SETTINGS& aSettings, PNS_ROUTER_MODE aMode );
virtual void OnClose( wxCloseEvent& aEvent );
virtual void OnOkClick( wxCommandEvent& aEvent );
virtual void OnCancelClick( wxCommandEvent& aEvent );
private:
WX_UNIT_BINDER m_minAmpl;
WX_UNIT_BINDER m_maxAmpl;
WX_UNIT_BINDER m_spacing;
WX_UNIT_BINDER m_targetLength;
PNS_MEANDER_SETTINGS& m_settings;
PNS_ROUTER_MODE m_mode;
};
#endif // __dialog_pns_settings__
This diff is collapsed.
......@@ -42,16 +42,16 @@ DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SE
m_viaDrill.SetValue( m_settings.GetCustomViaDrill() );
m_trackWidthText->SetFocus();
m_trackWidthText->SetSelection(-1, -1);
m_trackWidthText->SetSelection( -1, -1 );
m_stdButtonsOK->SetDefault();
// Pressing ENTER when any of the text input fields is active applies changes
#if wxCHECK_VERSION( 3, 0, 0 )
Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
#else
Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
#endif
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE::onClose ) );
}
......
......@@ -34,26 +34,25 @@ class BOARD_DESIGN_SETTINGS;
/** Implementing DIALOG_TRACK_VIA_SIZE_BASE */
class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE
{
public:
/** Constructor */
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings );
public:
/** Constructor */
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, BOARD_DESIGN_SETTINGS& aSettings );
protected:
protected:
WX_UNIT_BINDER m_trackWidth;
WX_UNIT_BINDER m_viaDiameter;
WX_UNIT_BINDER m_viaDrill;
WX_UNIT_BINDER m_trackWidth;
WX_UNIT_BINDER m_viaDiameter;
WX_UNIT_BINDER m_viaDrill;
// Routings settings that are modified by the dialog.
BOARD_DESIGN_SETTINGS& m_settings;
// Routings settings that are modified by the dialog.
BOARD_DESIGN_SETTINGS& m_settings;
///> Checks if values given in the dialog are sensible.
bool check();
///> Checks if values given in the dialog are sensible.
bool check();
// Handlers for DIALOG_TRACK_VIA_SIZE_BASE events.
void onClose( wxCloseEvent& aEvent );
void onOkClick( wxCommandEvent& aEvent );
void onCancelClick( wxCommandEvent& aEvent );
// Handlers for DIALOG_TRACK_VIA_SIZE_BASE events.
void onClose( wxCloseEvent& aEvent );
void onOkClick( wxCommandEvent& aEvent );
void onCancelClick( wxCommandEvent& aEvent );
};
#endif // __dialog_track_via_size__
......@@ -63,7 +63,7 @@ static void DisplayCmpDoc( wxString& aName, void* aData );
static FOOTPRINT_LIST MList;
static void clearModuleItemFlags ( BOARD_ITEM *aItem )
static void clearModuleItemFlags( BOARD_ITEM* aItem )
{
aItem->ClearFlags();
}
......
......@@ -515,7 +515,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Configure Interactive Routing." ),
KiBitmap( add_tracks_xpm ) ); // fixme: icon
//--- dimensions submenu ------------------------------------------------------
wxMenu* dimensionsMenu = new wxMenu;
......
......@@ -70,7 +70,6 @@
#include <tool/tool_dispatcher.h>
#include <tools/common_actions.h>
#include <scripting/python_console_frame.h>
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
......@@ -537,7 +536,7 @@ void PCB_EDIT_FRAME::setupTools()
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager );
// Register tools
registerAllTools ( m_toolManager );
registerAllTools( m_toolManager );
m_toolManager->ResetTools( TOOL_BASE::RUN );
......
......@@ -48,7 +48,6 @@ enum pcbnew_ids
ID_MENU_ADD_TEARDROPS,
ID_MENU_DIFF_PAIR_DIMENSIONS,
ID_MENU_INTERACTIVE_ROUTER_SETTINGS,
ID_PCB_MASK_CLEARANCE,
ID_PCB_LAYERS_SETUP,
......
/*
* KiRouter - a push-and-(sometimes-)shove PCB router
*
* Copyright (C) 2013-2014 CERN
* Copyright (C) 2013-2015 CERN
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
*
* This program is free software: you can redistribute it and/or modify it
......@@ -180,7 +180,7 @@ public:
return ( m_dir % 2 ) == 1;
}
bool IsDefined() const
bool IsDefined() const
{
return m_dir != UNDEFINED;
}
......@@ -282,7 +282,7 @@ public:
l.m_dir = NW;
else
l.m_dir = static_cast<Directions>( m_dir - 1 );
return l;
}
......@@ -303,10 +303,10 @@ public:
case NW: return VECTOR2I( -1, 1 );
case SE: return VECTOR2I( 1, -1 );
case SW: return VECTOR2I( -1, -1 );
default:
return VECTOR2I( 0, 0 );
}
}
}
int Mask() const
......@@ -320,7 +320,8 @@ private:
* Function construct()
* Calculates the direction from a vector. If the vector's angle is not a multiple of 45
* degrees, the direction is rounded to the nearest octant.
* @param aVec our vector */
* @param aVec our vector
*/
void construct_( const VECTOR2I& aVec )
{
m_dir = UNDEFINED;
......@@ -343,40 +344,14 @@ private:
if( dir < 0 )
dir = dir + 8;
m_dir = (Directions) dir;
return;
if( aVec.y < 0 )
{
if( aVec.x > 0 )
m_dir = NE;
else if( aVec.x < 0 )
m_dir = NW;
else
m_dir = N;
}
else if( aVec.y == 0 )
{
if( aVec.x > 0 )
m_dir = E;
else
m_dir = W;
}
else // aVec.y>0
{
if( aVec.x > 0 )
m_dir = SE;
else if( aVec.x < 0 )
m_dir = SW;
else
m_dir = S;
}
}
///> our actual direction
Directions m_dir;
Directions m_dir;
};
#endif // __DIRECTION_H
......@@ -86,7 +86,7 @@ public:
TUNER_TOOL_MENU( BOARD* aBoard )
{
SetTitle( wxT( "Length Tuner" ) );
//Add( ACT_StartTuning );
//Add( ACT_EndTuning );
......@@ -96,7 +96,7 @@ public:
Add( ACT_SpacingDecrease );
Add( ACT_AmplIncrease );
Add( ACT_AmplDecrease );
Add( ACT_Settings );
Add( ACT_Settings );
}
};
......@@ -106,10 +106,11 @@ LENGTH_TUNER_TOOL::~LENGTH_TUNER_TOOL()
delete m_router;
}
void LENGTH_TUNER_TOOL::Reset( RESET_REASON aReason )
{
PNS_TOOL_BASE::Reset( aReason );
Go( &LENGTH_TUNER_TOOL::TuneSingleTrace, COMMON_ACTIONS::routerActivateTuneSingleTrace.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPair, COMMON_ACTIONS::routerActivateTuneDiffPair.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPairSkew, COMMON_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent() );
......@@ -128,9 +129,9 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
}
}
PNS_MEANDER_PLACER_BASE *placer = static_cast <PNS_MEANDER_PLACER_BASE *> ( m_router->Placer() );
PNS_MEANDER_PLACER_BASE* placer = static_cast<PNS_MEANDER_PLACER_BASE*>( m_router->Placer() );
if (!placer)
if( !placer )
return;
if( aEvent.IsAction( &ACT_Settings ) )
......@@ -143,15 +144,16 @@ void LENGTH_TUNER_TOOL::handleCommonEvents( const TOOL_EVENT& aEvent )
placer->UpdateSettings ( settings );
}
m_savedMeanderSettings = placer->MeanderSettings( );
m_savedMeanderSettings = placer->MeanderSettings();
}
}
void LENGTH_TUNER_TOOL::performTuning()
{
bool saveUndoBuffer = true;
if(m_startItem)
if( m_startItem )
{
m_frame->SetActiveLayer( ToLAYER_ID ( m_startItem->Layers().Start() ) );
......@@ -162,22 +164,21 @@ void LENGTH_TUNER_TOOL::performTuning()
m_ctls->ForceCursorPosition( false );
m_ctls->SetAutoPan( true );
if ( !m_router->StartRouting( m_startSnapPoint, m_startItem, 0 ) )
if( !m_router->StartRouting( m_startSnapPoint, m_startItem, 0 ) )
{
wxMessageBox ( m_router->FailureReason(), _("Error") );
highlightNet ( false );
wxMessageBox( m_router->FailureReason(), _( "Error" ) );
highlightNet( false );
return;
}
PNS_TUNE_STATUS_POPUP statusPopup ( m_frame );
PNS_TUNE_STATUS_POPUP statusPopup( m_frame );
statusPopup.Popup();
PNS_MEANDER_PLACER *placer = static_cast <PNS_MEANDER_PLACER *> ( m_router->Placer() );
PNS_MEANDER_PLACER* placer = static_cast<PNS_MEANDER_PLACER*>( m_router->Placer() );
VECTOR2I end;
placer->UpdateSettings( m_savedMeanderSettings );
while( OPT_TOOL_EVENT evt = Wait() )
{
if( evt->IsCancel() || evt->IsActivate() )
......@@ -194,10 +195,10 @@ void LENGTH_TUNER_TOOL::performTuning()
wxPoint p = wxGetMousePosition();
p.x+=20;
p.y+=20;
p.x += 20;
p.y += 20;
statusPopup.Update ( m_router );
statusPopup.Update( m_router );
statusPopup.Move( p );
}
else if( evt->IsClick( BUT_LEFT ) )
......@@ -209,16 +210,24 @@ void LENGTH_TUNER_TOOL::performTuning()
{
if( m_router->FixRoute( end, NULL ) )
break;
} else if (evt->IsAction ( &ACT_AmplDecrease ) ) {
}
else if( evt->IsAction( &ACT_AmplDecrease ) )
{
placer->AmplitudeStep( -1 );
m_router->Move( end, NULL );
} else if (evt->IsAction ( &ACT_AmplIncrease ) ) {
}
else if( evt->IsAction( &ACT_AmplIncrease ) )
{
placer->AmplitudeStep( 1 );
m_router->Move( end, NULL );
} else if (evt->IsAction ( &ACT_SpacingDecrease ) ) {
}
else if(evt->IsAction( &ACT_SpacingDecrease ) )
{
placer->SpacingStep( -1 );
m_router->Move( end, NULL );
} else if (evt->IsAction ( &ACT_SpacingIncrease ) ) {
}
else if( evt->IsAction( &ACT_SpacingIncrease ) )
{
placer->SpacingStep( 1 );
m_router->Move( end, NULL );
}
......@@ -244,27 +253,29 @@ void LENGTH_TUNER_TOOL::performTuning()
m_ctls->SetAutoPan( false );
m_ctls->ForceCursorPosition( false );
highlightNet( false );
}
int LENGTH_TUNER_TOOL::TuneSingleTrace ( const TOOL_EVENT& aEvent )
int LENGTH_TUNER_TOOL::TuneSingleTrace( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Trace Length" ) );
return mainLoop( PNS_MODE_TUNE_SINGLE );
}
int LENGTH_TUNER_TOOL::TuneDiffPair ( const TOOL_EVENT& aEvent )
int LENGTH_TUNER_TOOL::TuneDiffPair( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Length" ) );
return mainLoop( PNS_MODE_TUNE_DIFF_PAIR );
}
int LENGTH_TUNER_TOOL::TuneDiffPairSkew ( const TOOL_EVENT& aEvent )
int LENGTH_TUNER_TOOL::TuneDiffPairSkew( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TRACK_BUTT, wxCURSOR_PENCIL, _( "Tune Diff Pair Skew" ) );
return mainLoop( PNS_MODE_TUNE_DIFF_PAIR_SKEW );
}
int LENGTH_TUNER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
{
......@@ -273,13 +284,13 @@ int LENGTH_TUNER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
Activate();
m_router->SetMode ( aMode );
m_router->SetMode( aMode );
m_ctls->SetSnapping( true );
m_ctls->ShowCursor( true );
std::auto_ptr<TUNER_TOOL_MENU> ctxMenu ( new TUNER_TOOL_MENU( m_board ) );
SetContextMenu ( ctxMenu.get() );
std::auto_ptr<TUNER_TOOL_MENU> ctxMenu( new TUNER_TOOL_MENU( m_board ) );
SetContextMenu( ctxMenu.get() );
// Main loop: keep receiving events
while( OPT_TOOL_EVENT evt = Wait() )
......@@ -300,7 +311,7 @@ int LENGTH_TUNER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
else if( evt->IsClick( BUT_LEFT ) || evt->IsAction( &ACT_StartTuning ) )
{
updateStartItem( *evt );
performTuning( );
performTuning( );
}
handleCommonEvents( *evt );
......@@ -316,4 +327,4 @@ int LENGTH_TUNER_TOOL::mainLoop( PNS_ROUTER_MODE aMode )
m_savedSizes = m_router->Sizes();
return 0;
}
\ No newline at end of file
}
......@@ -35,16 +35,15 @@ public:
void Reset( RESET_REASON aReason );
int TuneSingleTrace ( const TOOL_EVENT& aEvent );
int TuneDiffPair ( const TOOL_EVENT& aEvent );
int TuneDiffPairSkew ( const TOOL_EVENT& aEvent );
int ClearMeanders ( const TOOL_EVENT& aEvent );
int TuneSingleTrace( const TOOL_EVENT& aEvent );
int TuneDiffPair( const TOOL_EVENT& aEvent );
int TuneDiffPairSkew( const TOOL_EVENT& aEvent );
int ClearMeanders( const TOOL_EVENT& aEvent );
private:
void performTuning( );
int mainLoop( PNS_ROUTER_MODE aMode );
void handleCommonEvents( const TOOL_EVENT& evt );
void handleCommonEvents( const TOOL_EVENT& aEvent );
PNS_MEANDER_SETTINGS m_savedMeanderSettings;
};
......
......@@ -23,10 +23,10 @@
PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const
{
return m_router->Settings();
return m_router->Settings();
}
PNS_LOGGER *PNS_ALGO_BASE::Logger()
PNS_LOGGER *PNS_ALGO_BASE::Logger()
{
return NULL;
}
\ No newline at end of file
return NULL;
}
......@@ -22,7 +22,7 @@
#define __PNS_ALGO_BASE_H
#include <wx/wx.h> // for wxString
#include "pns_routing_settings.h"
class PNS_ROUTER;
......@@ -33,32 +33,30 @@ class PNS_LOGGER;
*
* Base class for all P&S algorithms (shoving, walkaround, line placement, dragging, etc.)
* Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router instance, logging)
**/
*/
class PNS_ALGO_BASE
{
public:
PNS_ALGO_BASE( PNS_ROUTER *aRouter ) :
m_router ( aRouter )
{}
PNS_ALGO_BASE( PNS_ROUTER* aRouter ) :
m_router( aRouter )
{}
virtual ~PNS_ALGO_BASE() {}
virtual ~PNS_ALGO_BASE() {}
///> Returns the instance of our router
PNS_ROUTER* Router() const
{
return m_router;
}
///> Returns the instance of our router
PNS_ROUTER* Router() const
{
return m_router;
}
///> Returns current router settings
PNS_ROUTING_SETTINGS& Settings() const;
///> Returns current router settings
PNS_ROUTING_SETTINGS& Settings() const;
///> Returns the logger object, allowing to dump geometry to a file.
virtual PNS_LOGGER* Logger();
///> Returns the logger object, allowing to dump geometry to a file.
virtual PNS_LOGGER* Logger();
private:
PNS_ROUTER* m_router;
PNS_ROUTER* m_router;
};
#endif
This diff is collapsed.
......@@ -43,23 +43,22 @@ class PNS_DIFF_PAIR;
**/
class PNS_DP_GATEWAY {
public:
PNS_DP_GATEWAY ( const VECTOR2I& aAnchorP,
const VECTOR2I& aAnchorN,
bool aIsDiagonal,
int aAllowedEntryAngles = DIRECTION_45::ANG_OBTUSE,
int aPriority = 0 )
: m_anchorP(aAnchorP),
m_anchorN (aAnchorN),
m_isDiagonal( aIsDiagonal ),
m_allowedEntryAngles (aAllowedEntryAngles),
m_priority(aPriority)
PNS_DP_GATEWAY( const VECTOR2I& aAnchorP,
const VECTOR2I& aAnchorN,
bool aIsDiagonal,
int aAllowedEntryAngles = DIRECTION_45::ANG_OBTUSE,
int aPriority = 0 )
: m_anchorP( aAnchorP ),
m_anchorN( aAnchorN ),
m_isDiagonal( aIsDiagonal ),
m_allowedEntryAngles( aAllowedEntryAngles ),
m_priority( aPriority )
{
m_hasEntryLines = false;
}
~PNS_DP_GATEWAY ()
~PNS_DP_GATEWAY()
{
}
/**
......@@ -67,15 +66,15 @@ public:
*
* @return true, if the gateway anchors lie on a diagonal line
*/
bool IsDiagonal() const
{
return m_isDiagonal;
return m_isDiagonal;
}
const VECTOR2I& AnchorP () const { return m_anchorP; }
const VECTOR2I& AnchorN () const { return m_anchorN; }
const VECTOR2I& AnchorP() const { return m_anchorP; }
const VECTOR2I& AnchorN() const { return m_anchorN; }
/**
* Function AllowedAngles()
*
......@@ -89,36 +88,35 @@ public:
*
* @return priority/score value for gateway matching
*/
int Priority() const
{
int Priority() const
{
return m_priority;
}
void SetPriority(int aPriority)
void SetPriority(int aPriority)
{
m_priority = aPriority;
}
void SetEntryLines ( const SHAPE_LINE_CHAIN& aEntryP, const SHAPE_LINE_CHAIN& aEntryN )
{
void SetEntryLines( const SHAPE_LINE_CHAIN& aEntryP, const SHAPE_LINE_CHAIN& aEntryN )
{
m_entryP = aEntryP;
m_entryN = aEntryN;
m_hasEntryLines = true;
}
const SHAPE_LINE_CHAIN& EntryP () const { return m_entryP; }
const SHAPE_LINE_CHAIN& EntryN () const { return m_entryN; }
const SHAPE_LINE_CHAIN& EntryP() const { return m_entryP; }
const SHAPE_LINE_CHAIN& EntryN() const { return m_entryN; }
const PNS_DIFF_PAIR Entry() const ;
void Reverse();
bool HasEntryLines () const
bool HasEntryLines () const
{
return m_hasEntryLines;
return m_hasEntryLines;
}
private:
private:
SHAPE_LINE_CHAIN m_entryP, m_entryN;
bool m_hasEntryLines;
VECTOR2I m_anchorP, m_anchorN;
......@@ -134,37 +132,36 @@ private:
**/
class PNS_DP_PRIMITIVE_PAIR
{
public:
PNS_DP_PRIMITIVE_PAIR():
m_primP (NULL), m_primN ( NULL ) {};
m_primP( NULL ), m_primN( NULL ) {};
PNS_DP_PRIMITIVE_PAIR ( const PNS_DP_PRIMITIVE_PAIR& aOther );
PNS_DP_PRIMITIVE_PAIR ( PNS_ITEM *aPrimP, PNS_ITEM *aPrimN );
PNS_DP_PRIMITIVE_PAIR ( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOther );
PNS_DP_PRIMITIVE_PAIR( PNS_ITEM* aPrimP, PNS_ITEM* aPrimN );
PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
~PNS_DP_PRIMITIVE_PAIR();
void SetAnchors ( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
void SetAnchors( const VECTOR2I& aAnchorP, const VECTOR2I& aAnchorN );
const VECTOR2I& AnchorP () const { return m_anchorP; }
const VECTOR2I& AnchorN () const { return m_anchorN; }
const VECTOR2I& AnchorP() const { return m_anchorP; }
const VECTOR2I& AnchorN() const { return m_anchorN; }
PNS_DP_PRIMITIVE_PAIR& operator= ( const PNS_DP_PRIMITIVE_PAIR& aOther );
PNS_DP_PRIMITIVE_PAIR& operator=( const PNS_DP_PRIMITIVE_PAIR& aOther );
PNS_ITEM* PrimP () const { return m_primP; }
PNS_ITEM* PrimN () const { return m_primN; }
PNS_ITEM* PrimP() const { return m_primP; }
PNS_ITEM* PrimN() const { return m_primN; }
bool Directional() const;
DIRECTION_45 DirP () const;
DIRECTION_45 DirN () const;
DIRECTION_45 DirP() const;
DIRECTION_45 DirN() const;
private:
DIRECTION_45 anchorDirection( PNS_ITEM* aItem, const VECTOR2I& aP ) const;
DIRECTION_45 anchorDirection ( PNS_ITEM *aItem, const VECTOR2I& aP) const;
PNS_ITEM *m_primP, *m_primN;
PNS_ITEM* m_primP;
PNS_ITEM* m_primN;
VECTOR2I m_anchorP, m_anchorN;
};
......@@ -174,21 +171,21 @@ private:
* A set of gateways calculated for the cursor or starting/ending primitive pair.
**/
class PNS_DP_GATEWAYS
class PNS_DP_GATEWAYS
{
public:
PNS_DP_GATEWAYS ( int aGap ):
m_gap(aGap), m_viaGap( aGap ) {};
void SetGap ( int aGap ) {
m_gap = aGap;
void SetGap ( int aGap ) {
m_gap = aGap;
m_viaGap = aGap;
}
void Clear()
{
m_gateways.clear();
void Clear()
{
m_gateways.clear();
}
void SetFitVias ( bool aEnable, int aDiameter = 0, int aViaGap = -1 )
......@@ -201,12 +198,12 @@ class PNS_DP_GATEWAYS
m_viaGap = aViaGap;
}
void BuildForCursor ( const VECTOR2I& aCursorPos );
void BuildOrthoProjections ( PNS_DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore );
void BuildGeneric ( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries = false, bool aViaMode = false );
void BuildFromPrimitivePair( PNS_DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal );
bool FitGateways ( PNS_DP_GATEWAYS& aEntry, PNS_DP_GATEWAYS& aTarget, bool aPrefDiagonal, PNS_DIFF_PAIR& aDp );
std::vector<PNS_DP_GATEWAY>& Gateways()
......@@ -216,7 +213,7 @@ class PNS_DP_GATEWAYS
private:
struct DP_CANDIDATE
struct DP_CANDIDATE
{
SHAPE_LINE_CHAIN p, n;
VECTOR2I gw_p, gw_n;
......@@ -246,7 +243,7 @@ class PNS_DIFF_PAIR : public PNS_ITEM {
public:
struct COUPLED_SEGMENTS {
COUPLED_SEGMENTS ( const SEG& aCoupledP, const SEG& aParentP, int aIndexP,
COUPLED_SEGMENTS ( const SEG& aCoupledP, const SEG& aParentP, int aIndexP,
const SEG& aCoupledN, const SEG& aParentN, int aIndexN ) :
coupledP ( aCoupledP ),
coupledN ( aCoupledN ),
......@@ -255,7 +252,7 @@ public:
indexP ( aIndexP ),
indexN ( aIndexN )
{}
SEG coupledP;
SEG coupledN;
SEG parentP;
......@@ -266,17 +263,17 @@ public:
typedef std::vector<COUPLED_SEGMENTS> COUPLED_SEGMENTS_VEC;
PNS_DIFF_PAIR ( ) : PNS_ITEM ( DIFF_PAIR ), m_hasVias (false) {}
PNS_DIFF_PAIR ( ) : PNS_ITEM ( DIFF_PAIR ), m_hasVias (false) {}
PNS_DIFF_PAIR ( int aGap ) :
PNS_ITEM ( DIFF_PAIR ),
PNS_DIFF_PAIR ( int aGap ) :
PNS_ITEM ( DIFF_PAIR ),
m_hasVias (false)
{
m_gapConstraint = aGap;
}
PNS_DIFF_PAIR ( const SHAPE_LINE_CHAIN &aP, const SHAPE_LINE_CHAIN& aN, int aGap = 0 ):
PNS_ITEM ( DIFF_PAIR ),
PNS_ITEM ( DIFF_PAIR ),
m_n (aN),
m_p (aP),
m_hasVias (false)
......@@ -285,7 +282,7 @@ public:
}
PNS_DIFF_PAIR ( const PNS_LINE &aLineP, const PNS_LINE &aLineN, int aGap = 0 ):
PNS_ITEM ( DIFF_PAIR ),
PNS_ITEM ( DIFF_PAIR ),
m_line_p ( aLineP ),
m_line_n ( aLineN ),
m_hasVias (false)
......@@ -301,8 +298,8 @@ public:
{
return aItem && DIFF_PAIR == aItem->Kind();
}
PNS_DIFF_PAIR * Clone() const { assert(false); return NULL; }
PNS_DIFF_PAIR * Clone() const { assert(false); return NULL; }
static PNS_DIFF_PAIR* AssembleDp ( PNS_LINE *aLine );
......@@ -317,7 +314,7 @@ public:
m_n = aN;
}
}
void SetShape ( const PNS_DIFF_PAIR& aPair )
{
m_p = aPair.m_p;
......@@ -326,20 +323,20 @@ public:
void SetNets ( int aP, int aN )
{
m_net_p = aP;
m_net_n = aN;
m_net_p = aP;
m_net_n = aN;
}
void SetWidth ( int aWidth )
{
m_width = aWidth;
m_width = aWidth;
}
int Width() const { return m_width; }
void SetGap ( int aGap)
{
m_gap = aGap;
m_gap = aGap;
m_gapConstraint = RANGED_NUM<int> ( m_gap, 10000, 10000 );
}
......@@ -364,24 +361,24 @@ public:
return m_hasVias;
}
int NetP() const
int NetP() const
{
return m_net_p;
}
int NetN() const
int NetN() const
{
return m_net_n;
}
PNS_LINE& PLine()
PNS_LINE& PLine()
{
if ( !m_line_p.IsLinked ( ) )
updateLine(m_line_p, m_p, m_net_p, m_via_p );
return m_line_p;
}
}
PNS_LINE& NLine()
PNS_LINE& NLine()
{
if ( !m_line_n.IsLinked ( ) )
updateLine(m_line_n, m_n, m_net_n, m_via_n );
......@@ -415,7 +412,7 @@ public:
}
const SHAPE_LINE_CHAIN& CP() const { return m_p; }
const SHAPE_LINE_CHAIN& CN() const { return m_n; }
bool BuildInitial ( PNS_DP_GATEWAY& aEntry, PNS_DP_GATEWAY& aTarget, bool aPrefDiagonal );
bool CheckConnectionAngle ( const PNS_DIFF_PAIR &aOther, int allowedAngles ) const;
int CoupledLength ( const SEG& aP, const SEG& aN ) const;
......@@ -428,7 +425,7 @@ public:
private:
void updateLine( PNS_LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, PNS_VIA& aVia )
void updateLine( PNS_LINE &aLine, const SHAPE_LINE_CHAIN& aShape, int aNet, PNS_VIA& aVia )
{
aLine.SetShape( aShape );
aLine.SetWidth( m_width );
......
This diff is collapsed.
......@@ -161,11 +161,11 @@ public:
bool IsPlacingVia() const { return m_placingVia; }
void SetOrthoMode ( bool aOrthoMode );
void SetOrthoMode( bool aOrthoMode );
void GetModifiedNets( std::vector<int> &aNets ) const;
private:
void GetModifiedNets( std::vector<int>& aNets ) const;
private:
int viaGap() const;
int gap() const;
......@@ -212,10 +212,10 @@ private:
*/
void setInitialDirection( const DIRECTION_45& aDirection );
bool routeHead( const VECTOR2I& aP );
bool tryWalkDp ( PNS_NODE* aNode, PNS_DIFF_PAIR &aPair, bool aSolidsOnly );
bool tryWalkDp( PNS_NODE* aNode, PNS_DIFF_PAIR& aPair, bool aSolidsOnly );
///> route step, walkaround mode
bool rhWalkOnly( const VECTOR2I& aP );
......@@ -227,10 +227,10 @@ private:
const PNS_VIA makeVia ( const VECTOR2I& aP, int aNet );
bool findDpPrimitivePair ( const VECTOR2I& aP, PNS_ITEM *aItem, PNS_DP_PRIMITIVE_PAIR& aPair );
OPT_VECTOR2I getDanglingAnchor ( PNS_NODE *aNode, PNS_ITEM *aItem );
int matchDpSuffix ( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName );
bool attemptWalk ( PNS_NODE *aNode, PNS_DIFF_PAIR *aCurrent, PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly );
bool findDpPrimitivePair( const VECTOR2I& aP, PNS_ITEM* aItem, PNS_DP_PRIMITIVE_PAIR& aPair );
OPT_VECTOR2I getDanglingAnchor( PNS_NODE* aNode, PNS_ITEM* aItem );
int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName );
bool attemptWalk( PNS_NODE* aNode, PNS_DIFF_PAIR* aCurrent, PNS_DIFF_PAIR& aWalk, bool aPFirst, bool aWindCw, bool aSolidsOnly );
bool propagateDpHeadForces ( const VECTOR2I& aP, VECTOR2I& aNewP );
enum State {
......@@ -247,11 +247,10 @@ private:
bool m_fitOk;
int m_netP, m_netN;
PNS_DP_PRIMITIVE_PAIR m_start;
boost::optional<PNS_DP_PRIMITIVE_PAIR> m_prevPair;
///> current algorithm iteration
int m_iteration;
......@@ -294,9 +293,9 @@ private:
VECTOR2I m_currentEnd, m_currentStart;
PNS_DIFF_PAIR m_currentTrace;
PNS_ITEM *m_currentEndItem;
PNS_ITEM* m_currentEndItem;
PNS_MODE m_currentMode;
bool m_idle;
};
......
This diff is collapsed.
......@@ -48,13 +48,12 @@ class PNS_ROUTER_BASE;
class PNS_DP_MEANDER_PLACER : public PNS_MEANDER_PLACER_BASE
{
public:
PNS_DP_MEANDER_PLACER( PNS_ROUTER* aRouter );
~PNS_DP_MEANDER_PLACER();
/**
* Function Start()
*
*
* Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL).
*/
......@@ -62,8 +61,8 @@ public:
/**
* Function Move()
*
* Moves the end of the currently routed trace to the point aP, taking
*
* Moves the end of the currently routed trace to the point aP, taking
* aEndItem as anchor (if not NULL).
* (unless NULL).
*/
......@@ -71,7 +70,7 @@ public:
/**
* Function FixRoute()
*
*
* Commits the currently routed track to the parent node, taking
* aP as the final end point and aEndItem as the final anchor (if provided).
* @return true, if route has been commited. May return false if the routing
......@@ -79,7 +78,7 @@ public:
* if Settings.CanViolateDRC() is on.
*/
bool FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem );
const PNS_LINE Trace() const;
/**
......@@ -88,39 +87,36 @@ public:
* Returns the most recent world state.
*/
PNS_NODE* CurrentNode( bool aLoopsRemoved = false ) const;
const PNS_ITEMSET Traces();
const VECTOR2I& CurrentEnd() const;
int CurrentNet() const;
int CurrentLayer() const;
int totalLength();
const wxString TuningInfo() const;
TUNING_STATUS TuningStatus() const;
bool CheckFit ( PNS_MEANDER_SHAPE* aShape );
bool CheckFit( PNS_MEANDER_SHAPE* aShape );
private:
friend class PNS_MEANDER_SHAPE;
void meanderSegment ( const SEG& aBase );
void meanderSegment ( const SEG& aBase );
// void addMeander ( PNS_MEANDER *aM );
// void addCorner ( const VECTOR2I& aP );
const SEG baselineSegment ( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs );
const SEG baselineSegment( const PNS_DIFF_PAIR::COUPLED_SEGMENTS& aCoupledSegs );
void setWorld ( PNS_NODE* aWorld );
void setWorld( PNS_NODE* aWorld );
void release();
int origPathLength () const;
int origPathLength() const;
///> pointer to world to search colliding items
PNS_NODE* m_world;
......@@ -139,7 +135,7 @@ private:
SHAPE_LINE_CHAIN m_finalShapeP, m_finalShapeN;
PNS_MEANDERED_LINE m_result;
PNS_SEGMENT *m_initialSegment;
PNS_SEGMENT* m_initialSegment;
int m_lastLength;
TUNING_STATUS m_lastStatus;
......
......@@ -42,7 +42,7 @@ class PNS_ROUTER_BASE;
class PNS_DRAGGER : public PNS_ALGO_BASE
{
public:
PNS_DRAGGER( PNS_ROUTER* aRouter );
PNS_DRAGGER( PNS_ROUTER* aRouter );
~PNS_DRAGGER();
/**
......@@ -54,7 +54,7 @@ public:
/**
* Function Start()
*
*
* Starts routing a single track at point aP, taking item aStartItem as anchor
* (unless NULL). Returns true if a dragging operation has started.
*/
......@@ -67,24 +67,24 @@ public:
* @return true, if dragging finished with success.
*/
bool Drag( const VECTOR2I& aP );
/**
* Function FixRoute()
*
* Checks if the result of current dragging operation is correct
* Checks if the result of current dragging operation is correct
* and eventually commits it to the world.
* @return true, if dragging finished with success.
*/
bool FixRoute();
/**
/**
* Function CurrentNode()
*
* Returns the most recent world state, including all
* items changed due to dragging operation.
*/
PNS_NODE* CurrentNode() const;
/**
* Function Traces()
*
......@@ -94,30 +94,30 @@ public:
/// @copydoc PNS_ALGO_BASE::Logger()
virtual PNS_LOGGER* Logger();
private:
typedef std::pair<PNS_LINE *, PNS_LINE *> LinePair;
typedef std::pair<PNS_LINE*, PNS_LINE*> LinePair;
typedef std::vector<LinePair> LinePairVec;
enum DragMode {
CORNER = 0,
SEGMENT,
VIA
};
enum DragMode {
CORNER = 0,
SEGMENT,
VIA
};
bool dragMarkObstacles( const VECTOR2I& aP );
bool dragShove(const VECTOR2I& aP );
bool startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg );
bool startDragVia( const VECTOR2D& aP, PNS_VIA* aVia );
void dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP );
PNS_NODE* m_world;
PNS_NODE* m_lastNode;
DragMode m_mode;
PNS_LINE* m_draggedLine;
PNS_VIA* m_draggedVia;
PNS_LINE m_lastValidDraggedLine;
PNS_SHOVE* m_shove;
bool startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg );
bool startDragVia( const VECTOR2D& aP, PNS_VIA* aVia );
void dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP );
PNS_NODE* m_world;
PNS_NODE* m_lastNode;
DragMode m_mode;
PNS_LINE* m_draggedLine;
PNS_VIA* m_draggedVia;
PNS_LINE m_lastValidDraggedLine;
PNS_SHOVE* m_shove;
int m_draggedSegmentIndex;
bool m_dragStatus;
PNS_MODE m_currentMode;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -62,7 +62,7 @@ public:
void Remove( PNS_LINE& aLine );
void Replace( PNS_LINE& aOldLine, PNS_LINE& aNewLine );
bool IsBetter( PNS_COST_ESTIMATOR& aOther, double aLengthTollerance,
bool IsBetter( PNS_COST_ESTIMATOR& aOther, double aLengthTolerance,
double aCornerTollerace ) const;
double GetLengthCost() const { return m_lengthCost; }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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