Module: wine
Branch: master
Commit: 963407a9ef315e42efd6fa9b74cfe564077f161f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=963407a9ef315e42efd6fa9b7…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com>
Date: Tue Feb 24 02:39:03 2009 -0500
richedit: EM_SHOWSCROLLBAR hides scrollbars for less than page of text.
When all the text fits on the screen, the scrollbars are not shown from
EM_SHOWSCROLLBAR. The message instead adds support for the specified
scrollbar when lParam is TRUE, so that the scrollbar will be shown when
sufficient text is in the document.
---
dlls/riched20/editor.c | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index 8af973c..4bfc9c2 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3156,12 +3156,18 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return 0;
}
- if (lParam)
+ if (lParam) {
editor->styleFlags |= flags;
- else
- editor->styleFlags &= flags;
-
- ITextHost_TxShowScrollBar(editor->texthost, wParam, lParam);
+ if (flags & WS_HSCROLL)
+ ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
+ editor->nTotalWidth > editor->sizeWindow.cx);
+ if (flags & WS_VSCROLL)
+ ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
+ editor->nTotalLength > editor->sizeWindow.cy);
+ } else {
+ editor->styleFlags &= ~flags;
+ ITextHost_TxShowScrollBar(editor->texthost, wParam, FALSE);
+ }
return 0;
}
case EM_SETTEXTEX:
Module: wine
Branch: master
Commit: 5f51221d9c1b94040ef354e7f62a0ce9a838cdab
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5f51221d9c1b94040ef354e7f…
Author: Dylan Smith <dylan.ah.smith(a)gmail.com>
Date: Tue Feb 24 02:38:49 2009 -0500
richedit: Fixed scrollbar visiblility calculation after SetScrollInfo.
The scrollbar visibility can be changed from SetScrollRange or
SetScrollInfo, but the visiblity that is a result of these calls are
not consistent with the calculation made by richedit controls to
decide whether to show or hide the scrollbars.
---
dlls/riched20/paint.c | 22 ++++++++++++++++------
1 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c
index f235082..620ac69 100644
--- a/dlls/riched20/paint.c
+++ b/dlls/riched20/paint.c
@@ -1111,6 +1111,18 @@ void ME_ScrollRight(ME_TextEditor *editor, int cx)
ME_HScrollAbs(editor, editor->horz_si.nPos + cx);
}
+/* Calculates the visiblity after a call to SetScrollRange or
+ * SetScrollInfo with SIF_RANGE. */
+static BOOL ME_PostSetScrollRangeVisibility(SCROLLINFO *si)
+{
+ if (si->fMask & SIF_DISABLENOSCROLL)
+ return TRUE;
+
+ /* This must match the check in SetScrollInfo to determine whether
+ * to show or hide the scrollbars. */
+ return si->nMin < si->nMax - max(si->nPage - 1, 0);
+}
+
void ME_UpdateScrollBar(ME_TextEditor *editor)
{
/* Note that this is the only function that should ever call
@@ -1158,15 +1170,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
ITextHost_TxSetScrollRange(editor->texthost, SB_HORZ, si.nMin, si.nMax, FALSE);
ITextHost_TxSetScrollPos(editor->texthost, SB_HORZ, si.nPos, TRUE);
}
+ /* SetScrollInfo or SetScrollRange change scrollbar visibility. */
+ bScrollBarWasVisible = ME_PostSetScrollRangeVisibility(&si);
}
}
if (si.fMask & SIF_DISABLENOSCROLL) {
bScrollBarWillBeVisible = TRUE;
} else if (!(editor->styleFlags & WS_HSCROLL)) {
- /* SetScrollInfo or SetScrollRange may cause the scrollbar to be
- * shown, so hide the scrollbar if necessary. */
- bScrollBarWasVisible = bScrollBarWillBeVisible;
bScrollBarWillBeVisible = FALSE;
}
@@ -1205,15 +1216,14 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, si.nMin, si.nMax, FALSE);
ITextHost_TxSetScrollPos(editor->texthost, SB_VERT, si.nPos, TRUE);
}
+ /* SetScrollInfo or SetScrollRange change scrollbar visibility. */
+ bScrollBarWasVisible = ME_PostSetScrollRangeVisibility(&si);
}
}
if (si.fMask & SIF_DISABLENOSCROLL) {
bScrollBarWillBeVisible = TRUE;
} else if (!(editor->styleFlags & WS_VSCROLL)) {
- /* SetScrollInfo or SetScrollRange may cause the scrollbar to be
- * shown, so hide the scrollbar if necessary. */
- bScrollBarWasVisible = bScrollBarWillBeVisible;
bScrollBarWillBeVisible = FALSE;
}