diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 20 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.h | 2 | ||||
-rw-r--r-- | Source/SPDatabaseDocument.m | 37 |
3 files changed, 38 insertions, 21 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 88902161..2ce00e2d 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15E39d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> +<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> <dependencies> <deployment identifier="macosx"/> <development version="5100" identifier="xcode"/> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/> - <plugIn identifier="com.apple.WebKitIBPlugin" version="9532"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/> + <plugIn identifier="com.apple.WebKitIBPlugin" version="10117"/> </dependencies> <objects> <customObject id="-2" userLabel="File's Owner" customClass="SPDatabaseDocument"> @@ -885,7 +885,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <tableView identifier="TableStructureIndexesTableView" focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" alternatingRowBackgroundColors="YES" multipleSelection="NO" autosaveColumns="NO" rowHeight="16" headerView="3923" id="289" customClass="SPTableView"> - <rect key="frame" x="0.0" y="0.0" width="694" height="135"/> + <rect key="frame" x="0.0" y="0.0" width="690" height="18"/> <autoresizingMask key="autoresizingMask"/> <size key="intercellSpacing" width="3" height="2"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> @@ -3440,7 +3440,7 @@ Gw <box autoresizesSubviews="NO" title="Table:" borderType="line" id="5660"> <rect key="frame" x="17" y="231" width="345" height="56"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <view key="contentView" id="5Bl-Ho-IU0"> + <view key="contentView"> <rect key="frame" x="1" y="1" width="343" height="40"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> @@ -3479,7 +3479,7 @@ Gw <box autoresizesSubviews="NO" title="Name" borderType="line" id="7798"> <rect key="frame" x="17" y="291" width="345" height="58"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <view key="contentView" id="3ZP-dJ-QhM"> + <view key="contentView"> <rect key="frame" x="1" y="1" width="343" height="42"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> @@ -3512,7 +3512,7 @@ Gw <box autoresizesSubviews="NO" title="Action" borderType="line" id="5659"> <rect key="frame" x="17" y="49" width="345" height="87"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <view key="contentView" id="mnI-Zx-qey"> + <view key="contentView"> <rect key="frame" x="1" y="1" width="343" height="71"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> @@ -3584,7 +3584,7 @@ Gw <box autoresizesSubviews="NO" title="References" borderType="line" id="5652"> <rect key="frame" x="17" y="140" width="345" height="87"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <view key="contentView" id="oBh-ZJ-t7F"> + <view key="contentView"> <rect key="frame" x="1" y="1" width="343" height="71"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> @@ -3705,7 +3705,7 @@ Gw <box autoresizesSubviews="NO" title="Trigger:" borderType="line" id="6770"> <rect key="frame" x="17" y="219" width="326" height="109"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> - <view key="contentView" id="TWl-AK-BwB"> + <view key="contentView"> <rect key="frame" x="1" y="1" width="324" height="93"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> @@ -4843,7 +4843,7 @@ Gw <subviews> <textField verticalHuggingPriority="750" id="6170"> <rect key="frame" x="2" y="2" width="105" height="14"/> - <autoresizingMask key="autoresizingMask" widthSizable="YES"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" id="6171"> <font key="font" metaFont="smallSystem"/> <color key="textColor" name="disabledControlTextColor" catalog="System" colorSpace="catalog"/> diff --git a/Source/SPDatabaseDocument.h b/Source/SPDatabaseDocument.h index c708cd9f..6596ca8c 100644 --- a/Source/SPDatabaseDocument.h +++ b/Source/SPDatabaseDocument.h @@ -106,7 +106,7 @@ IBOutlet NSView *parentView; - IBOutlet id titleAccessoryView; + IBOutlet NSView *titleAccessoryView; IBOutlet id titleImageView; IBOutlet id titleStringView; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index bd4233ae..2931ba9f 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -3943,17 +3943,34 @@ static int64_t SPDatabaseDocumentInstanceCounter = 0; if (newIsVisible == windowTitleStatusViewIsVisible) return; if (newIsVisible) { - NSView *windowFrame = [[parentWindow 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]; + if (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 = [[[NSTitlebarAccessoryViewController alloc] init] autorelease]; + accessoryViewController.view = titleAccessoryView; + accessoryViewController.layoutAttribute = NSLayoutAttributeRight; + [parentWindow addTitlebarAccessoryViewController:accessoryViewController]; + } else { + NSView *windowFrame = [[parentWindow 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 { - [titleAccessoryView removeFromSuperview]; + if (NSClassFromString(@"NSTitlebarAccessoryViewController")) { // OS X 10.11 and later + [parentWindow.titlebarAccessoryViewControllers enumerateObjectsUsingBlock:^(__kindof NSTitlebarAccessoryViewController * _Nonnull accessoryViewController, NSUInteger idx, BOOL * _Nonnull stop) { + if (accessoryViewController.view == titleAccessoryView) { + [parentWindow removeTitlebarAccessoryViewControllerAtIndex:idx]; + } + }]; + } else { + [titleAccessoryView removeFromSuperview]; + } } windowTitleStatusViewIsVisible = newIsVisible; |