diff options
author | Neil <nyamatongwe@gmail.com> | 2020-07-16 09:27:55 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2020-07-16 09:27:55 +1000 |
commit | 97782cf42d51d2834a9a92f460a1cb7d483f09d7 (patch) | |
tree | 7612f060f90404a275dde3aa13b04ced62191bd5 | |
parent | 86fc59c515f92eb9407e5f981eab1f4d04a6d97e (diff) | |
download | scintilla-mirror-97782cf42d51d2834a9a92f460a1cb7d483f09d7.tar.gz |
Backport: Rename validLevel to ValidLevel and make an enum class.
Backport of changeset 8412:999c4c848b8f.
-rw-r--r-- | src/EditView.cxx | 16 | ||||
-rw-r--r-- | src/Editor.cxx | 8 | ||||
-rw-r--r-- | src/PositionCache.cxx | 10 | ||||
-rw-r--r-- | src/PositionCache.h | 6 |
4 files changed, 20 insertions, 20 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index b90dd05b8..cd7695620 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -387,7 +387,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa if (posLineEnd >(posLineStart + ll->maxLineLength)) { posLineEnd = posLineStart + ll->maxLineLength; } - if (ll->validity == LineLayout::llCheckTextAndStyle) { + if (ll->validity == LineLayout::ValidLevel::checkTextAndStyle) { Sci::Position lineLength = posLineEnd - posLineStart; if (!vstyle.viewEOL) { lineLength = model.pdoc->LineEnd(line) - posLineStart; @@ -412,15 +412,15 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa } allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled if (allSame) { - ll->validity = LineLayout::llPositions; + ll->validity = LineLayout::ValidLevel::positions; } else { - ll->validity = LineLayout::llInvalid; + ll->validity = LineLayout::ValidLevel::invalid; } } else { - ll->validity = LineLayout::llInvalid; + ll->validity = LineLayout::ValidLevel::invalid; } } - if (ll->validity == LineLayout::llInvalid) { + if (ll->validity == LineLayout::ValidLevel::invalid) { ll->widthLine = LineLayout::wrapWidthInfinite; ll->lines = 1; if (vstyle.edgeState == EDGE_BACKGROUND) { @@ -504,13 +504,13 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa } ll->numCharsInLine = numCharsInLine; ll->numCharsBeforeEOL = numCharsBeforeEOL; - ll->validity = LineLayout::llPositions; + ll->validity = LineLayout::ValidLevel::positions; } // Hard to cope when too narrow, so just assume there is space if (width < 20) { width = 20; } - if ((ll->validity == LineLayout::llPositions) || (ll->widthLine != width)) { + if ((ll->validity == LineLayout::ValidLevel::positions) || (ll->widthLine != width)) { ll->widthLine = width; if (width == LineLayout::wrapWidthInfinite) { ll->lines = 1; @@ -593,7 +593,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa } ll->lines++; } - ll->validity = LineLayout::llLines; + ll->validity = LineLayout::ValidLevel::lines; } } diff --git a/src/Editor.cxx b/src/Editor.cxx index dad2bf8bb..35bcec9d7 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -273,7 +273,7 @@ void Editor::InvalidateStyleData() { vs.technology = technology; DropGraphics(false); AllocateGraphics(); - view.llc.Invalidate(LineLayout::llInvalid); + view.llc.Invalidate(LineLayout::ValidLevel::invalid); view.posCache.Clear(); } @@ -1473,7 +1473,7 @@ bool Editor::Wrapping() const noexcept { void Editor::NeedWrapping(Sci::Line docLineStart, Sci::Line docLineEnd) { //Platform::DebugPrintf("\nNeedWrapping: %0d..%0d\n", docLineStart, docLineEnd); if (wrapPending.AddRange(docLineStart, docLineEnd)) { - view.llc.Invalidate(LineLayout::llPositions); + view.llc.Invalidate(LineLayout::ValidLevel::positions); } // Wrap lines during idle. if (Wrapping() && wrapPending.NeedsWrap()) { @@ -2524,7 +2524,7 @@ void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) { void Editor::CheckModificationForWrap(DocModification mh) { if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { - view.llc.Invalidate(LineLayout::llCheckTextAndStyle); + view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle); const Sci::Line lineDoc = pdoc->SciLineFromPosition(mh.position); const Sci::Line lines = std::max(static_cast<Sci::Line>(0), mh.linesAdded); if (Wrapping()) { @@ -2603,7 +2603,7 @@ void Editor::NotifyModified(Document *, DocModification mh, void *) { } } if (mh.modificationType & SC_MOD_CHANGESTYLE) { - view.llc.Invalidate(LineLayout::llCheckTextAndStyle); + view.llc.Invalidate(LineLayout::ValidLevel::checkTextAndStyle); } } else { // Move selection and brace highlights diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx index 06e3586f2..bb581d84a 100644 --- a/src/PositionCache.cxx +++ b/src/PositionCache.cxx @@ -54,7 +54,7 @@ LineLayout::LineLayout(int maxLineLength_) : maxLineLength(-1), numCharsInLine(0), numCharsBeforeEOL(0), - validity(llInvalid), + validity(ValidLevel::invalid), xHighlightGuide(0), highlightColumn(false), containsCaret(false), @@ -90,7 +90,7 @@ void LineLayout::Free() noexcept { lineStarts.reset(); } -void LineLayout::Invalidate(validLevel validity_) noexcept { +void LineLayout::Invalidate(ValidLevel validity_) noexcept { if (validity > validity_) validity = validity_; } @@ -289,14 +289,14 @@ void LineLayoutCache::Deallocate() noexcept { cache.clear(); } -void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) noexcept { +void LineLayoutCache::Invalidate(LineLayout::ValidLevel validity_) noexcept { if (!cache.empty() && !allInvalidated) { for (const std::unique_ptr<LineLayout> &ll : cache) { if (ll) { ll->Invalidate(validity_); } } - if (validity_ == LineLayout::llInvalid) { + if (validity_ == LineLayout::ValidLevel::invalid) { allInvalidated = true; } } @@ -314,7 +314,7 @@ LineLayout *LineLayoutCache::Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, Sci::Line linesOnScreen, Sci::Line linesInDoc) { AllocateForLevel(linesOnScreen, linesInDoc); if (styleClock != styleClock_) { - Invalidate(LineLayout::llCheckTextAndStyle); + Invalidate(LineLayout::ValidLevel::checkTextAndStyle); styleClock = styleClock_; } allInvalidated = false; diff --git a/src/PositionCache.h b/src/PositionCache.h index 9ff3e1239..9647255d6 100644 --- a/src/PositionCache.h +++ b/src/PositionCache.h @@ -60,7 +60,7 @@ public: int maxLineLength; int numCharsInLine; int numCharsBeforeEOL; - enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity; + enum class ValidLevel { invalid, checkTextAndStyle, positions, lines } validity; int xHighlightGuide; bool highlightColumn; bool containsCaret; @@ -87,7 +87,7 @@ public: virtual ~LineLayout(); void Resize(int maxLineLength_); void Free() noexcept; - void Invalidate(validLevel validity_) noexcept; + void Invalidate(ValidLevel validity_) noexcept; int LineStart(int line) const noexcept; int LineLength(int line) const noexcept; enum class Scope { visibleOnly, includeEnd }; @@ -129,7 +129,7 @@ public: llcPage=SC_CACHE_PAGE, llcDocument=SC_CACHE_DOCUMENT }; - void Invalidate(LineLayout::validLevel validity_) noexcept; + void Invalidate(LineLayout::ValidLevel validity_) noexcept; void SetLevel(int level_) noexcept; int GetLevel() const noexcept { return level; } LineLayout *Retrieve(Sci::Line lineNumber, Sci::Line lineCaret, int maxChars, int styleClock_, |