From 68d456d0d0b273805bc0bc5f7472ac63e172e0a7 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 9 Jan 2002 12:01:59 +0000 Subject: Optimization that asks for the position of the scroll bar and does not set it if it does not change. Using scroll bar APIs that allow larger 32 bit values. --- win32/ScintillaWin.cxx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'win32') diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 1293d0737..ccf7402a1 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -847,12 +847,25 @@ void ScintillaWin::ScrollText(int linesToMove) { ::UpdateWindow(MainHWND()); } +// Change the scroll position but avoid repaint if changing to same value +static void ChangeScrollPos(HWND w, int barType, int pos) { + SCROLLINFO sci = { + sizeof(sci),0,0,0,0,0,0 + }; + sci.fMask = SIF_POS; + ::GetScrollInfo(w, barType, &sci); + if (sci.nPos != pos) { + sci.nPos = pos; + ::SetScrollInfo(w, barType, &sci, TRUE); + } +} + void ScintillaWin::SetVerticalScrollPos() { - ::SetScrollPos(MainHWND(), SB_VERT, topLine, TRUE); + ChangeScrollPos(MainHWND(), SB_VERT, topLine); } void ScintillaWin::SetHorizontalScrollPos() { - ::SetScrollPos(MainHWND(), SB_HORZ, xOffset, TRUE); + ChangeScrollPos(MainHWND(), SB_HORZ, xOffset); } bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) { -- cgit v1.2.3