diff options
author | nyamatongwe <unknown> | 2011-01-02 18:02:04 +1100 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-01-02 18:02:04 +1100 |
commit | c11b33236bcd09928bce17eaef11951a77a84abe (patch) | |
tree | 4eeeda4fd565f6b42a5b79d72a2c6d47ac6e9768 /src/Editor.cxx | |
parent | 2be32592356710eda9419a86da5d85e36a1c8cda (diff) | |
download | scintilla-mirror-c11b33236bcd09928bce17eaef11951a77a84abe.tar.gz |
Send SCN_UPDATEUI notification when view scrolled. Satisfies feature request #3125977.
Also includes an updated field in notification so that updates of no interest can be
easily ignored.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r-- | src/Editor.cxx | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index e9a30ee72..89c67b433 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -175,7 +175,8 @@ Editor::Editor() { lengthForEncode = -1; - needUpdateUI = true; + needUpdateUI = 0; + ContainerNeedsUpdate(SC_UPDATE_CONTENT); braces[0] = invalidPosition; braces[1] = invalidPosition; bracesMatchStyle = STYLE_BRACEBAD; @@ -434,7 +435,10 @@ int Editor::LineFromLocation(Point pt) { } void Editor::SetTopLine(int topLineNew) { - topLine = topLineNew; + if (topLine != topLineNew) { + topLine = topLineNew; + ContainerNeedsUpdate(SC_UPDATE_V_SCROLL); + } posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine)); } @@ -741,7 +745,7 @@ void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSel lastAffected = Platform::Maximum(lastAffected, sel.Range(r).anchor.Position()); } } - needUpdateUI = true; + ContainerNeedsUpdate(SC_UPDATE_SELECTION); InvalidateRange(firstAffected, lastAffected); } @@ -982,6 +986,7 @@ void Editor::HorizontalScrollTo(int xPos) { xPos = 0; if ((wrapState == eWrapNone) && (xOffset != xPos)) { xOffset = xPos; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); SetHorizontalScrollPos(); RedrawRect(GetClientRectangle()); } @@ -1291,6 +1296,7 @@ void Editor::SetXYScroll(XYScrollPosition newXY) { } if (newXY.xOffset != xOffset) { xOffset = newXY.xOffset; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); if (newXY.xOffset > 0) { PRectangle rcText = GetTextRectangle(); if (horizontalScrollBarVisible && @@ -3307,7 +3313,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { surfaceWindow->SetPalette(&palTemp, true); NotifyUpdateUI(); - needUpdateUI = false; + needUpdateUI = 0; RefreshStyleData(); RefreshPixMaps(surfaceWindow); @@ -4213,6 +4219,7 @@ void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool void Editor::NotifyUpdateUI() { SCNotification scn = {0}; scn.nmhdr.code = SCN_UPDATEUI; + scn.updated = needUpdateUI; NotifyParent(scn); } @@ -4329,7 +4336,7 @@ static inline int MovePositionForDeletion(int position, int startDeletion, int l } void Editor::NotifyModified(Document *, DocModification mh, void *) { - needUpdateUI = true; + ContainerNeedsUpdate(SC_UPDATE_CONTENT); if (paintState == painting) { CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); } @@ -4611,6 +4618,11 @@ void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lPar NotifyParent(scn); } +// Something has changed that the container should know about +void Editor::ContainerNeedsUpdate(int flags) { + needUpdateUI |= flags; +} + /** * Force scroll and keep position relative to top of window. * @@ -6338,7 +6350,7 @@ void Editor::IdleStyling() { if (needUpdateUI) { NotifyUpdateUI(); - needUpdateUI = false; + needUpdateUI = 0; } styleNeeded.Reset(); } @@ -6995,6 +7007,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETXOFFSET: xOffset = wParam; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); SetHorizontalScrollPos(); Redraw(); break; @@ -7459,6 +7472,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; } xOffset = 0; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); InvalidateStyleRedraw(); ReconfigureScrollBars(); break; |