aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2018-04-05 19:08:40 +1000
committerNeil <nyamatongwe@gmail.com>2018-04-05 19:08:40 +1000
commit0f2bb6479b09bf0c6c537bdd67654c6c4b6b011c (patch)
tree3ce644cc85aa9b11a6524904771cee2b41feaec6 /src/Editor.cxx
parent837ca0527d7fa9286cae4755038e458d4f0e2a02 (diff)
downloadscintilla-mirror-0f2bb6479b09bf0c6c537bdd67654c6c4b6b011c.tar.gz
Backed out changeset: 7402342dc7a3 Caching client rectangle on EditView.
This change was not compatible with Cocoa as it uses document-based coordinates rather than view-based.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 05756f6f1..80e32d1ae 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -310,18 +310,18 @@ PRectangle Editor::GetClientRectangle() const {
}
PRectangle Editor::GetClientDrawingRectangle() {
- return view.ViewRectangle();
+ return GetClientRectangle();
}
PRectangle Editor::GetTextRectangle() const {
- PRectangle rc = view.ViewRectangle();
+ PRectangle rc = GetClientRectangle();
rc.left += vs.textStart;
rc.right -= vs.rightMarginWidth;
return rc;
}
Sci::Line Editor::LinesOnScreen() const {
- const PRectangle rcClient = view.ViewRectangle();
+ const PRectangle rcClient = GetClientRectangle();
const int htClient = static_cast<int>(rcClient.bottom - rcClient.top);
//Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1);
return htClient / vs.lineHeight;
@@ -453,7 +453,7 @@ void Editor::RedrawRect(PRectangle rc) {
//Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom);
// Clip the redraw rectangle into the client area
- const PRectangle rcClient = view.ViewRectangle();
+ const PRectangle rcClient = GetClientRectangle();
if (rc.top < rcClient.top)
rc.top = rcClient.top;
if (rc.bottom > rcClient.bottom)
@@ -474,7 +474,7 @@ void Editor::DiscardOverdraw() {
void Editor::Redraw() {
//Platform::DebugPrintf("Redraw all\n");
- const PRectangle rcClient = view.ViewRectangle();
+ const PRectangle rcClient = GetClientRectangle();
wMain.InvalidateRectangle(rcClient);
if (wMargin.GetID())
wMargin.InvalidateAll();
@@ -492,7 +492,7 @@ void Editor::RedrawSelMargin(Sci::Line line, bool allAfter) {
Redraw();
return;
}
- PRectangle rcMarkers = view.ViewRectangle();
+ PRectangle rcMarkers = GetClientRectangle();
if (!markersInText) {
// Normal case: just draw the margin
rcMarkers.right = rcMarkers.left + vs.fixedColumnWidth;
@@ -946,7 +946,7 @@ void Editor::ScrollTo(Sci::Line line, bool moveThumb) {
SetTopLine(topLineNew);
// Optimize by styling the view as this will invalidate any needed area
// which could abort the initial paint if discovered later.
- StyleAreaBounded(view.ViewRectangle(), true);
+ StyleAreaBounded(GetClientRectangle(), true);
#ifndef UNDER_CE
// Perform redraw rather than scroll if many lines would be redrawn anyway.
if (performBlit) {
@@ -977,7 +977,7 @@ void Editor::HorizontalScrollTo(int xPos) {
xOffset = xPos;
ContainerNeedsUpdate(SC_UPDATE_H_SCROLL);
SetHorizontalScrollPos();
- RedrawRect(view.ViewRectangle());
+ RedrawRect(GetClientRectangle());
}
}
@@ -988,7 +988,7 @@ void Editor::VerticalCentreCaret() {
const Sci::Line newTop = lineDisplay - (LinesOnScreen() / 2);
if (topLine != newTop) {
SetTopLine(newTop > 0 ? newTop : 0);
- RedrawRect(view.ViewRectangle());
+ RedrawRect(GetClientRectangle());
}
}
@@ -1543,7 +1543,7 @@ bool Editor::WrapLines(WrapScope ws) {
if (lineToWrap < lineToWrapEnd) {
- PRectangle rcTextArea = view.ViewRectangle();
+ PRectangle rcTextArea = GetClientRectangle();
rcTextArea.left = static_cast<XYPOSITION>(vs.textStart);
rcTextArea.right -= vs.rightMarginWidth;
wrapWidth = static_cast<int>(rcTextArea.Width());
@@ -1655,7 +1655,7 @@ void Editor::PaintSelMargin(Surface *surfaceWindow, PRectangle &rc) {
return;
}
- PRectangle rcMargin = view.ViewRectangle();
+ PRectangle rcMargin = GetClientRectangle();
const Point ptOrigin = GetVisibleOriginInMain();
rcMargin.Move(0, -ptOrigin.y);
rcMargin.left = 0;
@@ -1688,7 +1688,7 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) {
view.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs);
marginView.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs);
if (view.bufferedDraw) {
- const PRectangle rcClient = view.ViewRectangle();
+ const PRectangle rcClient = GetClientRectangle();
if (!view.pixmapLine->Initialised()) {
view.pixmapLine->InitPixMap(static_cast<int>(rcClient.Width()), vs.lineHeight,
@@ -1715,7 +1715,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
StyleAreaBounded(rcArea, false);
- const PRectangle rcClient = view.ViewRectangle();
+ const PRectangle rcClient = GetClientRectangle();
//Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d) %d\n",
// rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
@@ -1839,10 +1839,8 @@ void Editor::SetScrollBars() {
void Editor::ChangeSize() {
DropGraphics(false);
SetScrollBars();
- const PRectangle rectangleClientArea = GetClientRectangle();
- view.SetViewRectangle(rectangleClientArea);
if (Wrapping()) {
- PRectangle rcTextArea = rectangleClientArea;
+ PRectangle rcTextArea = GetClientRectangle();
rcTextArea.left = static_cast<XYPOSITION>(vs.textStart);
rcTextArea.right -= vs.rightMarginWidth;
if (wrapWidth != rcTextArea.Width()) {
@@ -4363,7 +4361,7 @@ bool Editor::PointInSelection(Point pt) {
bool Editor::PointInSelMargin(Point pt) const {
// Really means: "Point in a margin"
if (vs.fixedColumnWidth > 0) { // There is a margin
- PRectangle rcSelMargin = view.ViewRectangle();
+ PRectangle rcSelMargin = GetClientRectangle();
rcSelMargin.right = static_cast<XYPOSITION>(vs.textStart - vs.leftMarginWidth);
rcSelMargin.left = static_cast<XYPOSITION>(vs.textStart - vs.fixedColumnWidth);
const Point ptOrigin = GetVisibleOriginInMain();
@@ -4746,7 +4744,7 @@ void Editor::ButtonMoveWithModifiers(Point pt, unsigned int, int modifiers) {
}
ptMouseLast = pt;
- PRectangle rcClient = view.ViewRectangle();
+ PRectangle rcClient = GetClientRectangle();
const Point ptOrigin = GetVisibleOriginInMain();
rcClient.Move(0, -ptOrigin.y);
if ((dwellDelay < SC_TIME_FOREVER) && rcClient.Contains(pt)) {
@@ -5096,7 +5094,7 @@ void Editor::StyleAreaBounded(PRectangle rcArea, bool scrolling) {
}
void Editor::IdleStyling() {
- const Sci::Position posAfterArea = PositionAfterArea(view.ViewRectangle());
+ const Sci::Position posAfterArea = PositionAfterArea(GetClientRectangle());
const Sci::Position endGoal = (idleStyling >= SC_IDLESTYLING_AFTERVISIBLE) ?
static_cast<Sci::Position>(pdoc->Length()) : posAfterArea;
const Sci::Position posAfterMax = PositionAfterMaxStyling(endGoal, false);
@@ -5134,7 +5132,7 @@ bool Editor::PaintContainsMargin() {
// never contains margin.
return false;
}
- PRectangle rcSelMargin = view.ViewRectangle();
+ PRectangle rcSelMargin = GetClientRectangle();
rcSelMargin.right = static_cast<XYPOSITION>(vs.textStart);
return PaintContains(rcSelMargin);
}