mirror of
https://github.com/textmate/textmate.git
synced 2026-04-06 03:01:29 -04:00
Move spelling dot to OakTextView
We now load the image via NSImage and creates a CGImageRef from that (based on the current graphics context). This ensures we get the @2px version when on a HiDPI display.
This commit is contained in:
|
Before Width: | Height: | Size: 109 B After Width: | Height: | Size: 109 B |
|
Before Width: | Height: | Size: 163 B After Width: | Height: | Size: 163 B |
@@ -38,6 +38,8 @@ PUBLIC @interface OakTextView : OakView <NSTextInput, NSTextFieldDelegate>
|
||||
BOOL hideCaret;
|
||||
NSTimer* blinkCaretTimer;
|
||||
|
||||
NSImage* spellingDotImage;
|
||||
|
||||
// =================
|
||||
// = Mouse Support =
|
||||
// =================
|
||||
|
||||
@@ -435,6 +435,8 @@ static std::string shell_quote (std::vector<std::string> paths)
|
||||
showInvisibles = settings.get(kSettingsShowInvisiblesKey, false);
|
||||
antiAlias = ![[NSUserDefaults standardUserDefaults] boolForKey:kUserDefaultsDisableAntiAliasKey];
|
||||
|
||||
spellingDotImage = [[NSImage imageNamed:@"SpellingDot" inSameBundleAsClass:[self class]] retain];
|
||||
|
||||
[self registerForDraggedTypes:[[self class] dropTypes]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(documentWillSave:) name:@"OakDocumentNotificationWillSave" object:nil];
|
||||
@@ -448,6 +450,7 @@ static std::string shell_quote (std::vector<std::string> paths)
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
[liveSearchString release];
|
||||
[self setDocument:document::document_ptr()];
|
||||
[spellingDotImage release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@@ -579,7 +582,7 @@ static std::string shell_quote (std::vector<std::string> paths)
|
||||
CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
|
||||
if(!antiAlias)
|
||||
CGContextSetShouldAntialias(context, false);
|
||||
layout->draw(context, aRect, [self isFlipped], showInvisibles, merge(editor->ranges(), [self markedRanges]), liveSearchRanges);
|
||||
layout->draw(ng::context_t(context, [spellingDotImage CGImageForProposedRect:NULL context:[NSGraphicsContext currentContext] hints:nil]), aRect, [self isFlipped], showInvisibles, merge(editor->ranges(), [self markedRanges]), liveSearchRanges);
|
||||
}
|
||||
|
||||
// ===============
|
||||
|
||||
Reference in New Issue
Block a user