From ff34c7a94823ac6e31b9c8f9faf4eab4cfd3700b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 6 Jun 2018 17:06:08 +0100 Subject: [PATCH] Eradicate g_userUnit from router. (cherry picked from commit 5e90e6b) --- pcbnew/router/pns_dp_meander_placer.cpp | 8 ++++---- pcbnew/router/pns_dp_meander_placer.h | 2 +- pcbnew/router/pns_kicad_iface.cpp | 2 +- pcbnew/router/pns_meander_placer.cpp | 6 +++--- pcbnew/router/pns_meander_placer.h | 2 +- pcbnew/router/pns_meander_placer_base.h | 2 +- pcbnew/router/pns_meander_skew_placer.cpp | 6 +++--- pcbnew/router/pns_meander_skew_placer.h | 2 +- pcbnew/router/pns_tune_status_popup.cpp | 3 ++- 9 files changed, 17 insertions(+), 16 deletions(-) diff --git a/pcbnew/router/pns_dp_meander_placer.cpp b/pcbnew/router/pns_dp_meander_placer.cpp index 39a3cd1e3e..8d5797b339 100644 --- a/pcbnew/router/pns_dp_meander_placer.cpp +++ b/pcbnew/router/pns_dp_meander_placer.cpp @@ -358,7 +358,7 @@ int DP_MEANDER_PLACER::CurrentLayer() const } -const wxString DP_MEANDER_PLACER::TuningInfo() const +const wxString DP_MEANDER_PLACER::TuningInfo( EDA_UNITS_T aUnits ) const { wxString status; @@ -377,11 +377,11 @@ const wxString DP_MEANDER_PLACER::TuningInfo() const return _( "?" ); } - status += ::MessageTextFromValue( g_UserUnit, m_lastLength, false ); + status += ::MessageTextFromValue( aUnits, m_lastLength, false ); status += "/"; - status += ::MessageTextFromValue( g_UserUnit, m_settings.m_targetLength, false ); + status += ::MessageTextFromValue( aUnits, m_settings.m_targetLength, false ); status += " (gap: "; - status += ::MessageTextFromValue( g_UserUnit, m_originPair.Gap(), false ); + status += ::MessageTextFromValue( aUnits, m_originPair.Gap(), false ); status += ")"; return status; diff --git a/pcbnew/router/pns_dp_meander_placer.h b/pcbnew/router/pns_dp_meander_placer.h index c798d2d359..22b36dc63f 100644 --- a/pcbnew/router/pns_dp_meander_placer.h +++ b/pcbnew/router/pns_dp_meander_placer.h @@ -100,7 +100,7 @@ public: int totalLength(); - const wxString TuningInfo() const override; + const wxString TuningInfo( EDA_UNITS_T aUnits ) const override; TUNING_STATUS TuningStatus() const override; bool CheckFit( MEANDER_SHAPE* aShape ) override; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 38117a4191..71125e55fd 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -799,7 +799,7 @@ bool PNS_KICAD_IFACE::syncZone( PNS::NODE* aWorld, ZONE_CONTAINER* aZone ) dlg.ShowDetailedText( wxString::Format( _( "%s\nThis zone cannot be handled by the track layout tool.\n" "Please verify it is not a self-intersecting polygon." ), - aZone->GetSelectMenuText( g_UserUnit ) ) ); + aZone->GetSelectMenuText( MILLIMETRES ) ) ); dlg.DoNotShowCheckbox(); dlg.ShowModal(); diff --git a/pcbnew/router/pns_meander_placer.cpp b/pcbnew/router/pns_meander_placer.cpp index 5c36ed4ec6..6cc20d4744 100644 --- a/pcbnew/router/pns_meander_placer.cpp +++ b/pcbnew/router/pns_meander_placer.cpp @@ -233,7 +233,7 @@ int MEANDER_PLACER::CurrentLayer() const } -const wxString MEANDER_PLACER::TuningInfo() const +const wxString MEANDER_PLACER::TuningInfo( EDA_UNITS_T aUnits ) const { wxString status; @@ -252,9 +252,9 @@ const wxString MEANDER_PLACER::TuningInfo() const return _( "?" ); } - status += ::MessageTextFromValue( g_UserUnit, m_lastLength, false ); + status += ::MessageTextFromValue( aUnits, m_lastLength, false ); status += "/"; - status += ::MessageTextFromValue( g_UserUnit, m_settings.m_targetLength, false ); + status += ::MessageTextFromValue( aUnits, m_settings.m_targetLength, false ); return status; } diff --git a/pcbnew/router/pns_meander_placer.h b/pcbnew/router/pns_meander_placer.h index b9a0bb90b8..05982e3ffe 100644 --- a/pcbnew/router/pns_meander_placer.h +++ b/pcbnew/router/pns_meander_placer.h @@ -80,7 +80,7 @@ public: int CurrentLayer() const override; /// @copydoc MEANDER_PLACER_BASE::TuningInfo() - virtual const wxString TuningInfo() const override; + virtual const wxString TuningInfo( EDA_UNITS_T aUnits ) const override; /// @copydoc MEANDER_PLACER_BASE::TuningStatus() virtual TUNING_STATUS TuningStatus() const override; diff --git a/pcbnew/router/pns_meander_placer_base.h b/pcbnew/router/pns_meander_placer_base.h index 18d11800a2..c60edd1a39 100644 --- a/pcbnew/router/pns_meander_placer_base.h +++ b/pcbnew/router/pns_meander_placer_base.h @@ -64,7 +64,7 @@ public: * Returns a string describing the status and length of the * tuned traces. */ - virtual const wxString TuningInfo() const = 0; + virtual const wxString TuningInfo( EDA_UNITS_T aUnits ) const = 0; /** * Function TuningStatus() diff --git a/pcbnew/router/pns_meander_skew_placer.cpp b/pcbnew/router/pns_meander_skew_placer.cpp index 0d5a485412..9b49f66d33 100644 --- a/pcbnew/router/pns_meander_skew_placer.cpp +++ b/pcbnew/router/pns_meander_skew_placer.cpp @@ -144,7 +144,7 @@ bool MEANDER_SKEW_PLACER::Move( const VECTOR2I& aP, ITEM* aEndItem ) } -const wxString MEANDER_SKEW_PLACER::TuningInfo() const +const wxString MEANDER_SKEW_PLACER::TuningInfo( EDA_UNITS_T aUnits ) const { wxString status; @@ -163,9 +163,9 @@ const wxString MEANDER_SKEW_PLACER::TuningInfo() const return _( "?" ); } - status += ::MessageTextFromValue( g_UserUnit, m_lastLength - m_coupledLength, false ); + status += ::MessageTextFromValue( aUnits, m_lastLength - m_coupledLength, false ); status += "/"; - status += ::MessageTextFromValue( g_UserUnit, m_settings.m_targetSkew, false ); + status += ::MessageTextFromValue( aUnits, m_settings.m_targetSkew, false ); return status; } diff --git a/pcbnew/router/pns_meander_skew_placer.h b/pcbnew/router/pns_meander_skew_placer.h index e65ecd1ece..bdc8eb05c0 100644 --- a/pcbnew/router/pns_meander_skew_placer.h +++ b/pcbnew/router/pns_meander_skew_placer.h @@ -49,7 +49,7 @@ public: bool Move( const VECTOR2I& aP, ITEM* aEndItem ) override; /// @copydoc MEANDER_PLACER_BASE::TuningInfo() - const wxString TuningInfo() const override; + const wxString TuningInfo( EDA_UNITS_T aUnits ) const override; private: diff --git a/pcbnew/router/pns_tune_status_popup.cpp b/pcbnew/router/pns_tune_status_popup.cpp index bb58b8a481..454ea2d50b 100644 --- a/pcbnew/router/pns_tune_status_popup.cpp +++ b/pcbnew/router/pns_tune_status_popup.cpp @@ -19,6 +19,7 @@ * with this program. If not, see . */ +#include "draw_frame.h" #include "pns_tune_status_popup.h" #include "pns_router.h" #include "pns_meander_placer.h" @@ -37,7 +38,7 @@ void PNS_TUNE_STATUS_POPUP::UpdateStatus( PNS::ROUTER* aRouter ) if( !placer ) return; - SetText( placer->TuningInfo() ); + SetText( placer->TuningInfo( m_frame->GetUserUnits() ) ); switch( placer->TuningStatus() ) {