Fix duplicate variable member m_userUnits, creating issues depending on

the way it was acceded (by name or by accessor).
This commit is contained in:
jean-pierre charras 2022-09-26 18:54:42 +02:00
parent f7c82e2469
commit 7584ccc758
5 changed files with 13 additions and 14 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -106,10 +106,11 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
// BLACK for Pcbnew, BLACK or WHITE for Eeschema
m_colorSettings = nullptr;
m_msgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight( this );
m_userUnits = EDA_UNITS::MILLIMETRES;
m_polarCoords = false;
m_findReplaceData = std::make_unique<EDA_SEARCH_DATA>();
SetUserUnits( EDA_UNITS::MILLIMETRES );
m_auimgr.SetFlags( wxAUI_MGR_DEFAULT );
CreateStatusBar( 8 );
@ -273,7 +274,7 @@ void EDA_DRAW_FRAME::ToggleUserUnits()
}
else
{
SetUserUnits( m_userUnits == EDA_UNITS::INCHES ? EDA_UNITS::MILLIMETRES
SetUserUnits( GetUserUnits() == EDA_UNITS::INCHES ? EDA_UNITS::MILLIMETRES
: EDA_UNITS::INCHES );
unitsChangeRefresh();
@ -588,7 +589,7 @@ void EDA_DRAW_FRAME::DisplayUnitsMsg()
{
wxString msg;
switch( m_userUnits )
switch( GetUserUnits() )
{
case EDA_UNITS::INCHES: msg = _( "inches" ); break;
case EDA_UNITS::MILS: msg = _( "mils" ); break;
@ -667,7 +668,7 @@ void EDA_DRAW_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
WINDOW_SETTINGS* window = GetWindowSettings( aCfg );
aCfg->m_System.units = static_cast<int>( m_userUnits );
aCfg->m_System.units = static_cast<int>( GetUserUnits() );
aCfg->m_System.first_run_shown = m_firstRunDialogSetting;
aCfg->m_System.max_undo_items = GetMaxUndoItems();

View File

@ -158,10 +158,9 @@ void SCH_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
SCH_BASE_FRAME::SaveSettings( eeconfig() );
wxAuiPaneInfo& hierarchy_pane = m_auimgr.GetPane( SchematicHierarchyPaneName() );
// TODO(JE) do we need to keep m_userUnits around?
if( eeconfig() )
{
eeconfig()->m_System.units = static_cast<int>( m_userUnits );
eeconfig()->m_System.units = static_cast<int>( GetUserUnits() );
eeconfig()->m_AuiPanels.show_schematic_hierarchy = hierarchy_pane.IsShown();
eeconfig()->m_AuiPanels.schematic_hierarchy_float = hierarchy_pane.IsFloating();
// Other parameters (hierarchy_panel_float_width, hierarchy_panel_float_height,

View File

@ -1612,7 +1612,7 @@ void SIM_PLOT_FRAME::onShowNetlist( wxCommandEvent& event )
text->SetLexer( wxSTC_LEX_SPICE );
wxBoxSizer* sizer = new wxBoxSizer( wxVERTICAL );
sizer->Add( text, 1, wxEXPAND );
sizer->Add( text, 1, wxEXPAND | wxALL, 5 );
SetSizer( sizer );
Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( NETLIST_VIEW_DIALOG::onClose ),

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -733,7 +733,6 @@ private:
wxString m_mruPath; // Most recently used path.
EDA_UNITS m_userUnits;
ORIGIN_TRANSFORMS m_originTransforms; // Default display origin transforms object.
///< Map containing the UI update handlers registered with wx for each action.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2017-2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017-2022 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
*
* This program is free software; you can redistribute it and/or
@ -91,7 +91,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_mruImagePath( wxEmptyString )
{
m_maximizeByDefault = true;
m_userUnits = EDA_UNITS::MILLIMETRES;
SetUserUnits( EDA_UNITS::MILLIMETRES );
m_showBorderAndTitleBlock = true; // true for reference drawings.
DS_DATA_MODEL::GetTheInstance().m_EditMode = true;
@ -665,14 +665,14 @@ void PL_EDITOR_FRAME::DisplayGridMsg()
wxString line;
wxString gridformatter;
switch( m_userUnits )
switch( GetUserUnits() )
{
case EDA_UNITS::INCHES: gridformatter = "grid %.3f"; break;
case EDA_UNITS::MILLIMETRES: gridformatter = "grid %.4f"; break;
default: gridformatter = "grid %f"; break;
}
double grid = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, m_userUnits,
double grid = EDA_UNIT_UTILS::UI::ToUserUnit( drawSheetIUScale, GetUserUnits(),
GetCanvas()->GetGAL()->GetGridSize().x );
line.Printf( gridformatter, grid );