From 20900ebeae1f9aa9fdad8403289aa5c1328e1754 Mon Sep 17 00:00:00 2001 From: Jakub Kaspar Date: Wed, 3 Mar 2021 23:37:58 +0100 Subject: [PATCH] Remove titleaccessoryView as it's not used anyways anymore --- Interfaces/DBView.xib | 24 -------- .../MainViewControllers/SPDatabaseDocument.h | 2 - .../MainViewControllers/SPDatabaseDocument.m | 58 +------------------ .../Controllers/Window/SPWindowController.m | 2 - 4 files changed, 1 insertion(+), 85 deletions(-) diff --git a/Interfaces/DBView.xib b/Interfaces/DBView.xib index a1ba2df84..f964b392e 100644 --- a/Interfaces/DBView.xib +++ b/Interfaces/DBView.xib @@ -62,9 +62,6 @@ - - - @@ -4160,27 +4157,6 @@ Gw - - - - - - - - - - - - - - - - - - - - - diff --git a/Source/Controllers/MainViewControllers/SPDatabaseDocument.h b/Source/Controllers/MainViewControllers/SPDatabaseDocument.h index f5c399f9d..2ac91d884 100644 --- a/Source/Controllers/MainViewControllers/SPDatabaseDocument.h +++ b/Source/Controllers/MainViewControllers/SPDatabaseDocument.h @@ -95,7 +95,6 @@ IBOutlet NSView *parentView; - IBOutlet NSView *titleAccessoryView; IBOutlet id titleImageView; IBOutlet id titleStringView; @@ -409,7 +408,6 @@ - (void)setStatusIconToImageWithName:(NSString *)imagePath; - (void)setTitlebarStatus:(NSString *)status; - (void)clearStatusIcon; -- (void)updateTitlebarStatusVisibilityForcingHide:(BOOL)forceHide; // Toolbar methods - (void)updateWindowTitle:(id)sender; diff --git a/Source/Controllers/MainViewControllers/SPDatabaseDocument.m b/Source/Controllers/MainViewControllers/SPDatabaseDocument.m index a1d4bdf5a..469331986 100644 --- a/Source/Controllers/MainViewControllers/SPDatabaseDocument.m +++ b/Source/Controllers/MainViewControllers/SPDatabaseDocument.m @@ -223,8 +223,6 @@ - (instancetype)initWithWindowController:(SPWindowController *)windowController spfDocData = [[NSMutableDictionary alloc] init]; runningActivitiesArray = [[NSMutableArray alloc] init]; - titleAccessoryView = nil; - taskProgressWindow = nil; taskDisplayIsIndeterminate = YES; taskDisplayLastValue = 0; @@ -330,8 +328,6 @@ - (void)awakeFromNib [taskProgressWindow setAlphaValue:0.0f]; [taskProgressWindow setContentView:taskProgressLayer]; - [self updateTitlebarStatusVisibilityForcingHide:NO]; - alterDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseAlterEncodingButton CollationButton:databaseAlterCollationButton]; addDatabaseCharsetHelper = [[SPCharsetCollationHelper alloc] initWithCharsetButton:databaseEncodingButton CollationButton:databaseCollationButton]; } @@ -3624,53 +3620,6 @@ - (void)clearStatusIcon [titleImageView setImage:nil]; } -/** - * Update the title bar status area visibility. The status area is visible if the tab is - * frontmost in the window, and if the window is not fullscreen. - */ -- (void)updateTitlebarStatusVisibilityForcingHide:(BOOL)forceHide -{ - BOOL newIsVisible = !forceHide; - if (newIsVisible && [[self.parentWindowController window] styleMask] & NSWindowStyleMaskFullScreen) newIsVisible = NO; - if (newIsVisible && [self.parentWindowController selectedTableDocument] != self) newIsVisible = NO; - if (newIsVisible == windowTitleStatusViewIsVisible) return; - - if (newIsVisible) { - Class controllerClass; - if ((controllerClass = NSClassFromString(@"NSTitlebarAccessoryViewController"))) { // OS X 10.11 and later - [titleAccessoryView setFrame:NSMakeRect(0, 0, titleAccessoryView.frame.size.width, 120)]; // make it really tall, so that it's on the top right of the title/toolbar area, instead of the bottom right (AppKit will not prevent it from going behind the toolbar) - - NSTitlebarAccessoryViewController *accessoryViewController = [[controllerClass alloc] init]; - accessoryViewController.view = titleAccessoryView; - accessoryViewController.layoutAttribute = NSLayoutAttributeRight; - [[self.parentWindowController window] addTitlebarAccessoryViewController:accessoryViewController]; - } else { - NSView *windowFrame = [[[self.parentWindowController window] contentView] superview]; - NSRect av = [titleAccessoryView frame]; - NSRect initialAccessoryViewFrame = NSMakeRect( - [windowFrame frame].size.width - av.size.width - 30, - [windowFrame frame].size.height - av.size.height, - av.size.width, - av.size.height - ); - [titleAccessoryView setFrame:initialAccessoryViewFrame]; - [windowFrame addSubview:titleAccessoryView]; - } - } else { - if (NSClassFromString(@"NSTitlebarAccessoryViewController")) { // OS X 10.11 and later - [[self.parentWindowController window].titlebarAccessoryViewControllers enumerateObjectsUsingBlock:^(__kindof NSTitlebarAccessoryViewController * _Nonnull accessoryViewController, NSUInteger idx, BOOL * _Nonnull stop) { - if (accessoryViewController.view == titleAccessoryView) { - [[self.parentWindowController window] removeTitlebarAccessoryViewControllerAtIndex:idx]; - } - }]; - } else { - [titleAccessoryView removeFromSuperview]; - } - } - - windowTitleStatusViewIsVisible = newIsVisible; -} - #pragma mark - #pragma mark Toolbar Methods @@ -4081,10 +4030,7 @@ - (void)parentTabDidClose * window, but is being switched away from, to allow cleaning up * details in the window. */ -- (void)willResignActiveTabInWindow -{ - [self updateTitlebarStatusVisibilityForcingHide:YES]; - +- (void)willResignActiveTabInWindow { // Remove the task progress window [[self.parentWindowController window] removeChildWindow:taskProgressWindow]; [taskProgressWindow orderOut:self]; @@ -4105,8 +4051,6 @@ - (void)didBecomeActiveTabInWindow [self updateWindowTitle:self]; [[self.parentWindowController window] setRepresentedURL:(spfFileURL && [spfFileURL isFileURL] ? spfFileURL : nil)]; - [self updateTitlebarStatusVisibilityForcingHide:NO]; - // Add the progress window to this window [self centerTaskWindow]; [[self.parentWindowController window] addChildWindow:taskProgressWindow ordered:NSWindowAbove]; diff --git a/Source/Controllers/Window/SPWindowController.m b/Source/Controllers/Window/SPWindowController.m index af0d45da9..cec6d240c 100644 --- a/Source/Controllers/Window/SPWindowController.m +++ b/Source/Controllers/Window/SPWindowController.m @@ -579,7 +579,6 @@ - (void)windowDidResize:(NSNotification *)notification */ - (void)windowWillEnterFullScreen:(NSNotification *)notification { - [self.selectedTableDocument updateTitlebarStatusVisibilityForcingHide:YES]; } /** @@ -587,7 +586,6 @@ - (void)windowWillEnterFullScreen:(NSNotification *)notification */ - (void)windowDidExitFullScreen:(NSNotification *)notification { - [self.selectedTableDocument updateTitlebarStatusVisibilityForcingHide:NO]; } #pragma mark -