From 4486bb71fbcd147c461679228884b382056c4602 Mon Sep 17 00:00:00 2001 From: Bjorn Winckler Date: Tue, 7 Jul 2009 21:01:13 +0200 Subject: [PATCH] Replace NSLog() with ASLogXXX() --- src/MacVim/MMAppController.m | 130 ++++++++++++++++---------- src/MacVim/MMAtsuiTextView.m | 33 +++---- src/MacVim/MMBackend.m | 138 +++++++++++++--------------- src/MacVim/MMFullscreenWindow.m | 3 +- src/MacVim/MMPlugInManager.m | 8 +- src/MacVim/MMPreferenceController.m | 6 +- src/MacVim/MMTextStorage.m | 68 ++++++-------- src/MacVim/MMTextView.m | 37 +++----- src/MacVim/MMTextViewHelper.m | 34 ++----- src/MacVim/MMTypesetter.m | 7 +- src/MacVim/MMVimController.m | 85 +++++++++-------- src/MacVim/MMVimView.m | 27 ++---- src/MacVim/MMWindow.m | 6 +- src/MacVim/MMWindowController.m | 14 +-- src/MacVim/MacVim.h | 2 +- src/MacVim/MacVim.m | 15 ++- src/MacVim/Miscellaneous.h | 8 -- src/MacVim/PlugInGUI.m | 4 +- src/MacVim/PlugInImpl.m | 4 +- src/MacVim/gui_macvim.m | 42 ++++----- 20 files changed, 322 insertions(+), 349 deletions(-) diff --git a/src/MacVim/MMAppController.m b/src/MacVim/MMAppController.m index 0e108ca5a9..0381e2915e 100644 --- a/src/MacVim/MMAppController.m +++ b/src/MacVim/MMAppController.m @@ -243,10 +243,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, // updated in MMBackend.m. NSString *name = [NSString stringWithFormat:@"%@-connection", [[NSBundle mainBundle] bundlePath]]; - //NSLog(@"Registering connection with name '%@'", name); if (![connection registerName:name]) { - NSLog(@"FATAL ERROR: Failed to register connection with name '%@'", - name); + ASLogCrit(@"Failed to register connection with name '%@'", name); [connection release]; connection = nil; } @@ -255,7 +253,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (void)dealloc { - //NSLog(@"MMAppController dealloc"); + ASLogDebug(@""); [connection release]; connection = nil; [inputQueues release]; inputQueues = nil; @@ -340,6 +338,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, [self scheduleVimControllerPreloadAfterDelay:2]; [self startWatchingVimDir]; } + + ASLogInfo(@"MacVim finished launching"); } - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender @@ -384,12 +384,15 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (BOOL)applicationOpenUntitledFile:(NSApplication *)sender { + ASLogDebug(@"Opening untitled window..."); [self newWindow:self]; return YES; } - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames { + ASLogInfo(@"Opening files %@", filenames); + // Extract ODB/Xcode/Spotlight parameters from the current Apple event, // sort the filenames, and then let openFiles:withArguments: do the heavy // lifting. @@ -523,20 +526,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef, e = [vimControllers objectEnumerator]; id vc; while ((vc = [e nextObject])) { - //NSLog(@"Terminate pid=%d", [vc pid]); + ASLogDebug(@"Terminate pid=%d", [vc pid]); [vc sendMessage:TerminateNowMsgID data:nil]; } e = [cachedVimControllers objectEnumerator]; while ((vc = [e nextObject])) { - //NSLog(@"Terminate pid=%d (cached)", [vc pid]); + ASLogDebug(@"Terminate pid=%d (cached)", [vc pid]); [vc sendMessage:TerminateNowMsgID data:nil]; } // If a Vim process is being preloaded as we quit we have to forcibly // kill it since we have not established a connection yet. if (preloadPid > 0) { - //NSLog(@"INCOMPLETE preloaded process: preloadPid=%d", preloadPid); + ASLogDebug(@"Kill incomplete preloaded process pid=%d", preloadPid); kill(preloadPid, SIGKILL); } @@ -544,7 +547,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, e = [[pidArguments allKeys] objectEnumerator]; NSNumber *pidKey; while ((pidKey = [e nextObject])) { - //NSLog(@"INCOMPLETE process: pid=%d", [pidKey intValue]); + ASLogDebug(@"Kill incomplete process pid=%d", [pidKey intValue]); kill([pidKey intValue], SIGKILL); } @@ -557,6 +560,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (void)applicationWillTerminate:(NSNotification *)notification { + ASLogInfo(@"Terminating MacVim..."); + [self stopWatchingVimDir]; #ifdef MM_ENABLE_PLUGINS @@ -591,7 +596,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, if (numChildProcesses <= 0) break; - //NSLog(@"%d processes still left, sleep a bit...", numChildProcesses); + ASLogDebug(@"%d processes still left, hold on...", numChildProcesses); // Run in NSConnectionReplyMode while waiting instead of calling e.g. // usleep(). Otherwise incoming messages may clog up the DO queues and @@ -606,8 +611,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef, ; // do nothing } - if (numChildProcesses > 0) - NSLog(@"%d ZOMBIES left behind", numChildProcesses); + if (numChildProcesses > 0) { + ASLogNotice(@"%d zombies left behind", numChildProcesses); + } } + (MMAppController *)sharedInstance @@ -630,9 +636,14 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (void)removeVimController:(id)controller { + ASLogDebug(@"Remove Vim controller pid=%d id=%d", + [controller pid], [controller identifier]); + int idx = [vimControllers indexOfObject:controller]; - if (NSNotFound == idx) + if (NSNotFound == idx) { + ASLogWarn(@"Controller at index=%d not found", idx); return; + } [controller cleanup]; @@ -705,7 +716,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, [win setFrameTopLeftPoint:topLeft]; } } else { - NSLog(@"[%s] WINDOW NOT ON SCREEN, don't constrain position", _cmd); + ASLogNotice(@"Window not on screen, don't constrain position"); } } @@ -979,6 +990,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)newWindow:(id)sender { + ASLogDebug(@"Open new window"); + // A cached controller requires no loading times and results in the new // window popping up instantaneously. If the cache is empty it may take // 1-2 seconds to start a new Vim process. @@ -998,6 +1011,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)fileOpen:(id)sender { + ASLogDebug(@"Show file open panel"); + NSString *dir = nil; BOOL trackPwd = [[NSUserDefaults standardUserDefaults] boolForKey:MMDialogsTrackPwdKey]; @@ -1017,6 +1032,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)selectNextWindow:(id)sender { + ASLogDebug(@"Select next window"); + unsigned i, count = [vimControllers count]; if (!count) return; @@ -1037,6 +1054,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)selectPreviousWindow:(id)sender { + ASLogDebug(@"Select previous window"); + unsigned i, count = [vimControllers count]; if (!count) return; @@ -1060,17 +1079,20 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)orderFrontPreferencePanel:(id)sender { + ASLogDebug(@"Show preferences panel"); [[MMPreferenceController sharedPrefsWindowController] showWindow:self]; } - (IBAction)openWebsite:(id)sender { + ASLogDebug(@"Open MacVim website"); [[NSWorkspace sharedWorkspace] openURL: [NSURL URLWithString:MMWebsiteString]]; } - (IBAction)showVimHelp:(id)sender { + ASLogDebug(@"Open window with Vim help"); // Open a new window with the help window maximized. [self launchVimProcessWithArguments:[NSArray arrayWithObjects: @"-c", @":h gui_mac", @"-c", @":res", nil]]; @@ -1078,11 +1100,13 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)zoomAll:(id)sender { + ASLogDebug(@"Zoom all windows"); [NSApp makeWindowsPerform:@selector(performZoom:) inOrder:YES]; } - (IBAction)atsuiButtonClicked:(id)sender { + ASLogDebug(@"Toggle ATSUI renderer"); // This action is called when the user clicks the "use ATSUI renderer" // button in the advanced preferences pane. [self rebuildPreloadCache]; @@ -1090,6 +1114,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)loginShellButtonClicked:(id)sender { + ASLogDebug(@"Toggle login shell option"); // This action is called when the user clicks the "use login shell" button // in the advanced preferences pane. [self rebuildPreloadCache]; @@ -1097,6 +1122,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (IBAction)quickstartButtonClicked:(id)sender { + ASLogDebug(@"Toggle Quickstart option"); if ([self maxPreloadCacheSize] > 0) { [self scheduleVimControllerPreloadAfterDelay:1.0]; [self startWatchingVimDir]; @@ -1124,7 +1150,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (unsigned)connectBackend:(byref in id )proxy pid:(int)pid { - //NSLog(@"[%s] pid=%d", _cmd, pid); + ASLogDebug(@"pid=%d", pid); [(NSDistantObject*)proxy setProtocolForProxy:@protocol(MMBackendProtocol)]; @@ -1154,12 +1180,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef, // queue the input and process it when the run loop is updated. if (!(queue && identifier)) { - NSLog(@"[%s] Bad input for identifier=%d", _cmd, identifier); + ASLogWarn(@"Bad input for identifier=%d", identifier); return; } - //NSLog(@"[%s] QUEUE for identifier=%d: <<< %@>>>", _cmd, identifier, - // debugStringForMessageQueue(queue)); + ASLogDebug(@"QUEUE for identifier=%d: <<< %@>>>", identifier, + debugStringForMessageQueue(queue)); NSNumber *key = [NSNumber numberWithUnsignedInt:identifier]; NSArray *q = [inputQueues objectForKey:key]; @@ -1205,11 +1231,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef, error:(NSString **)error { if (![[pboard types] containsObject:NSStringPboardType]) { - NSLog(@"WARNING: Pasteboard contains no object of type " - "NSStringPboardType"); + ASLogNotice(@"Pasteboard contains no NSStringPboardType"); return; } + ASLogInfo(@"Open new window containing current selection"); + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; BOOL openInCurrentWindow = [ud boolForKey:MMOpenInCurrentWindowKey]; MMVimController *vc; @@ -1232,8 +1259,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, error:(NSString **)error { if (![[pboard types] containsObject:NSStringPboardType]) { - NSLog(@"WARNING: Pasteboard contains no object of type " - "NSStringPboardType"); + ASLogNotice(@"Pasteboard contains no NSStringPboardType"); return; } @@ -1243,6 +1269,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, [NSCharacterSet whitespaceAndNewlineCharacterSet]]; string = [string stringByStandardizingPath]; + ASLogInfo(@"Open new window with selected file: %@", string); + NSArray *filenames = [self filterFilesAndNotify: [NSArray arrayWithObject:string]]; if ([filenames count] == 0) @@ -1263,8 +1291,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, error:(NSString **)error { if (![[pboard types] containsObject:NSStringPboardType]) { - NSLog(@"WARNING: Pasteboard contains no object of type " - "NSStringPboardType"); + ASLogNotice(@"Pasteboard contains no NSStringPboardType"); return; } @@ -1273,10 +1300,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef, BOOL dirIndicator; if (![[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&dirIndicator]) { - NSLog(@"Invalid path. Cannot open new document at: %@", path); + ASLogNotice(@"Invalid path. Cannot open new document at: %@", path); return; } + ASLogInfo(@"Open new file at path=%@", path); + if (!dirIndicator) path = [path stringByDeletingLastPathComponent]; @@ -1327,7 +1356,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, NSString *path = [[NSBundle mainBundle] pathForAuxiliaryExecutable:@"Vim"]; if (!path) { - NSLog(@"ERROR: Vim executable could not be found inside app bundle!"); + ASLogCrit(@"Vim executable could not be found inside app bundle!"); return -1; } @@ -1366,8 +1395,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, [pidArguments setObject:[NSNull null] forKey:[NSNumber numberWithInt:pid]]; } else { - NSLog(@"WARNING: %s%@ failed (useLoginShell=%d)", _cmd, args, - useLoginShell); + ASLogWarn(@"Failed to launch Vim process: args=%@, useLoginShell=%d", + args, useLoginShell); } return pid; @@ -1475,8 +1504,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, #if 0 // Xcode sends this event to query MacVim which open files have been // modified. - NSLog(@"reply:%@", reply); - NSLog(@"event:%@", event); + ASLogDebug(@"reply:%@", reply); + ASLogDebug(@"event:%@", event); NSEnumerator *e = [vimControllers objectEnumerator]; id vc; @@ -1587,10 +1616,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (int)findLaunchingProcessWithoutArguments { NSArray *keys = [pidArguments allKeysForObject:[NSNull null]]; - if ([keys count] > 0) { - //NSLog(@"found launching process without arguments"); + if ([keys count] > 0) return [[keys objectAtIndex:0] intValue]; - } return -1; } @@ -1905,12 +1932,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (void)activateWhenNextWindowOpens { + ASLogDebug(@"Activate MacVim when next window opens"); shouldActivateWhenNextWindowOpens = YES; } - (void)startWatchingVimDir { - //NSLog(@"%s", _cmd); #if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4) if (fsEventStream) return; @@ -1929,13 +1956,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef, kCFRunLoopDefaultMode); FSEventStreamStart(fsEventStream); - //NSLog(@"Started FS event stream"); + ASLogDebug(@"Started FS event stream"); #endif } - (void)stopWatchingVimDir { - //NSLog(@"%s", _cmd); #if (MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_4) if (NULL == FSEventStreamStop) return; // FSEvent functions are weakly linked @@ -1945,7 +1971,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, FSEventStreamInvalidate(fsEventStream); FSEventStreamRelease(fsEventStream); fsEventStream = NULL; - //NSLog(@"Stopped FS event stream"); + ASLogDebug(@"Stopped FS event stream"); } #endif @@ -1953,7 +1979,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (void)handleFSEvent { - //NSLog(@"%s", _cmd); [self clearPreloadCacheWithCount:-1]; // Several FS events may arrive in quick succession so make sure to cancel @@ -1967,8 +1992,12 @@ fsEventCallback(ConstFSEventStreamRef streamRef, // It is possible to set a user default to avoid loading the default font // (this cuts down on startup time). if (![[NSUserDefaults standardUserDefaults] boolForKey:MMLoadDefaultFontKey] - || fontContainerRef) + || fontContainerRef) { + ASLogInfo(@"Skip loading of the default font..."); return; + } + + ASLogInfo(@"Loading the default font..."); // Load all fonts in the Resouces folder of the app bundle. NSString *fontsFolder = [[NSBundle mainBundle] resourcePath]; @@ -2003,9 +2032,10 @@ fsEventCallback(ConstFSEventStreamRef streamRef, } } - if (!fontContainerRef) - NSLog(@"WARNING: Failed to activate the default font (the app bundle " - "may be incomplete)"); + if (!fontContainerRef) { + ASLogNotice(@"Failed to activate the default font (the app bundle " + "may be incomplete)"); + } } - (int)executeInLoginShell:(NSString *)path arguments:(NSArray *)args @@ -2027,8 +2057,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef, if (!shell) shell = @"/bin/bash"; - //NSLog(@"shell = %@", shell); - // Bash needs the '-l' flag to launch a login shell. The user may add // flags by setting a user default. NSString *shellArgument = [ud stringForKey:MMLoginShellArgumentKey]; @@ -2039,8 +2067,6 @@ fsEventCallback(ConstFSEventStreamRef streamRef, shellArgument = nil; } - //NSLog(@"shellArgument = %@", shellArgument); - // Build input string to pipe to the login shell. NSMutableString *input = [NSMutableString stringWithFormat: @"exec \"%@\"", path]; @@ -2105,7 +2131,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, if (close(ds[1]) == -1) return -1; ++numChildProcesses; - //NSLog(@"new process pid=%d (count=%d)", pid, numChildProcesses); + ASLogDebug(@"new process pid=%d (count=%d)", pid, numChildProcesses); } return pid; @@ -2124,7 +2150,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, if (pid <= 0) break; - //NSLog(@"WAIT for pid=%d complete", pid); + ASLogDebug(@"Wait for pid=%d complete", pid); --numChildProcesses; } } @@ -2139,7 +2165,7 @@ fsEventCallback(ConstFSEventStreamRef streamRef, // The processing flag is > 0 if this function is already on the call // stack; < 0 if this function was also re-entered. if (processingFlag != 0) { - NSLog(@"[%s] BUSY!", _cmd); + ASLogDebug(@"BUSY!"); processingFlag = -1; return; } @@ -2182,9 +2208,9 @@ fsEventCallback(ConstFSEventStreamRef streamRef, } } - if (i == count) - NSLog(@"[%s] WARNING: No Vim controller for identifier=%d", - _cmd, ukey); + if (i == count) { + ASLogWarn(@"No Vim controller for identifier=%d", ukey); + } } [queues release]; @@ -2203,6 +2229,8 @@ fsEventCallback(ConstFSEventStreamRef streamRef, - (void)addVimController:(MMVimController *)vc { + ASLogDebug(@"Add Vim controller pid=%d id=%d", [vc pid], [vc identifier]); + int pid = [vc pid]; NSNumber *pidKey = [NSNumber numberWithInt:pid]; diff --git a/src/MacVim/MMAtsuiTextView.m b/src/MacVim/MMAtsuiTextView.m index 269e773d5f..5f51dc97f3 100644 --- a/src/MacVim/MMAtsuiTextView.m +++ b/src/MacVim/MMAtsuiTextView.m @@ -139,7 +139,7 @@ defaultLineHeightForFont(NSFont *font) - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); [self disposeAtsuStyles]; [font release]; font = nil; @@ -588,7 +588,7 @@ defaultLineHeightForFont(NSFont *font) [self resizeContentImage]; #if MM_DEBUG_DRAWING - NSLog(@"====> BEGIN %s", _cmd); + ASLogDebug(@"====> BEGIN %s", _cmd); #endif [self beginDrawing]; @@ -599,7 +599,7 @@ defaultLineHeightForFont(NSFont *font) if (ClearAllDrawType == type) { #if MM_DEBUG_DRAWING - NSLog(@" Clear all"); + ASLogDebug(@" Clear all"); #endif [self clearAll]; } else if (ClearBlockDrawType == type) { @@ -610,8 +610,8 @@ defaultLineHeightForFont(NSFont *font) int col2 = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Clear block (%d,%d) -> (%d,%d)", row1, col1, - row2,col2); + ASLogDebug(@" Clear block (%d,%d) -> (%d,%d)", row1, col1, + row2,col2); #endif [self clearBlockFromRow:row1 column:col1 toRow:row2 column:col2 @@ -625,7 +625,7 @@ defaultLineHeightForFont(NSFont *font) int right = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Delete %d line(s) from %d", count, row); + ASLogDebug(@" Delete %d line(s) from %d", count, row); #endif [self deleteLinesFromRow:row lineCount:count scrollBottom:bot left:left right:right @@ -647,8 +647,8 @@ defaultLineHeightForFont(NSFont *font) freeWhenDone:NO]; bytes += len; #if MM_DEBUG_DRAWING - NSLog(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x " - "bg=0x%x sp=0x%x", row, col, len, flags, fg, bg, sp); + ASLogDebug(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x " + "bg=0x%x sp=0x%x", row, col, len, flags, fg, bg, sp); #endif unichar *characters = malloc(sizeof(unichar) * [string length]); [string getCharacters:characters]; @@ -672,7 +672,7 @@ defaultLineHeightForFont(NSFont *font) int right = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Insert %d line(s) at row %d", count, row); + ASLogDebug(@" Insert %d line(s) at row %d", count, row); #endif [self insertLinesAtRow:row lineCount:count scrollBottom:bot left:left right:right @@ -685,7 +685,7 @@ defaultLineHeightForFont(NSFont *font) int percent = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Draw cursor at (%d,%d)", row, col); + ASLogDebug(@" Draw cursor at (%d,%d)", row, col); #endif [helper setInsertionPointColor:[NSColor colorWithRgbInt:color]]; [self drawInsertionPointAtRow:row column:col shape:shape @@ -698,8 +698,8 @@ defaultLineHeightForFont(NSFont *font) /*int invert = *((int*)bytes);*/ bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d", - row, col, nr, nc); + ASLogDebug(@" Draw inverted rect: row=%d col=%d nrows=%d " + "ncols=%d", row, col, nr, nc); #endif [self drawInvertedRectAtRow:row column:col numRows:nr numColumns:nc]; @@ -709,7 +709,7 @@ defaultLineHeightForFont(NSFont *font) /*cursorRow = *((int*)bytes);*/ bytes += sizeof(int); /*cursorCol = *((int*)bytes);*/ bytes += sizeof(int); } else { - NSLog(@"WARNING: Unknown draw type (type=%d)", type); + ASLogWarn(@"Unknown draw type (type=%d)", type); } } @@ -723,7 +723,7 @@ defaultLineHeightForFont(NSFont *font) [self display]; #if MM_DEBUG_DRAWING - NSLog(@"<==== END %s", _cmd); + ASLogDebug(@"<==== END %s", _cmd); #endif } @@ -1032,7 +1032,6 @@ defaultLineHeightForFont(NSFont *font) - (void)resizeContentImage { - //NSLog(@"resizeContentImage"); [contentImage release]; contentImage = [[NSImage alloc] initWithSize:[self textAreaSize]]; [contentImage setFlipped:YES]; @@ -1090,8 +1089,6 @@ defaultLineHeightForFont(NSFont *font) ATSUSetAttributes(style, sizeof(attribValues) / sizeof(attribValues[0]), attribTags, attribSizes, attribValues); - // NSLog(@"drawString: %d", length); - ATSUCreateTextLayout(&layout); ATSUSetTextPointerLocation(layout, string, kATSUFromTextBeginning, kATSUToTextEnd, @@ -1219,8 +1216,6 @@ defaultLineHeightForFont(NSFont *font) NSRect rect = NSMakeRect(origin.x, origin.y, cellSize.width, cellSize.height); - // NSLog(@"shape = %d, fraction: %d", shape, percent); - if (MMInsertionPointHorizontal == shape) { int frac = (cellSize.height * percent + 99)/100; rect.origin.y += rect.size.height - frac; diff --git a/src/MacVim/MMBackend.m b/src/MacVim/MMBackend.m index 4bd176402c..aad655af13 100644 --- a/src/MacVim/MMBackend.m +++ b/src/MacVim/MMBackend.m @@ -157,16 +157,17 @@ extern GuiFont gui_mch_retain_font(GuiFont font); if (path) actionDict = [[NSDictionary dictionaryWithContentsOfFile:path] retain]; - if (!(colorDict && sysColorDict && actionDict)) - NSLog(@"ERROR: Failed to load dictionaries.%@", - MMSymlinkWarningString); + if (!(colorDict && sysColorDict && actionDict)) { + ASLogNotice(@"Failed to load dictionaries.%@", MMSymlinkWarningString); + } return self; } - (void)dealloc { - //NSLog(@"%@ %s", [self className], _cmd); + ASLogDebug(@""); + [[NSNotificationCenter defaultCenter] removeObserver:self]; gui_mch_free_font(oldWideFont); oldWideFont = NOFONT; @@ -282,8 +283,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font); } if (noErr != status) { - NSLog(@"ERROR: Failed to launch MacVim (path=%@).%@", - path, MMSymlinkWarningString); + ASLogCrit(@"Failed to launch MacVim (path=%@).%@", + path, MMSymlinkWarningString); return NO; } #else @@ -302,8 +303,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font); objectForKey:@"CFBundleExecutable"]; NSString *path = [mainBundle pathForAuxiliaryExecutable:exeName]; if (!path) { - NSLog(@"ERROR: Could not find MacVim executable in bundle.%@", - MMSymlinkWarningString); + ASLogCrit(@"Could not find MacVim executable in bundle.%@", + MMSymlinkWarningString); return NO; } @@ -322,7 +323,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); // NOTE: [self connection] will set 'connection' as a side-effect. if (!connection) { - NSLog(@"WARNING: Timed-out waiting for GUI to launch."); + ASLogCrit(@"Timed-out waiting for GUI to launch."); return NO; } } @@ -346,7 +347,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); return YES; } @catch (NSException *e) { - NSLog(@"Exception caught when trying to connect backend: \"%@\"", e); + ASLogWarn(@"Exception caught when trying to connect backend: %@", e); } return NO; @@ -505,16 +506,15 @@ extern GuiFont gui_mch_retain_font(GuiFont font); [self insertVimStateMessage]; @try { - //NSLog(@"[%s] Flushing (count=%d)", _cmd, [outputQueue count]); + ASLogDebug(@"Flushing queue: %@", + debugStringForMessageQueue(outputQueue)); [appProxy processInput:outputQueue forIdentifier:identifier]; } @catch (NSException *e) { - NSLog(@"[%s] Exception caught: \"%@\"", _cmd, e); - NSLog(@"outputQueue(len:%d)=%@", [outputQueue count]/2, - outputQueue); + ASLogWarn(@"Exception caught: %@", e); if (![connection isValid]) { - NSLog(@"WARNING! Connection is invalid, exit now!"); - NSLog(@"waitForAck=%d got_int=%d", waitForAck, got_int); + ASLogNotice(@"Connection is invalid, exit now!"); + ASLogDebug(@"waitForAck=%d got_int=%d", waitForAck, got_int); mch_exit(-1); } } @@ -575,10 +575,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font); // Flush the entire queue in case a VimLeave autocommand added // something to the queue. [self queueMessage:CloseWindowMsgID data:nil]; + ASLogDebug(@"Flush output queue before exit: %@", + debugStringForMessageQueue(outputQueue)); [appProxy processInput:outputQueue forIdentifier:identifier]; } @catch (NSException *e) { - NSLog(@"Exception caught when sending CloseWindowMsgID: \"%@\"", e); + ASLogWarn(@"Exception caught when sending CloseWindowMsgID: %@", e); } // NOTE: If Cmd-w was pressed to close the window the menu is briefly @@ -601,8 +603,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font); - (void)selectTab:(int)index { - //NSLog(@"%s%d", _cmd, index); - index -= 1; NSData *data = [NSData dataWithBytes:&index length:sizeof(int)]; [self queueMessage:SelectTabMsgID data:data]; @@ -610,8 +610,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font); - (void)updateTabBar { - //NSLog(@"%s", _cmd); - NSMutableData *data = [NSMutableData data]; int idx = tabpage_index(curtab) - 1; @@ -659,8 +657,6 @@ extern GuiFont gui_mch_retain_font(GuiFont font); - (void)setRows:(int)rows columns:(int)cols { - //NSLog(@"[VimTask] setRows:%d columns:%d", rows, cols); - int dim[] = { rows, cols }; NSData *data = [NSData dataWithBytes:&dim length:2*sizeof(int)]; @@ -707,7 +703,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); [dialogReturn release]; dialogReturn = nil; } @catch (NSException *e) { - NSLog(@"[%s] Exception caught: \"%@\"", _cmd, e); + ASLogWarn(@"Exception caught: %@", e); } return (char *)s; @@ -715,6 +711,8 @@ extern GuiFont gui_mch_retain_font(GuiFont font); - (oneway void)setDialogReturn:(in bycopy id)obj { + ASLogDebug(@"%@", obj); + // NOTE: This is called by // - [MMVimController panelDidEnd:::], and // - [MMVimController alertDidEnd:::], @@ -760,7 +758,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); [dialogReturn release]; dialogReturn = nil; } @catch (NSException *e) { - NSLog(@"[%s] Exception caught: \"%@\"", _cmd, e); + ASLogWarn(@"Exception caught: %@", e); } return retval; @@ -981,7 +979,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); } } - //NSLog(@"WARNING: No color with key %@ found.", stripKey); + ASLogNotice(@"No color with key %@ found.", stripKey); return INVALCOLOR; } @@ -1195,7 +1193,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); - (oneway void)addReply:(in bycopy NSString *)reply server:(in byref id )server { - //NSLog(@"addReply:%@ server:%@", reply, (id)server); + ASLogDebug(@"reply=%@ server=%@", reply, (id)server); // Replies might come at any time and in any order so we keep them in an // array inside a dictionary with the send port used as key. @@ -1217,7 +1215,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); - (void)addInput:(in bycopy NSString *)input client:(in byref id )client { - //NSLog(@"addInput:%@ client:%@", input, (id)client); + ASLogDebug(@"input=%@ client=%@", input, (id)client); // NOTE: We don't call addInput: here because it differs from // server_to_input_buf() in that it always sets the 'silent' flag and we @@ -1247,7 +1245,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); NSString *connName = [self connectionNameFromServerName:svrName]; if ([svrConn registerName:connName]) { - //NSLog(@"Registered server with name: %@", svrName); + ASLogInfo(@"Registered server with name: %@", svrName); // TODO: Set request/reply time-outs to something else? // @@ -1323,7 +1321,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); } } @catch (NSException *e) { - NSLog(@"WARNING: Caught exception in %s: \"%@\"", _cmd, e); + ASLogWarn(@"Caught exception: %@", e); return NO; } @@ -1342,7 +1340,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); list = [proxy serverList]; } @catch (NSException *e) { - NSLog(@"Exception caught when listing servers: \"%@\"", e); + ASLogWarn(@"Exception caught when listing servers: %@", e); } } else { EMSG(_("E???: No connection to MacVim, server listing not possible.")); @@ -1353,23 +1351,23 @@ extern GuiFont gui_mch_retain_font(GuiFont font); - (NSString *)peekForReplyOnPort:(int)port { - //NSLog(@"%s%d", _cmd, port); + ASLogDebug(@"port=%d", port); NSNumber *key = [NSNumber numberWithInt:port]; NSMutableArray *replies = [serverReplyDict objectForKey:key]; if (replies && [replies count]) { - //NSLog(@" %d replies, topmost is: %@", [replies count], - // [replies objectAtIndex:0]); + ASLogDebug(@" %d replies, topmost is: %@", [replies count], + [replies objectAtIndex:0]); return [replies objectAtIndex:0]; } - //NSLog(@" No replies"); + ASLogDebug(@" No replies"); return nil; } - (NSString *)waitForReplyOnPort:(int)port { - //NSLog(@"%s%d", _cmd, port); + ASLogDebug(@"port=%d", port); NSConnection *conn = [self connectionForServerPort:port]; if (!conn) @@ -1390,7 +1388,7 @@ extern GuiFont gui_mch_retain_font(GuiFont font); if (replies) { if ([replies count] > 0) { reply = [[replies objectAtIndex:0] retain]; - //NSLog(@" Got reply: %@", reply); + ASLogDebug(@" Got reply: %@", reply); [replies removeObjectAtIndex:0]; [reply autorelease]; } @@ -1407,12 +1405,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font); id client = [clientProxyDict objectForKey:[NSNumber numberWithInt:port]]; if (client) { @try { - //NSLog(@"sendReply:%@ toPort:%d", reply, port); + ASLogDebug(@"reply=%@ port=%d", reply, port); [client addReply:reply server:self]; return YES; } @catch (NSException *e) { - NSLog(@"WARNING: Exception caught in %s: \"%@\"", _cmd, e); + ASLogWarn(@"Exception caught: %@", e); } } else { EMSG2(_("E???: server2client failed; no client with id 0x%x"), port); @@ -1438,12 +1436,12 @@ extern GuiFont gui_mch_retain_font(GuiFont font); while (waitForAck && !got_int && [connection isValid]) { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; - //NSLog(@" waitForAck=%d got_int=%d isValid=%d", - // waitForAck, got_int, [connection isValid]); + ASLogDebug(@" waitForAck=%d got_int=%d isValid=%d", + waitForAck, got_int, [connection isValid]); } if (waitForAck) { - // Never received a connection acknowledgement, so die. + ASLogDebug(@"Never received a connection acknowledgement"); [[NSNotificationCenter defaultCenter] removeObserver:self]; [appProxy release]; appProxy = nil; @@ -1453,12 +1451,13 @@ extern GuiFont gui_mch_retain_font(GuiFont font); exit(0); } + ASLogInfo(@"Connection acknowledgement received"); [self processInputQueue]; } - (oneway void)acknowledgeConnection { - //NSLog(@"%s", _cmd); + ASLogDebug(@""); waitForAck = NO; } @@ -1647,12 +1646,11 @@ static void netbeansReadCallback(CFSocketRef s, if ([data isEqual:[NSNull null]]) data = nil; - //NSLog(@"(%d) %s:%s", i, _cmd, MessageStrings[msgid]); + ASLogDebug(@"(%d) %s", i, MessageStrings[msgid]); [self handleInputEvent:msgid data:data]; } [q release]; - //NSLog(@"Clear input event queue"); } - (void)handleInputEvent:(int)msgid data:(NSData *)data @@ -1751,16 +1749,13 @@ static void netbeansReadCallback(CFSocketRef s, if (!data) return; const void *bytes = [data bytes]; int idx = *((int*)bytes) + 1; - //NSLog(@"Selecting tab %d", idx); send_tabline_event(idx); } else if (CloseTabMsgID == msgid) { if (!data) return; const void *bytes = [data bytes]; int idx = *((int*)bytes) + 1; - //NSLog(@"Closing tab %d", idx); send_tabline_menu_event(idx, TABLINE_MENU_CLOSE); } else if (AddNewTabMsgID == msgid) { - //NSLog(@"Adding new tab"); send_tabline_menu_event(0, TABLINE_MENU_NEW); } else if (DraggedTabMsgID == msgid) { if (!data) return; @@ -1801,7 +1796,6 @@ static void netbeansReadCallback(CFSocketRef s, // since we need to be able to determine where a message originated. [self queueMessage:msgid data:d]; - //NSLog(@"[VimTask] Resizing shell to %dx%d.", cols, rows); gui_resize_shell(cols, rows); } else if (ExecuteMenuMsgID == msgid) { NSDictionary *attrs = [NSDictionary dictionaryWithData:data]; @@ -1848,7 +1842,7 @@ static void netbeansReadCallback(CFSocketRef s, messageFromNetbeansMacVim(); #endif } else { - NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid); + ASLogWarn(@"Unknown message received (msgid=%d)", msgid); } } @@ -1915,7 +1909,7 @@ static void netbeansReadCallback(CFSocketRef s, NSString *specialString = [[MMBackend specialKeys] objectForKey:key]; if (specialString && [specialString length] > 1) { - //NSLog(@"special key: %@", specialString); + //ASLogDebug(@"special key: %@", specialString); int ikey = TO_SPECIAL([specialString characterAtIndex:0], [specialString characterAtIndex:1]); @@ -2010,8 +2004,8 @@ static void netbeansReadCallback(CFSocketRef s, return; } else if (length > 0) { unichar c = [key characterAtIndex:0]; - //NSLog(@"non-special: %@ (hex=%x, mods=%d)", key, - // [key characterAtIndex:0], mods); + //ASLogDebug(@"non-special: %@ (hex=%x, mods=%d)", key, + // [key characterAtIndex:0], mods); // HACK! In most circumstances the Ctrl and Shift modifiers should be // cleared since they are already added to the key by the AppKit. @@ -2021,7 +2015,7 @@ static void netbeansReadCallback(CFSocketRef s, || 0x9 == c || 0xd == c || ESC == c) ) { mods &= ~MOD_MASK_SHIFT; mods &= ~MOD_MASK_CTRL; - //NSLog(@"clear shift ctrl"); + //ASLogDebug(@"clear shift ctrl"); } #ifdef FEAT_MBYTE @@ -2035,14 +2029,14 @@ static void netbeansReadCallback(CFSocketRef s, if (chars && length > 0) { if (mods) { - //NSLog(@"adding mods: %d", mods); + //ASLogDebug(@"adding mods: %d", mods); modChars[0] = CSI; modChars[1] = KS_MODIFIER; modChars[2] = mods; add_to_input_buf(modChars, 3); } - //NSLog(@"add to input buf: 0x%x", chars[0]); + //ASLogDebug(@"add to input buf: 0x%x", chars[0]); // TODO: Check for CSI bytes? add_to_input_buf(chars, length); } @@ -2055,9 +2049,6 @@ static void netbeansReadCallback(CFSocketRef s, - (void)queueMessage:(int)msgid data:(NSData *)data { - //if (msgid != EnableMenuItemMsgID) - // NSLog(@"queueMessage:%s", MessageStrings[msgid]); - [outputQueue addObject:[NSData dataWithBytes:&msgid length:sizeof(int)]]; if (data) [outputQueue addObject:data]; @@ -2073,8 +2064,8 @@ static void netbeansReadCallback(CFSocketRef s, // // NOTE: This is not called if a Vim controller invalidates its connection. - NSLog(@"WARNING[%s]: Main connection was lost before process had a chance " - "to terminate; preserving swap files.", _cmd); + ASLogNotice(@"Main connection was lost before process had a chance " + "to terminate; preserving swap files."); getout_preserve_modified(1); } @@ -2179,7 +2170,6 @@ static void netbeansReadCallback(CFSocketRef s, break; } - //NSLog(@"value %d -> %d", sb_info->value, value); gui_drag_scrollbar(sb, value, isStillDragging); if (updateKnob) { @@ -2376,8 +2366,7 @@ static void netbeansReadCallback(CFSocketRef s, if (remotePath) buf->b_odb_fname = [remotePath vimStringSave]; } else { - NSLog(@"WARNING: Could not find buffer '%@' for ODB editing.", - filename); + ASLogWarn(@"Could not find buffer '%@' for ODB editing.", filename); } } #endif // FEAT_ODB_EDITOR @@ -2416,7 +2405,7 @@ static void netbeansReadCallback(CFSocketRef s, // remoteTokenDescType ODB parameter // remoteTokenData ODB parameter - //NSLog(@"%s%@ (starting=%d)", _cmd, args, starting); + ASLogDebug(@"args=%@ (starting=%d)", args, starting); NSArray *filenames = [args objectForKey:@"filenames"]; int i, numFiles = filenames ? [filenames count] : 0; @@ -2737,8 +2726,8 @@ static void netbeansReadCallback(CFSocketRef s, host:nil]; // Try alternate server... if (!svrConn && alternateServerName) { - //NSLog(@" trying to connect to alternate server: %@", - // alternateServerName); + ASLogInfo(@" trying to connect to alternate server: %@", + alternateServerName); connName = [self connectionNameFromServerName:alternateServerName]; svrConn = [NSConnection connectionWithRegisteredName:connName host:nil]; @@ -2746,10 +2735,10 @@ static void netbeansReadCallback(CFSocketRef s, // Try looking for alternate servers... if (!svrConn) { - //NSLog(@" looking for alternate servers..."); + ASLogInfo(@" looking for alternate servers..."); NSString *alt = [self alternateServerNameForName:name]; if (alt != alternateServerName) { - //NSLog(@" found alternate server: %@", string); + ASLogInfo(@" found alternate server: %@", alt); [alternateServerName release]; alternateServerName = [alt copy]; } @@ -2757,8 +2746,8 @@ static void netbeansReadCallback(CFSocketRef s, // Try alternate server again... if (!svrConn && alternateServerName) { - //NSLog(@" trying to connect to alternate server: %@", - // alternateServerName); + ASLogInfo(@" trying to connect to alternate server: %@", + alternateServerName); connName = [self connectionNameFromServerName:alternateServerName]; svrConn = [NSConnection connectionWithRegisteredName:connName host:nil]; @@ -2767,7 +2756,8 @@ static void netbeansReadCallback(CFSocketRef s, if (svrConn) { [connectionNameDict setObject:svrConn forKey:connName]; - //NSLog(@"Adding %@ as connection observer for %@", self, svrConn); + ASLogDebug(@"Adding %@ as connection observer for %@", + self, svrConn); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(serverConnectionDidDie:) name:NSConnectionDidDieNotification object:svrConn]; @@ -2793,11 +2783,11 @@ static void netbeansReadCallback(CFSocketRef s, - (void)serverConnectionDidDie:(NSNotification *)notification { - //NSLog(@"%s%@", _cmd, notification); + ASLogDebug(@"notification=%@", notification); NSConnection *svrConn = [notification object]; - //NSLog(@"Removing %@ as connection observer from %@", self, svrConn); + ASLogDebug(@"Removing %@ as connection observer from %@", self, svrConn); [[NSNotificationCenter defaultCenter] removeObserver:self name:NSConnectionDidDieNotification diff --git a/src/MacVim/MMFullscreenWindow.m b/src/MacVim/MMFullscreenWindow.m index b366658d85..ed7f0fd083 100644 --- a/src/MacVim/MMFullscreenWindow.m +++ b/src/MacVim/MMFullscreenWindow.m @@ -94,7 +94,7 @@ - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -308,7 +308,6 @@ - (void)centerView { NSRect outer = [self frame], inner = [view frame]; - //NSLog(@"%s %@%@", _cmd, NSStringFromRect(outer), NSStringFromRect(inner)); NSPoint origin = NSMakePoint((outer.size.width - inner.size.width)/2, (outer.size.height - inner.size.height)/2); diff --git a/src/MacVim/MMPlugInManager.m b/src/MacVim/MMPlugInManager.m index 0fa9b4105e..9707d364e4 100644 --- a/src/MacVim/MMPlugInManager.m +++ b/src/MacVim/MMPlugInManager.m @@ -50,6 +50,8 @@ static MMPlugInManager *plugInManager = nil; - (void)dealloc { + ASLogDebug(@""); + [plugInClasses release]; plugInClasses = nil; [super dealloc]; } @@ -123,13 +125,13 @@ static MMPlugInManager *plugInManager = nil; if(currPrincipalClass && [self plugInClassIsValid:currPrincipalClass]) { if ([currPrincipalClass initializePlugIn: [MMPlugInAppMediator sharedAppMediator]]) { - //NSLog(@"Plug-in initialized: %@", currPath); + ASLogInfo(@"Plug-in initialized: %@", currPath); [plugInClasses addObject:currPrincipalClass]; } else { - NSLog(@"Plug-in failed to initialize: %@", currPath); + ASLogErr(@"Plug-in failed to initialize: %@", currPath); } } else { - NSLog(@"Plug-in did not conform to protocol: %@", currPath); + ASLogErr(@"Plug-in did not conform to protocol: %@", currPath); } } } diff --git a/src/MacVim/MMPreferenceController.m b/src/MacVim/MMPreferenceController.m index bfba36f8ac..54910632e8 100644 --- a/src/MacVim/MMPreferenceController.m +++ b/src/MacVim/MMPreferenceController.m @@ -115,6 +115,8 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom"; - (void)dealloc { + ASLogDebug(@""); + [supportedOdbEditors release]; supportedOdbEditors = nil; [super dealloc]; } @@ -383,7 +385,7 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom"; [self setOdbEditorByName:kOdbEditorNameMacVim]; } } else { - NSLog(@"Failed to install input manager, error is %d", err); + ASLogErr(@"Failed to install input manager, error is %d", err); } [au release]; @@ -402,7 +404,7 @@ NSString *kOdbEditorIdentifierWriteRoom = @"com.hogbaysoftware.WriteRoom"; initWithCommands:cmd]; OSStatus err = [au run]; if (err != errAuthorizationSuccess) - NSLog(@"Failed to uninstall input manager, error is %d", err); + ASLogErr(@"Failed to uninstall input manager, error is %d", err); [au release]; [self updateIntegrationPane]; diff --git a/src/MacVim/MMTextStorage.m b/src/MacVim/MMTextStorage.m index 030c1daf2c..0d272b2bde 100644 --- a/src/MacVim/MMTextStorage.m +++ b/src/MacVim/MMTextStorage.m @@ -84,7 +84,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); #if MM_USE_ROW_CACHE if (rowCache) { @@ -135,15 +135,13 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; withString:(NSString *)string { #if MM_TS_PARANOIA_LOG - NSLog(@"WARNING: calling %s on MMTextStorage is unsupported", _cmd); + ASLogWarn(@"Calling %s on MMTextStorage is unsupported", _cmd); #endif //[attribString replaceCharactersInRange:range withString:string]; } - (void)setAttributes:(NSDictionary *)attributes range:(NSRange)range { - //NSLog(@"%s%@", _cmd, NSStringFromRange(range)); - // NOTE! This method must be implemented since the text system calls it // constantly to 'fix attributes', apply font substitution, etc. #if 0 @@ -185,7 +183,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; [attribString setAttributes:newAttr range:range]; } else { - //NSLog(@"NOT fixing font attribute!"); [attribString setAttributes:attributes range:range]; } #endif @@ -220,7 +217,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; { NSLayoutManager *lm = [[self layoutManagers] objectAtIndex:0]; if (!lm) { - NSLog(@"WARNING: No layout manager available in call to %s", _cmd); + ASLogWarn(@"No layout manager available"); return; } @@ -253,10 +250,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; foregroundColor:(NSColor *)fg backgroundColor:(NSColor *)bg specialColor:(NSColor *)sp { - //NSLog(@"%@(%d,%d,%d,%d)", string, row, col, cells, flags); - //NSLog(@"replaceString:atRow:%d column:%d withFlags:%d " - // "foreground:%@ background:%@ special:%@", - // row, col, flags, fg, bg, sp); [self lazyResize:NO]; if (row < 0 || row >= maxRows || col < 0 || col >= maxColumns @@ -279,7 +272,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; NSRange range = [self charRangeForRow:row column:&acol cells:&acells]; if (NSNotFound == range.location) { #if MM_TS_PARANOIA_LOG - NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd); + ASLogErr(@"INTERNAL ERROR: Out of bounds"); #endif return; } @@ -345,13 +338,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; ++changeInLength; #if 0 } else if (acol == col - 1) { - NSLog(@"acol == col - 1"); [attribString replaceCharactersInRange:NSMakeRange(r.location,0) withAttributedString:[emptyRowString attributedSubstringFromRange:NSMakeRange(0,1)]]; ++changeInLength; } else if (acol == col + 1) { - NSLog(@"acol == col + 1"); [attribString replaceCharactersInRange:NSMakeRange(r.location-1,1) withAttributedString:[emptyRowString attributedSubstringFromRange:NSMakeRange(0,2)]]; @@ -361,8 +352,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; // NOTE: It seems that this never gets called. If it ever does, // then there is another case to treat. #if MM_TS_PARANOIA_LOG - NSLog(@"row=%d col=%d acol=%d cells=%d acells=%d", row, col, acol, - cells, acells); + ASLogWarn(@"row=%d col=%d acol=%d cells=%d acells=%d", row, col, + acol, cells, acells); #endif } } @@ -388,7 +379,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; scrollBottom:(int)bottom left:(int)left right:(int)right color:(NSColor *)color { - //NSLog(@"deleteLinesFromRow:%d lineCount:%d color:%@", row, count, color); [self lazyResize:NO]; if (row < 0 || row+count > maxRows || bottom > maxRows || left < 0 @@ -408,7 +398,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; destRange = [self charRangeForRow:destRow column:&acol cells:&acells]; #if MM_TS_PARANOIA_LOG if (acells != width || acol != left) - NSLog(@"INTERNAL ERROR [%s]", _cmd); + ASLogErr(@"INTERNAL ERROR"); #endif acol = left; acells = width; @@ -416,13 +406,13 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; cells:&acells]; #if MM_TS_PARANOIA_LOG if (acells != width || acol != left) - NSLog(@"INTERNAL ERROR [%s]", _cmd); + ASLogErr(@"INTERNAL ERROR"); #endif if (NSNotFound == destRange.location || NSNotFound == srcRange.location) { #if MM_TS_PARANOIA_LOG - NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd); + ASLogErr(@"INTERNAL ERROR: Out of bounds"); #endif return; } @@ -454,11 +444,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; destRange = [self charRangeForRow:destRow column:&acol cells:&acells]; #if MM_TS_PARANOIA_LOG if (acells != width || acol != left) - NSLog(@"INTERNAL ERROR [%s]", _cmd); + ASLogErr(@"INTERNAL ERROR"); #endif if (NSNotFound == destRange.location) { #if MM_TS_PARANOIA_LOG - NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd); + ASLogErr(@"INTERNAL ERROR: Out of bounds"); #endif return; } @@ -486,7 +476,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; scrollBottom:(int)bottom left:(int)left right:(int)right color:(NSColor *)color { - //NSLog(@"insertLinesAtRow:%d lineCount:%d color:%@", row, count, color); [self lazyResize:NO]; if (row < 0 || row+count > maxRows || bottom > maxRows || left < 0 @@ -507,19 +496,19 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; destRange = [self charRangeForRow:destRow column:&acol cells:&acells]; #if MM_TS_PARANOIA_LOG if (acells != width || acol != left) - NSLog(@"INTERNAL ERROR [%s]", _cmd); + ASLogErr(@"INTERNAL ERROR"); #endif acol = left; acells = width; srcRange = [self charRangeForRow:srcRow column:&acol cells:&acells]; #if MM_TS_PARANOIA_LOG if (acells != width || acol != left) - NSLog(@"INTERNAL ERROR [%s]", _cmd); + ASLogErr(@"INTERNAL ERROR"); #endif if (NSNotFound == destRange.location || NSNotFound == srcRange.location) { #if MM_TS_PARANOIA_LOG - NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd); + ASLogErr(@"INTERNAL ERROR: Out of bounds"); #endif return; } @@ -550,11 +539,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; destRange = [self charRangeForRow:destRow column:&acol cells:&acells]; #if MM_TS_PARANOIA_LOG if (acells != width || acol != left) - NSLog(@"INTERNAL ERROR [%s]", _cmd); + ASLogErr(@"INTERNAL ERROR"); #endif if (NSNotFound == destRange.location) { #if MM_TS_PARANOIA_LOG - NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd); + ASLogErr(@"INTERNAL ERROR: Out of bounds"); #endif return; } @@ -577,8 +566,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; - (void)clearBlockFromRow:(int)row1 column:(int)col1 toRow:(int)row2 column:(int)col2 color:(NSColor *)color { - //NSLog(@"clearBlockFromRow:%d column:%d toRow:%d column:%d color:%@", - // row1, col1, row2, col2, color); [self lazyResize:NO]; if (row1 < 0 || row2 >= maxRows || col1 < 0 || col2 > maxColumns) @@ -599,11 +586,11 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; range = [self charRangeForRow:r column:&acol cells:&acells]; #if MM_TS_PARANOIA_LOG if (acells != cells || acol != col1) - NSLog(@"INTERNAL ERROR [%s]", _cmd); + ASLogErr(@"INTERNAL ERROR"); #endif if (NSNotFound == range.location) { #if MM_TS_PARANOIA_LOG - NSLog(@"INTERNAL ERROR [%s] Out of bounds", _cmd); + ASLogErr(@"INTERNAL ERROR: Out of bounds"); #endif return; } @@ -625,7 +612,6 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; - (void)clearAll { - //NSLog(@"%s", _cmd); [self lazyResize:YES]; } @@ -684,7 +670,7 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; cellSize.height = linespace + [lm defaultLineHeightForFont:font]; } else { // Should never happen, set some bogus value for cell height. - NSLog(@"WARNING: No layout manager available in call to %s", _cmd); + ASLogWarn(@"No layout manager available"); cellSize.height = linespace + 16.0; } @@ -1018,8 +1004,8 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; if (row < 0 || row >= actualRows || col < 0 || col >= actualColumns || col+cells > actualColumns) { #if MM_TS_PARANOIA_LOG - NSLog(@"%s row=%d col=%d cells=%d is out of range (length=%d)", - _cmd, row, col, cells, stringLen); + ASLogErr(@"row=%d col=%d cells=%d is out of range (length=%d)", + row, col, cells, stringLen); #endif return range; } @@ -1175,20 +1161,20 @@ static NSString *MMWideCharacterAttributeName = @"MMWideChar"; #if MM_TS_PARANOIA_LOG #if MM_USE_ROW_CACHE if (range.location >= rowEnd-1) { - NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@", - _cmd, row, col, cells, NSStringFromRange(range)); + ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@", + row, col, cells, NSStringFromRange(range)); range.location = rowEnd - 2; range.length = 1; } else if (NSMaxRange(range) >= rowEnd) { - NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@", - _cmd, row, col, cells, NSStringFromRange(range)); + ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@", + row, col, cells, NSStringFromRange(range)); range.length = rowEnd - range.location - 1; } #endif if (NSMaxRange(range) > stringLen) { - NSLog(@"INTERNAL ERROR [%s] : row=%d col=%d cells=%d --> range=%@", - _cmd, row, col, cells, NSStringFromRange(range)); + ASLogErr(@"INTERNAL ERROR: row=%d col=%d cells=%d --> range=%@", + row, col, cells, NSStringFromRange(range)); range.location = NSNotFound; range.length = 0; } diff --git a/src/MacVim/MMTextView.m b/src/MacVim/MMTextView.m index a2aa406e0d..62240b18be 100644 --- a/src/MacVim/MMTextView.m +++ b/src/MacVim/MMTextView.m @@ -112,7 +112,7 @@ - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); if (invertRects) { free(invertRects); @@ -153,7 +153,7 @@ int cursorRow = -1, cursorCol = 0; #if MM_DEBUG_DRAWING - NSLog(@"====> BEGIN %s", _cmd); + ASLogDebug(@"====> BEGIN %s", _cmd); #endif [textStorage beginEditing]; @@ -164,7 +164,7 @@ if (ClearAllDrawType == type) { #if MM_DEBUG_DRAWING - NSLog(@" Clear all"); + ASLogDebug(@" Clear all"); #endif [textStorage clearAll]; } else if (ClearBlockDrawType == type) { @@ -175,8 +175,8 @@ int col2 = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Clear block (%d,%d) -> (%d,%d)", row1, col1, - row2,col2); + ASLogDebug(@" Clear block (%d,%d) -> (%d,%d)", row1, col1, + row2,col2); #endif [textStorage clearBlockFromRow:row1 column:col1 toRow:row2 column:col2 @@ -190,7 +190,7 @@ int right = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Delete %d line(s) from %d", count, row); + ASLogDebug(@" Delete %d line(s) from %d", count, row); #endif [textStorage deleteLinesFromRow:row lineCount:count scrollBottom:bot left:left right:right @@ -210,9 +210,9 @@ bytes += len; #if MM_DEBUG_DRAWING - NSLog(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x " - "bg=0x%x sp=0x%x (%@)", row, col, len, flags, fg, bg, sp, - len > 0 ? [string substringToIndex:1] : @""); + ASLogDebug(@" Draw string at (%d,%d) length=%d flags=%d fg=0x%x " + "bg=0x%x sp=0x%x (%@)", row, col, len, flags, fg, bg, sp, + len > 0 ? [string substringToIndex:1] : @""); #endif // NOTE: If this is a call to draw the (block) cursor, then cancel // any previous request to draw the insertion point, or it might @@ -237,7 +237,7 @@ int right = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Insert %d line(s) at row %d", count, row); + ASLogDebug(@" Insert %d line(s) at row %d", count, row); #endif [textStorage insertLinesAtRow:row lineCount:count scrollBottom:bot left:left right:right @@ -250,7 +250,7 @@ int percent = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Draw cursor at (%d,%d)", row, col); + ASLogDebug(@" Draw cursor at (%d,%d)", row, col); #endif [helper setInsertionPointColor:[NSColor colorWithRgbInt:color]]; [self drawInsertionPointAtRow:row column:col shape:shape @@ -263,8 +263,8 @@ int invert = *((int*)bytes); bytes += sizeof(int); #if MM_DEBUG_DRAWING - NSLog(@" Draw inverted rect: row=%d col=%d nrows=%d ncols=%d", - row, col, nr, nc); + ASLogDebug(@" Draw inverted rect: row=%d col=%d nrows=%d " + "ncols=%d", row, col, nr, nc); #endif [self drawInvertedRectAtRow:row column:col numRows:nr numColumns:nc invert:invert]; @@ -272,7 +272,7 @@ cursorRow = *((int*)bytes); bytes += sizeof(int); cursorCol = *((int*)bytes); bytes += sizeof(int); } else { - NSLog(@"WARNING: Unknown draw type (type=%d)", type); + ASLogWarn(@"Unknown draw type (type=%d)", type); } } @@ -293,7 +293,7 @@ [self display]; #if MM_DEBUG_DRAWING - NSLog(@"<==== END %s", _cmd); + ASLogDebug(@"<==== END %s", _cmd); #endif } @@ -451,9 +451,6 @@ if (row) *row = floor((point.y-origin.y-1) / cellSize.height); if (column) *column = floor((point.x-origin.x-1) / cellSize.width); - //NSLog(@"convertPoint:%@ toRow:%d column:%d", NSStringFromPoint(point), - // *row, *column); - return YES; } @@ -624,10 +621,6 @@ // NOTE: We only draw the cursor once and rely on Vim to say when it // should be drawn again. shouldDrawInsertionPoint = NO; - - //NSLog(@"%s draw insertion point %@ shape=%d color=%@", _cmd, - // NSStringFromRect(ipRect), insertionPointShape, - // [helper insertionPointColor]); } #if 0 diff --git a/src/MacVim/MMTextViewHelper.m b/src/MacVim/MMTextViewHelper.m index 347d5e462c..1bb1ab12be 100644 --- a/src/MacVim/MMTextViewHelper.m +++ b/src/MacVim/MMTextViewHelper.m @@ -53,6 +53,8 @@ static float MMDragAreaSize = 73.0f; - (void)dealloc { + ASLogDebug(@""); + [insertionPointColor release]; insertionPointColor = nil; [markedText release]; markedText = nil; [markedTextAttributes release]; markedTextAttributes = nil; @@ -81,7 +83,7 @@ static float MMDragAreaSize = 73.0f; - (void)keyDown:(NSEvent *)event { - //NSLog(@"%s %@", _cmd, event); + //ASLogDebug(@"%@", event); // HACK! If control modifier is held, don't pass the event along to // interpretKeyEvents: since some keys are bound to multiple commands which // means doCommandBySelector: is called several times. Do the same for @@ -140,7 +142,7 @@ static float MMDragAreaSize = 73.0f; - (void)insertText:(id)string { - //NSLog(@"%s %@", _cmd, string); + //ASLogDebug(@"%@", string); // NOTE! This method is called for normal key presses but also for // Option-key presses --- even when Ctrl is held as well as Option. When // Ctrl is held, the AppKit translates the character to a Ctrl+key stroke, @@ -178,8 +180,6 @@ static float MMDragAreaSize = 73.0f; if ([string isKindOfClass:[NSAttributedString class]]) string = [string string]; - //NSLog(@"send InsertTextMsgID: %@", string); - NSMutableData *data = [NSMutableData data]; int len = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; int flags = [event modifierFlags] & 0xffff0000U; @@ -195,7 +195,7 @@ static float MMDragAreaSize = 73.0f; - (void)doCommandBySelector:(SEL)selector { - //NSLog(@"%s %@", _cmd, NSStringFromSelector(selector)); + //ASLogDebug(@"%@", NSStringFromSelector(selector)); // By ignoring the selector we effectively disable the key binding // mechanism of Cocoa. Hopefully this is what the user will expect // (pressing Ctrl+P would otherwise result in moveUp: instead of previous @@ -234,7 +234,7 @@ static float MMDragAreaSize = 73.0f; - (BOOL)performKeyEquivalent:(NSEvent *)event { - //NSLog(@"%s %@", _cmd, event); + //ASLogDebug(@"%@", event); // Called for Cmd+key keystrokes, function keys, arrow keys, page // up/down, home, end. // @@ -289,8 +289,6 @@ static float MMDragAreaSize = 73.0f; return YES; } - //NSLog(@"%s%@", _cmd, event); - NSString *chars = [event characters]; int len = [unmodchars lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; NSMutableData *data = [NSMutableData data]; @@ -451,15 +449,11 @@ static float MMDragAreaSize = 73.0f; [data appendBytes:&col length:sizeof(int)]; [[self vimController] sendMessage:MouseMovedMsgID data:data]; - - //NSLog(@"Moved %d %d\n", col, row); } } - (void)mouseEntered:(NSEvent *)event { - //NSLog(@"%s", _cmd); - // NOTE: This event is received even when the window is not key; thus we // have to take care not to enable mouse moved events unless our window is // key. @@ -470,8 +464,6 @@ static float MMDragAreaSize = 73.0f; - (void)mouseExited:(NSEvent *)event { - //NSLog(@"%s", _cmd); - [[textView window] setAcceptsMouseMovedEvents:NO]; // NOTE: This event is received even when the window is not key; if the @@ -487,8 +479,6 @@ static float MMDragAreaSize = 73.0f; - (void)setFrame:(NSRect)frame { - //NSLog(@"%s", _cmd); - // When the frame changes we also need to update the tracking rect. [textView removeTrackingRect:trackingRectTag]; trackingRectTag = [textView addTrackingRect:[self trackingRect] @@ -499,8 +489,6 @@ static float MMDragAreaSize = 73.0f; - (void)viewDidMoveToWindow { - //NSLog(@"%s (window=%@)", _cmd, [self window]); - // Set a tracking rect which covers the text. // NOTE: While the mouse cursor is in this rect the view will receive // 'mouseMoved:' events so that Vim can take care of updating the mouse @@ -516,8 +504,6 @@ static float MMDragAreaSize = 73.0f; - (void)viewWillMoveToWindow:(NSWindow *)newWindow { - //NSLog(@"%s%@", _cmd, newWindow); - // Remove tracking rect if view moves or is removed. if ([textView window] && trackingRectTag) { [textView removeTrackingRect:trackingRectTag]; @@ -806,8 +792,8 @@ static float MMDragAreaSize = 73.0f; const char *bytes = 0; int mods = [event modifierFlags]; - //NSLog(@"%s chars[0]=0x%x unmodchars[0]=0x%x (chars=%@ unmodchars=%@)", - // _cmd, c, imc, chars, unmodchars); + //ASLogDebug(@"chars[0]=0x%x unmodchars[0]=0x%x (chars=%@ unmodchars=%@)", + // c, imc, chars, unmodchars); if (' ' == imc && 0xa0 != c) { // HACK! The AppKit turns into which is not standard @@ -855,7 +841,7 @@ static float MMDragAreaSize = 73.0f; [self hideMouseCursor]; - //NSLog(@"%s len=%d chars=0x%x", _cmd, len, chars[0]); + //ASLogDebug(@"len=%d chars=0x%x", len, chars[0]); [[self vimController] sendMessage:KeyDownMsgID data:data]; } } @@ -954,7 +940,7 @@ static float MMDragAreaSize = 73.0f; initWithImage:ibeamImage hotSpot:hotSpot]; } if (!customIbeamCursor) { - NSLog(@"WARNING: Failed to load custom Ibeam cursor"); + ASLogWarn(@"Failed to load custom Ibeam cursor"); customIbeamCursor = [NSCursor IBeamCursor]; } } diff --git a/src/MacVim/MMTypesetter.m b/src/MacVim/MMTypesetter.m index 746f181e8e..dd1bc5cbff 100644 --- a/src/MacVim/MMTypesetter.m +++ b/src/MacVim/MMTypesetter.m @@ -60,7 +60,6 @@ - (NSTypesetterControlCharacterAction) actionForControlCharacterAtIndex:(unsigned)charIndex { - //NSLog(@"%s%d", _cmd, charIndex); /*NSTextStorage *ts = [[self layoutManager] textStorage]; if ('\n' == [[ts string] characterAtIndex:charIndex]) @@ -75,9 +74,9 @@ withAdvancements:(const float *)advancements forStartOfGlyphRange:(NSRange)glyphRange { - NSLog(@"setLocation:%@ withAdvancements:%f forStartOfGlyphRange:%@", - NSStringFromPoint(location), advancements ? *advancements : 0, - NSStringFromRange(glyphRange)); + ASLogDebug(@"setLocation:%@ withAdvancements:%f forStartOfGlyphRange:%@", + NSStringFromPoint(location), advancements ? *advancements : 0, + NSStringFromRange(glyphRange)); [super setLocation:location withAdvancements:advancements forStartOfGlyphRange:glyphRange]; } diff --git a/src/MacVim/MMVimController.m b/src/MacVim/MMVimController.m index f21044c064..c973baaf5c 100644 --- a/src/MacVim/MMVimController.m +++ b/src/MacVim/MMVimController.m @@ -162,7 +162,7 @@ static BOOL isUnsafeMessage(int msgid); - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); isInitialized = NO; @@ -252,6 +252,8 @@ static BOOL isUnsafeMessage(int msgid); - (void)dropFiles:(NSArray *)filenames forceOpen:(BOOL)force { + ASLogInfo(@"filenames=%@ force=%d", filenames, force); + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; // Default to opening in tabs if layout is invalid or set to "windows". @@ -316,6 +318,8 @@ static BOOL isUnsafeMessage(int msgid); { if (!args) return; + ASLogDebug(@"args=%@", args); + [self sendMessage:OpenWithArgumentsMsgID data:[args dictionaryAsData]]; // HACK! Fool findUnusedEditor into thinking that this controller is not @@ -332,8 +336,8 @@ static BOOL isUnsafeMessage(int msgid); - (void)sendMessage:(int)msgid data:(NSData *)data { - //NSLog(@"sendMessage:%s (isInitialized=%d)", - // MessageStrings[msgid], isInitialized); + ASLogDebug(@"msg=%s (isInitialized=%d)", + MessageStrings[msgid], isInitialized); if (!isInitialized) return; @@ -341,8 +345,7 @@ static BOOL isUnsafeMessage(int msgid); [backendProxy processInput:msgid data:data]; } @catch (NSException *e) { - //NSLog(@"%@ %s Exception caught during DO call: %@", - // [self className], _cmd, e); + ASLogWarn(@"Exception caught during DO call: %@", e); } } @@ -354,6 +357,9 @@ static BOOL isUnsafeMessage(int msgid); // ball forever. In almost all circumstances sendMessage:data: should be // used instead. + ASLogDebug(@"msg=%s (isInitialized=%d)", + MessageStrings[msgid], isInitialized); + if (!isInitialized) return NO; @@ -380,6 +386,8 @@ static BOOL isUnsafeMessage(int msgid); - (void)addVimInput:(NSString *)string { + ASLogDebug(@"%@", string); + // This is a very general method of adding input to the Vim process. It is // basically the same as calling remote_send() on the process (see // ':h remote_send'). @@ -395,8 +403,11 @@ static BOOL isUnsafeMessage(int msgid); @try { eval = [backendProxy evaluateExpression:expr]; + ASLogDebug(@"eval(%@)=%@", expr, eval); + } + @catch (NSException *ex) { + ASLogWarn(@"Exception caught: %@", ex); } - @catch (NSException *ex) { /* do nothing */ } return eval; } @@ -409,7 +420,9 @@ static BOOL isUnsafeMessage(int msgid); @try { eval = [backendProxy evaluateExpressionCocoa:expr errorString:errstr]; + ASLogDebug(@"eval(%@)=%@", expr, eval); } @catch (NSException *ex) { + ASLogWarn(@"Exception caught: %@", ex); *errstr = [ex reason]; } @@ -447,7 +460,7 @@ static BOOL isUnsafeMessage(int msgid); [windowController processInputQueueDidFinish]; } @catch (NSException *ex) { - NSLog(@"[%s] Caught exception (pid=%d): %@", _cmd, pid, ex); + ASLogWarn(@"Caught exception (pid=%d): %@", pid, ex); } } @@ -457,7 +470,7 @@ static BOOL isUnsafeMessage(int msgid); { NSToolbarItem *item = [toolbarItemDict objectForKey:itemId]; if (!item) { - NSLog(@"WARNING: No toolbar item with id '%@'", itemId); + ASLogWarn(@"No toolbar item with id '%@'", itemId); } return item; @@ -485,18 +498,16 @@ static BOOL isUnsafeMessage(int msgid); unsigned i, count = [queue count]; if (count % 2) { - NSLog(@"WARNING: Uneven number of components (%d) in command " - "queue. Skipping...", count); + ASLogWarn(@"Uneven number of components (%d) in command queue. " + "Skipping...", count); return; } - //NSLog(@"======== %s BEGIN ========", _cmd); for (i = 0; i < count; i += 2) { NSData *value = [queue objectAtIndex:i]; NSData *data = [queue objectAtIndex:i+1]; int msgid = *((int*)[value bytes]); - //NSLog(@"%s%s", _cmd, MessageStrings[msgid]); BOOL inDefaultMode = [[[NSRunLoop currentRunLoop] currentMode] isEqual:NSDefaultRunLoopMode]; @@ -517,19 +528,19 @@ static BOOL isUnsafeMessage(int msgid); if (!delayQueue) delayQueue = [NSMutableArray array]; - //NSLog(@"Adding unsafe message '%s' to delay queue (mode=%@)", - // MessageStrings[msgid], - // [[NSRunLoop currentRunLoop] currentMode]); + ASLogDebug(@"Adding unsafe message '%s' to delay queue (mode=%@)", + MessageStrings[msgid], + [[NSRunLoop currentRunLoop] currentMode]); [delayQueue addObject:value]; [delayQueue addObject:data]; } else { [self handleMessage:msgid data:data]; } } - //NSLog(@"======== %s END ========", _cmd); if (delayQueue) { - //NSLog(@" Flushing delay queue (%d items)", [delayQueue count]/2); + ASLogDebug(@" Flushing delay queue (%d items)", + [delayQueue count]/2); [self performSelector:@selector(processInputQueue:) withObject:delayQueue afterDelay:0]; @@ -538,10 +549,6 @@ static BOOL isUnsafeMessage(int msgid); - (void)handleMessage:(int)msgid data:(NSData *)data { - //if (msgid != AddMenuMsgID && msgid != AddMenuItemMsgID && - // msgid != EnableMenuItemMsgID) - // NSLog(@"%@ %s%s", [self className], _cmd, MessageStrings[msgid]); - if (OpenWindowMsgID == msgid) { [windowController openWindow]; @@ -555,7 +562,6 @@ static BOOL isUnsafeMessage(int msgid); #if 0 // NOTE: Tab selection is done inside updateTabsWithData:. const void *bytes = [data bytes]; int idx = *((int*)bytes); - //NSLog(@"Selecting tab with index %d", idx); [windowController selectTabWithIndex:idx]; #endif } else if (UpdateTabBarMsgID == msgid) { @@ -743,7 +749,6 @@ static BOOL isUnsafeMessage(int msgid); [windowController adjustLinespace:linespace]; } else if (ActivateMsgID == msgid) { - //NSLog(@"ActivateMsgID"); [NSApp activateIgnoringOtherApps:YES]; [[windowController window] makeKeyAndOrderFront:self]; } else if (SetServerNameMsgID == msgid) { @@ -813,7 +818,7 @@ static BOOL isUnsafeMessage(int msgid); // IMPORTANT: When adding a new message, make sure to update // isUnsafeMessage() if necessary! } else { - NSLog(@"WARNING: Unknown message received (msgid=%d)", msgid); + ASLogWarn(@"Unknown message received (msgid=%d)", msgid); } } @@ -822,6 +827,8 @@ static BOOL isUnsafeMessage(int msgid); { NSString *path = (code == NSOKButton) ? [panel filename] : nil; + ASLogDebug(@"Open/save panel path=%@", path); + // NOTE! setDialogReturn: is a synchronous call so set a proper timeout to // avoid waiting forever for it to finish. We make this a synchronous call // so that we can be fairly certain that Vim doesn't think the dialog box @@ -840,7 +847,7 @@ static BOOL isUnsafeMessage(int msgid); noteNewRecentFilePath:path]; } @catch (NSException *e) { - NSLog(@"Exception caught in %s %@", _cmd, e); + ASLogWarn(@"Exception caught: %@", e); } @finally { [conn setRequestTimeout:oldTimeout]; @@ -860,11 +867,13 @@ static BOOL isUnsafeMessage(int msgid); ret = [NSArray arrayWithObject:[NSNumber numberWithInt:code]]; } + ASLogDebug(@"Alert return=%@", ret); + @try { [backendProxy setDialogReturn:ret]; } @catch (NSException *e) { - NSLog(@"Exception caught in %s %@", _cmd, e); + ASLogWarn(@"Exception caught: %@", e); } } @@ -1024,8 +1033,8 @@ static BOOL isUnsafeMessage(int msgid); NSMenu *parent = [self parentMenuForDescriptor:desc]; if (!parent) { - NSLog(@"WARNING: Menu item '%@' has no parent", - [desc componentsJoinedByString:@"->"]); + ASLogWarn(@"Menu item '%@' has no parent", + [desc componentsJoinedByString:@"->"]); return; } @@ -1087,8 +1096,8 @@ static BOOL isUnsafeMessage(int msgid); NSMenuItem *item = [self menuItemForDescriptor:desc]; if (!item) { - NSLog(@"Failed to remove menu item, descriptor not found: %@", - [desc componentsJoinedByString:@"->"]); + ASLogWarn(@"Failed to remove menu item, descriptor not found: %@", + [desc componentsJoinedByString:@"->"]); return; } @@ -1111,9 +1120,6 @@ static BOOL isUnsafeMessage(int msgid); { if (!(desc && [desc count] > 0)) return; - /*NSLog(@"%sable item %@", on ? "En" : "Dis", - [desc componentsJoinedByString:@"->"]);*/ - NSString *rootName = [desc objectAtIndex:0]; if ([rootName isEqual:@"ToolBar"]) { if (toolbar && [desc count] == 2) { @@ -1153,10 +1159,10 @@ static BOOL isUnsafeMessage(int msgid); img = nil; } if (!img) { - NSLog(@"WARNING: Could not find image with name '%@' to use as toolbar" - " image for identifier '%@';" - " using default toolbar icon '%@' instead.", - icon, title, MMDefaultToolbarImageName); + ASLogNotice(@"Could not find image with name '%@' to use as toolbar" + " image for identifier '%@';" + " using default toolbar icon '%@' instead.", + icon, title, MMDefaultToolbarImageName); img = [NSImage imageNamed:MMDefaultToolbarImageName]; } @@ -1243,7 +1249,7 @@ static BOOL isUnsafeMessage(int msgid); - (void)connectionDidDie:(NSNotification *)notification { - //NSLog(@"%@ %s%@", [self className], _cmd, notification); + ASLogDebug(@"%@", notification); [self scheduleClose]; } @@ -1399,8 +1405,11 @@ static BOOL isUnsafeMessage(int msgid); @implementation MMAlert + - (void)dealloc { + ASLogDebug(@""); + [textField release]; textField = nil; [super dealloc]; } diff --git a/src/MacVim/MMVimView.m b/src/MacVim/MMVimView.m index d371f5e2fc..b2b1af0990 100644 --- a/src/MacVim/MMVimView.m +++ b/src/MacVim/MMVimView.m @@ -152,7 +152,7 @@ enum { - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); [tabBarControl release]; tabBarControl = nil; [tabView release]; tabView = nil; @@ -311,7 +311,7 @@ enum { forTabViewItem:tvi]; break; default: - NSLog(@"WARNING: Unknown tab info for index: %d", i); + ASLogWarn(@"Unknown tab info for index: %d", i); } [val release]; @@ -326,7 +326,6 @@ enum { int i, count = [[self tabView] numberOfTabViewItems]; for (i = count-1; i >= tabIdx; --i) { id tvi = [tabViewItems objectAtIndex:i]; - //NSLog(@"Removing tab with index %d", i); [[self tabView] removeTabViewItem:tvi]; } vimTaskSelectedTab = NO; @@ -336,11 +335,9 @@ enum { - (void)selectTabWithIndex:(int)idx { - //NSLog(@"%s%d", _cmd, idx); - NSArray *tabViewItems = [[self tabBarControl] representedTabViewItems]; if (idx < 0 || idx >= [tabViewItems count]) { - NSLog(@"WARNING: No tab with index %d exists.", idx); + ASLogWarn(@"No tab with index %d exists.", idx); return; } @@ -376,8 +373,6 @@ enum { - (void)createScrollbarWithIdentifier:(long)ident type:(int)type { - //NSLog(@"Create scroller %d of type %d", ident, type); - MMScroller *scroller = [[MMScroller alloc] initWithIdentifier:ident type:type]; [scroller setTarget:self]; @@ -390,8 +385,6 @@ enum { - (BOOL)destroyScrollbarWithIdentifier:(long)ident { - //NSLog(@"Destroy scroller %d", ident); - unsigned idx = 0; MMScroller *scroller = [self scrollbarForIdentifier:ident index:&idx]; if (!scroller) return NO; @@ -410,8 +403,6 @@ enum { if (!scroller) return NO; BOOL wasVisible = ![scroller isHidden]; - //NSLog(@"%s scroller %d (was %svisible)", visible ? "Show" : "Hide", - // ident, wasVisible ? "" : "in"); [scroller setHidden:!visible]; // If a scroller was hidden or shown then the vim view must resize. This @@ -423,8 +414,6 @@ enum { identifier:(long)ident { MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL]; - //NSLog(@"Set thumb value %.2f proportion %.2f for scroller %d", - // val, prop, ident); [scroller setFloatValue:val knobProportion:prop]; [scroller setEnabled:prop != 1.f]; } @@ -449,8 +438,6 @@ enum { MMScroller *scroller = [self scrollbarForIdentifier:ident index:NULL]; NSRange range = NSMakeRange(pos, len); if (!NSEqualRanges(range, [scroller range])) { - //NSLog(@"Set range %@ for scroller %d", - // NSStringFromRange(range), ident); [scroller setRange:range]; // TODO! Should only do this once per update. @@ -502,7 +489,6 @@ enum { // on the tab. Instead of letting the tab bar close the tab, we return NO // and pass a message on to Vim to let it handle the closing. int idx = [self representedIndexOfTabViewItem:tabViewItem]; - //NSLog(@"Closing tab with index %d", idx); NSData *data = [NSData dataWithBytes:&idx length:sizeof(int)]; [vimController sendMessage:CloseTabMsgID data:data]; @@ -743,7 +729,6 @@ enum { rect.size.height = 0; } - //NSLog(@"set scroller #%d frame = %@", i, NSStringFromRect(rect)); NSRect oldRect = [scroller frame]; if (!NSEqualRects(oldRect, rect)) { [scroller setFrame:rect]; @@ -856,9 +841,9 @@ enum { int msgid = [self inLiveResize] ? LiveResizeMsgID : SetTextDimensionsMsgID; - //NSLog(@"Notify Vim that text dimensions changed from %dx%d to %dx%d" - // " (%s)", cols, rows, constrained[1], constrained[0], - // MessageStrings[msgid]); + ASLogDebug(@"Notify Vim that text dimensions changed from %dx%d to " + "%dx%d (%s)", cols, rows, constrained[1], constrained[0], + MessageStrings[msgid]); [vimController sendMessage:msgid data:data]; diff --git a/src/MacVim/MMWindow.m b/src/MacVim/MMWindow.m index 66b6f972c9..9644a511c9 100644 --- a/src/MacVim/MMWindow.m +++ b/src/MacVim/MMWindow.m @@ -63,7 +63,7 @@ - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); // TODO: Is there any reason why we would want the following call? //[tablineSeparator removeFromSuperviewWithoutNeedingDisplay]; @@ -144,10 +144,10 @@ { NSScreen *screen = [self screen]; if (!screen) { - NSLog(@"[%s] WINDOW NOT ON SCREEN, zoom to main screen", _cmd); + ASLogNotice(@"Window not on screen, zoom to main screen"); screen = [NSScreen mainScreen]; if (!screen) { - NSLog(@"[%s] NO MAIN SCREEN, abort zoom", _cmd); + ASLogNotice(@"No main screen, abort zoom"); return; } } diff --git a/src/MacVim/MMWindowController.m b/src/MacVim/MMWindowController.m index 7c06845b42..251595f34d 100644 --- a/src/MacVim/MMWindowController.m +++ b/src/MacVim/MMWindowController.m @@ -201,7 +201,7 @@ - (void)dealloc { - LOG_DEALLOC + ASLogDebug(@""); [decoratedWindow release]; decoratedWindow = nil; [windowAutosaveKey release]; windowAutosaveKey = nil; @@ -241,7 +241,7 @@ - (void)cleanup { - //NSLog(@"%@ %s", [self className], _cmd); + ASLogDebug(@"%@ %s", [self className], _cmd); if (fullscreenEnabled) { // If we are closed while still in fullscreen, end fullscreen mode, @@ -302,8 +302,8 @@ - (void)setTextDimensionsWithRows:(int)rows columns:(int)cols isLive:(BOOL)live isReply:(BOOL)reply { - //NSLog(@"setTextDimensionsWithRows:%d columns:%d isLive:%d isReply:%d", - // rows, cols, live, reply); + ASLogDebug(@"setTextDimensionsWithRows:%d columns:%d isLive:%d isReply:%d", + rows, cols, live, reply); // NOTE: The only place where the (rows,columns) of the vim view are // modified is here and when entering/leaving full-screen. Setting these @@ -551,8 +551,8 @@ [[vimView textView] constrainRows:&constrained[0] columns:&constrained[1] toSize:textViewSize]; - //NSLog(@"End of live resize, notify Vim that text dimensions are %dx%d", - // constrained[1], constrained[0]); + ASLogDebug(@"End of live resize, notify Vim that text dimensions are %dx%d", + constrained[1], constrained[0]); NSData *data = [NSData dataWithBytes:constrained length:2*sizeof(int)]; BOOL sendOk = [vimController sendMessageNow:SetTextDimensionsMsgID @@ -999,7 +999,7 @@ reply = [backendProxy starRegisterToPasteboard:pb]; } @catch (NSException *e) { - NSLog(@"WARNING: Caught exception in %s: \"%@\"", _cmd, e); + ASLogWarn(@"Caught exception: \"%@\"", e); } } diff --git a/src/MacVim/MacVim.h b/src/MacVim/MacVim.h index 68c74a4a6f..1dbe698cfa 100644 --- a/src/MacVim/MacVim.h +++ b/src/MacVim/MacVim.h @@ -332,7 +332,7 @@ void ASLInit(); #define ASLog(level, fmt, ...) \ if (level <= ASLogLevel) { \ - asl_log(NULL, NULL, level, "%s@%d %s", \ + asl_log(NULL, NULL, level, "%s@%d: %s", \ __PRETTY_FUNCTION__, __LINE__, \ [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); \ } diff --git a/src/MacVim/MacVim.m b/src/MacVim/MacVim.m index 3e59d6b378..5b2942e39a 100644 --- a/src/MacVim/MacVim.m +++ b/src/MacVim/MacVim.m @@ -122,7 +122,8 @@ debugStringForMessageQueue(NSArray *queue) { NSMutableString *s = [NSMutableString new]; unsigned i, count = [queue count]; - int item = 0, menu = 0, enable = 0; + int item = 0, menu = 0, enable = 0, remove = 0; + int sets = 0, sett = 0, shows = 0, cres = 0, dess = 0; for (i = 0; i < count; i += 2) { NSData *value = [queue objectAtIndex:i]; int msgid = *((int*)[value bytes]); @@ -131,11 +132,23 @@ debugStringForMessageQueue(NSArray *queue) if (msgid == AddMenuItemMsgID) ++item; else if (msgid == AddMenuMsgID) ++menu; else if (msgid == EnableMenuItemMsgID) ++enable; + else if (msgid == RemoveMenuItemMsgID) ++remove; + else if (msgid == SetScrollbarPositionMsgID) ++sets; + else if (msgid == SetScrollbarThumbMsgID) ++sett; + else if (msgid == ShowScrollbarMsgID) ++shows; + else if (msgid == CreateScrollbarMsgID) ++cres; + else if (msgid == DestroyScrollbarMsgID) ++dess; else [s appendFormat:@"%s ", MessageStrings[msgid]]; } if (item > 0) [s appendFormat:@"AddMenuItemMsgID(%d) ", item]; if (menu > 0) [s appendFormat:@"AddMenuMsgID(%d) ", menu]; if (enable > 0) [s appendFormat:@"EnableMenuItemMsgID(%d) ", enable]; + if (remove > 0) [s appendFormat:@"RemoveMenuItemMsgID(%d) ", remove]; + if (sets > 0) [s appendFormat:@"SetScrollbarPositionMsgID(%d) ", sets]; + if (sett > 0) [s appendFormat:@"SetScrollbarThumbMsgID(%d) ", sett]; + if (shows > 0) [s appendFormat:@"ShowScrollbarMsgID(%d) ", shows]; + if (cres > 0) [s appendFormat:@"CreateScrollbarMsgID(%d) ", cres]; + if (dess > 0) [s appendFormat:@"DestroyScrollbarMsgID(%d) ", dess]; return [s autorelease]; } diff --git a/src/MacVim/Miscellaneous.h b/src/MacVim/Miscellaneous.h index 0e41fda8d3..5c18665093 100644 --- a/src/MacVim/Miscellaneous.h +++ b/src/MacVim/Miscellaneous.h @@ -12,14 +12,6 @@ #import #import "MacVim.h" -#define MM_LOG_DEALLOCATIONS 0 - - -#if MM_LOG_DEALLOCATIONS -# define LOG_DEALLOC NSLog(@"%s %@", _cmd, [self className]); -#else -# define LOG_DEALLOC -#endif // NSUserDefaults keys diff --git a/src/MacVim/PlugInGUI.m b/src/MacVim/PlugInGUI.m index 8797d235ef..b1e272002d 100644 --- a/src/MacVim/PlugInGUI.m +++ b/src/MacVim/PlugInGUI.m @@ -120,7 +120,7 @@ NSString *MMPlugInViewPboardType = @"MMPlugInViewPboardType"; if ((self = [super init]) == nil) return nil; if (![NSBundle loadNibNamed:@"PlugInView" owner:self]) - NSLog(@"Error loading PlugIn nib"); + ASLogErr(@"Error loading PlugIn nib"); [titleField setStringValue:title]; @@ -196,6 +196,8 @@ NSString *MMPlugInViewPboardType = @"MMPlugInViewPboardType"; - (void)dealloc { + ASLogDebug(@""); + [fillerView release]; fillerView = nil; [super dealloc]; } diff --git a/src/MacVim/PlugInImpl.m b/src/MacVim/PlugInImpl.m index 066a7ac540..5ba1b1d10c 100644 --- a/src/MacVim/PlugInImpl.m +++ b/src/MacVim/PlugInImpl.m @@ -98,7 +98,7 @@ static int MMPlugInArchMinorVersion = 0; - (void)dealloc { - //NSLog(@"%@ %s", [self className], _cmd); + ASLogDebug(@""); [plugInViews release]; plugInViews = nil; [instances release]; instances = nil; @@ -126,8 +126,6 @@ static int MMPlugInArchMinorVersion = 0; - (void)addPlugInView:(NSView *)view withTitle:(NSString *)title { - //NSLog(@"%@ %s", [self className], _cmd); - // Do this here so that the drawer is never opened automatically when there // are no plugin views. if ([[NSUserDefaults standardUserDefaults] diff --git a/src/MacVim/gui_macvim.m b/src/MacVim/gui_macvim.m index 86d332b3fa..cc83b9d970 100644 --- a/src/MacVim/gui_macvim.m +++ b/src/MacVim/gui_macvim.m @@ -47,8 +47,6 @@ vimmenu_T *menu_for_descriptor(NSArray *desc); void gui_mch_prepare(int *argc, char **argv) { - //NSLog(@"gui_mch_prepare(argc=%d)", *argc); - // Set environment variables $VIM and $VIMRUNTIME // NOTE! If vim_getenv is called with one of these as parameters before // they have been set here, they will most likely end up with the wrong @@ -98,7 +96,6 @@ gui_mch_prepare(int *argc, char **argv) int gui_mch_init_check(void) { - //NSLog(@"gui_mch_init_check()"); return OK; } @@ -110,8 +107,8 @@ gui_mch_init_check(void) int gui_mch_init(void) { - //NSLog(@"gui_mch_init()"); ASLInit(); + ASLogDebug(@""); if (![[MMBackend sharedInstance] checkin]) { // TODO: Kill the process if there is no terminal to fall back on, @@ -153,7 +150,7 @@ gui_mch_init(void) void gui_mch_exit(int rc) { - //NSLog(@"gui_mch_exit(rc=%d)", rc); + ASLogDebug(@"rc=%d", rc); [[MMBackend sharedInstance] exit]; } @@ -468,8 +465,7 @@ gui_mch_new_colors(void) gui.def_back_pixel = gui.back_pixel; gui.def_norm_pixel = gui.norm_pixel; - //NSLog(@"gui_mch_new_colors(back=%x, norm=%x)", gui.def_back_pixel, - // gui.def_norm_pixel); + ASLogDebug(@"back=%x norm=%x", gui.def_back_pixel, gui.def_norm_pixel); [[MMBackend sharedInstance] setDefaultColorsBackground:gui.def_back_pixel @@ -936,7 +932,7 @@ gui_mch_free_font(font) GuiFont font; { if (font != NOFONT) { - //NSLog(@"gui_mch_free_font(font=0x%x)", font); + ASLogDebug(@"font=0x%x", font); [(id)font release]; } } @@ -955,8 +951,7 @@ gui_mch_retain_font(GuiFont font) GuiFont gui_mch_get_font(char_u *name, int giveErrorIfMissing) { - //NSLog(@"gui_mch_get_font(name=%s, giveErrorIfMissing=%d)", name, - // giveErrorIfMissing); + ASLogDebug(@"name='%s' giveErrorIfMissing=%d", name, giveErrorIfMissing); GuiFont font = gui_macvim_font_with_name(name); if (font != NOFONT) @@ -989,7 +984,7 @@ gui_mch_get_fontname(GuiFont font, char_u *name) int gui_mch_init_font(char_u *font_name, int fontset) { - //NSLog(@"gui_mch_init_font(font_name=%s, fontset=%d)", font_name, fontset); + ASLogDebug(@"font_name='%s' fontset=%d", font_name, fontset); if (font_name && STRCMP(font_name, "*") == 0) { // :set gfn=* shows the font panel. @@ -1241,14 +1236,14 @@ gui_mch_stop_blink(void) void gui_mch_getmouse(int *x, int *y) { - //NSLog(@"gui_mch_getmouse()"); + ASLogInfo(@"Not implemented!"); } void gui_mch_setmouse(int x, int y) { - //NSLog(@"gui_mch_setmouse(x=%d, y=%d)", x, y); + ASLogInfo(@"Not implemented!"); } @@ -1426,8 +1421,8 @@ gui_mch_browse( char_u *initdir, char_u *filter) { - //NSLog(@"gui_mch_browse(saving=%d, title=%s, dflt=%s, ext=%s, initdir=%s," - // " filter=%s", saving, title, dflt, ext, initdir, filter); + ASLogDebug(@"saving=%d title='%s' dflt='%s' ext='%s' initdir='%s' " + "filter='%s'", saving, title, dflt, ext, initdir, filter); // Ensure no data is on the output queue before presenting the dialog. gui_macvim_force_flush(); @@ -1456,9 +1451,9 @@ gui_mch_dialog( int dfltbutton, char_u *textfield) { - //NSLog(@"gui_mch_dialog(type=%d title=%s message=%s buttons=%s " - // "dfltbutton=%d textfield=%s)", type, title, message, buttons, - // dfltbutton, textfield); + ASLogDebug(@"type=%d title='%s' message='%s' buttons='%s' dfltbutton=%d " + "textfield='%s'", type, title, message, buttons, dfltbutton, + textfield); // Ensure no data is on the output queue before presenting the dialog. gui_macvim_force_flush(); @@ -1571,7 +1566,7 @@ gui_mch_get_rgb(guicolor_T pixel) void gui_mch_get_screen_dimensions(int *screen_w, int *screen_h) { - //NSLog(@"gui_mch_get_screen_dimensions()"); + ASLogDebug(@"Columns=%d Rows=%d", Columns, Rows); *screen_w = Columns; *screen_h = Rows; } @@ -1644,10 +1639,9 @@ gui_mch_set_shellsize( int base_height, int direction) { - //NSLog(@"gui_mch_set_shellsize(width=%d, height=%d, min_width=%d," - // " min_height=%d, base_width=%d, base_height=%d, direction=%d)", - // width, height, min_width, min_height, base_width, base_height, - // direction); + ASLogDebug(@"width=%d height=%d min_width=%d min_height=%d base_width=%d " + "base_height=%d direction=%d", width, height, min_width, + min_height, base_width, base_height, direction); [[MMBackend sharedInstance] setRows:height columns:width]; } @@ -1675,7 +1669,7 @@ gui_mch_set_winpos(int x, int y) void gui_mch_settitle(char_u *title, char_u *icon) { - //NSLog(@"gui_mch_settitle(title=%s, icon=%s)", title, icon); + ASLogDebug(@"title='%s' icon='%s'", title, icon); #ifdef FEAT_MBYTE title = CONVERT_TO_UTF8(title);