mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-26 21:40:44 +00:00
Fix Continuation Indent
This commit is contained in:
parent
98620811ce
commit
b6548a202d
@ -63,6 +63,7 @@ UseTab: Never
|
||||
Language: ObjC
|
||||
BasedOnStyle: LLVM
|
||||
IndentWidth: 4
|
||||
ContinuationIndentWidth: 8
|
||||
UseTab: Never
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
|
@ -29,12 +29,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (NSManagedObjectContext *) managedObjectContext;
|
||||
- (NSManagedObjectModel *) managedObjectModel;
|
||||
- (void) setManagedObjectContext:
|
||||
(NSManagedObjectContext *) managedObjectContext;
|
||||
(NSManagedObjectContext *) managedObjectContext;
|
||||
- (BOOL) configurePersistentStoreCoordinatorForURL: (NSURL *) url
|
||||
ofType: (NSString *) fileType
|
||||
modelConfiguration: (NSString *) configuration
|
||||
storeOptions:
|
||||
(NSDictionary *) storeOptions
|
||||
(NSDictionary *) storeOptions
|
||||
error: (NSError **) error;
|
||||
- (NSString *) persistentStoreTypeForFileType: (NSString *) fileType;
|
||||
|
||||
@ -50,9 +50,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
ofType: (NSString *) inTypeName
|
||||
error: (NSError **) outError;
|
||||
- (BOOL) writeToURL: (NSURL *) absoluteURL
|
||||
ofType: (NSString *) typeName
|
||||
forSaveOperation: (NSSaveOperationType) saveOperation
|
||||
originalContentsURL: (NSURL *) absoluteOriginalContentsURL
|
||||
error: (NSError **) error;
|
||||
ofType: (NSString *) typeName
|
||||
forSaveOperation: (NSSaveOperationType) saveOperation
|
||||
originalContentsURL: (NSURL *) absoluteOriginalContentsURL
|
||||
error: (NSError **) error;
|
||||
|
||||
@end
|
||||
|
@ -31,10 +31,10 @@
|
||||
if (self) {
|
||||
_context = [[NSManagedObjectContext alloc] init];
|
||||
NSManagedObjectModel *model =
|
||||
[[NSManagedObjectModel alloc] initWithName: [self className]];
|
||||
[[NSManagedObjectModel alloc] initWithName: [self className]];
|
||||
NSPersistentStoreCoordinator *coordinator =
|
||||
[[NSPersistentStoreCoordinator alloc]
|
||||
initWithManagedObjectModel: model];
|
||||
[[NSPersistentStoreCoordinator alloc]
|
||||
initWithManagedObjectModel: model];
|
||||
[_context setPersistentStoreCoordinator: coordinator];
|
||||
}
|
||||
return self;
|
||||
@ -54,7 +54,7 @@
|
||||
}
|
||||
|
||||
- (void) setManagedObjectContext:
|
||||
(NSManagedObjectContext *) managedObjectContext
|
||||
(NSManagedObjectContext *) managedObjectContext
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
@ -63,7 +63,7 @@
|
||||
ofType: (NSString *) fileType
|
||||
modelConfiguration: (NSString *) configuration
|
||||
storeOptions:
|
||||
(NSDictionary *) storeOptions
|
||||
(NSDictionary *) storeOptions
|
||||
error: (NSError **) error
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
@ -109,10 +109,10 @@
|
||||
}
|
||||
|
||||
- (BOOL) writeToURL: (NSURL *) absoluteURL
|
||||
ofType: (NSString *) typeName
|
||||
forSaveOperation: (NSSaveOperationType) saveOperation
|
||||
originalContentsURL: (NSURL *) absoluteOriginalContentsURL
|
||||
error: (NSError **) error
|
||||
ofType: (NSString *) typeName
|
||||
forSaveOperation: (NSSaveOperationType) saveOperation
|
||||
originalContentsURL: (NSURL *) absoluteOriginalContentsURL
|
||||
error: (NSError **) error
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return NO;
|
||||
|
@ -61,13 +61,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (id) objectAtIndex: (NSUInteger) index;
|
||||
- (NSUInteger) count;
|
||||
- (void) addObserver: (NSObject *) observer
|
||||
toObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath
|
||||
options: (NSKeyValueObservingOptions) options
|
||||
context: (void *) context;
|
||||
toObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath
|
||||
options: (NSKeyValueObservingOptions) options
|
||||
context: (void *) context;
|
||||
- (void) removeObserver: (NSObject *) observer
|
||||
fromObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath;
|
||||
fromObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath;
|
||||
- (void) notifyObserver: (_NSManagedProxy_observerInfo *) observerInfo;
|
||||
- (void) _refresh;
|
||||
- (id) objectValueForTableColumn: (NSTableColumn *) column;
|
||||
|
@ -42,7 +42,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
_entityName = [[coder decodeObjectForKey: @"NSEntityName"] retain];
|
||||
NSPredicate *fetchPredicate =
|
||||
[coder decodeObjectForKey: @"NSFetchPredicate"];
|
||||
[coder decodeObjectForKey: @"NSFetchPredicate"];
|
||||
|
||||
_fetchRequest = [[NSFetchRequest alloc] init];
|
||||
[_fetchRequest setEntity: _entity];
|
||||
@ -119,7 +119,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
if (!_context || !_fetchRequest)
|
||||
return nil;
|
||||
id object =
|
||||
[[_fetchRequest _resultsInContext: _context] objectAtIndex: index];
|
||||
[[_fetchRequest _resultsInContext: _context] objectAtIndex: index];
|
||||
return [[_NSManagedProxy alloc] initWithParent: self object: object];
|
||||
}
|
||||
|
||||
@ -135,16 +135,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (void) addObserver: (NSObject *) observer
|
||||
toObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath
|
||||
options: (NSKeyValueObservingOptions) options
|
||||
context: (void *) context
|
||||
toObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath
|
||||
options: (NSKeyValueObservingOptions) options
|
||||
context: (void *) context
|
||||
{
|
||||
NSLog(
|
||||
@"Proxy for %@ asked to observe by %@ for keypath %@ options 0x%08x\n",
|
||||
_object, observer, keyPath, options);
|
||||
NSLog(@"Proxy for %@ asked to observe by %@ for keypath %@ options "
|
||||
@"0x%08x\n",
|
||||
_object, observer, keyPath, options);
|
||||
_NSManagedProxy_observerInfo *observerInfo =
|
||||
[[_NSManagedProxy_observerInfo alloc] init];
|
||||
[[_NSManagedProxy_observerInfo alloc] init];
|
||||
[observerInfo setObserver: observer];
|
||||
[observerInfo setIndexSet: indexes];
|
||||
[observerInfo setKeyPath: keyPath];
|
||||
@ -155,8 +155,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (void) removeObserver: (NSObject *) observer
|
||||
fromObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath
|
||||
fromObjectsAtIndexes: (NSIndexSet *) indexes
|
||||
forKeyPath: (NSString *) keyPath
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@
|
||||
|
||||
- (BOOL) openFile: (NSString *) path withApplication: (NSString *) application {
|
||||
return [self openFile: path
|
||||
withApplication: application
|
||||
andDeactivate: YES];
|
||||
withApplication: application
|
||||
andDeactivate: YES];
|
||||
}
|
||||
|
||||
- (BOOL) openTempFile: (NSString *) path {
|
||||
@ -86,8 +86,8 @@
|
||||
}
|
||||
|
||||
- (BOOL) openFile: (NSString *) path
|
||||
withApplication: (NSString *) application
|
||||
andDeactivate: (BOOL) deactivate
|
||||
withApplication: (NSString *) application
|
||||
andDeactivate: (BOOL) deactivate
|
||||
{
|
||||
// TODO: call LSOpenFromURLSpec()
|
||||
NSUnimplementedMethod();
|
||||
@ -101,7 +101,7 @@
|
||||
}
|
||||
|
||||
- (BOOL) selectFile: (NSString *) path
|
||||
inFileViewerRootedAtPath: (NSString *) rootedAtPath
|
||||
inFileViewerRootedAtPath: (NSString *) rootedAtPath
|
||||
{
|
||||
// TODO: call activateFileViewerSelectingURLs
|
||||
NSUnimplementedMethod();
|
||||
@ -273,8 +273,9 @@
|
||||
- (NSURL *) URLForApplicationWithBundleIdentifier: (NSString *) bundleIdentifier
|
||||
{
|
||||
CFURLRef url;
|
||||
OSStatus status = LSFindApplicationForInfo(
|
||||
kLSUnknownCreator, (CFStringRef) bundleIdentifier, NULL, NULL, &url);
|
||||
OSStatus status = LSFindApplicationForInfo(kLSUnknownCreator,
|
||||
(CFStringRef) bundleIdentifier,
|
||||
NULL, NULL, &url);
|
||||
|
||||
if (status != noErr)
|
||||
return nil;
|
||||
@ -293,7 +294,7 @@
|
||||
|
||||
CFURLRef url;
|
||||
OSStatus status = LSFindApplicationForInfo(
|
||||
kLSUnknownCreator, NULL, (CFStringRef) appName, NULL, &url);
|
||||
kLSUnknownCreator, NULL, (CFStringRef) appName, NULL, &url);
|
||||
|
||||
if (status != noErr)
|
||||
return nil;
|
||||
|
@ -2,348 +2,348 @@
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
NSString *const NSAccessibilityChildrenAttribute =
|
||||
@"NSAccessibilityChildrenAttribute";
|
||||
@"NSAccessibilityChildrenAttribute";
|
||||
NSString *const NSAccessibilityContentsAttribute =
|
||||
@"NSAccessibilityContentsAttribute";
|
||||
@"NSAccessibilityContentsAttribute";
|
||||
NSString *const NSAccessibilityDescriptionAttribute =
|
||||
@"NSAccessibilityDescriptionAttribute";
|
||||
@"NSAccessibilityDescriptionAttribute";
|
||||
NSString *const NSAccessibilityEnabledAttribute =
|
||||
@"NSAccessibilityEnabledAttribute";
|
||||
@"NSAccessibilityEnabledAttribute";
|
||||
NSString *const NSAccessibilityFocusedAttribute =
|
||||
@"NSAccessibilityFocusedAttribute";
|
||||
@"NSAccessibilityFocusedAttribute";
|
||||
NSString *const NSAccessibilityHelpAttribute = @"NSAccessibilityHelpAttribute";
|
||||
NSString *const NSAccessibilityMaxValueAttribute =
|
||||
@"NSAccessibilityMaxValueAttribute";
|
||||
@"NSAccessibilityMaxValueAttribute";
|
||||
NSString *const NSAccessibilityMinValueAttribute =
|
||||
@"NSAccessibilityMinValueAttribute";
|
||||
@"NSAccessibilityMinValueAttribute";
|
||||
NSString *const NSAccessibilityParentAttribute =
|
||||
@"NSAccessibilityParentAttribute";
|
||||
@"NSAccessibilityParentAttribute";
|
||||
NSString *const NSAccessibilityPositionAttribute =
|
||||
@"NSAccessibilityPositionAttribute";
|
||||
@"NSAccessibilityPositionAttribute";
|
||||
NSString *const NSAccessibilityRoleAttribute = @"NSAccessibilityRoleAttribute";
|
||||
NSString *const NSAccessibilityRoleDescriptionAttribute =
|
||||
@"NSAccessibilityRoleDescriptionAttribute";
|
||||
@"NSAccessibilityRoleDescriptionAttribute";
|
||||
NSString *const NSAccessibilitySelectedChildrenAttribute =
|
||||
@"NSAccessibilitySelectedChildrenAttribute";
|
||||
@"NSAccessibilitySelectedChildrenAttribute";
|
||||
NSString *const NSAccessibilityShownMenuAttribute =
|
||||
@"NSAccessibilityShownMenuAttribute";
|
||||
@"NSAccessibilityShownMenuAttribute";
|
||||
NSString *const NSAccessibilitySizeAttribute = @"NSAccessibilitySizeAttribute";
|
||||
NSString *const NSAccessibilitySubroleAttribute =
|
||||
@"NSAccessibilitySubroleAttribute";
|
||||
@"NSAccessibilitySubroleAttribute";
|
||||
NSString *const NSAccessibilityTitleAttribute =
|
||||
@"NSAccessibilityTitleAttribute";
|
||||
@"NSAccessibilityTitleAttribute";
|
||||
NSString *const NSAccessibilityTopLevelUIElementAttribute =
|
||||
@"NSAccessibilityTopLevelUIElementAttribute";
|
||||
@"NSAccessibilityTopLevelUIElementAttribute";
|
||||
NSString *const NSAccessibilityValueAttribute =
|
||||
@"NSAccessibilityValueAttribute";
|
||||
@"NSAccessibilityValueAttribute";
|
||||
NSString *const NSAccessibilityValueDescriptionAttribute =
|
||||
@"NSAccessibilityValueDescriptionAttribute";
|
||||
@"NSAccessibilityValueDescriptionAttribute";
|
||||
NSString *const NSAccessibilityVisibleChildrenAttribute =
|
||||
@"NSAccessibilityVisibleChildrenAttribute";
|
||||
@"NSAccessibilityVisibleChildrenAttribute";
|
||||
NSString *const NSAccessibilityWindowAttribute =
|
||||
@"NSAccessibilityWindowAttribute";
|
||||
@"NSAccessibilityWindowAttribute";
|
||||
|
||||
NSString *const NSAccessibilityInsertionPointLineNumberAttribute =
|
||||
@"NSAccessibilityInsertionPointLineNumberAttribute";
|
||||
@"NSAccessibilityInsertionPointLineNumberAttribute";
|
||||
NSString *const NSAccessibilityNumberOfCharactersAttribute =
|
||||
@"NSAccessibilityNumberOfCharactersAttribute";
|
||||
@"NSAccessibilityNumberOfCharactersAttribute";
|
||||
NSString *const NSAccessibilitySelectedTextAttribute =
|
||||
@"NSAccessibilitySelectedTextAttribute";
|
||||
@"NSAccessibilitySelectedTextAttribute";
|
||||
NSString *const NSAccessibilitySelectedTextRangeAttribute =
|
||||
@"NSAccessibilitySelectedTextRangeAttribute";
|
||||
@"NSAccessibilitySelectedTextRangeAttribute";
|
||||
NSString *const NSAccessibilitySelectedTextRangesAttribute =
|
||||
@"NSAccessibilitySelectedTextRangesAttribute";
|
||||
@"NSAccessibilitySelectedTextRangesAttribute";
|
||||
NSString *const NSAccessibilitySharedCharacterRangeAttribute =
|
||||
@"NSAccessibilitySharedCharacterRangeAttribute";
|
||||
@"NSAccessibilitySharedCharacterRangeAttribute";
|
||||
NSString *const NSAccessibilitySharedTextUIElementsAttribute =
|
||||
@"NSAccessibilitySharedTextUIElementsAttribute";
|
||||
@"NSAccessibilitySharedTextUIElementsAttribute";
|
||||
NSString *const NSAccessibilityVisibleCharacterRangeAttribute =
|
||||
@"NSAccessibilityVisibleCharacterRangeAttribute";
|
||||
@"NSAccessibilityVisibleCharacterRangeAttribute";
|
||||
|
||||
NSString *const NSAccessibilityAttributedStringForRangeParameterizedAttribute =
|
||||
@"NSAccessibilityAttributedStringForRangeParameterizedAttribute";
|
||||
@"NSAccessibilityAttributedStringForRangeParameterizedAttribute";
|
||||
NSString *const NSAccessibilityBoundsForRangeParameterizedAttribute =
|
||||
@"NSAccessibilityBoundsForRangeParameterizedAttribute";
|
||||
@"NSAccessibilityBoundsForRangeParameterizedAttribute";
|
||||
NSString *const NSAccessibilityLineForIndexParameterizedAttribute =
|
||||
@"NSAccessibilityLineForIndexParameterizedAttribute";
|
||||
@"NSAccessibilityLineForIndexParameterizedAttribute";
|
||||
NSString *const NSAccessibilityRTFForRangeParameterizedAttribute =
|
||||
@"NSAccessibilityRTFForRangeParameterizedAttribute";
|
||||
@"NSAccessibilityRTFForRangeParameterizedAttribute";
|
||||
NSString *const NSAccessibilityRangeForIndexParameterizedAttribute =
|
||||
@"NSAccessibilityRangeForIndexParameterizedAttribute";
|
||||
@"NSAccessibilityRangeForIndexParameterizedAttribute";
|
||||
NSString *const NSAccessibilityRangeForLineParameterizedAttribute =
|
||||
@"NSAccessibilityRangeForLineParameterizedAttribute";
|
||||
@"NSAccessibilityRangeForLineParameterizedAttribute";
|
||||
NSString *const NSAccessibilityRangeForPositionParameterizedAttribute =
|
||||
@"NSAccessibilityRangeForPositionParameterizedAttribute";
|
||||
@"NSAccessibilityRangeForPositionParameterizedAttribute";
|
||||
NSString *const NSAccessibilityStringForRangeParameterizedAttribute =
|
||||
@"NSAccessibilityStringForRangeParameterizedAttribute";
|
||||
@"NSAccessibilityStringForRangeParameterizedAttribute";
|
||||
NSString *const NSAccessibilityStyleRangeForIndexParameterizedAttribute =
|
||||
@"NSAccessibilityStyleRangeForIndexParameterizedAttribute";
|
||||
@"NSAccessibilityStyleRangeForIndexParameterizedAttribute";
|
||||
|
||||
NSString *const NSAccessibilityAttachmentTextAttribute =
|
||||
@"NSAccessibilityAttachmentTextAttribute";
|
||||
@"NSAccessibilityAttachmentTextAttribute";
|
||||
NSString *const NSAccessibilityBackgroundColorTextAttribute =
|
||||
@"NSAccessibilityBackgroundColorTextAttribute";
|
||||
@"NSAccessibilityBackgroundColorTextAttribute";
|
||||
NSString *const NSAccessibilityFontFamilyKey = @"NSAccessibilityFontFamilyKey";
|
||||
NSString *const NSAccessibilityFontNameKey = @"NSAccessibilityFontNameKey";
|
||||
NSString *const NSAccessibilityFontSizeKey = @"NSAccessibilityFontSizeKey";
|
||||
NSString *const NSAccessibilityFontTextAttribute =
|
||||
@"NSAccessibilityFontTextAttribute";
|
||||
@"NSAccessibilityFontTextAttribute";
|
||||
NSString *const NSAccessibilityForegroundColorTextAttribute =
|
||||
@"NSAccessibilityForegroundColorTextAttribute";
|
||||
@"NSAccessibilityForegroundColorTextAttribute";
|
||||
NSString *const NSAccessibilityLinkTextAttribute =
|
||||
@"NSAccessibilityLinkTextAttribute";
|
||||
@"NSAccessibilityLinkTextAttribute";
|
||||
NSString *const NSAccessibilityMisspelledTextAttribute =
|
||||
@"NSAccessibilityMisspelledTextAttribute";
|
||||
@"NSAccessibilityMisspelledTextAttribute";
|
||||
NSString *const NSAccessibilityShadowTextAttribute =
|
||||
@"NSAccessibilityShadowTextAttribute";
|
||||
@"NSAccessibilityShadowTextAttribute";
|
||||
NSString *const NSAccessibilityStrikethroughColorTextAttribute =
|
||||
@"NSAccessibilityStrikethroughColorTextAttribute";
|
||||
@"NSAccessibilityStrikethroughColorTextAttribute";
|
||||
NSString *const NSAccessibilityStrikethroughTextAttribute =
|
||||
@"NSAccessibilityStrikethroughTextAttribute";
|
||||
@"NSAccessibilityStrikethroughTextAttribute";
|
||||
NSString *const NSAccessibilitySuperscriptTextAttribute =
|
||||
@"NSAccessibilitySuperscriptTextAttribute";
|
||||
@"NSAccessibilitySuperscriptTextAttribute";
|
||||
NSString *const NSAccessibilityUnderlineColorTextAttribute =
|
||||
@"NSAccessibilityUnderlineColorTextAttribute";
|
||||
@"NSAccessibilityUnderlineColorTextAttribute";
|
||||
NSString *const NSAccessibilityUnderlineTextAttribute =
|
||||
@"NSAccessibilityUnderlineTextAttribute";
|
||||
@"NSAccessibilityUnderlineTextAttribute";
|
||||
NSString *const NSAccessibilityVisibleNameKey =
|
||||
@"NSAccessibilityVisibleNameKey";
|
||||
@"NSAccessibilityVisibleNameKey";
|
||||
|
||||
NSString *const NSAccessibilityCancelButtonAttribute =
|
||||
@"NSAccessibilityCancelButtonAttribute";
|
||||
@"NSAccessibilityCancelButtonAttribute";
|
||||
NSString *const NSAccessibilityCloseButtonAttribute =
|
||||
@"NSAccessibilityCloseButtonAttribute";
|
||||
@"NSAccessibilityCloseButtonAttribute";
|
||||
NSString *const NSAccessibilityDefaultButtonAttribute =
|
||||
@"NSAccessibilityDefaultButtonAttribute";
|
||||
@"NSAccessibilityDefaultButtonAttribute";
|
||||
NSString *const NSAccessibilityGrowAreaAttribute =
|
||||
@"NSAccessibilityGrowAreaAttribute";
|
||||
@"NSAccessibilityGrowAreaAttribute";
|
||||
NSString *const NSAccessibilityMainAttribute = @"NSAccessibilityMainAttribute";
|
||||
NSString *const NSAccessibilityMinimizeButtonAttribute =
|
||||
@"NSAccessibilityMinimizeButtonAttribute";
|
||||
@"NSAccessibilityMinimizeButtonAttribute";
|
||||
NSString *const NSAccessibilityMinimizedAttribute =
|
||||
@"NSAccessibilityMinimizedAttribute";
|
||||
@"NSAccessibilityMinimizedAttribute";
|
||||
NSString *const NSAccessibilityModalAttribute =
|
||||
@"NSAccessibilityModalAttribute";
|
||||
@"NSAccessibilityModalAttribute";
|
||||
NSString *const NSAccessibilityProxyAttribute =
|
||||
@"NSAccessibilityProxyAttribute";
|
||||
@"NSAccessibilityProxyAttribute";
|
||||
NSString *const NSAccessibilityToolbarButtonAttribute =
|
||||
@"NSAccessibilityToolbarButtonAttribute";
|
||||
@"NSAccessibilityToolbarButtonAttribute";
|
||||
NSString *const NSAccessibilityZoomButtonAttribute =
|
||||
@"NSAccessibilityZoomButtonAttribute";
|
||||
@"NSAccessibilityZoomButtonAttribute";
|
||||
|
||||
NSString *const NSAccessibilityHorizontalOrientationValue =
|
||||
@"NSAccessibilityHorizontalOrientationValue";
|
||||
@"NSAccessibilityHorizontalOrientationValue";
|
||||
NSString *const NSAccessibilityVerticalOrientationValue =
|
||||
@"NSAccessibilityVerticalOrientationValue";
|
||||
@"NSAccessibilityVerticalOrientationValue";
|
||||
NSString *const NSAccessibilityUnknownOrientationValue =
|
||||
@"NSAccessibilityUnknownOrientationValue";
|
||||
@"NSAccessibilityUnknownOrientationValue";
|
||||
|
||||
NSString *const NSAccessibilityClearButtonAttribute =
|
||||
@"NSAccessibilityClearButtonAttribute";
|
||||
@"NSAccessibilityClearButtonAttribute";
|
||||
NSString *const NSAccessibilityColumnTitlesAttribute =
|
||||
@"NSAccessibilityColumnTitlesAttribute";
|
||||
@"NSAccessibilityColumnTitlesAttribute";
|
||||
NSString *const NSAccessibilityFocusedUIElementAttribute =
|
||||
@"NSAccessibilityFocusedUIElementAttribute";
|
||||
@"NSAccessibilityFocusedUIElementAttribute";
|
||||
NSString *const NSAccessibilityFocusedWindowAttribute =
|
||||
@"NSAccessibilityFocusedWindowAttribute";
|
||||
@"NSAccessibilityFocusedWindowAttribute";
|
||||
NSString *const NSAccessibilityFrontmostAttribute =
|
||||
@"NSAccessibilityFrontmostAttribute";
|
||||
@"NSAccessibilityFrontmostAttribute";
|
||||
NSString *const NSAccessibilityHiddenAttribute =
|
||||
@"NSAccessibilityHiddenAttribute";
|
||||
@"NSAccessibilityHiddenAttribute";
|
||||
NSString *const NSAccessibilityMainWindowAttribute =
|
||||
@"NSAccessibilityMainWindowAttribute";
|
||||
@"NSAccessibilityMainWindowAttribute";
|
||||
NSString *const NSAccessibilityMenuBarAttribute =
|
||||
@"NSAccessibilityMenuBarAttribute";
|
||||
@"NSAccessibilityMenuBarAttribute";
|
||||
NSString *const NSAccessibilityOrientationAttribute =
|
||||
@"NSAccessibilityOrientationAttribute";
|
||||
@"NSAccessibilityOrientationAttribute";
|
||||
NSString *const NSAccessibilitySearchButtonAttribute =
|
||||
@"NSAccessibilitySearchButtonAttribute";
|
||||
@"NSAccessibilitySearchButtonAttribute";
|
||||
NSString *const NSAccessibilitySearchMenuAttribute =
|
||||
@"NSAccessibilitySearchMenuAttribute";
|
||||
@"NSAccessibilitySearchMenuAttribute";
|
||||
NSString *const NSAccessibilityWindowsAttribute =
|
||||
@"NSAccessibilityWindowsAttribute";
|
||||
@"NSAccessibilityWindowsAttribute";
|
||||
|
||||
NSString *const NSAccessibilityColumnCountAttribute =
|
||||
@"NSAccessibilityColumnCountAttribute";
|
||||
@"NSAccessibilityColumnCountAttribute";
|
||||
NSString *const NSAccessibilityOrderedByRowAttribute =
|
||||
@"NSAccessibilityOrderedByRowAttribute";
|
||||
@"NSAccessibilityOrderedByRowAttribute";
|
||||
NSString *const NSAccessibilityRowCountAttribute =
|
||||
@"NSAccessibilityRowCountAttribute";
|
||||
@"NSAccessibilityRowCountAttribute";
|
||||
|
||||
NSString *const NSAccessibilityColumnHeaderUIElementsAttribute =
|
||||
@"NSAccessibilityColumnHeaderUIElementsAttribute";
|
||||
@"NSAccessibilityColumnHeaderUIElementsAttribute";
|
||||
NSString *const NSAccessibilityColumnsAttribute =
|
||||
@"NSAccessibilityColumnsAttribute";
|
||||
@"NSAccessibilityColumnsAttribute";
|
||||
NSString *const NSAccessibilityRowHeaderUIElementsAttribute =
|
||||
@"NSAccessibilityRowHeaderUIElementsAttribute";
|
||||
@"NSAccessibilityRowHeaderUIElementsAttribute";
|
||||
NSString *const NSAccessibilityRowsAttribute = @"NSAccessibilityRowsAttribute";
|
||||
NSString *const NSAccessibilitySelectedColumnsAttribute =
|
||||
@"NSAccessibilitySelectedColumnsAttribute";
|
||||
@"NSAccessibilitySelectedColumnsAttribute";
|
||||
NSString *const NSAccessibilitySelectedRowsAttribute =
|
||||
@"NSAccessibilitySelectedRowsAttribute";
|
||||
@"NSAccessibilitySelectedRowsAttribute";
|
||||
NSString *const NSAccessibilitySortDirectionAttribute =
|
||||
@"NSAccessibilitySortDirectionAttribute";
|
||||
@"NSAccessibilitySortDirectionAttribute";
|
||||
NSString *const NSAccessibilityVisibleColumnsAttribute =
|
||||
@"NSAccessibilityVisibleColumnsAttribute";
|
||||
@"NSAccessibilityVisibleColumnsAttribute";
|
||||
NSString *const NSAccessibilityVisibleRowsAttribute =
|
||||
@"NSAccessibilityVisibleRowsAttribute";
|
||||
@"NSAccessibilityVisibleRowsAttribute";
|
||||
|
||||
NSString *const NSAccessibilityDisclosedByRowAttribute =
|
||||
@"NSAccessibilityDisclosedByRowAttribute";
|
||||
@"NSAccessibilityDisclosedByRowAttribute";
|
||||
NSString *const NSAccessibilityDisclosedRowsAttribute =
|
||||
@"NSAccessibilityDisclosedRowsAttribute";
|
||||
@"NSAccessibilityDisclosedRowsAttribute";
|
||||
NSString *const NSAccessibilityDisclosingAttribute =
|
||||
@"NSAccessibilityDisclosingAttribute";
|
||||
@"NSAccessibilityDisclosingAttribute";
|
||||
NSString *const NSAccessibilityDisclosureLevelAttribute =
|
||||
@"NSAccessibilityDisclosureLevelAttribute";
|
||||
@"NSAccessibilityDisclosureLevelAttribute";
|
||||
|
||||
NSString *const NSAccessibilitySelectedCellsAttribute =
|
||||
@"NSAccessibilitySelectedCellsAttribute";
|
||||
@"NSAccessibilitySelectedCellsAttribute";
|
||||
NSString *const NSAccessibilityVisibleCellsAttribute =
|
||||
@"NSAccessibilityVisibleCellsAttribute";
|
||||
@"NSAccessibilityVisibleCellsAttribute";
|
||||
|
||||
NSString *const NSAccessibilityCellForColumnAndRowParameterizedAttribute =
|
||||
@"NSAccessibilityCellForColumnAndRowParameterizedAttribute";
|
||||
@"NSAccessibilityCellForColumnAndRowParameterizedAttribute";
|
||||
|
||||
NSString *const NSAccessibilityRowIndexRangeAttribute =
|
||||
@"NSAccessibilityRowIndexRangeAttribute";
|
||||
@"NSAccessibilityRowIndexRangeAttribute";
|
||||
NSString *const NSAccessibilityColumnIndexRangeAttribute =
|
||||
@"NSAccessibilityColumnIndexRangeAttribute";
|
||||
@"NSAccessibilityColumnIndexRangeAttribute";
|
||||
|
||||
NSString *const NSAccessibilityAscendingSortDirectionValue =
|
||||
@"NSAccessibilityAscendingSortDirectionValue";
|
||||
@"NSAccessibilityAscendingSortDirectionValue";
|
||||
NSString *const NSAccessibilityDescendingSortDirectionValue =
|
||||
@"NSAccessibilityDescendingSortDirectionValue";
|
||||
@"NSAccessibilityDescendingSortDirectionValue";
|
||||
NSString *const NSAccessibilityUnknownSortDirectionValue =
|
||||
@"NSAccessibilityUnknownSortDirectionValue";
|
||||
@"NSAccessibilityUnknownSortDirectionValue";
|
||||
|
||||
NSString *const NSAccessibilityHorizontalUnitsAttribute =
|
||||
@"NSAccessibilityHorizontalUnitsAttribute";
|
||||
@"NSAccessibilityHorizontalUnitsAttribute";
|
||||
NSString *const NSAccessibilityVerticalUnitsAttribute =
|
||||
@"NSAccessibilityVerticalUnitsAttribute";
|
||||
@"NSAccessibilityVerticalUnitsAttribute";
|
||||
NSString *const NSAccessibilityHorizontalUnitDescriptionAttribute =
|
||||
@"NSAccessibilityHorizontalUnitDescriptionAttribute";
|
||||
@"NSAccessibilityHorizontalUnitDescriptionAttribute";
|
||||
NSString *const NSAccessibilityVerticalUnitDescriptionAttribute =
|
||||
@"NSAccessibilityVerticalUnitDescriptionAttribute";
|
||||
@"NSAccessibilityVerticalUnitDescriptionAttribute";
|
||||
|
||||
NSString *const NSAccessibilityLayoutPointForScreenPointParameterizedAttribute =
|
||||
@"NSAccessibilityLayoutPointForScreenPointParameterizedAttribute";
|
||||
@"NSAccessibilityLayoutPointForScreenPointParameterizedAttribute";
|
||||
NSString *const NSAccessibilityLayoutSizeForScreenSizeParameterizedAttribute =
|
||||
@"NSAccessibilityLayoutSizeForScreenSizeParameterizedAttribute";
|
||||
@"NSAccessibilityLayoutSizeForScreenSizeParameterizedAttribute";
|
||||
NSString *const NSAccessibilityScreenPointForLayoutPointParameterizedAttribute =
|
||||
@"NSAccessibilityScreenPointForLayoutPointParameterizedAttribute";
|
||||
@"NSAccessibilityScreenPointForLayoutPointParameterizedAttribute";
|
||||
NSString *const NSAccessibilityScreenSizeForLayoutSizeParameterizedAttribute =
|
||||
@"NSAccessibilityScreenSizeForLayoutSizeParameterizedAttribute";
|
||||
@"NSAccessibilityScreenSizeForLayoutSizeParameterizedAttribute";
|
||||
|
||||
NSString *const NSAccessibilityHandlesAttribute =
|
||||
@"NSAccessibilityHandlesAttribute";
|
||||
@"NSAccessibilityHandlesAttribute";
|
||||
|
||||
NSString *const NSAccessibilityAllowedValuesAttribute =
|
||||
@"NSAccessibilityAllowedValuesAttribute";
|
||||
@"NSAccessibilityAllowedValuesAttribute";
|
||||
NSString *const NSAccessibilityLabelUIElementsAttribute =
|
||||
@"NSAccessibilityLabelUIElementsAttribute";
|
||||
@"NSAccessibilityLabelUIElementsAttribute";
|
||||
NSString *const NSAccessibilityLabelValueAttribute =
|
||||
@"NSAccessibilityLabelValueAttribute";
|
||||
@"NSAccessibilityLabelValueAttribute";
|
||||
|
||||
NSString *const NSAccessibilityMatteContentUIElementAttribute =
|
||||
@"NSAccessibilityMatteContentUIElementAttribute";
|
||||
@"NSAccessibilityMatteContentUIElementAttribute";
|
||||
NSString *const NSAccessibilityMatteHoleAttribute =
|
||||
@"NSAccessibilityMatteHoleAttribute";
|
||||
@"NSAccessibilityMatteHoleAttribute";
|
||||
|
||||
NSString *const NSAccessibilityMarkerGroupUIElementAttribute =
|
||||
@"NSAccessibilityMarkerGroupUIElementAttribute";
|
||||
@"NSAccessibilityMarkerGroupUIElementAttribute";
|
||||
NSString *const NSAccessibilityMarkerTypeAttribute =
|
||||
@"NSAccessibilityMarkerTypeAttribute";
|
||||
@"NSAccessibilityMarkerTypeAttribute";
|
||||
NSString *const NSAccessibilityMarkerTypeDescriptionAttribute =
|
||||
@"NSAccessibilityMarkerTypeDescriptionAttribute";
|
||||
@"NSAccessibilityMarkerTypeDescriptionAttribute";
|
||||
NSString *const NSAccessibilityMarkerUIElementsAttribute =
|
||||
@"NSAccessibilityMarkerUIElementsAttribute";
|
||||
@"NSAccessibilityMarkerUIElementsAttribute";
|
||||
NSString *const NSAccessibilityMarkerValuesAttribute =
|
||||
@"NSAccessibilityMarkerValuesAttribute";
|
||||
@"NSAccessibilityMarkerValuesAttribute";
|
||||
NSString *const NSAccessibilityUnitDescriptionAttribute =
|
||||
@"NSAccessibilityUnitDescriptionAttribute";
|
||||
@"NSAccessibilityUnitDescriptionAttribute";
|
||||
NSString *const NSAccessibilityUnitsAttribute =
|
||||
@"NSAccessibilityUnitsAttribute";
|
||||
@"NSAccessibilityUnitsAttribute";
|
||||
|
||||
NSString *const NSAccessibilityCenterTabStopMarkerTypeValue =
|
||||
@"NSAccessibilityCenterTabStopMarkerTypeValue";
|
||||
@"NSAccessibilityCenterTabStopMarkerTypeValue";
|
||||
NSString *const NSAccessibilityDecimalTabStopMarkerTypeValue =
|
||||
@"NSAccessibilityDecimalTabStopMarkerTypeValue";
|
||||
@"NSAccessibilityDecimalTabStopMarkerTypeValue";
|
||||
NSString *const NSAccessibilityFirstLineIndentMarkerTypeValue =
|
||||
@"NSAccessibilityFirstLineIndentMarkerTypeValue";
|
||||
@"NSAccessibilityFirstLineIndentMarkerTypeValue";
|
||||
NSString *const NSAccessibilityHeadIndentMarkerTypeValue =
|
||||
@"NSAccessibilityHeadIndentMarkerTypeValue";
|
||||
@"NSAccessibilityHeadIndentMarkerTypeValue";
|
||||
NSString *const NSAccessibilityLeftTabStopMarkerTypeValue =
|
||||
@"NSAccessibilityLeftTabStopMarkerTypeValue";
|
||||
@"NSAccessibilityLeftTabStopMarkerTypeValue";
|
||||
NSString *const NSAccessibilityRightTabStopMarkerTypeValue =
|
||||
@"NSAccessibilityRightTabStopMarkerTypeValue";
|
||||
@"NSAccessibilityRightTabStopMarkerTypeValue";
|
||||
NSString *const NSAccessibilityTailIndentMarkerTypeValue =
|
||||
@"NSAccessibilityTailIndentMarkerTypeValue";
|
||||
@"NSAccessibilityTailIndentMarkerTypeValue";
|
||||
NSString *const NSAccessibilityUnknownMarkerTypeValue =
|
||||
@"NSAccessibilityUnknownMarkerTypeValue";
|
||||
@"NSAccessibilityUnknownMarkerTypeValue";
|
||||
|
||||
NSString *const NSAccessibilityCentimetersUnitValue =
|
||||
@"NSAccessibilityCentimetersUnitValue";
|
||||
@"NSAccessibilityCentimetersUnitValue";
|
||||
NSString *const NSAccessibilityInchesUnitValue =
|
||||
@"NSAccessibilityInchesUnitValue";
|
||||
@"NSAccessibilityInchesUnitValue";
|
||||
NSString *const NSAccessibilityPicasUnitValue =
|
||||
@"NSAccessibilityPicasUnitValue";
|
||||
@"NSAccessibilityPicasUnitValue";
|
||||
NSString *const NSAccessibilityPointsUnitValue =
|
||||
@"NSAccessibilityPointsUnitValue";
|
||||
@"NSAccessibilityPointsUnitValue";
|
||||
NSString *const NSAccessibilityUnknownUnitValue =
|
||||
@"NSAccessibilityUnknownUnitValue";
|
||||
@"NSAccessibilityUnknownUnitValue";
|
||||
|
||||
NSString *const NSAccessibilityLinkedUIElementsAttribute =
|
||||
@"NSAccessibilityLinkedUIElementsAttribute";
|
||||
@"NSAccessibilityLinkedUIElementsAttribute";
|
||||
NSString *const NSAccessibilityServesAsTitleForUIElementsAttribute =
|
||||
@"NSAccessibilityServesAsTitleForUIElementsAttribute";
|
||||
@"NSAccessibilityServesAsTitleForUIElementsAttribute";
|
||||
NSString *const NSAccessibilityTitleUIElementAttribute =
|
||||
@"NSAccessibilityTitleUIElementAttribute";
|
||||
@"NSAccessibilityTitleUIElementAttribute";
|
||||
|
||||
NSString *const NSAccessibilityDecrementButtonAttribute =
|
||||
@"NSAccessibilityDecrementButtonAttribute";
|
||||
@"NSAccessibilityDecrementButtonAttribute";
|
||||
NSString *const NSAccessibilityDocumentAttribute =
|
||||
@"NSAccessibilityDocumentAttribute";
|
||||
@"NSAccessibilityDocumentAttribute";
|
||||
NSString *const NSAccessibilityEditedAttribute =
|
||||
@"NSAccessibilityEditedAttribute";
|
||||
@"NSAccessibilityEditedAttribute";
|
||||
NSString *const NSAccessibilityExpandedAttribute =
|
||||
@"NSAccessibilityExpandedAttribute";
|
||||
@"NSAccessibilityExpandedAttribute";
|
||||
NSString *const NSAccessibilityFilenameAttribute =
|
||||
@"NSAccessibilityFilenameAttribute";
|
||||
@"NSAccessibilityFilenameAttribute";
|
||||
NSString *const NSAccessibilityHeaderAttribute =
|
||||
@"NSAccessibilityHeaderAttribute";
|
||||
@"NSAccessibilityHeaderAttribute";
|
||||
NSString *const NSAccessibilityHorizontalScrollBarAttribute =
|
||||
@"NSAccessibilityHorizontalScrollBarAttribute";
|
||||
@"NSAccessibilityHorizontalScrollBarAttribute";
|
||||
NSString *const NSAccessibilityIncrementButtonAttribute =
|
||||
@"NSAccessibilityIncrementButtonAttribute";
|
||||
@"NSAccessibilityIncrementButtonAttribute";
|
||||
NSString *const NSAccessibilityIndexAttribute =
|
||||
@"NSAccessibilityIndexAttribute";
|
||||
@"NSAccessibilityIndexAttribute";
|
||||
NSString *const NSAccessibilityNextContentsAttribute =
|
||||
@"NSAccessibilityNextContentsAttribute";
|
||||
@"NSAccessibilityNextContentsAttribute";
|
||||
NSString *const NSAccessibilityOverflowButtonAttribute =
|
||||
@"NSAccessibilityOverflowButtonAttribute";
|
||||
@"NSAccessibilityOverflowButtonAttribute";
|
||||
NSString *const NSAccessibilityPreviousContentsAttribute =
|
||||
@"NSAccessibilityPreviousContentsAttribute";
|
||||
@"NSAccessibilityPreviousContentsAttribute";
|
||||
NSString *const NSAccessibilitySelectedAttribute =
|
||||
@"NSAccessibilitySelectedAttribute";
|
||||
@"NSAccessibilitySelectedAttribute";
|
||||
NSString *const NSAccessibilitySplittersAttribute =
|
||||
@"NSAccessibilitySplittersAttribute";
|
||||
@"NSAccessibilitySplittersAttribute";
|
||||
NSString *const NSAccessibilityTabsAttribute = @"NSAccessibilityTabsAttribute";
|
||||
NSString *const NSAccessibilityURLAttribute = @"NSAccessibilityURLAttribute";
|
||||
NSString *const NSAccessibilityVerticalScrollBarAttribute =
|
||||
@"NSAccessibilityVerticalScrollBarAttribute";
|
||||
@"NSAccessibilityVerticalScrollBarAttribute";
|
||||
NSString *const NSAccessibilityWarningValueAttribute =
|
||||
@"NSAccessibilityWarningValueAttribute";
|
||||
@"NSAccessibilityWarningValueAttribute";
|
||||
NSString *const NSAccessibilityCriticalValueAttribute =
|
||||
@"NSAccessibilityCriticalValueAttribute";
|
||||
@"NSAccessibilityCriticalValueAttribute";
|
||||
NSString *const NSAccessibilityPlaceholderValueAttribute =
|
||||
@"NSAccessibilityPlaceholderValueAttribute";
|
||||
@"NSAccessibilityPlaceholderValueAttribute";
|
||||
|
||||
NSString *const NSAccessibilityApplicationRole =
|
||||
@"NSAccessibilityApplicationRole";
|
||||
@"NSAccessibilityApplicationRole";
|
||||
NSString *const NSAccessibilityBrowserRole = @"NSAccessibilityBrowserRole";
|
||||
NSString *const NSAccessibilityBusyIndicatorRole =
|
||||
@"NSAccessibilityBusyIndicatorRole";
|
||||
@"NSAccessibilityBusyIndicatorRole";
|
||||
NSString *const NSAccessibilityButtonRole = @"NSAccessibilityButtonRole";
|
||||
NSString *const NSAccessibilityCellRole = @"NSAccessibilityCellRole";
|
||||
NSString *const NSAccessibilityCheckBoxRole = @"NSAccessibilityCheckBoxRole";
|
||||
@ -351,7 +351,7 @@ NSString *const NSAccessibilityColorWellRole = @"NSAccessibilityColorWellRole";
|
||||
NSString *const NSAccessibilityColumnRole = @"NSAccessibilityColumnRole";
|
||||
NSString *const NSAccessibilityComboBoxRole = @"NSAccessibilityComboBoxRole";
|
||||
NSString *const NSAccessibilityDisclosureTriangleRole =
|
||||
@"NSAccessibilityDisclosureTriangleRole";
|
||||
@"NSAccessibilityDisclosureTriangleRole";
|
||||
NSString *const NSAccessibilityDrawerRole = @"NSAccessibilityDrawerRole";
|
||||
NSString *const NSAccessibilityGridRole = @"NSAccessibilityGridRole";
|
||||
NSString *const NSAccessibilityGroupRole = @"NSAccessibilityGroupRole";
|
||||
@ -360,48 +360,48 @@ NSString *const NSAccessibilityHandleRole = @"NSAccessibilityHandleRole";
|
||||
NSString *const NSAccessibilityHelpTagRole = @"NSAccessibilityHelpTagRole";
|
||||
NSString *const NSAccessibilityImageRole = @"NSAccessibilityImageRole";
|
||||
NSString *const NSAccessibilityIncrementorRole =
|
||||
@"NSAccessibilityIncrementorRole";
|
||||
@"NSAccessibilityIncrementorRole";
|
||||
NSString *const NSAccessibilityLayoutAreaRole =
|
||||
@"NSAccessibilityLayoutAreaRole";
|
||||
@"NSAccessibilityLayoutAreaRole";
|
||||
NSString *const NSAccessibilityLayoutItemRole =
|
||||
@"NSAccessibilityLayoutItemRole";
|
||||
@"NSAccessibilityLayoutItemRole";
|
||||
NSString *const NSAccessibilityLinkRole = @"NSAccessibilityLinkRole";
|
||||
NSString *const NSAccessibilityListRole = @"NSAccessibilityListRole";
|
||||
NSString *const NSAccessibilityMatteRole = @"NSAccessibilityMatteRole";
|
||||
NSString *const NSAccessibilityMenuBarRole = @"NSAccessibilityMenuBarRole";
|
||||
NSString *const NSAccessibilityMenuButtonRole =
|
||||
@"NSAccessibilityMenuButtonRole";
|
||||
@"NSAccessibilityMenuButtonRole";
|
||||
NSString *const NSAccessibilityMenuItemRole = @"NSAccessibilityMenuItemRole";
|
||||
NSString *const NSAccessibilityMenuRole = @"NSAccessibilityMenuRole";
|
||||
NSString *const NSAccessibilityOutlineRole = @"NSAccessibilityOutlineRole";
|
||||
NSString *const NSAccessibilityPopUpButtonRole =
|
||||
@"NSAccessibilityPopUpButtonRole";
|
||||
@"NSAccessibilityPopUpButtonRole";
|
||||
NSString *const NSAccessibilityProgressIndicatorRole =
|
||||
@"NSAccessibilityProgressIndicatorRole";
|
||||
@"NSAccessibilityProgressIndicatorRole";
|
||||
NSString *const NSAccessibilityRadioButtonRole =
|
||||
@"NSAccessibilityRadioButtonRole";
|
||||
@"NSAccessibilityRadioButtonRole";
|
||||
NSString *const NSAccessibilityRadioGroupRole =
|
||||
@"NSAccessibilityRadioGroupRole";
|
||||
@"NSAccessibilityRadioGroupRole";
|
||||
NSString *const NSAccessibilityRelevanceIndicatorRole =
|
||||
@"NSAccessibilityRelevanceIndicatorRole";
|
||||
@"NSAccessibilityRelevanceIndicatorRole";
|
||||
NSString *const NSAccessibilityRowRole = @"NSAccessibilityRowRole";
|
||||
NSString *const NSAccessibilityRulerMarkerRole =
|
||||
@"NSAccessibilityRulerMarkerRole";
|
||||
@"NSAccessibilityRulerMarkerRole";
|
||||
NSString *const NSAccessibilityRulerRole = @"NSAccessibilityRulerRole";
|
||||
NSString *const NSAccessibilityScrollAreaRole =
|
||||
@"NSAccessibilityScrollAreaRole";
|
||||
@"NSAccessibilityScrollAreaRole";
|
||||
NSString *const NSAccessibilityScrollBarRole = @"NSAccessibilityScrollBarRole";
|
||||
NSString *const NSAccessibilitySheetRole = @"NSAccessibilitySheetRole";
|
||||
NSString *const NSAccessibilitySliderRole = @"NSAccessibilitySliderRole";
|
||||
NSString *const NSAccessibilitySortButtonRole =
|
||||
@"NSAccessibilitySortButtonRole";
|
||||
@"NSAccessibilitySortButtonRole";
|
||||
NSString *const NSAccessibilitySplitGroupRole =
|
||||
@"NSAccessibilitySplitGroupRole";
|
||||
@"NSAccessibilitySplitGroupRole";
|
||||
NSString *const NSAccessibilitySplitterRole = @"NSAccessibilitySplitterRole";
|
||||
NSString *const NSAccessibilityStaticTextRole =
|
||||
@"NSAccessibilityStaticTextRole";
|
||||
@"NSAccessibilityStaticTextRole";
|
||||
NSString *const NSAccessibilitySystemWideRole =
|
||||
@"NSAccessibilitySystemWideRole";
|
||||
@"NSAccessibilitySystemWideRole";
|
||||
NSString *const NSAccessibilityTabGroupRole = @"NSAccessibilityTabGroupRole";
|
||||
NSString *const NSAccessibilityTableRole = @"NSAccessibilityTableRole";
|
||||
NSString *const NSAccessibilityTextAreaRole = @"NSAccessibilityTextAreaRole";
|
||||
@ -409,142 +409,142 @@ NSString *const NSAccessibilityTextFieldRole = @"NSAccessibilityTextFieldRole";
|
||||
NSString *const NSAccessibilityToolbarRole = @"NSAccessibilityToolbarRole";
|
||||
NSString *const NSAccessibilityUnknownRole = @"NSAccessibilityUnknownRole";
|
||||
NSString *const NSAccessibilityValueIndicatorRole =
|
||||
@"NSAccessibilityValueIndicatorRole";
|
||||
@"NSAccessibilityValueIndicatorRole";
|
||||
NSString *const NSAccessibilityWindowRole = @"NSAccessibilityWindowRole";
|
||||
|
||||
NSString *const NSAccessibilityCloseButtonSubrole =
|
||||
@"NSAccessibilityCloseButtonSubrole";
|
||||
@"NSAccessibilityCloseButtonSubrole";
|
||||
NSString *const NSAccessibilityDecrementArrowSubrole =
|
||||
@"NSAccessibilityDecrementArrowSubrole";
|
||||
@"NSAccessibilityDecrementArrowSubrole";
|
||||
NSString *const NSAccessibilityDecrementPageSubrole =
|
||||
@"NSAccessibilityDecrementPageSubrole";
|
||||
@"NSAccessibilityDecrementPageSubrole";
|
||||
NSString *const NSAccessibilityDialogSubrole = @"NSAccessibilityDialogSubrole";
|
||||
NSString *const NSAccessibilityFloatingWindowSubrole =
|
||||
@"NSAccessibilityFloatingWindowSubrole";
|
||||
@"NSAccessibilityFloatingWindowSubrole";
|
||||
NSString *const NSAccessibilityIncrementArrowSubrole =
|
||||
@"NSAccessibilityIncrementArrowSubrole";
|
||||
@"NSAccessibilityIncrementArrowSubrole";
|
||||
NSString *const NSAccessibilityIncrementPageSubrole =
|
||||
@"NSAccessibilityIncrementPageSubrole";
|
||||
@"NSAccessibilityIncrementPageSubrole";
|
||||
NSString *const NSAccessibilityMinimizeButtonSubrole =
|
||||
@"NSAccessibilityMinimizeButtonSubrole";
|
||||
@"NSAccessibilityMinimizeButtonSubrole";
|
||||
NSString *const NSAccessibilityOutlineRowSubrole =
|
||||
@"NSAccessibilityOutlineRowSubrole";
|
||||
@"NSAccessibilityOutlineRowSubrole";
|
||||
NSString *const NSAccessibilitySearchFieldSubrole =
|
||||
@"NSAccessibilitySearchFieldSubrole";
|
||||
@"NSAccessibilitySearchFieldSubrole";
|
||||
NSString *const NSAccessibilitySecureTextFieldSubrole =
|
||||
@"NSAccessibilitySecureTextFieldSubrole";
|
||||
@"NSAccessibilitySecureTextFieldSubrole";
|
||||
NSString *const NSAccessibilityStandardWindowSubrole =
|
||||
@"NSAccessibilityStandardWindowSubrole";
|
||||
@"NSAccessibilityStandardWindowSubrole";
|
||||
NSString *const NSAccessibilitySystemDialogSubrole =
|
||||
@"NSAccessibilitySystemDialogSubrole";
|
||||
@"NSAccessibilitySystemDialogSubrole";
|
||||
NSString *const NSAccessibilitySystemFloatingWindowSubrole =
|
||||
@"NSAccessibilitySystemFloatingWindowSubrole";
|
||||
@"NSAccessibilitySystemFloatingWindowSubrole";
|
||||
NSString *const NSAccessibilityTableRowSubrole =
|
||||
@"NSAccessibilityTableRowSubrole";
|
||||
@"NSAccessibilityTableRowSubrole";
|
||||
NSString *const NSAccessibilityTextAttachmentSubrole =
|
||||
@"NSAccessibilityTextAttachmentSubrole";
|
||||
@"NSAccessibilityTextAttachmentSubrole";
|
||||
NSString *const NSAccessibilityTextLinkSubrole =
|
||||
@"NSAccessibilityTextLinkSubrole";
|
||||
@"NSAccessibilityTextLinkSubrole";
|
||||
NSString *const NSAccessibilityTimelineSubrole =
|
||||
@"NSAccessibilityTimelineSubrole";
|
||||
@"NSAccessibilityTimelineSubrole";
|
||||
NSString *const NSAccessibilityToolbarButtonSubrole =
|
||||
@"NSAccessibilityToolbarButtonSubrole";
|
||||
@"NSAccessibilityToolbarButtonSubrole";
|
||||
NSString *const NSAccessibilityUnknownSubrole =
|
||||
@"NSAccessibilityUnknownSubrole";
|
||||
@"NSAccessibilityUnknownSubrole";
|
||||
NSString *const NSAccessibilityZoomButtonSubrole =
|
||||
@"NSAccessibilityZoomButtonSubrole";
|
||||
@"NSAccessibilityZoomButtonSubrole";
|
||||
NSString *const NSAccessibilitySortButtonSubrole =
|
||||
@"NSAccessibilitySortButtonSubrole";
|
||||
@"NSAccessibilitySortButtonSubrole";
|
||||
NSString *const NSAccessibilityRatingIndicatorSubrole =
|
||||
@"NSAccessibilityRatingIndicatorSubrole";
|
||||
@"NSAccessibilityRatingIndicatorSubrole";
|
||||
NSString *const NSAccessibilityContentListSubrole =
|
||||
@"NSAccessibilityContentListSubrole";
|
||||
@"NSAccessibilityContentListSubrole";
|
||||
NSString *const NSAccessibilityDefinitionListSubrole =
|
||||
@"NSAccessibilityDefinitionListSubrole";
|
||||
@"NSAccessibilityDefinitionListSubrole";
|
||||
|
||||
NSString *const NSAccessibilityCancelAction = @"NSAccessibilityCancelAction";
|
||||
NSString *const NSAccessibilityConfirmAction = @"NSAccessibilityConfirmAction";
|
||||
NSString *const NSAccessibilityDecrementAction =
|
||||
@"NSAccessibilityDecrementAction";
|
||||
@"NSAccessibilityDecrementAction";
|
||||
NSString *const NSAccessibilityDeleteAction = @"NSAccessibilityDeleteAction";
|
||||
NSString *const NSAccessibilityIncrementAction =
|
||||
@"NSAccessibilityIncrementAction";
|
||||
@"NSAccessibilityIncrementAction";
|
||||
NSString *const NSAccessibilityPickAction = @"NSAccessibilityPickAction";
|
||||
NSString *const NSAccessibilityPressAction = @"NSAccessibilityPressAction";
|
||||
NSString *const NSAccessibilityRaiseAction = @"NSAccessibilityRaiseAction";
|
||||
NSString *const NSAccessibilityShowMenuAction =
|
||||
@"NSAccessibilityShowMenuAction";
|
||||
@"NSAccessibilityShowMenuAction";
|
||||
|
||||
NSString *const NSAccessibilityMainWindowChangedNotification =
|
||||
@"NSAccessibilityMainWindowChangedNotification";
|
||||
@"NSAccessibilityMainWindowChangedNotification";
|
||||
NSString *const NSAccessibilityFocusedWindowChangedNotification =
|
||||
@"NSAccessibilityFocusedWindowChangedNotification";
|
||||
@"NSAccessibilityFocusedWindowChangedNotification";
|
||||
NSString *const NSAccessibilityFocusedUIElementChangedNotification =
|
||||
@"NSAccessibilityFocusedUIElementChangedNotification";
|
||||
@"NSAccessibilityFocusedUIElementChangedNotification";
|
||||
|
||||
NSString *const NSAccessibilityWindowCreatedNotification =
|
||||
@"NSAccessibilityWindowCreatedNotification";
|
||||
@"NSAccessibilityWindowCreatedNotification";
|
||||
NSString *const NSAccessibilityWindowDeminiaturizedNotification =
|
||||
@"NSAccessibilityWindowDeminiaturizedNotification";
|
||||
@"NSAccessibilityWindowDeminiaturizedNotification";
|
||||
NSString *const NSAccessibilityWindowMiniaturizedNotification =
|
||||
@"NSAccessibilityWindowMiniaturizedNotification";
|
||||
@"NSAccessibilityWindowMiniaturizedNotification";
|
||||
NSString *const NSAccessibilityWindowMovedNotification =
|
||||
@"NSAccessibilityWindowMovedNotification";
|
||||
@"NSAccessibilityWindowMovedNotification";
|
||||
NSString *const NSAccessibilityWindowResizedNotification =
|
||||
@"NSAccessibilityWindowResizedNotification";
|
||||
@"NSAccessibilityWindowResizedNotification";
|
||||
|
||||
NSString *const NSAccessibilityApplicationActivatedNotification =
|
||||
@"NSAccessibilityApplicationActivatedNotification";
|
||||
@"NSAccessibilityApplicationActivatedNotification";
|
||||
NSString *const NSAccessibilityApplicationDeactivatedNotification =
|
||||
@"NSAccessibilityApplicationDeactivatedNotification";
|
||||
@"NSAccessibilityApplicationDeactivatedNotification";
|
||||
NSString *const NSAccessibilityApplicationHiddenNotification =
|
||||
@"NSAccessibilityApplicationHiddenNotification";
|
||||
@"NSAccessibilityApplicationHiddenNotification";
|
||||
NSString *const NSAccessibilityApplicationShownNotification =
|
||||
@"NSAccessibilityApplicationShownNotification";
|
||||
@"NSAccessibilityApplicationShownNotification";
|
||||
|
||||
NSString *const NSAccessibilityDrawerCreatedNotification =
|
||||
@"NSAccessibilityDrawerCreatedNotification";
|
||||
@"NSAccessibilityDrawerCreatedNotification";
|
||||
NSString *const NSAccessibilitySheetCreatedNotification =
|
||||
@"NSAccessibilitySheetCreatedNotification";
|
||||
@"NSAccessibilitySheetCreatedNotification";
|
||||
|
||||
NSString *const NSAccessibilityCreatedNotification =
|
||||
@"NSAccessibilityCreatedNotification";
|
||||
@"NSAccessibilityCreatedNotification";
|
||||
NSString *const NSAccessibilityMovedNotification =
|
||||
@"NSAccessibilityMovedNotification";
|
||||
@"NSAccessibilityMovedNotification";
|
||||
NSString *const NSAccessibilityResizedNotification =
|
||||
@"NSAccessibilityResizedNotification";
|
||||
@"NSAccessibilityResizedNotification";
|
||||
NSString *const NSAccessibilityTitleChangedNotification =
|
||||
@"NSAccessibilityTitleChangedNotification";
|
||||
@"NSAccessibilityTitleChangedNotification";
|
||||
NSString *const NSAccessibilityUIElementDestroyedNotification =
|
||||
@"NSAccessibilityUIElementDestroyedNotification";
|
||||
@"NSAccessibilityUIElementDestroyedNotification";
|
||||
NSString *const NSAccessibilityValueChangedNotification =
|
||||
@"NSAccessibilityValueChangedNotification";
|
||||
@"NSAccessibilityValueChangedNotification";
|
||||
|
||||
NSString *const NSAccessibilityHelpTagCreatedNotification =
|
||||
@"NSAccessibilityHelpTagCreatedNotification";
|
||||
@"NSAccessibilityHelpTagCreatedNotification";
|
||||
NSString *const NSAccessibilityRowCountChangedNotification =
|
||||
@"NSAccessibilityRowCountChangedNotification";
|
||||
@"NSAccessibilityRowCountChangedNotification";
|
||||
NSString *const NSAccessibilitySelectedChildrenChangedNotification =
|
||||
@"NSAccessibilitySelectedChildrenChangedNotification";
|
||||
@"NSAccessibilitySelectedChildrenChangedNotification";
|
||||
NSString *const NSAccessibilitySelectedColumnsChangedNotification =
|
||||
@"NSAccessibilitySelectedColumnsChangedNotification";
|
||||
@"NSAccessibilitySelectedColumnsChangedNotification";
|
||||
NSString *const NSAccessibilitySelectedRowsChangedNotification =
|
||||
@"NSAccessibilitySelectedRowsChangedNotification";
|
||||
@"NSAccessibilitySelectedRowsChangedNotification";
|
||||
NSString *const NSAccessibilitySelectedTextChangedNotification =
|
||||
@"NSAccessibilitySelectedTextChangedNotification";
|
||||
@"NSAccessibilitySelectedTextChangedNotification";
|
||||
NSString *const NSAccessibilityRowExpandedNotification =
|
||||
@"NSAccessibilityRowExpandedNotification";
|
||||
@"NSAccessibilityRowExpandedNotification";
|
||||
NSString *const NSAccessibilityRowCollapsedNotification =
|
||||
@"NSAccessibilityRowCollapsedNotification";
|
||||
@"NSAccessibilityRowCollapsedNotification";
|
||||
NSString *const NSAccessibilitySelectedCellsChangedNotification =
|
||||
@"NSAccessibilitySelectedCellsChangedNotification";
|
||||
@"NSAccessibilitySelectedCellsChangedNotification";
|
||||
NSString *const NSAccessibilityUnitsChangedNotification =
|
||||
@"NSAccessibilityUnitsChangedNotification";
|
||||
@"NSAccessibilityUnitsChangedNotification";
|
||||
NSString *const NSAccessibilitySelectedChildrenMovedNotification =
|
||||
@"NSAccessibilitySelectedChildrenMovedNotification";
|
||||
@"NSAccessibilitySelectedChildrenMovedNotification";
|
||||
|
||||
NSString *const NSAccessibilityErrorCodeExceptionInfo =
|
||||
@"NSAccessibilityErrorCodeExceptionInfo";
|
||||
@"NSAccessibilityErrorCodeExceptionInfo";
|
||||
|
||||
/* The above constants are probably all wrong */
|
||||
/* The one below is right */
|
||||
@ -553,14 +553,14 @@ NSString *const NSAccessibilityActivationPointAttribute = @"AXActivationPoint";
|
||||
/* Undocumented */
|
||||
NSString *const NSAccessibilityEventProcessedNotification = @"AXEventProcessed";
|
||||
NSString *const NSAccessibilityEventSourceProcessIDKey =
|
||||
@"AXEventSourceProcessIDKey";
|
||||
@"AXEventSourceProcessIDKey";
|
||||
NSString *const NSAccessibilityEventSourceStateIDKey = @"AXEventSourceStateID";
|
||||
NSString *const NSAccessibilityEventSourceUserDataKey =
|
||||
@"AXEventSourceUserDataKey";
|
||||
@"AXEventSourceUserDataKey";
|
||||
NSString *const NSAccessibilityEventTimestampKey = @"AXEventTimestampKey";
|
||||
NSString *const NSAccessibilityMainThreadIdleNotification = @"AXMainThreadIdle";
|
||||
NSString *const NSAccessibilitySupportsMainThreadIdleNotificationAttribute =
|
||||
@"AXSupportsMainThreadIdleNotification";
|
||||
@"AXSupportsMainThreadIdleNotification";
|
||||
/* End undocumented */
|
||||
|
||||
NSString *const NSAccessibilityLayoutChangedNotification = @"AXLayoutChanged";
|
||||
|
@ -45,8 +45,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_style = NSWarningAlertStyle;
|
||||
_icon = [[NSImage imageNamed: @"NSAlertPanelExclamation"] retain];
|
||||
_messageText = [NSLocalizedStringFromTableInBundle(
|
||||
@"Alert", nil, [NSBundle bundleForClass: [NSAlert class]],
|
||||
@"Default message text for NSAlert") copy];
|
||||
@"Alert", nil, [NSBundle bundleForClass: [NSAlert class]],
|
||||
@"Default message text for NSAlert") copy];
|
||||
_informativeText = @"";
|
||||
_accessoryView = nil;
|
||||
_showsHelp = NO;
|
||||
@ -60,10 +60,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_suppressionButton = [[NSButton alloc] init];
|
||||
// [_suppressionButton setButtonType:NSSwitchButton];
|
||||
[_suppressionButton
|
||||
setTitle: NSLocalizedStringFromTableInBundle(
|
||||
@"Do not show this message again", nil,
|
||||
[NSBundle bundleForClass: [NSAlert class]],
|
||||
@"Default NSAlert supression button title")];
|
||||
setTitle: NSLocalizedStringFromTableInBundle(
|
||||
@"Do not show this message again", nil,
|
||||
[NSBundle bundleForClass: [NSAlert class]],
|
||||
@"Default NSAlert supression button title")];
|
||||
_needsLayout = YES;
|
||||
return self;
|
||||
}
|
||||
@ -83,11 +83,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
+ (NSAlert *) alertWithError: (NSError *) error {
|
||||
NSArray *titles = [error localizedRecoveryOptions];
|
||||
NSString *defaultTitle =
|
||||
([titles count] > 0) ? [titles objectAtIndex: 0] : nil;
|
||||
([titles count] > 0) ? [titles objectAtIndex: 0] : nil;
|
||||
NSString *alternateTitle =
|
||||
([titles count] > 1) ? [titles objectAtIndex: 1] : nil;
|
||||
([titles count] > 1) ? [titles objectAtIndex: 1] : nil;
|
||||
NSString *otherTitle =
|
||||
([titles count] > 2) ? [titles objectAtIndex: 2] : nil;
|
||||
([titles count] > 2) ? [titles objectAtIndex: 2] : nil;
|
||||
|
||||
NSAlert *result = [[[self alloc] init] autorelease];
|
||||
|
||||
@ -112,8 +112,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
va_start(arguments, format);
|
||||
|
||||
informativeText =
|
||||
[[[NSString alloc] initWithFormat: format
|
||||
arguments: arguments] autorelease];
|
||||
[[[NSString alloc] initWithFormat: format
|
||||
arguments: arguments] autorelease];
|
||||
|
||||
NSAlert *result = [[[self alloc] init] autorelease];
|
||||
|
||||
@ -121,8 +121,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[result setInformativeText: informativeText];
|
||||
if (defaultTitle == nil)
|
||||
defaultTitle = NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil, [NSBundle bundleForClass: [NSAlert class]],
|
||||
@"Default button title for NSAlert");
|
||||
@"OK", nil, [NSBundle bundleForClass: [NSAlert class]],
|
||||
@"Default button title for NSAlert");
|
||||
[result addButtonWithTitle: defaultTitle];
|
||||
if (alternateTitle != nil)
|
||||
[result addButtonWithTitle: alternateTitle];
|
||||
@ -273,21 +273,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSStringDrawer *drawer = [NSStringDrawer sharedStringDrawer];
|
||||
NSSize iconSize = (_icon != nil) ? [_icon size] : NSZeroSize;
|
||||
NSDictionary *messageAttributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: [NSFont boldSystemFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
dictionaryWithObjectsAndKeys: [NSFont boldSystemFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
NSSize messageSize = NSZeroSize;
|
||||
NSDictionary *informativeAttributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
NSSize informativeSize = NSZeroSize;
|
||||
CGFloat messageInformativeGap = 0.;
|
||||
NSDictionary *suppressionAttributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
dictionaryWithObjectsAndKeys: [NSFont systemFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
NSSize supressionSize = NSZeroSize;
|
||||
CGFloat informativeSuppressionGap = 0.;
|
||||
NSSize accessorySize =
|
||||
(_accessoryView != nil) ? [_accessoryView frame].size : NSZeroSize;
|
||||
(_accessoryView != nil) ? [_accessoryView frame].size : NSZeroSize;
|
||||
CGFloat suppressionAccessoryGap = 0.;
|
||||
NSSize mainSize = NSZeroSize;
|
||||
NSSize panelSize = NSZeroSize;
|
||||
@ -303,7 +303,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSSize size = [drawer sizeOfAttributedString: title inSize: NSZeroSize];
|
||||
|
||||
okCancelButtonSize.width =
|
||||
MAX(size.width + BUTTON_MARGIN * 2, okCancelButtonSize.width);
|
||||
MAX(size.width + BUTTON_MARGIN * 2, okCancelButtonSize.width);
|
||||
okCancelButtonSize.height = MAX(size.height, okCancelButtonSize.height);
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSSize size = [drawer sizeOfAttributedString: title inSize: NSZeroSize];
|
||||
|
||||
otherButtonSize.width =
|
||||
MAX(size.width + BUTTON_MARGIN * 2, otherButtonSize.width);
|
||||
MAX(size.width + BUTTON_MARGIN * 2, otherButtonSize.width);
|
||||
otherButtonSize.height = MAX(size.height, otherButtonSize.height);
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
allButtonsSize.width += [button frame].size.width;
|
||||
allButtonsSize.height =
|
||||
MAX(allButtonsSize.height, [button frame].size.height);
|
||||
MAX(allButtonsSize.height, [button frame].size.height);
|
||||
|
||||
allButtonsSize.width += INTERBUTTON_GAP;
|
||||
if (i == 1)
|
||||
@ -406,11 +406,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
frame.origin.y = panelSize.height - TOP_MARGIN - messageSize.height;
|
||||
frame.size = messageSize;
|
||||
textField = [[[NSTextField alloc] initWithFrame: frame] autorelease];
|
||||
[textField
|
||||
setAttributedStringValue: [[[NSAttributedString alloc]
|
||||
initWithString: _messageText
|
||||
attributes: messageAttributes]
|
||||
autorelease]];
|
||||
[textField setAttributedStringValue:
|
||||
[[[NSAttributedString alloc]
|
||||
initWithString: _messageText
|
||||
attributes: messageAttributes]
|
||||
autorelease]];
|
||||
[textField setEditable: NO];
|
||||
[textField setSelectable: YES];
|
||||
[textField setBordered: NO];
|
||||
@ -426,10 +426,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
messageInformativeGap - informativeSize.height;
|
||||
frame.size = informativeSize;
|
||||
textField = [[[NSTextField alloc] initWithFrame: frame] autorelease];
|
||||
[textField setStringValue: [[[NSAttributedString alloc]
|
||||
initWithString: _informativeText
|
||||
attributes: informativeAttributes]
|
||||
autorelease]];
|
||||
[textField
|
||||
setStringValue: [[[NSAttributedString alloc]
|
||||
initWithString: _informativeText
|
||||
attributes: informativeAttributes]
|
||||
autorelease]];
|
||||
[textField setEditable: NO];
|
||||
[textField setSelectable: YES];
|
||||
[textField setBordered: NO];
|
||||
@ -491,11 +492,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
// manual layout
|
||||
if (_needsLayout) {
|
||||
if ([_buttons count] == 0) {
|
||||
[self addButtonWithTitle: NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil,
|
||||
[NSBundle
|
||||
bundleForClass: [NSAlert class]],
|
||||
@"Default button title for NSAlert")];
|
||||
[self addButtonWithTitle:
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil,
|
||||
[NSBundle bundleForClass: [NSAlert class]],
|
||||
@"Default button title for NSAlert")];
|
||||
}
|
||||
|
||||
[self layout];
|
||||
@ -509,7 +510,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
typedef void (*alertDidEnd)(id, SEL, NSAlert *, int, void *);
|
||||
if (_sheetDidEnd) {
|
||||
alertDidEnd endFunction =
|
||||
(alertDidEnd) [_sheetDelegate methodForSelector: _sheetDidEnd];
|
||||
(alertDidEnd) [_sheetDelegate methodForSelector: _sheetDidEnd];
|
||||
|
||||
endFunction(_sheetDelegate, _sheetDidEnd, self, returnCode,
|
||||
contextInfo);
|
||||
@ -530,10 +531,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
[self retain];
|
||||
[NSApp beginSheet: _window
|
||||
modalForWindow: window
|
||||
modalDelegate: self
|
||||
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
|
||||
contextInfo: info];
|
||||
modalForWindow: window
|
||||
modalDelegate: self
|
||||
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
|
||||
contextInfo: info];
|
||||
}
|
||||
|
||||
- (NSInteger) runModal {
|
||||
|
@ -29,10 +29,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- initWithTitle: (NSString *) title
|
||||
message: (NSString *) message
|
||||
defaultButton: (NSString *) defaulteTitle
|
||||
alternateButton: (NSString *) alternateTitle
|
||||
otherButton: (NSString *) otherTitle
|
||||
sheet: (BOOL) sheet;
|
||||
message: (NSString *) message
|
||||
defaultButton: (NSString *) defaulteTitle
|
||||
alternateButton: (NSString *) alternateTitle
|
||||
otherButton: (NSString *) otherTitle
|
||||
sheet: (BOOL) sheet;
|
||||
|
||||
@end
|
||||
|
@ -36,11 +36,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#define BUTTON_MARGIN 8
|
||||
|
||||
- initWithTitle: (NSString *) title
|
||||
message: (NSString *) message
|
||||
defaultButton: (NSString *) defaultTitle
|
||||
alternateButton: (NSString *) alternateTitle
|
||||
otherButton: (NSString *) otherTitle
|
||||
sheet: (BOOL) sheet
|
||||
message: (NSString *) message
|
||||
defaultButton: (NSString *) defaultTitle
|
||||
alternateButton: (NSString *) alternateTitle
|
||||
otherButton: (NSString *) otherTitle
|
||||
sheet: (BOOL) sheet
|
||||
{
|
||||
NSImage *image = [NSImage imageNamed: @"NSAlertPanelExclamation"];
|
||||
NSSize imageSize = [image size];
|
||||
@ -58,7 +58,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (defaultTitle == nil)
|
||||
defaultTitle = NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil, [NSBundle bundleForClass: [NSAlertPanel class]], @"");
|
||||
@"OK", nil, [NSBundle bundleForClass: [NSAlertPanel class]],
|
||||
@"");
|
||||
|
||||
defaultSize = [drawer sizeOfString: defaultTitle
|
||||
withAttributes: nil
|
||||
@ -122,24 +123,24 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
contentRect.origin = NSZeroPoint;
|
||||
contentRect.size = panelSize;
|
||||
|
||||
self = [self
|
||||
initWithContentRect: contentRect
|
||||
styleMask: sheet ? NSDocModalWindowMask
|
||||
: NSTitledWindowMask | NSClosableWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
self = [self initWithContentRect: contentRect
|
||||
styleMask: sheet ? NSDocModalWindowMask
|
||||
: NSTitledWindowMask |
|
||||
NSClosableWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
|
||||
if ([title length] == 0)
|
||||
title = NSLocalizedStringFromTableInBundle(
|
||||
@"Alert", nil, [NSBundle bundleForClass: [NSAlertPanel class]],
|
||||
@"Alert panel title");
|
||||
@"Alert", nil, [NSBundle bundleForClass: [NSAlertPanel class]],
|
||||
@"Alert panel title");
|
||||
|
||||
[self setTitle: title];
|
||||
[self setLevel: NSModalPanelWindowLevel];
|
||||
|
||||
viewFrame.origin.y = BOTTOM_MARGIN;
|
||||
viewFrame.origin.x =
|
||||
LEFT_MARGIN + floor((panelSize.width - buttonTotalWidth) / 2);
|
||||
LEFT_MARGIN + floor((panelSize.width - buttonTotalWidth) / 2);
|
||||
viewFrame.size.width = buttonWidth;
|
||||
viewFrame.size.height = buttonHeight;
|
||||
_defaultButton = [[[NSButton alloc] initWithFrame: viewFrame] autorelease];
|
||||
@ -156,7 +157,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
viewFrame.size.width = buttonWidth;
|
||||
viewFrame.size.height = buttonHeight;
|
||||
_alternateButton =
|
||||
[[[NSButton alloc] initWithFrame: viewFrame] autorelease];
|
||||
[[[NSButton alloc] initWithFrame: viewFrame] autorelease];
|
||||
[_alternateButton setTitle: alternateTitle];
|
||||
[_alternateButton setTarget: self];
|
||||
[_alternateButton setAction: @selector(alternateButton:)];
|
||||
@ -170,7 +171,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
viewFrame.size.width = buttonWidth;
|
||||
viewFrame.size.height = buttonHeight;
|
||||
_otherButton =
|
||||
[[[NSButton alloc] initWithFrame: viewFrame] autorelease];
|
||||
[[[NSButton alloc] initWithFrame: viewFrame] autorelease];
|
||||
[_otherButton setTitle: otherTitle];
|
||||
[_otherButton setTarget: self];
|
||||
[_otherButton setAction: @selector(otherButton:)];
|
||||
@ -194,8 +195,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
viewFrame.origin.y -= messageSize.height - imageSize.height;
|
||||
viewFrame.size = messageSize;
|
||||
viewFrame.size.width +=
|
||||
6; // TextField's like to shrink the title area a bit - so make sure it
|
||||
// doesn't make it too small for the message!
|
||||
6; // TextField's like to shrink the title area a bit - so make sure
|
||||
// it doesn't make it too small for the message!
|
||||
_messageText = [[[NSTextField alloc] initWithFrame: viewFrame] autorelease];
|
||||
[_messageText setStringValue: message];
|
||||
[_messageText setSelectable: YES];
|
||||
|
@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <Foundation/NSValue.h>
|
||||
|
||||
NSString *const NSAnimationProgressMarkNotification =
|
||||
@"NSAnimationProgressMarkNotification";
|
||||
@"NSAnimationProgressMarkNotification";
|
||||
|
||||
NSString *NSAnimationTriggerOrderIn = @"NSAnimationTriggerOrderIn";
|
||||
NSString *NSAnimationTriggerOrderOut = @"NSAnimationTriggerOrderOut";
|
||||
@ -35,7 +35,7 @@ NSString *NSAnimationRunLoopMode = @"NSAnimationRunLoopMode";
|
||||
@implementation NSAnimation
|
||||
|
||||
- initWithDuration: (NSTimeInterval) duration
|
||||
animationCurve: (NSAnimationCurve) curve
|
||||
animationCurve: (NSAnimationCurve) curve
|
||||
{
|
||||
_duration = duration;
|
||||
_curve = curve;
|
||||
@ -207,9 +207,9 @@ NSString *NSAnimationRunLoopMode = @"NSAnimationRunLoopMode";
|
||||
|
||||
while (_isAnimating)
|
||||
[[NSRunLoop currentRunLoop]
|
||||
runMode: NSAnimationRunLoopMode
|
||||
beforeDate: [NSDate
|
||||
dateWithTimeIntervalSinceNow: _duration]];
|
||||
runMode: NSAnimationRunLoopMode
|
||||
beforeDate: [NSDate dateWithTimeIntervalSinceNow:
|
||||
_duration]];
|
||||
|
||||
[self _setCurrentProgressAndEndIfNeeded: 1.0];
|
||||
break;
|
||||
|
@ -84,17 +84,17 @@ NSString *const NSViewAnimationFadeOutEffect = @"NSViewAnimationFadeOutEffect";
|
||||
NSRect currentRect;
|
||||
|
||||
currentRect.origin.x =
|
||||
startRect.origin.x +
|
||||
(endRect.origin.x - startRect.origin.x) * progress;
|
||||
startRect.origin.x +
|
||||
(endRect.origin.x - startRect.origin.x) * progress;
|
||||
currentRect.origin.y =
|
||||
startRect.origin.y +
|
||||
(endRect.origin.y - startRect.origin.y) * progress;
|
||||
startRect.origin.y +
|
||||
(endRect.origin.y - startRect.origin.y) * progress;
|
||||
currentRect.size.width =
|
||||
startRect.size.width +
|
||||
(endRect.size.width - startRect.size.width) * progress;
|
||||
startRect.size.width +
|
||||
(endRect.size.width - startRect.size.width) * progress;
|
||||
currentRect.size.height =
|
||||
startRect.size.height +
|
||||
(endRect.size.height - startRect.size.height) * progress;
|
||||
startRect.size.height +
|
||||
(endRect.size.height - startRect.size.height) * progress;
|
||||
|
||||
if ([target isKindOfClass: [NSView class]])
|
||||
[target setFrame: currentRect];
|
||||
|
@ -25,16 +25,16 @@ NSString *const NSAppearanceNameLightContent = @"NSAppearanceNameLightContent";
|
||||
NSString *const NSAppearanceNameVibrantDark = @"NSAppearanceNameVibrantDark";
|
||||
NSString *const NSAppearanceNameVibrantLight = @"NSAppearanceNameVibrantLight";
|
||||
NSString *const NSAppearanceNameAccessibilityHighContrastAqua =
|
||||
@"NSAppearanceNameAccessibilityAqua";
|
||||
@"NSAppearanceNameAccessibilityAqua";
|
||||
NSString *const NSAppearanceNameAccessibilityHighContrastDarkAqua =
|
||||
@"NSAppearanceNameAccessibilityDarkAqua";
|
||||
@"NSAppearanceNameAccessibilityDarkAqua";
|
||||
NSString *const NSAppearanceNameAccessibilityHighContrastVibrantLight =
|
||||
@"NSAppearanceNameAccessibilityVibrantLight";
|
||||
@"NSAppearanceNameAccessibilityVibrantLight";
|
||||
NSString *const NSAppearanceNameAccessibilityHighContrastVibrantDark =
|
||||
@"NSAppearanceNameAccessibilityVibrantDark";
|
||||
@"NSAppearanceNameAccessibilityVibrantDark";
|
||||
|
||||
NSString *const NSAppearanceNameControlStrip =
|
||||
@"NSAppearanceNameControlStrip"; // Undocumented
|
||||
@"NSAppearanceNameControlStrip"; // Undocumented
|
||||
|
||||
@implementation NSAppearance
|
||||
|
||||
|
@ -47,38 +47,38 @@ const NSRunLoopMode NSModalPanelRunLoopMode = @"NSModalPanelRunLoopMode";
|
||||
const NSRunLoopMode NSEventTrackingRunLoopMode = @"NSEventTrackingRunLoopMode";
|
||||
|
||||
const NSNotificationName NSApplicationWillFinishLaunchingNotification =
|
||||
@"NSApplicationWillFinishLaunchingNotification";
|
||||
@"NSApplicationWillFinishLaunchingNotification";
|
||||
const NSNotificationName NSApplicationDidFinishLaunchingNotification =
|
||||
@"NSApplicationDidFinishLaunchingNotification";
|
||||
@"NSApplicationDidFinishLaunchingNotification";
|
||||
|
||||
const NSNotificationName NSApplicationWillBecomeActiveNotification =
|
||||
@"NSApplicationWillBecomeActiveNotification";
|
||||
@"NSApplicationWillBecomeActiveNotification";
|
||||
const NSNotificationName NSApplicationDidBecomeActiveNotification =
|
||||
@"NSApplicationDidBecomeActiveNotification";
|
||||
@"NSApplicationDidBecomeActiveNotification";
|
||||
const NSNotificationName NSApplicationWillResignActiveNotification =
|
||||
@"NSApplicationWillResignActiveNotification";
|
||||
@"NSApplicationWillResignActiveNotification";
|
||||
const NSNotificationName NSApplicationDidResignActiveNotification =
|
||||
@"NSApplicationDidResignActiveNotification";
|
||||
@"NSApplicationDidResignActiveNotification";
|
||||
|
||||
const NSNotificationName NSApplicationWillUpdateNotification =
|
||||
@"NSApplicationWillUpdateNotification";
|
||||
@"NSApplicationWillUpdateNotification";
|
||||
const NSNotificationName NSApplicationDidUpdateNotification =
|
||||
@"NSApplicationDidUpdateNotification";
|
||||
@"NSApplicationDidUpdateNotification";
|
||||
|
||||
const NSNotificationName NSApplicationWillHideNotification =
|
||||
@"NSApplicationWillHideNotification";
|
||||
@"NSApplicationWillHideNotification";
|
||||
const NSNotificationName NSApplicationDidHideNotification =
|
||||
@"NSApplicationDidHideNotification";
|
||||
@"NSApplicationDidHideNotification";
|
||||
const NSNotificationName NSApplicationWillUnhideNotification =
|
||||
@"NSApplicationWillUnhideNotification";
|
||||
@"NSApplicationWillUnhideNotification";
|
||||
const NSNotificationName NSApplicationDidUnhideNotification =
|
||||
@"NSApplicationDidUnhideNotification";
|
||||
@"NSApplicationDidUnhideNotification";
|
||||
|
||||
const NSNotificationName NSApplicationWillTerminateNotification =
|
||||
@"NSApplicationWillTerminateNotification";
|
||||
@"NSApplicationWillTerminateNotification";
|
||||
|
||||
const NSNotificationName NSApplicationDidChangeScreenParametersNotification =
|
||||
@"NSApplicationDidChangeScreenParametersNotification";
|
||||
@"NSApplicationDidChangeScreenParametersNotification";
|
||||
|
||||
const NSAppKitVersion NSAppKitVersionNumber = 1504; // macOS 10.12
|
||||
|
||||
@ -119,10 +119,10 @@ NSApplication *NSApp = nil;
|
||||
NSSize imageSize = [image size];
|
||||
NSRect rect = NSMakeRect(0, 0, imageSize.width, imageSize.height);
|
||||
NSWindow *splash =
|
||||
[[NSWindow alloc] initWithContentRect: rect
|
||||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
[[NSWindow alloc] initWithContentRect: rect
|
||||
styleMask: NSBorderlessWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
[splash setLevel: NSFloatingWindowLevel];
|
||||
|
||||
NSImageView *view = [[NSImageView alloc] initWithFrame: rect];
|
||||
@ -142,7 +142,7 @@ NSApplication *NSApp = nil;
|
||||
|
||||
if ([contentView isKindOfClass: [NSImageView class]])
|
||||
if ([[[(NSImageView *) contentView image] name]
|
||||
isEqual: @"splash"]) {
|
||||
isEqual: @"splash"]) {
|
||||
[window close];
|
||||
return;
|
||||
}
|
||||
@ -309,66 +309,66 @@ NSApplication *NSApp = nil;
|
||||
}
|
||||
|
||||
- (void) unregisterDelegate {
|
||||
if ([_delegate
|
||||
respondsToSelector: @selector(applicationWillFinishLaunching:)]) {
|
||||
if ([_delegate respondsToSelector: @selector
|
||||
(applicationWillFinishLaunching:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationWillFinishLaunchingNotification
|
||||
object: self];
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationWillFinishLaunchingNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate respondsToSelector: @selector
|
||||
(applicationDidFinishLaunching:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationDidFinishLaunchingNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate
|
||||
respondsToSelector: @selector(applicationDidFinishLaunching:)]) {
|
||||
respondsToSelector: @selector(applicationDidBecomeActive:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationDidFinishLaunchingNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate
|
||||
respondsToSelector: @selector(applicationDidBecomeActive:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationDidBecomeActiveNotification
|
||||
object: self];
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationDidBecomeActiveNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate respondsToSelector: @selector(applicationWillTerminate:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationWillTerminateNotification
|
||||
object: self];
|
||||
removeObserver: _delegate
|
||||
name: NSApplicationWillTerminateNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) registerDelegate {
|
||||
if ([_delegate
|
||||
respondsToSelector: @selector(applicationWillFinishLaunching:)]) {
|
||||
if ([_delegate respondsToSelector: @selector
|
||||
(applicationWillFinishLaunching:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationWillFinishLaunching:)
|
||||
name: NSApplicationWillFinishLaunchingNotification
|
||||
object: self];
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationWillFinishLaunching:)
|
||||
name: NSApplicationWillFinishLaunchingNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate respondsToSelector: @selector
|
||||
(applicationDidFinishLaunching:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationDidFinishLaunching:)
|
||||
name: NSApplicationDidFinishLaunchingNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate
|
||||
respondsToSelector: @selector(applicationDidFinishLaunching:)]) {
|
||||
respondsToSelector: @selector(applicationDidBecomeActive:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationDidFinishLaunching:)
|
||||
name: NSApplicationDidFinishLaunchingNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate
|
||||
respondsToSelector: @selector(applicationDidBecomeActive:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationDidBecomeActive:)
|
||||
name: NSApplicationDidBecomeActiveNotification
|
||||
object: self];
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationDidBecomeActive:)
|
||||
name: NSApplicationDidBecomeActiveNotification
|
||||
object: self];
|
||||
}
|
||||
if ([_delegate respondsToSelector: @selector(applicationWillTerminate:)]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationWillTerminate:)
|
||||
name: NSApplicationWillTerminateNotification
|
||||
object: self];
|
||||
addObserver: _delegate
|
||||
selector: @selector(applicationWillTerminate:)
|
||||
name: NSApplicationWillTerminateNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,14 +428,14 @@ NSApplication *NSApp = nil;
|
||||
NSMenuItem *item;
|
||||
|
||||
if ([[self windowsMenu]
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)] != -1)
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)] != -1)
|
||||
return;
|
||||
|
||||
if (isFilename)
|
||||
title = [NSString
|
||||
stringWithFormat: @"%@ -- %@", [title lastPathComponent],
|
||||
[title stringByDeletingLastPathComponent]];
|
||||
stringWithFormat: @"%@ -- %@", [title lastPathComponent],
|
||||
[title stringByDeletingLastPathComponent]];
|
||||
|
||||
item = [[[NSMenuItem alloc] initWithTitle: title
|
||||
action: @selector(makeKeyAndOrderFront:)
|
||||
@ -455,17 +455,17 @@ NSApplication *NSApp = nil;
|
||||
[self removeWindowsItem: window];
|
||||
} else {
|
||||
int itemIndex = [[self windowsMenu]
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)];
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)];
|
||||
|
||||
if (itemIndex != -1) {
|
||||
NSMenuItem *item = [[self windowsMenu] itemAtIndex: itemIndex];
|
||||
|
||||
if (isFilename)
|
||||
title = [NSString
|
||||
stringWithFormat: @"%@ -- %@", [title lastPathComponent],
|
||||
[title
|
||||
stringByDeletingLastPathComponent]];
|
||||
stringWithFormat:
|
||||
@"%@ -- %@", [title lastPathComponent],
|
||||
[title stringByDeletingLastPathComponent]];
|
||||
|
||||
[item setTitle: title];
|
||||
[[self windowsMenu] itemChanged: item];
|
||||
@ -476,15 +476,15 @@ NSApplication *NSApp = nil;
|
||||
|
||||
- (void) removeWindowsItem: (NSWindow *) window {
|
||||
int itemIndex = [[self windowsMenu]
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)];
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)];
|
||||
|
||||
if (itemIndex != -1) {
|
||||
[[self windowsMenu] removeItemAtIndex: itemIndex];
|
||||
|
||||
if ([[[[self windowsMenu] itemArray] lastObject] isSeparatorItem]) {
|
||||
[[self windowsMenu]
|
||||
removeItem: [[[self windowsMenu] itemArray] lastObject]];
|
||||
removeItem: [[[self windowsMenu] itemArray] lastObject]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -495,8 +495,8 @@ NSApplication *NSApp = nil;
|
||||
#else
|
||||
NSMenu *menu = [self windowsMenu];
|
||||
int itemIndex = [[self windowsMenu]
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)];
|
||||
indexOfItemWithTarget: window
|
||||
andAction: @selector(makeKeyAndOrderFront:)];
|
||||
|
||||
if (itemIndex != -1) {
|
||||
NSMenuItem *item = [menu itemAtIndex: itemIndex];
|
||||
@ -547,14 +547,14 @@ NSApplication *NSApp = nil;
|
||||
BOOL needsUntitled = YES;
|
||||
|
||||
NS_DURING [[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationWillFinishLaunchingNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationWillFinishLaunchingNotification
|
||||
object: self];
|
||||
NS_HANDLER [self reportException: localException];
|
||||
NS_ENDHANDLER
|
||||
|
||||
// Load the application icon if we have one
|
||||
NSString *iconName = [[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey: @"CFBundleIconFile"];
|
||||
objectForKey: @"CFBundleIconFile"];
|
||||
if (iconName) {
|
||||
iconName = [iconName stringByAppendingPathExtension: @"icns"];
|
||||
NSImage *image = [NSImage imageNamed: iconName];
|
||||
@ -572,7 +572,7 @@ NSApplication *NSApp = nil;
|
||||
|
||||
NSDocumentController *controller = nil;
|
||||
id types = [[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey: @"CFBundleDocumentTypes"];
|
||||
objectForKey: @"CFBundleDocumentTypes"];
|
||||
if ([types count] > 0)
|
||||
controller = [NSDocumentController sharedDocumentController];
|
||||
|
||||
@ -588,7 +588,7 @@ NSApplication *NSApp = nil;
|
||||
|
||||
if (needsUntitled && _delegate &&
|
||||
[_delegate
|
||||
respondsToSelector: @selector(applicationOpenUntitledFile:)]) {
|
||||
respondsToSelector: @selector(applicationOpenUntitledFile:)]) {
|
||||
needsUntitled = ![_delegate applicationOpenUntitledFile: self];
|
||||
}
|
||||
|
||||
@ -603,12 +603,12 @@ NSApplication *NSApp = nil;
|
||||
}
|
||||
|
||||
NS_DURING [[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationDidFinishLaunchingNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationDidFinishLaunchingNotification
|
||||
object: self];
|
||||
NS_HANDLER [self reportException: localException];
|
||||
NS_ENDHANDLER
|
||||
|
||||
[pool release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void) _checkForReleasedWindows {
|
||||
@ -685,7 +685,7 @@ NSApplication *NSApp = nil;
|
||||
NS_HANDLER [self reportException: localException];
|
||||
NS_ENDHANDLER
|
||||
|
||||
[self _checkForReleasedWindows];
|
||||
[self _checkForReleasedWindows];
|
||||
[self _checkForTerminate];
|
||||
|
||||
[pool release];
|
||||
@ -736,14 +736,14 @@ NSApplication *NSApp = nil;
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
|
||||
NS_DURING [NSClassFromString(@"Win32RunningCopyPipe")
|
||||
performSelector: @selector(createRunningCopyPipe)];
|
||||
performSelector: @selector(createRunningCopyPipe)];
|
||||
|
||||
// This should happen before _makeSureIsOnAScreen so we don't reposition
|
||||
// done windows
|
||||
[self _checkForReleasedWindows];
|
||||
|
||||
[[NSApp windows]
|
||||
makeObjectsPerformSelector: @selector(_makeSureIsOnAScreen)];
|
||||
makeObjectsPerformSelector: @selector(_makeSureIsOnAScreen)];
|
||||
|
||||
[self _checkForAppActivation];
|
||||
[self _displayAllWindowsIfNeeded];
|
||||
@ -761,7 +761,7 @@ NSApplication *NSApp = nil;
|
||||
NS_HANDLER [self reportException: localException];
|
||||
NS_ENDHANDLER
|
||||
|
||||
[pool release];
|
||||
[pool release];
|
||||
} while (nextEvent == nil && [untilDate timeIntervalSinceNow] > 0);
|
||||
|
||||
if (nextEvent != nil) {
|
||||
@ -864,7 +864,7 @@ NSApplication *NSApp = nil;
|
||||
}
|
||||
|
||||
NSDocumentController *documentController =
|
||||
[NSDocumentController sharedDocumentController];
|
||||
[NSDocumentController sharedDocumentController];
|
||||
if ([[documentController currentDocument] respondsToSelector: action])
|
||||
return [documentController currentDocument];
|
||||
|
||||
@ -999,10 +999,10 @@ NSApplication *NSApp = nil;
|
||||
- (void) endModalSession: (NSModalSession) session {
|
||||
if (session != [_modalStack lastObject])
|
||||
[NSException
|
||||
raise: NSInvalidArgumentException
|
||||
format: @"-[%@ %s] modal session %@ is not the current one %@",
|
||||
[self class], sel_getName(_cmd), session,
|
||||
[_modalStack lastObject]];
|
||||
raise: NSInvalidArgumentException
|
||||
format: @"-[%@ %s] modal session %@ is not the current one %@",
|
||||
[self class], sel_getName(_cmd), session,
|
||||
[_modalStack lastObject]];
|
||||
|
||||
for (NSEvent *requeue in [session unprocessedEvents]) {
|
||||
[self postEvent: requeue atStart: YES];
|
||||
@ -1036,13 +1036,13 @@ NSApplication *NSApp = nil;
|
||||
NSMutableDictionary *values = [NSMutableDictionary dictionary];
|
||||
values[@"NSWindow"] = window;
|
||||
|
||||
[self
|
||||
performSelectorOnMainThread: @selector(_mainThreadRunModalForWindow:)
|
||||
withObject: values
|
||||
waitUntilDone: YES
|
||||
modes: @[
|
||||
NSDefaultRunLoopMode, NSModalPanelRunLoopMode
|
||||
]];
|
||||
[self performSelectorOnMainThread: @selector(_mainThreadRunModalForWindow:)
|
||||
withObject: values
|
||||
waitUntilDone: YES
|
||||
modes: @[
|
||||
NSDefaultRunLoopMode,
|
||||
NSModalPanelRunLoopMode
|
||||
]];
|
||||
|
||||
NSNumber *result = values[@"result"];
|
||||
|
||||
@ -1064,25 +1064,25 @@ NSApplication *NSApp = nil;
|
||||
}
|
||||
|
||||
- (void) beginSheet: (NSWindow *) sheet
|
||||
modalForWindow: (NSWindow *) window
|
||||
modalDelegate: (id) modalDelegate
|
||||
didEndSelector: (SEL) didEndSelector
|
||||
contextInfo: (void *) contextInfo
|
||||
modalForWindow: (NSWindow *) window
|
||||
modalDelegate: (id) modalDelegate
|
||||
didEndSelector: (SEL) didEndSelector
|
||||
contextInfo: (void *) contextInfo
|
||||
{
|
||||
NSSheetContext *context =
|
||||
[NSSheetContext sheetContextWithSheet: sheet
|
||||
modalDelegate: modalDelegate
|
||||
didEndSelector: didEndSelector
|
||||
contextInfo: contextInfo
|
||||
frame: [sheet frame]];
|
||||
[NSSheetContext sheetContextWithSheet: sheet
|
||||
modalDelegate: modalDelegate
|
||||
didEndSelector: didEndSelector
|
||||
contextInfo: contextInfo
|
||||
frame: [sheet frame]];
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"NSRunAllSheetsAsModalPanel"]) {
|
||||
boolForKey: @"NSRunAllSheetsAsModalPanel"]) {
|
||||
// Center the sheet on the window.
|
||||
NSPoint windowCenter =
|
||||
NSMakePoint(NSMidX([window frame]), NSMidY([window frame]));
|
||||
NSMakePoint(NSMidX([window frame]), NSMidY([window frame]));
|
||||
NSPoint sheetCenter =
|
||||
NSMakePoint(NSMidX([sheet frame]), NSMidY([sheet frame]));
|
||||
NSMakePoint(NSMidX([sheet frame]), NSMidY([sheet frame]));
|
||||
NSPoint origin = [sheet frame].origin;
|
||||
origin.x += windowCenter.x - sheetCenter.x;
|
||||
origin.y += windowCenter.y - sheetCenter.y;
|
||||
@ -1104,13 +1104,13 @@ NSApplication *NSApp = nil;
|
||||
|
||||
- (void) endSheet: (NSWindow *) sheet returnCode: (NSModalResponse) returnCode {
|
||||
if ([[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"NSRunAllSheetsAsModalPanel"]) {
|
||||
boolForKey: @"NSRunAllSheetsAsModalPanel"]) {
|
||||
NSSheetContext *context = [sheet _sheetContext];
|
||||
NSModalSession session = [context modalSession];
|
||||
[session stopModalWithCode: NSRunStoppedResponse];
|
||||
|
||||
IMP function = [[context modalDelegate]
|
||||
methodForSelector: [context didEndSelector]];
|
||||
methodForSelector: [context didEndSelector]];
|
||||
if (function != NULL) {
|
||||
function([context modalDelegate], [context didEndSelector], sheet,
|
||||
returnCode, [context contextInfo]);
|
||||
@ -1130,7 +1130,7 @@ NSApplication *NSApp = nil;
|
||||
[check _detachSheetContextAnimateAndOrderOut];
|
||||
|
||||
function = [[context modalDelegate]
|
||||
methodForSelector: [context didEndSelector]];
|
||||
methodForSelector: [context didEndSelector]];
|
||||
if (function != NULL)
|
||||
function([context modalDelegate], [context didEndSelector],
|
||||
sheet, returnCode, [context contextInfo]);
|
||||
@ -1156,11 +1156,11 @@ NSApplication *NSApp = nil;
|
||||
- (int) requestUserAttention: (NSRequestUserAttentionType) attentionType {
|
||||
[_attentionTimer invalidate];
|
||||
_attentionTimer =
|
||||
[NSTimer scheduledTimerWithTimeInterval: 3
|
||||
target: self
|
||||
selector: @selector(_attentionTimer:)
|
||||
userInfo: nil
|
||||
repeats: YES];
|
||||
[NSTimer scheduledTimerWithTimeInterval: 3
|
||||
target: self
|
||||
selector: @selector(_attentionTimer:)
|
||||
userInfo: nil
|
||||
repeats: YES];
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -1187,15 +1187,15 @@ NSApplication *NSApp = nil;
|
||||
return;
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationWillHideNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationWillHideNotification
|
||||
object: self];
|
||||
// Do no use orderOut here ist causes the application to quit if no window
|
||||
// is visible.
|
||||
[_windows
|
||||
makeObjectsPerformSelector: @selector(_forcedHideForDeactivation)];
|
||||
makeObjectsPerformSelector: @selector(_forcedHideForDeactivation)];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationDidHideNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationDidHideNotification
|
||||
object: self];
|
||||
_isHidden = YES;
|
||||
}
|
||||
|
||||
@ -1207,13 +1207,13 @@ NSApplication *NSApp = nil;
|
||||
|
||||
if (_isHidden) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationWillUnhideNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationWillUnhideNotification
|
||||
object: self];
|
||||
[_windows makeObjectsPerformSelector: @selector
|
||||
(_showForActivation)]; // only shows previously hidden windows
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationDidUnhideNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationDidUnhideNotification
|
||||
object: self];
|
||||
}
|
||||
_isHidden = NO;
|
||||
//[self activateIgnoringOtherApps:NO]
|
||||
@ -1227,13 +1227,13 @@ NSApplication *NSApp = nil;
|
||||
if (_isHidden) {
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationWillUnhideNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationWillUnhideNotification
|
||||
object: self];
|
||||
[_windows makeObjectsPerformSelector: @selector
|
||||
(_showForActivation)]; // only shows previously hidden windows
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationDidUnhideNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationDidUnhideNotification
|
||||
object: self];
|
||||
}
|
||||
_isHidden = NO;
|
||||
}
|
||||
@ -1249,10 +1249,10 @@ NSApplication *NSApp = nil;
|
||||
|
||||
- (void) terminate: sender {
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
closeAllDocumentsWithDelegate: self
|
||||
didCloseAllSelector: @selector
|
||||
(_documentController:didCloseAll:contextInfo:)
|
||||
contextInfo: NULL];
|
||||
closeAllDocumentsWithDelegate: self
|
||||
didCloseAllSelector: @selector
|
||||
(_documentController:didCloseAll:contextInfo:)
|
||||
contextInfo: NULL];
|
||||
}
|
||||
|
||||
- (void) _documentController: (NSDocumentController *) docController
|
||||
@ -1262,10 +1262,10 @@ NSApplication *NSApp = nil;
|
||||
// callback method for terminate:
|
||||
if (didCloseAll) {
|
||||
if ([_delegate
|
||||
respondsToSelector: @selector(applicationShouldTerminate:)])
|
||||
respondsToSelector: @selector(applicationShouldTerminate:)])
|
||||
[self replyToApplicationShouldTerminate:
|
||||
[_delegate applicationShouldTerminate: self] ==
|
||||
NSTerminateNow];
|
||||
[_delegate applicationShouldTerminate: self] ==
|
||||
NSTerminateNow];
|
||||
else
|
||||
[self replyToApplicationShouldTerminate: YES];
|
||||
}
|
||||
@ -1274,11 +1274,11 @@ NSApplication *NSApp = nil;
|
||||
- (void) replyToApplicationShouldTerminate: (BOOL) terminate {
|
||||
if (terminate == YES) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationWillTerminateNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationWillTerminateNotification
|
||||
object: self];
|
||||
|
||||
[NSClassFromString(@"Win32RunningCopyPipe")
|
||||
performSelector: @selector(invalidateRunningCopyPipe)];
|
||||
performSelector: @selector(invalidateRunningCopyPipe)];
|
||||
|
||||
exit(0);
|
||||
}
|
||||
@ -1366,7 +1366,7 @@ NSApplication *NSApp = nil;
|
||||
|
||||
- (void) orderFrontStandardAboutPanelWithOptions: (NSDictionary *) options {
|
||||
NSSystemInfoPanel *standardAboutPanel =
|
||||
[[NSSystemInfoPanel standardAboutPanel] retain];
|
||||
[[NSSystemInfoPanel standardAboutPanel] retain];
|
||||
[standardAboutPanel showInfoPanel: self withOptions: options];
|
||||
}
|
||||
|
||||
@ -1376,16 +1376,17 @@ NSApplication *NSApp = nil;
|
||||
|
||||
- (void) showGuessPanel: sender {
|
||||
[[[NSSpellChecker sharedSpellChecker] spellingPanel]
|
||||
makeKeyAndOrderFront: self];
|
||||
makeKeyAndOrderFront: self];
|
||||
}
|
||||
|
||||
- (void) showHelp: sender {
|
||||
NSString *helpBookFolder = [[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey: @"CFBundleHelpBookFolder"];
|
||||
objectForKey: @"CFBundleHelpBookFolder"];
|
||||
if (helpBookFolder != nil) {
|
||||
BOOL isDir;
|
||||
NSString *folder =
|
||||
[[NSBundle mainBundle] pathForResource: helpBookFolder ofType: nil];
|
||||
[[NSBundle mainBundle] pathForResource: helpBookFolder
|
||||
ofType: nil];
|
||||
if (folder != nil &&
|
||||
[[NSFileManager defaultManager] fileExistsAtPath: folder
|
||||
isDirectory: &isDir] &&
|
||||
@ -1393,14 +1394,15 @@ NSApplication *NSApp = nil;
|
||||
NSBundle *helpBundle = [NSBundle bundleWithPath: folder];
|
||||
if (helpBundle) {
|
||||
NSString *helpBookName = [[helpBundle infoDictionary]
|
||||
objectForKey: @"CFBundleHelpTOCFile"];
|
||||
objectForKey: @"CFBundleHelpTOCFile"];
|
||||
if (helpBookName != nil) {
|
||||
NSString *helpFilePath =
|
||||
[helpBundle pathForResource: helpBookName ofType: nil];
|
||||
[helpBundle pathForResource: helpBookName
|
||||
ofType: nil];
|
||||
if (helpFilePath) {
|
||||
if ([[NSWorkspace sharedWorkspace]
|
||||
openFile: helpFilePath
|
||||
withApplication: @"Help Viewer"] == YES) {
|
||||
openFile: helpFilePath
|
||||
withApplication: @"Help Viewer"] == YES) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1410,8 +1412,8 @@ NSApplication *NSApp = nil;
|
||||
ofType: @"html"];
|
||||
if (helpFilePath) {
|
||||
if ([[NSWorkspace sharedWorkspace]
|
||||
openFile: helpFilePath
|
||||
withApplication: @"Help Viewer"] == YES) {
|
||||
openFile: helpFilePath
|
||||
withApplication: @"Help Viewer"] == YES) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1422,18 +1424,20 @@ NSApplication *NSApp = nil;
|
||||
NSString *processName = [[NSProcessInfo processInfo] processName];
|
||||
NSAlert *alert = [[NSAlert alloc] init];
|
||||
[alert setMessageText: NSLocalizedStringFromTableInBundle(
|
||||
@"Help", nil,
|
||||
[NSBundle bundleForClass: [NSApplication class]],
|
||||
@"Help alert title")];
|
||||
[alert
|
||||
setInformativeText:
|
||||
[NSString
|
||||
stringWithFormat: NSLocalizedStringFromTableInBundle(
|
||||
@"Help isn't available for %@.", nil,
|
||||
[NSBundle bundleForClass: [NSApplication
|
||||
class]],
|
||||
@""),
|
||||
processName]];
|
||||
@"Help", nil,
|
||||
[NSBundle bundleForClass: [NSApplication
|
||||
class]],
|
||||
@"Help alert title")];
|
||||
[alert setInformativeText:
|
||||
[NSString stringWithFormat:
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Help isn't available for %@.",
|
||||
nil,
|
||||
[NSBundle bundleForClass:
|
||||
[NSApplication
|
||||
class]],
|
||||
@""),
|
||||
processName]];
|
||||
[alert runModal];
|
||||
[alert release];
|
||||
}
|
||||
@ -1459,24 +1463,24 @@ NSApplication *NSApp = nil;
|
||||
|
||||
if (![self isActive]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationWillBecomeActiveNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationWillBecomeActiveNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _windowDidBecomeActive: (NSWindow *) window {
|
||||
if (![self isActiveExcludingWindow: window]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationDidBecomeActiveNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationDidBecomeActiveNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) _windowWillBecomeDeactive: (NSWindow *) window {
|
||||
if (![self isActiveExcludingWindow: window]) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationWillResignActiveNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationWillResignActiveNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1491,20 +1495,20 @@ NSApplication *NSApp = nil;
|
||||
// received to let them proceed. This special event type was added to
|
||||
// help them get unstuck and remove the menu on deactivation
|
||||
NSEvent *appKitEvent =
|
||||
[NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: NSZeroPoint
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: 0
|
||||
context: nil
|
||||
subtype: NSApplicationDeactivated
|
||||
data1: 0
|
||||
data2: 0];
|
||||
[NSEvent otherEventWithType: NSAppKitDefined
|
||||
location: NSZeroPoint
|
||||
modifierFlags: 0
|
||||
timestamp: 0
|
||||
windowNumber: 0
|
||||
context: nil
|
||||
subtype: NSApplicationDeactivated
|
||||
data1: 0
|
||||
data2: 0];
|
||||
[self postEvent: appKitEvent atStart: YES];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSApplicationDidResignActiveNotification
|
||||
object: self];
|
||||
postNotificationName: NSApplicationDidResignActiveNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1536,24 +1540,25 @@ int NSApplicationMain(int argc, const char *argv[]) {
|
||||
#ifndef DARLING
|
||||
if (argc > 1) {
|
||||
NSMutableArray *arguments =
|
||||
[NSMutableArray arrayWithCapacity: arg c - 1];
|
||||
[NSMutableArray arrayWithCapacity: arg c - 1];
|
||||
for (int i = 1; i < argc; i++)
|
||||
if (argv[i][0] != '-')
|
||||
[arguments addObject: [NSString stringWithUTF8String: argv[i]]];
|
||||
else if (argv[i][1] == '-' && argv[i][2] == '\0')
|
||||
break;
|
||||
else // (argv[i][0] == '-' && argv[i] != "--")
|
||||
if (*(int64_t *) argv[i] != *(int64_t *) "-NSOpen")
|
||||
if (*(int64_t *) argv[i] != *(int64_t *) "-NSOpen")
|
||||
i++;
|
||||
|
||||
if ((argc = [arguments count]))
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: ((argc == 1) ? [arguments lastObject] : arguments)
|
||||
forKey: @"NSOpen"];
|
||||
setObject: ((argc == 1) ? [arguments lastObject]
|
||||
: arguments)
|
||||
forKey: @"NSOpen"];
|
||||
}
|
||||
|
||||
[NSClassFromString(@"Win32RunningCopyPipe")
|
||||
performSelector: @selector(startRunningCopyPipe)];
|
||||
performSelector: @selector(startRunningCopyPipe)];
|
||||
#endif
|
||||
|
||||
if (class == Nil)
|
||||
|
@ -29,27 +29,27 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
NSString *const NSFontAttributeName = @"NSFontAttributeName";
|
||||
NSString *const NSParagraphStyleAttributeName =
|
||||
@"NSParagraphStyleAttributeName";
|
||||
@"NSParagraphStyleAttributeName";
|
||||
NSString *const NSForegroundColorAttributeName =
|
||||
@"NSForegroundColorAttributeName";
|
||||
@"NSForegroundColorAttributeName";
|
||||
NSString *const NSBackgroundColorAttributeName =
|
||||
@"NSBackgroundColorAttributeName";
|
||||
@"NSBackgroundColorAttributeName";
|
||||
NSString *const NSUnderlineStyleAttributeName =
|
||||
@"NSUnderlineStyleAttributeName";
|
||||
@"NSUnderlineStyleAttributeName";
|
||||
NSString *const NSUnderlineColorAttributeName =
|
||||
@"NSUnderlineColorAttributeName";
|
||||
@"NSUnderlineColorAttributeName";
|
||||
NSString *const NSAttachmentAttributeName = @"NSAttachmentAttributeName";
|
||||
NSString *const NSKernAttributeName = @"NSKernAttributeName";
|
||||
NSString *const NSLigatureAttributeName = @"NSLigatureAttributeName";
|
||||
NSString *const NSStrikethroughStyleAttributeName =
|
||||
@"NSStrikethroughStyleAttributeName";
|
||||
@"NSStrikethroughStyleAttributeName";
|
||||
NSString *const NSStrikethroughColorAttributeName =
|
||||
@"NSStrikethroughColorAttributeName";
|
||||
@"NSStrikethroughColorAttributeName";
|
||||
NSString *const NSObliquenessAttributeName = @"NSObliquenessAttributeName";
|
||||
NSString *const NSStrokeWidthAttributeName = @"NSStrokeWidthAttributeName";
|
||||
NSString *const NSStrokeColorAttributeName = @"NSStrokeColorAttributeName";
|
||||
NSString *const NSBaselineOffsetAttributeName =
|
||||
@"NSBaselineOffsetAttributeName";
|
||||
@"NSBaselineOffsetAttributeName";
|
||||
NSString *const NSSuperscriptAttributeName = @"NSSuperscriptAttributeName";
|
||||
NSString *const NSLinkAttributeName = @"NSLinkAttributeName";
|
||||
NSString *const NSShadowAttributeName = @"NSShadowAttributeName";
|
||||
@ -57,7 +57,7 @@ NSString *const NSExpansionAttributeName = @"NSExpansionAttributeName";
|
||||
NSString *const NSCursorAttributeName = @"NSCursorAttributeName";
|
||||
NSString *const NSToolTipAttributeName = @"NSToolTipAttributeName";
|
||||
NSString *const NSSpellingStateAttributeName =
|
||||
@"NSSpellingStateAttributeName"; // temporary attribute
|
||||
@"NSSpellingStateAttributeName"; // temporary attribute
|
||||
|
||||
NSString *const NSDocumentTypeDocumentAttribute = @"DocumentType";
|
||||
NSString *const NSConvertedDocumentAttribute = @"Converted";
|
||||
@ -71,13 +71,13 @@ NSString *const NSKeywordsDocumentAttribute = @"NSKeywordsDocumentAttribute";
|
||||
NSString *const NSCommentDocumentAttribute = @"NSCommentDocumentAttribute";
|
||||
NSString *const NSEditorDocumentAttribute = @"NSEditorDocumentAttribute";
|
||||
NSString *const NSCreationTimeDocumentAttribute =
|
||||
@"NSCreationTimeDocumentAttribute";
|
||||
@"NSCreationTimeDocumentAttribute";
|
||||
NSString *const NSModificationTimeDocumentAttribute =
|
||||
@"NSModificationTimeDocumentAttribute";
|
||||
@"NSModificationTimeDocumentAttribute";
|
||||
NSString *const NSManagerDocumentAttribute = @"NSManagerDocumentAttribute";
|
||||
NSString *const NSCategoryDocumentAttribute = @"NSCategoryDocumentAttribute";
|
||||
NSString *const NSAppearanceDocumentAttribute =
|
||||
@"NSAppearanceDocumentAttribute";
|
||||
@"NSAppearanceDocumentAttribute";
|
||||
NSString *const NSCharacterEncodingDocumentAttribute = @"CharacterEncoding";
|
||||
NSString *const NSDefaultAttributesDocumentAttribute = @"DefaultAttributes";
|
||||
NSString *const NSPaperSizeDocumentAttribute = @"PaperSize";
|
||||
@ -93,7 +93,7 @@ NSString *const NSBackgroundColorDocumentAttribute = @"BackgroundColor";
|
||||
NSString *const NSHyphenationFactorDocumentAttribute = @"HyphenationFactor";
|
||||
NSString *const NSDefaultTabIntervalDocumentAttribute = @"DefaultTabInterval";
|
||||
NSString *const NSTextLayoutSectionsAttribute =
|
||||
@"NSTextLayoutSectionsAttribute";
|
||||
@"NSTextLayoutSectionsAttribute";
|
||||
NSString *const NSExcludedElementsDocumentAttribute = @"ExcludedElements";
|
||||
NSString *const NSTextEncodingNameDocumentAttribute = @"TextEncodingName";
|
||||
NSString *const NSPrefixSpacesDocumentAttribute = @"PrefixSpaces";
|
||||
@ -106,7 +106,7 @@ NSString *const NSBaseURLDocumentOption = @"BaseURL";
|
||||
NSString *const NSTimeoutDocumentOption = @"Timeout";
|
||||
NSString *const NSWebPreferencesDocumentOption = @"WebPreferences";
|
||||
NSString *const NSWebResourceLoadDelegateDocumentOption =
|
||||
@"WebResourceLoadDelegate";
|
||||
@"WebResourceLoadDelegate";
|
||||
NSString *const NSTextSizeMultiplierDocumentOption = @"TextSizeMultiplier";
|
||||
NSString *const NSFileTypeDocumentOption = @"UTI";
|
||||
|
||||
@ -122,7 +122,7 @@ NSString *const NSOfficeOpenXMLTextDocumentType = @"NSOfficeOpenXML";
|
||||
NSString *const NSOpenDocumentTextDocumentType = @"NSOpenDocument";
|
||||
|
||||
NSString *const NSTextLayoutSectionOrientation =
|
||||
@"NSTextLayoutSectionOrientation";
|
||||
@"NSTextLayoutSectionOrientation";
|
||||
NSString *const NSTextLayoutSectionRange = @"NSTextLayoutSectionRange";
|
||||
|
||||
NSString *const NSCharacterShapeAttributeName = @"NSCharacterShape";
|
||||
@ -139,62 +139,62 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
#pragma mark Creating an NSAttributedString
|
||||
|
||||
+ (NSAttributedString *) attributedStringWithAttachment:
|
||||
(NSTextAttachment *) attachment
|
||||
(NSTextAttachment *) attachment
|
||||
{
|
||||
unichar unicode = NSAttachmentCharacter;
|
||||
NSString *string = [NSString stringWithCharacters: &unicode length: 1];
|
||||
NSDictionary *attributes =
|
||||
[NSDictionary dictionaryWithObject: attachment
|
||||
forKey: NSAttachmentAttributeName];
|
||||
[NSDictionary dictionaryWithObject: attachment
|
||||
forKey: NSAttachmentAttributeName];
|
||||
|
||||
return [[[self alloc] initWithString: string
|
||||
attributes: attributes] autorelease];
|
||||
}
|
||||
|
||||
- initWithData: (NSData *) data
|
||||
options: (NSDictionary *) options
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
error: (NSError **) error
|
||||
options: (NSDictionary *) options
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
error: (NSError **) error
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
}
|
||||
|
||||
- initWithDocFormat: (NSData *) werd
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
}
|
||||
|
||||
- initWithHTML: (NSData *) html
|
||||
baseURL: (NSURL *) url
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
baseURL: (NSURL *) url
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
}
|
||||
|
||||
- initWithHTML: (NSData *) html
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
}
|
||||
|
||||
- initWithHTML: (NSData *) html
|
||||
options: (NSDictionary *) options
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
options: (NSDictionary *) options
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
}
|
||||
|
||||
- initWithPath: (NSString *) path
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
{
|
||||
NSAttributedString *string =
|
||||
[NSRichTextReader attributedStringWithContentsOfFile: path];
|
||||
[NSRichTextReader attributedStringWithContentsOfFile: path];
|
||||
if (string == nil) {
|
||||
[self release];
|
||||
return nil;
|
||||
@ -204,7 +204,7 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
|
||||
- initWithRTF: (NSData *) rtf documentAttributes: (NSDictionary **) attributes {
|
||||
NSAttributedString *string =
|
||||
[NSRichTextReader attributedStringWithData: rtf];
|
||||
[NSRichTextReader attributedStringWithData: rtf];
|
||||
if (string == nil) {
|
||||
[self release];
|
||||
return nil;
|
||||
@ -213,14 +213,14 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
}
|
||||
|
||||
- initWithRTFD: (NSData *) rtfd
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
}
|
||||
|
||||
- initWithRTFDFileWrapper: (NSFileWrapper *) wrapper
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
@ -232,9 +232,9 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
}
|
||||
|
||||
- initWithURL: (NSURL *) url
|
||||
options: (NSDictionary *) options
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
error: (NSError **) error
|
||||
options: (NSDictionary *) options
|
||||
documentAttributes: (NSDictionary **) attributes
|
||||
error: (NSError **) error
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
@ -285,16 +285,14 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
|
||||
if (expand) {
|
||||
for (; result.location != 0; result.location--, result.length++) {
|
||||
if (![set characterIsMember: [string
|
||||
characterAtIndex: result.location -
|
||||
1]])
|
||||
if (![set characterIsMember:
|
||||
[string characterAtIndex: result.location - 1]])
|
||||
break;
|
||||
}
|
||||
|
||||
for (; NSMaxRange(result) < length; result.length++) {
|
||||
if (![set
|
||||
characterIsMember: [string characterAtIndex: NSMaxRange(
|
||||
result)]])
|
||||
if (![set characterIsMember:
|
||||
[string characterAtIndex: NSMaxRange(result)]])
|
||||
break;
|
||||
}
|
||||
} else if (location < length)
|
||||
@ -440,7 +438,7 @@ NSUInteger NSUnderlineByWordMask = 0x8000;
|
||||
}
|
||||
|
||||
- (NSData *) RTFFromRange: (NSRange) range
|
||||
documentAttributes: (NSDictionary *) attributes
|
||||
documentAttributes: (NSDictionary *) attributes
|
||||
{
|
||||
return [NSRichTextWriter dataWithAttributedString: self range: range];
|
||||
}
|
||||
@ -565,7 +563,7 @@ NSParagraphStyle *
|
||||
NSParagraphStyleAttributeInDictionary(NSDictionary *dictionary)
|
||||
{
|
||||
NSParagraphStyle *style =
|
||||
[dictionary objectForKey: NSParagraphStyleAttributeName];
|
||||
[dictionary objectForKey: NSParagraphStyleAttributeName];
|
||||
|
||||
if (style == nil)
|
||||
style = [NSParagraphStyle defaultParagraphStyle];
|
||||
|
@ -72,8 +72,8 @@ static void CGPathConverter(void *info, const CGPathElement *element) {
|
||||
|
||||
case kCGPathElementAddCurveToPoint:
|
||||
[bezier curveToPoint: *(CGPoint *) &element->points[2]
|
||||
controlPoint1: *(CGPoint *) &element->points[0]
|
||||
controlPoint2: *(CGPoint *) &element->points[1]];
|
||||
controlPoint1: *(CGPoint *) &element->points[0]
|
||||
controlPoint2: *(CGPoint *) &element->points[1]];
|
||||
break;
|
||||
|
||||
case kCGPathElementCloseSubpath:
|
||||
@ -515,27 +515,27 @@ static int numberOfPointsForOperator(int op) {
|
||||
|| ((fromPoint.y > point.y) &&
|
||||
(toPoint.y <= point.y))) { // a downward crossing
|
||||
// compute the actual edge-ray intersect x-coordinate
|
||||
CGFloat vt =
|
||||
(CGFloat)(point.y - fromPoint.y) / (toPoint.y - fromPoint.y);
|
||||
CGFloat vt = (CGFloat)(point.y - fromPoint.y) /
|
||||
(toPoint.y - fromPoint.y);
|
||||
if (point.x <
|
||||
fromPoint.x +
|
||||
vt * (toPoint.x - fromPoint.x)) // point.x < intersect
|
||||
vt * (toPoint.x - fromPoint.x)) // point.x < intersect
|
||||
++count; // a valid crossing of y=point.y right of point.x
|
||||
}
|
||||
} else {
|
||||
// Subdivide the bezier path and test both subpaths - adapted from the
|
||||
// flatten path code
|
||||
CGPoint sub1_start = fromPoint;
|
||||
CGPoint sub1_cp1 =
|
||||
CGPointMake((fromPoint.x + tan1.x) / 2, (fromPoint.y + tan1.y) / 2);
|
||||
CGPoint sub1_cp1 = CGPointMake((fromPoint.x + tan1.x) / 2,
|
||||
(fromPoint.y + tan1.y) / 2);
|
||||
CGPoint T = CGPointMake((tan1.x + tan2.x) / 2, (tan1.y + tan2.y) / 2);
|
||||
CGPoint sub1_cp2 =
|
||||
CGPointMake((sub1_cp1.x + T.x) / 2, (sub1_cp1.y + T.y) / 2);
|
||||
CGPointMake((sub1_cp1.x + T.x) / 2, (sub1_cp1.y + T.y) / 2);
|
||||
CGPoint sub2_end = toPoint;
|
||||
CGPoint sub2_cp2 =
|
||||
CGPointMake((tan2.x + toPoint.x) / 2, (tan2.y + toPoint.y) / 2);
|
||||
CGPointMake((tan2.x + toPoint.x) / 2, (tan2.y + toPoint.y) / 2);
|
||||
CGPoint sub2_cp1 =
|
||||
CGPointMake((T.x + sub2_cp2.x) / 2, (T.y + sub2_cp2.y) / 2);
|
||||
CGPointMake((T.x + sub2_cp2.x) / 2, (T.y + sub2_cp2.y) / 2);
|
||||
CGPoint sub2_start = CGPointMake((sub1_cp2.x + sub2_cp1.x) / 2,
|
||||
(sub1_cp2.y + sub2_cp1.y) / 2);
|
||||
CGPoint sub1_end = sub2_start;
|
||||
@ -592,9 +592,10 @@ static int numberOfPointsForOperator(int op) {
|
||||
// compute the actual edge-ray intersect x-coordinate
|
||||
CGFloat vt = (CGFloat)(point.y - currentPoint.y) /
|
||||
(toPoint.y - currentPoint.y);
|
||||
if (point.x < currentPoint.x +
|
||||
vt * (toPoint.x -
|
||||
currentPoint.x)) // point.x < intersect
|
||||
if (point.x <
|
||||
currentPoint.x +
|
||||
vt * (toPoint.x -
|
||||
currentPoint.x)) // point.x < intersect
|
||||
++cn; // a valid crossing of y=point.y right of point.x
|
||||
}
|
||||
currentPoint = toPoint;
|
||||
@ -619,9 +620,10 @@ static int numberOfPointsForOperator(int op) {
|
||||
// compute the actual edge-ray intersect x-coordinate
|
||||
CGFloat vt = (CGFloat)(point.y - currentPoint.y) /
|
||||
(toPoint.y - currentPoint.y);
|
||||
if (point.x < currentPoint.x +
|
||||
vt * (toPoint.x -
|
||||
currentPoint.x)) // point.x < intersect
|
||||
if (point.x <
|
||||
currentPoint.x +
|
||||
vt * (toPoint.x -
|
||||
currentPoint.x)) // point.x < intersect
|
||||
++cn; // a valid crossing of y=point.y right of point.x
|
||||
}
|
||||
currentPoint = startPoint;
|
||||
@ -658,7 +660,7 @@ static inline void expandOperatorCapacity(NSBezierPath *self, unsigned delta) {
|
||||
self->_capacityOfElements = self->_numberOfElements + delta;
|
||||
self->_capacityOfElements = (self->_capacityOfElements / 32 + 1) * 32;
|
||||
self->_elements =
|
||||
NSZoneRealloc(NULL, self->_elements, self->_capacityOfElements);
|
||||
NSZoneRealloc(NULL, self->_elements, self->_capacityOfElements);
|
||||
}
|
||||
}
|
||||
|
||||
@ -667,7 +669,7 @@ static inline void expandPointCapacity(NSBezierPath *self, unsigned delta) {
|
||||
self->_capacityOfPoints = self->_numberOfPoints + delta;
|
||||
self->_capacityOfPoints = (self->_capacityOfPoints / 64 + 1) * 64;
|
||||
self->_points = NSZoneRealloc(
|
||||
NULL, self->_points, self->_capacityOfPoints * sizeof(CGPoint));
|
||||
NULL, self->_points, self->_capacityOfPoints * sizeof(CGPoint));
|
||||
}
|
||||
}
|
||||
|
||||
@ -777,8 +779,8 @@ static void cgApplier(void *info, const CGPathElement *element) {
|
||||
|
||||
case kCGPathElementAddCurveToPoint:
|
||||
[self curveToPoint: element->points[2]
|
||||
controlPoint1: element->points[0]
|
||||
controlPoint2: element->points[1]];
|
||||
controlPoint1: element->points[0]
|
||||
controlPoint2: element->points[1]];
|
||||
break;
|
||||
|
||||
case kCGPathElementCloseSubpath:
|
||||
@ -801,8 +803,8 @@ static void cgArcApply(void *info, const CGPathElement *element) {
|
||||
|
||||
case kCGPathElementAddCurveToPoint:
|
||||
[self curveToPoint: element->points[2]
|
||||
controlPoint1: element->points[0]
|
||||
controlPoint2: element->points[1]];
|
||||
controlPoint1: element->points[0]
|
||||
controlPoint2: element->points[1]];
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -828,8 +830,8 @@ static void cgArcFromApply(void *info, const CGPathElement *element) {
|
||||
|
||||
case kCGPathElementAddCurveToPoint:
|
||||
[self curveToPoint: element->points[2]
|
||||
controlPoint1: element->points[0]
|
||||
controlPoint2: element->points[1]];
|
||||
controlPoint1: element->points[0]
|
||||
controlPoint2: element->points[1]];
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -870,18 +872,21 @@ static void cgArcFromApply(void *info, const CGPathElement *element) {
|
||||
{
|
||||
[self moveToPoint: NSMakePoint(rect.origin.x + radius, NSMaxY(rect))];
|
||||
[self appendBezierPathWithArcWithCenter: NSMakePoint(
|
||||
rect.origin.x +
|
||||
rect.size.width - radius,
|
||||
rect.origin.y +
|
||||
rect.size.height - radius)
|
||||
rect.origin.x +
|
||||
rect.size.width -
|
||||
radius,
|
||||
rect.origin.y +
|
||||
rect.size.height -
|
||||
radius)
|
||||
radius: radius
|
||||
startAngle: 90
|
||||
endAngle: 0.0f
|
||||
clockwise: YES];
|
||||
[self appendBezierPathWithArcWithCenter: NSMakePoint(rect.origin.x +
|
||||
[self appendBezierPathWithArcWithCenter: NSMakePoint(
|
||||
rect.origin.x +
|
||||
rect.size.width -
|
||||
radius,
|
||||
rect.origin.y + radius)
|
||||
rect.origin.y + radius)
|
||||
radius: radius
|
||||
startAngle: 360.0f
|
||||
endAngle: 270
|
||||
@ -892,8 +897,9 @@ static void cgArcFromApply(void *info, const CGPathElement *element) {
|
||||
startAngle: 270
|
||||
endAngle: 180
|
||||
clockwise: YES];
|
||||
[self appendBezierPathWithArcWithCenter: NSMakePoint(rect.origin.x + radius,
|
||||
rect.origin.y +
|
||||
[self appendBezierPathWithArcWithCenter: NSMakePoint(
|
||||
rect.origin.x + radius,
|
||||
rect.origin.y +
|
||||
rect.size.height -
|
||||
radius)
|
||||
radius: radius
|
||||
@ -938,14 +944,14 @@ static inline CGFloat degreesToRadians(CGFloat degrees) {
|
||||
NSString *fontName = [font fontName];
|
||||
CGFontRef cgFont = CGFontCreateWithFontName((CFStringRef) fontName);
|
||||
if (cgFont) {
|
||||
CTFontRef fontRef =
|
||||
CTFontCreateWithGraphicsFont(cgFont, [font pointSize], NULL, NULL);
|
||||
CTFontRef fontRef = CTFontCreateWithGraphicsFont(
|
||||
cgFont, [font pointSize], NULL, NULL);
|
||||
if (fontRef) {
|
||||
CGPathRef glyphPath =
|
||||
CTFontCreatePathForGlyph(fontRef, glyph, NULL);
|
||||
CTFontCreatePathForGlyph(fontRef, glyph, NULL);
|
||||
if (glyphPath) {
|
||||
NSBezierPath *path =
|
||||
[NSBezierPath bezierPathWithCGPath: glyphPath];
|
||||
[NSBezierPath bezierPathWithCGPath: glyphPath];
|
||||
|
||||
// Translate the path to the current point
|
||||
CGPoint currentPoint = [self currentPoint];
|
||||
@ -1052,16 +1058,16 @@ static NSUInteger doFlattenBezierCurve(CGFloat desiredFlatness, CGPoint start,
|
||||
// Subdivide the curve - Hearn & Baker Computer Graphics pp460-461
|
||||
CGPoint sub1_start = start;
|
||||
CGPoint sub1_cp1 =
|
||||
CGPointMake((start.x + cp1.x) / 2, (start.y + cp1.y) / 2);
|
||||
CGPointMake((start.x + cp1.x) / 2, (start.y + cp1.y) / 2);
|
||||
CGPoint T = CGPointMake((cp1.x + cp2.x) / 2, (cp1.y + cp2.y) / 2);
|
||||
CGPoint sub1_cp2 =
|
||||
CGPointMake((sub1_cp1.x + T.x) / 2, (sub1_cp1.y + T.y) / 2);
|
||||
CGPointMake((sub1_cp1.x + T.x) / 2, (sub1_cp1.y + T.y) / 2);
|
||||
|
||||
CGPoint sub2_end = end;
|
||||
CGPoint sub2_cp2 =
|
||||
CGPointMake((cp2.x + end.x) / 2, (cp2.y + end.y) / 2);
|
||||
CGPointMake((cp2.x + end.x) / 2, (cp2.y + end.y) / 2);
|
||||
CGPoint sub2_cp1 =
|
||||
CGPointMake((T.x + sub2_cp2.x) / 2, (T.y + sub2_cp2.y) / 2);
|
||||
CGPointMake((T.x + sub2_cp2.x) / 2, (T.y + sub2_cp2.y) / 2);
|
||||
CGPoint sub2_start = CGPointMake((sub1_cp2.x + sub2_cp1.x) / 2,
|
||||
(sub1_cp2.y + sub2_cp1.y) / 2);
|
||||
CGPoint sub1_end = sub2_start;
|
||||
@ -1159,7 +1165,8 @@ static NSUInteger flattenBezierCurve(CGFloat desiredFlatness, CGPoint start,
|
||||
// Find the previous start of a path
|
||||
for (j = i - 1; j >= 0; j--) {
|
||||
NSBezierPathElement type =
|
||||
[self elementAtIndex: j associatedPoints: prevPoints];
|
||||
[self elementAtIndex: j
|
||||
associatedPoints: prevPoints];
|
||||
if (type == NSMoveToBezierPathElement) {
|
||||
nextPoint = prevPoints[0];
|
||||
break;
|
||||
@ -1215,8 +1222,8 @@ static NSUInteger flattenBezierCurve(CGFloat desiredFlatness, CGPoint start,
|
||||
break;
|
||||
case NSCurveToBezierPathElement:
|
||||
[path curveToPoint: nextPoint
|
||||
controlPoint1: pts[1]
|
||||
controlPoint2: pts[0]];
|
||||
controlPoint1: pts[1]
|
||||
controlPoint2: pts[0]];
|
||||
break;
|
||||
case NSClosePathBezierPathElement:
|
||||
if (i != 0) {
|
||||
|
@ -25,36 +25,36 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <AppKit/NSView.h>
|
||||
|
||||
NSBitmapImageRepPropertyKey NSImageCompressionFactor =
|
||||
@"NSImageCompressionFactor";
|
||||
@"NSImageCompressionFactor";
|
||||
NSBitmapImageRepPropertyKey NSImageCompressionMethod =
|
||||
@"NSImageCompressionMethod";
|
||||
@"NSImageCompressionMethod";
|
||||
NSBitmapImageRepPropertyKey NSImageDitherTransparency =
|
||||
@"NSImageDitherTransparency";
|
||||
@"NSImageDitherTransparency";
|
||||
NSBitmapImageRepPropertyKey NSImageInterlaced = @"NSImageInterlaced";
|
||||
NSBitmapImageRepPropertyKey NSImageRGBColorTable = @"NSImageRGBColorTable";
|
||||
NSBitmapImageRepPropertyKey NSImageFrameCount = @"NSImageFrameCount";
|
||||
NSBitmapImageRepPropertyKey NSImageColorSyncProfileData =
|
||||
@"NSImageColorSyncProfileData";
|
||||
@"NSImageColorSyncProfileData";
|
||||
NSBitmapImageRepPropertyKey NSImageFallbackBackgroundColor =
|
||||
@"NSImageFallbackBackgroundColor";
|
||||
@"NSImageFallbackBackgroundColor";
|
||||
NSBitmapImageRepPropertyKey NSImageEXIFData = @"NSImageEXIFData";
|
||||
NSBitmapImageRepPropertyKey NSImageProgressive = @"NSImageProgressive";
|
||||
NSBitmapImageRepPropertyKey NSImageGamma = @"NSImageGamma";
|
||||
NSBitmapImageRepPropertyKey NSImageLoopCount = @"NSImageLoopCount";
|
||||
NSBitmapImageRepPropertyKey NSImageCurrentFrameDuration =
|
||||
@"NSImageCurrentFrameDuration";
|
||||
@"NSImageCurrentFrameDuration";
|
||||
NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
|
||||
@implementation NSBitmapImageRep
|
||||
|
||||
+ (NSArray *) imageUnfilteredFileTypes {
|
||||
return
|
||||
[NSArray arrayWithObjects:
|
||||
// Try to order them so the most used ones are at the top
|
||||
// of the list
|
||||
@"png", @"tiff", @"tif", @"jpg", @"jpeg", @"icns", @"gif",
|
||||
@"bmp", @"PNG", @"TIFF", @"TIF", @"JPG", @"JPEG", @"ICNS",
|
||||
@"jpe", @"JPE", @"GIF", @"BMP", nil];
|
||||
return [NSArray arrayWithObjects:
|
||||
// Try to order them so the most used ones are at
|
||||
// the top of the list
|
||||
@"png", @"tiff", @"tif", @"jpg", @"jpeg",
|
||||
@"icns", @"gif", @"bmp", @"PNG", @"TIFF",
|
||||
@"TIF", @"JPG", @"JPEG", @"ICNS", @"jpe",
|
||||
@"JPE", @"GIF", @"BMP", nil];
|
||||
}
|
||||
|
||||
+ (NSArray *) imageRepsWithContentsOfFile: (NSString *) path {
|
||||
@ -88,13 +88,13 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
|
||||
+ (NSData *) TIFFRepresentationOfImageRepsInArray: (NSArray *) array
|
||||
usingCompression:
|
||||
(NSTIFFCompression) compression
|
||||
(NSTIFFCompression) compression
|
||||
factor: (float) factor
|
||||
{
|
||||
NSMutableData *result = [NSMutableData data];
|
||||
CGImageDestinationRef dest = CGImageDestinationCreateWithData(
|
||||
(CFMutableDataRef) result, (CFStringRef) @"public.tiff", [array count],
|
||||
NULL);
|
||||
(CFMutableDataRef) result, (CFStringRef) @"public.tiff",
|
||||
[array count], NULL);
|
||||
|
||||
for (NSBitmapImageRep *bitmap in array) {
|
||||
CGImageDestinationAddImage(dest, [bitmap CGImage], NULL);
|
||||
@ -120,7 +120,7 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
|
||||
+ (BOOL) canInitWithData: (NSData *) data {
|
||||
CGImageSourceRef imageSource =
|
||||
CGImageSourceCreateWithData((CFDataRef) data, nil);
|
||||
CGImageSourceCreateWithData((CFDataRef) data, nil);
|
||||
BOOL result = (imageSource != NULL) ? YES : NO;
|
||||
CFRelease(imageSource);
|
||||
return result;
|
||||
@ -129,7 +129,7 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
+ (NSArray *) imageRepsWithData: (NSData *) data {
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
CGImageSourceRef imageSource =
|
||||
CGImageSourceCreateWithData((CFDataRef) data, nil);
|
||||
CGImageSourceCreateWithData((CFDataRef) data, nil);
|
||||
|
||||
if (imageSource == nil)
|
||||
return nil;
|
||||
@ -138,19 +138,17 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
CGImageRef cgImage =
|
||||
CGImageSourceCreateImageAtIndex(imageSource, i, nil);
|
||||
CGImageSourceCreateImageAtIndex(imageSource, i, nil);
|
||||
|
||||
if (cgImage == nil)
|
||||
break;
|
||||
|
||||
CFDictionaryRef properties =
|
||||
CGImageSourceCopyPropertiesAtIndex(imageSource, i, nil);
|
||||
NSNumber *xres =
|
||||
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIWidth)
|
||||
copy] autorelease];
|
||||
NSNumber *yres =
|
||||
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIHeight)
|
||||
copy] autorelease];
|
||||
CGImageSourceCopyPropertiesAtIndex(imageSource, i, nil);
|
||||
NSNumber *xres = [[(id) CFDictionaryGetValue(
|
||||
properties, kCGImagePropertyDPIWidth) copy] autorelease];
|
||||
NSNumber *yres = [[(id) CFDictionaryGetValue(
|
||||
properties, kCGImagePropertyDPIHeight) copy] autorelease];
|
||||
|
||||
CFRelease(properties);
|
||||
|
||||
@ -237,7 +235,7 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
_bitmapPlanes[i] = planes[i];
|
||||
else
|
||||
_bitmapPlanes[i] =
|
||||
NSZoneCalloc(NULL, _bytesPerRow * _pixelsHigh, 1);
|
||||
NSZoneCalloc(NULL, _bytesPerRow * _pixelsHigh, 1);
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -287,7 +285,7 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
|
||||
- initWithData: (NSData *) data {
|
||||
CGImageSourceRef imageSource =
|
||||
CGImageSourceCreateWithData((CFDataRef) data, nil);
|
||||
CGImageSourceCreateWithData((CFDataRef) data, nil);
|
||||
|
||||
if (imageSource == nil) {
|
||||
[self dealloc];
|
||||
@ -303,13 +301,13 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
}
|
||||
|
||||
CFDictionaryRef properties =
|
||||
CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil);
|
||||
CGImageSourceCopyPropertiesAtIndex(imageSource, 0, nil);
|
||||
NSNumber *xres =
|
||||
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIWidth) copy]
|
||||
autorelease];
|
||||
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIWidth)
|
||||
copy] autorelease];
|
||||
NSNumber *yres =
|
||||
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIHeight) copy]
|
||||
autorelease];
|
||||
[[(id) CFDictionaryGetValue(properties, kCGImagePropertyDPIHeight)
|
||||
copy] autorelease];
|
||||
|
||||
CFRelease(properties);
|
||||
CFRelease(imageSource);
|
||||
@ -530,7 +528,7 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
unsigned char *bits =
|
||||
_bitmapPlanes[0] + _bytesPerRow * y + (x * _bitsPerPixel) / 8;
|
||||
_bitmapPlanes[0] + _bytesPerRow * y + (x * _bitsPerPixel) / 8;
|
||||
|
||||
int i;
|
||||
|
||||
@ -585,7 +583,7 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
if (_bitmapFormat & NSFloatingPointSamplesBitmapFormat) {
|
||||
for (i = 0; i < numberOfComponents; i++) {
|
||||
((CGFloat *) pixels)[i] =
|
||||
MAX(0.0f, MIN(1.0f, components[i])); // clamp just in case
|
||||
MAX(0.0f, MIN(1.0f, components[i])); // clamp just in case
|
||||
}
|
||||
} else {
|
||||
int maxValue = (1 << [self bitsPerSample]) - 1;
|
||||
@ -593,12 +591,12 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
for (i = 0; i < numberOfComponents; i++) {
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
pixels[i] =
|
||||
MAX(0, MIN(maxValue,
|
||||
(int) (components[(numberOfComponents - 1) - i] *
|
||||
maxValue))); // clamp just in case
|
||||
MAX(0, MIN(maxValue,
|
||||
(int) (components[(numberOfComponents - 1) - i] *
|
||||
maxValue))); // clamp just in case
|
||||
#else
|
||||
pixels[i] =
|
||||
MAX(0, MIN(maxValue, (int) (components[i] *
|
||||
pixels[i] = MAX(
|
||||
0, MIN(maxValue, (int) (components[i] *
|
||||
maxValue))); // clamp just in case
|
||||
#endif
|
||||
}
|
||||
@ -689,15 +687,15 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
|
||||
if ([properties count]) {
|
||||
id compressionFactor =
|
||||
[properties valueForKey: NSImageCompressionFactor];
|
||||
[properties valueForKey: NSImageCompressionFactor];
|
||||
if (compressionFactor) {
|
||||
[CGProperties
|
||||
setValue: compressionFactor
|
||||
forKey: (id) kCGImageDestinationLossyCompressionQuality];
|
||||
setValue: compressionFactor
|
||||
forKey: (id) kCGImageDestinationLossyCompressionQuality];
|
||||
}
|
||||
}
|
||||
CGImageDestinationRef dest = CGImageDestinationCreateWithData(
|
||||
(CFMutableDataRef) result, uti, 1, (CFDictionaryRef) CGProperties);
|
||||
(CFMutableDataRef) result, uti, 1, (CFDictionaryRef) CGProperties);
|
||||
|
||||
CGImageDestinationAddImage(dest, [self CGImage],
|
||||
(CFDictionaryRef) CGProperties);
|
||||
@ -717,9 +715,10 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
factor: (float) factor
|
||||
{
|
||||
return [[self class]
|
||||
TIFFRepresentationOfImageRepsInArray: [NSArray arrayWithObject: self]
|
||||
usingCompression: compression
|
||||
factor: factor];
|
||||
TIFFRepresentationOfImageRepsInArray: [NSArray
|
||||
arrayWithObject: self]
|
||||
usingCompression: compression
|
||||
factor: factor];
|
||||
}
|
||||
|
||||
- (CGImageRef) createCGImageIfNeeded {
|
||||
@ -730,12 +729,12 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
NSUnimplementedMethod();
|
||||
|
||||
CGDataProviderRef provider = CGDataProviderCreateWithData(
|
||||
NULL, _bitmapPlanes[0], _bytesPerRow * _pixelsHigh, NULL);
|
||||
NULL, _bitmapPlanes[0], _bytesPerRow * _pixelsHigh, NULL);
|
||||
|
||||
CGImageRef image = CGImageCreate(
|
||||
_pixelsWide, _pixelsHigh, _bitsPerPixel / _samplesPerPixel,
|
||||
_bitsPerPixel, _bytesPerRow, [self CGColorSpace], [self CGBitmapInfo],
|
||||
provider, NULL, NO, kCGRenderingIntentDefault);
|
||||
_pixelsWide, _pixelsHigh, _bitsPerPixel / _samplesPerPixel,
|
||||
_bitsPerPixel, _bytesPerRow, [self CGColorSpace],
|
||||
[self CGBitmapInfo], provider, NULL, NO, kCGRenderingIntentDefault);
|
||||
|
||||
CGDataProviderRelease(provider);
|
||||
|
||||
@ -764,11 +763,11 @@ NSBitmapImageRepPropertyKey NSImageCurrentFrame = @"NSImageCurrentFrame";
|
||||
|
||||
- (CGColorSpaceRef) CGColorSpace {
|
||||
if ([_colorSpaceName isEqualToString: NSDeviceRGBColorSpace])
|
||||
return (
|
||||
CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB() autorelease];
|
||||
return (CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB()
|
||||
autorelease];
|
||||
if ([_colorSpaceName isEqualToString: NSCalibratedRGBColorSpace])
|
||||
return (
|
||||
CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB() autorelease];
|
||||
return (CGColorSpaceRef)[(id) CGColorSpaceCreateDeviceRGB()
|
||||
autorelease];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_isTransparent = [keyed decodeBoolForKey: @"NSFullyTransparent"];
|
||||
|
||||
[[_subviews lastObject]
|
||||
setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
[[_subviews lastObject] setAutoresizesSubviews: YES];
|
||||
|
||||
if (_boxType == NSBoxCustom) {
|
||||
@ -105,7 +105,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_titlePosition = NSAboveTop;
|
||||
|
||||
contentview = [[NSView alloc]
|
||||
initWithFrame: NSMakeRect(0, 0, NSWidth(frame), NSHeight(frame))];
|
||||
initWithFrame: NSMakeRect(0, 0, NSWidth(frame), NSHeight(frame))];
|
||||
[contentview setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
[self addSubview: contentview];
|
||||
[contentview release];
|
||||
@ -173,7 +173,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (void) setContentView: (NSView *) view {
|
||||
if (![[self subviews] containsObject: view]) {
|
||||
[[self subviews]
|
||||
makeObjectsPerformSelector: @selector(removeFromSuperview)];
|
||||
makeObjectsPerformSelector: @selector(removeFromSuperview)];
|
||||
// FIX, adjust size
|
||||
[self addSubview: view];
|
||||
}
|
||||
@ -201,7 +201,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (NSAttributedString *) _attributedTitle {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||
NSMutableParagraphStyle *paraStyle =
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
|
||||
autorelease];
|
||||
NSFont *font = [_titleCell font];
|
||||
|
||||
if (font != nil)
|
||||
@ -217,9 +218,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[attributes setObject: [NSColor windowBackgroundColor]
|
||||
forKey: NSBackgroundColorAttributeName];
|
||||
|
||||
return
|
||||
[[[NSAttributedString alloc] initWithString: [_titleCell stringValue]
|
||||
attributes: attributes] autorelease];
|
||||
return [[[NSAttributedString alloc] initWithString: [_titleCell stringValue]
|
||||
attributes: attributes]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
#define TEXTGAP 4
|
||||
@ -235,10 +236,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// result.size.width=ceil(size.width); // // NSTextField cell must be bugged
|
||||
// we get too low values for the width here
|
||||
result.size.width =
|
||||
bounds.size.width -
|
||||
result.origin
|
||||
.x; // use the whole width until the text field cell size is fixed
|
||||
result.size.width = bounds.size.width -
|
||||
result.origin.x; // use the whole width until the text
|
||||
// field cell size is fixed
|
||||
|
||||
switch (_titlePosition) {
|
||||
|
||||
|
@ -52,7 +52,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSKeyedUnarchiver *keyed = (NSKeyedUnarchiver *) coder;
|
||||
unsigned flags = [keyed decodeIntForKey: @"NSBrFlags"];
|
||||
NSString *firstTitle =
|
||||
[keyed decodeObjectForKey: @"NSFirstColumnTitle"];
|
||||
[keyed decodeObjectForKey: @"NSFirstColumnTitle"];
|
||||
|
||||
_explicitTitles = [NSMutableArray new];
|
||||
if (firstTitle != nil)
|
||||
@ -69,7 +69,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_cellPrototype = nil;
|
||||
|
||||
_numberOfVisibleColumns =
|
||||
[keyed decodeIntForKey: @"NSNumberOfVisibleColumns"];
|
||||
[keyed decodeIntForKey: @"NSNumberOfVisibleColumns"];
|
||||
_selectedColumn = -1;
|
||||
|
||||
_allowsMultipleSelection = (flags & 0x80000000) ? YES : NO;
|
||||
@ -299,9 +299,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
column -= [self firstVisibleColumn];
|
||||
|
||||
result.size.width =
|
||||
([self bounds].size.width - (_numberOfVisibleColumns - 1) * columnGap) /
|
||||
_numberOfVisibleColumns;
|
||||
result.size.width = ([self bounds].size.width -
|
||||
(_numberOfVisibleColumns - 1) * columnGap) /
|
||||
_numberOfVisibleColumns;
|
||||
result.size.height = [self titleHeight];
|
||||
result.origin.x = column * (result.size.width + columnGap);
|
||||
result.origin.y = [self bounds].size.height - result.size.height;
|
||||
@ -354,11 +354,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (void) setDelegate: delegate {
|
||||
// check delegate validity
|
||||
if (![delegate respondsToSelector: @selector(browser:
|
||||
createRowsForColumn:inMatrix:)])
|
||||
createRowsForColumn:inMatrix:)])
|
||||
if (![delegate respondsToSelector: @selector(browser:
|
||||
numberOfRowsInColumn:)] &&
|
||||
![delegate respondsToSelector: @selector(browser:
|
||||
willDisplayCell:atRow:column:)])
|
||||
numberOfRowsInColumn:)] &&
|
||||
![delegate respondsToSelector: @selector
|
||||
(browser:willDisplayCell:atRow:column:)])
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"-[NSBrowser setDelegate:] doesn't implement "
|
||||
@"delegate methods"];
|
||||
@ -396,7 +396,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
if (flag) {
|
||||
if (_horizontalScroller == nil) {
|
||||
_horizontalScroller =
|
||||
[[NSScroller alloc] initWithFrame: [self frameOfScroller]];
|
||||
[[NSScroller alloc] initWithFrame: [self frameOfScroller]];
|
||||
[_horizontalScroller setTarget: self];
|
||||
[_horizontalScroller setAction: @selector(scrollViaScroller:)];
|
||||
}
|
||||
@ -569,7 +569,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
while ([_matrices count] <= column) {
|
||||
NSRect frame = [self frameOfInsideOfColumn: column];
|
||||
NSMatrix *matrix =
|
||||
[[[_matrixClass alloc] initWithFrame: frame] autorelease];
|
||||
[[[_matrixClass alloc] initWithFrame: frame] autorelease];
|
||||
|
||||
[matrix setTarget: self];
|
||||
[matrix setAction: @selector(doClick:)];
|
||||
@ -600,14 +600,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (column >= [self firstVisibleColumn] &&
|
||||
column <= [self lastVisibleColumn]) {
|
||||
NSScrollView *scrollView =
|
||||
[_scrollViews objectAtIndex: column - [self firstVisibleColumn]];
|
||||
NSScrollView *scrollView = [_scrollViews
|
||||
objectAtIndex: column - [self firstVisibleColumn]];
|
||||
|
||||
[scrollView setDocumentView: [_matrices objectAtIndex: column]];
|
||||
[scrollView setLineScroll: [[_matrices objectAtIndex: column] cellSize]
|
||||
.height];
|
||||
[scrollView
|
||||
setLineScroll: [[_matrices objectAtIndex: column] cellSize].height];
|
||||
[scrollView
|
||||
setPageScroll: [[scrollView contentView] frame].size.height];
|
||||
setPageScroll: [[scrollView contentView] frame].size.height];
|
||||
}
|
||||
|
||||
[self updateScroller];
|
||||
@ -625,7 +625,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[matrix renewRows: 0 columns: 1];
|
||||
|
||||
if ([_delegate respondsToSelector: @selector(browser:
|
||||
createRowsForColumn:inMatrix:)])
|
||||
createRowsForColumn:inMatrix:)])
|
||||
[_delegate browser: self createRowsForColumn: column inMatrix: matrix];
|
||||
else {
|
||||
NSInteger nrows = [_delegate browser: self
|
||||
@ -636,9 +636,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
for (i = 0; i < nrows; i++) {
|
||||
[_delegate browser: self
|
||||
willDisplayCell: [matrix cellAtRow: i column: 0]
|
||||
atRow: i
|
||||
column: column];
|
||||
willDisplayCell: [matrix cellAtRow: i column: 0]
|
||||
atRow: i
|
||||
column: column];
|
||||
}
|
||||
}
|
||||
|
||||
@ -655,8 +655,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
title = [_delegate browser: self titleOfColumn: column];
|
||||
else if (_takesTitleFromPreviousColumn) {
|
||||
if (column > 0) {
|
||||
title =
|
||||
[[[self matrixInColumn: column - 1] selectedCell] stringValue];
|
||||
title = [[[self matrixInColumn: column - 1] selectedCell]
|
||||
stringValue];
|
||||
}
|
||||
}
|
||||
|
||||
@ -716,10 +716,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
for (i = _firstVisibleColumn;
|
||||
i <= [self lastVisibleColumn] && i < [_matrices count]; i++) {
|
||||
NSView *matrix =
|
||||
(i < [_matrices count]) ? [_matrices objectAtIndex: i] : nil;
|
||||
(i < [_matrices count]) ? [_matrices objectAtIndex: i] : nil;
|
||||
|
||||
[[_scrollViews objectAtIndex: scrollViewIndex++]
|
||||
setDocumentView: matrix];
|
||||
setDocumentView: matrix];
|
||||
}
|
||||
|
||||
[self updateScroller];
|
||||
@ -741,7 +741,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
scrollViewIndex = [_scrollViews count] - 1;
|
||||
for (i = [self lastVisibleColumn]; i >= _firstVisibleColumn; --i) {
|
||||
[[_scrollViews objectAtIndex: scrollViewIndex--]
|
||||
setDocumentView: [_matrices objectAtIndex: i]];
|
||||
setDocumentView: [_matrices objectAtIndex: i]];
|
||||
}
|
||||
|
||||
[self updateScroller];
|
||||
@ -794,7 +794,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
CGFloat val = (CGFloat) _firstVisibleColumn /
|
||||
(CGFloat)([_matrices count] - _numberOfVisibleColumns);
|
||||
CGFloat knobP =
|
||||
(CGFloat) _numberOfVisibleColumns / (CGFloat)[_matrices count];
|
||||
(CGFloat) _numberOfVisibleColumns / (CGFloat)[_matrices count];
|
||||
|
||||
[_horizontalScroller setFloatValue: val knobProportion: knobP];
|
||||
[_horizontalScroller setEnabled: YES];
|
||||
@ -820,7 +820,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSInteger column = _firstVisibleColumn + [_scrollViews count];
|
||||
NSRect frame = [self frameOfColumn: column];
|
||||
NSScrollView *view =
|
||||
[[[NSScrollView alloc] initWithFrame: frame] autorelease];
|
||||
[[[NSScrollView alloc] initWithFrame: frame] autorelease];
|
||||
|
||||
[view setBorderType: NSBezelBorder];
|
||||
[view setHasVerticalScroller: YES];
|
||||
@ -882,10 +882,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
if ([self hasHorizontalScroller])
|
||||
[[self graphicsStyle]
|
||||
drawBrowserHorizontalScrollerWellInRect: [self
|
||||
frameOfScrollerBorder]
|
||||
clipRect: rect];
|
||||
[[self graphicsStyle] drawBrowserHorizontalScrollerWellInRect:
|
||||
[self frameOfScrollerBorder]
|
||||
clipRect: rect];
|
||||
}
|
||||
|
||||
- (void) resizeSubviewsWithOldSize: (NSSize) oldSize {
|
||||
@ -951,9 +950,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (void) moveRight: sender {
|
||||
if (![[self selectedCell] isLeaf]) {
|
||||
[self
|
||||
selectRow: 0
|
||||
inColumn: _selectedColumn + 1]; // nb this changes _selectedColumn
|
||||
[self selectRow: 0
|
||||
inColumn: _selectedColumn +
|
||||
1]; // nb this changes _selectedColumn
|
||||
[self doClick: [self matrixInColumn: _selectedColumn]];
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +123,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSAttributedString *title = [self attributedStringValue];
|
||||
NSImage *branchImage = [self branchImage];
|
||||
NSSize branchImageSize =
|
||||
(branchImage == nil) ? NSMakeSize(0, 0) : [branchImage size];
|
||||
(branchImage == nil) ? NSMakeSize(0, 0) : [branchImage size];
|
||||
NSPoint branchImageOrigin = frame.origin;
|
||||
NSImage *image = [self image];
|
||||
NSSize imageSize = (image == nil) ? NSMakeSize(0, 0) : [image size];
|
||||
@ -133,9 +133,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
BOOL drawBranchImage = YES, drawTitle = YES, drawImage = YES;
|
||||
|
||||
branchImageOrigin.x =
|
||||
frame.origin.x + (frame.size.width - branchImageSize.width);
|
||||
frame.origin.x + (frame.size.width - branchImageSize.width);
|
||||
branchImageOrigin.y +=
|
||||
floor((frame.size.height - branchImageSize.height) / 2);
|
||||
floor((frame.size.height - branchImageSize.height) / 2);
|
||||
|
||||
imageOrigin.x = frame.origin.x;
|
||||
imageOrigin.y += floor((frame.size.height - imageSize.height) / 2);
|
||||
@ -151,10 +151,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/* check for length to avoid exception */
|
||||
if ([title length] > 0 &&
|
||||
[title attribute: NSForegroundColorAttributeName
|
||||
atIndex: 0
|
||||
effectiveRange: NULL] == nil) {
|
||||
atIndex: 0
|
||||
effectiveRange: NULL] == nil) {
|
||||
NSMutableAttributedString *change =
|
||||
[[title mutableCopy] autorelease];
|
||||
[[title mutableCopy] autorelease];
|
||||
|
||||
[change addAttribute: NSForegroundColorAttributeName
|
||||
value: [NSColor selectedControlTextColor]
|
||||
@ -174,12 +174,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (drawBranchImage) {
|
||||
[branchImage
|
||||
drawInRect: NSMakeRect(branchImageOrigin.x, branchImageOrigin.y,
|
||||
branchImageSize.width,
|
||||
branchImageSize.height)
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
drawInRect: NSMakeRect(branchImageOrigin.x, branchImageOrigin.y,
|
||||
branchImageSize.width,
|
||||
branchImageSize.height)
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
}
|
||||
|
||||
if (drawImage) {
|
||||
|
@ -284,10 +284,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
CGFloat size = [currentFont pointSize];
|
||||
|
||||
NSFont *newFont =
|
||||
[[NSFontManager sharedFontManager] fontWithFamily: familyName
|
||||
traits: 0
|
||||
weight: 5
|
||||
size: size];
|
||||
[[NSFontManager sharedFontManager] fontWithFamily: familyName
|
||||
traits: 0
|
||||
weight: 5
|
||||
size: size];
|
||||
if (newFont != nil) {
|
||||
[self setFont: newFont];
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ static const CGFloat kImageMargin = 2.;
|
||||
_highlightsBy |= NSChangeGrayCellMask;
|
||||
|
||||
_isBordered =
|
||||
(flags & 0x00800000) ? YES : NO; // err, this flag is in NSCell too
|
||||
(flags & 0x00800000) ? YES : NO; // err, this flag is in NSCell too
|
||||
|
||||
_bezelStyle = (flags2 & 0x7) | (flags2 & 0x20 >> 2);
|
||||
|
||||
@ -145,12 +145,12 @@ static const CGFloat kImageMargin = 2.;
|
||||
} else {
|
||||
if (([[[self image] name] isEqualToString: @"NSRadioButton"] &&
|
||||
[[[self alternateImage] name]
|
||||
isEqualToString: @"NSHighlightedRadioButton"]) &&
|
||||
isEqualToString: @"NSHighlightedRadioButton"]) &&
|
||||
(flags & 0x20000) == 0) {
|
||||
[self setButtonType: NSRadioButton];
|
||||
} else if (([[[self image] name] isEqualToString: @"NSSwitch"] &&
|
||||
[[[self alternateImage] name]
|
||||
isEqualToString: @"NSHighlightedSwitch"]) &&
|
||||
isEqualToString: @"NSHighlightedSwitch"]) &&
|
||||
(flags & 0x20000) == 0) {
|
||||
[self setButtonType: NSMomentaryPushInButton];
|
||||
}
|
||||
@ -169,9 +169,9 @@ static const CGFloat kImageMargin = 2.;
|
||||
id check;
|
||||
|
||||
_titleOrAttributedTitle =
|
||||
[[keyed decodeObjectForKey: @"NSContents"] retain];
|
||||
[[keyed decodeObjectForKey: @"NSContents"] retain];
|
||||
_alternateTitle =
|
||||
[[keyed decodeObjectForKey: @"NSAlternateContents"] retain];
|
||||
[[keyed decodeObjectForKey: @"NSAlternateContents"] retain];
|
||||
|
||||
[self _applyButtonCellAppleFlags: flags flags2: flags2];
|
||||
|
||||
@ -191,7 +191,7 @@ static const CGFloat kImageMargin = 2.;
|
||||
_normalImage = [_image retain];
|
||||
|
||||
_keyEquivalent =
|
||||
[[keyed decodeObjectForKey: @"NSKeyEquivalent"] retain];
|
||||
[[keyed decodeObjectForKey: @"NSKeyEquivalent"] retain];
|
||||
_keyEquivalentModifierMask = flags2 >> 8;
|
||||
[self setIntValue: _state]; // make the int value of NSButtonCell to be
|
||||
// in synch with the bare _state of NSCell
|
||||
@ -222,16 +222,16 @@ static const CGFloat kImageMargin = 2.;
|
||||
unichar keyEquivalent = inFlags2 >> 8;
|
||||
if (keyEquivalent != 0) {
|
||||
_keyEquivalent =
|
||||
[[NSString alloc] initWithCharacters: &keyEquivalent
|
||||
length: 1];
|
||||
[[NSString alloc] initWithCharacters: &keyEquivalent
|
||||
length: 1];
|
||||
}
|
||||
|
||||
if (altContents) {
|
||||
_alternateTitle =
|
||||
[[NSString alloc] initWithBytesNoCopy: altContents
|
||||
length: strlen(altContents)
|
||||
encoding: NSUTF8StringEncoding
|
||||
freeWhenDone: TRUE];
|
||||
_alternateTitle = [[NSString alloc]
|
||||
initWithBytesNoCopy: altContents
|
||||
length: strlen(altContents)
|
||||
encoding: NSUTF8StringEncoding
|
||||
freeWhenDone: TRUE];
|
||||
}
|
||||
|
||||
if (flags & 0x20000) {
|
||||
@ -366,13 +366,14 @@ static const CGFloat kImageMargin = 2.;
|
||||
|
||||
if (version <= 40) {
|
||||
if (([[self image]
|
||||
isEqual: [NSImage imageNamed: @"NSRadioButton"]] &&
|
||||
isEqual: [NSImage imageNamed: @"NSRadioButton"]] &&
|
||||
[[self alternateImage]
|
||||
isEqual: [NSImage
|
||||
imageNamed: @"NSHighlightedRadioButton"]]) ||
|
||||
isEqual: [NSImage imageNamed: @"NSHighlightedRadioButt"
|
||||
@"on"]]) ||
|
||||
([[self image] isEqual: [NSImage imageNamed: @"NSSwitch"]] &&
|
||||
[[self alternateImage]
|
||||
isEqual: [NSImage imageNamed: @"NSHighlightedSwitch"]])) {
|
||||
isEqual: [NSImage imageNamed:
|
||||
@"NSHighlightedSwitch"]])) {
|
||||
flags |= 0x1000;
|
||||
}
|
||||
}
|
||||
@ -384,7 +385,7 @@ static const CGFloat kImageMargin = 2.;
|
||||
if ([[self keyEquivalent] isEqualToString: @"\r"]) {
|
||||
if ([[[self image] name] isEqualToString: @"NSReturnSign"] ||
|
||||
[[[self alternateImage] name]
|
||||
isEqualToString: @"NXreturnSignH"]) {
|
||||
isEqualToString: @"NXreturnSignH"]) {
|
||||
[self setImage: nil];
|
||||
[self setAlternateImage: nil];
|
||||
flags &= 0xB70000;
|
||||
@ -500,13 +501,13 @@ static const CGFloat kImageMargin = 2.;
|
||||
// attributed string when title is nil
|
||||
return [[NSAttributedString alloc] initWithString: @""];
|
||||
} else if ([_titleOrAttributedTitle
|
||||
isKindOfClass: [NSAttributedString class]])
|
||||
isKindOfClass: [NSAttributedString class]])
|
||||
return _titleOrAttributedTitle;
|
||||
else {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||
NSMutableParagraphStyle *paraStyle =
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
|
||||
autorelease];
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
|
||||
autorelease];
|
||||
NSFont *font = [self font];
|
||||
|
||||
if (font != nil)
|
||||
@ -525,14 +526,15 @@ static const CGFloat kImageMargin = 2.;
|
||||
|
||||
return [[[NSAttributedString alloc] initWithString: [self title]
|
||||
attributes: attributes]
|
||||
autorelease];
|
||||
autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSAttributedString *) attributedAlternateTitle {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||
NSMutableParagraphStyle *paraStyle =
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
|
||||
autorelease];
|
||||
NSFont *font = [self font];
|
||||
|
||||
if (font != nil)
|
||||
@ -549,9 +551,9 @@ static const CGFloat kImageMargin = 2.;
|
||||
[attributes setObject: [NSColor disabledControlTextColor]
|
||||
forKey: NSForegroundColorAttributeName];
|
||||
|
||||
return
|
||||
[[[NSAttributedString alloc] initWithString: [self alternateTitle]
|
||||
attributes: attributes] autorelease];
|
||||
return [[[NSAttributedString alloc] initWithString: [self alternateTitle]
|
||||
attributes: attributes]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
- (int) highlightsBy {
|
||||
@ -763,8 +765,8 @@ static const CGFloat kImageMargin = 2.;
|
||||
_imagePosition = NSImageLeft;
|
||||
_imageDimsWhenDisabled = NO;
|
||||
[self setImage: [NSImage imageNamed: @"NSRadioButton"]];
|
||||
[self setAlternateImage: [NSImage
|
||||
imageNamed: @"NSHighlightedRadioButton"]];
|
||||
[self setAlternateImage:
|
||||
[NSImage imageNamed: @"NSHighlightedRadioButton"]];
|
||||
[self setAlignment: NSLeftTextAlignment];
|
||||
[self setBordered: NO];
|
||||
[self setBezeled: NO];
|
||||
@ -857,9 +859,9 @@ static const CGFloat kImageMargin = 2.;
|
||||
BOOL enabled = [self isEnabled] ? YES : ![self imageDimsWhenDisabled];
|
||||
BOOL mixed = [self state] == NSMixedState;
|
||||
imageSize =
|
||||
[[[self controlView] graphicsStyle] sizeOfButtonImage: image
|
||||
enabled: enabled
|
||||
mixed: mixed];
|
||||
[[[self controlView] graphicsStyle] sizeOfButtonImage: image
|
||||
enabled: enabled
|
||||
mixed: mixed];
|
||||
}
|
||||
return NSMakeRect(rect.origin.x, rect.origin.y, imageSize.width,
|
||||
imageSize.height);
|
||||
@ -932,7 +934,7 @@ static const CGFloat kImageMargin = 2.;
|
||||
frame.size.height = 10 - _controlSize * 2;
|
||||
frame.origin.x = 5 - _controlSize;
|
||||
frame.origin.y =
|
||||
flipped ? _controlSize * 2 - 3 : 7 - _controlSize * 2;
|
||||
flipped ? _controlSize * 2 - 3 : 7 - _controlSize * 2;
|
||||
break;
|
||||
|
||||
case NSMiniControlSize:
|
||||
@ -947,7 +949,7 @@ static const CGFloat kImageMargin = 2.;
|
||||
- (void) _drawTexturedBezelWithFrame: (NSRect) frame {
|
||||
BOOL highlighted = [self isHighlighted];
|
||||
BOOL pressed =
|
||||
[self state] && ([self showsStateBy] & NSChangeBackgroundCellMask);
|
||||
[self state] && ([self showsStateBy] & NSChangeBackgroundCellMask);
|
||||
|
||||
BOOL renderDarkenBg = NO, renderOutlineShadow = NO;
|
||||
// CGFloat topGray=0.76, bottomGray=0.98, strokeGray=0.4;
|
||||
@ -972,10 +974,11 @@ static const CGFloat kImageMargin = 2.;
|
||||
|
||||
const CGFloat baseY = floor(frame.origin.y);
|
||||
const CGFloat maxY = baseY + frame.size.height - 1.0;
|
||||
CGRect r =
|
||||
CGRectMake(floor(frame.origin.x), baseY, ceil(frame.size.width), 1.0);
|
||||
CGRect r = CGRectMake(floor(frame.origin.x), baseY, ceil(frame.size.width),
|
||||
1.0);
|
||||
while (r.origin.y <= maxY) {
|
||||
CGFloat g = bottomGray + (topGray - bottomGray) *
|
||||
CGFloat g =
|
||||
bottomGray + (topGray - bottomGray) *
|
||||
((r.origin.y - baseY) / (maxY - baseY));
|
||||
CGFloat components[4] = {g, g, g, 1.0};
|
||||
CGContextSetFillColor(ctx, components);
|
||||
@ -1060,7 +1063,7 @@ static void drawRoundedBezel(CGContextRef context, CGRect frame) {
|
||||
BOOL defaulted = ([[controlView window] defaultButtonCell] == self);
|
||||
|
||||
NSRect adjustment =
|
||||
[self getControlSizeAdjustment: [controlView isFlipped]];
|
||||
[self getControlSizeAdjustment: [controlView isFlipped]];
|
||||
frame.size.width -= adjustment.size.width;
|
||||
frame.size.height -= adjustment.size.height;
|
||||
frame.origin.x += adjustment.origin.x;
|
||||
@ -1107,7 +1110,7 @@ static void drawRoundedBezel(CGContextRef context, CGRect frame) {
|
||||
case NSRecessedBezelStyle:;
|
||||
if ([self isBordered] && [self isVisuallyHighlighted]) {
|
||||
CGContextRef context =
|
||||
[[NSGraphicsContext currentContext] graphicsPort];
|
||||
[[NSGraphicsContext currentContext] graphicsPort];
|
||||
|
||||
frame.size.height--;
|
||||
frame.origin.y += [controlView isFlipped] ? 1 : 0;
|
||||
@ -1130,20 +1133,20 @@ static void drawRoundedBezel(CGContextRef context, CGRect frame) {
|
||||
default:
|
||||
if (![self isBordered]) {
|
||||
[[_controlView graphicsStyle]
|
||||
drawUnborderedButtonInRect: frame
|
||||
defaulted: defaulted];
|
||||
drawUnborderedButtonInRect: frame
|
||||
defaulted: defaulted];
|
||||
} else {
|
||||
if (([self highlightsBy] & NSPushInCellMask) &&
|
||||
[self isHighlighted])
|
||||
[[_controlView graphicsStyle]
|
||||
drawPushButtonPressedInRect: frame];
|
||||
drawPushButtonPressedInRect: frame];
|
||||
else if ([self isVisuallyHighlighted])
|
||||
[[_controlView graphicsStyle]
|
||||
drawPushButtonHighlightedInRect: frame];
|
||||
drawPushButtonHighlightedInRect: frame];
|
||||
else
|
||||
[[_controlView graphicsStyle]
|
||||
drawPushButtonNormalInRect: frame
|
||||
defaulted: defaulted];
|
||||
drawPushButtonNormalInRect: frame
|
||||
defaulted: defaulted];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -1164,10 +1167,10 @@ static void drawRoundedBezel(CGContextRef context, CGRect frame) {
|
||||
CGContextScaleCTM(ctx, 1, -1);
|
||||
}
|
||||
[[controlView graphicsStyle]
|
||||
drawButtonImage: image
|
||||
inRect: NSMakeRect(0, 0, rect.size.width, rect.size.height)
|
||||
enabled: enabled
|
||||
mixed: mixed];
|
||||
drawButtonImage: image
|
||||
inRect: NSMakeRect(0, 0, rect.size.width, rect.size.height)
|
||||
enabled: enabled
|
||||
mixed: mixed];
|
||||
CGContextRestoreGState(ctx);
|
||||
}
|
||||
|
||||
@ -1243,7 +1246,7 @@ static NSSize scaledImageSizeInFrameSize(NSSize imageSize, NSSize frameSize,
|
||||
*/
|
||||
BOOL defaulted = ([[controlView window] defaultButtonCell] == self);
|
||||
NSRect adjustment =
|
||||
[self getControlSizeAdjustment: [controlView isFlipped]];
|
||||
[self getControlSizeAdjustment: [controlView isFlipped]];
|
||||
frame.size.width -= adjustment.size.width;
|
||||
frame.size.height -= adjustment.size.height;
|
||||
frame.origin.x += adjustment.origin.x;
|
||||
@ -1278,8 +1281,8 @@ static NSSize scaledImageSizeInFrameSize(NSSize imageSize, NSSize frameSize,
|
||||
if ([self bezelStyle] == NSDisclosureBezelStyle)
|
||||
imagePosition = NSImageOnly;
|
||||
|
||||
imageSize =
|
||||
scaledImageSizeInFrameSize(imageSize, frame.size, [self imageScaling]);
|
||||
imageSize = scaledImageSizeInFrameSize(imageSize, frame.size,
|
||||
[self imageScaling]);
|
||||
|
||||
imageOrigin.x += floor((frame.size.width - imageSize.width) / 2);
|
||||
imageOrigin.y += floor((frame.size.height - imageSize.height) / 2);
|
||||
@ -1314,16 +1317,16 @@ static NSSize scaledImageSizeInFrameSize(NSSize imageSize, NSSize frameSize,
|
||||
titleRect.origin.y += imageSize.height;
|
||||
imageOrigin.y = MAX(frame.origin.y, imageOrigin.y);
|
||||
titleRect.origin.y =
|
||||
MIN(frame.origin.y + frame.size.height - titleRect.size.height,
|
||||
titleRect.origin.y);
|
||||
MIN(frame.origin.y + frame.size.height - titleRect.size.height,
|
||||
titleRect.origin.y);
|
||||
break;
|
||||
|
||||
case NSImageAbove:
|
||||
imageOrigin.y = frame.origin.y + (frame.size.height - imageSize.height);
|
||||
titleRect.origin.y -= imageSize.height;
|
||||
imageOrigin.y =
|
||||
MIN(frame.origin.y + frame.size.height - imageSize.height,
|
||||
imageOrigin.y);
|
||||
MIN(frame.origin.y + frame.size.height - imageSize.height,
|
||||
imageOrigin.y);
|
||||
titleRect.origin.y = MAX(frame.origin.y, titleRect.origin.y);
|
||||
break;
|
||||
|
||||
@ -1368,29 +1371,29 @@ static NSSize scaledImageSizeInFrameSize(NSSize imageSize, NSSize frameSize,
|
||||
const CGFloat shadowAlpha = ([self isHighlighted]) ? 0.15 : 0.25;
|
||||
NSString *baseTitle = [NSString stringWithString: [title string]];
|
||||
NSMutableDictionary *shadowAttrs =
|
||||
[[[title attributesAtIndex: 0
|
||||
effectiveRange: NULL] mutableCopy] autorelease];
|
||||
[[[title attributesAtIndex: 0
|
||||
effectiveRange: NULL] mutableCopy] autorelease];
|
||||
|
||||
if (titleRect.origin.y >
|
||||
frame.origin.y + 1) { // only draw the shadow if it doesn't come
|
||||
// too close to the edge
|
||||
[shadowAttrs
|
||||
setObject: [NSColor colorWithDeviceRed: shadowGray
|
||||
green: shadowGray
|
||||
blue: shadowGray
|
||||
alpha: shadowAlpha]
|
||||
forKey: NSForegroundColorAttributeName];
|
||||
setObject: [NSColor colorWithDeviceRed: shadowGray
|
||||
green: shadowGray
|
||||
blue: shadowGray
|
||||
alpha: shadowAlpha]
|
||||
forKey: NSForegroundColorAttributeName];
|
||||
|
||||
NSAttributedString *shadowTitle = [[[NSAttributedString alloc]
|
||||
initWithString: baseTitle
|
||||
attributes: shadowAttrs] autorelease];
|
||||
initWithString: baseTitle
|
||||
attributes: shadowAttrs] autorelease];
|
||||
NSRect shadowRect = NSOffsetRect(titleRect, 0, 1);
|
||||
|
||||
[shadowTitle _clipAndDrawInRect: shadowRect];
|
||||
}
|
||||
|
||||
NSMutableDictionary *fgAttrs =
|
||||
[[shadowAttrs mutableCopy] autorelease];
|
||||
[[shadowAttrs mutableCopy] autorelease];
|
||||
if ([self isEnabled])
|
||||
[fgAttrs setObject: [NSColor colorWithDeviceRed: fgGray
|
||||
green: fgGray
|
||||
@ -1405,7 +1408,7 @@ static NSSize scaledImageSizeInFrameSize(NSSize imageSize, NSSize frameSize,
|
||||
forKey: NSForegroundColorAttributeName];
|
||||
title = [[[NSAttributedString alloc] initWithString: baseTitle
|
||||
attributes: fgAttrs]
|
||||
autorelease];
|
||||
autorelease];
|
||||
}
|
||||
|
||||
[self drawTitle: title withFrame: titleRect inView: controlView];
|
||||
|
@ -46,15 +46,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
// in them.
|
||||
NSWindowStyleMask styleMask = NSBorderlessWindowMask;
|
||||
if ([[NSUserDefaults standardUserDefaults]
|
||||
boolForKey: @"NSShowAllWindows"] == NO) {
|
||||
boolForKey: @"NSShowAllWindows"] == NO) {
|
||||
styleMask |= NSAppKitPrivateWindow;
|
||||
}
|
||||
NSRect rect = {NSZeroPoint, size};
|
||||
NSWindow *window =
|
||||
[[NSWindow alloc] initWithContentRect: rect
|
||||
styleMask: styleMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
[[NSWindow alloc] initWithContentRect: rect
|
||||
styleMask: styleMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
|
||||
NSDictionary *entries = @{@"CGContext" : @"Onyx"};
|
||||
[[window platformWindow] addEntriesToDeviceDictionary: entries];
|
||||
@ -78,16 +78,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (BOOL) drawAtPoint: (NSPoint) point {
|
||||
NSRect rect = {point, _size};
|
||||
CGImageRef imageRef =
|
||||
CGBitmapContextCreateImage([[_window graphicsContext] graphicsPort]);
|
||||
CGImageRef imageRef = CGBitmapContextCreateImage(
|
||||
[[_window graphicsContext] graphicsPort]);
|
||||
CGContextDrawImage(NSCurrentGraphicsPort(), rect, imageRef);
|
||||
CGImageRelease(imageRef);
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL) drawInRect: (NSRect) rect {
|
||||
CGImageRef imageRef =
|
||||
CGBitmapContextCreateImage([[_window graphicsContext] graphicsPort]);
|
||||
CGImageRef imageRef = CGBitmapContextCreateImage(
|
||||
[[_window graphicsContext] graphicsPort]);
|
||||
CGContextDrawImage(NSCurrentGraphicsPort(), rect, imageRef);
|
||||
CGImageRelease(imageRef);
|
||||
return YES;
|
||||
|
@ -347,8 +347,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (BOOL) wraps {
|
||||
return (_lineBreakMode == NSLineBreakByWordWrapping ||
|
||||
_lineBreakMode == NSLineBreakByCharWrapping)
|
||||
? YES
|
||||
: NO;
|
||||
? YES
|
||||
: NO;
|
||||
}
|
||||
|
||||
- (NSString *) title {
|
||||
@ -432,9 +432,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (int) intValue {
|
||||
NSString *objString =
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
if ([objString isKindOfClass: [NSString class]]) {
|
||||
int i = 0;
|
||||
[[NSScanner localizedScannerWithString: objString] scanInt: &i];
|
||||
@ -450,9 +450,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
return 0.f;
|
||||
}
|
||||
NSString *objString =
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
if ([objString isKindOfClass: [NSString class]]) {
|
||||
float f = 0.0;
|
||||
[[NSScanner localizedScannerWithString: objString] scanFloat: &f];
|
||||
@ -470,9 +470,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
NSString *objString =
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
if ([objString isKindOfClass: [NSString class]]) {
|
||||
double d = 0.0;
|
||||
[[NSScanner localizedScannerWithString: objString] scanDouble: &d];
|
||||
@ -483,9 +483,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (NSInteger) integerValue {
|
||||
NSString *objString =
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
([_objectValue isKindOfClass: [NSAttributedString class]])
|
||||
? [_objectValue string]
|
||||
: (NSString *) _objectValue;
|
||||
if ([objString isKindOfClass: [NSString class]]) {
|
||||
NSInteger i = 0;
|
||||
[[NSScanner localizedScannerWithString: objString] scanInteger: &i];
|
||||
@ -500,8 +500,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
else {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||
NSMutableParagraphStyle *paraStyle =
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
|
||||
autorelease];
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
|
||||
autorelease];
|
||||
NSFont *font = [self font];
|
||||
|
||||
if (font != nil)
|
||||
@ -525,7 +525,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
return [[[NSAttributedString alloc] initWithString: [self stringValue]
|
||||
attributes: attributes]
|
||||
autorelease];
|
||||
autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
@ -558,7 +558,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[self setFont: [NSFont systemFontOfSize: 12.0]];
|
||||
}
|
||||
[[[self controlView] window]
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -596,20 +596,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (void) setTarget: target {
|
||||
[NSException
|
||||
raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %s] Unimplemented", [self class], sel_getName(_cmd)];
|
||||
raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %s] Unimplemented", [self class], sel_getName(_cmd)];
|
||||
}
|
||||
|
||||
- (void) setAction: (SEL) action {
|
||||
[NSException
|
||||
raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %s] Unimplemented", [self class], sel_getName(_cmd)];
|
||||
raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %s] Unimplemented", [self class], sel_getName(_cmd)];
|
||||
}
|
||||
|
||||
- (void) setTag: (NSInteger) tag {
|
||||
[NSException
|
||||
raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %s] Unimplemented", [self class], sel_getName(_cmd)];
|
||||
raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %s] Unimplemented", [self class], sel_getName(_cmd)];
|
||||
}
|
||||
|
||||
- (void) setEntryType: (NSInteger) type {
|
||||
@ -672,7 +672,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
if (_isEnabled != flag) {
|
||||
_isEnabled = flag;
|
||||
[[[self controlView] window]
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -680,7 +680,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
if (_isEditable != flag) {
|
||||
_isEditable = flag;
|
||||
[[[self controlView] window]
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -688,7 +688,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
if (_isSelectable != flag) {
|
||||
_isSelectable = flag;
|
||||
[[[self controlView] window]
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
invalidateCursorRectsForView: [self controlView]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -764,9 +764,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (void) setStringValue: (NSString *) value {
|
||||
if (value == nil) {
|
||||
[NSException
|
||||
raise: NSInvalidArgumentException
|
||||
format: @"-[%@ %s] value==nil", [self class], sel_getName(_cmd)];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"-[%@ %s] value==nil", [self class],
|
||||
sel_getName(_cmd)];
|
||||
return;
|
||||
}
|
||||
|
||||
@ -922,9 +922,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (BOOL) trackMouse: (NSEvent *) event
|
||||
inRect: (NSRect) frame
|
||||
ofView: (NSView *) view
|
||||
untilMouseUp: (BOOL) untilMouseUp
|
||||
inRect: (NSRect) frame
|
||||
ofView: (NSView *) view
|
||||
untilMouseUp: (BOOL) untilMouseUp
|
||||
{
|
||||
NSPoint lastPoint;
|
||||
BOOL result = NO;
|
||||
@ -940,7 +940,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
currentPoint = [view convertPoint: [event locationInWindow]
|
||||
fromView: nil];
|
||||
isWithinCellFrame =
|
||||
NSMouseInRect(currentPoint, frame, [view isFlipped]);
|
||||
NSMouseInRect(currentPoint, frame, [view isFlipped]);
|
||||
|
||||
if (untilMouseUp) {
|
||||
if ([event type] == NSLeftMouseUp) {
|
||||
@ -982,8 +982,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
[[view window] flushWindow];
|
||||
|
||||
event = [[view window]
|
||||
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
|
||||
event = [[view window] nextEventMatchingMask: NSLeftMouseUpMask |
|
||||
NSLeftMouseDraggedMask];
|
||||
|
||||
} while (YES);
|
||||
|
||||
@ -1010,7 +1010,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
(drawsBackground)]];
|
||||
if ([self respondsToSelector: @selector(backgroundColor)])
|
||||
[editor setBackgroundColor: [self performSelector: @selector
|
||||
(backgroundColor)]];
|
||||
(backgroundColor)]];
|
||||
|
||||
return editor;
|
||||
}
|
||||
@ -1040,7 +1040,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
[clipView
|
||||
setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||
[editor setAutoresizingMask: 0];
|
||||
[editor setHorizontallyResizable: [self isScrollable]];
|
||||
[editor setVerticallyResizable: YES];
|
||||
@ -1149,9 +1149,10 @@ static NSString *NSStringFromCellType(NSCellType type) {
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat: @"%@\n\ttype: %@\n\tfont: %@\n\tobjectValue: %@",
|
||||
[super description], NSStringFromCellType(_cellType),
|
||||
_font, _objectValue];
|
||||
stringWithFormat: @"%@\n\ttype: %@\n\tfont: %@\n\tobjectValue: %@",
|
||||
[super description],
|
||||
NSStringFromCellType(_cellType), _font,
|
||||
_objectValue];
|
||||
}
|
||||
@end
|
||||
|
||||
|
@ -45,15 +45,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (_docView != nil)
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(viewFrameChanged:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: _docView];
|
||||
addObserver: self
|
||||
selector: @selector(viewFrameChanged:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: _docView];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(viewBoundsChanged:)
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: _docView];
|
||||
addObserver: self
|
||||
selector: @selector(viewBoundsChanged:)
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: _docView];
|
||||
} else {
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"-[%@ %s] is not implemented for coder %@",
|
||||
@ -121,13 +121,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (void) setDocumentView: (NSView *) view {
|
||||
if (_docView != nil) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: _docView];
|
||||
removeObserver: self
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: _docView];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: _docView];
|
||||
removeObserver: self
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: _docView];
|
||||
}
|
||||
|
||||
[_docView removeFromSuperview];
|
||||
@ -140,15 +140,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (_docView != nil) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(viewFrameChanged:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: _docView];
|
||||
addObserver: self
|
||||
selector: @selector(viewFrameChanged:)
|
||||
name: NSViewFrameDidChangeNotification
|
||||
object: _docView];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(viewBoundsChanged:)
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: _docView];
|
||||
addObserver: self
|
||||
selector: @selector(viewBoundsChanged:)
|
||||
name: NSViewBoundsDidChangeNotification
|
||||
object: _docView];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,8 +58,8 @@ enum {
|
||||
|
||||
if (*name)
|
||||
colorName =
|
||||
[NSString stringWithCString: name
|
||||
encoding: NSMacOSRomanStringEncoding];
|
||||
[NSString stringWithCString: name
|
||||
encoding: NSMacOSRomanStringEncoding];
|
||||
|
||||
NSString *catalogs[2] = {@"PANTONE", nil};
|
||||
NSString *palette = nil;
|
||||
@ -81,8 +81,8 @@ enum {
|
||||
palette = catalogs[0];
|
||||
} else
|
||||
palette = [NSString
|
||||
stringWithCString: bufPalette
|
||||
encoding: NSMacOSRomanStringEncoding];
|
||||
stringWithCString: bufPalette
|
||||
encoding: NSMacOSRomanStringEncoding];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,6 @@
|
||||
#import <AppKit/NSCollectionViewFlowLayout.h>
|
||||
|
||||
NSString *const NSCollectionElementKindSectionHeader =
|
||||
@"UICollectionElementKindSectionHeader";
|
||||
@"UICollectionElementKindSectionHeader";
|
||||
NSString *const NSCollectionElementKindSectionFooter =
|
||||
@"UICollectionElementKindSectionFooter";
|
||||
@"UICollectionElementKindSectionFooter";
|
||||
|
@ -20,5 +20,5 @@
|
||||
#import <AppKit/NSCollectionViewLayout.h>
|
||||
|
||||
NSCollectionViewSupplementaryElementKind const
|
||||
NSCollectionElementKindInterItemGapIndicator =
|
||||
@"NSCollectionElementKindInterItemGapIndicator";
|
||||
NSCollectionElementKindInterItemGapIndicator =
|
||||
@"NSCollectionElementKindInterItemGapIndicator";
|
||||
|
@ -52,7 +52,7 @@ static int NSColor_ignoresAlpha = -1;
|
||||
[self getRed: &r green: &g blue: &b alpha: &a];
|
||||
[coder encodeInt: 1 forKey: @"NSColorSpace"];
|
||||
NSString *string =
|
||||
[NSString stringWithFormat: @"%f %f %f %f", r, g, b, a];
|
||||
[NSString stringWithFormat: @"%f %f %f %f", r, g, b, a];
|
||||
NSData *data = [string dataUsingEncoding: NSASCIIStringEncoding];
|
||||
[coder encodeBytes: [data bytes]
|
||||
length: [data length]
|
||||
@ -63,7 +63,7 @@ static int NSColor_ignoresAlpha = -1;
|
||||
[self getRed: &r green: &g blue: &b alpha: &a];
|
||||
[coder encodeInt: 2 forKey: @"NSColorSpace"];
|
||||
NSString *string =
|
||||
[NSString stringWithFormat: @"%f %f %f %f", r, g, b, a];
|
||||
[NSString stringWithFormat: @"%f %f %f %f", r, g, b, a];
|
||||
NSData *data = [string dataUsingEncoding: NSASCIIStringEncoding];
|
||||
[coder encodeBytes: [data bytes]
|
||||
length: [data length]
|
||||
@ -93,8 +93,8 @@ static int NSColor_ignoresAlpha = -1;
|
||||
|
||||
[self getCyan: &c magenta: &m yellow: &y black: &k alpha: &a];
|
||||
[coder encodeInt: 5 forKey: @"NSColorSpace"];
|
||||
NSString *string =
|
||||
[NSString stringWithFormat: @"%f %f %f %f %f", c, m, y, k, a];
|
||||
NSString *string = [NSString
|
||||
stringWithFormat: @"%f %f %f %f %f", c, m, y, k, a];
|
||||
NSData *data = [string dataUsingEncoding: NSASCIIStringEncoding];
|
||||
[coder encodeBytes: [data bytes]
|
||||
length: [data length]
|
||||
@ -142,9 +142,9 @@ static int NSColor_ignoresAlpha = -1;
|
||||
const uint8_t *rgb = [keyed decodeBytesForKey: @"NSRGB"
|
||||
returnedLength: &length];
|
||||
NSString *string = [[[NSString alloc]
|
||||
initWithBytes: rgb
|
||||
length: length
|
||||
encoding: NSUTF8StringEncoding] autorelease];
|
||||
initWithBytes: rgb
|
||||
length: length
|
||||
encoding: NSUTF8StringEncoding] autorelease];
|
||||
NSArray *components = [string componentsSeparatedByString: @" "];
|
||||
int count = [components count];
|
||||
|
||||
@ -181,9 +181,9 @@ static int NSColor_ignoresAlpha = -1;
|
||||
const uint8_t *white = [keyed decodeBytesForKey: @"NSWhite"
|
||||
returnedLength: &length];
|
||||
NSString *string = [[[NSString alloc]
|
||||
initWithBytes: white
|
||||
length: length
|
||||
encoding: NSUTF8StringEncoding] autorelease];
|
||||
initWithBytes: white
|
||||
length: length
|
||||
encoding: NSUTF8StringEncoding] autorelease];
|
||||
NSArray *components = [string componentsSeparatedByString: @" "];
|
||||
int count = [components count];
|
||||
|
||||
@ -215,9 +215,9 @@ static int NSColor_ignoresAlpha = -1;
|
||||
const uint8_t *cmyk = [keyed decodeBytesForKey: @"NSCMYK"
|
||||
returnedLength: &length];
|
||||
NSString *string = [[[NSString alloc]
|
||||
initWithBytes: cmyk
|
||||
length: length - 1
|
||||
encoding: NSUTF8StringEncoding] autorelease];
|
||||
initWithBytes: cmyk
|
||||
length: length - 1
|
||||
encoding: NSUTF8StringEncoding] autorelease];
|
||||
NSArray *components = [string componentsSeparatedByString: @" "];
|
||||
int count = [components count];
|
||||
|
||||
@ -633,8 +633,8 @@ static void drawPattern(void *info, CGContextRef cgContext) {
|
||||
NSImage *image = (NSImage *) info;
|
||||
NSSize size = [image size];
|
||||
NSGraphicsContext *context =
|
||||
[NSGraphicsContext graphicsContextWithGraphicsPort: cgContext
|
||||
flipped: NO];
|
||||
[NSGraphicsContext graphicsContextWithGraphicsPort: cgContext
|
||||
flipped: NO];
|
||||
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
[NSGraphicsContext setCurrentContext: context];
|
||||
@ -654,17 +654,17 @@ static void releasePatternInfo(void *info) {
|
||||
CGPatternCallbacks callbacks = {0, drawPattern, releasePatternInfo};
|
||||
[image retain];
|
||||
CGPatternRef pattern =
|
||||
CGPatternCreate(image, CGRectMake(0, 0, size.width, size.height),
|
||||
CGAffineTransformIdentity, size.width, size.height,
|
||||
kCGPatternTilingNoDistortion, YES, &callbacks);
|
||||
CGPatternCreate(image, CGRectMake(0, 0, size.width, size.height),
|
||||
CGAffineTransformIdentity, size.width, size.height,
|
||||
kCGPatternTilingNoDistortion, YES, &callbacks);
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGFloat components[4] = {1, 1, 1, 1};
|
||||
CGColorRef cgColor =
|
||||
CGColorCreateWithPattern(colorSpace, pattern, components);
|
||||
CGColorCreateWithPattern(colorSpace, pattern, components);
|
||||
|
||||
NSColor *result = [[[NSColor_CGColor alloc]
|
||||
initWithColorRef: cgColor
|
||||
spaceName: NSPatternColorSpace] autorelease];
|
||||
initWithColorRef: cgColor
|
||||
spaceName: NSPatternColorSpace] autorelease];
|
||||
|
||||
CGColorRelease(cgColor);
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
@ -700,9 +700,9 @@ static void releasePatternInfo(void *info) {
|
||||
}
|
||||
|
||||
- (void) getHue: (CGFloat *) hue
|
||||
saturation: (CGFloat *) saturation
|
||||
brightness: (CGFloat *) brightness
|
||||
alpha: (CGFloat *) alpha
|
||||
saturation: (CGFloat *) saturation
|
||||
brightness: (CGFloat *) brightness
|
||||
alpha: (CGFloat *) alpha
|
||||
{
|
||||
NSInvalidAbstractInvocation();
|
||||
}
|
||||
@ -828,9 +828,9 @@ static void releasePatternInfo(void *info) {
|
||||
ofColor: (NSColor *) color
|
||||
{
|
||||
NSColor *primary =
|
||||
[color colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
[color colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
NSColor *secondary =
|
||||
[self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
[self colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
|
||||
if (primary == nil || secondary == nil)
|
||||
return nil;
|
||||
@ -899,10 +899,11 @@ static void releasePatternInfo(void *info) {
|
||||
@synchronized(self) {
|
||||
if (NSColor_ignoresAlpha == -1)
|
||||
NSColor_ignoresAlpha =
|
||||
[[[NSUserDefaults standardUserDefaults]
|
||||
objectForKey: @"NSIgnoreAlpha"]
|
||||
compare: @"NO"
|
||||
options: NSCaseInsensitiveSearch] != NSOrderedSame;
|
||||
[[[NSUserDefaults standardUserDefaults]
|
||||
objectForKey: @"NSIgnoreAlpha"]
|
||||
compare: @"NO"
|
||||
options: NSCaseInsensitiveSearch] !=
|
||||
NSOrderedSame;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat: @"<%@ colorRef=%@>", [self class], _colorRef];
|
||||
stringWithFormat: @"<%@ colorRef=%@>", [self class], _colorRef];
|
||||
}
|
||||
|
||||
- (NSInteger) numberOfComponents {
|
||||
@ -159,9 +159,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (NSColor *) colorWithAlphaComponent: (CGFloat) alpha {
|
||||
CGColorRef ref = CGColorCreateCopyWithAlpha(_colorRef, alpha);
|
||||
NSColor *result =
|
||||
[[[[self class] alloc] initWithColorRef: ref
|
||||
spaceName: _colorSpaceName] autorelease];
|
||||
NSColor *result = [[[[self class] alloc] initWithColorRef: ref
|
||||
spaceName: _colorSpaceName]
|
||||
autorelease];
|
||||
|
||||
CGColorRelease(ref);
|
||||
return result;
|
||||
@ -219,9 +219,9 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
|
||||
CGFloat alpha = components[3];
|
||||
|
||||
if ([otherSpaceName isEqualToString: NSDeviceWhiteColorSpace])
|
||||
return [NSColor
|
||||
colorWithDeviceWhite: calibratedWhiteFromRGB(red, green, blue)
|
||||
alpha: alpha];
|
||||
return [NSColor colorWithDeviceWhite: calibratedWhiteFromRGB(
|
||||
red, green, blue)
|
||||
alpha: alpha];
|
||||
|
||||
if ([otherSpaceName isEqualToString: NSDeviceCMYKColorSpace])
|
||||
return [NSColor colorWithDeviceCyan: 1.0 - red
|
||||
@ -238,7 +238,7 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
|
||||
|
||||
if ([otherSpaceName isEqualToString: NSCalibratedWhiteColorSpace])
|
||||
return [NSColor colorWithCalibratedWhite: calibratedWhiteFromRGB(
|
||||
red, green, blue)
|
||||
red, green, blue)
|
||||
alpha: alpha];
|
||||
} else if ([_colorSpaceName isEqualToString: NSDeviceCMYKColorSpace]) {
|
||||
CGFloat cyan = components[0];
|
||||
@ -296,9 +296,9 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
|
||||
CGFloat alpha = components[3];
|
||||
|
||||
if ([otherSpaceName isEqualToString: NSDeviceWhiteColorSpace])
|
||||
return [NSColor
|
||||
colorWithDeviceWhite: calibratedWhiteFromRGB(red, green, blue)
|
||||
alpha: alpha];
|
||||
return [NSColor colorWithDeviceWhite: calibratedWhiteFromRGB(
|
||||
red, green, blue)
|
||||
alpha: alpha];
|
||||
|
||||
if ([otherSpaceName isEqualToString: NSDeviceCMYKColorSpace])
|
||||
return [NSColor colorWithDeviceCyan: 1.0 - red
|
||||
@ -309,7 +309,7 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
|
||||
|
||||
if ([otherSpaceName isEqualToString: NSCalibratedWhiteColorSpace])
|
||||
return [NSColor colorWithCalibratedWhite: calibratedWhiteFromRGB(
|
||||
red, green, blue)
|
||||
red, green, blue)
|
||||
alpha: alpha];
|
||||
|
||||
if ([otherSpaceName isEqualToString: NSDeviceRGBColorSpace])
|
||||
@ -381,9 +381,9 @@ static inline CGFloat calibratedWhiteFromRGB(CGFloat r, CGFloat g, CGFloat b) {
|
||||
}
|
||||
|
||||
- (void) getHue: (CGFloat *) huep
|
||||
saturation: (CGFloat *) saturationp
|
||||
brightness: (CGFloat *) brightnessp
|
||||
alpha: (CGFloat *) alphap
|
||||
saturation: (CGFloat *) saturationp
|
||||
brightness: (CGFloat *) brightnessp
|
||||
alpha: (CGFloat *) alphap
|
||||
{
|
||||
CGColorSpaceRef colorSpace = CGColorGetColorSpace(_colorRef);
|
||||
CGColorSpaceModel model = CGColorSpaceGetModel(colorSpace);
|
||||
|
@ -110,8 +110,8 @@ NSColor *NSColorGetCatalogColor(NSString *catalogName, NSString *colorName);
|
||||
return self;
|
||||
|
||||
result = [NSColorGetCatalogColor(_catalogName, _colorName)
|
||||
colorUsingColorSpaceName: colorSpace
|
||||
device: device];
|
||||
colorUsingColorSpaceName: colorSpace
|
||||
device: device];
|
||||
|
||||
if (result == nil)
|
||||
NSLog(@"result ==nil %@ %@", _colorName, colorSpace);
|
||||
|
@ -21,7 +21,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <AppKit/NSRaise.h>
|
||||
|
||||
NSString *const NSColorListDidChangeNotification =
|
||||
@"NSColorListDidChangeNotification";
|
||||
@"NSColorListDidChangeNotification";
|
||||
|
||||
@implementation NSColorList
|
||||
|
||||
@ -175,11 +175,11 @@ static NSMutableDictionary *_namedColorLists = nil;
|
||||
{nil, 0x0}};
|
||||
|
||||
NSColorList *basicColorList =
|
||||
[[[NSColorList alloc] initWithName: @"Basic"] autorelease];
|
||||
[[[NSColorList alloc] initWithName: @"Basic"] autorelease];
|
||||
NSColorList *systemColorList =
|
||||
[[[NSColorList alloc] initWithName: @"System"] autorelease];
|
||||
[[[NSColorList alloc] initWithName: @"System"] autorelease];
|
||||
NSColorList *webColorList =
|
||||
[[[NSColorList alloc] initWithName: @"Web"] autorelease];
|
||||
[[[NSColorList alloc] initWithName: @"Web"] autorelease];
|
||||
int i;
|
||||
|
||||
for (i = 0; webColors[i].name != nil; i++) {
|
||||
@ -356,8 +356,8 @@ static NSMutableDictionary *_namedColorLists = nil;
|
||||
}
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSColorListDidChangeNotification
|
||||
object: self];
|
||||
postNotificationName: NSColorListDidChangeNotification
|
||||
object: self];
|
||||
}
|
||||
|
||||
- (void) removeColorWithKey: (NSString *) key {
|
||||
@ -368,8 +368,8 @@ static NSMutableDictionary *_namedColorLists = nil;
|
||||
[_keys removeObjectAtIndex: index];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSColorListDidChangeNotification
|
||||
object: self];
|
||||
postNotificationName: NSColorListDidChangeNotification
|
||||
object: self];
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,8 +381,8 @@ static NSMutableDictionary *_namedColorLists = nil;
|
||||
[_keys insertObject: key atIndex: index];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSColorListDidChangeNotification
|
||||
object: self];
|
||||
postNotificationName: NSColorListDidChangeNotification
|
||||
object: self];
|
||||
}
|
||||
|
||||
- (void) writeToFile: (NSString *) path {
|
||||
|
@ -24,7 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <AppKit/NSRaise.h>
|
||||
|
||||
NSString *const NSColorPanelColorDidChangeNotification =
|
||||
@"NSColorPanelColorDidChangeNotification";
|
||||
@"NSColorPanelColorDidChangeNotification";
|
||||
|
||||
@interface NSColorPicker (PrivateInterface)
|
||||
|
||||
@ -87,25 +87,25 @@ static NSUInteger _pickerMask = 0;
|
||||
[color writeToPasteboard: pboard];
|
||||
|
||||
[view dragImage: image
|
||||
at: NSMakePoint(0, 0)
|
||||
offset: NSMakeSize(0, 0)
|
||||
event: event
|
||||
pasteboard: pboard
|
||||
source: view
|
||||
slideBack: YES];
|
||||
at: NSMakePoint(0, 0)
|
||||
offset: NSMakeSize(0, 0)
|
||||
event: event
|
||||
pasteboard: pboard
|
||||
source: view
|
||||
slideBack: YES];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) swapInNewView: sender {
|
||||
NSColorPicker<NSColorPickingCustom> *chosenColorPicker =
|
||||
[_colorPickers objectAtIndex: [sender selectedTag]];
|
||||
[_colorPickers objectAtIndex: [sender selectedTag]];
|
||||
NSView *newView;
|
||||
|
||||
newView = [chosenColorPicker provideNewView: YES];
|
||||
|
||||
if (currentColorPickerView != newView) {
|
||||
[[sender selectedCell]
|
||||
setImage: [chosenColorPicker provideNewButtonImage]];
|
||||
setImage: [chosenColorPicker provideNewButtonImage]];
|
||||
|
||||
if (currentColorPickerView != nil)
|
||||
[newView setFrame: [currentColorPickerView frame]];
|
||||
@ -125,14 +125,14 @@ static NSUInteger _pickerMask = 0;
|
||||
// time to load the color pickers. theoretically we should be searching all
|
||||
// the /Library/ColorPickers out there, but...
|
||||
NSArray *colorPickersClassArray =
|
||||
[NSArray arrayWithObjects: [NSColorPickerWheel class],
|
||||
[NSColorPickerSliders class],
|
||||
[NSArray arrayWithObjects: [NSColorPickerWheel class],
|
||||
[NSColorPickerSliders class],
|
||||
#if 1
|
||||
// Disabled to see if it fixes a nib
|
||||
// instantiation issue
|
||||
[NSColorPickerColorList class],
|
||||
// Disabled to see if it fixes a nib
|
||||
// instantiation issue
|
||||
[NSColorPickerColorList class],
|
||||
#endif
|
||||
nil];
|
||||
nil];
|
||||
NSUInteger i, count = [colorPickersClassArray count];
|
||||
|
||||
[colorWell setBordered: NO];
|
||||
@ -142,9 +142,9 @@ static NSUInteger _pickerMask = 0;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
Class colorPickerClass = [colorPickersClassArray objectAtIndex: i];
|
||||
NSColorPicker *newPicker =
|
||||
[[[colorPickerClass alloc] initWithPickerMask: _pickerMask
|
||||
colorPanel: self] autorelease];
|
||||
NSColorPicker *newPicker = [[[colorPickerClass alloc]
|
||||
initWithPickerMask: _pickerMask
|
||||
colorPanel: self] autorelease];
|
||||
NSCell *cell = [colorPickersMatrix cellAtRow: 0 column: i];
|
||||
|
||||
[_colorPickers addObject: newPicker];
|
||||
@ -217,13 +217,14 @@ static NSUInteger _pickerMask = 0;
|
||||
[opacityTextField setFloatValue: alpha * 100.f];
|
||||
|
||||
[[NSNotificationQueue defaultQueue]
|
||||
enqueueNotification:
|
||||
[NSNotification
|
||||
notificationWithName: NSColorPanelColorDidChangeNotification
|
||||
object: self]
|
||||
postingStyle: NSPostNow
|
||||
coalesceMask: NSNotificationCoalescingOnName
|
||||
forModes: nil];
|
||||
enqueueNotification:
|
||||
[NSNotification
|
||||
notificationWithName:
|
||||
NSColorPanelColorDidChangeNotification
|
||||
object: self]
|
||||
postingStyle: NSPostNow
|
||||
coalesceMask: NSNotificationCoalescingOnName
|
||||
forModes: nil];
|
||||
}
|
||||
|
||||
- (void) setMode: (NSColorPanelMode) mode {
|
||||
|
@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
colorPanel: (NSColorPanel *) colorPanel
|
||||
{
|
||||
NSEnumerator *colorListsEnumerator =
|
||||
[[NSColorList availableColorLists] objectEnumerator];
|
||||
[[NSColorList availableColorLists] objectEnumerator];
|
||||
NSColorList *colorList;
|
||||
|
||||
[super initWithPickerMask: mask colorPanel: colorPanel];
|
||||
@ -50,20 +50,20 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (void) colorListPopUpClicked: (id) sender {
|
||||
[_pickedColorList release];
|
||||
_pickedColorList = [[NSColorList
|
||||
colorListNamed: [[sender itemAtIndex: [sender indexOfSelectedItem]]
|
||||
title]] retain];
|
||||
colorListNamed: [[sender itemAtIndex: [sender indexOfSelectedItem]]
|
||||
title]] retain];
|
||||
|
||||
[colorBrowser reloadColumn: 0];
|
||||
}
|
||||
|
||||
- (void) colorListBrowserClicked: (id) sender {
|
||||
[[NSColorPanel sharedColorPanel]
|
||||
setColor: [_pickedColorList
|
||||
colorWithKey: [[sender selectedCell] stringValue]]];
|
||||
setColor: [_pickedColorList colorWithKey: [[sender selectedCell]
|
||||
stringValue]]];
|
||||
}
|
||||
|
||||
- (NSInteger) browser: (NSBrowser *) sender
|
||||
numberOfRowsInColumn: (NSInteger) column
|
||||
numberOfRowsInColumn: (NSInteger) column
|
||||
{
|
||||
return [[_pickedColorList allKeys] count];
|
||||
}
|
||||
@ -73,15 +73,16 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (void) browser: (NSBrowser *) sender
|
||||
willDisplayCell: (id) cell
|
||||
atRow: (NSInteger) row
|
||||
column: (NSInteger) column
|
||||
willDisplayCell: (id) cell
|
||||
atRow: (NSInteger) row
|
||||
column: (NSInteger) column
|
||||
{
|
||||
[cell setStringValue: [[_pickedColorList allKeys] objectAtIndex: row]];
|
||||
[cell setLeaf: YES];
|
||||
[cell setLoaded: YES];
|
||||
[cell setColor: [_pickedColorList colorWithKey: [[_pickedColorList allKeys]
|
||||
objectAtIndex: row]]];
|
||||
[cell setColor: [_pickedColorList
|
||||
colorWithKey: [[_pickedColorList allKeys]
|
||||
objectAtIndex: row]]];
|
||||
}
|
||||
|
||||
- (void) setColor: (NSColor *) color {
|
||||
|
@ -87,10 +87,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
color = [color colorUsingColorSpaceName: NSDeviceCMYKColorSpace];
|
||||
[color getCyan: &cyan
|
||||
magenta: &magenta
|
||||
yellow: &yellow
|
||||
black: &black
|
||||
alpha: &alpha];
|
||||
magenta: &magenta
|
||||
yellow: &yellow
|
||||
black: &black
|
||||
alpha: &alpha];
|
||||
|
||||
[_cyanSlider setIntValue: cyan * 100];
|
||||
[_magentaSlider setIntValue: magenta * 100];
|
||||
@ -111,9 +111,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
color = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
[color getHue: &hue
|
||||
saturation: &saturation
|
||||
brightness: &brightness
|
||||
alpha: &alpha];
|
||||
saturation: &saturation
|
||||
brightness: &brightness
|
||||
alpha: &alpha];
|
||||
|
||||
[_hueSlider setIntValue: hue * 359];
|
||||
[_saturationSlider setIntValue: saturation * 100];
|
||||
@ -193,9 +193,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[greyscaleSlider setIntValue: intValue];
|
||||
|
||||
[[self colorPanel]
|
||||
setColor: [NSColor
|
||||
colorWithCalibratedWhite: intValue / 100.0
|
||||
alpha: [[self colorPanel] alpha]]];
|
||||
setColor: [NSColor colorWithCalibratedWhite: intValue / 100.0
|
||||
alpha: [[self colorPanel]
|
||||
alpha]]];
|
||||
}
|
||||
|
||||
- (void) grayscaleConstant: sender {
|
||||
@ -223,10 +223,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[[rgbTextFieldMatrix cellAtRow: 2 column: 0] setIntValue: [blue intValue]];
|
||||
|
||||
[[self colorPanel]
|
||||
setColor: [NSColor colorWithCalibratedRed: [red doubleValue] / 255.0
|
||||
green: [green doubleValue] / 255.0
|
||||
blue: [blue doubleValue] / 255.0
|
||||
alpha: [[self colorPanel] alpha]]];
|
||||
setColor: [NSColor
|
||||
colorWithCalibratedRed: [red doubleValue] / 255.0
|
||||
green: [green doubleValue] /
|
||||
255.0
|
||||
blue: [blue doubleValue] / 255.0
|
||||
alpha: [[self colorPanel]
|
||||
alpha]]];
|
||||
}
|
||||
|
||||
- (void) rgbSliderChanged: sender {
|
||||
@ -254,11 +257,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[_blackSlider setIntValue: [black intValue]];
|
||||
|
||||
[[self colorPanel]
|
||||
setColor: [NSColor colorWithDeviceCyan: [cyan doubleValue] / 100.0
|
||||
magenta: [magenta doubleValue] / 100.0
|
||||
yellow: [yellow doubleValue] / 100.0
|
||||
black: [black doubleValue] / 100.0
|
||||
alpha: [[self colorPanel] alpha]]];
|
||||
setColor: [NSColor
|
||||
colorWithDeviceCyan: [cyan doubleValue] / 100.0
|
||||
magenta: [magenta doubleValue] / 100.0
|
||||
yellow: [yellow doubleValue] / 100.0
|
||||
black: [black doubleValue] / 100.0
|
||||
alpha: [[self colorPanel] alpha]]];
|
||||
}
|
||||
|
||||
- (void) cmykSliderChanged: sender {
|
||||
@ -287,23 +291,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[_brightnessSlider setIntValue: [brightness intValue]];
|
||||
|
||||
[[self colorPanel]
|
||||
setColor: [NSColor
|
||||
colorWithCalibratedHue: [hue doubleValue] / 359.0
|
||||
saturation: [saturation doubleValue] / 100.0
|
||||
brightness: [brightness doubleValue] / 100.0
|
||||
alpha: [[self colorPanel] alpha]]];
|
||||
setColor: [NSColor
|
||||
colorWithCalibratedHue: [hue doubleValue] / 359.0
|
||||
saturation: [saturation doubleValue] /
|
||||
100.0
|
||||
brightness: [brightness doubleValue] /
|
||||
100.0
|
||||
alpha: [[self colorPanel]
|
||||
alpha]]];
|
||||
}
|
||||
|
||||
- (void) hsbSliderChanged: sender {
|
||||
[self _updateHue: _hueSlider
|
||||
saturation: _saturationSlider
|
||||
brightness: _brightnessSlider];
|
||||
saturation: _saturationSlider
|
||||
brightness: _brightnessSlider];
|
||||
}
|
||||
|
||||
- (void) hsbTextChanged: sender {
|
||||
[self _updateHue: [hsbTextFieldMatrix cellAtRow: 0 column: 0]
|
||||
saturation: [hsbTextFieldMatrix cellAtRow: 1 column: 0]
|
||||
brightness: [hsbTextFieldMatrix cellAtRow: 2 column: 0]];
|
||||
saturation: [hsbTextFieldMatrix cellAtRow: 1 column: 0]
|
||||
brightness: [hsbTextFieldMatrix cellAtRow: 2 column: 0]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -21,9 +21,9 @@
|
||||
color = [color colorUsingColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
|
||||
[color getHue: &hue
|
||||
saturation: &saturation
|
||||
brightness: &brightness
|
||||
alpha: &alpha];
|
||||
saturation: &saturation
|
||||
brightness: &brightness
|
||||
alpha: &alpha];
|
||||
|
||||
[_wheelView setHue: hue * 360];
|
||||
[_wheelView setSaturation: saturation * 100];
|
||||
@ -47,10 +47,11 @@
|
||||
{
|
||||
|
||||
[[self colorPanel]
|
||||
setColor: [NSColor colorWithCalibratedHue: hue / 360.0
|
||||
saturation: saturation / 100.0
|
||||
brightness: brightness / 100.0
|
||||
alpha: [[self colorPanel] alpha]]];
|
||||
setColor: [NSColor colorWithCalibratedHue: hue / 360.0
|
||||
saturation: saturation / 100.0
|
||||
brightness: brightness / 100.0
|
||||
alpha: [[self colorPanel]
|
||||
alpha]]];
|
||||
}
|
||||
|
||||
- (void) setColor: (NSColor *) color {
|
||||
|
@ -120,13 +120,13 @@
|
||||
location.y -= center.y;
|
||||
|
||||
CGFloat relativeDistanceFromCenter =
|
||||
hypot(location.x, location.y) / colorWheelRadius;
|
||||
hypot(location.x, location.y) / colorWheelRadius;
|
||||
if (relativeDistanceFromCenter > 1)
|
||||
relativeDistanceFromCenter = 1;
|
||||
|
||||
// Get the angle and ensure it's in 0..2*PI
|
||||
CGFloat angle =
|
||||
fmod(atan2(location.y, location.x) - M_PI_2 + M_PI * 2.f, M_PI * 2.f);
|
||||
CGFloat angle = fmod(atan2(location.y, location.x) - M_PI_2 + M_PI * 2.f,
|
||||
M_PI * 2.f);
|
||||
|
||||
// Hue is stored in degrees
|
||||
_hueValue = angle * 180.f / M_PI;
|
||||
|
@ -24,14 +24,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
+ (NSColorSpace *) sRGBColorSpace {
|
||||
CGColorSpaceRef srgb = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
|
||||
NSColorSpace *colorSpace =
|
||||
[[[self alloc] initWithCGColorSpace: srgb] autorelease];
|
||||
[[[self alloc] initWithCGColorSpace: srgb] autorelease];
|
||||
return colorSpace;
|
||||
}
|
||||
|
||||
+ (NSColorSpace *) deviceRGBColorSpace {
|
||||
CGColorSpaceRef device = CGColorSpaceCreateDeviceRGB();
|
||||
NSColorSpace *result =
|
||||
[[[self alloc] initWithCGColorSpace: device] autorelease];
|
||||
[[[self alloc] initWithCGColorSpace: device] autorelease];
|
||||
|
||||
CGColorSpaceRelease(device);
|
||||
|
||||
|
@ -49,7 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// private
|
||||
NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
|
||||
@"_NSColorWellDidBecomeExclusiveNotification";
|
||||
@"_NSColorWellDidBecomeExclusiveNotification";
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *) coder {
|
||||
NSUnimplementedMethod();
|
||||
@ -81,15 +81,15 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
|
||||
_color = [[NSColor whiteColor] copy];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(colorPanelWillClose:)
|
||||
name: NSWindowWillCloseNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
addObserver: self
|
||||
selector: @selector(colorPanelWillClose:)
|
||||
name: NSWindowWillCloseNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(colorWellDidBecomeExclusive:)
|
||||
name: _NSColorWellDidBecomeExclusiveNotification
|
||||
object: nil];
|
||||
addObserver: self
|
||||
selector: @selector(colorWellDidBecomeExclusive:)
|
||||
name: _NSColorWellDidBecomeExclusiveNotification
|
||||
object: nil];
|
||||
|
||||
[self registerForDraggedTypes: @[ NSColorPboardType ]];
|
||||
|
||||
@ -99,15 +99,15 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
|
||||
- (void) awakeFromNib {
|
||||
// this should be moved the nib initWithCoder:
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(colorPanelWillClose:)
|
||||
name: NSWindowWillCloseNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
addObserver: self
|
||||
selector: @selector(colorPanelWillClose:)
|
||||
name: NSWindowWillCloseNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(colorWellDidBecomeExclusive:)
|
||||
name: _NSColorWellDidBecomeExclusiveNotification
|
||||
object: nil];
|
||||
addObserver: self
|
||||
selector: @selector(colorWellDidBecomeExclusive:)
|
||||
name: _NSColorWellDidBecomeExclusiveNotification
|
||||
object: nil];
|
||||
[self registerForDraggedTypes: @[ NSColorPboardType ]];
|
||||
}
|
||||
|
||||
@ -196,20 +196,20 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
|
||||
|
||||
if (exclusive) {
|
||||
NSNotification *notification = [NSNotification
|
||||
notificationWithName: _NSColorWellDidBecomeExclusiveNotification
|
||||
object: self];
|
||||
notificationWithName: _NSColorWellDidBecomeExclusiveNotification
|
||||
object: self];
|
||||
|
||||
[[NSNotificationQueue defaultQueue]
|
||||
enqueueNotification: notification
|
||||
postingStyle: NSPostNow
|
||||
coalesceMask: NSNotificationCoalescingOnName
|
||||
forModes: nil];
|
||||
enqueueNotification: notification
|
||||
postingStyle: NSPostNow
|
||||
coalesceMask: NSNotificationCoalescingOnName
|
||||
forModes: nil];
|
||||
}
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(changeColorWhenActive:)
|
||||
name: NSColorPanelColorDidChangeNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
addObserver: self
|
||||
selector: @selector(changeColorWhenActive:)
|
||||
name: NSColorPanelColorDidChangeNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
|
||||
// Update the color panel with our color.
|
||||
[[NSColorPanel sharedColorPanel] setColor: [self color]];
|
||||
@ -225,9 +225,9 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
|
||||
|
||||
_isActive = NO;
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSColorPanelColorDidChangeNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
removeObserver: self
|
||||
name: NSColorPanelColorDidChangeNotification
|
||||
object: [NSColorPanel sharedColorPanel]];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
@ -284,8 +284,8 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
|
||||
BOOL wasActive = [self isActive];
|
||||
NSPoint point = [self convertPoint: [event locationInWindow]
|
||||
fromView: nil];
|
||||
BOOL mouseInBorder =
|
||||
!NSMouseInRect(point, NSInsetRect(_bounds, 8, 8), [self isFlipped]);
|
||||
BOOL mouseInBorder = !NSMouseInRect(point, NSInsetRect(_bounds, 8, 8),
|
||||
[self isFlipped]);
|
||||
BOOL canStartDrag = !mouseInBorder;
|
||||
if (mouseInBorder) {
|
||||
// Toggle the initial state.
|
||||
@ -297,12 +297,12 @@ NSNotificationName _NSColorWellDidBecomeExclusiveNotification =
|
||||
|
||||
BOOL shouldStartDrag = NO;
|
||||
do {
|
||||
event =
|
||||
[[self window] nextEventMatchingMask: NSLeftMouseUpMask |
|
||||
NSLeftMouseDraggedMask];
|
||||
event = [[self window]
|
||||
nextEventMatchingMask: NSLeftMouseUpMask |
|
||||
NSLeftMouseDraggedMask];
|
||||
point = [self convertPoint: [event locationInWindow] fromView: nil];
|
||||
BOOL mouseInBounds =
|
||||
NSMouseInRect(point, _bounds, [self isFlipped]);
|
||||
NSMouseInRect(point, _bounds, [self isFlipped]);
|
||||
if ([event type] == NSLeftMouseDragged) {
|
||||
if (canStartDrag) {
|
||||
// Get dragging the color.
|
||||
|
@ -24,13 +24,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <AppKit/NSTextView.h>
|
||||
|
||||
NSString *const NSComboBoxSelectionDidChangeNotification =
|
||||
@"NSComboBoxSelectionDidChangeNotification";
|
||||
@"NSComboBoxSelectionDidChangeNotification";
|
||||
NSString *const NSComboBoxSelectionIsChangingNotification =
|
||||
@"NSComboBoxSelectionIsChangingNotification";
|
||||
@"NSComboBoxSelectionIsChangingNotification";
|
||||
NSString *const NSComboBoxWillDismissNotification =
|
||||
@"NSComboBoxWillDismissNotification";
|
||||
@"NSComboBoxWillDismissNotification";
|
||||
NSString *const NSComboBoxWillPopUpNotification =
|
||||
@"NSComboBoxWillPopUpNotification";
|
||||
@"NSComboBoxWillPopUpNotification";
|
||||
|
||||
@implementation NSComboBox
|
||||
|
||||
@ -195,7 +195,7 @@ NSString *const NSComboBoxWillPopUpNotification =
|
||||
// objectValue index 0...
|
||||
- (BOOL) textView: (NSTextView *) textView doCommandBySelector: (SEL) selector {
|
||||
NSInteger index =
|
||||
[[self cell] indexOfItemWithObjectValue: [self objectValue]];
|
||||
[[self cell] indexOfItemWithObjectValue: [self objectValue]];
|
||||
id objectCache = nil;
|
||||
|
||||
if ([textView rangeForUserCompletion].location != NSNotFound)
|
||||
@ -226,12 +226,12 @@ NSString *const NSComboBoxWillPopUpNotification =
|
||||
}
|
||||
|
||||
- (NSArray *) textView: (NSTextView *) textView
|
||||
completions: (NSArray *) words
|
||||
forPartialWordRange: (NSRange) range
|
||||
indexOfSelectedItem: (NSInteger *) index
|
||||
completions: (NSArray *) words
|
||||
forPartialWordRange: (NSRange) range
|
||||
indexOfSelectedItem: (NSInteger *) index
|
||||
{
|
||||
NSString *string = [[self cell]
|
||||
completedString: [[textView string] substringWithRange: range]];
|
||||
completedString: [[textView string] substringWithRange: range]];
|
||||
|
||||
// NSLog(@"NSComboBox delegate OK: %@", string);
|
||||
|
||||
|
@ -38,11 +38,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
_dataSource = [keyed decodeObjectForKey: @"NSDataSource"];
|
||||
_objectValues = [[NSMutableArray alloc]
|
||||
initWithArray: [keyed decodeObjectForKey: @"NSPopUpListData"]];
|
||||
initWithArray: [keyed decodeObjectForKey: @"NSPopUpListData"]];
|
||||
_numberOfVisibleItems = [keyed decodeIntForKey: @"NSVisibleItemCount"];
|
||||
_usesDataSource = [keyed decodeBoolForKey: @"NSUsesDataSource"];
|
||||
_hasVerticalScroller =
|
||||
[keyed decodeBoolForKey: @"NSHasVerticalScroller"];
|
||||
[keyed decodeBoolForKey: @"NSHasVerticalScroller"];
|
||||
_completes = [keyed decodeBoolForKey: @"NSCompletes"];
|
||||
_isButtonBordered = YES;
|
||||
_buttonEnabled = YES;
|
||||
@ -238,7 +238,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (_usesDataSource == YES) // not supported yet, well...
|
||||
if ([_dataSource respondsToSelector: @selector(comboBoxCell:
|
||||
completedString:)] == YES)
|
||||
completedString:)] == YES)
|
||||
return [_dataSource comboBoxCell: self completedString: string];
|
||||
|
||||
for (i = 0; i < count; ++i) {
|
||||
@ -271,9 +271,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (BOOL) trackMouse: (NSEvent *) event
|
||||
inRect: (NSRect) cellFrame
|
||||
ofView: (NSView *) controlView
|
||||
untilMouseUp: (BOOL) flag
|
||||
inRect: (NSRect) cellFrame
|
||||
ofView: (NSView *) controlView
|
||||
untilMouseUp: (BOOL) flag
|
||||
{
|
||||
NSComboBoxWindow *window;
|
||||
NSPoint origin = [controlView bounds].origin;
|
||||
@ -281,7 +281,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSPoint check = [controlView convertPoint: [event locationInWindow]
|
||||
fromView: nil];
|
||||
NSUInteger selectedIndex =
|
||||
[_objectValues indexOfObject: [self objectValue]];
|
||||
[_objectValues indexOfObject: [self objectValue]];
|
||||
|
||||
if ([_objectValues count] == 0)
|
||||
return NO;
|
||||
@ -329,7 +329,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
else if ([object respondsToSelector: @selector
|
||||
(descriptionWithLocale:)])
|
||||
string = [object
|
||||
descriptionWithLocale: [NSLocale currentLocale]];
|
||||
descriptionWithLocale: [NSLocale currentLocale]];
|
||||
else if ([object respondsToSelector: @selector(description)])
|
||||
string = [object description];
|
||||
else
|
||||
@ -337,7 +337,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (attstr)
|
||||
[[(NSTextView *) editor textStorage]
|
||||
setAttributedString: attstr];
|
||||
setAttributedString: attstr];
|
||||
else
|
||||
[editor setString: string];
|
||||
|
||||
@ -345,8 +345,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[self endEditing: editor];
|
||||
if (_sendsActionOnEndEditing)
|
||||
[(NSControl *) controlView
|
||||
sendAction: [(NSControl *) controlView action]
|
||||
to: [(NSControl *) controlView target]];
|
||||
sendAction: [(NSControl *) controlView action]
|
||||
to: [(NSControl *) controlView target]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,10 +372,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[super drawWithFrame: frame inView: controlView];
|
||||
|
||||
[[controlView graphicsStyle]
|
||||
drawComboBoxButtonInRect: [self buttonRectForBounds: frame]
|
||||
enabled: _buttonEnabled
|
||||
bordered: _isButtonBordered
|
||||
pressed: _buttonPressed];
|
||||
drawComboBoxButtonInRect: [self buttonRectForBounds: frame]
|
||||
enabled: _buttonEnabled
|
||||
bordered: _isButtonBordered
|
||||
pressed: _buttonPressed];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -60,14 +60,14 @@ enum { KEYBOARD_INACTIVE, KEYBOARD_ACTIVE, KEYBOARD_OK, KEYBOARD_CANCEL };
|
||||
|
||||
- (NSDictionary *) itemAttributes {
|
||||
return [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: _font, NSFontAttributeName, nil];
|
||||
dictionaryWithObjectsAndKeys: _font, NSFontAttributeName, nil];
|
||||
}
|
||||
|
||||
- (NSDictionary *) selectedItemAttributes {
|
||||
return [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: _font, NSFontAttributeName,
|
||||
[NSColor selectedTextColor],
|
||||
NSForegroundColorAttributeName, nil];
|
||||
dictionaryWithObjectsAndKeys: _font, NSFontAttributeName,
|
||||
[NSColor selectedTextColor],
|
||||
NSForegroundColorAttributeName, nil];
|
||||
}
|
||||
|
||||
- (NSSize) sizeForContents {
|
||||
@ -250,8 +250,8 @@ enum { KEYBOARD_INACTIVE, KEYBOARD_ACTIVE, KEYBOARD_OK, KEYBOARD_CANCEL };
|
||||
[[self window] flushWindow];
|
||||
|
||||
event = [[self window]
|
||||
nextEventMatchingMask: NSLeftMouseDownMask | NSLeftMouseUpMask |
|
||||
NSLeftMouseDraggedMask | NSKeyDownMask];
|
||||
nextEventMatchingMask: NSLeftMouseDownMask | NSLeftMouseUpMask |
|
||||
NSLeftMouseDraggedMask | NSKeyDownMask];
|
||||
if ([event type] == NSKeyDown) {
|
||||
[self interpretKeyEvents: [NSArray arrayWithObject: event]];
|
||||
switch (_keyboardUIState) {
|
||||
@ -279,7 +279,7 @@ enum { KEYBOARD_INACTIVE, KEYBOARD_ACTIVE, KEYBOARD_OK, KEYBOARD_CANCEL };
|
||||
point = [event locationInWindow];
|
||||
point = [[event window] convertBaseToScreen: point];
|
||||
screenVisible =
|
||||
NSInsetRect([[[self window] screen] visibleFrame], 4, 4);
|
||||
NSInsetRect([[[self window] screen] visibleFrame], 4, 4);
|
||||
if (NSPointInRect(point, [[self window] frame]) &&
|
||||
!NSPointInRect(point, screenVisible)) {
|
||||
NSPoint origin = [[self window] frame].origin;
|
||||
|
@ -69,10 +69,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (int) runTrackingWithEvent: (NSEvent *) event {
|
||||
NSSize size = [_view sizeForContents];
|
||||
NSSize scrollViewSize = [NSScrollView
|
||||
frameSizeForContentSize: size
|
||||
hasHorizontalScroller: [_scrollView hasHorizontalScroller]
|
||||
hasVerticalScroller: [_scrollView hasVerticalScroller]
|
||||
borderType: NSLineBorder];
|
||||
frameSizeForContentSize: size
|
||||
hasHorizontalScroller: [_scrollView hasHorizontalScroller]
|
||||
hasVerticalScroller: [_scrollView hasVerticalScroller]
|
||||
borderType: NSLineBorder];
|
||||
NSRect frame;
|
||||
|
||||
frame = [self frame];
|
||||
|
@ -34,11 +34,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <objc/runtime.h>
|
||||
|
||||
NSString *const NSControlTextDidBeginEditingNotification =
|
||||
@"NSControlTextDidBeginEditingNotification";
|
||||
@"NSControlTextDidBeginEditingNotification";
|
||||
NSString *const NSControlTextDidChangeNotification =
|
||||
@"NSControlTextDidChangeNotification";
|
||||
@"NSControlTextDidChangeNotification";
|
||||
NSString *const NSControlTextDidEndEditingNotification =
|
||||
@"NSControlTextDidEndEditingNotification";
|
||||
@"NSControlTextDidEndEditingNotification";
|
||||
|
||||
@implementation NSControl
|
||||
|
||||
@ -74,7 +74,7 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
[_aux setTag: [keyed decodeIntegerForKey: @"NSTag"]];
|
||||
|
||||
SEL sel = NSSelectorFromString(
|
||||
[keyed decodeObjectForKey: @"NSControlAction"]);
|
||||
[keyed decodeObjectForKey: @"NSControlAction"]);
|
||||
if (sel)
|
||||
[_aux setAction: sel];
|
||||
[_aux setTarget: [keyed decodeObjectForKey: @"NSControlTarget"]];
|
||||
@ -511,7 +511,7 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
NSTextView *textview = (NSTextView *) _currentEditor;
|
||||
NSAttributedString *text = [textview textStorage];
|
||||
NSAttributedString *string = [[[NSAttributedString alloc]
|
||||
initWithAttributedString: text] autorelease];
|
||||
initWithAttributedString: text] autorelease];
|
||||
[[self selectedCell] setAttributedStringValue: string];
|
||||
} else {
|
||||
[[self selectedCell] setStringValue: string];
|
||||
@ -577,11 +577,12 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
return;
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSControlTextDidBeginEditingNotification
|
||||
object: self
|
||||
userInfo: [NSDictionary
|
||||
dictionaryWithObject: [note object]
|
||||
forKey: @"NSFieldEditor"]];
|
||||
postNotificationName: NSControlTextDidBeginEditingNotification
|
||||
object: self
|
||||
userInfo: [NSDictionary
|
||||
dictionaryWithObject: [note object]
|
||||
forKey: @"NSFieldEdito"
|
||||
@"r"]];
|
||||
|
||||
// If this control's value is bound to an object that conforms to
|
||||
// NSEditorRegistration, register as an editor.
|
||||
@ -589,7 +590,7 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
if (bindingInfo) {
|
||||
id observedObject = [bindingInfo objectForKey: NSObservedObjectKey];
|
||||
if ([observedObject
|
||||
respondsToSelector: @selector(objectDidBeginEditing:)])
|
||||
respondsToSelector: @selector(objectDidBeginEditing:)])
|
||||
[observedObject objectDidBeginEditing: self];
|
||||
}
|
||||
}
|
||||
@ -602,11 +603,12 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
[[self selectedCell] setStringValue: [[note object] string]];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSControlTextDidChangeNotification
|
||||
object: self
|
||||
userInfo: [NSDictionary
|
||||
dictionaryWithObject: [note object]
|
||||
forKey: @"NSFieldEditor"]];
|
||||
postNotificationName: NSControlTextDidChangeNotification
|
||||
object: self
|
||||
userInfo: [NSDictionary
|
||||
dictionaryWithObject: [note object]
|
||||
forKey: @"NSFieldEdito"
|
||||
@"r"]];
|
||||
}
|
||||
|
||||
- (void) textDidEndEditing: (NSNotification *) note {
|
||||
@ -619,11 +621,12 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
[self abortEditing];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSControlTextDidEndEditingNotification
|
||||
object: self
|
||||
userInfo: [NSDictionary
|
||||
dictionaryWithObject: [note object]
|
||||
forKey: @"NSFieldEditor"]];
|
||||
postNotificationName: NSControlTextDidEndEditingNotification
|
||||
object: self
|
||||
userInfo: [NSDictionary
|
||||
dictionaryWithObject: [note object]
|
||||
forKey: @"NSFieldEdito"
|
||||
@"r"]];
|
||||
|
||||
// If this control's value is bound to an object that conforms to
|
||||
// NSEditorRegistration, unregister as an editor.
|
||||
@ -631,7 +634,7 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
if (bindingInfo) {
|
||||
id observedObject = [bindingInfo objectForKey: NSObservedObjectKey];
|
||||
if ([observedObject
|
||||
respondsToSelector: @selector(objectDidEndEditing:)])
|
||||
respondsToSelector: @selector(objectDidEndEditing:)])
|
||||
[observedObject objectDidEndEditing: self];
|
||||
}
|
||||
|
||||
@ -660,10 +663,10 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
[self setNeedsDisplay: YES];
|
||||
|
||||
if ([_cell trackMouse: event
|
||||
inRect: [self bounds]
|
||||
ofView: self
|
||||
untilMouseUp:
|
||||
[[_cell class] prefersTrackingUntilMouseUp]]) {
|
||||
inRect: [self bounds]
|
||||
ofView: self
|
||||
untilMouseUp:
|
||||
[[_cell class] prefersTrackingUntilMouseUp]]) {
|
||||
[_cell setState: ![_cell state]];
|
||||
[self setNeedsDisplay: YES];
|
||||
sendAction = YES;
|
||||
@ -675,8 +678,8 @@ static NSMutableDictionary *cellClassDictionary = nil;
|
||||
}
|
||||
|
||||
[[self window] flushWindow];
|
||||
event = [[self window]
|
||||
nextEventMatchingMask: NSLeftMouseUpMask | NSLeftMouseDraggedMask];
|
||||
event = [[self window] nextEventMatchingMask: NSLeftMouseUpMask |
|
||||
NSLeftMouseDraggedMask];
|
||||
} while ([event type] != NSLeftMouseUp);
|
||||
|
||||
[self unlockFocus];
|
||||
|
@ -68,41 +68,41 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
+ (void) initialize {
|
||||
[self setKeys: [NSArray arrayWithObjects: @"content", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"contentArray"];
|
||||
triggerChangeNotificationsForDependentKey: @"contentArray"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"content", @"contentArray",
|
||||
@"selectionIndexes", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"selection"];
|
||||
triggerChangeNotificationsForDependentKey: @"selection"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"content", @"contentArray",
|
||||
@"selectionIndexes", @"selection",
|
||||
nil]
|
||||
triggerChangeNotificationsForDependentKey: @"selectionIndex"];
|
||||
triggerChangeNotificationsForDependentKey: @"selectionIndex"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"content", @"contentArray",
|
||||
@"selectionIndexes", @"selection",
|
||||
nil]
|
||||
triggerChangeNotificationsForDependentKey: @"selectedObjects"];
|
||||
triggerChangeNotificationsForDependentKey: @"selectedObjects"];
|
||||
|
||||
[self setKeys: [NSArray arrayWithObjects: @"selectionIndexes", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"canRemove"];
|
||||
triggerChangeNotificationsForDependentKey: @"canRemove"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"selectionIndexes", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"canSelectNext"];
|
||||
triggerChangeNotificationsForDependentKey: @"canSelectNext"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"selectionIndexes", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"canSelectPrevious"];
|
||||
triggerChangeNotificationsForDependentKey: @"canSelectPrevious"];
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *) coder {
|
||||
if ((self = [super initWithCoder: coder])) {
|
||||
_flags.avoidsEmptySelection =
|
||||
[coder decodeBoolForKey: @"NSAvoidsEmptySelection"];
|
||||
[coder decodeBoolForKey: @"NSAvoidsEmptySelection"];
|
||||
_flags.clearsFilterPredicateOnInsertion =
|
||||
[coder decodeBoolForKey: @"NSClearsFilterPredicateOnInsertion"];
|
||||
[coder decodeBoolForKey: @"NSClearsFilterPredicateOnInsertion"];
|
||||
_flags.filterRestrictsInsertion =
|
||||
[coder decodeBoolForKey: @"NSFilterRestrictsInsertion"];
|
||||
[coder decodeBoolForKey: @"NSFilterRestrictsInsertion"];
|
||||
_flags.preservesSelection =
|
||||
[coder decodeBoolForKey: @"NSPreservesSelection"];
|
||||
[coder decodeBoolForKey: @"NSPreservesSelection"];
|
||||
_flags.selectsInsertedObjects =
|
||||
[coder decodeBoolForKey: @"NSSelectsInsertedObjects"];
|
||||
[coder decodeBoolForKey: @"NSSelectsInsertedObjects"];
|
||||
_flags.alwaysUsesMultipleValuesMarker =
|
||||
[coder decodeBoolForKey: @"NSAlwaysUsesMultipleValuesMarker"];
|
||||
[coder decodeBoolForKey: @"NSAlwaysUsesMultipleValuesMarker"];
|
||||
|
||||
id declaredKeys = [coder decodeObjectForKey: @"NSDeclaredKeys"];
|
||||
|
||||
@ -173,13 +173,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
id sortedObjects = objects;
|
||||
|
||||
if ([self filterPredicate]) {
|
||||
sortedObjects =
|
||||
[sortedObjects filteredArrayUsingPredicate: [self filterPredicate]];
|
||||
sortedObjects = [sortedObjects
|
||||
filteredArrayUsingPredicate: [self filterPredicate]];
|
||||
}
|
||||
|
||||
if ([self sortDescriptors]) {
|
||||
sortedObjects =
|
||||
[sortedObjects sortedArrayUsingDescriptors: [self sortDescriptors]];
|
||||
sortedObjects = [sortedObjects
|
||||
sortedArrayUsingDescriptors: [self sortDescriptors]];
|
||||
}
|
||||
|
||||
return sortedObjects;
|
||||
@ -381,8 +381,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
id set = [NSMutableIndexSet indexSet];
|
||||
int i, count = [objects count];
|
||||
for (i = 0; i < [objects count]; i++) {
|
||||
NSUInteger idx =
|
||||
[[self arrangedObjects] indexOfObject: [objects objectAtIndex: i]];
|
||||
NSUInteger idx = [[self arrangedObjects]
|
||||
indexOfObject: [objects objectAtIndex: i]];
|
||||
if (idx != NSNotFound) {
|
||||
[set addIndex: idx];
|
||||
}
|
||||
@ -499,7 +499,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
// Don't check canAdd here as this can be used programmatically to add
|
||||
// objects
|
||||
[self insertObject: object
|
||||
atArrangedObjectIndex: [[self arrangedObjects] count]];
|
||||
atArrangedObjectIndex: [[self arrangedObjects] count]];
|
||||
}
|
||||
|
||||
- (void) addObjects: (NSArray *) objects {
|
||||
@ -530,7 +530,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (void) insertObjects: (NSArray *) objects
|
||||
atArrangedObjectIndexes: (NSIndexSet *) indices
|
||||
atArrangedObjectIndexes: (NSIndexSet *) indices
|
||||
{
|
||||
if (_flags.clearsFilterPredicateOnInsertion) {
|
||||
[self setFilterPredicate: nil];
|
||||
@ -677,8 +677,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat: @"<%@ %x> content: %@ arrangedObjects: %@",
|
||||
[self class], self, _content, _arrangedObjects];
|
||||
stringWithFormat: @"<%@ %x> content: %@ arrangedObjects: %@",
|
||||
[self class], self, _content, _arrangedObjects];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -36,11 +36,11 @@ BOOL NSIsControllerMarker(id object) {
|
||||
+ (void) initialize {
|
||||
if (self == [NSController class]) {
|
||||
NSNoSelectionMarker = [[_NSControllerMarker alloc]
|
||||
initWithString: @"NSNoSelectionMarker"];
|
||||
initWithString: @"NSNoSelectionMarker"];
|
||||
NSMultipleValuesMarker = [[_NSControllerMarker alloc]
|
||||
initWithString: @"NSMultipleValuesMarker"];
|
||||
initWithString: @"NSMultipleValuesMarker"];
|
||||
NSNotApplicableMarker = [[_NSControllerMarker alloc]
|
||||
initWithString: @"NSNotApplicableMarker"];
|
||||
initWithString: @"NSNotApplicableMarker"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (id) observableSelection {
|
||||
if (!_observableSelection)
|
||||
_observableSelection = [[_NSControllerArray alloc]
|
||||
initWithArray: [_controller selectedObjects]];
|
||||
initWithArray: [_controller selectedObjects]];
|
||||
return _observableSelection;
|
||||
}
|
||||
|
||||
@ -62,12 +62,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[_observableSelection release];
|
||||
|
||||
if ([_observationProxies count] > 0)
|
||||
[NSException
|
||||
raise: NSInvalidArgumentException
|
||||
format:
|
||||
@"NSControllerSelectionProxy still being observed by %@ on %@",
|
||||
[[_observationProxies objectAtIndex: 0] observer],
|
||||
[[_observationProxies objectAtIndex: 0] keyPath]];
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"NSControllerSelectionProxy still being observed "
|
||||
@"by %@ on %@",
|
||||
[[_observationProxies objectAtIndex: 0] observer],
|
||||
[[_observationProxies objectAtIndex: 0] keyPath]];
|
||||
|
||||
[_observationProxies release];
|
||||
[super dealloc];
|
||||
@ -79,10 +78,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSArray *selectedObjects = [_controller selectedObjects];
|
||||
for (id obj in selectedObjects) {
|
||||
[obj addObserver: self
|
||||
forKeyPath: key
|
||||
options: NSKeyValueObservingOptionOld |
|
||||
NSKeyValueObservingOptionNew
|
||||
context: nil];
|
||||
forKeyPath: key
|
||||
options: NSKeyValueObservingOptionOld |
|
||||
NSKeyValueObservingOptionNew
|
||||
context: nil];
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,7 +108,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
// Get all selected objects property values, swizzling nil values with
|
||||
// the nilMarker
|
||||
NSMutableArray *allValues =
|
||||
[NSMutableArray arrayWithCapacity: [selectedObjects count]];
|
||||
[NSMutableArray arrayWithCapacity: [selectedObjects count]];
|
||||
id en = [selectedObjects objectEnumerator];
|
||||
id obj;
|
||||
while ((obj = [en nextObject])) {
|
||||
@ -192,10 +191,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
for (id obj in selectedObjects) {
|
||||
for (id key in _cachedKeysForKVO) {
|
||||
[obj addObserver: self
|
||||
forKeyPath: key
|
||||
options: NSKeyValueObservingOptionOld |
|
||||
NSKeyValueObservingOptionNew
|
||||
context: nil];
|
||||
forKeyPath: key
|
||||
options: NSKeyValueObservingOptionOld |
|
||||
NSKeyValueObservingOptionNew
|
||||
context: nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -251,7 +250,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// Pass the change on up to those observing the proxy
|
||||
if ([[change objectForKey: NSKeyValueChangeNotificationIsPriorKey]
|
||||
boolValue] == YES) {
|
||||
boolValue] == YES) {
|
||||
[self willChangeValueForKey: keyPath];
|
||||
} else {
|
||||
[self didChangeValueForKey: keyPath];
|
||||
@ -264,9 +263,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
context: (void *) context
|
||||
{
|
||||
_NSObservationProxy *proxy =
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
[proxy setNotifyObject: YES];
|
||||
[_observationProxies addObject: proxy];
|
||||
|
||||
@ -282,9 +281,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
forKeyPath: (NSString *) keyPath
|
||||
{
|
||||
_NSObservationProxy *proxy =
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
NSInteger idx = [_observationProxies indexOfObject: proxy];
|
||||
if (idx == NSNotFound) {
|
||||
}
|
||||
@ -293,8 +292,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (idx != NSNotFound) {
|
||||
[[self observableSelection]
|
||||
removeObserver: [_observationProxies objectAtIndex: idx]
|
||||
forKeyPath: keyPath];
|
||||
removeObserver: [_observationProxies objectAtIndex: idx]
|
||||
forKeyPath: keyPath];
|
||||
[_observationProxies removeObjectAtIndex: idx];
|
||||
}
|
||||
}
|
||||
|
@ -71,9 +71,10 @@
|
||||
// NSDictionaryController has a default sort descriptor, NSArrayController
|
||||
// does not
|
||||
[self setSortDescriptors:
|
||||
[NSArray arrayWithObject: [NSSortDescriptor
|
||||
sortDescriptorWithKey: @"key"
|
||||
ascending: YES]]];
|
||||
[NSArray arrayWithObject:
|
||||
[NSSortDescriptor
|
||||
sortDescriptorWithKey: @"key"
|
||||
ascending: YES]]];
|
||||
_initialKey = @"key";
|
||||
_initialValue = @"value";
|
||||
return self;
|
||||
@ -86,9 +87,10 @@
|
||||
_includedKeys = [[coder decodeObjectForKey: @"NSIncludedKeys"] retain];
|
||||
_excludedKeys = [[coder decodeObjectForKey: @"NSExcludedKeys"] retain];
|
||||
[self setSortDescriptors:
|
||||
[NSArray arrayWithObject: [NSSortDescriptor
|
||||
sortDescriptorWithKey: @"key"
|
||||
ascending: YES]]];
|
||||
[NSArray arrayWithObject:
|
||||
[NSSortDescriptor
|
||||
sortDescriptorWithKey: @"key"
|
||||
ascending: YES]]];
|
||||
_initialKey = @"key";
|
||||
_initialValue = @"value";
|
||||
|
||||
@ -132,7 +134,7 @@
|
||||
for (id key in [_contentDictionary allKeys]) {
|
||||
if (![_excludedKeys containsObject: key]) {
|
||||
NSDictionaryControllerProxy *proxy =
|
||||
[NSDictionaryControllerProxy new];
|
||||
[NSDictionaryControllerProxy new];
|
||||
proxy.key = key;
|
||||
proxy.dictionary = _contentDictionary;
|
||||
[contentArray addObject: proxy];
|
||||
|
@ -33,19 +33,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
@implementation NSObjectController
|
||||
+ (void) initialize {
|
||||
[self setKeys: [NSArray arrayWithObjects: @"editable", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"canAdd"];
|
||||
triggerChangeNotificationsForDependentKey: @"canAdd"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"editable", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"canInsert"];
|
||||
triggerChangeNotificationsForDependentKey: @"canInsert"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"editable", @"selection", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"canRemove"];
|
||||
triggerChangeNotificationsForDependentKey: @"canRemove"];
|
||||
[self setKeys: [NSArray arrayWithObjects: @"content", nil]
|
||||
triggerChangeNotificationsForDependentKey: @"contentObject"];
|
||||
triggerChangeNotificationsForDependentKey: @"contentObject"];
|
||||
}
|
||||
|
||||
- (id) init {
|
||||
if ((self = [super init])) {
|
||||
_selection =
|
||||
[[NSControllerSelectionProxy alloc] initWithController: self];
|
||||
[[NSControllerSelectionProxy alloc] initWithController: self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@ -59,7 +59,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
_observedKeys = [[NSCountedSet alloc] init];
|
||||
_selection =
|
||||
[[NSControllerSelectionProxy alloc] initWithController: self];
|
||||
[[NSControllerSelectionProxy alloc] initWithController: self];
|
||||
}
|
||||
|
||||
return self;
|
||||
@ -69,17 +69,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
if ((self = [super init])) {
|
||||
|
||||
_objectClassName =
|
||||
[[coder decodeObjectForKey: @"NSObjectClassName"] copy];
|
||||
[[coder decodeObjectForKey: @"NSObjectClassName"] copy];
|
||||
if (_objectClassName == nil)
|
||||
_objectClassName = @"NSMutableDictionary";
|
||||
|
||||
_editable = [coder decodeBoolForKey: @"NSEditable"];
|
||||
_automaticallyPreparesContent =
|
||||
[coder decodeBoolForKey: @"NSAutomaticallyPreparesContent"];
|
||||
[coder decodeBoolForKey: @"NSAutomaticallyPreparesContent"];
|
||||
|
||||
_observedKeys = [[NSCountedSet alloc] init];
|
||||
_selection =
|
||||
[[NSControllerSelectionProxy alloc] initWithController: self];
|
||||
[[NSControllerSelectionProxy alloc] initWithController: self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -101,8 +101,8 @@ void NSStringKVCSplitOnDot(NSString *self, NSString **before, NSString **after)
|
||||
}
|
||||
|
||||
- (NSString *) description {
|
||||
return
|
||||
[NSString stringWithFormat: @"observation proxy for %@ on key path %@",
|
||||
_observer, _keyPath];
|
||||
return [NSString
|
||||
stringWithFormat: @"observation proxy for %@ on key path %@",
|
||||
_observer, _keyPath];
|
||||
}
|
||||
@end
|
||||
|
@ -38,7 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- initWithDefaults: (NSUserDefaults *) defaults
|
||||
initialValues: (NSDictionary *) values
|
||||
initialValues: (NSDictionary *) values
|
||||
{
|
||||
if (defaults == nil)
|
||||
defaults = [NSUserDefaults standardUserDefaults];
|
||||
@ -47,7 +47,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_initialValues = [values copy];
|
||||
_appliesImmediately = YES;
|
||||
_valueProxy =
|
||||
[[NSUserDefaultsControllerProxy alloc] initWithController: self];
|
||||
[[NSUserDefaultsControllerProxy alloc] initWithController: self];
|
||||
|
||||
return self;
|
||||
}
|
||||
@ -99,7 +99,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
// Be sure to retain the shared object - the caller must be able to
|
||||
// call release on it when done
|
||||
self = [[NSUserDefaultsController sharedUserDefaultsController]
|
||||
retain];
|
||||
retain];
|
||||
} else {
|
||||
self = [self init];
|
||||
}
|
||||
|
@ -22,10 +22,10 @@
|
||||
_controller = controller;
|
||||
_cachedValues = [NSMutableDictionary new];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(userDefaultsDidChange:)
|
||||
name: NSUserDefaultsDidChangeNotification
|
||||
object: [_controller defaults]];
|
||||
addObserver: self
|
||||
selector: @selector(userDefaultsDidChange:)
|
||||
name: NSUserDefaultsDidChangeNotification
|
||||
object: [_controller defaults]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -28,10 +28,10 @@
|
||||
- (void) dealloc {
|
||||
if ([_observationProxies count] > 0)
|
||||
[NSException
|
||||
raise: NSInvalidArgumentException
|
||||
format: @"_NSControllerArray still being observed by %@ on %@",
|
||||
[[_observationProxies objectAtIndex: 0] observer],
|
||||
[[_observationProxies objectAtIndex: 0] keyPath]];
|
||||
raise: NSInvalidArgumentException
|
||||
format: @"_NSControllerArray still being observed by %@ on %@",
|
||||
[[_observationProxies objectAtIndex: 0] observer],
|
||||
[[_observationProxies objectAtIndex: 0] keyPath]];
|
||||
|
||||
[_observationProxies release];
|
||||
[_array release];
|
||||
@ -46,9 +46,9 @@
|
||||
{
|
||||
// init the proxy
|
||||
_NSObservationProxy *proxy =
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
|
||||
proxy->_options = options;
|
||||
proxy->_context = context;
|
||||
@ -61,7 +61,7 @@
|
||||
idxs = _roi;
|
||||
else
|
||||
idxs = [NSIndexSet
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
|
||||
// is this an operator?
|
||||
if ([keyPath hasPrefix: @"@"]) {
|
||||
@ -78,25 +78,25 @@
|
||||
// for that path
|
||||
keyPath = rest;
|
||||
idxs = [NSIndexSet
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
}
|
||||
|
||||
// add observer proxy for all relevant indexes
|
||||
if ([_array count] && keyPath) {
|
||||
[_array addObserver: proxy
|
||||
toObjectsAtIndexes: idxs
|
||||
forKeyPath: keyPath
|
||||
options: options
|
||||
context: context];
|
||||
toObjectsAtIndexes: idxs
|
||||
forKeyPath: keyPath
|
||||
options: options
|
||||
context: context];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) removeObserver: (id) observer forKeyPath: (NSString *) keyPath {
|
||||
// find the proxy again
|
||||
_NSObservationProxy *proxy =
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
[[_NSObservationProxy alloc] initWithKeyPath: keyPath
|
||||
observer: observer
|
||||
object: self];
|
||||
int idx = [_observationProxies indexOfObject: proxy];
|
||||
[proxy release];
|
||||
proxy = [[[_observationProxies objectAtIndex: idx] retain] autorelease];
|
||||
@ -109,7 +109,7 @@
|
||||
idxs = _roi;
|
||||
else
|
||||
idxs = [NSIndexSet
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
|
||||
// operator?
|
||||
if ([keyPath hasPrefix: @"@"]) {
|
||||
@ -121,12 +121,12 @@
|
||||
// remove dependent key path from all children
|
||||
keyPath = rest;
|
||||
idxs = [NSIndexSet
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
indexSetWithIndexesInRange: NSMakeRange(0, [_array count])];
|
||||
}
|
||||
if ([_array count] && keyPath) {
|
||||
[_array removeObserver: proxy
|
||||
fromObjectsAtIndexes: idxs
|
||||
forKeyPath: keyPath];
|
||||
fromObjectsAtIndexes: idxs
|
||||
forKeyPath: keyPath];
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,15 +144,15 @@
|
||||
// if dependencies: observe these in any case
|
||||
if (rest)
|
||||
[obj addObserver: proxy
|
||||
forKeyPath: rest
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
forKeyPath: rest
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
} else if (!_roi) {
|
||||
// only observe if no ROI
|
||||
[obj addObserver: proxy
|
||||
forKeyPath: keyPath
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
forKeyPath: keyPath
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -222,18 +222,18 @@
|
||||
[old removeObserver: proxy forKeyPath: [proxy keyPath]];
|
||||
|
||||
[obj addObserver: proxy
|
||||
forKeyPath: rest
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
forKeyPath: rest
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
}
|
||||
} else {
|
||||
if (!_roi || [_roi containsIndex: idx]) {
|
||||
[old removeObserver: proxy forKeyPath: [proxy keyPath]];
|
||||
|
||||
[obj addObserver: proxy
|
||||
forKeyPath: [proxy keyPath]
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
forKeyPath: [proxy keyPath]
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -262,9 +262,9 @@
|
||||
|
||||
for (_NSObservationProxy *proxy in proxies) {
|
||||
[self addObserver: [proxy observer]
|
||||
forKeyPath: [proxy keyPath]
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
forKeyPath: [proxy keyPath]
|
||||
options: [proxy options]
|
||||
context: [proxy context]];
|
||||
}
|
||||
|
||||
[proxies release];
|
||||
|
@ -44,14 +44,14 @@ id NSPlatformCreateCursorImpWithImage(NSImage *image, NSPoint hotSpot) {
|
||||
|
||||
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
|
||||
CGContextRef context = CGBitmapContextCreate(
|
||||
NULL, width, height, 8, 0, colorSpace,
|
||||
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little);
|
||||
NULL, width, height, 8, 0, colorSpace,
|
||||
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little);
|
||||
CGColorSpaceRelease(colorSpace);
|
||||
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSGraphicsContext *graphicsContext =
|
||||
[NSGraphicsContext graphicsContextWithGraphicsPort: context
|
||||
flipped: NO];
|
||||
[NSGraphicsContext graphicsContextWithGraphicsPort: context
|
||||
flipped: NO];
|
||||
|
||||
[NSGraphicsContext saveGraphicsState];
|
||||
[NSGraphicsContext setCurrentContext: graphicsContext];
|
||||
@ -372,9 +372,9 @@ static NSMutableArray *_cursorStack = nil;
|
||||
}
|
||||
|
||||
- initWithImage: (NSImage *) image
|
||||
foregroundColorHint: (NSColor *) foregroundHint
|
||||
backgroundColorHint: (NSColor *) backgroundHint
|
||||
hotSpot: (NSPoint) hotSpot
|
||||
foregroundColorHint: (NSColor *) foregroundHint
|
||||
backgroundColorHint: (NSColor *) backgroundHint
|
||||
hotSpot: (NSPoint) hotSpot
|
||||
{
|
||||
// the hints are unused per doc.s
|
||||
return [self initWithImage: image hotSpot: hotSpot];
|
||||
|
@ -201,8 +201,8 @@ static void drawRoundedSelection(NSRect rect) {
|
||||
|
||||
- (NSArray *) _attributedStrings {
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
NSMutableParagraphStyle *style =
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
||||
NSMutableParagraphStyle *style = [[[NSParagraphStyle defaultParagraphStyle]
|
||||
mutableCopy] autorelease];
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||
NSMutableDictionary *separatorAttributes;
|
||||
|
||||
@ -221,72 +221,76 @@ static void drawRoundedSelection(NSRect rect) {
|
||||
if ((_elements & NSYearMonthDayDatePickerElementFlag) ==
|
||||
NSYearMonthDayDatePickerElementFlag) {
|
||||
NSUInteger flags =
|
||||
NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
|
||||
NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
|
||||
NSDateComponents *components = [_calendar components: flags
|
||||
fromDate: [self dateValue]];
|
||||
|
||||
NSString *month =
|
||||
[NSString stringWithFormat: @"%d", [components month]];
|
||||
[NSString stringWithFormat: @"%d", [components month]];
|
||||
NSString *day = [NSString stringWithFormat: @"%d", [components day]];
|
||||
NSString *year = [NSString stringWithFormat: @"%d", [components year]];
|
||||
|
||||
[attributes
|
||||
setObject: [NSNumber numberWithUnsignedInteger: [components month]]
|
||||
forKey: @"_value"];
|
||||
setObject: [NSNumber numberWithUnsignedInteger: [components
|
||||
month]]
|
||||
forKey: @"_value"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger: 1]
|
||||
forKey: @"_min"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger: 12]
|
||||
forKey: @"_max"];
|
||||
[attributes
|
||||
setObject: [NSNumber numberWithUnsignedInteger: NSMonthCalendarUnit]
|
||||
forKey: @"_unit"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger:
|
||||
NSMonthCalendarUnit]
|
||||
forKey: @"_unit"];
|
||||
[attributes setObject: [NSNumber numberWithFloat: digitWidth * 2]
|
||||
forKey: @"_width"];
|
||||
[result addObject: [[[NSAttributedString alloc]
|
||||
initWithString: month
|
||||
attributes: attributes] autorelease]];
|
||||
initWithString: month
|
||||
attributes: attributes] autorelease]];
|
||||
|
||||
[result
|
||||
addObject: [[[NSAttributedString alloc]
|
||||
initWithString: @"/"
|
||||
attributes: separatorAttributes] autorelease]];
|
||||
[result addObject: [[[NSAttributedString alloc]
|
||||
initWithString: @"/"
|
||||
attributes: separatorAttributes]
|
||||
autorelease]];
|
||||
|
||||
[attributes
|
||||
setObject: [NSNumber numberWithUnsignedInteger: [components day]]
|
||||
forKey: @"_value"];
|
||||
setObject: [NSNumber
|
||||
numberWithUnsignedInteger: [components day]]
|
||||
forKey: @"_value"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger: 1]
|
||||
forKey: @"_min"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger: 31]
|
||||
forKey: @"_max"];
|
||||
[attributes
|
||||
setObject: [NSNumber numberWithUnsignedInteger: NSDayCalendarUnit]
|
||||
forKey: @"_unit"];
|
||||
setObject: [NSNumber
|
||||
numberWithUnsignedInteger: NSDayCalendarUnit]
|
||||
forKey: @"_unit"];
|
||||
[attributes setObject: [NSNumber numberWithFloat: digitWidth * 2]
|
||||
forKey: @"_width"];
|
||||
[result addObject: [[[NSAttributedString alloc]
|
||||
initWithString: day
|
||||
attributes: attributes] autorelease]];
|
||||
initWithString: day
|
||||
attributes: attributes] autorelease]];
|
||||
|
||||
[result
|
||||
addObject: [[[NSAttributedString alloc]
|
||||
initWithString: @"/"
|
||||
attributes: separatorAttributes] autorelease]];
|
||||
[result addObject: [[[NSAttributedString alloc]
|
||||
initWithString: @"/"
|
||||
attributes: separatorAttributes]
|
||||
autorelease]];
|
||||
|
||||
[attributes
|
||||
setObject: [NSNumber numberWithUnsignedInteger: [components year]]
|
||||
forKey: @"_value"];
|
||||
setObject: [NSNumber
|
||||
numberWithUnsignedInteger: [components year]]
|
||||
forKey: @"_value"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger: 0]
|
||||
forKey: @"_min"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger: 9999]
|
||||
forKey: @"_max"];
|
||||
[attributes
|
||||
setObject: [NSNumber numberWithUnsignedInteger: NSYearCalendarUnit]
|
||||
forKey: @"_unit"];
|
||||
[attributes setObject: [NSNumber numberWithUnsignedInteger:
|
||||
NSYearCalendarUnit]
|
||||
forKey: @"_unit"];
|
||||
[attributes setObject: [NSNumber numberWithFloat: digitWidth * 4]
|
||||
forKey: @"_width"];
|
||||
[result addObject: [[[NSAttributedString alloc]
|
||||
initWithString: year
|
||||
attributes: attributes] autorelease]];
|
||||
initWithString: year
|
||||
attributes: attributes] autorelease]];
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -370,24 +374,24 @@ static void getRectsInFrameForAttributesStrings(NSRect *rects, NSRect frame,
|
||||
NSArray *array = [self _attributedStrings];
|
||||
NSInteger i, count = [array count];
|
||||
NSDateComponents *components =
|
||||
[[[NSDateComponents alloc] init] autorelease];
|
||||
[[[NSDateComponents alloc] init] autorelease];
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
NSAttributedString *string = [array objectAtIndex: i];
|
||||
NSDictionary *attributes = [string attributesAtIndex: 0
|
||||
effectiveRange: NULL];
|
||||
NSUInteger unit =
|
||||
[[attributes objectForKey: @"_unit"] unsignedIntegerValue];
|
||||
[[attributes objectForKey: @"_unit"] unsignedIntegerValue];
|
||||
|
||||
if (unit == 0)
|
||||
continue;
|
||||
|
||||
NSUInteger value =
|
||||
[[attributes objectForKey: @"_value"] unsignedIntegerValue];
|
||||
[[attributes objectForKey: @"_value"] unsignedIntegerValue];
|
||||
NSUInteger min =
|
||||
[[attributes objectForKey: @"_min"] unsignedIntegerValue];
|
||||
[[attributes objectForKey: @"_min"] unsignedIntegerValue];
|
||||
NSUInteger max =
|
||||
[[attributes objectForKey: @"_max"] unsignedIntegerValue];
|
||||
[[attributes objectForKey: @"_max"] unsignedIntegerValue];
|
||||
|
||||
if (unit == _selectedUnit) {
|
||||
value *= multiply;
|
||||
@ -444,17 +448,19 @@ static void getRectsInFrameForAttributesStrings(NSRect *rects, NSRect frame,
|
||||
[self drawInteriorWithFrame: frame inView: view];
|
||||
|
||||
[[_controlView graphicsStyle]
|
||||
drawStepperButtonInRect: [self _upArrowFrameForStepperFrame: stepper]
|
||||
clipRect: stepper
|
||||
enabled: [self isEnabled]
|
||||
highlighted: _isUpHighlighted
|
||||
upNotDown: YES];
|
||||
drawStepperButtonInRect:
|
||||
[self _upArrowFrameForStepperFrame: stepper]
|
||||
clipRect: stepper
|
||||
enabled: [self isEnabled]
|
||||
highlighted: _isUpHighlighted
|
||||
upNotDown: YES];
|
||||
[[_controlView graphicsStyle]
|
||||
drawStepperButtonInRect: [self _downArrowFrameForStepperFrame: stepper]
|
||||
clipRect: stepper
|
||||
enabled: [self isEnabled]
|
||||
highlighted: _isDownHighlighted
|
||||
upNotDown: NO];
|
||||
drawStepperButtonInRect:
|
||||
[self _downArrowFrameForStepperFrame: stepper]
|
||||
clipRect: stepper
|
||||
enabled: [self isEnabled]
|
||||
highlighted: _isDownHighlighted
|
||||
upNotDown: NO];
|
||||
}
|
||||
|
||||
- (void) selectComponentUnderPoint: (NSPoint) point inView: (NSView *) view {
|
||||
@ -472,7 +478,7 @@ static void getRectsInFrameForAttributesStrings(NSRect *rects, NSRect frame,
|
||||
NSDictionary *attributes = [string attributesAtIndex: 0
|
||||
effectiveRange: NULL];
|
||||
NSUInteger unit =
|
||||
[[attributes objectForKey: @"_unit"] unsignedIntegerValue];
|
||||
[[attributes objectForKey: @"_unit"] unsignedIntegerValue];
|
||||
|
||||
if (unit != 0) {
|
||||
_selectedUnit = unit;
|
||||
|
@ -33,7 +33,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSDictionary *modifierMapping = @{@"NSModifierFlagMapping" : map};
|
||||
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
registerDefaults: modifierMapping];
|
||||
registerDefaults: modifierMapping];
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,11 +83,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
// None of the backends can be used.
|
||||
[NSException
|
||||
raise: NSWindowServerCommunicationException
|
||||
format:
|
||||
@"Failed to connect to a window server. Available backends are: %@",
|
||||
backends];
|
||||
[NSException raise: NSWindowServerCommunicationException
|
||||
format: @"Failed to connect to a window server. Available "
|
||||
@"backends are: %@",
|
||||
backends];
|
||||
|
||||
[backends release];
|
||||
return nil;
|
||||
@ -225,7 +224,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
standard: (NSEventModifierFlags) standard
|
||||
{
|
||||
NSDictionary *modmap = [[NSUserDefaults standardUserDefaults]
|
||||
dictionaryForKey: @"NSModifierFlagMapping"];
|
||||
dictionaryForKey: @"NSModifierFlagMapping"];
|
||||
NSString *remap = modmap[key];
|
||||
|
||||
if ([remap isEqualToString: @"Command"])
|
||||
@ -263,7 +262,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (int) runModalPrintPanelWithPrintInfoDictionary:
|
||||
(NSMutableDictionary *) attributes
|
||||
(NSMutableDictionary *) attributes
|
||||
{
|
||||
NSInvalidAbstractInvocation();
|
||||
return 0;
|
||||
@ -271,7 +270,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (CGContextRef) graphicsPortForPrintOperationWithView: (NSView *) view
|
||||
printInfo:
|
||||
(NSPrintInfo *) printInfo
|
||||
(NSPrintInfo *) printInfo
|
||||
pageRange: (NSRange) pageRange
|
||||
{
|
||||
NSInvalidAbstractInvocation();
|
||||
@ -283,17 +282,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (int) savePanel: (NSSavePanel *) savePanel
|
||||
runModalForDirectory: (NSString *) directory
|
||||
file: (NSString *) file
|
||||
runModalForDirectory: (NSString *) directory
|
||||
file: (NSString *) file
|
||||
{
|
||||
NSInvalidAbstractInvocation();
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (int) openPanel: (NSOpenPanel *) openPanel
|
||||
runModalForDirectory: (NSString *) directory
|
||||
file: (NSString *) file
|
||||
types: (NSArray *) types
|
||||
runModalForDirectory: (NSString *) directory
|
||||
file: (NSString *) file
|
||||
types: (NSArray *) types
|
||||
{
|
||||
NSInvalidAbstractInvocation();
|
||||
return 0;
|
||||
@ -315,14 +314,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (CGRect) insetRect: (CGRect) frame
|
||||
forNativeWindowBorderWithStyle: (NSUInteger) styleMask
|
||||
forNativeWindowBorderWithStyle: (NSUInteger) styleMask
|
||||
{
|
||||
NSInvalidAbstractInvocation();
|
||||
return frame;
|
||||
}
|
||||
|
||||
- (CGRect) outsetRect: (CGRect) frame
|
||||
forNativeWindowBorderWithStyle: (NSUInteger) styleMask
|
||||
forNativeWindowBorderWithStyle: (NSUInteger) styleMask
|
||||
{
|
||||
NSInvalidAbstractInvocation();
|
||||
return frame;
|
||||
|
@ -37,13 +37,13 @@ static int untitled_document_number = 0;
|
||||
|
||||
+ (NSArray *) readableTypes {
|
||||
NSArray *knownDocTypes =
|
||||
[[NSBundle mainBundle] infoDictionary][@"CFBundleDocumentTypes"];
|
||||
[[NSBundle mainBundle] infoDictionary][@"CFBundleDocumentTypes"];
|
||||
NSMutableArray *readableTypes = [NSMutableArray array];
|
||||
|
||||
for (NSDictionary *typeDict in knownDocTypes) {
|
||||
NSString *typeRole = typeDict[@"CFBundleTypeRole"];
|
||||
Class documentClass =
|
||||
NSClassFromString((NSString *) typeDict[@"NSDocumentClass"]);
|
||||
NSClassFromString((NSString *) typeDict[@"NSDocumentClass"]);
|
||||
if (documentClass == self && ([typeRole isEqualToString: @"Viewer"] ||
|
||||
[typeRole isEqualToString: @"Editor"])) {
|
||||
NSString *typeName = typeDict[@"CFBundleTypeName"];
|
||||
@ -57,13 +57,13 @@ static int untitled_document_number = 0;
|
||||
|
||||
+ (NSArray *) writableTypes {
|
||||
NSArray *knownDocTypes =
|
||||
[[NSBundle mainBundle] infoDictionary][@"CFBundleDocumentTypes"];
|
||||
[[NSBundle mainBundle] infoDictionary][@"CFBundleDocumentTypes"];
|
||||
NSMutableArray *writableTypes = [NSMutableArray array];
|
||||
|
||||
for (NSDictionary *typeDict in knownDocTypes) {
|
||||
NSString *typeRole = typeDict[@"CFBundleTypeRole"];
|
||||
Class documentClass =
|
||||
NSClassFromString((NSString *) typeDict[@"NSDocumentClass"]);
|
||||
NSClassFromString((NSString *) typeDict[@"NSDocumentClass"]);
|
||||
if (documentClass == self && [typeRole isEqualToString: @"Editor"]) {
|
||||
NSString *typeName = typeDict[@"CFBundleTypeName"];
|
||||
if (typeName)
|
||||
@ -77,13 +77,13 @@ static int untitled_document_number = 0;
|
||||
+ (BOOL) isNativeType: (NSString *) type {
|
||||
BOOL result = NO;
|
||||
NSArray *knownDocTypes =
|
||||
[[NSBundle mainBundle] infoDictionary][@"CFBundleDocumentTypes"];
|
||||
[[NSBundle mainBundle] infoDictionary][@"CFBundleDocumentTypes"];
|
||||
|
||||
for (NSDictionary *typeDict in knownDocTypes) {
|
||||
NSString *typeRole = typeDict[@"CFBundleTypeRole"];
|
||||
NSString *typeName = typeDict[@"CFBundleTypeName"];
|
||||
Class documentClass =
|
||||
NSClassFromString((NSString *) typeDict[@"NSDocumentClass"]);
|
||||
NSClassFromString((NSString *) typeDict[@"NSDocumentClass"]);
|
||||
result |= documentClass == self &&
|
||||
[typeRole isEqualToString: @"Editor"] &&
|
||||
[typeName isEqualToString: type];
|
||||
@ -255,17 +255,17 @@ static int untitled_document_number = 0;
|
||||
- (void) setUndoManager: (NSUndoManager *) undoManager {
|
||||
if (_undoManager != nil) {
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSUndoManagerDidUndoChangeNotification
|
||||
object: _undoManager];
|
||||
removeObserver: self
|
||||
name: NSUndoManagerDidUndoChangeNotification
|
||||
object: _undoManager];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSUndoManagerDidRedoChangeNotification
|
||||
object: _undoManager];
|
||||
removeObserver: self
|
||||
name: NSUndoManagerDidRedoChangeNotification
|
||||
object: _undoManager];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
removeObserver: self
|
||||
name: NSUndoManagerWillCloseUndoGroupNotification
|
||||
object: _undoManager];
|
||||
removeObserver: self
|
||||
name: NSUndoManagerWillCloseUndoGroupNotification
|
||||
object: _undoManager];
|
||||
[_undoManager release];
|
||||
}
|
||||
|
||||
@ -274,20 +274,20 @@ static int untitled_document_number = 0;
|
||||
if (undoManager) {
|
||||
// Only add observers if we have an undoManager we're concerned about
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_undoManagerDidUndoChange:)
|
||||
name: NSUndoManagerDidUndoChangeNotification
|
||||
object: _undoManager];
|
||||
addObserver: self
|
||||
selector: @selector(_undoManagerDidUndoChange:)
|
||||
name: NSUndoManagerDidUndoChangeNotification
|
||||
object: _undoManager];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_undoManagerDidRedoChange:)
|
||||
name: NSUndoManagerDidRedoChangeNotification
|
||||
object: _undoManager];
|
||||
addObserver: self
|
||||
selector: @selector(_undoManagerDidRedoChange:)
|
||||
name: NSUndoManagerDidRedoChangeNotification
|
||||
object: _undoManager];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_undoManagerDidCloseGroup:)
|
||||
name: NSUndoManagerWillCloseUndoGroupNotification
|
||||
object: _undoManager];
|
||||
addObserver: self
|
||||
selector: @selector(_undoManagerDidCloseGroup:)
|
||||
name: NSUndoManagerWillCloseUndoGroupNotification
|
||||
object: _undoManager];
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,8 +339,8 @@ static int untitled_document_number = 0;
|
||||
|
||||
if (nibName != nil) {
|
||||
NSWindowController *controller = [[[NSWindowController alloc]
|
||||
initWithWindowNibName: nibName
|
||||
owner: self] autorelease];
|
||||
initWithWindowNibName: nibName
|
||||
owner: self] autorelease];
|
||||
|
||||
[self addWindowController: controller];
|
||||
}
|
||||
@ -364,16 +364,16 @@ static int untitled_document_number = 0;
|
||||
- (NSString *) displayName {
|
||||
if (_fileURL == nil) {
|
||||
NSString *untitledName = NSLocalizedStringFromTableInBundle(
|
||||
@"Untitled", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@"The name of a untitled document");
|
||||
@"Untitled", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@"The name of a untitled document");
|
||||
if (_untitledNumber != 0)
|
||||
return [NSString
|
||||
stringWithFormat: @"%@ %d", untitledName, _untitledNumber];
|
||||
stringWithFormat: @"%@ %d", untitledName, _untitledNumber];
|
||||
else
|
||||
return untitledName;
|
||||
} else {
|
||||
return
|
||||
[[NSFileManager defaultManager] displayNameAtPath: [_fileURL path]];
|
||||
return [[NSFileManager defaultManager]
|
||||
displayNameAtPath: [_fileURL path]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -455,8 +455,8 @@ static int untitled_document_number = 0;
|
||||
if ([self _isSelectorOverridden: @selector(readFromFile:ofType:)]) {
|
||||
return [self readFromFile: [url path] ofType: type];
|
||||
} else {
|
||||
NSFileWrapper *fileWrapper =
|
||||
[[[NSFileWrapper alloc] initWithPath: [url path]] autorelease];
|
||||
NSFileWrapper *fileWrapper = [[[NSFileWrapper alloc]
|
||||
initWithPath: [url path]] autorelease];
|
||||
|
||||
return [self readFromFileWrapper: fileWrapper
|
||||
ofType: type
|
||||
@ -490,8 +490,8 @@ static int untitled_document_number = 0;
|
||||
- (NSFileWrapper *) fileWrapperOfType: (NSString *) type
|
||||
error: (NSError **) error
|
||||
{
|
||||
if ([self
|
||||
_isSelectorOverridden: @selector(fileWrapperRepresentationOfType:)])
|
||||
if ([self _isSelectorOverridden: @selector
|
||||
(fileWrapperRepresentationOfType:)])
|
||||
return [self fileWrapperRepresentationOfType: type];
|
||||
else {
|
||||
NSData *data = [self dataOfType: type error: error];
|
||||
@ -500,7 +500,7 @@ static int untitled_document_number = 0;
|
||||
return nil;
|
||||
|
||||
return [[[NSFileWrapper alloc] initRegularFileWithContents: data]
|
||||
autorelease];
|
||||
autorelease];
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,8 +517,8 @@ static int untitled_document_number = 0;
|
||||
return NO;
|
||||
|
||||
if (![wrapper writeToFile: [url path]
|
||||
atomically: YES
|
||||
updateFilenames: YES])
|
||||
atomically: YES
|
||||
updateFilenames: YES])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
@ -526,14 +526,14 @@ static int untitled_document_number = 0;
|
||||
}
|
||||
|
||||
- (BOOL) writeToURL: (NSURL *) url
|
||||
ofType: (NSString *) type
|
||||
forSaveOperation: (NSSaveOperationType) operation
|
||||
originalContentsURL: (NSURL *) contentsURL
|
||||
error: (NSError **) error
|
||||
ofType: (NSString *) type
|
||||
forSaveOperation: (NSSaveOperationType) operation
|
||||
originalContentsURL: (NSURL *) contentsURL
|
||||
error: (NSError **) error
|
||||
{
|
||||
BOOL status = NO;
|
||||
if ([self _isSelectorOverridden: @selector
|
||||
(writeToFile:ofType:originalFile:saveOperation:)]) {
|
||||
(writeToFile:ofType:originalFile:saveOperation:)]) {
|
||||
status = [self writeToFile: [url path]
|
||||
ofType: type
|
||||
originalFile: [contentsURL path]
|
||||
@ -545,7 +545,7 @@ static int untitled_document_number = 0;
|
||||
// It's a new file that's been successfully saved to a url...
|
||||
// so note it for the open recent menu
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
noteNewRecentDocumentURL: url];
|
||||
noteNewRecentDocumentURL: url];
|
||||
}
|
||||
return status;
|
||||
}
|
||||
@ -556,10 +556,10 @@ static int untitled_document_number = 0;
|
||||
error: (NSError **) error
|
||||
{
|
||||
if (![self writeToURL: url
|
||||
ofType: type
|
||||
forSaveOperation: operation
|
||||
originalContentsURL: url
|
||||
error: error])
|
||||
ofType: type
|
||||
forSaveOperation: operation
|
||||
originalContentsURL: url
|
||||
error: error])
|
||||
return NO;
|
||||
|
||||
NSDictionary *attributes = [self fileAttributesToWriteToURL: url
|
||||
@ -597,10 +597,10 @@ static int untitled_document_number = 0;
|
||||
NSError *error;
|
||||
|
||||
if (![self writeToURL: [self autosavedContentsFileURL]
|
||||
ofType: [self autosavingFileType]
|
||||
forSaveOperation: NSAutosaveOperation
|
||||
originalContentsURL: [self fileURL]
|
||||
error: &error]) {
|
||||
ofType: [self autosavingFileType]
|
||||
forSaveOperation: NSAutosaveOperation
|
||||
originalContentsURL: [self fileURL]
|
||||
error: &error]) {
|
||||
}
|
||||
|
||||
NSUnimplementedMethod();
|
||||
@ -613,21 +613,21 @@ static int untitled_document_number = 0;
|
||||
|
||||
- (BOOL) presentError: (NSError *) error {
|
||||
return [[NSDocumentController sharedDocumentController]
|
||||
presentError: [self willPresentError: error]];
|
||||
presentError: [self willPresentError: error]];
|
||||
}
|
||||
|
||||
- (void) presentError: (NSError *) error
|
||||
modalForWindow: (NSWindow *) window
|
||||
delegate: delegate
|
||||
didPresentSelector: (SEL) selector
|
||||
contextInfo: (void *) info
|
||||
modalForWindow: (NSWindow *) window
|
||||
delegate: delegate
|
||||
didPresentSelector: (SEL) selector
|
||||
contextInfo: (void *) info
|
||||
{
|
||||
[[NSDocumentController sharedDocumentController]
|
||||
presentError: [self willPresentError: error]
|
||||
modalForWindow: window
|
||||
delegate: delegate
|
||||
didPresentSelector: selector
|
||||
contextInfo: info];
|
||||
presentError: [self willPresentError: error]
|
||||
modalForWindow: window
|
||||
delegate: delegate
|
||||
didPresentSelector: selector
|
||||
contextInfo: info];
|
||||
}
|
||||
|
||||
- (NSArray *) writableTypesForSaveOperation: (NSSaveOperationType) operation {
|
||||
@ -676,7 +676,7 @@ static int untitled_document_number = 0;
|
||||
NSString *extension = [path pathExtension];
|
||||
if ([extension length] == 0) {
|
||||
extension = [[[NSDocumentController sharedDocumentController]
|
||||
fileExtensionsFromType: [self fileType]] objectAtIndex: 0];
|
||||
fileExtensionsFromType: [self fileType]] objectAtIndex: 0];
|
||||
}
|
||||
NSSavePanel *savePanel = [NSSavePanel savePanel];
|
||||
[savePanel setRequiredFileType: extension];
|
||||
@ -697,14 +697,14 @@ static int untitled_document_number = 0;
|
||||
if (_fileURL) {
|
||||
// Suggest saving alongside the original file
|
||||
saveResult = [savePanel
|
||||
runModalForDirectory: [path stringByDeletingLastPathComponent]
|
||||
file: [path lastPathComponent]];
|
||||
runModalForDirectory: [path stringByDeletingLastPathComponent]
|
||||
file: [path lastPathComponent]];
|
||||
} else {
|
||||
NSString *directory = [savePanel directory];
|
||||
if (directory == nil) {
|
||||
// Suggest saving in some reasonable directory
|
||||
directory = [[NSDocumentController sharedDocumentController]
|
||||
currentDirectory];
|
||||
currentDirectory];
|
||||
}
|
||||
saveResult = [savePanel runModalForDirectory: directory
|
||||
file: [self displayName]];
|
||||
@ -713,29 +713,30 @@ static int untitled_document_number = 0;
|
||||
NSString *savePath = [savePanel filename];
|
||||
NSString *extension = [savePath pathExtension];
|
||||
NSString *fileType = [[NSDocumentController sharedDocumentController]
|
||||
typeFromFileExtension: extension];
|
||||
typeFromFileExtension: extension];
|
||||
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: [savePath stringByDeletingLastPathComponent]
|
||||
forKey: @"NSNavLastRootDirectory"];
|
||||
setObject: [savePath stringByDeletingLastPathComponent]
|
||||
forKey: @"NSNavLastRootDirectory"];
|
||||
|
||||
// Try the various saving methods that can be implemented by the
|
||||
// document subclass
|
||||
if ([self _isSelectorOverridden: @selector
|
||||
(saveToFile:
|
||||
saveOperation:delegate:didSaveSelector:contextInfo:)]) {
|
||||
(saveToFile:
|
||||
saveOperation:delegate:didSaveSelector:contextInfo
|
||||
:)]) {
|
||||
[self saveToFile: savePath
|
||||
saveOperation: operation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: context];
|
||||
saveOperation: operation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: context];
|
||||
} else {
|
||||
[self saveToURL: [savePanel URL]
|
||||
ofType: fileType
|
||||
forSaveOperation: operation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: context];
|
||||
ofType: fileType
|
||||
forSaveOperation: operation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: context];
|
||||
}
|
||||
} else {
|
||||
// User cancelled the save panel...
|
||||
@ -743,8 +744,8 @@ static int untitled_document_number = 0;
|
||||
// Tell delegate that file couldn't be saved.
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod =
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, NO, context);
|
||||
}
|
||||
}
|
||||
@ -768,29 +769,32 @@ static int untitled_document_number = 0;
|
||||
NSDictionary *attributes = [fileManager fileAttributesAtPath: path
|
||||
traverseLink: YES];
|
||||
NSDate *dateModified =
|
||||
[attributes objectForKey: NSFileModificationDate];
|
||||
[attributes objectForKey: NSFileModificationDate];
|
||||
if (attributes != nil &&
|
||||
![dateModified isEqualToDate: _fileModificationDate]) {
|
||||
int result = NSRunAlertPanel(
|
||||
[self displayName],
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Another user or process has changed this document's file "
|
||||
@"on disk.\n\nIf you save now, those changes will be lost. "
|
||||
@"Save anyway?",
|
||||
nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Don't Save", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
nil);
|
||||
[self displayName],
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Another user or process has changed this "
|
||||
@"document's file "
|
||||
@"on disk.\n\nIf you save now, those changes will "
|
||||
@"be lost. "
|
||||
@"Save anyway?",
|
||||
nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Don't Save", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
nil);
|
||||
if (result == NSAlertDefaultReturn) {
|
||||
// The user canceled the save operation.
|
||||
if ([delegate respondsToSelector: selector]) {
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod = (void (*)(id, SEL, id, BOOL, void *))
|
||||
[delegate methodForSelector: selector];
|
||||
[delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, NO, info);
|
||||
}
|
||||
return;
|
||||
@ -798,20 +802,21 @@ static int untitled_document_number = 0;
|
||||
}
|
||||
|
||||
if ([self _isSelectorOverridden: @selector
|
||||
(saveToFile:
|
||||
saveOperation:delegate:didSaveSelector:contextInfo:)]) {
|
||||
(saveToFile:
|
||||
saveOperation:delegate:didSaveSelector:contextInfo
|
||||
:)]) {
|
||||
[self saveToFile: [_fileURL path]
|
||||
saveOperation: NSSaveOperation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: info];
|
||||
saveOperation: NSSaveOperation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: info];
|
||||
} else {
|
||||
[self saveToURL: _fileURL
|
||||
ofType: [self fileType]
|
||||
forSaveOperation: NSSaveOperation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: info];
|
||||
ofType: [self fileType]
|
||||
forSaveOperation: NSSaveOperation
|
||||
delegate: delegate
|
||||
didSaveSelector: selector
|
||||
contextInfo: info];
|
||||
}
|
||||
} else {
|
||||
[self runModalSavePanelForSaveOperation: NSSaveOperation
|
||||
@ -822,9 +827,9 @@ static int untitled_document_number = 0;
|
||||
}
|
||||
|
||||
- (BOOL) saveToURL: (NSURL *) url
|
||||
ofType: (NSString *) type
|
||||
forSaveOperation: (NSSaveOperationType) operation
|
||||
error: (NSError **) error
|
||||
ofType: (NSString *) type
|
||||
forSaveOperation: (NSSaveOperationType) operation
|
||||
error: (NSError **) error
|
||||
{
|
||||
if (url == nil) {
|
||||
return NO;
|
||||
@ -847,11 +852,11 @@ static int untitled_document_number = 0;
|
||||
}
|
||||
|
||||
- (void) saveToURL: (NSURL *) url
|
||||
ofType: (NSString *) type
|
||||
forSaveOperation: (NSSaveOperationType) operation
|
||||
delegate: delegate
|
||||
didSaveSelector: (SEL) selector
|
||||
contextInfo: (void *) info
|
||||
ofType: (NSString *) type
|
||||
forSaveOperation: (NSSaveOperationType) operation
|
||||
delegate: delegate
|
||||
didSaveSelector: (SEL) selector
|
||||
contextInfo: (void *) info
|
||||
{
|
||||
NSError *error = nil;
|
||||
BOOL success = [self saveToURL: url
|
||||
@ -865,8 +870,9 @@ static int untitled_document_number = 0;
|
||||
|
||||
if ([delegate respondsToSelector: selector]) {
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod = (void (*)(
|
||||
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod =
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, success, info);
|
||||
}
|
||||
}
|
||||
@ -890,8 +896,9 @@ static int untitled_document_number = 0;
|
||||
if ([delegate respondsToSelector: selector]) {
|
||||
// Tell delegate if the print info was updated.
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod = (void (*)(
|
||||
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod =
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, button == NSOKButton, info);
|
||||
}
|
||||
}
|
||||
@ -961,20 +968,21 @@ static int untitled_document_number = 0;
|
||||
if (fileName == nil)
|
||||
fileName = [self displayName];
|
||||
int result = NSRunAlertPanel(
|
||||
[[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey: @"CFBundleName"],
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save changes to %@?", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Yes", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"No", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
fileName);
|
||||
[[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey: @"CFBundleName"],
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save changes to %@?", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Yes", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"No", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
fileName);
|
||||
if (result == NSAlertDefaultReturn) {
|
||||
[self saveDocumentWithDelegate: delegate
|
||||
didSaveSelector: selector
|
||||
@ -994,8 +1002,9 @@ static int untitled_document_number = 0;
|
||||
|
||||
if ([delegate respondsToSelector: selector]) {
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod = (void (*)(
|
||||
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod =
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, OKToClose, info);
|
||||
}
|
||||
}
|
||||
@ -1011,23 +1020,27 @@ static int untitled_document_number = 0;
|
||||
contextInfo: info];
|
||||
} else if ([delegate respondsToSelector: selector]) {
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod = (void (*)(
|
||||
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod =
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, YES, info);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) revertDocumentToSaved: sender {
|
||||
int result = NSRunAlertPanel(
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"%@ has been edited. Are you sure you want to undo changes?", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Revert", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
nil, [self displayName]);
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"%@ has been edited. Are you sure you want to undo "
|
||||
@"changes?",
|
||||
nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Revert", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
nil, [self displayName]);
|
||||
|
||||
if (result == NSAlertDefaultReturn) {
|
||||
for (id editor in [[_activeEditors copy] autorelease])
|
||||
@ -1128,7 +1141,7 @@ static int untitled_document_number = 0;
|
||||
}
|
||||
|
||||
- (NSString *) fileNameFromRunningSavePanelForSaveOperation:
|
||||
(NSSaveOperationType) operation
|
||||
(NSSaveOperationType) operation
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
@ -1140,8 +1153,8 @@ static int untitled_document_number = 0;
|
||||
if (data == nil)
|
||||
return nil;
|
||||
|
||||
return
|
||||
[[[NSFileWrapper alloc] initRegularFileWithContents: data] autorelease];
|
||||
return [[[NSFileWrapper alloc] initRegularFileWithContents: data]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
- initWithContentsOfFile: (NSString *) path ofType: (NSString *) type {
|
||||
@ -1156,13 +1169,14 @@ static int untitled_document_number = 0;
|
||||
error = nil;
|
||||
if (![self readFromURL: url ofType: type error: &error]) {
|
||||
NSRunAlertPanel(
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Can't open file '%@'. Error = %@", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
nil, nil, path, error);
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Can't open file '%@'. Error = %@", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
nil, nil, path, error);
|
||||
[self dealloc];
|
||||
return nil;
|
||||
}
|
||||
@ -1181,13 +1195,14 @@ static int untitled_document_number = 0;
|
||||
[self setFileType: type];
|
||||
if (![self readFromURL: url ofType: type error: &error]) {
|
||||
NSRunAlertPanel(
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Can't open file '%@'. Error = %@", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
nil, nil, url, error);
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Can't open file '%@'. Error = %@", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"OK", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
nil, nil, url, error);
|
||||
[self dealloc];
|
||||
return nil;
|
||||
}
|
||||
@ -1273,10 +1288,10 @@ static int untitled_document_number = 0;
|
||||
}
|
||||
|
||||
- (void) saveToFile: (NSString *) path
|
||||
saveOperation: (NSSaveOperationType) operation
|
||||
delegate: delegate
|
||||
didSaveSelector: (SEL) selector
|
||||
contextInfo: (void *) context
|
||||
saveOperation: (NSSaveOperationType) operation
|
||||
delegate: delegate
|
||||
didSaveSelector: (SEL) selector
|
||||
contextInfo: (void *) context
|
||||
{
|
||||
if (path != nil) {
|
||||
BOOL success = [self writeWithBackupToFile: path
|
||||
@ -1292,8 +1307,8 @@ static int untitled_document_number = 0;
|
||||
if ([delegate respondsToSelector: selector]) {
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod =
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, success, context);
|
||||
}
|
||||
}
|
||||
@ -1321,9 +1336,9 @@ static int untitled_document_number = 0;
|
||||
}
|
||||
|
||||
- (BOOL) writeToFile: (NSString *) path
|
||||
ofType: (NSString *) type
|
||||
originalFile: (NSString *) original
|
||||
saveOperation: (NSSaveOperationType) operation
|
||||
ofType: (NSString *) type
|
||||
originalFile: (NSString *) original
|
||||
saveOperation: (NSSaveOperationType) operation
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return 0;
|
||||
@ -1370,22 +1385,23 @@ static int untitled_document_number = 0;
|
||||
- (BOOL) windowShouldClose: sender {
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey: @"useSheets"]) {
|
||||
NSBeginAlertSheet(
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Yes", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"No", nil, [NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
sender, self,
|
||||
@selector(didEndShouldCloseSheet:returnCode:contextInfo:), NULL,
|
||||
sender,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save changes to %@?", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
[self displayName]);
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Yes", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"No", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
sender, self,
|
||||
@selector(didEndShouldCloseSheet:returnCode:contextInfo:), NULL,
|
||||
sender,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save changes to %@?", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
[self displayName]);
|
||||
|
||||
return NO;
|
||||
} else {
|
||||
@ -1393,20 +1409,20 @@ static int untitled_document_number = 0;
|
||||
return YES;
|
||||
else {
|
||||
int result = NSRunAlertPanel(
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save changes to %@?", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Yes", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"No", nil, [NSBundle bundleForClass: [NSDocument class]],
|
||||
@""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
[self displayName]);
|
||||
nil,
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Save changes to %@?", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Yes", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"No", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
NSLocalizedStringFromTableInBundle(
|
||||
@"Cancel", nil,
|
||||
[NSBundle bundleForClass: [NSDocument class]], @""),
|
||||
[self displayName]);
|
||||
|
||||
switch (result) {
|
||||
case NSAlertDefaultReturn:
|
||||
|
@ -59,7 +59,7 @@ static NSDocumentController *shared = nil;
|
||||
|
||||
_documents = [NSMutableArray new];
|
||||
_fileTypes = [[[[NSBundle mainBundle] infoDictionary]
|
||||
objectForKey: @"CFBundleDocumentTypes"] retain];
|
||||
objectForKey: @"CFBundleDocumentTypes"] retain];
|
||||
_autosavingDelay = 0;
|
||||
return self;
|
||||
}
|
||||
@ -84,7 +84,7 @@ static NSDocumentController *shared = nil;
|
||||
return nil;
|
||||
|
||||
return [(NSDictionary *) [_fileTypes objectAtIndex: 0]
|
||||
objectForKey: @"CFBundleTypeName"];
|
||||
objectForKey: @"CFBundleTypeName"];
|
||||
}
|
||||
|
||||
- (NSArray *) documentClassNames {
|
||||
@ -93,7 +93,7 @@ static NSDocumentController *shared = nil;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
[result addObject: [(NSDictionary *) [_fileTypes objectAtIndex: i]
|
||||
objectForKey: @"NSDocumentClass"]];
|
||||
objectForKey: @"NSDocumentClass"]];
|
||||
|
||||
return [result allObjects];
|
||||
}
|
||||
@ -141,7 +141,7 @@ static NSDocumentController *shared = nil;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
NSArray *add = [(NSDictionary *) [_fileTypes objectAtIndex: i]
|
||||
objectForKey: @"CFBundleTypeExtensions"];
|
||||
objectForKey: @"CFBundleTypeExtensions"];
|
||||
[set addObjectsFromArray: add];
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ static NSDocumentController *shared = nil;
|
||||
}
|
||||
|
||||
NSString *lastOpenPanelDirectory = [[NSUserDefaults standardUserDefaults]
|
||||
stringForKey: @"NSNavLastRootDirectory"];
|
||||
stringForKey: @"NSNavLastRootDirectory"];
|
||||
if (lastOpenPanelDirectory != nil)
|
||||
return lastOpenPanelDirectory;
|
||||
|
||||
@ -268,9 +268,9 @@ static NSDocumentController *shared = nil;
|
||||
}
|
||||
|
||||
- makeDocumentForURL: (NSURL *) url
|
||||
withContentsOfURL: (NSURL *) contentsURL
|
||||
ofType: (NSString *) type
|
||||
error: (NSError **) error
|
||||
withContentsOfURL: (NSURL *) contentsURL
|
||||
ofType: (NSString *) type
|
||||
error: (NSError **) error
|
||||
{
|
||||
id result;
|
||||
Class class = [self documentClassForType: type];
|
||||
@ -308,9 +308,9 @@ static NSDocumentController *shared = nil;
|
||||
if this class is a subclass that has this method overridden.
|
||||
*/
|
||||
IMP mine = [NSDocumentController
|
||||
instanceMethodForSelector: @selector(makeUntitledDocumentOfType:)];
|
||||
instanceMethodForSelector: @selector(makeUntitledDocumentOfType:)];
|
||||
IMP theirs =
|
||||
[self methodForSelector: @selector(makeUntitledDocumentOfType:)];
|
||||
[self methodForSelector: @selector(makeUntitledDocumentOfType:)];
|
||||
if (mine != theirs) {
|
||||
return [self makeUntitledDocumentOfType: type];
|
||||
}
|
||||
@ -359,7 +359,7 @@ static NSDocumentController *shared = nil;
|
||||
IMP mine = [NSDocumentController instanceMethodForSelector: @selector
|
||||
(openUntitledDocumentOfType:display:)];
|
||||
IMP theirs = [self
|
||||
methodForSelector: @selector(openUntitledDocumentOfType:display:)];
|
||||
methodForSelector: @selector(openUntitledDocumentOfType:display:)];
|
||||
if (mine != theirs) {
|
||||
return [self openUntitledDocumentOfType: type display: display];
|
||||
}
|
||||
@ -402,8 +402,8 @@ static NSDocumentController *shared = nil;
|
||||
{
|
||||
IMP mine = [NSDocumentController instanceMethodForSelector: @selector
|
||||
(openDocumentWithContentsOfFile:display:)];
|
||||
IMP theirs = [self
|
||||
methodForSelector: @selector(openDocumentWithContentsOfFile:display:)];
|
||||
IMP theirs = [self methodForSelector: @selector
|
||||
(openDocumentWithContentsOfFile:display:)];
|
||||
|
||||
if ([url isFileURL] && mine != theirs)
|
||||
return [self openDocumentWithContentsOfFile: [url path]
|
||||
@ -452,11 +452,11 @@ static NSDocumentController *shared = nil;
|
||||
[document close];
|
||||
if ([_documents count] > 0) {
|
||||
[[_documents lastObject]
|
||||
canCloseDocumentWithDelegate: self
|
||||
shouldCloseSelector: @selector
|
||||
(_closeDocumentsStartingWith:
|
||||
shouldClose:closeAllContext:)
|
||||
contextInfo: context];
|
||||
canCloseDocumentWithDelegate: self
|
||||
shouldCloseSelector: @selector
|
||||
(_closeDocumentsStartingWith:
|
||||
shouldClose:closeAllContext:)
|
||||
contextInfo: context];
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -468,8 +468,9 @@ static NSDocumentController *shared = nil;
|
||||
[context release];
|
||||
if ([delegate respondsToSelector: selector]) {
|
||||
void (*delegateMethod)(id, SEL, id, BOOL, void *);
|
||||
delegateMethod = (void (*)(
|
||||
id, SEL, id, BOOL, void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod =
|
||||
(void (*)(id, SEL, id, BOOL,
|
||||
void *)) [delegate methodForSelector: selector];
|
||||
delegateMethod(delegate, selector, self, ([_documents count] == 0),
|
||||
info);
|
||||
}
|
||||
@ -480,10 +481,10 @@ static NSDocumentController *shared = nil;
|
||||
contextInfo: (void *) info
|
||||
{
|
||||
NSDictionary *closeAllContext = [[NSDictionary alloc]
|
||||
initWithObjectsAndKeys: delegate, @"delegate",
|
||||
NSStringFromSelector(selector), @"selector",
|
||||
[NSValue valueWithPointer: info],
|
||||
@"contextInfo", nil];
|
||||
initWithObjectsAndKeys: delegate, @"delegate",
|
||||
NSStringFromSelector(selector), @"selector",
|
||||
[NSValue valueWithPointer: info],
|
||||
@"contextInfo", nil];
|
||||
[self _closeDocumentsStartingWith: nil
|
||||
shouldClose: YES
|
||||
closeAllContext: closeAllContext];
|
||||
@ -508,16 +509,16 @@ static NSDocumentController *shared = nil;
|
||||
}
|
||||
|
||||
- (void) presentError: (NSError *) error
|
||||
modalForWindow: (NSWindow *) window
|
||||
delegate: delegate
|
||||
didPresentSelector: (SEL) selector
|
||||
contextInfo: (void *) info
|
||||
modalForWindow: (NSWindow *) window
|
||||
delegate: delegate
|
||||
didPresentSelector: (SEL) selector
|
||||
contextInfo: (void *) info
|
||||
{
|
||||
[NSApp presentError: [self willPresentError: error]
|
||||
modalForWindow: window
|
||||
delegate: delegate
|
||||
didPresentSelector: selector
|
||||
contextInfo: info];
|
||||
modalForWindow: window
|
||||
delegate: delegate
|
||||
didPresentSelector: selector
|
||||
contextInfo: info];
|
||||
}
|
||||
|
||||
- (int) runModalOpenPanel: (NSOpenPanel *) openPanel
|
||||
@ -528,8 +529,8 @@ static NSDocumentController *shared = nil;
|
||||
types: extensions];
|
||||
if (result)
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: [openPanel directory]
|
||||
forKey: @"NSNavLastRootDirectory"];
|
||||
setObject: [openPanel directory]
|
||||
forKey: @"NSNavLastRootDirectory"];
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -557,8 +558,8 @@ static NSDocumentController *shared = nil;
|
||||
- (NSMutableArray *) _recentDocumentPaths {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSMutableArray *paths = [NSMutableArray
|
||||
arrayWithArray: [[NSUserDefaults standardUserDefaults]
|
||||
arrayForKey: @"NSRecentDocumentPaths"]];
|
||||
arrayWithArray: [[NSUserDefaults standardUserDefaults]
|
||||
arrayForKey: @"NSRecentDocumentPaths"]];
|
||||
int i, count = [paths count];
|
||||
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
@ -567,8 +568,8 @@ static NSDocumentController *shared = nil;
|
||||
|
||||
if ([paths count] != count)
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: paths
|
||||
forKey: @"NSRecentDocumentPaths"];
|
||||
setObject: paths
|
||||
forKey: @"NSRecentDocumentPaths"];
|
||||
|
||||
return paths;
|
||||
}
|
||||
@ -591,8 +592,8 @@ static NSDocumentController *shared = nil;
|
||||
if ([appDelegate respondsToSelector: @selector(application:
|
||||
openFiles:)]) {
|
||||
[appDelegate
|
||||
application: NSApp
|
||||
openFiles: [NSArray arrayWithObject: [url path]]];
|
||||
application: NSApp
|
||||
openFiles: [NSArray arrayWithObject: [url path]]];
|
||||
} else if ([appDelegate respondsToSelector: @selector
|
||||
(application:openFile:)]) {
|
||||
[appDelegate application: NSApp openFile: [url path]];
|
||||
@ -635,12 +636,12 @@ static NSDocumentController *shared = nil;
|
||||
// Shorten entries to the last path component, but not for then-duplicates.
|
||||
for (i = 0; i < count; i++) {
|
||||
NSString *lastPath =
|
||||
[(NSString *) [array objectAtIndex: i] lastPathComponent];
|
||||
[(NSString *) [array objectAtIndex: i] lastPathComponent];
|
||||
NSInteger occurences = 0;
|
||||
|
||||
for (j = 0; j < count; j++) {
|
||||
if ([[(NSString *) [array objectAtIndex: j] lastPathComponent]
|
||||
isEqualToString: lastPath])
|
||||
isEqualToString: lastPath])
|
||||
occurences++;
|
||||
}
|
||||
if (occurences > 1)
|
||||
@ -651,10 +652,10 @@ static NSDocumentController *shared = nil;
|
||||
|
||||
while (--count >= 0) {
|
||||
NSString *path = [lastPathArray objectAtIndex: count];
|
||||
NSMenuItem *item =
|
||||
[[[NSMenuItem alloc] initWithTitle: path
|
||||
action: @selector(_openRecentDocument:)
|
||||
keyEquivalent: nil] autorelease];
|
||||
NSMenuItem *item = [[[NSMenuItem alloc]
|
||||
initWithTitle: path
|
||||
action: @selector(_openRecentDocument:)
|
||||
keyEquivalent: nil] autorelease];
|
||||
|
||||
[item setTag: count];
|
||||
[menu insertItem: item atIndex: 0];
|
||||
@ -675,7 +676,7 @@ static NSDocumentController *shared = nil;
|
||||
|
||||
- (unsigned) maximumRecentDocumentCount {
|
||||
NSString *value = [[NSUserDefaults standardUserDefaults]
|
||||
stringForKey: @"NSRecentDocumentMaximum"];
|
||||
stringForKey: @"NSRecentDocumentMaximum"];
|
||||
|
||||
return (value == nil) ? 10 : [value intValue];
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSString *const NSDrawerWillOpenNotification = @"NSDrawerWillOpenNotification";
|
||||
NSString *const NSDrawerDidOpenNotification = @"NSDrawerDidOpenNotification";
|
||||
NSString *const NSDrawerWillCloseNotification =
|
||||
@"NSDrawerWillCloseNotification";
|
||||
@"NSDrawerWillCloseNotification";
|
||||
NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
|
||||
@implementation NSDrawer
|
||||
@ -53,24 +53,24 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
{
|
||||
NSRect parentFrame = [parentWindow frame];
|
||||
NSRect parentContentRect =
|
||||
[parentWindow contentRectForFrameRect: parentFrame];
|
||||
NSRect drawerFrame =
|
||||
[NSWindow frameRectForContentRect: NSMakeRect(0, 0, contentSize.width,
|
||||
contentSize.height)
|
||||
styleMask: NSDrawerWindowMask];
|
||||
[parentWindow contentRectForFrameRect: parentFrame];
|
||||
NSRect drawerFrame = [NSWindow
|
||||
frameRectForContentRect: NSMakeRect(0, 0, contentSize.width,
|
||||
contentSize.height)
|
||||
styleMask: NSDrawerWindowMask];
|
||||
|
||||
if (edge == NSMinXEdge || edge == NSMaxXEdge) {
|
||||
drawerFrame.origin.x = parentFrame.origin.x - 12.0;
|
||||
drawerFrame.origin.y =
|
||||
parentContentRect.origin.y + trailingOffset - 12.0;
|
||||
parentContentRect.origin.y + trailingOffset - 12.0;
|
||||
drawerFrame.size.height = parentContentRect.size.height -
|
||||
(leadingOffset + trailingOffset) + 9.0;
|
||||
} else {
|
||||
drawerFrame.origin.x =
|
||||
parentContentRect.origin.x + leadingOffset - 12.0;
|
||||
parentContentRect.origin.x + leadingOffset - 12.0;
|
||||
drawerFrame.origin.y = parentContentRect.origin.y - 12.0;
|
||||
drawerFrame.size.width =
|
||||
parentContentRect.size.width - (leadingOffset + trailingOffset);
|
||||
parentContentRect.size.width - (leadingOffset + trailingOffset);
|
||||
}
|
||||
|
||||
// Initially I was only computing the open-state frame. Code added to
|
||||
@ -168,37 +168,36 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
_state = 0;
|
||||
_edge = 0;
|
||||
if ([keyed containsValueForKey: @"NSPreferredEdge"])
|
||||
[self
|
||||
setPreferredEdge: [keyed decodeIntForKey: @"NSPreferredEdge"]];
|
||||
[self setPreferredEdge:
|
||||
[keyed decodeIntForKey: @"NSPreferredEdge"]];
|
||||
else
|
||||
_preferredEdge = 0;
|
||||
|
||||
if ([keyed containsValueForKey: @"NSLeadingOffset"])
|
||||
[self setLeadingOffset: [keyed
|
||||
decodeFloatForKey: @"NSLeadingOffset"]];
|
||||
[self setLeadingOffset:
|
||||
[keyed decodeFloatForKey: @"NSLeadingOffset"]];
|
||||
else
|
||||
_leadingOffset = 0;
|
||||
|
||||
if ([keyed containsValueForKey: @"NSTrailingOffset"])
|
||||
[self
|
||||
setTrailingOffset: [keyed
|
||||
decodeFloatForKey: @"NSTrailingOffset"]];
|
||||
[self setTrailingOffset:
|
||||
[keyed decodeFloatForKey: @"NSTrailingOffset"]];
|
||||
else
|
||||
_trailingOffset = 0;
|
||||
|
||||
_drawerWindow = [[[NSDrawerWindow alloc]
|
||||
initWithContentRect: NSMakeRect(0, 0, _contentSize.width,
|
||||
_contentSize.height)
|
||||
styleMask: NSDrawerWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO] retain];
|
||||
initWithContentRect: NSMakeRect(0, 0, _contentSize.width,
|
||||
_contentSize.height)
|
||||
styleMask: NSDrawerWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO] retain];
|
||||
[_drawerWindow setDrawer: self];
|
||||
[self setContentSize: _contentSize];
|
||||
|
||||
_parentWindow = _nextParentWindow = nil;
|
||||
if ([keyed containsValueForKey: @"NSParentWindow"])
|
||||
[self
|
||||
setParentWindow: [keyed decodeObjectForKey: @"NSParentWindow"]];
|
||||
[self setParentWindow:
|
||||
[keyed decodeObjectForKey: @"NSParentWindow"]];
|
||||
|
||||
if ([keyed containsValueForKey: @"NSDelegate"])
|
||||
[self setDelegate: [keyed decodeObjectForKey: @"NSDelegate"]];
|
||||
@ -206,18 +205,16 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
_delegate = nil;
|
||||
|
||||
if ([keyed containsValueForKey: @"NSMinContentSize"]) {
|
||||
[self
|
||||
setMinContentSize: [keyed
|
||||
decodeSizeForKey: @"NSMinContentSize"]];
|
||||
[self setMinContentSize:
|
||||
[keyed decodeSizeForKey: @"NSMinContentSize"]];
|
||||
_minContentSize.width += 12.0;
|
||||
_minContentSize.height += 12.0;
|
||||
} else
|
||||
_minContentSize = NSZeroSize;
|
||||
|
||||
if ([keyed containsValueForKey: @"NSMaxContentSize"]) {
|
||||
[self
|
||||
setMaxContentSize: [keyed
|
||||
decodeSizeForKey: @"NSMaxContentSize"]];
|
||||
[self setMaxContentSize:
|
||||
[keyed decodeSizeForKey: @"NSMaxContentSize"]];
|
||||
_maxContentSize.width += 12.0;
|
||||
_maxContentSize.height += 12.0;
|
||||
} else
|
||||
@ -231,11 +228,11 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
preferredEdge: (NSRectEdge) edge
|
||||
{
|
||||
_drawerWindow = [[NSDrawerWindow alloc]
|
||||
initWithContentRect: NSMakeRect(0, 0, contentSize.width,
|
||||
contentSize.height)
|
||||
styleMask: NSDrawerWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
initWithContentRect: NSMakeRect(0, 0, contentSize.width,
|
||||
contentSize.height)
|
||||
styleMask: NSDrawerWindowMask
|
||||
backing: NSBackingStoreBuffered
|
||||
defer: NO];
|
||||
[_drawerWindow setDrawer: self];
|
||||
[self setContentSize: contentSize];
|
||||
[self setPreferredEdge: edge];
|
||||
@ -379,10 +376,10 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
}
|
||||
|
||||
- (void) open {
|
||||
[self
|
||||
openOnEdge: [[self class] visibleEdgeWithPreferredEdge: _preferredEdge
|
||||
parentWindow: _parentWindow
|
||||
drawerWindow: _drawerWindow]];
|
||||
[self openOnEdge: [[self class]
|
||||
visibleEdgeWithPreferredEdge: _preferredEdge
|
||||
parentWindow: _parentWindow
|
||||
drawerWindow: _drawerWindow]];
|
||||
}
|
||||
|
||||
- (void) _resetWindowOrdering: sender {
|
||||
@ -403,14 +400,14 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
// if we've moved to a different edge, recompute...
|
||||
if (_edge != edge)
|
||||
[self setContentSize: [self drawerWindow: _drawerWindow
|
||||
constrainSize: [self contentSize]
|
||||
edge: edge]];
|
||||
constrainSize: [self contentSize]
|
||||
edge: edge]];
|
||||
|
||||
_edge = edge;
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSDrawerWillOpenNotification
|
||||
object: self];
|
||||
postNotificationName: NSDrawerWillOpenNotification
|
||||
object: self];
|
||||
|
||||
frame = [[self class] drawerFrameWithContentSize: [self contentSize]
|
||||
parentWindow: [self parentWindow]
|
||||
@ -437,10 +434,10 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
[_drawerWindow setFrame: start display: YES animate: NO];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(drawerDidOpen:)
|
||||
name: NSWindowDidAnimateNotification
|
||||
object: _drawerWindow];
|
||||
addObserver: self
|
||||
selector: @selector(drawerDidOpen:)
|
||||
name: NSWindowDidAnimateNotification
|
||||
object: _drawerWindow];
|
||||
_state = NSDrawerOpeningState;
|
||||
[self _resetWindowOrdering: nil];
|
||||
[_drawerWindow setFrame: frame display: YES animate: YES];
|
||||
@ -469,14 +466,14 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
edge: _edge];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSDrawerWillCloseNotification
|
||||
object: self];
|
||||
postNotificationName: NSDrawerWillCloseNotification
|
||||
object: self];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(drawerDidClose:)
|
||||
name: NSWindowDidAnimateNotification
|
||||
object: _drawerWindow];
|
||||
addObserver: self
|
||||
selector: @selector(drawerDidClose:)
|
||||
name: NSWindowDidAnimateNotification
|
||||
object: _drawerWindow];
|
||||
_state = NSDrawerClosingState;
|
||||
|
||||
[_drawerWindow setFrame: frame display: YES animate: YES];
|
||||
@ -528,12 +525,12 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
- (void) parentWindowDidChangeFrame: (NSWindow *) window {
|
||||
if (_state == NSDrawerOpenState) {
|
||||
NSRect frame =
|
||||
[[self class] drawerFrameWithContentSize: [self contentSize]
|
||||
parentWindow: [self parentWindow]
|
||||
leadingOffset: _leadingOffset
|
||||
trailingOffset: _trailingOffset
|
||||
edge: _edge
|
||||
state: _state];
|
||||
[[self class] drawerFrameWithContentSize: [self contentSize]
|
||||
parentWindow: [self parentWindow]
|
||||
leadingOffset: _leadingOffset
|
||||
trailingOffset: _trailingOffset
|
||||
edge: _edge
|
||||
state: _state];
|
||||
|
||||
if (_edge == NSMinXEdge || _edge == NSMaxXEdge) {
|
||||
if (frame.size.width > _maxContentSize.width &&
|
||||
@ -620,8 +617,8 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
_state = NSDrawerOpenState;
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSDrawerDidOpenNotification
|
||||
object: self];
|
||||
postNotificationName: NSDrawerDidOpenNotification
|
||||
object: self];
|
||||
}
|
||||
|
||||
- (void) drawerDidClose: (NSNotification *) nilObject {
|
||||
@ -629,8 +626,8 @@ NSString *const NSDrawerDidCloseNotification = @"NSDrawerDidCloseNotification";
|
||||
[_drawerWindow orderOut: nil];
|
||||
_state = NSDrawerClosedState;
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
postNotificationName: NSDrawerDidCloseNotification
|
||||
object: self];
|
||||
postNotificationName: NSDrawerDidCloseNotification
|
||||
object: self];
|
||||
|
||||
if (_nextParentWindow != nil)
|
||||
[self setNextParentWindow];
|
||||
|
@ -51,7 +51,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
// constrain resize size.
|
||||
- (NSSize) platformWindow: (CGWindow *) window
|
||||
frameSizeWillChange: (NSSize) size
|
||||
frameSizeWillChange: (NSSize) size
|
||||
{
|
||||
size = [super platformWindow: window frameSizeWillChange: size];
|
||||
|
||||
|
@ -7,44 +7,44 @@ NSExceptionName NSWordTablesReadException = @"NSWordTablesReadException";
|
||||
NSExceptionName NSTextReadException = @"NSTextReadException";
|
||||
NSExceptionName NSTextWriteException = @"NSTextWriteException";
|
||||
NSExceptionName NSPasteboardCommunicationException =
|
||||
@"NSPasteboardCommunicationException";
|
||||
@"NSPasteboardCommunicationException";
|
||||
NSExceptionName NSPrintingCommunicationException =
|
||||
@"NSPrintingCommunicationException";
|
||||
@"NSPrintingCommunicationException";
|
||||
NSExceptionName NSAbortModalException = @"NSAbortModalException";
|
||||
NSExceptionName NSAbortPrintingException = @"NSAbortPrintingException";
|
||||
NSExceptionName NSIllegalSelectorException = @"NSIllegalSelectorException";
|
||||
NSExceptionName NSAppKitVirtualMemoryException =
|
||||
@"NSAppKitVirtualMemoryException";
|
||||
@"NSAppKitVirtualMemoryException";
|
||||
NSExceptionName NSBadRTFDirectiveException = @"NSBadRTFDirectiveException";
|
||||
NSExceptionName NSBadRTFFontTableException = @"NSBadRTFFontTableException";
|
||||
NSExceptionName NSBadRTFStyleSheetException = @"NSBadRTFStyleSheetException";
|
||||
NSExceptionName NSTypedStreamVersionException =
|
||||
@"NSTypedStreamVersionException";
|
||||
@"NSTypedStreamVersionException";
|
||||
NSExceptionName NSTIFFException = @"NSTIFFException";
|
||||
NSExceptionName NSPrintPackageException = @"NSPrintPackageException";
|
||||
NSExceptionName NSBadRTFColorTableException = @"NSBadRTFColorTableException";
|
||||
NSExceptionName NSDraggingException = @"NSDraggingException";
|
||||
NSExceptionName NSColorListIOException = @"NSColorListIOException";
|
||||
NSExceptionName NSColorListNotEditableException =
|
||||
@"NSColorListNotEditableException";
|
||||
@"NSColorListNotEditableException";
|
||||
NSExceptionName NSBadBitmapParametersException =
|
||||
@"NSBadBitmapParametersException";
|
||||
@"NSBadBitmapParametersException";
|
||||
NSExceptionName NSWindowServerCommunicationException =
|
||||
@"NSWindowServerCommunicationException";
|
||||
@"NSWindowServerCommunicationException";
|
||||
NSExceptionName NSFontUnavailableException = @"NSFontUnavailableException";
|
||||
NSExceptionName NSPPDIncludeNotFoundException =
|
||||
@"NSPPDIncludeNotFoundException";
|
||||
@"NSPPDIncludeNotFoundException";
|
||||
NSExceptionName NSPPDParseException = @"NSPPDParseException";
|
||||
NSExceptionName NSPPDIncludeStackOverflowException =
|
||||
@"NSPPDIncludeStackOverflowException";
|
||||
@"NSPPDIncludeStackOverflowException";
|
||||
NSExceptionName NSPPDIncludeStackUnderflowException =
|
||||
@"NSPPDIncludeStackUnderflowException";
|
||||
@"NSPPDIncludeStackUnderflowException";
|
||||
NSExceptionName NSRTFPropertyStackOverflowException =
|
||||
@"NSRTFPropertyStackOverflowException";
|
||||
@"NSRTFPropertyStackOverflowException";
|
||||
NSExceptionName NSAppKitIgnoredException = @"NSAppKitIgnoredException";
|
||||
NSExceptionName NSBadComparisonException = @"NSBadComparisonException";
|
||||
NSExceptionName NSImageCacheException = @"NSImageCacheException";
|
||||
NSExceptionName NSNibLoadingException = @"NSNibLoadingException";
|
||||
NSExceptionName NSBrowserIllegalDelegateException =
|
||||
@"NSBrowserIllegalDelegateException";
|
||||
@"NSBrowserIllegalDelegateException";
|
||||
NSExceptionName NSAccessibilityException = @"NSAccessibilityException";
|
||||
|
@ -125,13 +125,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
+ (instancetype) keyEventWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) modifierFlags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) modifierFlags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode
|
||||
{
|
||||
return [[[NSEvent_keyboard alloc] initWithType: type
|
||||
location: location
|
||||
@ -144,26 +144,26 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
+ (instancetype) keyEventWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) modifierFlags
|
||||
timestamp: (NSTimeInterval) timestamp
|
||||
windowNumber: (NSInteger) windowNumber
|
||||
context: (NSGraphicsContext *) context
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) modifierFlags
|
||||
timestamp: (NSTimeInterval) timestamp
|
||||
windowNumber: (NSInteger) windowNumber
|
||||
context: (NSGraphicsContext *) context
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode
|
||||
{
|
||||
return [[[NSEvent_keyboard alloc]
|
||||
initWithType: type
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: [NSApp
|
||||
windowWithWindowNumber: windowNumber]
|
||||
characters: characters
|
||||
charactersIgnoringModifiers: charactersIgnoringModifiers
|
||||
isARepeat: isARepeat
|
||||
keyCode: keyCode] autorelease];
|
||||
initWithType: type
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: [NSApp windowWithWindowNumber:
|
||||
windowNumber]
|
||||
characters: characters
|
||||
charactersIgnoringModifiers: charactersIgnoringModifiers
|
||||
isARepeat: isARepeat
|
||||
keyCode: keyCode] autorelease];
|
||||
}
|
||||
|
||||
+ (instancetype) otherEventWithType: (NSEventType) type
|
||||
@ -241,13 +241,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat: @"<NSEvent: type=%lu loc=(%f,%f) time=%f flags=0x%X "
|
||||
@"win=%p winNum=%lu>",
|
||||
(unsigned long) [self type],
|
||||
[self locationInWindow].x, [self locationInWindow].y,
|
||||
[self timestamp],
|
||||
(unsigned long) [self modifierFlags], [self window],
|
||||
(unsigned long) [self windowNumber]];
|
||||
stringWithFormat:
|
||||
@"<NSEvent: type=%lu loc=(%f,%f) time=%f flags=0x%X "
|
||||
@"win=%p winNum=%lu>",
|
||||
(unsigned long) [self type], [self locationInWindow].x,
|
||||
[self locationInWindow].y, [self timestamp],
|
||||
(unsigned long) [self modifierFlags], [self window],
|
||||
(unsigned long) [self windowNumber]];
|
||||
}
|
||||
|
||||
static NSTimer *_periodicTimer = nil;
|
||||
|
@ -23,18 +23,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- initWithCoreGraphicsEvent: (CGEvent *) event window: (NSWindow *) window {
|
||||
[super initWithType: NSPlatformSpecific
|
||||
location: NSMakePoint(0, 0)
|
||||
modifierFlags: 0
|
||||
window: window];
|
||||
location: NSMakePoint(0, 0)
|
||||
modifierFlags: 0
|
||||
window: window];
|
||||
_coreGraphicsEvent = [event retain];
|
||||
return self;
|
||||
}
|
||||
|
||||
- initWithDisplayEvent: (CGEvent *) event {
|
||||
[super initWithType: NSPlatformSpecificDisplayEvent
|
||||
location: NSMakePoint(0, 0)
|
||||
modifierFlags: 0
|
||||
window: nil];
|
||||
location: NSMakePoint(0, 0)
|
||||
modifierFlags: 0
|
||||
window: nil];
|
||||
_coreGraphicsEvent = [event retain];
|
||||
return self;
|
||||
}
|
||||
|
@ -27,12 +27,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (instancetype) initWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) flags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode;
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) flags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode;
|
||||
|
||||
@end
|
||||
|
@ -23,18 +23,18 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
@implementation NSEvent_keyboard
|
||||
|
||||
- (instancetype) initWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) modifierFlags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) modifierFlags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode
|
||||
{
|
||||
[super initWithType: type
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: window];
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: window];
|
||||
|
||||
_characters = [characters copy];
|
||||
_charactersIgnoringModifiers = [charactersIgnoringModifiers copy];
|
||||
|
@ -30,9 +30,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
deltaY: (CGFloat) deltaY
|
||||
{
|
||||
[super initWithType: type
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: window];
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: window];
|
||||
|
||||
_clickCount = clickCount;
|
||||
_deltaX = deltaX;
|
||||
@ -52,9 +52,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
deltaY: (CGFloat) deltaY
|
||||
{
|
||||
[super initWithType: type
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: window];
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: window];
|
||||
|
||||
_deltaY = deltaY;
|
||||
|
||||
@ -93,9 +93,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
pressure: (float) pressure
|
||||
{
|
||||
[super initWithType: type
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: (id) windowNumber];
|
||||
location: location
|
||||
modifierFlags: modifierFlags
|
||||
window: (id) windowNumber];
|
||||
_clickCount = clickCount;
|
||||
return self;
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- initWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSUInteger) modifierFlags
|
||||
timestamp: (NSTimeInterval) time
|
||||
windowNumber: (NSInteger) windowNum
|
||||
context: (NSGraphicsContext *) context
|
||||
subtype: (short) subtype
|
||||
data1: (NSInteger) data1
|
||||
data2: (NSInteger) data2;
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSUInteger) modifierFlags
|
||||
timestamp: (NSTimeInterval) time
|
||||
windowNumber: (NSInteger) windowNum
|
||||
context: (NSGraphicsContext *) context
|
||||
subtype: (short) subtype
|
||||
data1: (NSInteger) data1
|
||||
data2: (NSInteger) data2;
|
||||
|
||||
@end
|
||||
|
@ -21,14 +21,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
@implementation NSEvent_other
|
||||
- initWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSUInteger) modifierFlags
|
||||
timestamp: (NSTimeInterval) time
|
||||
windowNumber: (NSInteger) windowNum
|
||||
context: (NSGraphicsContext *) context
|
||||
subtype: (short) subtype
|
||||
data1: (NSInteger) data1
|
||||
data2: (NSInteger) data2
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSUInteger) modifierFlags
|
||||
timestamp: (NSTimeInterval) time
|
||||
windowNumber: (NSInteger) windowNum
|
||||
context: (NSGraphicsContext *) context
|
||||
subtype: (short) subtype
|
||||
data1: (NSInteger) data1
|
||||
data2: (NSInteger) data2
|
||||
{
|
||||
_type = type;
|
||||
_locationInWindow = location;
|
||||
|
@ -27,12 +27,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- (instancetype) initWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) flags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode;
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSEventModifierFlags) flags
|
||||
window: (NSWindow *) window
|
||||
characters: (NSString *) characters
|
||||
charactersIgnoringModifiers: (NSString *) charactersIgnoringModifiers
|
||||
isARepeat: (BOOL) isARepeat
|
||||
keyCode: (unsigned short) keyCode;
|
||||
|
||||
@end
|
||||
|
@ -26,13 +26,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- initWithType: (NSEventType) type
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSUInteger) modifierFlags
|
||||
timestamp: (NSTimeInterval) time
|
||||
windowNumber: (NSInteger) windowNum
|
||||
context: (NSGraphicsContext *) context
|
||||
subtype: (short) subtype
|
||||
data1: (NSInteger) data1
|
||||
data2: (NSInteger) data2;
|
||||
location: (NSPoint) location
|
||||
modifierFlags: (NSUInteger) modifierFlags
|
||||
timestamp: (NSTimeInterval) time
|
||||
windowNumber: (NSInteger) windowNum
|
||||
context: (NSGraphicsContext *) context
|
||||
subtype: (short) subtype
|
||||
data1: (NSInteger) data1
|
||||
data2: (NSInteger) data2;
|
||||
|
||||
@end
|
||||
|
@ -31,9 +31,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <Onyx2D/O2Font.h>
|
||||
|
||||
NSNotificationName NSFontSetChangedNotification =
|
||||
@"NSFontSetChangedNotification";
|
||||
@"NSFontSetChangedNotification";
|
||||
NSNotificationName NSAntialiasThresholdChangedNotification =
|
||||
@"NSAntialiasThresholdChangedNotification";
|
||||
@"NSAntialiasThresholdChangedNotification";
|
||||
|
||||
FOUNDATION_EXPORT char *NSUnicodeToSymbol(const unichar *characters,
|
||||
NSUInteger length, BOOL lossy,
|
||||
@ -121,8 +121,8 @@ static NSLock *_cacheLock = nil;
|
||||
if (self == [NSFont class]) {
|
||||
_fontCacheCapacity = 4;
|
||||
_fontCacheSize = 0;
|
||||
_fontCache =
|
||||
NSZoneMalloc([self zone], sizeof(NSFont *) * _fontCacheCapacity);
|
||||
_fontCache = NSZoneMalloc([self zone],
|
||||
sizeof(NSFont *) * _fontCacheCapacity);
|
||||
#ifndef DARLING
|
||||
_nibFontTranslator = [[NSNibFontNameTranslator alloc] init];
|
||||
#endif
|
||||
@ -234,9 +234,9 @@ static NSLock *_cacheLock = nil;
|
||||
[ctFont release];
|
||||
[name release];
|
||||
} else {
|
||||
result = [NSFont
|
||||
fontWithName: [O2Font postscriptNameForDisplayName: fallbackName]
|
||||
size: size];
|
||||
result = [NSFont fontWithName: [O2Font postscriptNameForDisplayName:
|
||||
fallbackName]
|
||||
size: size];
|
||||
}
|
||||
O2FontLog(@"asked for type: %d got font: %@", type, result);
|
||||
return result;
|
||||
@ -299,15 +299,15 @@ static NSLock *_cacheLock = nil;
|
||||
}
|
||||
|
||||
+ (NSFont *) userFontOfSize: (CGFloat) size {
|
||||
return [NSFont
|
||||
fontWithName: [O2Font postscriptNameForDisplayName: @"San Francisco"]
|
||||
size: (size == 0) ? 12.0 : size];
|
||||
return [NSFont fontWithName: [O2Font postscriptNameForDisplayName:
|
||||
@"San Francisco"]
|
||||
size: (size == 0) ? 12.0 : size];
|
||||
}
|
||||
|
||||
+ (NSFont *) userFixedPitchFontOfSize: (CGFloat) size {
|
||||
return [NSFont
|
||||
fontWithName: [O2Font postscriptNameForDisplayName: @"Courier New"]
|
||||
size: (size == 0) ? 12.0 : size];
|
||||
fontWithName: [O2Font postscriptNameForDisplayName: @"Courier New"]
|
||||
size: (size == 0) ? 12.0 : size];
|
||||
}
|
||||
|
||||
+ (void) setUserFont: (NSFont *) value {
|
||||
@ -330,7 +330,7 @@ static NSLock *_cacheLock = nil;
|
||||
if ([coder allowsKeyedCoding]) {
|
||||
#ifndef DARLING
|
||||
[coder encodeObject: [[NSFont nibFontTranslator]
|
||||
translateToNibFontName: _name]
|
||||
translateToNibFontName: _name]
|
||||
forKey: @"NSName"];
|
||||
#else
|
||||
[coder encodeObject: _name forKey: @"NSName"];
|
||||
@ -359,8 +359,8 @@ static NSLock *_cacheLock = nil;
|
||||
// int flags=[keyed decodeIntForKey:@"NSfFlags"]; // ?
|
||||
NSUInteger matrixLen;
|
||||
const uint32_t *matrixBytes =
|
||||
(const uint32_t *) [keyed decodeBytesForKey: @"NSMatrix"
|
||||
returnedLength: &matrixLen];
|
||||
(const uint32_t *) [keyed decodeBytesForKey: @"NSMatrix"
|
||||
returnedLength: &matrixLen];
|
||||
|
||||
if (matrixLen >= 6 * sizeof(float) && matrixBytes) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
@ -522,7 +522,7 @@ static NSLock *_cacheLock = nil;
|
||||
NSFontManager *fontMgr = [NSFontManager sharedFontManager];
|
||||
|
||||
NSArray *matchingFonts =
|
||||
[fontMgr availableMembersOfFontFamily: fontFamily];
|
||||
[fontMgr availableMembersOfFontFamily: fontFamily];
|
||||
|
||||
if ([matchingFonts count] == 1) {
|
||||
// won't find anything better than this
|
||||
@ -580,7 +580,8 @@ static NSLock *_cacheLock = nil;
|
||||
- (NSAffineTransform *) textTransform {
|
||||
NSAffineTransform *result = [NSAffineTransform transform];
|
||||
NSAffineTransformStruct fields = {
|
||||
_matrix[0], _matrix[1], _matrix[2], _matrix[3], _matrix[4], _matrix[5],
|
||||
_matrix[0], _matrix[1], _matrix[2],
|
||||
_matrix[3], _matrix[4], _matrix[5],
|
||||
};
|
||||
|
||||
[result setTransformStruct: fields];
|
||||
@ -603,16 +604,17 @@ static NSLock *_cacheLock = nil;
|
||||
|
||||
- (NSString *) familyName {
|
||||
NSString *familyName =
|
||||
[[NSFontFamily fontFamilyWithTypefaceName: _name] name];
|
||||
[[NSFontFamily fontFamilyWithTypefaceName: _name] name];
|
||||
if (familyName == nil) {
|
||||
NSString *blank = @" ";
|
||||
NSMutableArray *nameComponents = [NSMutableArray
|
||||
arrayWithArray: [_name componentsSeparatedByString: blank]];
|
||||
arrayWithArray: [_name componentsSeparatedByString: blank]];
|
||||
while ([nameComponents count] > 1 && familyName == nil) {
|
||||
[nameComponents removeLastObject];
|
||||
familyName = [[NSFontFamily
|
||||
fontFamilyWithName: [nameComponents
|
||||
componentsJoinedByString: blank]] name];
|
||||
fontFamilyWithName:
|
||||
[nameComponents componentsJoinedByString: blank]]
|
||||
name];
|
||||
}
|
||||
}
|
||||
|
||||
@ -632,16 +634,16 @@ static NSLock *_cacheLock = nil;
|
||||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
||||
|
||||
NSMutableDictionary *traitsDictionary =
|
||||
[NSMutableDictionary dictionaryWithCapacity: 4];
|
||||
[NSMutableDictionary dictionaryWithCapacity: 4];
|
||||
NSFontFamily *family =
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [self fontName]];
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [self fontName]];
|
||||
NSFontTypeface *typeface = [family typefaceWithName: [self fontName]];
|
||||
NSFontTraitMask symbolicTraits = [typeface traits];
|
||||
[traitsDictionary setObject: [NSNumber numberWithInt: symbolicTraits]
|
||||
forKey: NSFontSymbolicTrait];
|
||||
[traitsDictionary
|
||||
setObject: [NSNumber numberWithInt: [fm weightOfFont: self]]
|
||||
forKey: NSFontWeightTrait];
|
||||
setObject: [NSNumber numberWithInt: [fm weightOfFont: self]]
|
||||
forKey: NSFontWeightTrait];
|
||||
// [traitsDictionary setObject: [NSNumber numberWithInt: ??] forKey:
|
||||
// NSFontWidthTrait]; // not sure what's put here
|
||||
[traitsDictionary setObject: [NSNumber numberWithDouble: [self italicAngle]]
|
||||
@ -652,28 +654,29 @@ static NSLock *_cacheLock = nil;
|
||||
- (NSFontDescriptor *) fontDescriptor {
|
||||
|
||||
NSFontFamily *fontFamily =
|
||||
[NSFontFamily fontFamilyWithName: [self familyName]];
|
||||
[NSFontFamily fontFamilyWithName: [self familyName]];
|
||||
NSFontTypeface *typeface = [fontFamily typefaceWithName: [self fontName]];
|
||||
|
||||
NSDictionary *attributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys:
|
||||
[self fontName], NSFontNameAttribute, [self familyName],
|
||||
NSFontFamilyAttribute,
|
||||
[[NSNumber numberWithDouble: [self pointSize]] stringValue],
|
||||
NSFontSizeAttribute,
|
||||
// [self
|
||||
// matrix], NSFontMatrixAttribute,
|
||||
//// currently returns nil
|
||||
// [self coveredCharacterSet], NSFontCharacterSetAttribute, //
|
||||
// currently returns nil
|
||||
[self _fontTraitsAsDictionary], NSFontTraitsAttribute,
|
||||
[typeface traitName], NSFontFaceAttribute,
|
||||
[NSNumber numberWithDouble: [self maximumAdvancement].width],
|
||||
NSFontFixedAdvanceAttribute, [self displayName],
|
||||
NSFontVisibleNameAttribute, nil];
|
||||
dictionaryWithObjectsAndKeys:
|
||||
[self fontName], NSFontNameAttribute, [self familyName],
|
||||
NSFontFamilyAttribute,
|
||||
[[NSNumber numberWithDouble: [self pointSize]] stringValue],
|
||||
NSFontSizeAttribute,
|
||||
// [self
|
||||
// matrix], NSFontMatrixAttribute,
|
||||
//// currently returns nil
|
||||
// [self coveredCharacterSet], NSFontCharacterSetAttribute,
|
||||
// // currently returns nil
|
||||
[self _fontTraitsAsDictionary], NSFontTraitsAttribute,
|
||||
[typeface traitName], NSFontFaceAttribute,
|
||||
[NSNumber
|
||||
numberWithDouble: [self maximumAdvancement].width],
|
||||
NSFontFixedAdvanceAttribute, [self displayName],
|
||||
NSFontVisibleNameAttribute, nil];
|
||||
|
||||
NSFontDescriptor *descriptor =
|
||||
[NSFontDescriptor fontDescriptorWithFontAttributes: attributes];
|
||||
[NSFontDescriptor fontDescriptorWithFontAttributes: attributes];
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@ -885,7 +888,7 @@ static NSLock *_cacheLock = nil;
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat: @"<%@ %@ %f>", [self class], _name, _pointSize];
|
||||
stringWithFormat: @"<%@ %@ %f>", [self class], _name, _pointSize];
|
||||
}
|
||||
|
||||
NSInteger NSConvertGlyphsToPackedGlyphs(NSGlyph *glyphs, NSInteger length,
|
||||
|
@ -33,7 +33,7 @@ NSString *const NSFontFixedAdvanceAttribute = @"NSFontFixedAdvanceAttribute";
|
||||
NSString *const NSFontVisibleNameAttribute = @"NSFontVisibleNameAttribute";
|
||||
NSString *const NSFontCascadeListAttribute = @"NSCTFontCascadeListAttribute";
|
||||
NSString *const NSFontFeatureSettingsAttribute =
|
||||
@"NSCTFontFeatureSettingsAttribute";
|
||||
@"NSCTFontFeatureSettingsAttribute";
|
||||
NSString *const NSFontVariationAttribute = @"NSCTFontVariationAttribute";
|
||||
|
||||
NSString *const NSFontSymbolicTrait = @"NSFontSymbolicTrait";
|
||||
@ -73,28 +73,28 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
|
||||
|
||||
+ fontDescriptorWithFontAttributes: (NSDictionary *) attributes {
|
||||
return [[[self allocWithZone: NULL] initWithFontAttributes: attributes]
|
||||
autorelease];
|
||||
autorelease];
|
||||
}
|
||||
|
||||
+ fontDescriptorWithName: (NSString *) name
|
||||
matrix: (NSAffineTransform *) matrix
|
||||
{
|
||||
NSDictionary *attributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: name, NSFontNameAttribute, matrix,
|
||||
NSFontMatrixAttribute, nil];
|
||||
dictionaryWithObjectsAndKeys: name, NSFontNameAttribute, matrix,
|
||||
NSFontMatrixAttribute, nil];
|
||||
return [[[self allocWithZone: NULL] initWithFontAttributes: attributes]
|
||||
autorelease];
|
||||
autorelease];
|
||||
}
|
||||
|
||||
+ fontDescriptorWithName: (NSString *) name size: (CGFloat) pointSize {
|
||||
NSDictionary *attributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: name, NSFontNameAttribute,
|
||||
[[NSNumber numberWithFloat: pointSize]
|
||||
stringValue],
|
||||
NSFontSizeAttribute, nil];
|
||||
dictionaryWithObjectsAndKeys: name, NSFontNameAttribute,
|
||||
[[NSNumber numberWithFloat: pointSize]
|
||||
stringValue],
|
||||
NSFontSizeAttribute, nil];
|
||||
|
||||
return [[[self allocWithZone: NULL] initWithFontAttributes: attributes]
|
||||
autorelease];
|
||||
autorelease];
|
||||
}
|
||||
|
||||
- (NSDictionary *) fontAttributes {
|
||||
@ -115,15 +115,15 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
|
||||
|
||||
- (NSFontSymbolicTraits) symbolicTraits {
|
||||
NSDictionary *fontTraits =
|
||||
[_attributes objectForKey: NSFontTraitsAttribute];
|
||||
[_attributes objectForKey: NSFontTraitsAttribute];
|
||||
return [[fontTraits objectForKey: NSFontSymbolicTrait] unsignedIntValue];
|
||||
}
|
||||
|
||||
- (NSFontDescriptor *) fontDescriptorByAddingAttributes:
|
||||
(NSDictionary *) attributes
|
||||
(NSDictionary *) attributes
|
||||
{
|
||||
NSMutableDictionary *copy =
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
|
||||
[copy addEntriesFromDictionary: attributes];
|
||||
|
||||
@ -132,7 +132,7 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
|
||||
|
||||
- (NSFontDescriptor *) fontDescriptorWithFace: (NSString *) face {
|
||||
NSMutableDictionary *copy =
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
|
||||
[copy setObject: face forKey: NSFontFaceAttribute];
|
||||
|
||||
@ -141,7 +141,7 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
|
||||
|
||||
- (NSFontDescriptor *) fontDescriptorWithFamily: (NSString *) family {
|
||||
NSMutableDictionary *copy =
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
|
||||
[copy setObject: family forKey: NSFontFamilyAttribute];
|
||||
|
||||
@ -150,7 +150,7 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
|
||||
|
||||
- (NSFontDescriptor *) fontDescriptorWithMatrix: (NSAffineTransform *) matrix {
|
||||
NSMutableDictionary *copy =
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
|
||||
[copy setObject: matrix forKey: NSFontMatrixAttribute];
|
||||
|
||||
@ -159,7 +159,7 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
|
||||
|
||||
- (NSFontDescriptor *) fontDescriptorWithSize: (CGFloat) pointSize {
|
||||
NSMutableDictionary *copy =
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
|
||||
[copy setObject: [NSNumber numberWithFloat: pointSize]
|
||||
forKey: NSFontSizeAttribute];
|
||||
@ -168,14 +168,14 @@ const NSFontWeight NSFontWeightRegular = 0x0000000000000000;
|
||||
}
|
||||
|
||||
- (NSFontDescriptor *) fontDescriptorWithSymbolicTraits:
|
||||
(NSFontSymbolicTraits) traits
|
||||
(NSFontSymbolicTraits) traits
|
||||
{
|
||||
NSMutableDictionary *copy =
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
[NSMutableDictionary dictionaryWithDictionary: _attributes];
|
||||
|
||||
NSMutableDictionary *traitsCopy = [NSMutableDictionary
|
||||
dictionaryWithDictionary: [_attributes
|
||||
objectForKey: NSFontTraitsAttribute]];
|
||||
dictionaryWithDictionary:
|
||||
[_attributes objectForKey: NSFontTraitsAttribute]];
|
||||
[traitsCopy setObject: [NSNumber numberWithUnsignedInt: traits]
|
||||
forKey: NSFontSymbolicTrait];
|
||||
[copy setObject: traitsCopy forKey: NSFontTraitsAttribute];
|
||||
|
@ -62,7 +62,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSFontFamily *family = [[self alloc] initWithName: familyName];
|
||||
[self addFontFamily: family];
|
||||
NSArray *typefaces =
|
||||
[[NSDisplay currentDisplay] fontTypefacesForFamilyName: familyName];
|
||||
[[NSDisplay currentDisplay] fontTypefacesForFamilyName: familyName];
|
||||
[family addTypefaces: typefaces];
|
||||
return [family autorelease];
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ static Class _fontPanelFactory;
|
||||
NSArray *families = [NSFontFamily allFontFamilyNames];
|
||||
|
||||
if (![_delegate respondsToSelector: @selector(fontManager:
|
||||
willIncludeFont:)])
|
||||
willIncludeFont:)])
|
||||
return families;
|
||||
else {
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
@ -139,7 +139,7 @@ static Class _fontPanelFactory;
|
||||
for (i = 0; i < count; i++) {
|
||||
NSString *familyName = [families objectAtIndex: i];
|
||||
NSFontFamily *family =
|
||||
[NSFontFamily fontFamilyWithName: familyName];
|
||||
[NSFontFamily fontFamilyWithName: familyName];
|
||||
NSArray *typefaces = [family typefaces];
|
||||
int t, tcount = [typefaces count];
|
||||
|
||||
@ -170,18 +170,19 @@ static Class _fontPanelFactory;
|
||||
NSString *traitName = [typeface traitName];
|
||||
|
||||
// Callers expect an array of four objects
|
||||
[result
|
||||
addObject: [NSArray arrayWithObjects: name, traitName,
|
||||
[NSNumber numberWithInt: 0],
|
||||
[NSNumber numberWithInt: 0],
|
||||
nil]];
|
||||
[result addObject: [NSArray arrayWithObjects: name, traitName,
|
||||
[NSNumber
|
||||
numberWithInt: 0],
|
||||
[NSNumber
|
||||
numberWithInt: 0],
|
||||
nil]];
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
- (NSArray *) availableFontNamesMatchingFontDescriptor:
|
||||
(NSFontDescriptor *) descriptor
|
||||
(NSFontDescriptor *) descriptor
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
@ -247,7 +248,7 @@ static Class _fontPanelFactory;
|
||||
|
||||
- (NSFontTraitMask) traitsOfFont: (NSFont *) font {
|
||||
NSFontTypeface *typeface =
|
||||
[NSFontFamily fontTypefaceWithName: [font fontName]];
|
||||
[NSFontFamily fontTypefaceWithName: [font fontName]];
|
||||
|
||||
return [typeface traits];
|
||||
}
|
||||
@ -318,34 +319,38 @@ static Class _fontPanelFactory;
|
||||
if (traits & NSItalicFontMask) {
|
||||
[item setTag: NSUnitalicFontMask];
|
||||
[item setTitle: NSLocalizedStringFromTableInBundle(
|
||||
@"Unitalic", nil,
|
||||
[NSBundle bundleForClass: [NSFontManager
|
||||
@"Unitalic", nil,
|
||||
[NSBundle bundleForClass:
|
||||
[NSFontManager
|
||||
class]],
|
||||
@"Remove the italic font trait")];
|
||||
@"Remove the italic font trait")];
|
||||
} else {
|
||||
[item setTag: NSItalicFontMask];
|
||||
[item setTitle: NSLocalizedStringFromTableInBundle(
|
||||
@"Italic", nil,
|
||||
[NSBundle bundleForClass: [NSFontManager
|
||||
@"Italic", nil,
|
||||
[NSBundle bundleForClass:
|
||||
[NSFontManager
|
||||
class]],
|
||||
@"Add the italic font trait")];
|
||||
@"Add the italic font trait")];
|
||||
}
|
||||
}
|
||||
if (tag & (NSBoldFontMask | NSUnboldFontMask)) {
|
||||
if (traits & NSBoldFontMask) {
|
||||
[item setTag: NSUnboldFontMask];
|
||||
[item setTitle: NSLocalizedStringFromTableInBundle(
|
||||
@"Unbold", nil,
|
||||
[NSBundle bundleForClass: [NSFontManager
|
||||
@"Unbold", nil,
|
||||
[NSBundle bundleForClass:
|
||||
[NSFontManager
|
||||
class]],
|
||||
@"Remove the bold font trait")];
|
||||
@"Remove the bold font trait")];
|
||||
} else {
|
||||
[item setTag: NSBoldFontMask];
|
||||
[item setTitle: NSLocalizedStringFromTableInBundle(
|
||||
@"Bold", nil,
|
||||
[NSBundle bundleForClass: [NSFontManager
|
||||
@"Bold", nil,
|
||||
[NSBundle bundleForClass:
|
||||
[NSFontManager
|
||||
class]],
|
||||
@"Add the bold font trait")];
|
||||
@"Add the bold font trait")];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -427,7 +432,7 @@ static Class _fontPanelFactory;
|
||||
toHaveTrait: (NSFontTraitMask) addTraits
|
||||
{
|
||||
NSFontFamily *family =
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [font fontName]];
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [font fontName]];
|
||||
NSFontTypeface *typeface = [family typefaceWithName: [font fontName]];
|
||||
NSFontTraitMask traits = [typeface traits];
|
||||
|
||||
@ -459,7 +464,7 @@ static Class _fontPanelFactory;
|
||||
}
|
||||
|
||||
NSFontFamily *family =
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [font fontName]];
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [font fontName]];
|
||||
NSFontTypeface *typeface = [family typefaceWithName: [font fontName]];
|
||||
NSFontTraitMask traits = [typeface traits];
|
||||
NSFontTypeface *newface;
|
||||
@ -526,7 +531,7 @@ static Class _fontPanelFactory;
|
||||
|
||||
// Get the current traits so we try and match them...
|
||||
NSFontFamily *fontFamily =
|
||||
[NSFontFamily fontFamilyWithName: [font familyName]];
|
||||
[NSFontFamily fontFamilyWithName: [font familyName]];
|
||||
NSFontTypeface *typeface = [fontFamily typefaceWithName: [font fontName]];
|
||||
NSFontTraitMask traits = [typeface traits];
|
||||
return [self fontWithFamily: family
|
||||
|
@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- initWithSize: (NSSize) size
|
||||
ascender: (CGFloat) ascender
|
||||
descender: (CGFloat) descender;
|
||||
ascender: (CGFloat) ascender
|
||||
descender: (CGFloat) descender;
|
||||
|
||||
@end
|
||||
|
@ -23,8 +23,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
@implementation NSFontMetric
|
||||
|
||||
- initWithSize: (NSSize) size
|
||||
ascender: (CGFloat) ascender
|
||||
descender: (CGFloat) descender
|
||||
ascender: (CGFloat) ascender
|
||||
descender: (CGFloat) descender
|
||||
{
|
||||
_size = size;
|
||||
_ascender = ascender;
|
||||
|
@ -40,7 +40,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (NSArray *) availableTraitsInFamily: (NSString *) familyName {
|
||||
NSMutableArray *result = [NSMutableArray array];
|
||||
NSArray *members = [[NSFontManager sharedFontManager]
|
||||
availableMembersOfFontFamily: familyName];
|
||||
availableMembersOfFontFamily: familyName];
|
||||
int i, count = [members count];
|
||||
|
||||
// (fullName,traitName,size,traits)
|
||||
@ -131,7 +131,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (NSString *) selectedFontName {
|
||||
NSArray *members = [[NSFontManager sharedFontManager]
|
||||
availableMembersOfFontFamily: [self selectedFamilyName]];
|
||||
availableMembersOfFontFamily: [self selectedFamilyName]];
|
||||
int row = [_typefaceMatrix selectedRow];
|
||||
|
||||
if (row < 0)
|
||||
@ -159,7 +159,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
int i, count = [traits count];
|
||||
int selectRow = 0;
|
||||
NSString *oldTrait =
|
||||
[[[[_typefaceMatrix selectedCell] stringValue] retain] autorelease];
|
||||
[[[[_typefaceMatrix selectedCell] stringValue] retain] autorelease];
|
||||
|
||||
[_typefaceMatrix renewRows: count columns: 1];
|
||||
for (i = 0; i < count; i++) {
|
||||
@ -194,14 +194,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
CGFloat pointSize = [self selectedPointSize];
|
||||
|
||||
[_sampleTextField
|
||||
setStringValue: [[font displayName]
|
||||
stringByAppendingFormat: @" %g pt", pointSize]];
|
||||
setStringValue: [[font displayName]
|
||||
stringByAppendingFormat: @" %g pt",
|
||||
pointSize]];
|
||||
[_sampleTextField setFont: font];
|
||||
}
|
||||
|
||||
- (void) setPanelFont: (NSFont *) font isMultiple: (BOOL) isMultiple {
|
||||
NSFontFamily *family =
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [font fontName]];
|
||||
[NSFontFamily fontFamilyWithTypefaceName: [font fontName]];
|
||||
NSFontTypeface *typeface = [family typefaceWithName: [font fontName]]; {
|
||||
NSArray *families = [self availableFontFamilies];
|
||||
NSString *familyName = [family name];
|
||||
@ -210,8 +211,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
unsigned traitIndex = [traits indexOfObject: [typeface traitName]];
|
||||
NSArray *sizes = [self availablePointSizes];
|
||||
unsigned sizeIndex = [sizes
|
||||
indexOfObject: [NSString
|
||||
stringWithFormat: @"%g", [font pointSize]]];
|
||||
indexOfObject: [NSString stringWithFormat: @"%g",
|
||||
[font pointSize]]];
|
||||
|
||||
[self buildFamilyMatrix];
|
||||
[_familyMatrix selectCellAtRow: familyIndex column: 0];
|
||||
@ -260,10 +261,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
if (row >= 0) {
|
||||
[_sizeTextField
|
||||
setStringValue: [NSString
|
||||
stringWithFormat: @"%g",
|
||||
[[sizes objectAtIndex: row]
|
||||
floatValue]]];
|
||||
setStringValue:
|
||||
[NSString stringWithFormat: @"%g",
|
||||
[[sizes objectAtIndex: row]
|
||||
floatValue]]];
|
||||
}
|
||||
|
||||
[self buildSampleTextField];
|
||||
|
@ -30,12 +30,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- initWithName: (NSString *) name
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits;
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits;
|
||||
- initWithName: (NSString *) name
|
||||
displayName: (NSString *) displayName
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits;
|
||||
displayName: (NSString *) displayName
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits;
|
||||
|
||||
- (NSString *) name;
|
||||
- (NSString *) displayName;
|
||||
|
@ -24,9 +24,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
@implementation NSFontTypeface
|
||||
|
||||
- initWithName: (NSString *) name
|
||||
displayName: (NSString *) displayName
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits
|
||||
displayName: (NSString *) displayName
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits
|
||||
{
|
||||
_name = [name copy];
|
||||
_displayName = [displayName copy];
|
||||
@ -37,8 +37,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
- initWithName: (NSString *) name
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits
|
||||
traitName: (NSString *) traitName
|
||||
traits: (NSFontTraitMask) traits
|
||||
{
|
||||
return [self initWithName: name
|
||||
displayName: name
|
||||
|
@ -172,7 +172,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
- (NSAttributedString *) attributedStringValue {
|
||||
NSMutableDictionary *attributes = [NSMutableDictionary dictionary];
|
||||
NSMutableParagraphStyle *paraStyle =
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
||||
[[[NSParagraphStyle defaultParagraphStyle] mutableCopy]
|
||||
autorelease];
|
||||
NSFont *font = [self font];
|
||||
|
||||
if (font != nil)
|
||||
@ -189,9 +190,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[paraStyle setAlignment: _textAlignment];
|
||||
[attributes setObject: paraStyle forKey: NSParagraphStyleAttributeName];
|
||||
|
||||
return
|
||||
[[[NSAttributedString alloc] initWithString: [self stringValue]
|
||||
attributes: attributes] autorelease];
|
||||
return [[[NSAttributedString alloc] initWithString: [self stringValue]
|
||||
attributes: attributes]
|
||||
autorelease];
|
||||
}
|
||||
|
||||
- (void) drawInteriorWithFrame: (NSRect) frame inView: (NSView *) control {
|
||||
@ -203,7 +204,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
titleRect.origin.x = frame.origin.x;
|
||||
titleRect.origin.y =
|
||||
frame.origin.y + floor((frame.size.height - titleSize.height) / 2);
|
||||
frame.origin.y + floor((frame.size.height - titleSize.height) / 2);
|
||||
titleRect.size.width = _titleWidth;
|
||||
titleRect.size.height = titleSize.height;
|
||||
|
||||
|
@ -62,13 +62,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[string getCharacters: characterChunk
|
||||
range: NSMakeRange(characterIndex, chunkSize)];
|
||||
[font getGlyphs: glyphChunk
|
||||
forCharacters: characterChunk
|
||||
length: chunkSize];
|
||||
forCharacters: characterChunk
|
||||
length: chunkSize];
|
||||
|
||||
[glyphStorage insertGlyphs: glyphChunk
|
||||
length: chunkSize
|
||||
forStartingGlyphAtIndex: glyphIndex
|
||||
characterIndex: characterIndex];
|
||||
length: chunkSize
|
||||
forStartingGlyphAtIndex: glyphIndex
|
||||
characterIndex: characterIndex];
|
||||
|
||||
characterIndex += chunkSize;
|
||||
glyphIndex += chunkSize;
|
||||
|
@ -37,10 +37,10 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
+ (NSGlyphInfo *) glyphInfoWithCharacterIdentifier: (NSUInteger) identifier
|
||||
collection:
|
||||
(NSCharacterCollection) collection
|
||||
baseString: (NSString *) baseString
|
||||
+ (NSGlyphInfo *)
|
||||
glyphInfoWithCharacterIdentifier: (NSUInteger) identifier
|
||||
collection: (NSCharacterCollection) collection
|
||||
baseString: (NSString *) baseString
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
return nil;
|
||||
|
@ -73,9 +73,9 @@ static void evaluate(void *info, CGFloat const *input, CGFloat *output) {
|
||||
for (componentIndex = 0; componentIndex < self->_numberOfComponents;
|
||||
componentIndex++) {
|
||||
output[componentIndex] =
|
||||
(components[startColorIndex][componentIndex] +
|
||||
(ratio * (components[endColorIndex][componentIndex] -
|
||||
components[startColorIndex][componentIndex])));
|
||||
(components[startColorIndex][componentIndex] +
|
||||
(ratio * (components[endColorIndex][componentIndex] -
|
||||
components[startColorIndex][componentIndex])));
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ static void evaluate(void *info, CGFloat const *input, CGFloat *output) {
|
||||
endingColor: (NSColor *) endingColor
|
||||
{
|
||||
NSArray *colors =
|
||||
[NSArray arrayWithObjects: startingColor, endingColor, nil];
|
||||
[NSArray arrayWithObjects: startingColor, endingColor, nil];
|
||||
CGFloat locations[2] = {0.0, 1.0};
|
||||
|
||||
return [self initWithColors: colors
|
||||
@ -129,8 +129,8 @@ static void evaluate(void *info, CGFloat const *input, CGFloat *output) {
|
||||
}
|
||||
|
||||
- initWithColors: (NSArray *) colors
|
||||
atLocations: (const CGFloat *) locations
|
||||
colorSpace: (NSColorSpace *) colorSpace
|
||||
atLocations: (const CGFloat *) locations
|
||||
colorSpace: (NSColorSpace *) colorSpace
|
||||
{
|
||||
_colorSpace = [[NSColorSpace deviceRGBColorSpace] retain];
|
||||
_numberOfColors = [colors count];
|
||||
@ -145,7 +145,7 @@ static void evaluate(void *info, CGFloat const *input, CGFloat *output) {
|
||||
|
||||
color = [color colorUsingColorSpaceName: NSDeviceRGBColorSpace];
|
||||
_components[i] =
|
||||
NSZoneMalloc(NULL, sizeof(CGFloat) * _numberOfComponents);
|
||||
NSZoneMalloc(NULL, sizeof(CGFloat) * _numberOfComponents);
|
||||
[color getComponents: _components[i]];
|
||||
|
||||
_locations[i] = locations[i];
|
||||
@ -174,8 +174,8 @@ static void evaluate(void *info, CGFloat const *input, CGFloat *output) {
|
||||
{
|
||||
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
|
||||
CGFunctionCallbacks callbacks = {0, evaluate, NULL};
|
||||
CGFunctionRef function =
|
||||
CGFunctionCreate(self, 1, NULL, _numberOfComponents, NULL, &callbacks);
|
||||
CGFunctionRef function = CGFunctionCreate(
|
||||
self, 1, NULL, _numberOfComponents, NULL, &callbacks);
|
||||
CGColorSpaceRef colorSpace = [_colorSpace CGColorSpace];
|
||||
CGShadingRef shading = CGShadingCreateAxial(colorSpace, startingPoint,
|
||||
endingPoint, function, NO, NO);
|
||||
@ -257,7 +257,7 @@ static void evaluate(void *info, CGFloat const *input, CGFloat *output) {
|
||||
}
|
||||
|
||||
- (void) drawInBezierPath: (NSBezierPath *) path
|
||||
relativeCenterPosition: (NSPoint) center
|
||||
relativeCenterPosition: (NSPoint) center
|
||||
{
|
||||
NSUnimplementedMethod();
|
||||
}
|
||||
|
@ -52,20 +52,20 @@ NSString *const NSDeviceBitsPerSample = @"NSDeviceBitsPerSample";
|
||||
|
||||
static inline CGBlendMode blendModeForCompositeOp(NSCompositingOperation op) {
|
||||
static CGBlendMode table[] = {
|
||||
kCGBlendModeClear,
|
||||
kCGBlendModeCopy,
|
||||
kCGBlendModeNormal,
|
||||
kCGBlendModeSourceIn,
|
||||
kCGBlendModeSourceOut,
|
||||
kCGBlendModeSourceAtop,
|
||||
kCGBlendModeDestinationOver,
|
||||
kCGBlendModeDestinationIn,
|
||||
kCGBlendModeDestinationOut,
|
||||
kCGBlendModeDestinationAtop,
|
||||
kCGBlendModeXOR,
|
||||
kCGBlendModePlusDarker,
|
||||
kCGBlendModeNormal, // FIXME: highlight
|
||||
kCGBlendModePlusLighter,
|
||||
kCGBlendModeClear,
|
||||
kCGBlendModeCopy,
|
||||
kCGBlendModeNormal,
|
||||
kCGBlendModeSourceIn,
|
||||
kCGBlendModeSourceOut,
|
||||
kCGBlendModeSourceAtop,
|
||||
kCGBlendModeDestinationOver,
|
||||
kCGBlendModeDestinationIn,
|
||||
kCGBlendModeDestinationOut,
|
||||
kCGBlendModeDestinationAtop,
|
||||
kCGBlendModeXOR,
|
||||
kCGBlendModePlusDarker,
|
||||
kCGBlendModeNormal, // FIXME: highlight
|
||||
kCGBlendModePlusLighter,
|
||||
};
|
||||
|
||||
if (op < NSCompositeClear || op > NSCompositePlusLighter)
|
||||
|
@ -61,8 +61,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_isDrawingToScreen = CGContextIsBitmapContext(context);
|
||||
_isFlipped = flipped;
|
||||
_deviceDescription =
|
||||
[[NSDictionary dictionaryWithObject: [NSNumber numberWithBool: NO]
|
||||
forKey: NSDeviceIsScreen] copy];
|
||||
[[NSDictionary dictionaryWithObject: [NSNumber numberWithBool: NO]
|
||||
forKey: NSDeviceIsScreen] copy];
|
||||
_shouldAntialias = YES;
|
||||
_renderingIntent = NSColorRenderingIntentDefault;
|
||||
_compOperation = NSCompositeSourceOver;
|
||||
@ -78,9 +78,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
_graphicsPort = CGBitmapContextCreate(
|
||||
[imageRep bitmapData], [imageRep pixelsWide], [imageRep pixelsHigh],
|
||||
[imageRep bitsPerSample], [imageRep bytesPerRow], colorSpace,
|
||||
[imageRep CGBitmapInfo]);
|
||||
[imageRep bitmapData], [imageRep pixelsWide], [imageRep pixelsHigh],
|
||||
[imageRep bitsPerSample], [imageRep bytesPerRow], colorSpace,
|
||||
[imageRep CGBitmapInfo]);
|
||||
|
||||
if (_graphicsPort == nil) {
|
||||
[self dealloc];
|
||||
@ -91,8 +91,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
_isDrawingToScreen = YES;
|
||||
_isFlipped = NO;
|
||||
_deviceDescription =
|
||||
[[NSDictionary dictionaryWithObject: [NSNumber numberWithBool: YES]
|
||||
forKey: NSDeviceIsScreen] copy];
|
||||
[[NSDictionary dictionaryWithObject: [NSNumber numberWithBool: YES]
|
||||
forKey: NSDeviceIsScreen] copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -117,7 +117,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
}
|
||||
|
||||
+ (NSGraphicsContext *) graphicsContextWithBitmapImageRep:
|
||||
(NSBitmapImageRep *) imageRep
|
||||
(NSBitmapImageRep *) imageRep
|
||||
{
|
||||
return [[[self alloc] initWithBitmapImageRep: imageRep] autorelease];
|
||||
}
|
||||
@ -233,20 +233,20 @@ NSMutableArray *NSCurrentFocusStack() {
|
||||
|
||||
- (void) setCompositingOperation: (NSCompositingOperation) value {
|
||||
CGBlendMode blendMode[] = {
|
||||
kCGBlendModeClear,
|
||||
kCGBlendModeCopy,
|
||||
kCGBlendModeNormal,
|
||||
kCGBlendModeSourceIn,
|
||||
kCGBlendModeSourceOut,
|
||||
kCGBlendModeSourceAtop,
|
||||
kCGBlendModeDestinationOver,
|
||||
kCGBlendModeDestinationIn,
|
||||
kCGBlendModeDestinationOut,
|
||||
kCGBlendModeDestinationAtop,
|
||||
kCGBlendModeXOR,
|
||||
kCGBlendModePlusDarker,
|
||||
kCGBlendModeNormal,
|
||||
kCGBlendModePlusLighter,
|
||||
kCGBlendModeClear,
|
||||
kCGBlendModeCopy,
|
||||
kCGBlendModeNormal,
|
||||
kCGBlendModeSourceIn,
|
||||
kCGBlendModeSourceOut,
|
||||
kCGBlendModeSourceAtop,
|
||||
kCGBlendModeDestinationOver,
|
||||
kCGBlendModeDestinationIn,
|
||||
kCGBlendModeDestinationOut,
|
||||
kCGBlendModeDestinationAtop,
|
||||
kCGBlendModeXOR,
|
||||
kCGBlendModePlusDarker,
|
||||
kCGBlendModeNormal,
|
||||
kCGBlendModePlusLighter,
|
||||
};
|
||||
if (value < NSCompositeClear || value > NSCompositePlusLighter)
|
||||
return;
|
||||
|
160
AppKit/NSImage.m
160
AppKit/NSImage.m
@ -43,16 +43,16 @@ NSImageName const NSImageNameColumnViewTemplate = @"NSColumnViewTemplate";
|
||||
NSImageName const NSImageNameComputer = @"NSComputer";
|
||||
NSImageName const NSImageNameDotMac = @"NSDotMac";
|
||||
NSImageName const NSImageNameEnterFullScreenTemplate =
|
||||
@"NSEnterFullScreenTemplate";
|
||||
@"NSEnterFullScreenTemplate";
|
||||
NSImageName const NSImageNameEveryone = @"NSEveryone";
|
||||
NSImageName const NSImageNameExitFullScreenTemplate =
|
||||
@"NSExitFullScreenTemplate";
|
||||
@"NSExitFullScreenTemplate";
|
||||
NSImageName const NSImageNameFlowViewTemplate = @"NSFlowViewTemplate";
|
||||
NSImageName const NSImageNameFolder = @"NSFolder";
|
||||
NSImageName const NSImageNameFolderBurnable = @"NSFolderBurnable";
|
||||
NSImageName const NSImageNameFolderSmart = @"NSFolderSmart";
|
||||
NSImageName const NSImageNameFollowLinkFreestandingTemplate =
|
||||
@"NSFollowLinkFreestandingTemplate";
|
||||
@"NSFollowLinkFreestandingTemplate";
|
||||
NSImageName const NSImageNameFontPanel = @"NSFontPanel";
|
||||
NSImageName const NSImageNameGoLeftTemplate = @"NSGoLeftTemplate";
|
||||
NSImageName const NSImageNameGoRightTemplate = @"NSGoRightTemplate";
|
||||
@ -61,14 +61,14 @@ NSImageName const NSImageNameIChatTheaterTemplate = @"NSIChatTheaterTemplate";
|
||||
NSImageName const NSImageNameIconViewTemplate = @"NSIconViewTemplate";
|
||||
NSImageName const NSImageNameInfo = @"NSInfo";
|
||||
NSImageName const NSImageNameInvalidDataFreestandingTemplate =
|
||||
@"NSInvalidDataFreestandingTemplate";
|
||||
@"NSInvalidDataFreestandingTemplate";
|
||||
NSImageName const NSImageNameLeftFacingTriangleTemplate =
|
||||
@"NSLeftFacingTriangleTemplate";
|
||||
@"NSLeftFacingTriangleTemplate";
|
||||
NSImageName const NSImageNameListViewTemplate = @"NSListViewTemplate";
|
||||
NSImageName const NSImageNameLockLockedTemplate = @"NSLockLockedTemplate";
|
||||
NSImageName const NSImageNameLockUnlockedTemplate = @"NSLockUnlockedTemplate";
|
||||
NSImageName const NSImageNameMenuMixedStateTemplate =
|
||||
@"NSMenuMixedStateTemplate";
|
||||
@"NSMenuMixedStateTemplate";
|
||||
NSImageName const NSImageNameMenuOnStateTemplate = @"NSMenuOnStateTemplate";
|
||||
NSImageName const NSImageNameMobileMe = @"NSMobileMe";
|
||||
NSImageName const NSImageNameMultipleDocuments = @"NSMultipleDocuments";
|
||||
@ -77,23 +77,23 @@ NSImageName const NSImageNamePathTemplate = @"NSPathTemplate";
|
||||
NSImageName const NSImageNamePreferencesGeneral = @"NSPreferencesGeneral";
|
||||
NSImageName const NSImageNameQuickLookTemplate = @"NSQuickLookTemplate";
|
||||
NSImageName const NSImageNameRefreshFreestandingTemplate =
|
||||
@"NSRefreshFreestandingTemplate";
|
||||
@"NSRefreshFreestandingTemplate";
|
||||
NSImageName const NSImageNameRefreshTemplate = @"NSRefreshTemplate";
|
||||
NSImageName const NSImageNameRemoveTemplate = @"NSRemoveTemplate";
|
||||
NSImageName const NSImageNameRevealFreestandingTemplate =
|
||||
@"NSRevealFreestandingTemplate";
|
||||
@"NSRevealFreestandingTemplate";
|
||||
NSImageName const NSImageNameRightFacingTriangleTemplate =
|
||||
@"NSRightFacingTriangleTemplate";
|
||||
@"NSRightFacingTriangleTemplate";
|
||||
NSImageName const NSImageNameShareTemplate = @"NSShareTemplate";
|
||||
NSImageName const NSImageNameSlideshowTemplate = @"NSSlideshowTemplate";
|
||||
NSImageName const NSImageNameSmartBadgeTemplate = @"NSSmartBadgeTemplate";
|
||||
NSImageName const NSImageNameStatusAvailable = @"NSStatusAvailable";
|
||||
NSImageName const NSImageNameStatusNone = @"NSStatusNone";
|
||||
NSImageName const NSImageNameStatusPartiallyAvailable =
|
||||
@"NSStatusPartiallyAvailable";
|
||||
@"NSStatusPartiallyAvailable";
|
||||
NSImageName const NSImageNameStatusUnavailable = @"NSStatusUnavailable";
|
||||
NSImageName const NSImageNameStopProgressFreestandingTemplate =
|
||||
@"NSStopProgressFreestandingTemplate";
|
||||
@"NSStopProgressFreestandingTemplate";
|
||||
NSImageName const NSImageNameStopProgressTemplate = @"NSStopProgressTemplate";
|
||||
NSImageName const NSImageNameTrashEmpty = @"NSTrashEmpty";
|
||||
NSImageName const NSImageNameTrashFull = @"NSTrashFull";
|
||||
@ -104,11 +104,11 @@ NSImageName const NSImageNameUserGuest = @"NSUserGuest";
|
||||
NSImageName const NSImageNameGoBackTemplate = @"NSGoBackTemplate";
|
||||
NSImageName const NSImageNameGoForwardTemplate = @"NSGoForwardTemplate";
|
||||
NSImageName const NSImageNameTouchBarDeleteTemplate =
|
||||
@"NSTouchBarDeleteTemplate";
|
||||
@"NSTouchBarDeleteTemplate";
|
||||
NSImageName const NSImageNameTouchBarPauseTemplate = @"NSTouchBarPauseTemplate";
|
||||
NSImageName const NSImageNameTouchBarPlayTemplate = @"NSTouchBarPlayTemplate";
|
||||
NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
@"NSTouchBarRecordStopTemplate";
|
||||
@"NSTouchBarRecordStopTemplate";
|
||||
|
||||
// Private class used so the context knows the flipped status of a locked image
|
||||
// 10.4 does something like that - probably for more than just getting the
|
||||
@ -143,7 +143,7 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
[result addObjectsFromArray: [[allClasses objectAtIndex: i]
|
||||
imageUnfilteredFileTypes]];
|
||||
imageUnfilteredFileTypes]];
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -159,28 +159,29 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
[result addObjectsFromArray: [[allClasses objectAtIndex: i]
|
||||
imageUnfilteredPasteboardTypes]];
|
||||
imageUnfilteredPasteboardTypes]];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (BOOL) canInitWithPasteboard: (NSPasteboard *) pasteboard {
|
||||
NSString *available = [pasteboard
|
||||
availableTypeFromArray: [self imageUnfilteredPasteboardTypes]];
|
||||
availableTypeFromArray: [self imageUnfilteredPasteboardTypes]];
|
||||
|
||||
return (available != nil) ? YES : NO;
|
||||
}
|
||||
|
||||
+ (NSArray *) _checkBundles {
|
||||
return [NSArray
|
||||
arrayWithObjects: [NSBundle mainBundle], // Check the main bundle first
|
||||
// according to the doc
|
||||
[NSBundle bundleForClass: self], nil];
|
||||
arrayWithObjects: [NSBundle
|
||||
mainBundle], // Check the main bundle
|
||||
// first according to the doc
|
||||
[NSBundle bundleForClass: self], nil];
|
||||
}
|
||||
|
||||
+ (NSMutableDictionary *) allImages {
|
||||
NSMutableDictionary *result = [[[NSThread currentThread] threadDictionary]
|
||||
objectForKey: @"__allImages"];
|
||||
objectForKey: @"__allImages"];
|
||||
|
||||
if (result == nil) {
|
||||
result = [NSMutableDictionary dictionary];
|
||||
@ -206,7 +207,7 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
if (path != nil) {
|
||||
image = [[[NSImage alloc] initWithContentsOfFile: path]
|
||||
autorelease];
|
||||
autorelease];
|
||||
[image setName: name];
|
||||
if (image) {
|
||||
break;
|
||||
@ -228,8 +229,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
NSKeyedUnarchiver *keyed = (NSKeyedUnarchiver *) coder;
|
||||
NSUInteger length;
|
||||
const unsigned char *tiff =
|
||||
[keyed decodeBytesForKey: @"NSTIFFRepresentation"
|
||||
returnedLength: &length];
|
||||
[keyed decodeBytesForKey: @"NSTIFFRepresentation"
|
||||
returnedLength: &length];
|
||||
NSBitmapImageRep *rep;
|
||||
|
||||
if (tiff == NULL) {
|
||||
@ -238,7 +239,7 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
}
|
||||
|
||||
rep = [NSBitmapImageRep
|
||||
imageRepWithData: [NSData dataWithBytes: tiff length: length]];
|
||||
imageRepWithData: [NSData dataWithBytes: tiff length: length]];
|
||||
if (rep == nil) {
|
||||
[self release];
|
||||
return nil;
|
||||
@ -277,8 +278,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
withObject: data];
|
||||
else if ([repClass respondsToSelector: @selector(imageRepWithData:)]) {
|
||||
NSImageRep *rep =
|
||||
[repClass performSelector: @selector(imageRepWithData:)
|
||||
withObject: data];
|
||||
[repClass performSelector: @selector(imageRepWithData:)
|
||||
withObject: data];
|
||||
|
||||
if (rep != nil)
|
||||
reps = [NSArray arrayWithObject: rep];
|
||||
@ -328,8 +329,8 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
- initWithCGImage: (CGImageRef) cgImage size: (NSSize) size; {
|
||||
if (self = [self initWithSize: size]) {
|
||||
NSBitmapImageRep *rep =
|
||||
[[[NSBitmapImageRep alloc] initWithCGImage: cgImage] autorelease];
|
||||
NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc]
|
||||
initWithCGImage: cgImage] autorelease];
|
||||
[_representations addObject: rep];
|
||||
}
|
||||
return self;
|
||||
@ -337,8 +338,9 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
- initWithPasteboard: (NSPasteboard *) pasteboard {
|
||||
|
||||
NSString *available = [pasteboard
|
||||
availableTypeFromArray: [[self class] imageUnfilteredPasteboardTypes]];
|
||||
NSString *available =
|
||||
[pasteboard availableTypeFromArray:
|
||||
[[self class] imageUnfilteredPasteboardTypes]];
|
||||
NSData *data = [pasteboard dataForType: available];
|
||||
if (data == nil) {
|
||||
[self release];
|
||||
@ -556,10 +558,10 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
}
|
||||
|
||||
NSCachedImageRep *cached =
|
||||
[[NSCachedImageRep alloc] initWithSize: [self size]
|
||||
depth: 0
|
||||
separate: _isCachedSeparately
|
||||
alpha: YES];
|
||||
[[NSCachedImageRep alloc] initWithSize: [self size]
|
||||
depth: 0
|
||||
separate: _isCachedSeparately
|
||||
alpha: YES];
|
||||
[self addRepresentation: cached];
|
||||
[cached release];
|
||||
return cached;
|
||||
@ -580,8 +582,9 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
}
|
||||
|
||||
- (NSImageRep *)
|
||||
_bestUncachedFallbackCachedRepresentationForDevice: (NSDictionary *) device
|
||||
size: (NSSize) size
|
||||
_bestUncachedFallbackCachedRepresentationForDevice:
|
||||
(NSDictionary *) device
|
||||
size: (NSSize) size
|
||||
{
|
||||
int i, count = [_representations count];
|
||||
NSImageRep *best = nil;
|
||||
@ -646,7 +649,7 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
if ([device objectForKey: NSDeviceIsScreen] != nil) {
|
||||
NSImageRep *uncached =
|
||||
[self _bestUncachedRepresentationForDevice: device];
|
||||
[self _bestUncachedRepresentationForDevice: device];
|
||||
NSImageCacheMode caching = _cacheMode;
|
||||
|
||||
if (caching == NSImageCacheDefault) {
|
||||
@ -668,13 +671,14 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
case NSImageCacheBySize:
|
||||
if ([[uncached colorSpaceName]
|
||||
isEqual: [device objectForKey: NSDeviceColorSpaceName]]) {
|
||||
isEqual: [device objectForKey:
|
||||
NSDeviceColorSpaceName]]) {
|
||||
NSSize size = [self size];
|
||||
|
||||
if ((size.width == [uncached pixelsWide]) &&
|
||||
(size.height == [uncached pixelsHigh])) {
|
||||
int deviceBPS =
|
||||
[[device objectForKey: NSDeviceBitsPerSample] intValue];
|
||||
int deviceBPS = [[device
|
||||
objectForKey: NSDeviceBitsPerSample] intValue];
|
||||
|
||||
if (deviceBPS == [uncached bitsPerSample])
|
||||
return uncached;
|
||||
@ -741,7 +745,7 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
NSRect r = {.origin = NSZeroPoint, .size = check.size};
|
||||
[self lockFocus];
|
||||
NSBitmapImageRep *image =
|
||||
[[NSBitmapImageRep alloc] initWithFocusedViewRect: r];
|
||||
[[NSBitmapImageRep alloc] initWithFocusedViewRect: r];
|
||||
[self unlockFocus];
|
||||
|
||||
[bitmaps addObject: image];
|
||||
@ -749,16 +753,16 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
} else {
|
||||
NSSize size = [check size];
|
||||
NSBitmapImageRep *image = [[NSBitmapImageRep alloc]
|
||||
initWithBitmapDataPlanes: NULL
|
||||
pixelsWide: size.width
|
||||
pixelsHigh: size.height
|
||||
bitsPerSample: 8
|
||||
samplesPerPixel: 4
|
||||
hasAlpha: YES
|
||||
isPlanar: NO
|
||||
colorSpaceName: NSDeviceRGBColorSpace
|
||||
bytesPerRow: 0
|
||||
bitsPerPixel: 32];
|
||||
initWithBitmapDataPlanes: NULL
|
||||
pixelsWide: size.width
|
||||
pixelsHigh: size.height
|
||||
bitsPerSample: 8
|
||||
samplesPerPixel: 4
|
||||
hasAlpha: YES
|
||||
isPlanar: NO
|
||||
colorSpaceName: NSDeviceRGBColorSpace
|
||||
bytesPerRow: 0
|
||||
bitsPerPixel: 32];
|
||||
|
||||
[self lockFocusOnRepresentation: image];
|
||||
// we should probably use -draw here but not all reps implement it,
|
||||
@ -811,12 +815,12 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
if ([representation isKindOfClass: [NSCachedImageRep class]])
|
||||
context = [NSGraphicsContext
|
||||
graphicsContextWithWindow: [(NSCachedImageRep *)
|
||||
representation window]];
|
||||
graphicsContextWithWindow: [(NSCachedImageRep *) representation
|
||||
window]];
|
||||
else if ([representation isKindOfClass: [NSBitmapImageRep class]])
|
||||
context = [NSGraphicsContext
|
||||
graphicsContextWithBitmapImageRep: (NSBitmapImageRep *)
|
||||
representation];
|
||||
graphicsContextWithBitmapImageRep: (NSBitmapImageRep *)
|
||||
representation];
|
||||
|
||||
if (context == nil) {
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
@ -835,7 +839,7 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
// Some fake view, just so the context knows if it's flipped or not
|
||||
NSView *view = [[[NSImageCacheView alloc] initWithFlipped: [self isFlipped]]
|
||||
autorelease];
|
||||
autorelease];
|
||||
[[context focusStack] addObject: self];
|
||||
|
||||
if ([self isFlipped]) {
|
||||
@ -904,9 +908,9 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
}
|
||||
|
||||
[self drawInRect: rect
|
||||
fromRect: source
|
||||
operation: operation
|
||||
fraction: fraction];
|
||||
fromRect: source
|
||||
operation: operation
|
||||
fraction: fraction];
|
||||
CGContextRestoreGState(context);
|
||||
}
|
||||
|
||||
@ -945,9 +949,9 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
NSSize size = [self size];
|
||||
|
||||
[self drawInRect: NSMakeRect(point.x, point.y, size.width, size.height)
|
||||
fromRect: source
|
||||
operation: operation
|
||||
fraction: fraction];
|
||||
fromRect: source
|
||||
operation: operation
|
||||
fraction: fraction];
|
||||
}
|
||||
|
||||
- (void) drawInRect: (NSRect) rect
|
||||
@ -958,15 +962,15 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
// Keep a lid on any intermediate allocations while producing caches
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
NSImageRep *any =
|
||||
[[[self _bestUncachedFallbackCachedRepresentationForDevice: nil
|
||||
size: rect.size]
|
||||
NSImageRep *any = [[[self
|
||||
_bestUncachedFallbackCachedRepresentationForDevice: nil
|
||||
size: rect.size]
|
||||
retain] autorelease];
|
||||
NSImageRep *cachedRep = nil;
|
||||
CGContextRef context;
|
||||
NSRect fullRect = {.origin = NSZeroPoint, .size = self.size};
|
||||
BOOL drawFullImage =
|
||||
(NSIsEmptyRect(source) || NSEqualRects(source, fullRect));
|
||||
(NSIsEmptyRect(source) || NSEqualRects(source, fullRect));
|
||||
BOOL canCache = drawFullImage && !_isFlipped;
|
||||
|
||||
if (canCache) {
|
||||
@ -987,11 +991,11 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
|
||||
// Create a cached image rep to hold our image
|
||||
NSCachedImageRep *cached =
|
||||
[[[NSCachedImageRep alloc] initWithSize: cachedSize
|
||||
depth: 0
|
||||
separate: YES
|
||||
alpha: YES]
|
||||
autorelease]; // remember that pool we created earlier
|
||||
[[[NSCachedImageRep alloc] initWithSize: cachedSize
|
||||
depth: 0
|
||||
separate: YES
|
||||
alpha: YES]
|
||||
autorelease]; // remember that pool we created earlier
|
||||
|
||||
// a non-nil object passed here means we need to manually add the rep
|
||||
[self lockFocusOnRepresentation: cached];
|
||||
@ -1037,9 +1041,9 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
// fraction
|
||||
uint8_t bytes[1] = {MIN(MAX(0, fraction * 255), 255)};
|
||||
CGDataProviderRef provider =
|
||||
CGDataProviderCreateWithData(NULL, bytes, 1, NULL);
|
||||
CGDataProviderCreateWithData(NULL, bytes, 1, NULL);
|
||||
CGImageRef mask =
|
||||
CGImageMaskCreate(1, 1, 8, 8, 1, provider, NULL, NO);
|
||||
CGImageMaskCreate(1, 1, 8, 8, 1, provider, NULL, NO);
|
||||
|
||||
CGContextClipToMask(context, rect, mask);
|
||||
CGImageRelease(mask);
|
||||
@ -1060,11 +1064,11 @@ NSImageName const NSImageNameTouchBarRecordStopTemplate =
|
||||
- (NSString *) description {
|
||||
NSSize size = [self size];
|
||||
|
||||
return
|
||||
[NSString stringWithFormat:
|
||||
@"<%@[%p] name: %@ size: { %f, %f } representations: %@>",
|
||||
[self class], self, _name, size.width, size.height,
|
||||
_representations];
|
||||
return [NSString
|
||||
stringWithFormat:
|
||||
@"<%@[%p] name: %@ size: { %f, %f } representations: %@>",
|
||||
[self class], self, _name, size.width, size.height,
|
||||
_representations];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -91,7 +91,7 @@ static NSMutableArray *_registeredClasses = nil;
|
||||
|
||||
+ (BOOL) canInitWithPasteboard: (NSPasteboard *) pasteboard {
|
||||
NSString *available = [pasteboard
|
||||
availableTypeFromArray: [self imageUnfilteredPasteboardTypes]];
|
||||
availableTypeFromArray: [self imageUnfilteredPasteboardTypes]];
|
||||
|
||||
return (available != nil) ? YES : NO;
|
||||
}
|
||||
@ -345,12 +345,12 @@ static NSMutableArray *_registeredClasses = nil;
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat: @"<%@[%p] size: { %f, %f } colorSpace: %@ (%dx%d @ "
|
||||
@"%d bps) alpha: %@ opaque: %@>",
|
||||
[self class], self, _size.width, _size.height,
|
||||
_colorSpaceName, _pixelsWide, _pixelsHigh,
|
||||
_bitsPerSample, _hasAlpha ? @"YES" : @"NO",
|
||||
_isOpaque ? @"YES" : @"NO"];
|
||||
stringWithFormat:
|
||||
@"<%@[%p] size: { %f, %f } colorSpace: %@ (%dx%d @ "
|
||||
@"%d bps) alpha: %@ opaque: %@>",
|
||||
[self class], self, _size.width, _size.height,
|
||||
_colorSpaceName, _pixelsWide, _pixelsHigh, _bitsPerSample,
|
||||
_hasAlpha ? @"YES" : @"NO", _isOpaque ? @"YES" : @"NO"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -101,7 +101,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (void) setValuePath: (NSString *) path {
|
||||
NSImage *image =
|
||||
[[[NSImage alloc] initWithContentsOfFile: path] autorelease];
|
||||
[[[NSImage alloc] initWithContentsOfFile: path] autorelease];
|
||||
[_cell setImage: image];
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
@ -39,34 +39,34 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
if (sNormalMenuTextAttributes == nil) {
|
||||
NSFont *menuFont = [NSFont menuFontOfSize: 0];
|
||||
sNormalMenuTextAttributes = [[NSDictionary
|
||||
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
|
||||
[NSColor menuItemTextColor],
|
||||
NSForegroundColorAttributeName, nil]
|
||||
retain];
|
||||
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
|
||||
[NSColor menuItemTextColor],
|
||||
NSForegroundColorAttributeName,
|
||||
nil] retain];
|
||||
sSelectedMenuTextAttributes = [[NSDictionary
|
||||
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
|
||||
[NSColor selectedMenuItemTextColor],
|
||||
NSForegroundColorAttributeName, nil]
|
||||
retain];
|
||||
dictionaryWithObjectsAndKeys:
|
||||
menuFont, NSFontAttributeName,
|
||||
[NSColor selectedMenuItemTextColor],
|
||||
NSForegroundColorAttributeName, nil] retain];
|
||||
|
||||
sDimmedMenuTextAttributes = [[NSDictionary
|
||||
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
|
||||
[NSColor grayColor],
|
||||
NSForegroundColorAttributeName, nil]
|
||||
retain];
|
||||
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
|
||||
[NSColor grayColor],
|
||||
NSForegroundColorAttributeName,
|
||||
nil] retain];
|
||||
|
||||
sDimmedMenuTextShadowAttributes = [[NSDictionary
|
||||
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
|
||||
[NSColor whiteColor],
|
||||
NSForegroundColorAttributeName, nil]
|
||||
retain];
|
||||
dictionaryWithObjectsAndKeys: menuFont, NSFontAttributeName,
|
||||
[NSColor whiteColor],
|
||||
NSForegroundColorAttributeName,
|
||||
nil] retain];
|
||||
|
||||
sScrollerButtonAttributes = [[NSDictionary
|
||||
dictionaryWithObjectsAndKeys: [NSFont labelFontOfSize: 8],
|
||||
NSFontAttributeName,
|
||||
[NSColor grayColor],
|
||||
NSForegroundColorAttributeName, nil]
|
||||
retain];
|
||||
dictionaryWithObjectsAndKeys: [NSFont labelFontOfSize: 8],
|
||||
NSFontAttributeName,
|
||||
[NSColor grayColor],
|
||||
NSForegroundColorAttributeName,
|
||||
nil] retain];
|
||||
}
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
|
||||
if (sBranchArrow == nil)
|
||||
sBranchArrow = [[NSInterfacePartAttributedString alloc]
|
||||
initWithMarlettCharacter: 0x34];
|
||||
initWithMarlettCharacter: 0x34];
|
||||
return sBranchArrow;
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
|
||||
if (sCheckMark == nil)
|
||||
sCheckMark = [[NSInterfacePartAttributedString alloc]
|
||||
initWithMarlettCharacter: 0x61];
|
||||
initWithMarlettCharacter: 0x61];
|
||||
return sCheckMark;
|
||||
}
|
||||
|
||||
@ -189,9 +189,9 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
}
|
||||
|
||||
- (CGFloat) menuBarHeight {
|
||||
NSDictionary *attributes =
|
||||
[NSDictionary dictionaryWithObjectsAndKeys: [NSFont menuFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
NSDictionary *attributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: [NSFont menuFontOfSize: 0],
|
||||
NSFontAttributeName, nil];
|
||||
CGFloat result = [@"Menu" sizeWithAttributes: attributes].height;
|
||||
|
||||
result += 2; // border top/bottom margin
|
||||
@ -238,7 +238,7 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
if (enabled) {
|
||||
if (selected) {
|
||||
[string drawInRect: rect
|
||||
withAttributes: sSelectedMenuTextAttributes];
|
||||
withAttributes: sSelectedMenuTextAttributes];
|
||||
} else {
|
||||
[string drawInRect: rect withAttributes: sNormalMenuTextAttributes];
|
||||
}
|
||||
@ -248,7 +248,7 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
offsetRect.origin.x += 1;
|
||||
offsetRect.origin.y += 1;
|
||||
[string drawInRect: offsetRect
|
||||
withAttributes: sDimmedMenuTextShadowAttributes];
|
||||
withAttributes: sDimmedMenuTextShadowAttributes];
|
||||
}
|
||||
[string drawInRect: rect withAttributes: sDimmedMenuTextAttributes];
|
||||
}
|
||||
@ -277,21 +277,22 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
if (enabled) {
|
||||
if (!selected) {
|
||||
[mutableString
|
||||
addAttributes:
|
||||
[NSDictionary
|
||||
dictionaryWithObject: [NSColor menuItemTextColor]
|
||||
forKey: NSForegroundColorAttributeName]
|
||||
range: range];
|
||||
addAttributes:
|
||||
[NSDictionary
|
||||
dictionaryWithObject:
|
||||
[NSColor menuItemTextColor]
|
||||
forKey: NSForegroundColorAttributeName]
|
||||
range: range];
|
||||
}
|
||||
[mutableString drawInRect: rect];
|
||||
} else {
|
||||
if (!selected) {
|
||||
[mutableString
|
||||
addAttributes:
|
||||
[NSDictionary
|
||||
dictionaryWithObject: [NSColor grayColor]
|
||||
forKey: NSForegroundColorAttributeName]
|
||||
range: range];
|
||||
addAttributes:
|
||||
[NSDictionary
|
||||
dictionaryWithObject: [NSColor grayColor]
|
||||
forKey: NSForegroundColorAttributeName]
|
||||
range: range];
|
||||
NSRect offsetRect = rect;
|
||||
offsetRect.origin.x += 1;
|
||||
offsetRect.origin.y += 1;
|
||||
@ -315,11 +316,11 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
else
|
||||
color = [NSColor disabledControlTextColor];
|
||||
|
||||
checkMark =
|
||||
[[NSInterfacePartAttributedString alloc] initWithCharacter: 0x61
|
||||
fontName: @"Marlett"
|
||||
pointSize: 10
|
||||
color: color];
|
||||
checkMark = [[NSInterfacePartAttributedString alloc]
|
||||
initWithCharacter: 0x61
|
||||
fontName: @"Marlett"
|
||||
pointSize: 10
|
||||
color: color];
|
||||
rect.origin.x += margins.left;
|
||||
rect.origin.y += margins.top;
|
||||
|
||||
@ -545,8 +546,8 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
NSRect blockRect = progressRect;
|
||||
int numBlocks;
|
||||
|
||||
numBlocks =
|
||||
(animation * progressRect.size.width) / (BLOCK_WIDTH + BLOCK_SPACING);
|
||||
numBlocks = (animation * progressRect.size.width) /
|
||||
(BLOCK_WIDTH + BLOCK_SPACING);
|
||||
|
||||
if (numBlocks > 0)
|
||||
numBlocks++;
|
||||
@ -581,7 +582,7 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
int numBlocks;
|
||||
|
||||
numBlocks =
|
||||
(value * progressRect.size.width) / (BLOCK_WIDTH + BLOCK_SPACING);
|
||||
(value * progressRect.size.width) / (BLOCK_WIDTH + BLOCK_SPACING);
|
||||
|
||||
if (numBlocks > 0)
|
||||
numBlocks++;
|
||||
@ -622,11 +623,11 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
arrow=[[[class alloc] initWithMarlettCharacter:code] autorelease];
|
||||
*/
|
||||
NSString *arrow =
|
||||
vertical ? (upOrLeft ? @"▲" : @"▼") : (upOrLeft ? @"◀" : @"▶");
|
||||
vertical ? (upOrLeft ? @"▲" : @"▼") : (upOrLeft ? @"◀" : @"▶");
|
||||
|
||||
if (!NSIsEmptyRect(rect)) {
|
||||
NSSize arrowSize =
|
||||
[arrow sizeWithAttributes: sScrollerButtonAttributes];
|
||||
[arrow sizeWithAttributes: sScrollerButtonAttributes];
|
||||
|
||||
if (pressed)
|
||||
[self drawPushButtonPressedInRect: rect];
|
||||
@ -639,7 +640,7 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
point.x += floor((rect.size.width - arrowSize.width) / 2);
|
||||
point.y += floor((rect.size.height - arrowSize.height) / 2);
|
||||
[arrow drawAtPoint: point
|
||||
withAttributes: sScrollerButtonAttributes];
|
||||
withAttributes: sScrollerButtonAttributes];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -734,10 +735,10 @@ static NSDictionary *sScrollerButtonAttributes = nil;
|
||||
|
||||
if (enabled)
|
||||
arrow = [[[NSInterfacePartAttributedString alloc]
|
||||
initWithMarlettCharacter: code] autorelease];
|
||||
initWithMarlettCharacter: code] autorelease];
|
||||
else
|
||||
arrow = [[[NSInterfacePartDisabledAttributedString alloc]
|
||||
initWithMarlettCharacter: code] autorelease];
|
||||
initWithMarlettCharacter: code] autorelease];
|
||||
|
||||
if (highlighted)
|
||||
NSDrawWhiteBezel(rect, clipRect);
|
||||
|
@ -32,8 +32,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
NSString *string = [NSString stringWithCharacters: &character length: 1];
|
||||
NSFont *font = [NSFont fontWithName: fontName size: pointSize];
|
||||
NSDictionary *attributes = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: font, NSFontAttributeName, color,
|
||||
NSForegroundColorAttributeName, nil];
|
||||
dictionaryWithObjectsAndKeys: font, NSFontAttributeName, color,
|
||||
NSForegroundColorAttributeName, nil];
|
||||
|
||||
_attributedString = [[NSAttributedString alloc] initWithString: string
|
||||
attributes: attributes];
|
||||
|
@ -35,7 +35,7 @@ NSString *const NSEnabledBinding = @"enabled";
|
||||
NSString *const NSHiddenBinding = @"hidden";
|
||||
NSString *const NSImageBinding = @"image";
|
||||
NSString *const NSInsertsNullPlaceholderBindingOption =
|
||||
@"NSInsertsNullPlaceholder";
|
||||
@"NSInsertsNullPlaceholder";
|
||||
NSString *const NSSelectedIndexBinding = @"selectedIndex";
|
||||
NSString *const NSSelectedObjectBinding = @"selectedObject";
|
||||
NSString *const NSSelectedObjectsBinding = @"selectedObjects";
|
||||
@ -44,7 +44,7 @@ NSString *const NSSelectionIndexesBinding = @"selectionIndexes";
|
||||
NSString *const NSTitleBinding = @"title";
|
||||
NSString *const NSValidatesImmediatelyBindingOption = @"NSValidatesImmediately";
|
||||
NSString *const NSNotApplicablePlaceholderBindingOption =
|
||||
@"NSNotApplicablePlaceholder";
|
||||
@"NSNotApplicablePlaceholder";
|
||||
NSString *const NSValueBinding = @"value";
|
||||
NSString *const NSVisibleBinding = @"visible";
|
||||
NSString *const NSToolTipBinding = @"toolTip";
|
||||
@ -52,21 +52,21 @@ NSString *const NSEditableBinding = @"editable";
|
||||
|
||||
NSString *const NSNullPlaceholderBindingOption = @"NSNullPlaceholder";
|
||||
NSString *const NSNoSelectionPlaceholderBindingOption =
|
||||
@"NSNoSelectionPlaceholder";
|
||||
@"NSNoSelectionPlaceholder";
|
||||
NSString *const NSMultipleValuesPlaceholderBindingOption =
|
||||
@"NSMultipleValuesPlaceholder";
|
||||
@"NSMultipleValuesPlaceholder";
|
||||
NSString *const NSCreatesSortDescriptorBindingOption =
|
||||
@"NSCreatesSortDescriptors";
|
||||
@"NSCreatesSortDescriptors";
|
||||
NSString *const NSRaisesForNotApplicableKeysBindingOption =
|
||||
@"NSRaisesForNotApplicableKeys";
|
||||
@"NSRaisesForNotApplicableKeys";
|
||||
NSString *const NSAllowsEditingMultipleValuesSelectionBindingOption =
|
||||
@"NSAllowsEditingMultipleValuesSelection";
|
||||
@"NSAllowsEditingMultipleValuesSelection";
|
||||
NSString *const NSValueTransformerNameBindingOption = @"NSValueTransformerName";
|
||||
NSString *const NSValueTransformerBindingOption = @"NSValueTransformerBinding";
|
||||
NSString *const NSConditionallySetsEnabledBindingOption =
|
||||
@"NSConditionallySetsEnabled";
|
||||
@"NSConditionallySetsEnabled";
|
||||
NSString *const NSConditionallySetsEditableBindingOption =
|
||||
@"NSConditionallySetsEditable";
|
||||
@"NSConditionallySetsEditable";
|
||||
NSString *const NSContinuouslyUpdatesValueBindingOption =
|
||||
@"NSContinuouslyUpdatesValue";
|
||||
@"NSContinuouslyUpdatesValue";
|
||||
NSString *const NSDisplayPatternBindingOption = @"NSDisplayPattern";
|
||||
|
@ -33,35 +33,35 @@ static void *NSBinderChangeContext;
|
||||
@implementation _NSBinder (BindingOptions)
|
||||
- (BOOL) conditionallySetsEditable {
|
||||
return [[_options objectForKey: NSConditionallySetsEditableBindingOption]
|
||||
boolValue] &&
|
||||
boolValue] &&
|
||||
[_source respondsToSelector: @selector(setEditable:)];
|
||||
}
|
||||
|
||||
- (BOOL) conditionallySetsEnabled {
|
||||
return [[_options objectForKey: NSConditionallySetsEnabledBindingOption]
|
||||
boolValue] &&
|
||||
boolValue] &&
|
||||
[_source respondsToSelector: @selector(setEnabled:)];
|
||||
}
|
||||
|
||||
- (BOOL) allowsEditingMultipleValues {
|
||||
return [[_options
|
||||
objectForKey: NSAllowsEditingMultipleValuesSelectionBindingOption]
|
||||
boolValue];
|
||||
objectForKey: NSAllowsEditingMultipleValuesSelectionBindingOption]
|
||||
boolValue];
|
||||
}
|
||||
|
||||
- (BOOL) createsSortDescriptor {
|
||||
return [[_options objectForKey: NSCreatesSortDescriptorBindingOption]
|
||||
boolValue];
|
||||
boolValue];
|
||||
}
|
||||
|
||||
- (BOOL) raisesForNotApplicableKeys {
|
||||
return [[_options objectForKey: NSRaisesForNotApplicableKeysBindingOption]
|
||||
boolValue];
|
||||
boolValue];
|
||||
}
|
||||
|
||||
- (BOOL) continuouslyUpdatesValue {
|
||||
return [[_options objectForKey: NSContinuouslyUpdatesValueBindingOption]
|
||||
boolValue];
|
||||
boolValue];
|
||||
}
|
||||
|
||||
- (id) multipleValuesPlaceholder {
|
||||
@ -93,7 +93,7 @@ static void *NSBinderChangeContext;
|
||||
|
||||
if (result == nil) {
|
||||
NSString *name =
|
||||
[_options objectForKey: NSValueTransformerNameBindingOption];
|
||||
[_options objectForKey: NSValueTransformerNameBindingOption];
|
||||
|
||||
if (name == nil)
|
||||
return nil;
|
||||
@ -101,11 +101,11 @@ static void *NSBinderChangeContext;
|
||||
result = [NSValueTransformer valueTransformerForName: name];
|
||||
|
||||
if (result == nil) {
|
||||
NSBindingDebugLog(
|
||||
kNSBindingDebugLogLevel1,
|
||||
@"[NSValueTransformer valueTransformerForName:%@] failed in "
|
||||
@"NSBinder.m",
|
||||
name);
|
||||
NSBindingDebugLog(kNSBindingDebugLogLevel1,
|
||||
@"[NSValueTransformer "
|
||||
@"valueTransformerForName:%@] failed in "
|
||||
@"NSBinder.m",
|
||||
name);
|
||||
}
|
||||
|
||||
if (result != nil)
|
||||
@ -151,8 +151,8 @@ static void *NSBinderChangeContext;
|
||||
- (void) setSource: (id) value {
|
||||
if (_source != value) {
|
||||
_source = value;
|
||||
[self
|
||||
setBindingPath: [_source _replacementKeyPathForBinding: _binding]];
|
||||
[self setBindingPath: [_source
|
||||
_replacementKeyPathForBinding: _binding]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,8 +185,8 @@ static void *NSBinderChangeContext;
|
||||
if (_binding != value) {
|
||||
[_binding release];
|
||||
_binding = [value copy];
|
||||
[self
|
||||
setBindingPath: [_source _replacementKeyPathForBinding: _binding]];
|
||||
[self setBindingPath: [_source
|
||||
_replacementKeyPathForBinding: _binding]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ static void *NSBinderChangeContext;
|
||||
_options = [value mutableCopy];
|
||||
else
|
||||
_options =
|
||||
[[self defaultBindingOptionsForBinding: _binding] mutableCopy];
|
||||
[[self defaultBindingOptionsForBinding: _binding] mutableCopy];
|
||||
}
|
||||
|
||||
- (id) bindingPath {
|
||||
@ -241,9 +241,9 @@ static void *NSBinderChangeContext;
|
||||
{
|
||||
|
||||
NSBindingDebugLog(
|
||||
kNSBindingDebugLogLevel1,
|
||||
@"keyPath: %@\n object: %@\n change: %@\n context: %p", kp,
|
||||
object, change, context);
|
||||
kNSBindingDebugLogLevel1,
|
||||
@"keyPath: %@\n object: %@\n change: %@\n context: %p", kp,
|
||||
object, change, context);
|
||||
if ([self allowsReverseTransformation]) {
|
||||
|
||||
if (context == &NSBinderChangeContext) {
|
||||
@ -256,8 +256,8 @@ static void *NSBinderChangeContext;
|
||||
NSBindingDebugLog(kNSBindingDebugLogLevel2, @"new value %@",
|
||||
[_source valueForKeyPath: _bindingPath]);
|
||||
NSBindingDebugLog(
|
||||
kNSBindingDebugLogLevel2, @"DST setting %@, for %@",
|
||||
[_source valueForKeyPath: _bindingPath], _keyPath);
|
||||
kNSBindingDebugLogLevel2, @"DST setting %@, for %@",
|
||||
[_source valueForKeyPath: _bindingPath], _keyPath);
|
||||
|
||||
id value = [_source valueForKeyPath: _bindingPath];
|
||||
|
||||
@ -329,9 +329,9 @@ static void *NSBinderChangeContext;
|
||||
if ([checkBinding length] == [baseName length] + 1) {
|
||||
// Only keep the binder if it has a 1..9 at the end
|
||||
NSRange numberAtEnd =
|
||||
NSMakeRange([checkBinding length] - 1, 1);
|
||||
NSMakeRange([checkBinding length] - 1, 1);
|
||||
if ([[checkBinding substringWithRange: numberAtEnd]
|
||||
intValue] == 0) {
|
||||
intValue] == 0) {
|
||||
peer = NO;
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
static void *NSCachingBinderChangeContext =
|
||||
(void *) @"NSCachingBinderChangeContext";
|
||||
(void *) @"NSCachingBinderChangeContext";
|
||||
|
||||
@implementation _NSCachingBinder
|
||||
|
||||
@ -121,7 +121,7 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
if (newValue != nil &&
|
||||
![newValue isKindOfClass: [NSDate class]])
|
||||
newValue =
|
||||
[NSDate dateWithTimeIntervalSinceReferenceDate: 0];
|
||||
[NSDate dateWithTimeIntervalSinceReferenceDate: 0];
|
||||
}
|
||||
}
|
||||
[_source setValue: newValue forKeyPath: _bindingPath];
|
||||
|
@ -52,11 +52,11 @@ static void *NSKVOBinderChangeContext;
|
||||
- (void) stopObservingChanges {
|
||||
@try {
|
||||
if (_isObserving) {
|
||||
NSBindingDebugLog(
|
||||
kNSBindingDebugLogLevel2,
|
||||
@"stop observing binding between %@.%@ alias %@ and %@.%@ (%@)",
|
||||
[_source className], _binding, _bindingPath,
|
||||
[_destination className], _keyPath, self);
|
||||
NSBindingDebugLog(kNSBindingDebugLogLevel2,
|
||||
@"stop observing binding between %@.%@ alias %@ "
|
||||
@"and %@.%@ (%@)",
|
||||
[_source className], _binding, _bindingPath,
|
||||
[_destination className], _keyPath, self);
|
||||
[super stopObservingChanges];
|
||||
[_destination removeObserver: self forKeyPath: _keyPath];
|
||||
_isObserving = NO;
|
||||
@ -119,8 +119,8 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
valueIndex--;
|
||||
if (code == '@') {
|
||||
NSString *string = (valueIndex < valueCount)
|
||||
? [values[valueIndex] description]
|
||||
: @"";
|
||||
? [values[valueIndex] description]
|
||||
: @"";
|
||||
NSInteger s, stringLength = [string length];
|
||||
|
||||
while (resultCount + stringLength >= resultCapacity) {
|
||||
@ -153,16 +153,17 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
|
||||
- (void) writeDestinationToSource {
|
||||
NSArray *peersIncludingSelf = [self peerBinders];
|
||||
NSInteger i,
|
||||
count = (peersIncludingSelf == nil) ? 1 : [peersIncludingSelf count];
|
||||
NSInteger i, count = (peersIncludingSelf == nil)
|
||||
? 1
|
||||
: [peersIncludingSelf count];
|
||||
id allBinders[count];
|
||||
id allValues[count];
|
||||
BOOL isEditable = YES;
|
||||
BOOL containsPlaceholder = NO;
|
||||
|
||||
if (count > 1)
|
||||
peersIncludingSelf =
|
||||
[peersIncludingSelf sortedArrayUsingSelector: @selector(compare:)];
|
||||
peersIncludingSelf = [peersIncludingSelf
|
||||
sortedArrayUsingSelector: @selector(compare:)];
|
||||
|
||||
if (peersIncludingSelf == nil)
|
||||
allBinders[0] = self;
|
||||
@ -195,8 +196,8 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
allValues[i] = dstValue;
|
||||
}
|
||||
|
||||
NSString *pattern =
|
||||
[[allBinders[0] options] objectForKey: NSDisplayPatternBindingOption];
|
||||
NSString *pattern = [[allBinders[0] options]
|
||||
objectForKey: NSDisplayPatternBindingOption];
|
||||
id value;
|
||||
|
||||
if (pattern != nil) {
|
||||
@ -248,8 +249,8 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
BOOL isValidKeyPath = YES;
|
||||
id currentValue = nil;
|
||||
id bindingPath =
|
||||
[allBinders[0] bindingPath]; // We want the real one - not "xxxx2" fake
|
||||
// path from non-main peers
|
||||
[allBinders[0] bindingPath]; // We want the real one - not "xxxx2"
|
||||
// fake path from non-main peers
|
||||
@try {
|
||||
currentValue = [_source valueForKeyPath: bindingPath];
|
||||
} @catch (id ex) {
|
||||
@ -279,9 +280,10 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
} @catch (id ex) {
|
||||
if (isValidKeyPath == NO ||
|
||||
[currentValue
|
||||
isEqualTo: [NSNumber numberWithBool: NO]] == NO) {
|
||||
isEqualTo: [NSNumber numberWithBool: NO]] ==
|
||||
NO) {
|
||||
[_source setValue: [NSNumber numberWithBool: NO]
|
||||
forKeyPath: bindingPath];
|
||||
forKeyPath: bindingPath];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -301,9 +303,9 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
|
||||
} else {
|
||||
NSBindingDebugLog(
|
||||
kNSBindingDebugLogLevel2,
|
||||
@"skipping setting value on _source: %@ forKeyPath: %@", _source,
|
||||
bindingPath);
|
||||
kNSBindingDebugLogLevel2,
|
||||
@"skipping setting value on _source: %@ forKeyPath: %@",
|
||||
_source, bindingPath);
|
||||
}
|
||||
|
||||
if ([self conditionallySetsEditable])
|
||||
@ -326,9 +328,9 @@ NSString *NSFormatDisplayPattern(NSString *pattern, id *values,
|
||||
context: (void *) context
|
||||
{
|
||||
NSBindingDebugLog(
|
||||
kNSBindingDebugLogLevel1,
|
||||
@"keyPath: %@\n object: %@\n change: %@\n context: %p", kp,
|
||||
object, change, context);
|
||||
kNSBindingDebugLogLevel1,
|
||||
@"keyPath: %@\n object: %@\n change: %@\n context: %p", kp,
|
||||
object, change, context);
|
||||
|
||||
// We want changes to propogate one way so we stop observing for both our
|
||||
// handling and super's, otherwise our change will generate a change for the
|
||||
|
@ -53,7 +53,7 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
|
||||
- (void) applyToObject: (id) object inRow: (NSInteger) row keyPath: (id) path {
|
||||
@try {
|
||||
[object setValue: [[_rowValues objectAtIndex: row]
|
||||
valueForKeyPath: _valueKeyPath]
|
||||
valueForKeyPath: _valueKeyPath]
|
||||
forKey: path];
|
||||
} @catch (id e) {
|
||||
NSLog(@"exception %@ while setting value for key path %@ for row %i", e,
|
||||
@ -120,8 +120,8 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
|
||||
} else {
|
||||
_valueKeyPath = [components lastObject];
|
||||
_arrayKeyPath =
|
||||
[_keyPath substringToIndex: [_keyPath length] -
|
||||
[_valueKeyPath length] - 1];
|
||||
[_keyPath substringToIndex: [_keyPath length] -
|
||||
[_valueKeyPath length] - 1];
|
||||
}
|
||||
}
|
||||
[_valueKeyPath retain];
|
||||
@ -146,19 +146,21 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
|
||||
_isObserving = YES;
|
||||
@try {
|
||||
[_destination
|
||||
addObserver: self
|
||||
forKeyPath: _arrayKeyPath
|
||||
options: 0
|
||||
context: &NSMultipleValueBinderWholeArrayChangeContext];
|
||||
addObserver: self
|
||||
forKeyPath: _arrayKeyPath
|
||||
options: 0
|
||||
context: &NSMultipleValueBinderWholeArrayChangeContext];
|
||||
if (![_valueKeyPath hasPrefix: @"@"])
|
||||
[_rowValues addObserver: self
|
||||
toObjectsAtIndexes: [NSIndexSet
|
||||
indexSetWithIndexesInRange:
|
||||
NSMakeRange(
|
||||
0, [_rowValues count])]
|
||||
forKeyPath: _valueKeyPath
|
||||
options: 0
|
||||
context: &NSMultipleValueBinderChangeContext];
|
||||
toObjectsAtIndexes:
|
||||
[NSIndexSet
|
||||
indexSetWithIndexesInRange:
|
||||
NSMakeRange(0,
|
||||
[_rowValues count])]
|
||||
forKeyPath: _valueKeyPath
|
||||
options: 0
|
||||
context: &
|
||||
NSMultipleValueBinderChangeContext];
|
||||
} @catch (id ex) {
|
||||
NSLog(@"%@", ex);
|
||||
}
|
||||
@ -172,11 +174,12 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
|
||||
[_destination removeObserver: self forKeyPath: _arrayKeyPath];
|
||||
if (![_valueKeyPath hasPrefix: @"@"])
|
||||
[_rowValues removeObserver: self
|
||||
fromObjectsAtIndexes: [NSIndexSet
|
||||
indexSetWithIndexesInRange:
|
||||
NSMakeRange(
|
||||
0, [_rowValues count])]
|
||||
forKeyPath: _valueKeyPath];
|
||||
fromObjectsAtIndexes:
|
||||
[NSIndexSet
|
||||
indexSetWithIndexesInRange:
|
||||
NSMakeRange(0,
|
||||
[_rowValues count])]
|
||||
forKeyPath: _valueKeyPath];
|
||||
} @catch (id ex) {
|
||||
NSLog(@"%@", ex);
|
||||
}
|
||||
@ -211,7 +214,7 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
|
||||
[[_source tableView] reloadData];
|
||||
|
||||
if ([_destination
|
||||
respondsToSelector: @selector(_selectionMayHaveChanged)])
|
||||
respondsToSelector: @selector(_selectionMayHaveChanged)])
|
||||
[_destination performSelector: @selector(_selectionMayHaveChanged)];
|
||||
}
|
||||
}
|
||||
@ -227,10 +230,10 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
|
||||
[self startObservingChanges];
|
||||
|
||||
if ([self createsSortDescriptor] && [_binding isEqual: @"value"]) {
|
||||
[_source
|
||||
setSortDescriptorPrototype: [[[NSSortDescriptor alloc]
|
||||
initWithKey: _valueKeyPath
|
||||
ascending: YES] autorelease]];
|
||||
[_source setSortDescriptorPrototype: [[[NSSortDescriptor alloc]
|
||||
initWithKey: _valueKeyPath
|
||||
ascending: YES]
|
||||
autorelease]];
|
||||
}
|
||||
if ([_source respondsToSelector: @selector
|
||||
(_establishBindingsWithDestinationIfUnbound:)]) {
|
||||
@ -247,14 +250,14 @@ static void *NSMultipleValueBinderWholeArrayChangeContext;
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat: @"%@ %@", [super description], [self rowValues]];
|
||||
stringWithFormat: @"%@ %@", [super description], [self rowValues]];
|
||||
}
|
||||
|
||||
- (void) updateRowValues {
|
||||
id value = [_destination valueForKeyPath: _arrayKeyPath];
|
||||
if (![value respondsToSelector: @selector(objectAtIndex:)])
|
||||
value = [[[_NSMultipleValueWrapperArray alloc] initWithObject: value]
|
||||
autorelease];
|
||||
autorelease];
|
||||
[self setRowValues: value];
|
||||
}
|
||||
@end
|
||||
|
@ -25,9 +25,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
@interface NSObject (BindingSupport)
|
||||
- (void) bind: (id) binding
|
||||
toObject: (id) destination
|
||||
withKeyPath: (NSString *) keyPath
|
||||
options: (NSDictionary *) options;
|
||||
toObject: (id) destination
|
||||
withKeyPath: (NSString *) keyPath
|
||||
options: (NSDictionary *) options;
|
||||
- (NSDictionary *) infoForBinding: (id) binding;
|
||||
- (void) unbind: (id) binding;
|
||||
+ (void) exposeBinding: (id) binding;
|
||||
|
@ -73,7 +73,7 @@ void NSDetermineBindingDebugLoggingLevel(void) {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
NSBindingDebugLogLevel =
|
||||
[defaults integerForKey: @"NSBindingDebugLogLevel"];
|
||||
[defaults integerForKey: @"NSBindingDebugLogLevel"];
|
||||
if (NSBindingDebugLogLevel > 0) {
|
||||
NSLog(@"set NSBindingDebugLogLevel to: '%d'",
|
||||
NSBindingDebugLogLevel);
|
||||
@ -90,16 +90,16 @@ void NSDetermineBindingDebugLoggingLevel(void) {
|
||||
NSString *path = [bundle pathForResource: @"defaultBindingOptions"
|
||||
ofType: @"plist"];
|
||||
|
||||
if ((defaultBindingOptions =
|
||||
[[NSDictionary alloc] initWithContentsOfFile: path]) == nil)
|
||||
if ((defaultBindingOptions = [[NSDictionary alloc]
|
||||
initWithContentsOfFile: path]) == nil)
|
||||
defaultBindingOptions = [NSDictionary new];
|
||||
}
|
||||
|
||||
NSString *className = NSStringFromClass(self);
|
||||
NSString *bindingKey = [[className stringByAppendingString: @"."]
|
||||
stringByAppendingString: binding];
|
||||
stringByAppendingString: binding];
|
||||
NSDictionary *defaults =
|
||||
[defaultBindingOptionsCache objectForKey: bindingKey];
|
||||
[defaultBindingOptionsCache objectForKey: bindingKey];
|
||||
|
||||
if (defaults == nil) {
|
||||
NSMutableDictionary *values;
|
||||
@ -107,12 +107,12 @@ void NSDetermineBindingDebugLoggingLevel(void) {
|
||||
if (self == [NSObject class])
|
||||
values = [NSMutableDictionary dictionary];
|
||||
else
|
||||
values =
|
||||
[[[[self superclass] _defaultBindingOptionsForBinding: binding]
|
||||
mutableCopy] autorelease];
|
||||
values = [[[[self superclass]
|
||||
_defaultBindingOptionsForBinding: binding] mutableCopy]
|
||||
autorelease];
|
||||
|
||||
[values addEntriesFromDictionary: [defaultBindingOptions
|
||||
objectForKey: bindingKey]];
|
||||
objectForKey: bindingKey]];
|
||||
|
||||
if (defaultBindingOptionsCache == nil)
|
||||
defaultBindingOptionsCache = [NSMutableDictionary new];
|
||||
@ -152,8 +152,8 @@ void NSDetermineBindingDebugLoggingLevel(void) {
|
||||
id binder = [ownBinders objectForKey: binding];
|
||||
|
||||
if (!binder && create) {
|
||||
binder =
|
||||
[[[[self class] _binderClassForBinding: binding] new] autorelease];
|
||||
binder = [[[[self class] _binderClassForBinding: binding] new]
|
||||
autorelease];
|
||||
[ownBinders setObject: binder forKey: binding];
|
||||
}
|
||||
|
||||
@ -176,14 +176,14 @@ void NSDetermineBindingDebugLoggingLevel(void) {
|
||||
}
|
||||
|
||||
- (void) bind: (id) binding
|
||||
toObject: (id) destination
|
||||
withKeyPath: (NSString *) keyPath
|
||||
options: (NSDictionary *) options
|
||||
toObject: (id) destination
|
||||
withKeyPath: (NSString *) keyPath
|
||||
options: (NSDictionary *) options
|
||||
{
|
||||
NSBindingDebugLog(
|
||||
kNSBindingDebugLogLevel1,
|
||||
@"binding: %@\n toObject: %@\n withKeyPath: %@\n options: %@",
|
||||
binding, destination, keyPath, options);
|
||||
kNSBindingDebugLogLevel1,
|
||||
@"binding: %@\n toObject: %@\n withKeyPath: %@\n options: %@",
|
||||
binding, destination, keyPath, options);
|
||||
|
||||
if (![[self class] _binderClassForBinding: binding]) {
|
||||
NSBindingDebugLog(kNSBindingDebugLogLevel1,
|
||||
@ -243,9 +243,10 @@ void NSDetermineBindingDebugLoggingLevel(void) {
|
||||
- (NSDictionary *) infoForBinding: (id) binding {
|
||||
_NSBinder *binder = [self _binderForBinding: binding create: NO];
|
||||
NSDictionary *result = [NSDictionary
|
||||
dictionaryWithObjectsAndKeys: [binder destination], NSObservedObjectKey,
|
||||
[binder keyPath], NSObservedKeyPathKey,
|
||||
[binder options], NSOptionsKey, nil];
|
||||
dictionaryWithObjectsAndKeys: [binder destination],
|
||||
NSObservedObjectKey, [binder keyPath],
|
||||
NSObservedKeyPathKey,
|
||||
[binder options], NSOptionsKey, nil];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -34,33 +34,33 @@
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
if ([_source isKindOfClass: [NSText class]]) {
|
||||
[nc addObserver: self
|
||||
selector: @selector(textDidEndEditing:)
|
||||
name: NSTextDidEndEditingNotification
|
||||
object: _source];
|
||||
selector: @selector(textDidEndEditing:)
|
||||
name: NSTextDidEndEditingNotification
|
||||
object: _source];
|
||||
if ([self continuouslyUpdatesValue])
|
||||
[nc addObserver: self
|
||||
selector: @selector(textDidChange:)
|
||||
name: NSTextDidChangeNotification
|
||||
object: _source];
|
||||
selector: @selector(textDidChange:)
|
||||
name: NSTextDidChangeNotification
|
||||
object: _source];
|
||||
} else if ([_source isKindOfClass: [NSControl class]]) {
|
||||
[nc addObserver: self
|
||||
selector: @selector(textDidEndEditing:)
|
||||
name: NSControlTextDidEndEditingNotification
|
||||
object: _source];
|
||||
selector: @selector(textDidEndEditing:)
|
||||
name: NSControlTextDidEndEditingNotification
|
||||
object: _source];
|
||||
if ([self continuouslyUpdatesValue])
|
||||
[nc addObserver: self
|
||||
selector: @selector(textDidChange:)
|
||||
name: NSControlTextDidChangeNotification
|
||||
object: _source];
|
||||
selector: @selector(textDidChange:)
|
||||
name: NSControlTextDidChangeNotification
|
||||
object: _source];
|
||||
}
|
||||
|
||||
if ([_source isKindOfClass: [NSView class]]) {
|
||||
NSWindow *window = [_source window];
|
||||
if (window)
|
||||
[nc addObserver: self
|
||||
selector: @selector(windowWillClose:)
|
||||
name: NSWindowWillCloseNotification
|
||||
object: window];
|
||||
selector: @selector(windowWillClose:)
|
||||
name: NSWindowWillCloseNotification
|
||||
object: window];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,18 +41,18 @@
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
if ([_source isKindOfClass: [NSControl class]]) {
|
||||
[nc addObserver: self
|
||||
selector: @selector(textDidEndEditing:)
|
||||
name: NSControlTextDidEndEditingNotification
|
||||
object: _source];
|
||||
selector: @selector(textDidEndEditing:)
|
||||
name: NSControlTextDidEndEditingNotification
|
||||
object: _source];
|
||||
[nc addObserver: self
|
||||
selector: @selector(textDidBeginEditing:)
|
||||
name: NSControlTextDidBeginEditingNotification
|
||||
object: _source];
|
||||
selector: @selector(textDidBeginEditing:)
|
||||
name: NSControlTextDidBeginEditingNotification
|
||||
object: _source];
|
||||
if ([self continuouslyUpdatesValue])
|
||||
[nc addObserver: self
|
||||
selector: @selector(textDidChange:)
|
||||
name: NSControlTextDidChangeNotification
|
||||
object: _source];
|
||||
selector: @selector(textDidChange:)
|
||||
name: NSControlTextDidChangeNotification
|
||||
object: _source];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -90,7 +90,7 @@
|
||||
[_destination objectDidEndEditing: self];
|
||||
if ([_source respondsToSelector: @selector(window)]) {
|
||||
NSDocument *document =
|
||||
[[[_source window] windowController] document];
|
||||
[[[_source window] windowController] document];
|
||||
if (document)
|
||||
[document objectDidEndEditing: self];
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
- (NSString *) description {
|
||||
return [NSString
|
||||
stringWithFormat:
|
||||
@"<%@[%p] string: %@ modifierMask: %p selectorNames: %@>",
|
||||
[self class], self, _string, _modifierMask, _selectorNames];
|
||||
stringWithFormat:
|
||||
@"<%@[%p] string: %@ modifierMask: %p selectorNames: %@>",
|
||||
[self class], self, _string, _modifierMask, _selectorNames];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user