diff --git a/src/MacVim/DBPrefsWindowController.m b/src/MacVim/DBPrefsWindowController.m index 5887ab80c1..74a5b46ac3 100644 --- a/src/MacVim/DBPrefsWindowController.m +++ b/src/MacVim/DBPrefsWindowController.m @@ -75,14 +75,14 @@ - (void)windowDidLoad // Create a new window to display the preference views. // If the developer attached a window to this controller // in Interface Builder, it gets replaced with this one. - NSPanel *window = [[[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000) + NSPanel *window = [[NSPanel alloc] initWithContentRect:NSMakeRect(0,0,1000,1000) styleMask:(NSWindowStyleMaskTitled | NSWindowStyleMaskClosable) backing:NSBackingStoreBuffered - defer:YES] autorelease]; + defer:YES]; [window setHidesOnDeactivate:NO]; [self setWindow:window]; - contentSubview = [[[NSView alloc] initWithFrame:[[[self window] contentView] frame]] autorelease]; + contentSubview = [[NSView alloc] initWithFrame:[[[self window] contentView] frame]]; [contentSubview setAutoresizingMask:(NSViewMinYMargin | NSViewWidthSizable)]; [[[self window] contentView] addSubview:contentSubview]; [[self window] setShowsToolbarButton:NO]; @@ -91,13 +91,6 @@ - (void)windowDidLoad -- (void) dealloc { - [toolbarIdentifiers release]; - [toolbarViews release]; - [toolbarItems release]; - [viewAnimation release]; - [super dealloc]; -} @@ -130,12 +123,12 @@ - (void)addView:(NSView *)view label:(NSString *)label image:(NSImage *)image NSAssert (view != nil, @"Attempted to add a nil view when calling -addView:label:image:."); - NSString *identifier = [[label copy] autorelease]; + NSString *identifier = [label copy]; [toolbarIdentifiers addObject:identifier]; [toolbarViews setObject:view forKey:identifier]; - NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:identifier] autorelease]; + NSToolbarItem *item = [[NSToolbarItem alloc] initWithItemIdentifier:identifier]; [item setLabel:label]; [item setImage:image]; [item setTarget:self]; @@ -227,7 +220,6 @@ - (IBAction)showWindow:(id)sender [toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel]; [toolbar setDelegate:self]; [[self window] setToolbar:toolbar]; - [toolbar release]; } if ([toolbarItems objectForKey:[self currentPaneIdentifier]] == nil) { diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 8a70dec11f..dedc2ccc19 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -42,6 +42,7 @@ #import "MMVimController.h" #import "MMWindowController.h" #import "MMTextView.h" +#import "MMVimView.h" #import "Miscellaneous.h" #import "Sparkle.framework/Headers/Sparkle.h" #import @@ -297,7 +298,7 @@ - (id)init [[NSBundle mainBundle] bundlePath]]; if (![connection registerName:name]) { ASLogCrit(@"Failed to register connection with name '%@'", name); - [connection release]; connection = nil; + connection = nil; } // Register help search handler to support search Vim docs via the Help menu @@ -315,22 +316,6 @@ - (id)init - (void)dealloc { ASLogDebug(@""); - - [connection release]; connection = nil; - [inputQueues release]; inputQueues = nil; - [pidArguments release]; pidArguments = nil; - [vimControllers release]; vimControllers = nil; - [cachedVimControllers release]; cachedVimControllers = nil; - [openSelectionString release]; openSelectionString = nil; - [recentFilesMenuItem release]; recentFilesMenuItem = nil; - [defaultMainMenu release]; defaultMainMenu = nil; - currentMainMenu = nil; - [appMenuItemTemplate release]; appMenuItemTemplate = nil; -#if !DISABLE_SPARKLE - [updater release]; updater = nil; -#endif - - [super dealloc]; } - (void)applicationWillFinishLaunching:(NSNotification *)notification @@ -342,7 +327,7 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification // Remember the default menu so that it can be restored if the user closes // all editor windows. - defaultMainMenu = [[NSApp mainMenu] retain]; + defaultMainMenu = [NSApp mainMenu]; // Store a copy of the default app menu so we can use this as a template // for all other menus. We make a copy here because the "Services" menu @@ -368,14 +353,12 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification int idx = [fileMenu indexOfItemWithAction:@selector(fileOpen:)]; if (idx >= 0 && idx+1 < [fileMenu numberOfItems]) - recentFilesMenuItem = [fileMenu itemWithTag:15432]; - [[recentFilesMenuItem submenu] performSelector:@selector(_setMenuName:) - withObject:@"NSRecentDocumentsMenu"]; - // Note: The "Recent Files" menu must be moved around since there is no // -[NSApp setRecentFilesMenu:] method. We keep a reference to it to // facilitate this move (see setMainMenu: below). - [recentFilesMenuItem retain]; + recentFilesMenuItem = [fileMenu itemWithTag:15432]; + [[recentFilesMenuItem submenu] performSelector:@selector(_setMenuName:) + withObject:@"NSRecentDocumentsMenu"]; } #if MM_HANDLE_XCODE_MOD_EVENT @@ -568,8 +551,6 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: if ([alert runModal] != NSAlertFirstButtonReturn) reply = NSTerminateCancel; - - [alert release]; } else if (![[NSUserDefaults standardUserDefaults] boolForKey:MMSuppressTerminationAlertKey]) { // No unmodified buffers, but give a warning if there are multiple @@ -627,7 +608,6 @@ - (NSApplicationTerminateReply)applicationShouldTerminate: setBool:YES forKey:MMSuppressTerminationAlertKey]; } - [alert release]; } } @@ -747,10 +727,8 @@ - (void)removeVimController:(id)controller return; } - [controller retain]; [vimControllers removeObjectAtIndex:idx]; [controller cleanup]; - [controller release]; if (![vimControllers count]) { // The last editor window just closed so restore the main menu back to @@ -861,7 +839,6 @@ - (void)windowControllerWillOpen:(MMWindowController *)windowController // There is some text to paste into this window as a result of the // services menu "Open selection ..." being used. [[windowController vimController] dropString:openSelectionString]; - [openSelectionString release]; openSelectionString = nil; } @@ -908,7 +885,7 @@ - (void)refreshMainMenu // of Screen" to the Window menu, and on repeated calls it will keep adding // the same item over and over again, without resolving for duplicates. Using // copies help keep the source menu clean. - NSMenu *mainMenu = [[currentMainMenu copy] autorelease]; + NSMenu *mainMenu = [currentMainMenu copy]; // If the new menu has a "Recent Files" dummy item, then swap the real item // for the dummy. We are forced to do this since Cocoa initializes the @@ -919,19 +896,17 @@ - (void)refreshMainMenu int dummyIdx = [fileMenu indexOfItemWithAction:@selector(recentFilesDummy:)]; if (dummyIdx >= 0) { - NSMenuItem *dummyItem = [[fileMenu itemAtIndex:dummyIdx] retain]; + NSMenuItem *dummyItem = [fileMenu itemAtIndex:dummyIdx]; [fileMenu removeItemAtIndex:dummyIdx]; NSMenu *recentFilesParentMenu = [recentFilesMenuItem menu]; int idx = [recentFilesParentMenu indexOfItem:recentFilesMenuItem]; if (idx >= 0) { - [[recentFilesMenuItem retain] autorelease]; [recentFilesParentMenu removeItemAtIndex:idx]; [recentFilesParentMenu insertItem:dummyItem atIndex:idx]; } [fileMenu insertItem:recentFilesMenuItem atIndex:dummyIdx]; - [dummyItem release]; } } @@ -977,7 +952,7 @@ - (BOOL)openFiles:(NSArray *)filenames withArguments:(NSDictionary *)args // arguments for each launching process can be looked up by its PID (in the // pidArguments dictionary). - NSMutableDictionary *arguments = (args ? [[args mutableCopy] autorelease] + NSMutableDictionary *arguments = (args ? [args mutableCopy] : [NSMutableDictionary dictionary]); filenames = normalizeFilenames(filenames); @@ -1078,7 +1053,7 @@ - (BOOL)openFiles:(NSArray *)filenames withArguments:(NSDictionary *)args // NOTE: We have to copy the args since we'll mutate them in the // next loop and the below call may retain the arguments while // waiting for a process to start. - NSDictionary *args = [[arguments copy] autorelease]; + NSDictionary *args = [arguments copy]; openOk = [self openVimControllerWithArguments:args]; if (!openOk) break; @@ -1387,8 +1362,6 @@ - (unsigned)connectBackend:(byref in id )proxy pid:(int)pid modes:[NSArray arrayWithObject: NSDefaultRunLoopMode]]; - [vc release]; - return [vc vimControllerId]; } @@ -1470,7 +1443,7 @@ - (void)searchForItemsWithSearchString:(NSString *)searchString @synchronized (self) { if (!parsed) { - parsedLineComponents = [[NSMutableArray alloc]init]; + parsedLineComponents = [NSMutableArray array]; NSString *tagsFilePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"vim/runtime/doc/tags"]; @@ -1493,7 +1466,7 @@ - (void)searchForItemsWithSearchString:(NSString *)searchString // substring in the tag. Don't do fuzzy matching or regex for simplicity for now. NSArray *searchStrings = [searchString componentsSeparatedByString:@" "]; - NSMutableArray *ret = [[[NSMutableArray alloc]init] autorelease]; + NSMutableArray *ret = [NSMutableArray array]; for (NSArray *line in parsedLineComponents) { BOOL found = YES; for (NSString *curSearchString in searchStrings) { @@ -1565,7 +1538,6 @@ - (void)openSelection:(NSPasteboard *)pboard userData:(NSString *)userData // Save the text, open a new window, and paste the text when the next // window opens. (If this is called several times in a row, then all // but the last call may be ignored.) - if (openSelectionString) [openSelectionString release]; openSelectionString = [[pboard stringForType:NSStringPboardType] copy]; [self newWindow:self]; @@ -1784,7 +1756,6 @@ - (NSArray *)filterFilesAndNotify:(NSArray *)filenames [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; - [alert release]; [NSApp replyToOpenOrPrint:NSApplicationDelegateReplyFailure]; } @@ -1819,7 +1790,7 @@ - (NSArray *)filterOpenFiles:(NSArray *)filenames NSIndexSet *idxSet = [NSIndexSet indexSetWithVimList:eval]; if ([idxSet count] > 0) { [dict setObject:[files objectsAtIndexes:idxSet] - forKey:[NSValue valueWithPointer:vc]]; + forKey:[NSValue valueWithPointer:(__bridge void *)vc]]; // Remove all the files that were open in this Vim process and // create a new expression to evaluate. @@ -1833,7 +1804,7 @@ - (NSArray *)filterOpenFiles:(NSArray *)filenames if (openFiles != nil) *openFiles = dict; - return [files autorelease]; + return files; } #if MM_HANDLE_XCODE_MOD_EVENT @@ -1985,7 +1956,6 @@ - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; - [alert release]; } } else { NSAlert *alert = [[NSAlert alloc] init]; @@ -2001,7 +1971,6 @@ - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; - [alert release]; } } } else { @@ -2019,7 +1988,6 @@ - (void)handleGetURLEvent:(NSAppleEventDescriptor *)event [alert setAlertStyle:NSAlertStyleWarning]; [alert runModal]; - [alert release]; } } @@ -2338,7 +2306,7 @@ - (void)startWatchingVimDir NSArray *pathsToWatch = [NSArray arrayWithObject:path]; fsEventStream = FSEventStreamCreate(NULL, &fsEventCallback, NULL, - (CFArrayRef)pathsToWatch, kFSEventStreamEventIdSinceNow, + (__bridge CFArrayRef)pathsToWatch, kFSEventStreamEventIdSinceNow, MMEventStreamLatency, kFSEventStreamCreateFlagNone); FSEventStreamScheduleWithRunLoop(fsEventStream, @@ -2545,8 +2513,6 @@ - (void)processInputQueues:(id)sender } } - [queues release]; - // If new input arrived while we were processing it would have been // blocked so we have to schedule it to be processed again. if (processingFlag < 0) @@ -2612,7 +2578,7 @@ - (NSDictionary *)convertVimControllerArguments:(NSDictionary *)args return args; NSMutableArray *a = [NSMutableArray array]; - NSMutableDictionary *d = [[args mutableCopy] autorelease]; + NSMutableDictionary *d = [args mutableCopy]; // Search for text and highlight it (this Vim script avoids warnings in // case there is no match for the search text). diff --git a/src/MacVim/MMCoreTextView+ToolTip.m b/src/MacVim/MMCoreTextView+ToolTip.m index defc5d0d74..358e5f97b3 100644 --- a/src/MacVim/MMCoreTextView+ToolTip.m +++ b/src/MacVim/MMCoreTextView+ToolTip.m @@ -204,7 +204,6 @@ - (void)setToolTipAtMousePoint:(NSString *)string } if (oldToolTip) { [self _sendToolTipMouseExited]; - [oldToolTip release]; } toolTip_ = [toolTip copy]; if (toolTip) { @@ -225,7 +224,7 @@ - (NSString *)view:(NSView *)view point:(NSPoint)point userData:(void *)data { - return [[toolTip_ copy] autorelease]; + return [toolTip_ copy]; } @end diff --git a/src/MacVim/MMCoreTextView.m b/src/MacVim/MMCoreTextView.m index 19f5bfe1ed..d70fe334e7 100644 --- a/src/MacVim/MMCoreTextView.m +++ b/src/MacVim/MMCoreTextView.m @@ -114,7 +114,6 @@ - (void)invertBlockFromRow:(int)row column:(int)col numRows:(int)nrows // temporarily. NSLayoutManager *lm = [[NSLayoutManager alloc] init]; float height = [lm defaultLineHeightForFont:font]; - [lm release]; return height; } @@ -157,7 +156,7 @@ - (void)invertBlockFromRow:(int)row column:(int)col numRows:(int)nrows unsigned fg; unsigned sp; int textFlags; - NSString* string; // Owned by characterStrings. + __unsafe_unretained NSString* string; // Owned by characterStrings. } GridCell; typedef struct { @@ -191,14 +190,14 @@ static void grid_resize(Grid *grid, int rows, int cols) { size_t newSize = rows * cols; grid->cells = realloc(grid->cells, newSize * sizeof(GridCell)); if (newSize > oldSize) - bzero(grid->cells + oldSize, (newSize - oldSize) * sizeof(GridCell)); + bzero((void*)grid->cells + oldSize, (newSize - oldSize) * sizeof(GridCell)); } else { // Otherwise, allocate a new buffer. GridCell *oldCells = grid->cells; grid->cells = calloc(rows * cols, sizeof(GridCell)); if (oldCells) { for (int r = 1; r < MIN(grid->rows, rows); r++) - memcpy(grid->cells + cols * r, oldCells + grid->cols * r, MIN(grid->cols, cols) * sizeof(GridCell)); + memcpy((void*)grid->cells + cols * r, oldCells + grid->cols * r, MIN(grid->cols, cols) * sizeof(GridCell)); free(oldCells); } } @@ -247,20 +246,8 @@ - (id)initWithFrame:(NSRect)frame - (void)dealloc { - [font release]; font = nil; - [fontWide release]; fontWide = nil; - [defaultBackgroundColor release]; defaultBackgroundColor = nil; - [defaultForegroundColor release]; defaultForegroundColor = nil; - [fontVariants release]; fontVariants = nil; - [characterStrings release]; characterStrings = nil; - [characterLines release]; characterLines = nil; - [helper setTextView:nil]; - [helper release]; helper = nil; - grid_free(&grid); - - [super dealloc]; } - (int)maxRows @@ -290,8 +277,7 @@ - (void)setDefaultColorsBackground:(NSColor *)bgColor foreground:(NSColor *)fgColor { if (defaultBackgroundColor != bgColor) { - [defaultBackgroundColor release]; - defaultBackgroundColor = bgColor ? [bgColor retain] : nil; + defaultBackgroundColor = bgColor; self.needsDisplay = YES; } @@ -299,8 +285,7 @@ - (void)setDefaultColorsBackground:(NSColor *)bgColor // other class instances might want to be able to access it so it is stored // here. if (defaultForegroundColor != fgColor) { - [defaultForegroundColor release]; - defaultForegroundColor = fgColor ? [fgColor retain] : nil; + defaultForegroundColor = fgColor; } [self setNeedsDisplay:YES]; } @@ -408,7 +393,6 @@ - (void)setFont:(NSFont *)newFont const BOOL preserveLineHeight = [[NSUserDefaults standardUserDefaults] boolForKey:MMFontPreserveLineSpacingKey]; - [font release]; if (!preserveLineHeight) { double pt = round([newFont pointSize]); @@ -418,9 +402,9 @@ - (void)setFont:(NSFont *)newFont if (!fontRef) { ASLogInfo(@"CTFontCreateWithFontDescriptor failed (preserveLineHeight == false, fontName: %@), pt: %f", [newFont fontName], pt); } - font = (NSFont*)fontRef; + font = (NSFont*)CFBridgingRelease(fontRef); } else { - font = [newFont retain]; + font = newFont; } fontDescent = ceil(CTFontGetDescent((CTFontRef)font)); @@ -447,8 +431,7 @@ - (void)setWideFont:(NSFont *)newFont return; } } else if (newFont != fontWide) { - [fontWide release]; - fontWide = [newFont retain]; + fontWide = newFont; } [self clearAll]; @@ -796,7 +779,7 @@ - (void)drawRect:(NSRect)rect ASLogDebug(@"CTLineGetGlyphRuns no glyphs for: %@", lineString); } for (id obj in glyphRuns) { - CTRunRef run = (CTRunRef)obj; + CTRunRef run = (__bridge CTRunRef)obj; CFIndex glyphCount = CTRunGetGlyphCount(run); CFIndex indices[glyphCount]; CGPoint positions[glyphCount]; @@ -893,7 +876,6 @@ - (void)drawRect:(NSRect)rect c++; } flushLineString(); - [lineString release]; CGContextRestoreGState(ctx); } if (thinStrokes) { @@ -1136,9 +1118,9 @@ - (CTLineRef)lineForCharacterString:(NSString *)string NSNumber *key = @(cacheFlags); NSCache *strCache = characterLines[key]; if (!strCache){ - strCache = characterLines[key] = [[[NSCache alloc] init] autorelease]; + strCache = characterLines[key] = [[NSCache alloc] init]; } - CTLineRef line = (CTLineRef)[[strCache objectForKey:string] retain]; + CTLineRef line = (CTLineRef)CFBridgingRetain([strCache objectForKey:string]); if (!line) { NSAttributedString *attrString = [[NSAttributedString alloc] initWithString:string @@ -1148,10 +1130,10 @@ - (CTLineRef)lineForCharacterString:(NSString *)string (NSString *)kCTForegroundColorFromContextAttributeName: @YES, }]; line = CTLineCreateWithAttributedString((CFAttributedStringRef)attrString); - [attrString release]; - [strCache setObject:(id)line forKey:[[string copy] autorelease]]; + [strCache setObject:(__bridge id)line forKey:[string copy]]; } - return (CTLineRef)[(id)line autorelease]; + CFAutorelease(line); + return line; } @end // MMCoreTextView (Private) @@ -1459,8 +1441,6 @@ - (void)batchDrawData:(NSData *)data foregroundColor:cmd->fg backgroundColor:cmd->bg specialColor:cmd->sp]; - - [sref release]; } else if (InsertLinesDrawType == type) { struct DrawCmdInsertLines *cmd = &drawCmd.drawCmdInsertLines; #if MM_DEBUG_DRAWING diff --git a/src/MacVim/MMFullScreenWindow.m b/src/MacVim/MMFullScreenWindow.m index d12adddb97..e7a49ef5d9 100644 --- a/src/MacVim/MMFullScreenWindow.m +++ b/src/MacVim/MMFullScreenWindow.m @@ -77,8 +77,8 @@ - (MMFullScreenWindow *)initWithWindow:(NSWindow *)t view:(MMVimView *)v if (self == nil) return nil; - target = [t retain]; - view = [v retain]; + target = t; + view = v; [self setHasShadow:NO]; [self setShowsResizeIndicator:NO]; @@ -120,11 +120,6 @@ - (void)dealloc ASLogDebug(@""); [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [target release]; target = nil; - [view release]; view = nil; - - [super dealloc]; } - (void)setOptions:(int)opt @@ -265,7 +260,6 @@ - (void)leaveFullScreen } // fix up target controller - [self retain]; // NSWindowController releases us once [[self windowController] setWindow:target]; [[view tabBarControl] setStyleNamed:oldTabBarStyle]; @@ -330,8 +324,6 @@ - (void)leaveFullScreen CGReleaseDisplayFadeReservation(token); } - [self autorelease]; // Balance the above retain - state = LeftFullScreen; ASLogDebug(@"Left full-screen"); } diff --git a/src/MacVim/MMTextStorage.m b/src/MacVim/MMTextStorage.m index f09b1ba57a..259d9babac 100644 --- a/src/MacVim/MMTextStorage.m +++ b/src/MacVim/MMTextStorage.m @@ -75,7 +75,7 @@ - (id)init backingStore = [[NSTextStorage alloc] init]; // NOTE! It does not matter which font is set here, Vim will set its // own font on startup anyway. Just set some bogus values. - font = [[NSFont userFixedPitchFontOfSize:0] retain]; + font = [NSFont userFixedPitchFontOfSize:0]; cellSize.height = 16.0; cellSize.width = 6.0; } @@ -90,22 +90,8 @@ - (void)dealloc #if MM_USE_ROW_CACHE if (rowCache) { free(rowCache); - rowCache = NULL; } #endif - [emptyRowString release]; emptyRowString = nil; - [boldItalicFontWide release]; boldItalicFontWide = nil; - [italicFontWide release]; italicFontWide = nil; - [boldFontWide release]; boldFontWide = nil; - [fontWide release]; fontWide = nil; - [boldItalicFont release]; boldItalicFont = nil; - [italicFont release]; italicFont = nil; - [boldFont release]; boldFont = nil; - [font release]; font = nil; - [defaultBackgroundColor release]; defaultBackgroundColor = nil; - [defaultForegroundColor release]; defaultForegroundColor = nil; - [backingStore release]; backingStore = nil; - [super dealloc]; } - (NSString *)string @@ -636,28 +622,17 @@ - (void)clearAll - (void)setDefaultColorsBackground:(NSColor *)bgColor foreground:(NSColor *)fgColor { - if (defaultBackgroundColor != bgColor) { - [defaultBackgroundColor release]; - defaultBackgroundColor = bgColor ? [bgColor retain] : nil; - } + defaultBackgroundColor = bgColor; // NOTE: The default foreground color isn't actually used for anything, but // other class instances might want to be able to access it so it is stored // here. - if (defaultForegroundColor != fgColor) { - [defaultForegroundColor release]; - defaultForegroundColor = fgColor ? [fgColor retain] : nil; - } + defaultForegroundColor = fgColor; } - (void)setFont:(NSFont*)newFont { if (newFont && font != newFont) { - [boldItalicFont release]; boldItalicFont = nil; - [italicFont release]; italicFont = nil; - [boldFont release]; boldFont = nil; - [font release]; font = nil; - // NOTE! When setting a new font we make sure that the advancement of // each glyph is fixed. @@ -681,7 +656,6 @@ - (void)setFont:(NSFont*)newFont NSFontDescriptor *desc = [newFont fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dict]; font = [NSFont fontWithDescriptor:desc size:pointSize]; - [font retain]; NSLayoutManager *lm = [[self layoutManagers] objectAtIndex:0]; if (lm) { @@ -701,21 +675,18 @@ - (void)setFont:(NSFont*)newFont desc = [boldFont fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dict]; boldFont = [NSFont fontWithDescriptor:desc size:pointSize]; - [boldFont retain]; italicFont = [[NSFontManager sharedFontManager] convertFont:font toHaveTrait:NSItalicFontMask]; desc = [italicFont fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dict]; italicFont = [NSFont fontWithDescriptor:desc size:pointSize]; - [italicFont retain]; boldItalicFont = [[NSFontManager sharedFontManager] convertFont:italicFont toHaveTrait:NSBoldFontMask]; desc = [boldItalicFont fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dict]; boldItalicFont = [NSFont fontWithDescriptor:desc size:pointSize]; - [boldItalicFont retain]; } } @@ -726,11 +697,6 @@ - (void)setWideFont:(NSFont *)newFont // very well include wide characters.) if (font) [self setWideFont:font]; } else if (newFont != fontWide) { - [boldItalicFontWide release]; boldItalicFontWide = nil; - [italicFontWide release]; italicFontWide = nil; - [boldFontWide release]; boldFontWide = nil; - [fontWide release]; fontWide = nil; - float pointSize = [newFont pointSize]; NSFontDescriptor *desc = [newFont fontDescriptor]; NSDictionary *dictWide = [NSDictionary @@ -739,28 +705,24 @@ - (void)setWideFont:(NSFont *)newFont desc = [desc fontDescriptorByAddingAttributes:dictWide]; fontWide = [NSFont fontWithDescriptor:desc size:pointSize]; - [fontWide retain]; boldFontWide = [[NSFontManager sharedFontManager] convertFont:fontWide toHaveTrait:NSBoldFontMask]; desc = [boldFontWide fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dictWide]; boldFontWide = [NSFont fontWithDescriptor:desc size:pointSize]; - [boldFontWide retain]; italicFontWide = [[NSFontManager sharedFontManager] convertFont:fontWide toHaveTrait:NSItalicFontMask]; desc = [italicFontWide fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dictWide]; italicFontWide = [NSFont fontWithDescriptor:desc size:pointSize]; - [italicFontWide retain]; boldItalicFontWide = [[NSFontManager sharedFontManager] convertFont:italicFontWide toHaveTrait:NSBoldFontMask]; desc = [boldItalicFontWide fontDescriptor]; desc = [desc fontDescriptorByAddingAttributes:dictWide]; boldItalicFontWide = [NSFont fontWithDescriptor:desc size:pointSize]; - [boldItalicFontWide retain]; } } @@ -986,11 +948,9 @@ - (void)lazyResize:(BOOL)force } [rowString appendString:@"\n"]; - [emptyRowString release]; emptyRowString = [[NSAttributedString alloc] initWithString:rowString attributes:dict]; - [backingStore release]; backingStore = [[NSTextStorage alloc] init]; for (i=0; i= MAC_OS_X_VERSION_10_12_2 +@interface MMTouchBarButton : NSButton { + NSArray *_desc; +} +- (NSArray *)desc; +- (void)setDesc:(NSArray *)desc; +@end +#endif @interface MMVimController : NSObject< NSToolbarDelegate diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index 4964b5eb93..88eaaa60ae 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -102,13 +102,6 @@ - (id)initWithItem:(NSTouchBarItem *)item label:(NSString *)label; - (void)setTouchBarItem:(NSTouchBarItem *)item; - (void)makeChildTouchBar; @end - -@interface MMTouchBarButton : NSButton { - NSArray *_desc; -} -- (NSArray *)desc; -- (void)setDesc:(NSArray *)desc; -@end #endif @interface MMVimController (Private) @@ -179,7 +172,7 @@ - (id)initWithBackend:(id)backend pid:(int)processIdentifier windowController = [[MMWindowController alloc] initWithVimController:self]; - backendProxy = [backend retain]; + backendProxy = backend; popupMenuItems = [[NSMutableArray alloc] init]; toolbarItemDict = [[NSMutableDictionary alloc] init]; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12_2 @@ -206,7 +199,7 @@ - (id)initWithBackend:(id)backend pid:(int)processIdentifier mainMenu = [[NSMenu alloc] initWithTitle:@"MainMenu"]; NSMenuItem *appMenuItem = [[MMAppController sharedInstance] appMenuItemTemplate]; - appMenuItem = [[appMenuItem copy] autorelease]; + appMenuItem = [appMenuItem copy]; // Note: If the title of the application menu is anything but what // CFBundleName says then the application menu will not be typeset in @@ -233,25 +226,7 @@ - (id)initWithBackend:(id)backend pid:(int)processIdentifier - (void)dealloc { ASLogDebug(@""); - isInitialized = NO; - - [serverName release]; serverName = nil; - [backendProxy release]; backendProxy = nil; - - [toolbarItemDict release]; toolbarItemDict = nil; - [toolbar release]; toolbar = nil; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12_2 - [touchbarInfo release]; touchbarInfo = nil; -#endif - [popupMenuItems release]; popupMenuItems = nil; - [windowController release]; windowController = nil; - - [vimState release]; vimState = nil; - [mainMenu release]; mainMenu = nil; - [creationDate release]; creationDate = nil; - - [super dealloc]; } - (unsigned)vimControllerId @@ -302,7 +277,6 @@ - (NSDate *)creationDate - (void)setServerName:(NSString *)name { if (name != serverName) { - [serverName release]; serverName = [name copy]; } } @@ -725,8 +699,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data length:len encoding:NSUTF8StringEncoding]; [windowController setTitle:string]; - - [string release]; } else if (SetDocumentFilenameMsgID == msgid) { const void *bytes = [data bytes]; int len = *((int*)bytes); bytes += sizeof(int); @@ -736,8 +708,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data length:len encoding:NSUTF8StringEncoding]; [windowController setDocumentFilename:filename]; - - [filename release]; } else { [windowController setDocumentFilename:@""]; } @@ -833,7 +803,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data } [windowController setFont:font]; - [name release]; } else if (SetWideFontMsgID == msgid) { const void *bytes = [data bytes]; float size = *((float*)bytes); bytes += sizeof(float); @@ -844,8 +813,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data encoding:NSUTF8StringEncoding]; NSFont *font = [NSFont fontWithName:name size:size]; [windowController setWideFont:font]; - - [name release]; } else { [windowController setWideFont:nil]; } @@ -867,7 +834,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data SEL sel = NSSelectorFromString(actionName); [NSApp sendAction:sel to:nil from:self]; - [actionName release]; } else if (ShowPopupMenuMsgID == msgid) { NSDictionary *attrs = [NSDictionary dictionaryWithData:data]; @@ -898,7 +864,6 @@ - (void)handleMessage:(int)msgid data:(NSData *)data NSString *name = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; [self setServerName:name]; - [name release]; } else if (EnterFullScreenMsgID == msgid) { const void *bytes = [data bytes]; int fuoptions = *((int*)bytes); bytes += sizeof(int); @@ -942,8 +907,7 @@ - (void)handleMessage:(int)msgid data:(NSData *)data } else if (SetVimStateMsgID == msgid) { NSDictionary *dict = [NSDictionary dictionaryWithData:data]; if (dict) { - [vimState release]; - vimState = [dict retain]; + vimState = dict; } } else if (CloseWindowMsgID == msgid) { [self scheduleClose]; @@ -1275,8 +1239,6 @@ - (void)addMenuWithDescriptor:(NSArray *)desc atIndex:(int)idx } } - [item release]; - [menu release]; if (!isPopup) [[MMAppController sharedInstance] markMainMenuDirty:mainMenu]; } @@ -1334,7 +1296,7 @@ - (void)addMenuItemWithDescriptor:(NSArray *)desc item = [NSMenuItem separatorItem]; [item setTitle:title]; } else { - item = [[[NSMenuItem alloc] init] autorelease]; + item = [[NSMenuItem alloc] init]; [item setTitle:title]; // Note: It is possible to set the action to a message that "doesn't @@ -1408,8 +1370,6 @@ - (void)removeMenuItemWithDescriptor:(NSArray *)desc return; } - [item retain]; - if ([item menu] == [NSApp mainMenu] || ![item menu]) { // NOTE: To be on the safe side we try to remove the item from // both arrays (it is ok to call removeObject: even if an array @@ -1420,8 +1380,6 @@ - (void)removeMenuItemWithDescriptor:(NSArray *)desc if ([item menu]) [[item menu] removeItem:item]; - [item release]; - const BOOL isPopup = [MMVimController hasPopupPrefix:rootName]; if (!isPopup) [[MMAppController sharedInstance] markMainMenuDirty:mainMenu]; @@ -1520,7 +1478,7 @@ - (void)addToolbarItemToDictionaryWithLabel:(NSString *)title NSImage *img = [NSImage imageNamed:icon]; if (!img) { - img = [[[NSImage alloc] initByReferencingFile:icon] autorelease]; + img = [[NSImage alloc] initByReferencingFile:icon]; if (!(img && [img isValid])) img = nil; } @@ -1536,8 +1494,6 @@ - (void)addToolbarItemToDictionaryWithLabel:(NSString *)title [item setImage:img]; [toolbarItemDict setObject:item forKey:title]; - - [item release]; } - (void)addToolbarItemWithLabel:(NSString *)label @@ -1598,7 +1554,7 @@ - (void)addTouchbarItemWithLabel:(NSString *)label touchbarLabel = NSTouchBarItemIdentifierFixedSpaceLarge; } } else if (submenu) { - NSPopoverTouchBarItem *item = [[[NSPopoverTouchBarItem alloc] initWithIdentifier:label] autorelease]; + NSPopoverTouchBarItem *item = [[NSPopoverTouchBarItem alloc] initWithIdentifier:label]; // Icons not supported for now until we find a way to send the information in from Vim [item setCollapsedRepresentationLabel:label]; touchbarItem = item; @@ -1608,11 +1564,11 @@ - (void)addTouchbarItemWithLabel:(NSString *)label MMTouchBarButton* button = [MMTouchBarButton buttonWithTitle:buttonTitle target:windowController action:@selector(vimTouchbarItemAction:)]; [button setDesc:desc]; NSCustomTouchBarItem *item = - [[[NSCustomTouchBarItem alloc] initWithIdentifier:label] autorelease]; + [[NSCustomTouchBarItem alloc] initWithIdentifier:label]; NSImage *img = [NSImage imageNamed:icon]; if (!img) { - img = [[[NSImage alloc] initByReferencingFile:icon] autorelease]; + img = [[NSImage alloc] initByReferencingFile:icon]; if (!(img && [img isValid])) img = nil; } @@ -1630,7 +1586,7 @@ - (void)addTouchbarItemWithLabel:(NSString *)label touchbarItem = item; } - MMTouchBarItemInfo *touchbarItemInfo = [[[MMTouchBarItemInfo alloc] initWithItem:touchbarItem label:touchbarLabel] autorelease]; + MMTouchBarItemInfo *touchbarItemInfo = [[MMTouchBarItemInfo alloc] initWithItem:touchbarItem label:touchbarLabel]; if (submenu) { [touchbarItemInfo makeChildTouchBar]; } @@ -1893,8 +1849,6 @@ - (void)handleShowDialog:(NSDictionary *)attr [alert beginSheetModalForWindow:[windowController window] modalDelegate:self]; - - [alert release]; } - (void)handleDeleteSign:(NSDictionary *)attr @@ -1927,14 +1881,10 @@ @implementation MMAlert - (void)dealloc { ASLogDebug(@""); - - [textField release]; textField = nil; - [super dealloc]; } - (void)setTextFieldString:(NSString *)textFieldString { - [textField release]; textField = [[NSTextField alloc] init]; [textField setStringValue:textFieldString]; } @@ -2013,32 +1963,17 @@ - (id)init return self; } -- (void)dealloc -{ - [_touchbar release]; _touchbar = nil; - - [_itemDict release]; _itemDict = nil; - [_itemOrder release]; _itemOrder = nil; - [super dealloc]; -} @end // MMTouchBarInfo @implementation MMTouchBarItemInfo -- (void)dealloc -{ - [_touchbarItem release]; _touchbarItem = nil; - [_label release]; _label = nil; - [_childTouchbar release]; _childTouchbar = nil; - [super dealloc]; -} - (id)initWithItem:(NSTouchBarItem *)item label:(NSString *)label { - _touchbarItem = [item retain]; + _touchbarItem = item; _enabled = YES; - _label = [label retain]; + _label = label; return self; } @@ -2056,12 +1991,6 @@ - (void)makeChildTouchBar @implementation MMTouchBarButton -- (void)dealloc -{ - [_desc release]; _desc = nil; - [super dealloc]; -} - - (NSArray *)desc { return _desc; @@ -2069,7 +1998,7 @@ - (NSArray *)desc - (void)setDesc:(NSArray *)desc { - _desc = [desc retain]; + _desc = desc; } @end // MMTouchBarButton diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index 6624c5c6db..bf1074b030 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -25,6 +25,7 @@ #import "MMVimView.h" #import "MMWindowController.h" #import +#import @@ -171,20 +172,6 @@ - (MMVimView *)initWithFrame:(NSRect)frame - (void)dealloc { ASLogDebug(@""); - - [tabBarControl release]; tabBarControl = nil; - [tabView release]; tabView = nil; - [scrollbars release]; scrollbars = nil; - - // HACK! The text storage is the principal owner of the text system, but we - // keep only a reference to the text view, so release the text storage - // first (unless we are using the CoreText renderer). - if ([textView isKindOfClass:[MMTextView class]]) - [[textView textStorage] release]; - - [textView release]; textView = nil; - - [super dealloc]; } - (BOOL)isOpaque @@ -356,8 +343,6 @@ - (void)updateTabsWithData:(NSData *)data default: ASLogWarn(@"Unknown tab info for index: %d", i); } - - [val release]; } } @@ -412,8 +397,6 @@ - (NSTabViewItem *)addNewTabViewItem [[self tabView] addTabViewItem:tvi]; vimTaskSelectedTab = NO; - [tvi autorelease]; - return tvi; } @@ -426,7 +409,6 @@ - (void)createScrollbarWithIdentifier:(int32_t)ident type:(int)type [self addSubview:scroller]; [scrollbars addObject:scroller]; - [scroller release]; self.pendingPlaceScrollbars = YES; } diff --git a/src/MacVim/MMWindow.m b/src/MacVim/MMWindow.m index 5fa0a02e4d..e1510a2df7 100644 --- a/src/MacVim/MMWindow.m +++ b/src/MacVim/MMWindow.m @@ -98,8 +98,6 @@ - (void)dealloc // TODO: Is there any reason why we would want the following call? //[tablineSeparator removeFromSuperviewWithoutNeedingDisplay]; - [tablineSeparator release]; tablineSeparator = nil; - [super dealloc]; } - (BOOL) canBecomeMainWindow { diff --git a/src/MacVim/MMWindowController.h b/src/MacVim/MMWindowController.h index b5c10beb29..94e3523509 100644 --- a/src/MacVim/MMWindowController.h +++ b/src/MacVim/MMWindowController.h @@ -11,7 +11,6 @@ #import "MacVim.h" - @class MMWindow; @class MMFullScreenWindow; @class MMVimController; diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index 4d8e25e434..b9ce5a8093 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -149,7 +149,6 @@ - (id)initWithVimController:(MMVimController *)controller styleMask:styleMask backing:NSBackingStoreBuffered defer:YES]; - [win autorelease]; self = [super initWithWindow:win]; if (!self) return nil; @@ -157,7 +156,7 @@ - (id)initWithVimController:(MMVimController *)controller resizingDueToMove = NO; vimController = controller; - decoratedWindow = [win retain]; + decoratedWindow = win; [self refreshApperanceMode]; @@ -243,15 +242,6 @@ - (id)initWithVimController:(MMVimController *)controller - (void)dealloc { ASLogDebug(@""); - - [decoratedWindow release]; decoratedWindow = nil; - [windowAutosaveKey release]; windowAutosaveKey = nil; - [vimView release]; vimView = nil; - [toolbar release]; toolbar = nil; - // in case processAfterWindowPresentedQueue wasn't called - [afterWindowPresentedQueue release]; afterWindowPresentedQueue = nil; - - [super dealloc]; } - (NSString *)description @@ -279,7 +269,6 @@ - (NSString *)windowAutosaveKey - (void)setWindowAutosaveKey:(NSString *)key { - [windowAutosaveKey autorelease]; windowAutosaveKey = [key copy]; } @@ -461,8 +450,7 @@ - (void)zoomWithRows:(int)rows columns:(int)cols state:(int)state - (void)setTitle:(NSString *)title { // Save the original title, if we haven't already. - [lastSetTitle release]; - lastSetTitle = [title retain]; + lastSetTitle = title; // While in live resize the window title displays the dimensions of the // window so don't clobber this with the new title. We have already set @@ -508,8 +496,7 @@ - (void)setDocumentFilename:(NSString *)filename - (void)setToolbar:(NSToolbar *)theToolbar { if (theToolbar != toolbar) { - [toolbar release]; - toolbar = [theToolbar retain]; + toolbar = theToolbar; } // NOTE: Toolbar must be set here or it won't work to show it later. @@ -930,10 +917,6 @@ - (void)enterFullScreen:(int)fuoptions backgroundColor:(NSColor *)back // Enter custom full-screen mode. ASLogInfo(@"Enter custom full-screen"); - // fullScreenWindow could be non-nil here if this is called multiple - // times during startup. - [fullScreenWindow release]; - NSColor *fullscreenBg = back; // See setDefaultColorsBackground: for why set a transparent @@ -973,7 +956,6 @@ - (void)leaveFullScreen if (fullScreenWindow) { // Using custom full-screen [fullScreenWindow leaveFullScreen]; - [fullScreenWindow release]; fullScreenWindow = nil; // The vim view may be too large to fit the screen, so update it. @@ -1100,7 +1082,7 @@ - (IBAction)vimToolbarItemAction:(id)sender } #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_12_2 -- (IBAction)vimTouchbarItemAction:(id)sender +- (IBAction)vimTouchbarItemAction:(MMTouchBarButton *)sender { NSArray *desc = [sender desc]; NSDictionary *attrs = [NSDictionary dictionaryWithObject:desc @@ -1888,7 +1870,7 @@ - (void)processAfterWindowPresentedQueue for (void (^block)(void) in afterWindowPresentedQueue) block(); - [afterWindowPresentedQueue release]; afterWindowPresentedQueue = nil; + afterWindowPresentedQueue = nil; } + (NSString *)tabBarStyleForUnified diff --git a/src/MacVim/MacVim.m b/src/MacVim/MacVim.m index 31cbe47d14..8981a74336 100644 --- a/src/MacVim/MacVim.m +++ b/src/MacVim/MacVim.m @@ -80,7 +80,7 @@ if (cres > 0) [s appendFormat:@"CreateScrollbarMsgID(%d) ", cres]; if (dess > 0) [s appendFormat:@"DestroyScrollbarMsgID(%d) ", dess]; - return [s autorelease]; + return s; } @@ -115,7 +115,7 @@ - (NSString *)stringByRemovingFindPatterns options:NSCaseInsensitiveSearch|NSLiteralSearch range:NSMakeRange(0, [string length])]; - return [string autorelease]; + return string; } - (NSString *)stringBySanitizingSpotlightSearch @@ -125,8 +125,7 @@ - (NSString *)stringBySanitizingSpotlightSearch if (len > 1024) len = 1024; else if (len == 0) return self; - NSMutableString *string = [[[self substringToIndex:len] mutableCopy] - autorelease]; + NSMutableString *string = [[self substringToIndex:len] mutableCopy]; // Ignore strings with control characters NSCharacterSet *controlChars = [NSCharacterSet controlCharacterSet]; diff --git a/src/MacVim/MacVim.xcodeproj/project.pbxproj b/src/MacVim/MacVim.xcodeproj/project.pbxproj index 729c230092..e4840c26a9 100644 --- a/src/MacVim/MacVim.xcodeproj/project.pbxproj +++ b/src/MacVim/MacVim.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 47; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -1167,6 +1167,7 @@ C01FCF4B08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1200,6 +1201,7 @@ C01FCF4C08A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = YES; FRAMEWORK_SEARCH_PATHS = ( diff --git a/src/MacVim/Miscellaneous.m b/src/MacVim/Miscellaneous.m index 9ee98ee10c..42c1e637c8 100644 --- a/src/MacVim/Miscellaneous.m +++ b/src/MacVim/Miscellaneous.m @@ -260,8 +260,8 @@ - (NSInteger)tag // could be displayed at once. // If the accessory view should get more complex, it should probably be // loaded from a nib file. - NSButton *button = [[[NSButton alloc] - initWithFrame:NSMakeRect(0, 0, 140, 18)] autorelease]; + NSButton *button = [[NSButton alloc] + initWithFrame:NSMakeRect(0, 0, 140, 18)]; [button setTitle: NSLocalizedString(@"Show Hidden Files", @"Show Hidden Files Checkbox")]; [button setButtonType:NSSwitchButton]; diff --git a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj b/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj index 21c3f7f560..063a6e00a2 100644 --- a/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj +++ b/src/MacVim/PSMTabBarControl/PSMTabBarControl.xcodeproj/project.pbxproj @@ -58,7 +58,7 @@ A268E80709A9822A00E082AA /* TabNewMetal.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7FB09A9822900E082AA /* TabNewMetal.png */; }; A268E80809A9822A00E082AA /* TabNewMetalPressed.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7FC09A9822900E082AA /* TabNewMetalPressed.png */; }; A268E80909A9822A00E082AA /* TabNewMetalRollover.png in Resources */ = {isa = PBXBuildFile; fileRef = A268E7FD09A9822900E082AA /* TabNewMetalRollover.png */; }; - A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */ = {isa = PBXBuildFile; fileRef = A268EA5F09A9831800E082AA /* PSMRolloverButton.h */; }; + A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */ = {isa = PBXBuildFile; fileRef = A268EA5F09A9831800E082AA /* PSMRolloverButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; A268EA6309A9831800E082AA /* PSMRolloverButton.m in Sources */ = {isa = PBXBuildFile; fileRef = A268EA6009A9831800E082AA /* PSMRolloverButton.m */; }; A27E47850A28EE76007BA395 /* TabIcon.tif in Resources */ = {isa = PBXBuildFile; fileRef = A20822F00959F6AA00C5F5A4 /* TabIcon.tif */; }; A27E47880A28EE7C007BA395 /* TabControlRep.tif in Resources */ = {isa = PBXBuildFile; fileRef = A20822EF0959F6AA00C5F5A4 /* TabControlRep.tif */; }; @@ -415,12 +415,12 @@ buildActionMask = 2147483647; files = ( 546DEAF2067F630E0098DCC4 /* PSMTabBarControl.h in Headers */, + A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */, A251BE850959A1B90058BC7F /* PSMOverflowPopUpButton.h in Headers */, A251BE870959A1B90058BC7F /* PSMTabBarCell.h in Headers */, 52FAFCD31C30F4DF00C6E613 /* PSMYosemiteTabStyle.h in Headers */, A2D32EDC09A634C900EC8662 /* PSMTabStyle.h in Headers */, A2D32F0009A63D7A00EC8662 /* PSMMetalTabStyle.h in Headers */, - A268EA6209A9831800E082AA /* PSMRolloverButton.h in Headers */, A2129BB209AEB58F00724E6C /* PSMProgressIndicator.h in Headers */, A2082A9009EAEB34009AC8BE /* PSMTabDragAssistant.h in Headers */, A2D98B0A0A2B432C0064C6F8 /* PSMUnifiedTabStyle.h in Headers */, @@ -463,6 +463,7 @@ developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( + English, en, ); mainGroup = 0259C574FE90428111CA0C5A /* PSMTabBarControl */; @@ -595,6 +596,7 @@ C056398008A954F8003078D8 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; DYLIB_COMPATIBILITY_VERSION = 1; @@ -621,6 +623,7 @@ C056398108A954F8003078D8 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_ARC = YES; COMBINE_HIDPI_IMAGES = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; diff --git a/src/MacVim/PSMTabBarControl/source/FakeModel.m b/src/MacVim/PSMTabBarControl/source/FakeModel.m index dee72ec085..2f3fe691c0 100644 --- a/src/MacVim/PSMTabBarControl/source/FakeModel.m +++ b/src/MacVim/PSMTabBarControl/source/FakeModel.m @@ -42,8 +42,6 @@ - (NSImage *)icon - (void)setIcon:(NSImage *)icon { - [icon retain]; - [_icon release]; _icon = icon; } @@ -54,8 +52,6 @@ - (NSString *)iconName - (void)setIconName:(NSString *)iconName { - [iconName retain]; - [_iconName release]; _iconName = iconName; } diff --git a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m index fc1c5fae89..f3f92f4945 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMMetalTabStyle.m @@ -51,20 +51,6 @@ - (id) init return self; } -- (void)dealloc -{ - [metalCloseButton release]; - [metalCloseButtonDown release]; - [metalCloseButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; - - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} #pragma mark - #pragma mark Control Specific @@ -259,12 +245,12 @@ - (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)ce { NSMutableAttributedString *attrStr; NSFontManager *fm = [NSFontManager sharedFontManager]; - NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; + NSNumberFormatter *nf = [[NSNumberFormatter alloc] init]; [nf setLocalizesFormat:YES]; [nf setFormat:@"0"]; [nf setHasThousandSeparators:YES]; NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -278,7 +264,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell { NSMutableAttributedString *attrStr; NSString *contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -287,7 +273,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell // Add shadow attribute NSShadow* shadow; - shadow = [[[NSShadow alloc] init] autorelease]; + shadow = [[NSShadow alloc] init]; float shadowAlpha; if(([cell state] == NSOnState) || [cell isHighlighted]){ shadowAlpha = 0.8; @@ -301,7 +287,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell // Paragraph Style for Truncating Long Text if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + truncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; } @@ -474,11 +460,11 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect labelRect.origin.y += 4.0; NSMutableAttributedString *attrStr; NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; @@ -517,12 +503,12 @@ - (id)initWithCoder:(NSCoder *)aDecoder // self = [super initWithCoder:aDecoder]; //if (self) { if ([aDecoder allowsKeyedCoding]) { - metalCloseButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; - metalCloseButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; - metalCloseButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; - _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; - _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; + metalCloseButton = [aDecoder decodeObjectForKey:@"metalCloseButton"]; + metalCloseButtonDown = [aDecoder decodeObjectForKey:@"metalCloseButtonDown"]; + metalCloseButtonOver = [aDecoder decodeObjectForKey:@"metalCloseButtonOver"]; + _addTabButtonImage = [aDecoder decodeObjectForKey:@"addTabButtonImage"]; + _addTabButtonPressedImage = [aDecoder decodeObjectForKey:@"addTabButtonPressedImage"]; + _addTabButtonRolloverImage = [aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"]; } //} return self; diff --git a/src/MacVim/PSMTabBarControl/source/PSMMojaveTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMMojaveTabStyle.m index b6194330e2..1d3ac1c296 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMMojaveTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMMojaveTabStyle.m @@ -9,6 +9,8 @@ // #import "PSMMojaveTabStyle.h" +#import "PSMRolloverButton.h" + #if HAS_MOJAVE_TAB_STYLE @@ -23,19 +25,6 @@ void MojaveNSDrawWindowBackground(NSRect rect, NSColor *color) @implementation PSMMojaveTabStyle -- (void)dealloc -{ - [closeButton release]; - [closeButtonDown release]; - [closeButtonOver release]; - [closeButtonOverDark release]; - [_addTabButtonImage release]; - - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} #pragma mark - #pragma mark Initializers @@ -45,12 +34,12 @@ - (id)init self = [super init]; if (!self) return nil; - closeButton = [[self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:nil] retain]; - closeButtonDown = [[self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:[NSColor grayColor]] retain]; - closeButtonOver = [[self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:[NSColor grayColor]] retain]; - closeButtonOverDark = [[self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:[NSColor darkGrayColor]] retain]; + closeButton = [self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:nil]; + closeButtonDown = [self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:[NSColor grayColor]]; + closeButtonOver = [self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:[NSColor grayColor]]; + closeButtonOverDark = [self createCloseButtonImage:16.0 color:[NSColor secondaryLabelColor] backgroundColor:[NSColor darkGrayColor]]; - _addTabButtonImage = [[NSImage imageNamed:NSImageNameAddTemplate] retain]; + _addTabButtonImage = [NSImage imageNamed:NSImageNameAddTemplate]; return self; } @@ -296,12 +285,12 @@ - (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)ce { NSMutableAttributedString *attrStr; NSFontManager *fm = [NSFontManager sharedFontManager]; - NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; + NSNumberFormatter *nf = [[NSNumberFormatter alloc] init]; [nf setLocalizesFormat:YES]; [nf setFormat:@"0"]; [nf setHasThousandSeparators:YES]; NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -315,7 +304,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell { NSMutableAttributedString *attrStr; NSString *contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -336,7 +325,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell // Paragraph Style for Truncating Long Text if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + truncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingHead]; [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; } @@ -508,11 +497,11 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect labelRect.origin.y += 4.0; NSMutableAttributedString *attrStr; NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; @@ -547,11 +536,11 @@ - (void)encodeWithCoder:(NSCoder *)aCoder - (id)initWithCoder:(NSCoder *)aDecoder { if ([aDecoder allowsKeyedCoding]) { - closeButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; - closeButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; - closeButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; - closeButtonOverDark = [[aDecoder decodeObjectForKey:@"metalCloseButtonOverDark"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; + closeButton = [aDecoder decodeObjectForKey:@"metalCloseButton"]; + closeButtonDown = [aDecoder decodeObjectForKey:@"metalCloseButtonDown"]; + closeButtonOver = [aDecoder decodeObjectForKey:@"metalCloseButtonOver"]; + closeButtonOverDark = [aDecoder decodeObjectForKey:@"metalCloseButtonOverDark"]; + _addTabButtonImage = [aDecoder decodeObjectForKey:@"addTabButtonImage"]; } return self; diff --git a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m index 2b36b745e2..fc9389ae92 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMOverflowPopUpButton.m @@ -25,12 +25,6 @@ - (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag return self; } -- (void)dealloc -{ - [_PSMTabBarOverflowPopUpImage release]; - [_PSMTabBarOverflowDownPopUpImage release]; - [super dealloc]; -} - (void)drawRect:(NSRect)rect { @@ -80,8 +74,8 @@ - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { if ([aDecoder allowsKeyedCoding]) { - _PSMTabBarOverflowPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"] retain]; - _PSMTabBarOverflowDownPopUpImage = [[aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"] retain]; + _PSMTabBarOverflowPopUpImage = [aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"]; + _PSMTabBarOverflowDownPopUpImage = [aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"]; } } return self; diff --git a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m index 10fed285a0..e382635f59 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m +++ b/src/MacVim/PSMTabBarControl/source/PSMRolloverButton.m @@ -10,19 +10,10 @@ @implementation PSMRolloverButton -- (void)dealloc -{ - [_usualImage release]; - [_rolloverImage release]; - - [super dealloc]; -} // the regular image - (void)setUsualImage:(NSImage *)newImage { - [newImage retain]; - [_usualImage release]; _usualImage = newImage; [self setImage:_usualImage]; } @@ -34,8 +25,6 @@ - (NSImage *)usualImage - (void)setRolloverImage:(NSImage *)newImage { - [newImage retain]; - [_rolloverImage release]; _rolloverImage = newImage; } @@ -103,8 +92,8 @@ - (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { if ([aDecoder allowsKeyedCoding]) { - _rolloverImage = [[aDecoder decodeObjectForKey:@"rolloverImage"] retain]; - _usualImage = [[aDecoder decodeObjectForKey:@"usualImage"] retain]; + _rolloverImage = [aDecoder decodeObjectForKey:@"rolloverImage"]; + _usualImage = [aDecoder decodeObjectForKey:@"usualImage"]; _myTrackingRectTag = [aDecoder decodeIntForKey:@"myTrackingRectTag"]; } } diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h index 4c28ffc831..08b03c3513 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.h @@ -34,7 +34,7 @@ NSString *_toolTip; } -@property(assign) PSMTabBarControl* controlView; +@property(weak) PSMTabBarControl* controlView; // creation/destruction - (id)initWithControlView:(PSMTabBarControl *)controlView; diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m index 9642ba704b..83669fb53f 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarCell.m @@ -67,12 +67,6 @@ - (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView: return self; } -- (void)dealloc -{ - [_indicator release]; - [_toolTip release]; - [super dealloc]; -} #pragma mark - #pragma mark Accessors @@ -251,7 +245,6 @@ - (NSString *)toolTip - (void)setToolTip:(NSString *)tip { if (tip != _toolTip) { - [_toolTip release]; _toolTip = [tip copy]; } } @@ -333,9 +326,9 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame [[self controlView] cacheDisplayInRect:cellFrame toBitmapImageRep:rep]; [self.controlView unlockFocus]; - NSImage *image = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; + NSImage *image = [[NSImage alloc] initWithSize:[rep size]]; [image addRepresentation:rep]; - NSImage *returnImage = [[[NSImage alloc] initWithSize:[rep size]] autorelease]; + NSImage *returnImage = [[NSImage alloc] initWithSize:[rep size]]; [returnImage lockFocus]; [image drawAtPoint:NSMakePoint(0.0, 0.0) fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; [returnImage unlockFocus]; @@ -347,7 +340,6 @@ - (NSImage*)dragImageForRect:(NSRect)cellFrame indicatorPoint.y += 1.0; [pi drawAtPoint:indicatorPoint fromRect:NSZeroRect operation:NSCompositingOperationSourceOver fraction:0.7]; [returnImage unlockFocus]; - [pi release]; } return returnImage; } @@ -390,7 +382,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder { _cellTrackingTag = [aDecoder decodeIntForKey:@"cellTrackingTag"]; _closeButtonOver = [aDecoder decodeBoolForKey:@"closeButtonOver"]; _closeButtonPressed = [aDecoder decodeBoolForKey:@"closeButtonPressed"]; - _indicator = [[aDecoder decodeObjectForKey:@"indicator"] retain]; + _indicator = [aDecoder decodeObjectForKey:@"indicator"]; _isInOverflowMenu = [aDecoder decodeBoolForKey:@"isInOverflowMenu"]; _hasCloseButton = [aDecoder decodeBoolForKey:@"hasCloseButton"]; _isCloseButtonSuppressed = [aDecoder decodeBoolForKey:@"isCloseButtonSuppressed"]; diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m index e782b0a03c..d7cfa3f484 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m @@ -163,18 +163,9 @@ - (id)initWithFrame:(NSRect)frame - (void)dealloc { - [_overflowPopUpButton release]; - [_cells release]; - [tabView release]; - [_addTabButton release]; - [partnerView release]; - [_lastMouseDownEvent release]; - [style release]; - [delegate release]; [self unregisterDraggedTypes]; - [super dealloc]; } - (void)awakeFromNib @@ -214,8 +205,6 @@ - (NSEvent *)lastMouseDownEvent - (void)setLastMouseDownEvent:(NSEvent *)event { - [event retain]; - [_lastMouseDownEvent release]; _lastMouseDownEvent = event; } @@ -226,8 +215,6 @@ - (id)delegate - (void)setDelegate:(id)object { - [object retain]; - [delegate release]; delegate = object; } @@ -238,8 +225,6 @@ - (NSTabView *)tabView - (void)setTabView:(NSTabView *)view { - [view retain]; - [tabView release]; tabView = view; } @@ -255,7 +240,6 @@ - (NSString *)styleName - (void)setStyleNamed:(NSString *)name { - [style release]; if([name isEqualToString:@"Unified"]){ style = [[PSMUnifiedTabStyle alloc] init]; } else if([name isEqualToString:@"Yosemite"]){ @@ -453,7 +437,6 @@ - (void)addTabViewItem:(NSTabViewItem *)item // add to collection [_cells addObject:cell]; - [cell release]; if([_cells count] == [tabView numberOfTabViewItems]){ [self update]; // don't update unless all are accounted for! } @@ -622,8 +605,6 @@ - (id)partnerView - (void)setPartnerView:(id)view { - [partnerView release]; - [view retain]; partnerView = view; } @@ -838,10 +819,10 @@ - (void)update // set up menu items NSMenuItem *menuItem; if(overflowMenu == nil){ - overflowMenu = [[[NSMenu alloc] initWithTitle:@"TITLE"] autorelease]; + overflowMenu = [[NSMenu alloc] initWithTitle:@"TITLE"]; [overflowMenu insertItemWithTitle:@"FIRST" action:nil keyEquivalent:@"" atIndex:0]; // Because the overflowPupUpButton is a pull down menu } - menuItem = [[[NSMenuItem alloc] initWithTitle:[[cell attributedStringValue] string] action:@selector(overflowMenuAction:) keyEquivalent:@""] autorelease]; + menuItem = [[NSMenuItem alloc] initWithTitle:[[cell attributedStringValue] string] action:@selector(overflowMenuAction:) keyEquivalent:@""]; [menuItem setTarget:self]; [menuItem setRepresentedObject:tvi]; [cell setIsInOverflowMenu:YES]; @@ -1127,7 +1108,6 @@ - (void)overflowMenuAction:(id)sender - (void)closeTabClick:(id)sender { - [sender retain]; if(([_cells count] == 1) && (![self canCloseOnlyTab])) return; @@ -1143,14 +1123,13 @@ - (void)closeTabClick:(id)sender [[self delegate] tabView:tabView willCloseTabViewItem:[sender representedObject]]; } - [[sender representedObject] retain]; + [sender representedObject]; [tabView removeTabViewItem:[sender representedObject]]; if(([self delegate]) && ([[self delegate] respondsToSelector:@selector(tabView:didCloseTabViewItem:)])){ [[self delegate] tabView:tabView didCloseTabViewItem:[sender representedObject]]; } - [[sender representedObject] release]; - [sender release]; + [sender representedObject]; } - (void)tabClick:(id)sender @@ -1363,11 +1342,11 @@ - (id)initWithCoder:(NSCoder *)aDecoder self = [super initWithCoder:aDecoder]; if (self) { if ([aDecoder allowsKeyedCoding]) { - _cells = [[aDecoder decodeObjectForKey:@"PSMcells"] retain]; - tabView = [[aDecoder decodeObjectForKey:@"PSMtabView"] retain]; - _overflowPopUpButton = [[aDecoder decodeObjectForKey:@"PSMoverflowPopUpButton"] retain]; - _addTabButton = [[aDecoder decodeObjectForKey:@"PSMaddTabButton"] retain]; - style = [[aDecoder decodeObjectForKey:@"PSMstyle"] retain]; + _cells = [aDecoder decodeObjectForKey:@"PSMcells"]; + tabView = [aDecoder decodeObjectForKey:@"PSMtabView"]; + _overflowPopUpButton = [aDecoder decodeObjectForKey:@"PSMoverflowPopUpButton"]; + _addTabButton = [aDecoder decodeObjectForKey:@"PSMaddTabButton"]; + style = [aDecoder decodeObjectForKey:@"PSMstyle"]; _canCloseOnlyTab = [aDecoder decodeBoolForKey:@"PSMcanCloseOnlyTab"]; _hideForSingleTab = [aDecoder decodeBoolForKey:@"PSMhideForSingleTab"]; _showAddTabButton = [aDecoder decodeBoolForKey:@"PSMshowAddTabButton"]; @@ -1378,10 +1357,10 @@ - (id)initWithCoder:(NSCoder *)aDecoder _currentStep = [aDecoder decodeIntForKey:@"PSMcurrentStep"]; _isHidden = [aDecoder decodeBoolForKey:@"PSMisHidden"]; _hideIndicators = [aDecoder decodeBoolForKey:@"PSMhideIndicators"]; - partnerView = [[aDecoder decodeObjectForKey:@"PSMpartnerView"] retain]; + partnerView = [aDecoder decodeObjectForKey:@"PSMpartnerView"]; _awakenedFromNib = [aDecoder decodeBoolForKey:@"PSMawakenedFromNib"]; - _lastMouseDownEvent = [[aDecoder decodeObjectForKey:@"PSMlastMouseDownEvent"] retain]; - delegate = [[aDecoder decodeObjectForKey:@"PSMdelegate"] retain]; + _lastMouseDownEvent = [aDecoder decodeObjectForKey:@"PSMlastMouseDownEvent"]; + delegate = [aDecoder decodeObjectForKey:@"PSMdelegate"]; } } return self; diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m index 9adee1c281..316b42a2c1 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabDragAssistant.m @@ -9,6 +9,8 @@ #import "PSMTabDragAssistant.h" #import "PSMTabBarCell.h" #import "PSMTabStyle.h" +#import "PSMOverflowPopUpButton.h" +#import "PSMRolloverButton.h" @implementation PSMTabDragAssistant @@ -43,17 +45,6 @@ - (id)init return self; } -- (void)dealloc -{ - [_sourceTabBar release]; - [_destinationTabBar release]; - [_participatingTabBars release]; - [_draggedCell release]; - [_animationTimer release]; - [_sineCurveWidths release]; - [_targetCell release]; - [super dealloc]; -} #pragma mark - #pragma mark Accessors @@ -65,8 +56,6 @@ - (PSMTabBarControl *)sourceTabBar - (void)setSourceTabBar:(PSMTabBarControl *)tabBar { - [tabBar retain]; - [_sourceTabBar release]; _sourceTabBar = tabBar; } @@ -77,8 +66,6 @@ - (PSMTabBarControl *)destinationTabBar - (void)setDestinationTabBar:(PSMTabBarControl *)tabBar { - [tabBar retain]; - [_destinationTabBar release]; _destinationTabBar = tabBar; } @@ -89,8 +76,6 @@ - (PSMTabBarCell *)draggedCell - (void)setDraggedCell:(PSMTabBarCell *)cell { - [cell retain]; - [_draggedCell release]; _draggedCell = cell; } @@ -131,8 +116,6 @@ - (PSMTabBarCell *)targetCell - (void)setTargetCell:(PSMTabBarCell *)cell { - [cell retain]; - [_targetCell release]; _targetCell = cell; } @@ -360,7 +343,7 @@ - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control withDraggedCe [self distributePlaceholdersInTabBar:control]; // replace dragged cell with a placeholder, and clean up surrounding cells int cellIndex = [[control cells] indexOfObject:cell]; - PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:YES inControlView:control] autorelease]; + PSMTabBarCell *pc = [[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:YES inControlView:control]; [[control cells] replaceObjectAtIndex:cellIndex withObject:pc]; [[control cells] removeObjectAtIndex:(cellIndex + 1)]; [[control cells] removeObjectAtIndex:(cellIndex - 1)]; @@ -371,11 +354,11 @@ - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control { int i, numVisibleTabs = [control numberOfVisibleTabs]; for(i = 0; i < numVisibleTabs; i++){ - PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease]; + PSMTabBarCell *pc = [[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control]; [[control cells] insertObject:pc atIndex:(2 * i)]; } if(numVisibleTabs > 0){ - PSMTabBarCell *pc = [[[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control] autorelease]; + PSMTabBarCell *pc = [[PSMTabBarCell alloc] initPlaceholderWithFrame:[[self draggedCell] frame] expanded:NO inControlView:control]; if([[control cells] count] > (2 * numVisibleTabs)){ [[control cells] insertObject:pc atIndex:(2 * numVisibleTabs)]; } else { @@ -420,16 +403,16 @@ - (id)initWithCoder:(NSCoder *)aDecoder { //self = [super initWithCoder:aDecoder]; //if (self) { if ([aDecoder allowsKeyedCoding]) { - _sourceTabBar = [[aDecoder decodeObjectForKey:@"sourceTabBar"] retain]; - _destinationTabBar = [[aDecoder decodeObjectForKey:@"destinationTabBar"] retain]; - _participatingTabBars = [[aDecoder decodeObjectForKey:@"participatingTabBars"] retain]; - _draggedCell = [[aDecoder decodeObjectForKey:@"draggedCell"] retain]; + _sourceTabBar = [aDecoder decodeObjectForKey:@"sourceTabBar"]; + _destinationTabBar = [aDecoder decodeObjectForKey:@"destinationTabBar"]; + _participatingTabBars = [aDecoder decodeObjectForKey:@"participatingTabBars"]; + _draggedCell = [aDecoder decodeObjectForKey:@"draggedCell"]; _draggedCellIndex = [aDecoder decodeIntForKey:@"draggedCellIndex"]; _isDragging = [aDecoder decodeBoolForKey:@"isDragging"]; - _animationTimer = [[aDecoder decodeObjectForKey:@"animationTimer"] retain]; - _sineCurveWidths = [[aDecoder decodeObjectForKey:@"sineCurveWidths"] retain]; + _animationTimer = [aDecoder decodeObjectForKey:@"animationTimer"]; + _sineCurveWidths = [aDecoder decodeObjectForKey:@"sineCurveWidths"]; _currentMouseLoc = [aDecoder decodePointForKey:@"currentMouseLoc"]; - _targetCell = [[aDecoder decodeObjectForKey:@"targetCell"] retain]; + _targetCell = [aDecoder decodeObjectForKey:@"targetCell"]; } //} return self; diff --git a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m index 56a60d3fab..b2a43a1641 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMUnifiedTabStyle.m @@ -45,19 +45,6 @@ - (id) init return self; } -- (void)dealloc -{ - [unifiedCloseButton release]; - [unifiedCloseButtonDown release]; - [unifiedCloseButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} #pragma mark - #pragma mark Control Specific @@ -245,12 +232,12 @@ - (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)ce { NSMutableAttributedString *attrStr; NSFontManager *fm = [NSFontManager sharedFontManager]; - NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; + NSNumberFormatter *nf = [[NSNumberFormatter alloc] init]; [nf setLocalizesFormat:YES]; [nf setFormat:@"0"]; [nf setHasThousandSeparators:YES]; NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -264,14 +251,14 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell { NSMutableAttributedString *attrStr; NSString * contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; // Paragraph Style for Truncating Long Text if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + truncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingTail]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:truncatingTailParagraphStyle range:range]; @@ -468,11 +455,11 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect labelRect.origin.y += 4.0; NSMutableAttributedString *attrStr; NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; @@ -511,12 +498,12 @@ - (id)initWithCoder:(NSCoder *)aDecoder // self = [super initWithCoder:aDecoder]; //if (self) { if ([aDecoder allowsKeyedCoding]) { - unifiedCloseButton = [[aDecoder decodeObjectForKey:@"unifiedCloseButton"] retain]; - unifiedCloseButtonDown = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"] retain]; - unifiedCloseButtonOver = [[aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; - _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; - _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; + unifiedCloseButton = [aDecoder decodeObjectForKey:@"unifiedCloseButton"]; + unifiedCloseButtonDown = [aDecoder decodeObjectForKey:@"unifiedCloseButtonDown"]; + unifiedCloseButtonOver = [aDecoder decodeObjectForKey:@"unifiedCloseButtonOver"]; + _addTabButtonImage = [aDecoder decodeObjectForKey:@"addTabButtonImage"]; + _addTabButtonPressedImage = [aDecoder decodeObjectForKey:@"addTabButtonPressedImage"]; + _addTabButtonRolloverImage = [aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"]; } //} return self; diff --git a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m index 0997cc00bb..35c4f07cb1 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m +++ b/src/MacVim/PSMTabBarControl/source/PSMYosemiteTabStyle.m @@ -19,20 +19,6 @@ void YosemiteNSDrawWindowBackground(NSRect rect, NSColor *color) @implementation PSMYosemiteTabStyle -- (void)dealloc -{ - [closeButton release]; - [closeButtonDown release]; - [closeButtonOver release]; - [_addTabButtonImage release]; - [_addTabButtonPressedImage release]; - [_addTabButtonRolloverImage release]; - - [truncatingTailParagraphStyle release]; - [centeredParagraphStyle release]; - - [super dealloc]; -} #pragma mark - #pragma mark Initializers @@ -266,12 +252,12 @@ - (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)ce { NSMutableAttributedString *attrStr; NSFontManager *fm = [NSFontManager sharedFontManager]; - NSNumberFormatter *nf = [[[NSNumberFormatter alloc] init] autorelease]; + NSNumberFormatter *nf = [[NSNumberFormatter alloc] init]; [nf setLocalizesFormat:YES]; [nf setFormat:@"0"]; [nf setHasThousandSeparators:YES]; NSString *contents = [nf stringFromNumber:[NSNumber numberWithInt:[cell count]]]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -285,7 +271,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell { NSMutableAttributedString *attrStr; NSString *contents = [cell stringValue]; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); // Add font attribute @@ -306,7 +292,7 @@ - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell // Paragraph Style for Truncating Long Text if (!truncatingTailParagraphStyle) { - truncatingTailParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + truncatingTailParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [truncatingTailParagraphStyle setLineBreakMode:NSLineBreakByTruncatingHead]; [truncatingTailParagraphStyle setAlignment:NSTextAlignmentCenter]; } @@ -445,11 +431,11 @@ - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect labelRect.origin.y += 4.0; NSMutableAttributedString *attrStr; NSString *contents = @"PSMTabBarControl"; - attrStr = [[[NSMutableAttributedString alloc] initWithString:contents] autorelease]; + attrStr = [[NSMutableAttributedString alloc] initWithString:contents]; NSRange range = NSMakeRange(0, [contents length]); [attrStr addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:11.0] range:range]; if (!centeredParagraphStyle) { - centeredParagraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] retain]; + centeredParagraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; [centeredParagraphStyle setAlignment:NSTextAlignmentCenter]; } [attrStr addAttribute:NSParagraphStyleAttributeName value:centeredParagraphStyle range:range]; @@ -485,12 +471,12 @@ - (void)encodeWithCoder:(NSCoder *)aCoder - (id)initWithCoder:(NSCoder *)aDecoder { if ([aDecoder allowsKeyedCoding]) { - closeButton = [[aDecoder decodeObjectForKey:@"metalCloseButton"] retain]; - closeButtonDown = [[aDecoder decodeObjectForKey:@"metalCloseButtonDown"] retain]; - closeButtonOver = [[aDecoder decodeObjectForKey:@"metalCloseButtonOver"] retain]; - _addTabButtonImage = [[aDecoder decodeObjectForKey:@"addTabButtonImage"] retain]; - _addTabButtonPressedImage = [[aDecoder decodeObjectForKey:@"addTabButtonPressedImage"] retain]; - _addTabButtonRolloverImage = [[aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"] retain]; + closeButton = [aDecoder decodeObjectForKey:@"metalCloseButton"]; + closeButtonDown = [aDecoder decodeObjectForKey:@"metalCloseButtonDown"]; + closeButtonOver = [aDecoder decodeObjectForKey:@"metalCloseButtonOver"]; + _addTabButtonImage = [aDecoder decodeObjectForKey:@"addTabButtonImage"]; + _addTabButtonPressedImage = [aDecoder decodeObjectForKey:@"addTabButtonPressedImage"]; + _addTabButtonRolloverImage = [aDecoder decodeObjectForKey:@"addTabButtonRolloverImage"]; } return self;