diff options
-rw-r--r-- | cocoa/PlatCocoa.mm | 16 | ||||
-rw-r--r-- | cocoa/ScintillaCocoa.mm | 11 |
2 files changed, 14 insertions, 13 deletions
diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index da87a7b13..a0a0e8943 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -52,7 +52,9 @@ NSRect PRectangleToNSRect(PRectangle& rc) */ PRectangle NSRectToPRectangle(NSRect& rc) { - return PRectangle(rc.origin.x, rc.origin.y, rc.size.width + rc.origin.x, rc.size.height + rc.origin.y); + return PRectangle(rc.origin.x, rc.origin.y, + static_cast<XYPOSITION>(NSMaxX(rc)), + static_cast<XYPOSITION>(NSMaxY(rc))); } //-------------------------------------------------------------------------------------------------- @@ -1148,11 +1150,11 @@ PRectangle Window::GetPosition() win = reinterpret_cast<NSWindow*>(idWin); rect = [win frame]; } - int screenHeight = ScreenMax(win); + CGFloat screenHeight = ScreenMax(win); // Invert screen positions to match Scintilla return PRectangle( - NSMinX(rect), screenHeight - NSMaxY(rect), - NSMaxX(rect), screenHeight - NSMinY(rect)); + NSMinX(rect), static_cast<XYPOSITION>(screenHeight - NSMaxY(rect)), + NSMaxX(rect), static_cast<XYPOSITION>(screenHeight - NSMinY(rect))); } else { @@ -1336,11 +1338,11 @@ PRectangle Window::GetMonitorRect(Point) NSWindow* win = reinterpret_cast<NSWindow*>(idWin); NSScreen* screen = [win screen]; NSRect rect = [screen frame]; - int screenHeight = rect.origin.y + rect.size.height; + CGFloat screenHeight = rect.origin.y + rect.size.height; // Invert screen positions to match Scintilla return PRectangle( - NSMinX(rect), screenHeight - NSMaxY(rect), - NSMaxX(rect), screenHeight - NSMinY(rect)); + NSMinX(rect), static_cast<XYPOSITION>(screenHeight - NSMaxY(rect)), + NSMaxX(rect), static_cast<XYPOSITION>(screenHeight - NSMinY(rect))); } } return PRectangle(); diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index 7e86d86f1..621f43f3e 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -693,7 +693,7 @@ Scintilla::Point ScintillaCocoa::GetVisibleOriginInMain() { NSScrollView *scrollView = ScrollContainer(); NSRect contentRect = [[scrollView contentView] bounds]; - return Point(contentRect.origin.x, contentRect.origin.y); + return Point(static_cast<XYPOSITION>(contentRect.origin.x), static_cast<XYPOSITION>(contentRect.origin.y)); } //-------------------------------------------------------------------------------------------------- @@ -722,8 +722,7 @@ PRectangle ScintillaCocoa::GetClientDrawingRectangle() { 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 NSRectToPRectangle(rcPrepared); } #endif return ScintillaCocoa::GetClientRectangle(); @@ -741,7 +740,7 @@ Scintilla::Point ScintillaCocoa::ConvertPoint(NSPoint point) NSView* container = ContentView(); NSPoint result = [container convertPoint: point fromView: nil]; Scintilla::Point ptOrigin = GetVisibleOriginInMain(); - return Point(result.x - ptOrigin.x, result.y - ptOrigin.y); + return Point(static_cast<XYPOSITION>(result.x - ptOrigin.x), static_cast<XYPOSITION>(result.y - ptOrigin.y)); } //-------------------------------------------------------------------------------------------------- @@ -1061,7 +1060,7 @@ void ScintillaCocoa::CTPaint(void* gc, NSRect rc) { void ScintillaCocoa::CallTipMouseDown(NSPoint pt) { NSRect rectBounds = [(NSView *)(ct.wDraw.GetID()) bounds]; - Point location(pt.x, rectBounds.size.height - pt.y); + Point location(pt.x, static_cast<XYPOSITION>(rectBounds.size.height - pt.y)); ct.MouseClick(location); CallTipClick(); } @@ -1301,7 +1300,7 @@ void ScintillaCocoa::StartDrag() CGContextTranslateCTM(gc, 0, imageRect.Height()); CGContextScaleCTM(gc, 1.0, -1.0); - pixmap->CopyImageRectangle(*sw, imageRect, PRectangle(0, 0, imageRect.Width(), imageRect.Height())); + pixmap->CopyImageRectangle(*sw, imageRect, PRectangle(0.0f, 0.0f, imageRect.Width(), imageRect.Height())); // XXX TODO: overwrite any part of the image that is not part of the // selection to make it transparent. right now we just use // the full rectangle which may include non-selected text. |