richedit: Keep scrollbars hidden without WS_HSCROLL & WS_VSCROLL.
This commit is contained in:
parent
eddccdd1f2
commit
f59e41e8d5
|
@ -1061,22 +1061,28 @@ void ME_ScrollAbs(ME_TextEditor *editor, int x, int y)
|
||||||
if (editor->hWnd)
|
if (editor->hWnd)
|
||||||
{
|
{
|
||||||
LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
|
LONG winStyle = GetWindowLongW(editor->hWnd, GWL_STYLE);
|
||||||
bScrollBarIsVisible = (winStyle & WS_HSCROLL) != 0;
|
if (editor->styleFlags & WS_HSCROLL)
|
||||||
bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx
|
{
|
||||||
&& (editor->styleFlags & WS_HSCROLL))
|
bScrollBarIsVisible = (winStyle & WS_HSCROLL) != 0;
|
||||||
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
bScrollBarWillBeVisible = (editor->nTotalWidth > editor->sizeWindow.cx
|
||||||
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
&& (editor->styleFlags & WS_HSCROLL))
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
|
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
||||||
bScrollBarWillBeVisible);
|
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
||||||
|
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ,
|
||||||
|
bScrollBarWillBeVisible);
|
||||||
|
}
|
||||||
|
|
||||||
bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0;
|
if (editor->styleFlags & WS_VSCROLL)
|
||||||
bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy
|
{
|
||||||
&& (editor->styleFlags & WS_VSCROLL)
|
bScrollBarIsVisible = (winStyle & WS_VSCROLL) != 0;
|
||||||
&& (editor->styleFlags & ES_MULTILINE))
|
bScrollBarWillBeVisible = (editor->nTotalLength > editor->sizeWindow.cy
|
||||||
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
&& (editor->styleFlags & WS_VSCROLL)
|
||||||
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
&& (editor->styleFlags & ES_MULTILINE))
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
|| (editor->styleFlags & ES_DISABLENOSCROLL);
|
||||||
bScrollBarWillBeVisible);
|
if (bScrollBarIsVisible != bScrollBarWillBeVisible)
|
||||||
|
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
||||||
|
bScrollBarWillBeVisible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ME_UpdateScrollBar(editor);
|
ME_UpdateScrollBar(editor);
|
||||||
}
|
}
|
||||||
|
@ -1136,6 +1142,7 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
|
||||||
|
|
||||||
si.cbSize = sizeof(si);
|
si.cbSize = sizeof(si);
|
||||||
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
|
si.fMask = SIF_PAGE | SIF_RANGE | SIF_POS;
|
||||||
|
si.nMin = 0;
|
||||||
if (editor->styleFlags & ES_DISABLENOSCROLL)
|
if (editor->styleFlags & ES_DISABLENOSCROLL)
|
||||||
si.fMask |= SIF_DISABLENOSCROLL;
|
si.fMask |= SIF_DISABLENOSCROLL;
|
||||||
|
|
||||||
|
@ -1150,20 +1157,19 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
si.nMin = 0;
|
|
||||||
si.nMax = editor->nTotalWidth;
|
si.nMax = editor->nTotalWidth;
|
||||||
si.nPos = editor->horz_si.nPos;
|
si.nPos = editor->horz_si.nPos;
|
||||||
si.nPage = editor->sizeWindow.cx;
|
si.nPage = editor->sizeWindow.cx;
|
||||||
|
|
||||||
if (si.nMin != editor->horz_si.nMin ||
|
if (si.nMax != editor->horz_si.nMax ||
|
||||||
si.nMax != editor->horz_si.nMax ||
|
|
||||||
si.nPage != editor->horz_si.nPage)
|
si.nPage != editor->horz_si.nPage)
|
||||||
{
|
{
|
||||||
TRACE("min=%d max=%d page=%d\n", si.nMin, si.nMax, si.nPage);
|
TRACE("min=%d max=%d page=%d\n", si.nMin, si.nMax, si.nPage);
|
||||||
editor->horz_si.nMin = si.nMin;
|
|
||||||
editor->horz_si.nMax = si.nMax;
|
editor->horz_si.nMax = si.nMax;
|
||||||
editor->horz_si.nPage = si.nPage;
|
editor->horz_si.nPage = si.nPage;
|
||||||
if (bScrollBarWillBeVisible || bScrollBarWasVisible) {
|
if ((bScrollBarWillBeVisible || bScrollBarWasVisible) &&
|
||||||
|
editor->styleFlags & WS_HSCROLL)
|
||||||
|
{
|
||||||
if (editor->hWnd) {
|
if (editor->hWnd) {
|
||||||
SetScrollInfo(editor->hWnd, SB_HORZ, &si, TRUE);
|
SetScrollInfo(editor->hWnd, SB_HORZ, &si, TRUE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1175,14 +1181,17 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (si.fMask & SIF_DISABLENOSCROLL) {
|
if (editor->styleFlags & WS_HSCROLL)
|
||||||
bScrollBarWillBeVisible = TRUE;
|
{
|
||||||
} else if (!(editor->styleFlags & WS_HSCROLL)) {
|
if (si.fMask & SIF_DISABLENOSCROLL) {
|
||||||
bScrollBarWillBeVisible = FALSE;
|
bScrollBarWillBeVisible = TRUE;
|
||||||
}
|
} else if (!(editor->styleFlags & WS_HSCROLL)) {
|
||||||
|
bScrollBarWillBeVisible = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, bScrollBarWillBeVisible);
|
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, bScrollBarWillBeVisible);
|
||||||
|
}
|
||||||
|
|
||||||
/* Update vertical scrollbar */
|
/* Update vertical scrollbar */
|
||||||
bScrollBarWasVisible = editor->vert_si.nMax > editor->vert_si.nPage;
|
bScrollBarWasVisible = editor->vert_si.nMax > editor->vert_si.nPage;
|
||||||
|
@ -1201,15 +1210,15 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
|
||||||
si.nPos = editor->vert_si.nPos;
|
si.nPos = editor->vert_si.nPos;
|
||||||
si.nPage = editor->sizeWindow.cy;
|
si.nPage = editor->sizeWindow.cy;
|
||||||
|
|
||||||
if (si.nMin != editor->vert_si.nMin ||
|
if (si.nMax != editor->vert_si.nMax ||
|
||||||
si.nMax != editor->vert_si.nMax ||
|
|
||||||
si.nPage != editor->vert_si.nPage)
|
si.nPage != editor->vert_si.nPage)
|
||||||
{
|
{
|
||||||
TRACE("min=%d max=%d page=%d\n", si.nMin, si.nMax, si.nPage);
|
TRACE("min=%d max=%d page=%d\n", si.nMin, si.nMax, si.nPage);
|
||||||
editor->vert_si.nMin = si.nMin;
|
|
||||||
editor->vert_si.nMax = si.nMax;
|
editor->vert_si.nMax = si.nMax;
|
||||||
editor->vert_si.nPage = si.nPage;
|
editor->vert_si.nPage = si.nPage;
|
||||||
if (bScrollBarWillBeVisible || bScrollBarWasVisible) {
|
if ((bScrollBarWillBeVisible || bScrollBarWasVisible) &&
|
||||||
|
editor->styleFlags & WS_VSCROLL)
|
||||||
|
{
|
||||||
if (editor->hWnd) {
|
if (editor->hWnd) {
|
||||||
SetScrollInfo(editor->hWnd, SB_VERT, &si, TRUE);
|
SetScrollInfo(editor->hWnd, SB_VERT, &si, TRUE);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1221,15 +1230,18 @@ void ME_UpdateScrollBar(ME_TextEditor *editor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (si.fMask & SIF_DISABLENOSCROLL) {
|
if (editor->styleFlags & WS_VSCROLL)
|
||||||
bScrollBarWillBeVisible = TRUE;
|
{
|
||||||
} else if (!(editor->styleFlags & WS_VSCROLL)) {
|
if (si.fMask & SIF_DISABLENOSCROLL) {
|
||||||
bScrollBarWillBeVisible = FALSE;
|
bScrollBarWillBeVisible = TRUE;
|
||||||
}
|
} else if (!(editor->styleFlags & WS_VSCROLL)) {
|
||||||
|
bScrollBarWillBeVisible = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
if (bScrollBarWasVisible != bScrollBarWillBeVisible)
|
||||||
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT,
|
||||||
bScrollBarWillBeVisible);
|
bScrollBarWillBeVisible);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
|
void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
|
||||||
|
|
Loading…
Reference in New Issue