TextMate is a graphical text editor for OS X 10.7+
Revision | 6e70305c5d7f1d9a11f5583b4a19cdc1987a161c (tree) |
---|---|
Zeit | 2012-08-19 04:28:56 |
Autor | jtbandes <jtbandes@gmai...> |
Commiter | Allan Odgaard |
Move border drawing to OakDocumentView
This allows the border to appear properly when scrolling (with a multitouch device) bounces past the end of the content.
@@ -332,20 +332,17 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel | ||
332 | 332 | - (void)drawRect:(NSRect)aRect |
333 | 333 | { |
334 | 334 | [self.enclosingScrollView.backgroundColor set]; |
335 | - NSRectFill(NSIntersectionRect(aRect, NSOffsetRect(self.frame, -1, 0))); | |
336 | - | |
337 | - [[NSColor grayColor] set]; | |
338 | - NSRectFill(NSIntersectionRect(aRect, NSOffsetRect(self.frame, NSWidth(self.frame)-1, 0))); | |
335 | + NSRectFill(NSIntersectionRect(aRect, self.frame)); | |
339 | 336 | |
340 | 337 | [self setupSelectionRects]; |
341 | 338 | |
342 | 339 | [[self.enclosingScrollView.backgroundColor highlightWithLevel:0.5] set]; |
343 | 340 | iterate(rect, backgroundRects) |
344 | - NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, NSOffsetRect(self.frame, -1, 0)))); | |
341 | + NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, self.frame))); | |
345 | 342 | |
346 | 343 | [[NSColor grayColor] set]; |
347 | 344 | iterate(rect, borderRects) |
348 | - NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, NSOffsetRect(self.frame, -1, 0)))); | |
345 | + NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, self.frame))); | |
349 | 346 | |
350 | 347 | std::pair<NSUInteger, NSUInteger> prevLine(NSNotFound, 0); |
351 | 348 | for(CGFloat y = NSMinY(aRect); y < NSMaxY(aRect); ) |
@@ -387,7 +384,7 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel | ||
387 | 384 | |
388 | 385 | static const CGFloat columnPadding = 1; |
389 | 386 | |
390 | - CGFloat currentX = 0, totalWidth = 1; // we start at 1 to account for the right border | |
387 | + CGFloat currentX = 0, totalWidth = 0; | |
391 | 388 | iterate(it, columnDataSources) |
392 | 389 | { |
393 | 390 | it->x0 = currentX; |
@@ -86,7 +86,7 @@ private: | ||
86 | 86 | |
87 | 87 | CGFloat gutterViewWidth = 40; |
88 | 88 | |
89 | - NSRect textScrollViewFrame = NSMakeRect(gutterViewWidth, OakStatusBarHeight, NSWidth(aRect)-gutterViewWidth, NSHeight(aRect)-OakStatusBarHeight); | |
89 | + NSRect textScrollViewFrame = NSMakeRect(gutterViewWidth+1, OakStatusBarHeight, NSWidth(aRect)-gutterViewWidth-1, NSHeight(aRect)-OakStatusBarHeight); | |
90 | 90 | NSSize textViewSize = [NSScrollView contentSizeForFrameSize:textScrollViewFrame.size hasHorizontalScroller:YES hasVerticalScroller:YES borderType:NSNoBorder]; |
91 | 91 | |
92 | 92 | textScrollView = [[NSScrollView alloc] initWithFrame:textScrollViewFrame]; |
@@ -372,6 +372,11 @@ private: | ||
372 | 372 | [[NSColor grayColor] set]; |
373 | 373 | NSRectFill(NSIntersectionRect(NSMakeRect(NSMinX(aRect), NSHeight(self.frame) - height, NSWidth(aRect), 1), aRect)); |
374 | 374 | } |
375 | + | |
376 | + // Draw the border between gutter and text views | |
377 | + [[NSColor grayColor] set]; | |
378 | + NSRect gutterFrame = gutterView.frame; | |
379 | + NSRectFill(NSMakeRect(NSMaxX(gutterFrame), OakStatusBarHeight, 1, NSHeight(self.frame)-OakStatusBarHeight)); | |
375 | 380 | } |
376 | 381 | |
377 | 382 | // ====================== |