From 1b049b8f75a3fd53b13e09c3b7f8ea6a565559f6 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 15 Sep 2018 17:57:59 +0300 Subject: [PATCH] Fixing UI bugs in the Cocoa debugger. Console windows now display the ROM file name --- Cocoa/Document.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Cocoa/Document.m b/Cocoa/Document.m index 9866064..cf2a7f9 100644 --- a/Cocoa/Document.m +++ b/Cocoa/Document.m @@ -356,6 +356,9 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height, [self.feedSaveButton removeFromSuperview]; + + self.consoleWindow.title = [NSString stringWithFormat:@"Debug Console – %@", [[self.fileURL path] lastPathComponent]]; + /* contentView.superview.subviews.lastObject is the titlebar view */ NSView *titleView = self.printerFeedWindow.contentView.superview.subviews.lastObject; [titleView addSubview: self.feedSaveButton]; @@ -587,7 +590,7 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height, [textView.textStorage appendAttributedString:pending_console_output]; [textView scrollToEndOfDocument:nil]; if ([[NSUserDefaults standardUserDefaults] boolForKey:@"DeveloperMode"]) { - [self.consoleWindow orderBack:nil]; + [self.consoleWindow orderFront:nil]; } pending_console_output = nil; } @@ -631,7 +634,7 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height, [pending_console_output appendAttributedString:attributed]; } - if ([console_output_timer isValid]) { + if (![console_output_timer isValid]) { console_output_timer = [NSTimer timerWithTimeInterval:(NSTimeInterval)0.05 repeats:NO block:^(NSTimer * _Nonnull timer) { [self appendPendingOutput]; }]; @@ -1416,4 +1419,11 @@ static void printImage(GB_gameboy_t *gb, uint32_t *image, uint8_t height, }]; } +- (void)setFileURL:(NSURL *)fileURL +{ + [super setFileURL:fileURL]; + self.consoleWindow.title = [NSString stringWithFormat:@"Debug Console – %@", [[fileURL path] lastPathComponent]]; + +} + @end