aboutsummaryrefslogtreecommitdiffhomepage
path: root/cocoa/ScintillaCocoa.mm
diff options
context:
space:
mode:
Diffstat (limited to 'cocoa/ScintillaCocoa.mm')
-rw-r--r--cocoa/ScintillaCocoa.mm51
1 files changed, 51 insertions, 0 deletions
diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm
index f9e67f7b4..c5f24fcd6 100644
--- a/cocoa/ScintillaCocoa.mm
+++ b/cocoa/ScintillaCocoa.mm
@@ -714,6 +714,22 @@ PRectangle ScintillaCocoa::GetClientRectangle()
//--------------------------------------------------------------------------------------------------
/**
+ * Allow for prepared rectangle
+ */
+PRectangle ScintillaCocoa::GetClientDrawingRectangle() {
+ SCIContentView *content = ContentView();
+ if ([content respondsToSelector: @selector(setPreparedContentRect:)]) {
+ NSRect rcPrepared = [content preparedContentRect];
+ if (!NSIsEmptyRect(rcPrepared))
+ return PRectangle(rcPrepared.origin.x, rcPrepared.origin.y,
+ rcPrepared.origin.x+rcPrepared.size.width, rcPrepared.origin.y + rcPrepared.size.height);
+ }
+ return ScintillaCocoa::GetClientRectangle();
+}
+
+//--------------------------------------------------------------------------------------------------
+
+/**
* Converts the given point from base coordinates to local coordinates and at the same time into
* a native Point structure. Base coordinates are used for the top window used in the view hierarchy.
* Returned value is in view coordinates.
@@ -739,12 +755,24 @@ void ScintillaCocoa::RedrawRect(PRectangle rc)
//--------------------------------------------------------------------------------------------------
+void ScintillaCocoa::DiscardOverdraw()
+{
+ // If running on 10.9, reset prepared area to visible area
+ SCIContentView *content = ContentView();
+ if ([content respondsToSelector: @selector(setPreparedContentRect:)]) {
+ content.preparedContentRect = [content visibleRect];
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+
/**
* Ensure all of prepared content is also redrawn.
*/
void ScintillaCocoa::Redraw()
{
wMargin.InvalidateAll();
+ DiscardOverdraw();
wMain.InvalidateAll();
}
@@ -1563,6 +1591,29 @@ void ScintillaCocoa::PaintMargin(NSRect aRect)
//--------------------------------------------------------------------------------------------------
/**
+ * Prepare for drawing.
+ *
+ * @param rect The area that will be drawn, given in the sender's coordinate system.
+ */
+void ScintillaCocoa::WillDraw(NSRect rect)
+{
+ RefreshStyleData();
+ PRectangle rcWillDraw = NSRectToPRectangle(rect);
+ int positionAfterRect = PositionAfterArea(rcWillDraw);
+ pdoc->EnsureStyledTo(positionAfterRect);
+ NotifyUpdateUI();
+ if (WrapLines(wsVisible)) {
+ // Wrap may have reduced number of lines so more lines may need to be styled
+ positionAfterRect = PositionAfterArea(rcWillDraw);
+ pdoc->EnsureStyledTo(positionAfterRect);
+ // The wrapping process has changed the height of some lines so redraw all.
+ Redraw();
+ }
+}
+
+//--------------------------------------------------------------------------------------------------
+
+/**
* ScrollText is empty because scrolling is handled by the NSScrollView.
*/
void ScintillaCocoa::ScrollText(int linesToMove)