diff options
Diffstat (limited to 'cocoa')
-rw-r--r-- | cocoa/ScintillaCocoa.h | 3 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 17 |
2 files changed, 17 insertions, 3 deletions
diff --git a/cocoa/ScintillaCocoa.h b/cocoa/ScintillaCocoa.h index 4c1f10a97..f8c3357e0 100644 --- a/cocoa/ScintillaCocoa.h +++ b/cocoa/ScintillaCocoa.h @@ -103,6 +103,8 @@ private: bool isFirstResponder; bool isActive; + Point sizeClient; + bool enteredSetScrollingSize; bool GetPasteboardData(NSPasteboard *board, SelectionText *selectedText); @@ -118,6 +120,7 @@ private: protected: Point GetVisibleOriginInMain() const override; + Point ClientSize() const override; PRectangle GetClientRectangle() const override; PRectangle GetClientDrawingRectangle() override; Point ConvertPoint(NSPoint point); diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 4f4fa1b71..223c9dac0 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -732,15 +732,22 @@ Scintilla::Internal::Point ScintillaCocoa::GetVisibleOriginInMain() const { //-------------------------------------------------------------------------------------------------- /** + * Return the size of the client area which has been cached. + */ +Scintilla::Internal::Point ScintillaCocoa::ClientSize() const { + return sizeClient; +} + +//-------------------------------------------------------------------------------------------------- + +/** * Instead of returning the size of the inner view we have to return the visible part of it * in order to make scrolling working properly. * The returned value is in document coordinates. */ PRectangle ScintillaCocoa::GetClientRectangle() const { NSScrollView *scrollView = ScrollContainer(); - NSSize size = scrollView.contentView.bounds.size; - Point origin = GetVisibleOriginInMain(); - return PRectangle(origin.x, origin.y, origin.x+size.width, origin.y + size.height); + return NSRectToPRectangle(scrollView.contentView.bounds); } //-------------------------------------------------------------------------------------------------- @@ -2033,6 +2040,10 @@ bool ScintillaCocoa::SetScrollingSize() { void ScintillaCocoa::Resize() { SetScrollingSize(); + + const PRectangle rcClient = GetClientRectangle(); + sizeClient = Point(rcClient.Width(), rcClient.Height()); + ChangeSize(); } |