diff options
| author | Neil <nyamatongwe@gmail.com> | 2018-04-05 19:08:40 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2018-04-05 19:08:40 +1000 | 
| commit | 0f2bb6479b09bf0c6c537bdd67654c6c4b6b011c (patch) | |
| tree | 3ce644cc85aa9b11a6524904771cee2b41feaec6 /src | |
| parent | 837ca0527d7fa9286cae4755038e458d4f0e2a02 (diff) | |
| download | scintilla-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')
| -rw-r--r-- | src/EditView.cxx | 8 | ||||
| -rw-r--r-- | src/EditView.h | 4 | ||||
| -rw-r--r-- | src/Editor.cxx | 38 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 4 | 
4 files changed, 20 insertions, 34 deletions
| diff --git a/src/EditView.cxx b/src/EditView.cxx index 2bb107e0b..37a6a9f9e 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -190,14 +190,6 @@ EditView::EditView() {  EditView::~EditView() {  } -PRectangle EditView::ViewRectangle() const { -	return rectangleView; -} - -void EditView::SetViewRectangle(PRectangle rectangle) { -	rectangleView = rectangle; -} -  bool EditView::SetTwoPhaseDraw(bool twoPhaseDraw) {  	const PhasesDraw phasesDrawNew = twoPhaseDraw ? phasesTwo : phasesOne;  	const bool redraw = phasesDraw != phasesDrawNew; diff --git a/src/EditView.h b/src/EditView.h index 5e7a6d29a..8a194236d 100644 --- a/src/EditView.h +++ b/src/EditView.h @@ -47,7 +47,6 @@ typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid);  */  class EditView {  public: -	PRectangle rectangleView;  	PrintParameters printParameters;  	std::unique_ptr<PerLine> ldTabstops;  	int tabWidthMinimumPixels; @@ -94,9 +93,6 @@ public:  	void operator=(const EditView &) = delete;  	virtual ~EditView(); -	PRectangle ViewRectangle() const; -	void SetViewRectangle(PRectangle rectangle); -  	bool SetTwoPhaseDraw(bool twoPhaseDraw);  	bool SetPhasesDraw(int phases);  	bool LinesOverlap() const; 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);  } diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index da569d490..febc4f11f 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -261,7 +261,7 @@ void ScintillaBase::AutoCompleteStart(Sci::Position lenEntered, const char *list  	ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(),  				lenEntered, vs.lineHeight, IsUnicodeMode(), technology); -	const PRectangle rcClient = view.ViewRectangle(); +	const PRectangle rcClient = GetClientRectangle();  	Point pt = LocationFromPosition(sel.MainCaret() - lenEntered);  	PRectangle rcPopupBounds = wMain.GetMonitorRect(pt);  	if (rcPopupBounds.Height() == 0) @@ -477,7 +477,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {  		wMain);  	// If the call-tip window would be out of the client  	// space -	const PRectangle rcClient = view.ViewRectangle(); +	const PRectangle rcClient = GetClientRectangle();  	const int offset = vs.lineHeight + static_cast<int>(rc.Height());  	// adjust so it displays above the text.  	if (rc.bottom > rcClient.bottom && rc.Height() < rcClient.Height()) { | 
