don't skip the scroll position validity check in CalcScrollInc() if m_[xy]ScrollPixelsPerLine is NULL, this resulted in problems mentioned in patch 1696082

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-04-08 23:06:42 +00:00
parent 600b3983e9
commit 2e9c0c010a

View File

@@ -613,49 +613,36 @@ int wxScrollHelper::CalcScrollInc(wxScrollWinEvent& event)
if (orient == wxHORIZONTAL) if (orient == wxHORIZONTAL)
{ {
if (m_xScrollPixelsPerLine > 0) if ( m_xScrollPosition + nScrollInc < 0 )
{ {
if ( m_xScrollPosition + nScrollInc < 0 ) // As -ve as we can go
nScrollInc = -m_xScrollPosition;
}
else // check for the other bound
{
const int posMax = m_xScrollLines - m_xScrollLinesPerPage;
if ( m_xScrollPosition + nScrollInc > posMax )
{ {
// As -ve as we can go // As +ve as we can go
nScrollInc = -m_xScrollPosition; nScrollInc = posMax - m_xScrollPosition;
}
else // check for the other bound
{
const int posMax = m_xScrollLines - m_xScrollLinesPerPage;
if ( m_xScrollPosition + nScrollInc > posMax )
{
// As +ve as we can go
nScrollInc = posMax - m_xScrollPosition;
}
} }
} }
else
m_targetWindow->Refresh(true, GetScrollRect());
} }
else else // wxVERTICAL
{ {
if ( m_yScrollPixelsPerLine > 0 ) if ( m_yScrollPosition + nScrollInc < 0 )
{ {
if ( m_yScrollPosition + nScrollInc < 0 ) // As -ve as we can go
{ nScrollInc = -m_yScrollPosition;
// As -ve as we can go
nScrollInc = -m_yScrollPosition;
}
else // check for the other bound
{
const int posMax = m_yScrollLines - m_yScrollLinesPerPage;
if ( m_yScrollPosition + nScrollInc > posMax )
{
// As +ve as we can go
nScrollInc = posMax - m_yScrollPosition;
}
}
} }
else else // check for the other bound
{ {
// VZ: why do we do this? (FIXME) const int posMax = m_yScrollLines - m_yScrollLinesPerPage;
m_targetWindow->Refresh(true, GetScrollRect()); if ( m_yScrollPosition + nScrollInc > posMax )
{
// As +ve as we can go
nScrollInc = posMax - m_yScrollPosition;
}
} }
} }