diff --git a/common/view/view_controls.cpp b/common/view/view_controls.cpp index 690043db6e..cfa0ac5bb0 100644 --- a/common/view/view_controls.cpp +++ b/common/view/view_controls.cpp @@ -82,6 +82,7 @@ void VC_SETTINGS::Reset() m_lastKeyboardCursorPositionValid = false; m_lastKeyboardCursorPosition = { 0.0, 0.0 }; m_lastKeyboardCursorCommand = ACTIONS::CURSOR_NONE; + m_scrollReversePanH = false; } diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index 9c0f14dde2..a7c14865a8 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -5,7 +5,7 @@ // Maintainer: Davide Rondini // Contributors: Jose Luis Blanco, Val Greene, Maciej Suminski, Tomasz Wlostowski // Created: 21/07/2003 -// Last edit: 25/08/2016 +// Last edit: 2023 // Copyright: (c) David Schalig, Davide Rondini // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -959,7 +959,7 @@ void mpScaleXLog::recalculateTicks( wxDC& dc, mpWindow& w ) // Half the number of ticks according to window size. // The value 96 is used to have only 4 ticks when m_scrX is 268. // For each 96 device context units, is possible to add a new tick. - while( visibleDecades - 2 >= m_scrX / 96 ) + while( visibleDecades - 2 >= m_scrX / 96.0 ) { step *= 10.0; visibleDecades = log( maxVvis / minVvis ) / log( step ); @@ -1872,9 +1872,9 @@ void mpWindow::ZoomOut( const wxPoint& centerPoint, double zoomFactor ) m_desiredXmax = m_posX + (m_scrX - m_marginLeft - m_marginRight) / m_scaleX; m_desiredYmax = m_posY; m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; - + AdjustLimitedView(); - + if( !CheckXLimits( m_desiredXmax, m_desiredXmin ) || !CheckYLimits( m_desiredYmax, m_desiredYmin ) ) { diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 6af5949c58..870fc1c6f9 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -1117,7 +1117,8 @@ int EE_SELECTION_TOOL::UnselectAll( const TOOL_EVENT& aEvent ) for( SCH_SHEET_PIN* pin : sheet->GetPins() ) { EDA_ITEM* item = dynamic_cast( pin ); - if( Selectable( item ) ) + + if( item && Selectable( item ) ) unselect( item ); } } diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index 350d3745a0..37fccfcc38 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -70,6 +70,15 @@ #include #include +// We currently represent board units as integers. Any values that are +// larger or smaller than those board units represent undefined behavior for +// the system. We limit values to the largest usable +// i.e. std::numeric_limits::max(). +// However to avoid issues in comparisons, use a slightly smaller value +// Note also the usable limits are much smaller to avoid overflows in intermediate +// calculations. +constexpr double INT_LIMIT = std::numeric_limits::max() - 10; + using namespace PCB_KEYS_T; @@ -187,10 +196,7 @@ int PCB_PARSER::parseBoardUnits() // N.B. we currently represent board units as integers. Any values that are // larger or smaller than those board units represent undefined behavior for // the system. We limit values to the largest that is visible on the screen - // This is the diagonal distance of the full screen ~1.5m - constexpr double int_limit = - std::numeric_limits::max() * 0.7071; // 0.7071 = roughly 1/sqrt(2) - return KiROUND( Clamp( -int_limit, retval, int_limit ) ); + return KiROUND( Clamp( -INT_LIMIT, retval, INT_LIMIT ) ); } @@ -201,11 +207,7 @@ int PCB_PARSER::parseBoardUnits( const char* aExpected ) // N.B. we currently represent board units as integers. Any values that are // larger or smaller than those board units represent undefined behavior for // the system. We limit values to the largest that is visible on the screen - constexpr double int_limit = std::numeric_limits::max() * 0.7071; - - // Use here #KiROUND, not EKIROUND (see comments about them) when having a function as - // argument, because it will be called twice with #KIROUND. - return KiROUND( Clamp( -int_limit, retval, int_limit ) ); + return KiROUND( Clamp( -INT_LIMIT, retval, INT_LIMIT ) ); }