Fix setting the scrollbar positions (SF Bug #721159)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20318 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-04-23 21:04:26 +00:00
parent 465b213606
commit 1bc54e3257
2 changed files with 22 additions and 12 deletions

View File

@@ -253,18 +253,23 @@ void ScintillaWX::SetHorizontalScrollPos() {
} }
} }
const int H_SCROLL_STEP = 20; const int H_SCROLL_STEP = 20;
bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) { bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
bool modified = false; bool modified = false;
int vertEnd = nMax;
if (!verticalScrollBarVisible)
vertEnd = 0;
// Check the vertical scrollbar // Check the vertical scrollbar
if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar
int sbMax = stc->GetScrollRange(wxVERTICAL); int sbMax = stc->GetScrollRange(wxVERTICAL);
int sbThumb = stc->GetScrollThumb(wxVERTICAL); int sbThumb = stc->GetScrollThumb(wxVERTICAL);
int sbPos = stc->GetScrollPos(wxVERTICAL); int sbPos = stc->GetScrollPos(wxVERTICAL);
if (sbMax != nMax || sbThumb != nPage) { if (sbMax != vertEnd || sbThumb != nPage) {
stc->SetScrollbar(wxVERTICAL, sbPos, nPage, nMax+1); stc->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd+1);
modified = true; modified = true;
} }
} }
@@ -272,8 +277,8 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbMax = stc->m_vScrollBar->GetRange(); int sbMax = stc->m_vScrollBar->GetRange();
int sbPage = stc->m_vScrollBar->GetPageSize(); int sbPage = stc->m_vScrollBar->GetPageSize();
int sbPos = stc->m_vScrollBar->GetThumbPosition(); int sbPos = stc->m_vScrollBar->GetThumbPosition();
if (sbMax != nMax || sbPage != nPage) { if (sbMax != vertEnd || sbPage != nPage) {
stc->m_vScrollBar->SetScrollbar(sbPos, nPage, nMax+1, nPage); stc->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd+1, nPage);
modified = true; modified = true;
} }
} }
@@ -293,7 +298,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbThumb = stc->GetScrollThumb(wxHORIZONTAL); int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
int sbPos = stc->GetScrollPos(wxHORIZONTAL); int sbPos = stc->GetScrollPos(wxHORIZONTAL);
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) { if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
stc->SetScrollbar(wxHORIZONTAL, 0, pageWidth, horizEnd); stc->SetScrollbar(wxHORIZONTAL, sbPos, pageWidth, horizEnd);
modified = true; modified = true;
if (scrollWidth < pageWidth) { if (scrollWidth < pageWidth) {
HorizontalScrollTo(0); HorizontalScrollTo(0);
@@ -305,7 +310,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbThumb = stc->m_hScrollBar->GetPageSize(); int sbThumb = stc->m_hScrollBar->GetPageSize();
int sbPos = stc->m_hScrollBar->GetThumbPosition(); int sbPos = stc->m_hScrollBar->GetThumbPosition();
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) { if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
stc->m_hScrollBar->SetScrollbar(0, pageWidth, horizEnd, pageWidth); stc->m_hScrollBar->SetScrollbar(sbPos, pageWidth, horizEnd, pageWidth);
modified = true; modified = true;
if (scrollWidth < pageWidth) { if (scrollWidth < pageWidth) {
HorizontalScrollTo(0); HorizontalScrollTo(0);

View File

@@ -253,18 +253,23 @@ void ScintillaWX::SetHorizontalScrollPos() {
} }
} }
const int H_SCROLL_STEP = 20; const int H_SCROLL_STEP = 20;
bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) { bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
bool modified = false; bool modified = false;
int vertEnd = nMax;
if (!verticalScrollBarVisible)
vertEnd = 0;
// Check the vertical scrollbar // Check the vertical scrollbar
if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar if (stc->m_vScrollBar == NULL) { // Use built-in scrollbar
int sbMax = stc->GetScrollRange(wxVERTICAL); int sbMax = stc->GetScrollRange(wxVERTICAL);
int sbThumb = stc->GetScrollThumb(wxVERTICAL); int sbThumb = stc->GetScrollThumb(wxVERTICAL);
int sbPos = stc->GetScrollPos(wxVERTICAL); int sbPos = stc->GetScrollPos(wxVERTICAL);
if (sbMax != nMax || sbThumb != nPage) { if (sbMax != vertEnd || sbThumb != nPage) {
stc->SetScrollbar(wxVERTICAL, sbPos, nPage, nMax+1); stc->SetScrollbar(wxVERTICAL, sbPos, nPage, vertEnd+1);
modified = true; modified = true;
} }
} }
@@ -272,8 +277,8 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbMax = stc->m_vScrollBar->GetRange(); int sbMax = stc->m_vScrollBar->GetRange();
int sbPage = stc->m_vScrollBar->GetPageSize(); int sbPage = stc->m_vScrollBar->GetPageSize();
int sbPos = stc->m_vScrollBar->GetThumbPosition(); int sbPos = stc->m_vScrollBar->GetThumbPosition();
if (sbMax != nMax || sbPage != nPage) { if (sbMax != vertEnd || sbPage != nPage) {
stc->m_vScrollBar->SetScrollbar(sbPos, nPage, nMax+1, nPage); stc->m_vScrollBar->SetScrollbar(sbPos, nPage, vertEnd+1, nPage);
modified = true; modified = true;
} }
} }
@@ -293,7 +298,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbThumb = stc->GetScrollThumb(wxHORIZONTAL); int sbThumb = stc->GetScrollThumb(wxHORIZONTAL);
int sbPos = stc->GetScrollPos(wxHORIZONTAL); int sbPos = stc->GetScrollPos(wxHORIZONTAL);
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) { if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
stc->SetScrollbar(wxHORIZONTAL, 0, pageWidth, horizEnd); stc->SetScrollbar(wxHORIZONTAL, sbPos, pageWidth, horizEnd);
modified = true; modified = true;
if (scrollWidth < pageWidth) { if (scrollWidth < pageWidth) {
HorizontalScrollTo(0); HorizontalScrollTo(0);
@@ -305,7 +310,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) {
int sbThumb = stc->m_hScrollBar->GetPageSize(); int sbThumb = stc->m_hScrollBar->GetPageSize();
int sbPos = stc->m_hScrollBar->GetThumbPosition(); int sbPos = stc->m_hScrollBar->GetThumbPosition();
if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) { if ((sbMax != horizEnd) || (sbThumb != pageWidth) || (sbPos != 0)) {
stc->m_hScrollBar->SetScrollbar(0, pageWidth, horizEnd, pageWidth); stc->m_hScrollBar->SetScrollbar(sbPos, pageWidth, horizEnd, pageWidth);
modified = true; modified = true;
if (scrollWidth < pageWidth) { if (scrollWidth < pageWidth) {
HorizontalScrollTo(0); HorizontalScrollTo(0);