Skip to content

Commit

Permalink
Updated with changes from OmniGroup svn [289908:290414]
Browse files Browse the repository at this point in the history
OmniFoundation:
- OFFilterProcess now clears DYLD_INSERT_LIBRARIES.
- OFRelativeDateFormatter no longer rejectings -dateFromString:.
- Moved -convertToAppleEventDescriptor: from OmniFocus into
  OmniFoundation, and fixed a few things along the way.

OmniDataObjects:
- Fix an #import so it can find its reference on a case-sensitive file
  system.

OmniSoftwareUpdate:
- Update OSUDevices.json with new iPad Pro models
- Add WWDC 2017 Mac models

OmniDocumentStore:
- For a move operation _doMotion's completion handler needs to know where the
  file items we moved ended up. For copy it wants the ODSFileItems created at
  the destination. The problem here was the completion handler thought we had
  failed to create a folder so it didn't get to the part of the completion that
  ended the progress indicator. In that error path, added a call to
  activityIndicator stopAnimating.

OmniUI/iPad:
- -[UIApplication delegate] triggers the main-thread checker in Xcode 9.
  Cache the result with a dispatch_once and rely on this getting hit on the
  main thread before we call it on a background queue.
- Made selected tab text color and tab border colors themeable.
- -[OUIStackedSlicesInspectorPane viewWillAppear:] calls -notifyChildrenThatAppearanceDidChange
  at the end if OUIInspectorAppearance is enabled.
- Don't reload the inspectors if they are not in the view hierarchy, but also
  make sure they are visible on the screen, as hidden embedded inspectors are
  in the view hierarchy but not on screen.
- OUIStackedSlicesInspector's OUIStackedSlicesInspectorPaneContentView used to
  be initialized with height self.inspector.mainPane.preferredContentSize.height.
  Since it uses autolayout to size itself to the stack view it contains that
  has been removed.

OmniUI/iPad-Document:
- Updated the empty overlay view text color. Each app can now specify this color
  via an -[OUIDocumentAppController emptyOverlayViewTextColor] override.
  The default is _window.tintColor.
  OUIDocumentPickerViewController and OUIDocumentCreationTemplatePickerViewController
  have been updated to use the long form constructor for building OUIEmptyOverlayViews
  that includes passing the text color. It consults -[OUIDocumentAppController emptyOverlayViewTextColor]
  for the text color.
- In -closeAndDismissDocumentWithCompletionHandler:, if we are closing and
  dismissing the document, but the document picker has no presented view
  controller, just call the completion handler as the document has already
  been closed.

OmniInspector:
- Fix build issues with Xcode 9.
- Added tooltips for any labels that get truncated.
  • Loading branch information
tjw committed Jul 8, 2017
1 parent 8c09107 commit d116a42
Show file tree
Hide file tree
Showing 28 changed files with 352 additions and 93 deletions.
2 changes: 1 addition & 1 deletion Frameworks/OmniDataObjects/ODOObject.m
Expand Up @@ -12,7 +12,7 @@
#import <OmniDataObjects/ODOAttribute.h>
#import <OmniDataObjects/ODOModel.h>

#import <OmniBase/ObjC.h>
#import <OmniBase/objc.h>

#import <OmniFoundation/NSArray-OFExtensions.h>

Expand Down
11 changes: 7 additions & 4 deletions Frameworks/OmniDocumentStore/ODSScope.m
Expand Up @@ -767,10 +767,13 @@ - (void)_doMotion:(NSString *)motionType withItems:(NSSet *)items toFolder:(ODSF
[self _updateItemTree];

if (completionHandler) {
// Give the completion handler the immediate children of parentFolder that were created (so if we had "a/b/c" duplicating "a/b" to "a/b2", we'd pass back "a/b2" not "a/b2/c".
NSSet *addedChildren = [parentFolder childrenContainingItems:createdFileItems];
DEBUG_STORE(@"%@ yielded added children %@", motionType, [addedChildren valueForKey:@"shortDescription"]);
completionHandler(addedChildren);
NSSet *moveItems = createdFileItems;
if ([motionType isEqualToString:@"COPY"]) {
// Give the completion handler the immediate children of parentFolder that were created (so if we had "a/b/c" duplicating "a/b" to "a/b2", we'd pass back "a/b2" not "a/b2/c".
moveItems = [parentFolder childrenContainingItems:moveItems];
}
DEBUG_STORE(@"%@ yielded added children %@", motionType, [moveItems valueForKey:@"shortDescription"]);
completionHandler(moveItems);
}
}];
}];
Expand Down
3 changes: 3 additions & 0 deletions Frameworks/OmniFoundation/OFErrors.h
Expand Up @@ -69,6 +69,9 @@ enum {
OFEmbeddedProvisioningProfileUnreadableError,
OFEmbeddedProvisioningProfileMalformedPKCS7Error,
OFEmbeddedProvisioningProfileMalformedPlistError,

// AppleScript
OFUnableToConvertScriptHandlerArgumentToAppleEventDescriptor,
};


Expand Down
6 changes: 5 additions & 1 deletion Frameworks/OmniFoundation/OFFilterProcess.m
@@ -1,4 +1,4 @@
// Copyright 2005-2014 Omni Development, Inc. All rights reserved.
// Copyright 2005-2017 Omni Development, Inc. All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
Expand Down Expand Up @@ -1248,6 +1248,10 @@ BOOL OFIncludeInPathEnvironment(const char *pathdir)

static char **computeToolEnvironment(NSDictionary *replace_env, NSDictionary *augment_env, NSString *ensurePath)
{
if (augment_env == nil)
augment_env = [NSDictionary dictionary];
augment_env = [augment_env dictionaryWithObject:@"" forKey:@"DYLD_INSERT_LIBRARIES"];

char **newEnviron;
NSUInteger newEnvironSize, newEnvironCount;
BOOL modified;
Expand Down
6 changes: 0 additions & 6 deletions Frameworks/OmniFoundation/OFRelativeDateFormatter.m
Expand Up @@ -212,12 +212,6 @@ - (NSString *)stringFromDate:(NSDate *)date;
return nil;
}

- (nullable NSDate *)dateFromString:(NSString *)string;
{
OBRejectUnusedImplementation(self, _cmd);
return nil;
}

#pragma mark NSCopying

- (id)copyWithZone:(nullable NSZone *)zone;
Expand Down
@@ -1,4 +1,4 @@
// Copyright 2008, 2010 Omni Development, Inc. All rights reserved.
// Copyright 2008-2017 Omni Development, Inc. All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
Expand All @@ -9,7 +9,7 @@

#import <Foundation/NSObject.h>

@class NSArray, NSDictionary, NSScriptObjectSpecifier;
@class NSAppleEventDescriptor, NSArray, NSDictionary, NSScriptObjectSpecifier;

@interface NSObject (OFAppleScriptExtensions)

Expand All @@ -29,4 +29,6 @@

- (NSScriptObjectSpecifier *)objectSpecifierByProperty:(NSString *)propertyKey inRelation:(NSString *)myLocation toContainer:(NSObject *)myContainer;

- (NSAppleEventDescriptor *)convertToAppleEventDescriptor:(NSError **)outError;

@end
@@ -1,4 +1,4 @@
// Copyright 1997-2005, 2007,2008, 2010-2011, 2013 Omni Development, Inc. All rights reserved.
// Copyright 1997-2017 Omni Development, Inc. All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
Expand All @@ -7,13 +7,11 @@

#import <OmniFoundation/NSObject-OFAppleScriptExtensions.h>

#import <Foundation/NSScriptCoercionHandler.h>
#import <Foundation/NSScriptClassDescription.h>
#import <Foundation/NSScriptKeyValueCoding.h>
#import <Foundation/NSScriptSuiteRegistry.h>
#import <Foundation/NSScriptObjectSpecifiers.h>
#import <Foundation/NSScriptWhoseTests.h>
#import <ApplicationServices/ApplicationServices.h>
@import ApplicationServices;
@import Foundation;
@import Carbon; // For 'keyASUserRecordFields'

#import <OmniFoundation/OFErrors.h>

RCS_ID("$Id$")

Expand Down Expand Up @@ -441,4 +439,116 @@ - (NSScriptObjectSpecifier *)objectSpecifierByProperty:(NSString *)propertyKey i
return specifier;
}

#pragma mark -

// Minimal conversion routines for what we need.

- (NSAppleEventDescriptor *)convertToAppleEventDescriptor:(NSError **)outError;
{
NSScriptObjectSpecifier *specifier = [self objectSpecifier];
if (specifier == nil) {
// RT #429341 -- 10.6 began adding non-plist values to -[NSWorkspace currentApplication]. We'll be lossy here in the conversion of NSObject's to event descriptors instead of halting everything for no particularly good reason. We'll return a null descriptor so that we have a non-nil (no error) result and so that if we are getting wrapped in a dictionary, we'll an entry for this key (with missing value? not sure w/o testing).
return [NSAppleEventDescriptor nullDescriptor];
}

NSAppleEventDescriptor *desc = [specifier descriptor];
if (desc == nil) {
NSString *reason = [NSString stringWithFormat:@"Cannot convert \"%@\" to an NSAppleEventDescriptor.", [self shortDescription]];
OFError(outError, OFUnableToConvertScriptHandlerArgumentToAppleEventDescriptor, reason, @"-descriptor returned nil");
}

return desc;
}

@end

@implementation NSString (OFAppleScriptExtensions)

- (NSAppleEventDescriptor *)convertToAppleEventDescriptor:(NSError **)outError;
{
return [NSAppleEventDescriptor descriptorWithString:self];
}

@end

@implementation NSNumber (OFAppleScriptExtensions)

- (NSAppleEventDescriptor *)convertToAppleEventDescriptor:(NSError **)outError;
{
CFNumberType type = CFNumberGetType((CFNumberRef)self);

switch (type) {
case kCFNumberSInt64Type: {
SInt64 int64Value = 0;
CFNumberGetValue((CFNumberRef)self, kCFNumberSInt64Type, &int64Value);
return [NSAppleEventDescriptor descriptorWithDescriptorType:typeSInt64 bytes:&int64Value length:sizeof(int64Value)];
}
case kCFNumberSInt32Type:
return [NSAppleEventDescriptor descriptorWithInt32:self.intValue];
case kCFNumberCharType:
return [NSAppleEventDescriptor descriptorWithBoolean:self.boolValue];
case kCFNumberFloat64Type:
return [NSAppleEventDescriptor descriptorWithDouble:self.doubleValue];
default: {
NSString *reason = [NSString stringWithFormat:@"Cannot convert \"%@\", type %" PRIdNS " to an NSAppleEventDescriptor.", [self shortDescription], type];
OFError(outError, OFUnableToConvertScriptHandlerArgumentToAppleEventDescriptor, reason, @"Unknown number type");
return nil;
}
}
}

@end

@implementation NSArray (OFAppleScriptExtensions)

- (NSAppleEventDescriptor *)convertToAppleEventDescriptor:(NSError **)outError;
{
NSAppleEventDescriptor *result = [NSAppleEventDescriptor listDescriptor];

NSUInteger objectIndex, objectCount = [self count];
for (objectIndex = 0; objectIndex < objectCount; objectIndex++) {
NSAppleEventDescriptor *desc = [[self objectAtIndex:objectIndex] convertToAppleEventDescriptor:outError];
if (!desc)
return nil;
[result insertDescriptor:desc atIndex:1+objectIndex]; // 1-based
}

return result;
}

@end

@implementation NSDictionary (OFAppleScriptExtensions)

// We send a 'user field' record for arbitrary keys instead of 4CC keys.
- (NSAppleEventDescriptor *)convertToAppleEventDescriptor:(NSError **)outError;
{
NSAppleEventDescriptor *keysAndValues = [NSAppleEventDescriptor listDescriptor];

NSArray *keys = [[self allKeys] sortedArrayUsingSelector:@selector(compare:)];
NSUInteger descriptorIndex = 1;
for (NSString *key in keys) {
id value = [self valueForKey:key];

NSAppleEventDescriptor *keyDesc = [key convertToAppleEventDescriptor:outError];
if (keyDesc == nil)
return nil;

NSAppleEventDescriptor *valueDesc = [value convertToAppleEventDescriptor:outError];
if (valueDesc == nil)
return nil;

// 1-based
[keysAndValues insertDescriptor:keyDesc atIndex:descriptorIndex++];
[keysAndValues insertDescriptor:valueDesc atIndex:descriptorIndex++];
}

NSAppleEventDescriptor *result = [NSAppleEventDescriptor recordDescriptor];
[result setParamDescriptor:keysAndValues forKeyword:keyASUserRecordFields];

return result;
}

@end


2 changes: 1 addition & 1 deletion Frameworks/OmniInspector/OIInspectorRegistry.h
Expand Up @@ -37,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
- (id)initWithDefaultInspectorControllerClass:(Class)controllerClass;
- (void)invalidate;

+ (OIInspectionSet *)newInspectionSetForResponder:(NSResponder *)responder;
+ (OIInspectionSet *)newInspectionSetForResponder:(nullable NSResponder *)responder;
- (void)updateInspectorForWindow:(NSWindow *)window;
- (void)updateInspectionSetImmediatelyAndUnconditionallyForWindow:(NSWindow *)window;
- (void)clearInspectionSet;
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/OmniInspector/OIInspectorRegistry.m
Expand Up @@ -1236,7 +1236,7 @@ + (OIInspectionSet *)newInspectionSetForWindowController:(NSWindowController *)w
return [self newInspectionSetForResponder:[windowController responderForInspectionSet]];
}

+ (OIInspectionSet *)newInspectionSetForResponder:(NSResponder *)responder;
+ (OIInspectionSet *)newInspectionSetForResponder:(nullable NSResponder *)responder;
{
OIInspectionSet *inspectionSet = [[OIInspectionSet alloc] init];

Expand Down
15 changes: 14 additions & 1 deletion Frameworks/OmniInspector/OIInspectorSection.m
@@ -1,11 +1,12 @@
// Copyright 2007-2015 Omni Development, Inc. All rights reserved.
// Copyright 2007-2017 Omni Development, Inc. All rights reserved.
//
// This software may only be used and reproduced according to the
// terms in the file OmniSourceLicense.html, which should be
// distributed with this project and can also be found at
// <http://www.omnigroup.com/developer/sourcecode/sourcelicense/>.

#import <OmniInspector/OIInspectorSection.h>
#import <OmniAppKit/OALabelField.h>

RCS_ID("$Id$")

Expand All @@ -16,4 +17,16 @@ - (NSView *)firstKeyView;
return firstKeyView;
}

- (void)awakeFromNib;
{
[super awakeFromNib];

// setup toolTips for any truncated labels.
for (NSView *subview in self.view.subviews) {
if ([subview isKindOfClass:OALabelField.class]) {
[(OALabelField *)subview setLabelAsToolTipIfTruncated];
}
}
}

@end
48 changes: 48 additions & 0 deletions Frameworks/OmniSoftwareUpdate/OmniSystemInfo/OSUDevices.json
Expand Up @@ -222,6 +222,26 @@
"platform": "iPad6,8",
"comment": "12.9 inch"
},
"J120AP": {
"name": "iPad Pro (2nd generation)",
"platform": "iPad7,1",
"comment": "12.9 inch"
},
"J121AP": {
"name": "iPad Pro (2nd generation)",
"platform": "iPad7,2",
"comment": "12.9 inch"
},
"J207AP": {
"name": "iPad Pro (10.5 inch)",
"platform": "iPad7,3",
"comment": "10.5 inch"
},
"J208AP": {
"name": "iPad Pro (10.5 inch)",
"platform": "iPad7,4",
"comment": "10.5 inch"
},
"J71sAP": {
"name": "iPad (2017)",
"platform": "iPad6,11",
Expand Down Expand Up @@ -342,6 +362,18 @@
"iMac17,1": {
"name": "iMac"
},
"iMac18,1": {
"name": "iMac",
"comment": "21.5 inch, mid 2017"
},
"iMac18,2": {
"name": "iMac",
"comment": "21.5 inch, 4K, mid 2017"
},
"iMac18,3": {
"name": "iMac",
"comment": "27 inch, 5K, mid 2017"
},
"Macmini1,1": {
"name": "Mac mini"
},
Expand Down Expand Up @@ -421,6 +453,10 @@
"name": "MacBook",
"comment": "Early 2016 12-inch Core m3/m5/m7"
},
"MacBook10,1": {
"name": "MacBook",
"comment": "Mid 2017 12-inch"
},
"MacBookAir1,1": {
"name": "MacBook Air"
},
Expand Down Expand Up @@ -549,5 +585,17 @@
"MacBookPro13,3": {
"name": "MacBook Pro",
"comment": "15-inch, late 2016, Touch Bar"
},
"MacBookPro14,1": {
"name": "MacBook Pro",
"comment": "13-inch, mid 2017"
},
"MacBookPro14,2": {
"name": "MacBook Pro",
"comment": "13-inch, mid 2017, Touch Bar"
},
"MacBookPro14,3": {
"name": "MacBook Pro",
"comment": "15-inch, mid 2017, Touch Bar"
}
}
1 change: 1 addition & 0 deletions Frameworks/OmniUI/iPad-Document/OUIDocumentAppController.h
Expand Up @@ -98,6 +98,7 @@
- (NSString *)recentDocumentShortcutIconImageName;
- (NSString *)newDocumentShortcutIconImageName;
- (UIImage *)documentPickerBackgroundImage;
- (UIColor *)emptyOverlayViewTextColor;
- (Class)documentClassForURL:(NSURL *)url;
- (UIView *)pickerAnimationViewForTarget:(OUIDocument *)document;
- (NSArray *)toolbarItemsForDocument:(OUIDocument *)document;
Expand Down
13 changes: 12 additions & 1 deletion Frameworks/OmniUI/iPad-Document/OUIDocumentAppController.m
Expand Up @@ -264,7 +264,13 @@ - (void)closeDocument:(id)sender;
- (void)closeAndDismissDocumentWithCompletionHandler:(void (^)(void))completionHandler
{
[self closeDocumentWithCompletionHandler:^{
[_documentPicker dismissViewControllerAnimated:YES completion:completionHandler];
// If there is no presented view controller the completion handler doesn't get called
if (_documentPicker.presentedViewController) {
[_documentPicker dismissViewControllerAnimated:YES completion:completionHandler];
} else {
completionHandler();
}

}];
}

Expand Down Expand Up @@ -1359,6 +1365,11 @@ - (UIImage *)documentPickerBackgroundImage;
return nil;
}

- (UIColor *)emptyOverlayViewTextColor;
{
return _window.tintColor;
}

- (NSURL *)documentProviderMoreInfoURL;
{
return nil;
Expand Down

0 comments on commit d116a42

Please sign in to comment.