• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

TextMate is a graphical text editor for OS X 10.7+


Commit MetaInfo

Revision6e70305c5d7f1d9a11f5583b4a19cdc1987a161c (tree)
Zeit2012-08-19 04:28:56
Autorjtbandes <jtbandes@gmai...>
CommiterAllan Odgaard

Log Message

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.

Ändern Zusammenfassung

Diff

--- a/Frameworks/OakTextView/src/GutterView.mm
+++ b/Frameworks/OakTextView/src/GutterView.mm
@@ -332,20 +332,17 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel
332332 - (void)drawRect:(NSRect)aRect
333333 {
334334 [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));
339336
340337 [self setupSelectionRects];
341338
342339 [[self.enclosingScrollView.backgroundColor highlightWithLevel:0.5] set];
343340 iterate(rect, backgroundRects)
344- NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, NSOffsetRect(self.frame, -1, 0))));
341+ NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, self.frame)));
345342
346343 [[NSColor grayColor] set];
347344 iterate(rect, borderRects)
348- NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, NSOffsetRect(self.frame, -1, 0))));
345+ NSRectFill(NSIntersectionRect(*rect, NSIntersectionRect(aRect, self.frame)));
349346
350347 std::pair<NSUInteger, NSUInteger> prevLine(NSNotFound, 0);
351348 for(CGFloat y = NSMinY(aRect); y < NSMaxY(aRect); )
@@ -387,7 +384,7 @@ static void DrawText (std::string const& text, CGRect const& rect, CGFloat basel
387384
388385 static const CGFloat columnPadding = 1;
389386
390- CGFloat currentX = 0, totalWidth = 1; // we start at 1 to account for the right border
387+ CGFloat currentX = 0, totalWidth = 0;
391388 iterate(it, columnDataSources)
392389 {
393390 it->x0 = currentX;
--- a/Frameworks/OakTextView/src/OakDocumentView.mm
+++ b/Frameworks/OakTextView/src/OakDocumentView.mm
@@ -86,7 +86,7 @@ private:
8686
8787 CGFloat gutterViewWidth = 40;
8888
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);
9090 NSSize textViewSize = [NSScrollView contentSizeForFrameSize:textScrollViewFrame.size hasHorizontalScroller:YES hasVerticalScroller:YES borderType:NSNoBorder];
9191
9292 textScrollView = [[NSScrollView alloc] initWithFrame:textScrollViewFrame];
@@ -372,6 +372,11 @@ private:
372372 [[NSColor grayColor] set];
373373 NSRectFill(NSIntersectionRect(NSMakeRect(NSMinX(aRect), NSHeight(self.frame) - height, NSWidth(aRect), 1), aRect));
374374 }
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));
375380 }
376381
377382 // ======================