diff --git a/AppKit/NSAttributedString.m b/AppKit/NSAttributedString.m index c6deb4d85..68bffa573 100644 --- a/AppKit/NSAttributedString.m +++ b/AppKit/NSAttributedString.m @@ -27,108 +27,95 @@ this software and associated documentation files (the "Software"), to deal in #import #import -NSString *const NSFontAttributeName = @"NSFontAttributeName"; -NSString *const NSParagraphStyleAttributeName = - @"NSParagraphStyleAttributeName"; -NSString *const NSForegroundColorAttributeName = - @"NSForegroundColorAttributeName"; -NSString *const NSBackgroundColorAttributeName = - @"NSBackgroundColorAttributeName"; -NSString *const NSUnderlineStyleAttributeName = - @"NSUnderlineStyleAttributeName"; -NSString *const NSUnderlineColorAttributeName = - @"NSUnderlineColorAttributeName"; -NSString *const NSAttachmentAttributeName = @"NSAttachmentAttributeName"; -NSString *const NSKernAttributeName = @"NSKernAttributeName"; -NSString *const NSLigatureAttributeName = @"NSLigatureAttributeName"; -NSString *const NSStrikethroughStyleAttributeName = - @"NSStrikethroughStyleAttributeName"; -NSString *const NSStrikethroughColorAttributeName = - @"NSStrikethroughColorAttributeName"; -NSString *const NSObliquenessAttributeName = @"NSObliquenessAttributeName"; -NSString *const NSStrokeWidthAttributeName = @"NSStrokeWidthAttributeName"; -NSString *const NSStrokeColorAttributeName = @"NSStrokeColorAttributeName"; -NSString *const NSBaselineOffsetAttributeName = - @"NSBaselineOffsetAttributeName"; -NSString *const NSSuperscriptAttributeName = @"NSSuperscriptAttributeName"; -NSString *const NSLinkAttributeName = @"NSLinkAttributeName"; -NSString *const NSShadowAttributeName = @"NSShadowAttributeName"; -NSString *const NSExpansionAttributeName = @"NSExpansionAttributeName"; -NSString *const NSCursorAttributeName = @"NSCursorAttributeName"; -NSString *const NSToolTipAttributeName = @"NSToolTipAttributeName"; -NSString *const NSSpellingStateAttributeName = - @"NSSpellingStateAttributeName"; // temporary attribute - -NSString *const NSDocumentTypeDocumentAttribute = @"DocumentType"; -NSString *const NSConvertedDocumentAttribute = @"Converted"; -NSString *const NSFileTypeDocumentAttribute = @"UTI"; -NSString *const NSTitleDocumentAttribute = @"NSTitleDocumentAttribute"; -NSString *const NSCompanyDocumentAttribute = @"NSCompanyDocumentAttribute"; -NSString *const NSCopyrightDocumentAttribute = @"NSCopyrightDocumentAttribute"; -NSString *const NSSubjectDocumentAttribute = @"NSSubjectDocumentAttribute"; -NSString *const NSAuthorDocumentAttribute = @"NSAuthorDocumentAttribute"; -NSString *const NSKeywordsDocumentAttribute = @"NSKeywordsDocumentAttribute"; -NSString *const NSCommentDocumentAttribute = @"NSCommentDocumentAttribute"; -NSString *const NSEditorDocumentAttribute = @"NSEditorDocumentAttribute"; -NSString *const NSCreationTimeDocumentAttribute = - @"NSCreationTimeDocumentAttribute"; -NSString *const NSModificationTimeDocumentAttribute = - @"NSModificationTimeDocumentAttribute"; -NSString *const NSManagerDocumentAttribute = @"NSManagerDocumentAttribute"; -NSString *const NSCategoryDocumentAttribute = @"NSCategoryDocumentAttribute"; -NSString *const NSAppearanceDocumentAttribute = - @"NSAppearanceDocumentAttribute"; -NSString *const NSCharacterEncodingDocumentAttribute = @"CharacterEncoding"; -NSString *const NSDefaultAttributesDocumentAttribute = @"DefaultAttributes"; -NSString *const NSPaperSizeDocumentAttribute = @"PaperSize"; -NSString *const NSLeftMarginDocumentAttribute = @"LeftMargin"; -NSString *const NSRightMarginDocumentAttribute = @"RightMargin"; -NSString *const NSTopMarginDocumentAttribute = @"TopMargin"; -NSString *const NSBottomMarginDocumentAttribute = @"BottomMargin"; -NSString *const NSViewSizeDocumentAttribute = @"ViewSize"; -NSString *const NSViewZoomDocumentAttribute = @"ViewZoom"; -NSString *const NSViewModeDocumentAttribute = @"ViewMode"; -NSString *const NSReadOnlyDocumentAttribute = @"ReadOnly"; -NSString *const NSBackgroundColorDocumentAttribute = @"BackgroundColor"; -NSString *const NSHyphenationFactorDocumentAttribute = @"HyphenationFactor"; -NSString *const NSDefaultTabIntervalDocumentAttribute = @"DefaultTabInterval"; -NSString *const NSTextLayoutSectionsAttribute = - @"NSTextLayoutSectionsAttribute"; -NSString *const NSExcludedElementsDocumentAttribute = @"ExcludedElements"; -NSString *const NSTextEncodingNameDocumentAttribute = @"TextEncodingName"; -NSString *const NSPrefixSpacesDocumentAttribute = @"PrefixSpaces"; - -NSString *const NSDocumentTypeDocumentOption = @"DocumentType"; -NSString *const NSDefaultAttributesDocumentOption = @"DefaultAttributes"; -NSString *const NSCharacterEncodingDocumentOption = @"CharacterEncoding"; -NSString *const NSTextEncodingNameDocumentOption = @"TextEncodingName"; -NSString *const NSBaseURLDocumentOption = @"BaseURL"; -NSString *const NSTimeoutDocumentOption = @"Timeout"; -NSString *const NSWebPreferencesDocumentOption = @"WebPreferences"; -NSString *const NSWebResourceLoadDelegateDocumentOption = - @"WebResourceLoadDelegate"; -NSString *const NSTextSizeMultiplierDocumentOption = @"TextSizeMultiplier"; -NSString *const NSFileTypeDocumentOption = @"UTI"; - -NSString *const NSPlainTextDocumentType = @"NSPlainText"; -NSString *const NSRTFTextDocumentType = @"NSRTF"; -NSString *const NSRTFDTextDocumentType = @"NSRTFD"; -NSString *const NSHTMLTextDocumentType = @"NSHTML"; -NSString *const NSMacSimpleTextDocumentType = @"NSMacSimpleText"; -NSString *const NSDocFormatTextDocumentType = @"NSDocFormat"; -NSString *const NSWordMLTextDocumentType = @"NSWordML"; -NSString *const NSWebArchiveTextDocumentType = @"NSWebArchive"; -NSString *const NSOfficeOpenXMLTextDocumentType = @"NSOfficeOpenXML"; -NSString *const NSOpenDocumentTextDocumentType = @"NSOpenDocument"; - -NSString *const NSTextLayoutSectionOrientation = - @"NSTextLayoutSectionOrientation"; -NSString *const NSTextLayoutSectionRange = @"NSTextLayoutSectionRange"; - -NSString *const NSCharacterShapeAttributeName = @"NSCharacterShape"; -NSString *const NSUsesScreenFontsDocumentAttribute = @"UsesScreenFonts"; - -NSString *const NSTextEffectAttributeName = @"NSTextEffect"; +NSAttributedStringKey NSFontAttributeName = @"NSFontAttributeName"; +NSAttributedStringKey NSParagraphStyleAttributeName = @"NSParagraphStyleAttributeName"; +NSAttributedStringKey NSForegroundColorAttributeName = @"NSForegroundColorAttributeName"; +NSAttributedStringKey NSBackgroundColorAttributeName = @"NSBackgroundColorAttributeName"; +NSAttributedStringKey NSUnderlineStyleAttributeName = @"NSUnderlineStyleAttributeName"; +NSAttributedStringKey NSUnderlineColorAttributeName = @"NSUnderlineColorAttributeName"; +NSAttributedStringKey NSAttachmentAttributeName = @"NSAttachmentAttributeName"; +NSAttributedStringKey NSKernAttributeName = @"NSKernAttributeName"; +NSAttributedStringKey NSLigatureAttributeName = @"NSLigatureAttributeName"; +NSAttributedStringKey NSStrikethroughStyleAttributeName = @"NSStrikethroughStyleAttributeName"; +NSAttributedStringKey NSStrikethroughColorAttributeName = @"NSStrikethroughColorAttributeName"; +NSAttributedStringKey NSObliquenessAttributeName = @"NSObliquenessAttributeName"; +NSAttributedStringKey NSStrokeWidthAttributeName = @"NSStrokeWidthAttributeName"; +NSAttributedStringKey NSStrokeColorAttributeName = @"NSStrokeColorAttributeName"; +NSAttributedStringKey NSBaselineOffsetAttributeName = @"NSBaselineOffsetAttributeName"; +NSAttributedStringKey NSSuperscriptAttributeName = @"NSSuperscriptAttributeName"; +NSAttributedStringKey NSLinkAttributeName = @"NSLinkAttributeName"; +NSAttributedStringKey NSShadowAttributeName = @"NSShadowAttributeName"; +NSAttributedStringKey NSExpansionAttributeName = @"NSExpansionAttributeName"; +NSAttributedStringKey NSCursorAttributeName = @"NSCursorAttributeName"; +NSAttributedStringKey NSToolTipAttributeName = @"NSToolTipAttributeName"; +NSAttributedStringKey NSSpellingStateAttributeName = @"NSSpellingStateAttributeName"; // temporary attribute + +NSAttributedStringDocumentAttributeKey NSDocumentTypeDocumentAttribute = @"DocumentType"; +NSAttributedStringDocumentAttributeKey NSConvertedDocumentAttribute = @"Converted"; +NSAttributedStringDocumentAttributeKey NSFileTypeDocumentAttribute = @"UTI"; +NSAttributedStringDocumentAttributeKey NSTitleDocumentAttribute = @"NSTitleDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSCompanyDocumentAttribute = @"NSCompanyDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSCopyrightDocumentAttribute = @"NSCopyrightDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSSubjectDocumentAttribute = @"NSSubjectDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSAuthorDocumentAttribute = @"NSAuthorDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSKeywordsDocumentAttribute = @"NSKeywordsDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSCommentDocumentAttribute = @"NSCommentDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSEditorDocumentAttribute = @"NSEditorDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSCreationTimeDocumentAttribute = @"NSCreationTimeDocumentAttribute"; +NSAttributedStringKey NSModificationTimeDocumentAttribute = @"NSModificationTimeDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSManagerDocumentAttribute = @"NSManagerDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSCategoryDocumentAttribute = @"NSCategoryDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSAppearanceDocumentAttribute = @"NSAppearanceDocumentAttribute"; +NSAttributedStringDocumentAttributeKey NSCharacterEncodingDocumentAttribute = @"CharacterEncoding"; +NSAttributedStringDocumentAttributeKey NSDefaultAttributesDocumentAttribute = @"DefaultAttributes"; +NSAttributedStringDocumentAttributeKey NSPaperSizeDocumentAttribute = @"PaperSize"; +NSAttributedStringDocumentAttributeKey NSLeftMarginDocumentAttribute = @"LeftMargin"; +NSAttributedStringDocumentAttributeKey NSRightMarginDocumentAttribute = @"RightMargin"; +NSAttributedStringDocumentAttributeKey NSTopMarginDocumentAttribute = @"TopMargin"; +NSAttributedStringDocumentAttributeKey NSBottomMarginDocumentAttribute = @"BottomMargin"; +NSAttributedStringDocumentAttributeKey NSViewSizeDocumentAttribute = @"ViewSize"; +NSAttributedStringDocumentAttributeKey NSViewZoomDocumentAttribute = @"ViewZoom"; +NSAttributedStringDocumentAttributeKey NSViewModeDocumentAttribute = @"ViewMode"; +NSAttributedStringDocumentAttributeKey NSReadOnlyDocumentAttribute = @"ReadOnly"; +NSAttributedStringDocumentAttributeKey NSBackgroundColorDocumentAttribute = @"BackgroundColor"; +NSAttributedStringDocumentAttributeKey NSHyphenationFactorDocumentAttribute = @"HyphenationFactor"; +NSAttributedStringDocumentAttributeKey NSDefaultTabIntervalDocumentAttribute = @"DefaultTabInterval"; +NSAttributedStringDocumentAttributeKey NSTextLayoutSectionsAttribute = @"NSTextLayoutSectionsAttribute"; +NSAttributedStringDocumentAttributeKey NSExcludedElementsDocumentAttribute = @"ExcludedElements"; +NSAttributedStringDocumentAttributeKey NSTextEncodingNameDocumentAttribute = @"TextEncodingName"; +NSAttributedStringDocumentAttributeKey NSPrefixSpacesDocumentAttribute = @"PrefixSpaces"; +NSAttributedStringDocumentAttributeKey NSCocoaVersionDocumentAttribute = @"NSCocoaVersionDocumentAttribute"; + +NSAttributedStringDocumentReadingOptionKey NSDocumentTypeDocumentOption = @"DocumentType"; +NSAttributedStringDocumentReadingOptionKey NSDefaultAttributesDocumentOption = @"DefaultAttributes"; +NSAttributedStringDocumentReadingOptionKey NSCharacterEncodingDocumentOption = @"CharacterEncoding"; +NSAttributedStringDocumentReadingOptionKey NSTextEncodingNameDocumentOption = @"TextEncodingName"; +NSAttributedStringDocumentReadingOptionKey NSBaseURLDocumentOption = @"BaseURL"; +NSAttributedStringDocumentReadingOptionKey NSTimeoutDocumentOption = @"Timeout"; +NSAttributedStringDocumentReadingOptionKey NSWebPreferencesDocumentOption = @"WebPreferences"; +NSAttributedStringDocumentReadingOptionKey NSWebResourceLoadDelegateDocumentOption = @"WebResourceLoadDelegate"; +NSAttributedStringDocumentReadingOptionKey NSTextSizeMultiplierDocumentOption = @"TextSizeMultiplier"; +NSAttributedStringDocumentReadingOptionKey NSFileTypeDocumentOption = @"UTI"; + +NSAttributedStringDocumentType NSPlainTextDocumentType = @"NSPlainText"; +NSAttributedStringDocumentType NSRTFTextDocumentType = @"NSRTF"; +NSAttributedStringDocumentType NSRTFDTextDocumentType = @"NSRTFD"; +NSAttributedStringDocumentType NSHTMLTextDocumentType = @"NSHTML"; +NSAttributedStringDocumentType NSMacSimpleTextDocumentType = @"NSMacSimpleText"; +NSAttributedStringDocumentType NSDocFormatTextDocumentType = @"NSDocFormat"; +NSAttributedStringDocumentType NSWordMLTextDocumentType = @"NSWordML"; +NSAttributedStringDocumentType NSWebArchiveTextDocumentType = @"NSWebArchive"; +NSAttributedStringDocumentType NSOfficeOpenXMLTextDocumentType = @"NSOfficeOpenXML"; +NSAttributedStringDocumentType NSOpenDocumentTextDocumentType = @"NSOpenDocument"; + +NSTextLayoutSectionKey NSTextLayoutSectionOrientation = @"NSTextLayoutSectionOrientation"; +NSTextLayoutSectionKey NSTextLayoutSectionRange = @"NSTextLayoutSectionRange"; + +NSAttributedStringKey NSCharacterShapeAttributeName = @"NSCharacterShape"; +NSAttributedStringKey NSUsesScreenFontsDocumentAttribute = @"UsesScreenFonts"; + +const NSAttributedStringKey NSTextEffectAttributeName = @"NSTextEffect"; +NSAttributedStringKey NSWritingDirectionAttributeName = @"NSWritingDirectionAttribute"; NSUInteger NSUnderlineStrikethroughMask = 0x4000; NSUInteger NSUnderlineByWordMask = 0x8000; @@ -157,7 +144,89 @@ + (NSAttributedString *) attributedStringWithAttachment: error: (NSError **) error { NSUnimplementedMethod(); + NSString *docType = [options objectForKey:NSDocumentTypeDocumentAttribute]; + + //Infer the document format if not provided + if(docType == nil){ + //Extract a prefix from the document to identify the type + //FIXME: use 64 bit ready types and check encoding + char prefix[14]; + NSUInteger dataLength = [data length]; + + if(dataLength < sizeof(prefix)) + { + [data getBytes: prefix length: dataLength]; + prefix[dataLength] = 0; + } + else + { + [data getBytes: prefix length: sizeof(prefix)]; + } + + //Use the prefix to determine the document format + // FIXME extend the list + if (strncmp(prefix, "{\\rtf", 5) == 0) + { + docType = NSRTFTextDocumentType; + } + else if (strncasecmp(prefix, " *) opts + documentAttributes: (NSDictionary *_Nullable *) dict + error: (NSError *_Nullable *) error +{ + NSAttributedString *str = [NSAttributedString alloc]; + str = [str initWithURL: url + options: opts + documentAttributes: dict + error: error]; + if (str == nil) { + return NO; + } + [self setAttributedString: str]; + [str release]; + return YES; +} + @end diff --git a/AppKit/NSMutableParagraphStyle.m b/AppKit/NSMutableParagraphStyle.m index 3aff6ac56..48e092ad5 100644 --- a/AppKit/NSMutableParagraphStyle.m +++ b/AppKit/NSMutableParagraphStyle.m @@ -128,9 +128,29 @@ - (void) setDefaultTabInterval: (CGFloat) interval { } - (void) setTabStops: (NSArray *) tabStops { - tabStops = [tabStops copy]; - [_tabStops release]; - _tabStops = tabStops; + if (tabStops != _tabStops) { + [_tabStops removeAllObjects]; + [_tabStops addObjectsFromArray: tabStops]; + [_tabStops sortUsingSelector: @selector(compare:)]; + } +} + +- (void) addTabStop: (NSTextTab *) tabStop { + NSUInteger index = [_tabStops + indexOfObjectPassingTest: ^BOOL(NSTextTab *other, NSUInteger id, + BOOL *stop) { + return [other compare: tabStop] == NSOrderedAscending; + }]; + + if (index == NSNotFound) { + [_tabStops insertObject: tabStop atIndex: 0]; + } else { + [_tabStops insertObject: tabStop atIndex: index]; + } +} + +- (void) removeTabStop: (NSTextTab *) tabStop { + [_tabStops removeObject: tabStop]; } - (void) setHyphenationFactor: (float) factor { diff --git a/AppKit/NSParagraphStyle.m b/AppKit/NSParagraphStyle.m index 61d8ccda4..09d92da67 100644 --- a/AppKit/NSParagraphStyle.m +++ b/AppKit/NSParagraphStyle.m @@ -34,6 +34,11 @@ + (NSParagraphStyle *) defaultParagraphStyle { return shared; } ++ (NSWritingDirection) defaultWritingDirectionForLanguage: (NSString *) languageName { + NSUnimplementedMethod(); + return NSWritingDirectionNatural; +} + + (NSArray *) _defaultTabStops { static NSArray *shared = nil; @@ -69,7 +74,7 @@ - (void) _initWithDefaults { _lineHeightMultiple = 0; _lineSpacing = 0; _defaultTabInterval = 0; - _tabStops = [[[self class] _defaultTabStops] retain]; + _tabStops = [[[self class] _defaultTabStops] mutableCopy]; _hyphenationFactor = 0; _tighteningFactorForTruncation = 0; } diff --git a/AppKit/NSScrollView.m b/AppKit/NSScrollView.m index 2afdd224c..05c702630 100644 --- a/AppKit/NSScrollView.m +++ b/AppKit/NSScrollView.m @@ -86,6 +86,20 @@ + (NSSize) frameSizeForContentSize: (NSSize) contentSize return contentSize; } ++ (NSSize) frameSizeForContentSize: (NSSize) cSize + horizontalScrollerClass: (Class) horizontalScrollerClass + verticalScrollerClass: (Class) verticalScrollerClass + borderType: (NSBorderType) type + controlSize: (NSControlSize) controlSize + scrollerStyle: (NSScrollerStyle) scrollerStyle +{ + NSUnimplementedMethod(); + return [self frameSizeForContentSize: cSize + hasHorizontalScroller: YES + hasVerticalScroller: YES + borderType: type]; +} + + (NSSize) contentSizeForFrameSize: (NSSize) frameSize hasHorizontalScroller: (BOOL) hasHorizontalScroller hasVerticalScroller: (BOOL) hasVerticalScroller @@ -120,6 +134,16 @@ + (NSSize) contentSizeForFrameSize: (NSSize) frameSize return frameSize; } ++ (NSSize) contentSizeForFrameSize: (NSSize) fSize + horizontalScrollerClass: (Class) horizontalScrollerClass + verticalScrollerClass: (Class) verticalScrollerClass + borderType: (NSBorderType) type + controlSize: (NSControlSize) controlSize + scrollerStyle: (NSScrollerStyle) scrollerStyle +{ + NSUnimplementedMethod(); +} + + (void) setRulerViewClass: (Class) class { _rulerViewClass = class; } @@ -165,6 +189,11 @@ - (void) encodeWithCoder: (NSCoder *) coder { _drawsBackground = [_clipView drawsBackground]; } + _allowsMagnification = NO; + _magnification = 1.0; + _maxMagnification = 4.0; + _minMagnification = 0.25; + _verticalLineScroll = 10.0; // the default value in IB is 10 _verticalPageScroll = 10.0; _horizontalLineScroll = 10.0; @@ -398,6 +427,10 @@ - (void) createHorizontalScrollerIfNeeded { _drawsBackground = YES; _borderType = NSNoBorder; _backgroundColor = [[NSColor controlBackgroundColor] copy]; + _allowsMagnification = NO; + _magnification = 1.0; + _maxMagnification = 4.0; + _minMagnification = 0.25; [self setLineScroll: 1.0]; [self setPageScroll: 10.0]; // entirely arbitrary @@ -614,6 +647,22 @@ - (NSCursor *) documentCursor { return _documentCursor; } +- (CGFloat) magnification { + return _magnification; +} + +- (CGFloat) minMagnification { + return _minMagnification; +} + +- (CGFloat) maxMagnification { + return _maxMagnification; +} + +- (BOOL) allowsMagnification { + return _allowsMagnification; +}; + - (void) setDocumentView: (NSView *) view { [_clipView setDocumentView: view]; [self reflectScrolledClipView: _clipView]; @@ -779,6 +828,30 @@ - (void) setAutohidesScrollers: (BOOL) value { // FIXME: tile or hide/show scrollers? } +- (void) allowsMagnification: (BOOL) value { + _allowsMagnification = value; +} + +- (void) setMaxMagnification: (CGFloat) value { + if (value >= _minMagnification) { + _maxMagnification = value; + } else { + [NSException raise: NSInvalidArgumentException + format: @"maxMagnification (%.3f) must be greater than or equal to minMagnification (%.3f).", + value, _minMagnification]; + } +} + +- (void) setMinMagnification: (CGFloat) value { + if (value <= _maxMagnification) { + _minMagnification = value; + } else { + [NSException raise: NSInvalidArgumentException + format: @"minMagnification (%.3f) must be less than or equal to maxMagnification (%.3f).", + value, _maxMagnification]; + } +} + - (void) tile { NSRect frame; @@ -1005,4 +1078,36 @@ - (void) resizeSubviewsWithOldSize: (NSSize) oldSize { [self _horizontalScroll: _horizontalScroller]; } +- (void) setMagnification:(CGFloat) magnification + centeredAtPoint:(NSPoint) point { + // scale the content view centered at the given point + NSRect frame = [_clipView frame]; + NSSize scaledSize = NSMakeSize(frame.size.width*magnification, frame.size.height*magnification); + NSPoint centeredOrigin = NSMakePoint(point.x - (scaledSize.width/2), point.y - (scaledSize.height/2)); + [_clipView setFrame:NSMakeRect(centeredOrigin.x, centeredOrigin.y, scaledSize.width, scaledSize.height)]; + + // clip the resulting magnification value to min and max magnification + magnification = MAX(_minMagnification, magnification); + magnification = MIN(_maxMagnification, magnification); + + _magnification = magnification; +} + +- (void) magnifyToFitRect: (NSRect) rect { + if (_allowsMagnification) { + // find magnification value needed to scale the content view to the given rectangle without morphing + CGFloat widthMagnification = NSWidth(_clipView.bounds) / NSWidth(rect); + CGFloat heightMagnification = NSHeight(_clipView.bounds) / NSHeight(rect); + CGFloat magnification = MIN(widthMagnification, heightMagnification); + + // The resulting magnification value is clipped to the min/max magnification + magnification = MAX(_minMagnification, magnification); + magnification = MIN(_maxMagnification, magnification); + + (NSPoint) point = NSMakePoint(NSMidX(rect), NSMidY(rect)); + + [_clipView setMagnification:magnification centeredAtPoint:point]; + } +} + @end diff --git a/AppKit/NSScroller.m b/AppKit/NSScroller.m index 754afef2a..6c361fa31 100644 --- a/AppKit/NSScroller.m +++ b/AppKit/NSScroller.m @@ -34,6 +34,9 @@ + (CGFloat) scrollerWidth { return [[NSDisplay currentDisplay] scrollerWidth]; } ++ (NSScrollerStyle) preferredScrollerStyle { + NSUnimplementedMethod(); +} /* OS X has a global default "AppleScrollBarVariant" with the values: Single, DoubleMin, DoubleMax, and DoubleBoth This controls the default position of the scroller. This should be controlling the positioning. @@ -141,6 +144,11 @@ - (NSControlSize) controlSize { return _controlSize; } +- (NSScrollerStyle) scrollerStyle { + return _scrollerStyle; +} + + - (void) setFloatValue: (float) zeroToOneValue knobProportion: (CGFloat) zeroToOneKnob { @@ -185,6 +193,10 @@ - (void) setControlSize: (NSControlSize) value { [self setNeedsDisplay: YES]; } +- (void) setScrollerStyle: (NSScrollerStyle) style { + _scrollerStyle = style; +} + - (NSRect) frameOfDecrementPage { NSRect knobSlot = [self rectForPart: NSScrollerKnobSlot]; NSRect knob = [self rectForPart: NSScrollerKnob]; diff --git a/AppKit/NSTextView.subproj/NSLayoutManager.m b/AppKit/NSTextView.subproj/NSLayoutManager.m index a7cd58597..d4cc26551 100644 --- a/AppKit/NSTextView.subproj/NSLayoutManager.m +++ b/AppKit/NSTextView.subproj/NSLayoutManager.m @@ -30,7 +30,6 @@ this software and associated documentation files (the "Software"), to deal in #import #import -#import #import #import #import @@ -39,6 +38,7 @@ this software and associated documentation files (the "Software"), to deal in #import #import #import +#import #import "NSBidiHelper.h" #import "NSRulerMarker+NSTextExtensions.h" @@ -177,11 +177,17 @@ - (NSArray *) textContainers { } - (NSTextView *) firstTextView { - return [[_textContainers objectAtIndex: 0] textView]; + for (NSTextContainer *container in _textContainers) { + NSTextView *textView = [container textView]; + if (textView) { + return textView; + } + } + return nil; } - (NSTextView *) textViewForBeginningOfSelection { - return [[_textContainers objectAtIndex: 0] textView]; + return [self firstTextView]; } - (BOOL) layoutManagerOwnsFirstResponderInWindow: (NSWindow *) window { @@ -726,6 +732,10 @@ - (NSTextContainer *) extraLineFragmentTextContainer { return _extraLineFragmentTextContainer; } +- (BOOL) allowsNonContiguousLayout { + return _allowsNonContiguousLayout; +} + - (void) setTextContainer: (NSTextContainer *) container forGlyphRange: (NSRange) glyphRange { @@ -1365,7 +1375,7 @@ - (NSRect *) rectArrayForGlyphRange: (NSRange) glyphRange #if DEBUG_rectArrayForGlyphRange_withinSelectedGlyphRange_inTextContainer_rectCount NSLog(@"This existing range is %@\n", NSStringFromRange(range)); #endif - + // The part of the that we are interested in - start with the full // rect, we'll change it if we don't want the full fragment NSRect fill = fragment->rect; @@ -1374,7 +1384,8 @@ - (NSRect *) rectArrayForGlyphRange: (NSRange) glyphRange NSRange intersect; if (remainder.length > 0) intersect = NSIntersectionRange(remainder, range); - else // NSIntersectionRange's returned location is undefined for 0-length ranges + else // NSIntersectionRange's returned location is undefined for + // 0-length ranges intersect = NSMakeRange(remainder.location, 0); #if DEBUG_rectArrayForGlyphRange_withinSelectedGlyphRange_inTextContainer_rectCount @@ -2909,4 +2920,9 @@ - (NSView *) rulerAccessoryViewForTextView: (NSTextView *) view { return nil; } + +- (void) setAllowsNonContiguousLayout: (BOOL) value { + _allowsNonContiguousLayout = value; + NSUnimplementedMethod(); +} @end diff --git a/AppKit/NSTextView.subproj/NSTextContainer.m b/AppKit/NSTextView.subproj/NSTextContainer.m index 1a0632215..40b868263 100644 --- a/AppKit/NSTextView.subproj/NSTextContainer.m +++ b/AppKit/NSTextView.subproj/NSTextContainer.m @@ -189,6 +189,7 @@ - (void) setHeightTracksTextView: (BOOL) flag { - (void) setLayoutManager: (NSLayoutManager *) layoutManager { _layoutManager = layoutManager; + [_textView _setTextStorage: [_layoutManager textStorage]]; } - (void) replaceLayoutManager: (NSLayoutManager *) layoutManager { diff --git a/AppKit/NSTextView.subproj/NSTextTab.m b/AppKit/NSTextView.subproj/NSTextTab.m index 81722bbad..d452db1c1 100644 --- a/AppKit/NSTextView.subproj/NSTextTab.m +++ b/AppKit/NSTextView.subproj/NSTextTab.m @@ -136,4 +136,20 @@ - (BOOL) isEqual: (id) object { return self.location == other.location && self.tabStopType == other.tabStopType; } + +- (NSComparisonResult) compare: (id) anObject { + CGFloat loc; + + if (anObject == self) + return NSOrderedSame; + if (anObject == nil || ![anObject isKindOfClass: [self class]]) + return NSOrderedAscending; + loc = ((NSTextTab *) anObject)->_location; + if (_location < loc) + return NSOrderedAscending; + else if (_location > loc) + return NSOrderedDescending; + else + return NSOrderedSame; +} @end diff --git a/AppKit/NSTextView.subproj/NSTextView.m b/AppKit/NSTextView.subproj/NSTextView.m index 1858357da..c66ad8c61 100644 --- a/AppKit/NSTextView.subproj/NSTextView.m +++ b/AppKit/NSTextView.subproj/NSTextView.m @@ -143,6 +143,37 @@ - (void) encodeWithCoder: (NSCoder *) coder { NSUnimplementedMethod(); } +- (void) _setTextStorage: (NSTextStorage *) storage { + if (_ownsTextStorage) + [_textStorage release]; + + _textStorage = storage; + _ownsTextStorage = NO; + + NSMutableDictionary *typingAttributes = + [[_textStorage attributesAtIndex: 0 + effectiveRange: NULL] mutableCopy]; + if (![typingAttributes objectForKey: NSFontAttributeName]) { + [typingAttributes setObject: _font forKey: NSFontAttributeName]; + } + if (![typingAttributes objectForKey: NSForegroundColorAttributeName]) { + [typingAttributes setObject: _textColor + forKey: NSForegroundColorAttributeName]; + } + + [_typingAttributes release]; + _typingAttributes = typingAttributes; + + [_defaultParagraphStyle release]; + if ([typingAttributes objectForKey: NSParagraphStyleAttributeName]) { + _defaultParagraphStyle = [[typingAttributes + objectForKey: NSParagraphStyleAttributeName] copy]; + } else { + _defaultParagraphStyle = + [[NSParagraphStyle defaultParagraphStyle] copy]; + } +} + - initWithCoder: (NSCoder *) coder { [super initWithCoder: coder]; @@ -240,8 +271,6 @@ - (void) encodeWithCoder: (NSCoder *) coder { - initWithFrame: (NSRect) frame textContainer: (NSTextContainer *) container { [super initWithFrame: frame]; - _textStorage = [[container layoutManager] textStorage]; - _ownsTextStorage = NO; _textContainer = [container retain]; [_textContainer setTextView: self]; _textContainerInset = NSMakeSize(0, 0); @@ -263,26 +292,6 @@ - (void) encodeWithCoder: (NSCoder *) coder { _selectedRanges = [[NSMutableArray alloc] init]; [_selectedRanges addObject: [NSValue valueWithRange: NSMakeRange(0, 0)]]; - NSMutableDictionary *typingAttributes = - [[_textStorage attributesAtIndex: 0 - effectiveRange: NULL] mutableCopy]; - if (![typingAttributes objectForKey: NSFontAttributeName]) { - [typingAttributes setObject: _font forKey: NSFontAttributeName]; - } - if (![typingAttributes objectForKey: NSForegroundColorAttributeName]) { - [typingAttributes setObject: _textColor - forKey: NSForegroundColorAttributeName]; - } - _typingAttributes = typingAttributes; - - if ([typingAttributes objectForKey: NSParagraphStyleAttributeName]) { - _defaultParagraphStyle = [[typingAttributes - objectForKey: NSParagraphStyleAttributeName] copy]; - } else { - _defaultParagraphStyle = - [[NSParagraphStyle defaultParagraphStyle] copy]; - } - _rangeForUserCompletion = NSMakeRange(NSNotFound, 0); _selectedTextAttributes = [[NSDictionary dictionaryWithObjectsAndKeys: [NSColor selectedTextColor], @@ -291,9 +300,12 @@ - (void) encodeWithCoder: (NSCoder *) coder { NSBackgroundColorAttributeName, nil] retain]; + [self _setTextStorage: [[container layoutManager] textStorage]]; + [self setBoundsOrigin: NSMakePoint(-_textContainerInset.width, -_textContainerInset.height)]; [self configureMenu]; + [self registerForDraggedTypes: [NSArray arrayWithObjects: NSRTFPboardType, NSStringPboardType, @@ -3389,9 +3401,7 @@ - (void) showGuessPanel: sender { - (void) _continuousSpellCheckWithInvalidatedRange: (NSRange) invalidatedRange { NSString *string = [self string]; NSUInteger start, end; - // TODO, truncate invalidated range to string size if needed - // round range to nearest paragraphs [string getParagraphStart: &start @@ -3433,10 +3443,8 @@ - (void) _continuousSpellCheckWithInvalidatedRange: (NSRange) invalidatedRange { } - (void) _continuousSpellCheck { - [self _continuousSpellCheckWithInvalidatedRange: NSMakeRange( - 0, - [[self string] - length])]; + NSRange invalidatedRange = NSMakeRange(0, [[self string] length]); + [self _continuousSpellCheckWithInvalidatedRange: invalidatedRange]; } - (void) checkSpelling: sender { @@ -3630,6 +3638,22 @@ - (void) setEnabledTextCheckingTypes: (NSTextCheckingTypes) checkingTypes { NSUnimplementedMethod(); } +- (BOOL) smartInsertDeleteEnabled { + return _smartInsertDeleteEnabled; +} + +- (void) setSmartInsertDeleteEnabled: (BOOL) boolForKey { + _smartInsertDeleteEnabled = boolForKey; +} + +- (BOOL) allowsDocumentBackgroundColorChange { + return _allowsDocumentBackgroundColorChange; +} + +- (void) setAllowsDocumentBackgroundColorChange: (BOOL) value { + _allowsDocumentBackgroundColorChange = value; +} + - (void) setSpellingState: (NSInteger) value range: (NSRange) characterRange { [[self layoutManager] addTemporaryAttribute: NSSpellingStateAttributeName @@ -3957,5 +3981,109 @@ - (id) replacementObjectForKeyedArchiver { NSUnimplementedMethod(); return self; } +- (NSTextLayoutOrientation) layoutOrientation { + NSUnimplementedMethod(); + return _layoutOrientation; +} + +- (void) setLayoutOrientation: (NSTextLayoutOrientation) orientation { + _layoutOrientation = orientation; + NSUnimplementedMethod(); +} + +- (BOOL) isIncrementalSearchingEnabled { + NSUnimplementedMethod(); + return _incrementalSearchingEnabled; +} + +- (BOOL) usesFindBar { + NSUnimplementedMethod(); + return _usesFindBar; +} + +- (BOOL) usesInspectorBar { + NSUnimplementedMethod(); + return _usesInspectorBar; +} + +- (void) setIncrementalSearchingEnabled: (BOOL) value { + NSUnimplementedMethod(); + _incrementalSearchingEnabled = value; +} + +- (void) setUsesFindBar: (BOOL) value { + NSUnimplementedMethod(); + _usesFindBar = value; +} + +- (void) setUsesInspectorBar: (BOOL) value { + NSUnimplementedMethod(); + _usesInspectorBar = value; +} + +- (BOOL) isGrammarCheckingEnabled { + NSUnimplementedMethod(); + return _grammarCheckingEnabled; +} + +- (BOOL) isAutomaticQuoteSubstitutionEnabled { + NSUnimplementedMethod(); + return _automaticQuoteSubstitutionEnabled; +} + +- (BOOL) isAutomaticDashSubstitutionEnabled { + NSUnimplementedMethod(); + return _automaticDashSubstitutionEnabled; +} + +- (BOOL) isAutomaticLinkDetectionEnabled { + NSUnimplementedMethod(); + return _automaticLinkDetectionEnabled; +} + +- (BOOL) isAutomaticDataDetectionEnabled { + NSUnimplementedMethod(); + return _automaticDataDetectionEnabled; +} + +- (BOOL) isAutomaticTextReplacementEnabled { + NSUnimplementedMethod(); + return _automaticTextReplacementEnabled; +} + +- (void) setGrammarCheckingEnabled: (BOOL) value { + NSUnimplementedMethod(); + _grammarCheckingEnabled = value; +} + +- (void) setAutomaticQuoteSubstitutionEnabled: (BOOL) value { + NSUnimplementedMethod(); + _automaticQuoteSubstitutionEnabled = value; +} + +- (void) setAutomaticDashSubstitutionEnabled: (BOOL) value { + NSUnimplementedMethod(); + _automaticDashSubstitutionEnabled = value; +} + +- (void) setAutomaticLinkDetectionEnabled: (BOOL) value { + NSUnimplementedMethod(); + _automaticLinkDetectionEnabled = value; +} + +- (void) setAutomaticDataDetectionEnabled: (BOOL) value { + NSUnimplementedMethod(); + _automaticDataDetectionEnabled = value; +} + +- (void) setAutomaticTextReplacementEnabled: (BOOL) value { + NSUnimplementedMethod(); + _automaticTextReplacementEnabled = value; +} + +// Is defined in NSText but throws an NSInvalidAbstractInvocation Exception +- (void) setImportsGraphics: (BOOL) value { + NSUnimplementedMethod(); +} @end diff --git a/AppKit/NSView.m b/AppKit/NSView.m index b945e7251..533d7daf3 100644 --- a/AppKit/NSView.m +++ b/AppKit/NSView.m @@ -647,7 +647,32 @@ - (BOOL) postsBoundsChangedNotifications { } - (void) scaleUnitSquareToSize: (NSSize) size { - NSUnimplementedMethod(); + if (size.width != 1.0 || size.height != 1.0) { + // todo what if width or height is zero? + + [_bounds scaleXBy: size.width yBy: size.height]; + + _bounds.origin.x = _bounds.origin.x / size.width; + _bounds.origin.y = _bounds.origin.y / size.height; + _bounds.size.width = _bounds.size.width / size.width; + _bounds.size.height = _bounds.size.height / size.height; + + isRotatedOrScaledFromBase = YES; + + /* code from gnustep + todo + if (_coordinates_valid) + { + (*invalidateImp)(self, invalidateSel); + } + */ + [self resetCursorRects] + if (_postsNotificationOnBoundsChange) { + [[NSNotificationCenter defaultCenter] + postNotificationName: NSViewBoundsDidChangeNotification + object: self]; + } + } } - (NSWindow *) window { diff --git a/AppKit/X11.backend/X11Display.m b/AppKit/X11.backend/X11Display.m index dce249efc..5f77ffa0d 100644 --- a/AppKit/X11.backend/X11Display.m +++ b/AppKit/X11.backend/X11Display.m @@ -592,10 +592,10 @@ - (NSColor *) colorWithName: (NSString *) colorName { if ([colorName isEqual: @"windowFrameColor"]) return [NSColor lightGrayColor]; if ([colorName isEqual: @"selectedTextBackgroundColor"]) - return [NSColor colorWithCalibratedRed: 0x33 - green: 0x8f - blue: 0xff - alpha: 1.0f]; + return [NSColor colorWithCalibratedRed: 0.20f + green: 0.55f + blue: 1.00f + alpha: 1.00f]; NSLog(@"missing color for %@", colorName); return [NSColor redColor]; diff --git a/AppKit/include/AppKit/NSAttributedString.h b/AppKit/include/AppKit/NSAttributedString.h index 03a7bd389..bad341c48 100644 --- a/AppKit/include/AppKit/NSAttributedString.h +++ b/AppKit/include/AppKit/NSAttributedString.h @@ -24,95 +24,112 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @class NSFont, NSColor, NSParagraphStyle, NSTextAttachment, NSFileWrapper, NSTextList, NSTextBlock, NSTextTable; -APPKIT_EXPORT NSString *const NSFontAttributeName; -APPKIT_EXPORT NSString *const NSParagraphStyleAttributeName; -APPKIT_EXPORT NSString *const NSForegroundColorAttributeName; -APPKIT_EXPORT NSString *const NSBackgroundColorAttributeName; -APPKIT_EXPORT NSString *const NSUnderlineStyleAttributeName; -APPKIT_EXPORT NSString *const NSUnderlineColorAttributeName; -APPKIT_EXPORT NSString *const NSAttachmentAttributeName; -APPKIT_EXPORT NSString *const NSKernAttributeName; -APPKIT_EXPORT NSString *const NSLigatureAttributeName; -APPKIT_EXPORT NSString *const NSStrikethroughStyleAttributeName; -APPKIT_EXPORT NSString *const NSStrikethroughColorAttributeName; -APPKIT_EXPORT NSString *const NSObliquenessAttributeName; -APPKIT_EXPORT NSString *const NSStrokeWidthAttributeName; -APPKIT_EXPORT NSString *const NSStrokeColorAttributeName; -APPKIT_EXPORT NSString *const NSBaselineOffsetAttributeName; -APPKIT_EXPORT NSString *const NSSuperscriptAttributeName; -APPKIT_EXPORT NSString *const NSLinkAttributeName; -APPKIT_EXPORT NSString *const NSShadowAttributeName; -APPKIT_EXPORT NSString *const NSExpansionAttributeName; -APPKIT_EXPORT NSString *const NSCursorAttributeName; -APPKIT_EXPORT NSString *const NSToolTipAttributeName; - -APPKIT_EXPORT NSString *const NSSpellingStateAttributeName; - -APPKIT_EXPORT NSString *const NSDocumentTypeDocumentAttribute; -APPKIT_EXPORT NSString *const NSConvertedDocumentAttribute; -APPKIT_EXPORT NSString *const NSFileTypeDocumentAttribute; -APPKIT_EXPORT NSString *const NSTitleDocumentAttribute; -APPKIT_EXPORT NSString *const NSCompanyDocumentAttribute; -APPKIT_EXPORT NSString *const NSCopyrightDocumentAttribute; -APPKIT_EXPORT NSString *const NSSubjectDocumentAttribute; -APPKIT_EXPORT NSString *const NSAuthorDocumentAttribute; -APPKIT_EXPORT NSString *const NSKeywordsDocumentAttribute; -APPKIT_EXPORT NSString *const NSCommentDocumentAttribute; -APPKIT_EXPORT NSString *const NSEditorDocumentAttribute; -APPKIT_EXPORT NSString *const NSCreationTimeDocumentAttribute; -APPKIT_EXPORT NSString *const NSModificationTimeDocumentAttribute; -APPKIT_EXPORT NSString *const NSManagerDocumentAttribute; -APPKIT_EXPORT NSString *const NSCategoryDocumentAttribute; -APPKIT_EXPORT NSString *const NSAppearanceDocumentAttribute; -APPKIT_EXPORT NSString *const NSCharacterEncodingDocumentAttribute; -APPKIT_EXPORT NSString *const NSDefaultAttributesDocumentAttribute; -APPKIT_EXPORT NSString *const NSPaperSizeDocumentAttribute; -APPKIT_EXPORT NSString *const NSLeftMarginDocumentAttribute; -APPKIT_EXPORT NSString *const NSRightMarginDocumentAttribute; -APPKIT_EXPORT NSString *const NSTopMarginDocumentAttribute; -APPKIT_EXPORT NSString *const NSBottomMarginDocumentAttribute; -APPKIT_EXPORT NSString *const NSViewSizeDocumentAttribute; -APPKIT_EXPORT NSString *const NSViewZoomDocumentAttribute; -APPKIT_EXPORT NSString *const NSViewModeDocumentAttribute; -APPKIT_EXPORT NSString *const NSReadOnlyDocumentAttribute; -APPKIT_EXPORT NSString *const NSBackgroundColorDocumentAttribute; -APPKIT_EXPORT NSString *const NSHyphenationFactorDocumentAttribute; -APPKIT_EXPORT NSString *const NSDefaultTabIntervalDocumentAttribute; -APPKIT_EXPORT NSString *const NSTextLayoutSectionsAttribute; -APPKIT_EXPORT NSString *const NSExcludedElementsDocumentAttribute; -APPKIT_EXPORT NSString *const NSTextEncodingNameDocumentAttribute; -APPKIT_EXPORT NSString *const NSPrefixSpacesDocumentAttribute; - -APPKIT_EXPORT NSString *const NSDocumentTypeDocumentOption; -APPKIT_EXPORT NSString *const NSDefaultAttributesDocumentOption; -APPKIT_EXPORT NSString *const NSCharacterEncodingDocumentOption; -APPKIT_EXPORT NSString *const NSTextEncodingNameDocumentOption; -APPKIT_EXPORT NSString *const NSBaseURLDocumentOption; -APPKIT_EXPORT NSString *const NSTimeoutDocumentOption; -APPKIT_EXPORT NSString *const NSWebPreferencesDocumentOption; -APPKIT_EXPORT NSString *const NSWebResourceLoadDelegateDocumentOption; -APPKIT_EXPORT NSString *const NSTextSizeMultiplierDocumentOption; -APPKIT_EXPORT NSString *const NSFileTypeDocumentOption; - -APPKIT_EXPORT NSString *const NSPlainTextDocumentType; -APPKIT_EXPORT NSString *const NSRTFTextDocumentType; -APPKIT_EXPORT NSString *const NSRTFDTextDocumentType; -APPKIT_EXPORT NSString *const NSHTMLTextDocumentType; -APPKIT_EXPORT NSString *const NSMacSimpleTextDocumentType; -APPKIT_EXPORT NSString *const NSDocFormatTextDocumentType; -APPKIT_EXPORT NSString *const NSWordMLTextDocumentType; -APPKIT_EXPORT NSString *const NSWebArchiveTextDocumentType; -APPKIT_EXPORT NSString *const NSOfficeOpenXMLTextDocumentType; -APPKIT_EXPORT NSString *const NSOpenDocumentTextDocumentType; - -APPKIT_EXPORT NSString *const NSTextLayoutSectionOrientation; -APPKIT_EXPORT NSString *const NSTextLayoutSectionRange; - -APPKIT_EXPORT NSString *const NSCharacterShapeAttributeName; -APPKIT_EXPORT NSString *const NSUsesScreenFontsDocumentAttribute; - -APPKIT_EXPORT NSString *const NSTextEffectAttributeName; - +typedef NSString *NSAttributedStringDocumentReadingOptionKey; +typedef NSString *NSAttributedStringDocumentAttributeKey; +typedef NSString *NSAttributedStringDocumentType; +typedef NSString *NSTextLayoutSectionKey; +typedef NSString *NSAttributedStringKey; + +// The following constants are *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSAttributedStringKey NSFontAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSParagraphStyleAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSForegroundColorAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSBackgroundColorAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSUnderlineStyleAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSUnderlineColorAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSAttachmentAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSKernAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSLigatureAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSStrikethroughStyleAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSStrikethroughColorAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSObliquenessAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSStrokeWidthAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSStrokeColorAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSBaselineOffsetAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSSuperscriptAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSLinkAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSShadowAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSExpansionAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSCursorAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSToolTipAttributeName; + +// The following constant is *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSAttributedStringKey NSSpellingStateAttributeName; + +// The following constants are *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSDocumentTypeDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSConvertedDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSFileTypeDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSTitleDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSCompanyDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSCopyrightDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSSubjectDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSAuthorDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSKeywordsDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSCommentDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSEditorDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSCreationTimeDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSModificationTimeDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSManagerDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSCategoryDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSAppearanceDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSCharacterEncodingDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSDefaultAttributesDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSPaperSizeDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSLeftMarginDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSRightMarginDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSTopMarginDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSBottomMarginDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSViewSizeDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSViewZoomDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSViewModeDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSReadOnlyDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSBackgroundColorDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSHyphenationFactorDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSDefaultTabIntervalDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSTextLayoutSectionsAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSExcludedElementsDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSTextEncodingNameDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSPrefixSpacesDocumentAttribute; +APPKIT_EXPORT NSAttributedStringDocumentAttributeKey NSCocoaVersionDocumentAttribute; + +// The following constants are *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSDocumentTypeDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSDefaultAttributesDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSCharacterEncodingDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSTextEncodingNameDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSBaseURLDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSTimeoutDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSWebPreferencesDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSWebResourceLoadDelegateDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSTextSizeMultiplierDocumentOption; +APPKIT_EXPORT NSAttributedStringDocumentReadingOptionKey NSFileTypeDocumentOption; + +// The following constants are *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSAttributedStringDocumentType NSPlainTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSRTFTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSRTFDTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSHTMLTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSMacSimpleTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSDocFormatTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSWordMLTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSWebArchiveTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSOfficeOpenXMLTextDocumentType; +APPKIT_EXPORT NSAttributedStringDocumentType NSOpenDocumentTextDocumentType; + +// The following constants are *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSTextLayoutSectionKey NSTextLayoutSectionOrientation; +APPKIT_EXPORT NSTextLayoutSectionKey NSTextLayoutSectionRange; + +// The following constants are *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSAttributedStringKey NSCharacterShapeAttributeName; +APPKIT_EXPORT NSAttributedStringKey NSUsesScreenFontsDocumentAttribute; + +APPKIT_EXPORT const NSAttributedStringKey NSTextEffectAttributeName; +// The following constant is *not* declared as `const` in Apple's AppKit (they are located in __data) +APPKIT_EXPORT NSAttributedStringKey NSWritingDirectionAttributeName; + +// The following constants are *not* declared as `const` in Apple's AppKit (they are located in __data) APPKIT_EXPORT NSUInteger NSUnderlineStrikethroughMask; APPKIT_EXPORT NSUInteger NSUnderlineByWordMask; @@ -239,6 +256,13 @@ enum { - (NSRect) boundingRectWithSize: (NSSize) size options: (NSStringDrawingOptions) options; +#pragma mark - +#pragma mark Getting Attribute Data +- (void)enumerateAttribute: (NSAttributedStringKey) attrName + inRange: (NSRange) enumerationRange + options: (NSAttributedStringEnumerationOptions) opts + usingBlock: (void (^)(id value, NSRange range, BOOL *stop)) block; + #pragma mark - #pragma mark Testing String Data Sources diff --git a/AppKit/include/AppKit/NSDocument.h b/AppKit/include/AppKit/NSDocument.h index 62d760d72..440e176b0 100644 --- a/AppKit/include/AppKit/NSDocument.h +++ b/AppKit/include/AppKit/NSDocument.h @@ -23,18 +23,23 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ @class NSWindow, NSWindowController, NSSavePanel, NSMenuItem, NSFileWrapper, NSPrintOperation, NSPrintInfo, NSPageLayout, NSView; -typedef enum { +typedef enum NSDocumentChangeType : NSUInteger { NSChangeDone, NSChangeUndone, NSChangeCleared, NSChangeReadOtherContents, NSChangeAutosaved, + NSChangeRedone, + NSChangeDiscardable = 256, } NSDocumentChangeType; typedef enum { NSSaveOperation, NSSaveAsOperation, NSSaveToOperation, + NSAutosaveElsewhereOperation, + NSAutosaveInPlaceOperation, + NSAutosaveAsOperation, NSAutosaveOperation, } NSSaveOperationType; @@ -230,7 +235,7 @@ typedef enum { (NSSaveOperationType) operation; - (NSFileWrapper *) fileWrapperRepresentationOfType: (NSString *) type; - initWithContentsOfFile: (NSString *) path ofType: (NSString *) type; -- initWithContentsOfURL: (NSURL *) url ofType: (NSString *) type; +- (id) initWithContentsOfURL: (NSURL *) url ofType: (NSString *) type; - (BOOL) loadDataRepresentation: (NSData *) data ofType: (NSString *) type; - (BOOL) loadFileWrapperRepresentation: (NSFileWrapper *) wrapper ofType: (NSString *) type; @@ -259,4 +264,12 @@ typedef enum { ofType: (NSString *) type saveOperation: (NSSaveOperationType) operation; +- (void)saveToURL: (NSURL *) url + ofType: (NSString *) typeName + forSaveOperation: (NSSaveOperationType) saveOperation +completionHandler: (void (^)(NSError *errorOrNil)) completionHandler; + +- (void)autosaveWithImplicitCancellability: (BOOL) autosavingIsImplicitlyCancellable + completionHandler: (void (^)(NSError *errorOrNil)) completionHandler; + @end diff --git a/AppKit/include/AppKit/NSLayoutManager.h b/AppKit/include/AppKit/NSLayoutManager.h index 03de587a4..9463dbbf5 100644 --- a/AppKit/include/AppKit/NSLayoutManager.h +++ b/AppKit/include/AppKit/NSLayoutManager.h @@ -32,6 +32,11 @@ typedef enum { NSGlyphInscribeOverBelow, } NSGlyphInscription; +typedef NS_ENUM(NSInteger, NSTextLayoutOrientation) { + NSTextLayoutOrientationHorizontal, + NSTextLayoutOrientationVertical, +}; + @interface NSLayoutManager : NSObject { NSTextStorage *_textStorage; NSGlyphGenerator *_glyphGenerator; @@ -47,6 +52,7 @@ typedef enum { struct NSRangeEntries *_rangeToTemporaryAttributes; BOOL _layoutInvalid; + BOOL _allowsNonContiguousLayout; NSRect _extraLineFragmentRect; NSRect _extraLineFragmentUsedRect; @@ -126,6 +132,8 @@ typedef enum { - (NSRect) extraLineFragmentUsedRect; - (NSTextContainer *) extraLineFragmentTextContainer; +- (BOOL) allowsNonContiguousLayout; + - (void) setTextContainer: (NSTextContainer *) container forGlyphRange: (NSRange) glyphRange; - (void) setLineFragmentRect: (NSRect) fragmentRect @@ -268,6 +276,8 @@ typedef enum { paragraphStyle: (NSParagraphStyle *) style ruler: (NSRulerView *) ruler enabled: (BOOL) isEnabled; + +- (void) setAllowsNonContiguousLayout: (BOOL) value; @end @protocol NSLayoutManagerDelegate @@ -284,4 +294,6 @@ typedef enum { @protocol NSTextLayoutOrientationProvider +- (NSTextLayoutOrientation) layoutOrientation; + @end diff --git a/AppKit/include/AppKit/NSMutableAttributedString.h b/AppKit/include/AppKit/NSMutableAttributedString.h index 0c2cbacfa..cab1673ed 100644 --- a/AppKit/include/AppKit/NSMutableAttributedString.h +++ b/AppKit/include/AppKit/NSMutableAttributedString.h @@ -25,4 +25,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - (void) fixParagraphStyleAttributeInRange: (NSRange) range; - (void) fixAttributesInRange: (NSRange) range; - (void) applyFontTraits: (NSFontTraitMask) traits range: (NSRange) range; + +- (BOOL) readFromURL: (NSURL *) url + options: (NSDictionary *) opts + documentAttributes: (NSDictionary * _Nullable *) dict + error: (NSError * _Nullable *)error; + +- (void)addAttribute: (NSAttributedStringKey) name + value: (id) value + range: (NSRange) range; + @end diff --git a/AppKit/include/AppKit/NSMutableParagraphStyle.h b/AppKit/include/AppKit/NSMutableParagraphStyle.h index 365044aa7..bf719535c 100644 --- a/AppKit/include/AppKit/NSMutableParagraphStyle.h +++ b/AppKit/include/AppKit/NSMutableParagraphStyle.h @@ -18,6 +18,7 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import +#import @interface NSMutableParagraphStyle : NSParagraphStyle @@ -47,6 +48,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - (void) setDefaultTabInterval: (CGFloat) interval; - (void) setTabStops: (NSArray *) tabStops; +- (void) addTabStop: (NSTextTab *) tabStop; +- (void) removeTabStop: (NSTextTab *) tabStop; + - (void) setHyphenationFactor: (float) factor; - (void) setTighteningFactorForTruncation: (float) factor; diff --git a/AppKit/include/AppKit/NSParagraphStyle.h b/AppKit/include/AppKit/NSParagraphStyle.h index f942545bd..13fd29741 100644 --- a/AppKit/include/AppKit/NSParagraphStyle.h +++ b/AppKit/include/AppKit/NSParagraphStyle.h @@ -45,13 +45,15 @@ typedef enum { CGFloat _lineHeightMultiple; CGFloat _lineSpacing; CGFloat _defaultTabInterval; - NSArray *_tabStops; + NSMutableArray *_tabStops; float _hyphenationFactor; float _tighteningFactorForTruncation; } + (NSParagraphStyle *) defaultParagraphStyle; ++ (NSWritingDirection)defaultWritingDirectionForLanguage: (NSString *)languageName; + - (NSWritingDirection) baseWritingDirection; - (CGFloat) paragraphSpacing; diff --git a/AppKit/include/AppKit/NSScrollView.h b/AppKit/include/AppKit/NSScrollView.h index 946731c5f..2ca43aaa6 100644 --- a/AppKit/include/AppKit/NSScrollView.h +++ b/AppKit/include/AppKit/NSScrollView.h @@ -19,6 +19,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import #import +#import +#import #import @class NSClipView, NSScroller, NSColor, NSRulerView; @@ -50,16 +52,32 @@ APPKIT_EXPORT NSString *const NSScrollViewDidLiveScrollNotification; BOOL _scrollsDynamically; BOOL _autohidesScrollers; NSCursor *_documentCursor; + BOOL _allowsMagnification; + CGFloat _magnification; + CGFloat _minMagnification; + CGFloat _maxMagnification; } + (NSSize) frameSizeForContentSize: (NSSize) contentSize hasHorizontalScroller: (BOOL) hasHorizontalScroller hasVerticalScroller: (BOOL) hasVerticalScroller borderType: (NSBorderType) borderType; ++ (NSSize)frameSizeForContentSize: (NSSize)cSize + horizontalScrollerClass: (Class)horizontalScrollerClass + verticalScrollerClass: (Class)verticalScrollerClass + borderType: (NSBorderType)type + controlSize: (NSControlSize)controlSize + scrollerStyle: (NSScrollerStyle)scrollerStyle; + (NSSize) contentSizeForFrameSize: (NSSize) fSize hasHorizontalScroller: (BOOL) hasHorizontalScroller hasVerticalScroller: (BOOL) hasVerticalScroller borderType: (NSBorderType) borderType; ++ (NSSize)contentSizeForFrameSize: (NSSize)fSize + horizontalScrollerClass: (Class)horizontalScrollerClass + verticalScrollerClass: (Class)verticalScrollerClass + borderType: (NSBorderType)type + controlSize: (NSControlSize)controlSize + scrollerStyle: (NSScrollerStyle)scrollerStyle; + (void) setRulerViewClass: (Class) aClass; + (Class) rulerViewClass; @@ -94,6 +112,10 @@ APPKIT_EXPORT NSString *const NSScrollViewDidLiveScrollNotification; - (BOOL) autohidesScrollers; - (NSCursor *) documentCursor; +- (CGFloat) magnification; +- (CGFloat) minMagnification; +- (CGFloat) maxMagnification; +- (BOOL) allowsMagnification; - (void) setDocumentView: (NSView *) view; - (void) setContentView: (NSClipView *) clipView; @@ -116,8 +138,17 @@ APPKIT_EXPORT NSString *const NSScrollViewDidLiveScrollNotification; - (void) setScrollsDynamically: (BOOL) flag; - (void) setDocumentCursor: (NSCursor *) cursor; - (void) setAutohidesScrollers: (BOOL) value; +- (void) setMagnification: (CGFloat) value; +- (void) setMinMagnification: (CGFloat) value; +- (void) setMaxMagnification: (CGFloat) value; +- (void) setAllowsMagnification: (BOOL) value; +- (void) setMaxMagnification: (CGFloat) value; +- (void) minMagnification: (CGFloat) value; - (void) tile; - (void) reflectScrolledClipView: (NSClipView *) clipView; +- (void) setMagnification:(CGFloat) magnification + centeredAtPoint:(NSPoint) point; +- (void) magnifyToFitRect: (NSRect) rect; @end diff --git a/AppKit/include/AppKit/NSScroller.h b/AppKit/include/AppKit/NSScroller.h index a255e8f80..5ffb10e82 100644 --- a/AppKit/include/AppKit/NSScroller.h +++ b/AppKit/include/AppKit/NSScroller.h @@ -46,6 +46,12 @@ enum { NSOnlyScrollerArrows = 1, NSAllScrollerParts = 2, }; + +typedef NS_ENUM(NSInteger, NSScrollerStyle) { + NSScrollerStyleLegacy, + NSScrollerStyleOverlay, +}; + typedef NSUInteger NSUsableScrollerParts; @interface NSScroller : NSControl { @@ -64,6 +70,8 @@ typedef NSUInteger NSUsableScrollerParts; NSScrollerPart _hitPart; BOOL _isEnabled; BOOL _isHighlighted; + + NSScrollerStyle _scrollerStyle; } + (CGFloat) scrollerWidth; @@ -71,11 +79,14 @@ typedef NSUInteger NSUsableScrollerParts; - (CGFloat) knobProportion; - (NSScrollArrowPosition) arrowsPosition; - (NSControlSize) controlSize; +- (NSScrollerStyle) scrollerStyle; ++ (NSScrollerStyle) preferredScrollerStyle; - (void) setFloatValue: (float) zeroToOneValue knobProportion: (CGFloat) zeroToOneKnob; - (void) setArrowsPosition: (NSScrollArrowPosition) position; - (void) setControlSize: (NSControlSize) value; +- (void) setScrollerStyle: (NSScrollerStyle) style; - (NSRect) rectForPart: (NSScrollerPart) part; - (void) checkSpaceForParts; diff --git a/AppKit/include/AppKit/NSTextTab.h b/AppKit/include/AppKit/NSTextTab.h index f52b8da53..bb886e989 100644 --- a/AppKit/include/AppKit/NSTextTab.h +++ b/AppKit/include/AppKit/NSTextTab.h @@ -49,4 +49,5 @@ APPKIT_EXPORT NSString *NSTabColumnTerminatorsAttributeName; - (CGFloat) location; +- (NSComparisonResult) compare: (id) anObject; @end diff --git a/AppKit/include/AppKit/NSTextView.h b/AppKit/include/AppKit/NSTextView.h index 54455036b..58e92d34a 100644 --- a/AppKit/include/AppKit/NSTextView.h +++ b/AppKit/include/AppKit/NSTextView.h @@ -30,6 +30,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import #import #import +#import #import @@ -68,7 +69,7 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier; @class NSUndoTyping; -@interface NSTextView : NSText { +@interface NSTextView : NSText { NSTextStorage *_textStorage; NSTextContainer *_textContainer; NSSize _textContainerInset; @@ -98,6 +99,7 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier; BOOL _usesRuler; BOOL _rulerVisible; BOOL _usesFontPanel; + BOOL _usesFindBar; BOOL _allowsUndo; NSMutableArray *_selectedRanges; @@ -129,14 +131,30 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier; BOOL _isContinuousSpellCheckingEnabled; BOOL _isAutomaticSpellingCorrectionEnabled; NSTextCheckingTypes _enabledTextCheckingTypes; + BOOL _smartInsertDeleteEnabled; + + BOOL _allowsDocumentBackgroundColorChange; NSUndoTyping *_undoTyping; + NSTextLayoutOrientation _layoutOrientation; + + BOOL _incrementalSearchingEnabled; + BOOL _grammarCheckingEnabled; + BOOL _automaticQuoteSubstitutionEnabled; + BOOL _automaticDashSubstitutionEnabled; + BOOL _automaticLinkDetectionEnabled; + BOOL _automaticDataDetectionEnabled; + BOOL _automaticTextReplacementEnabled; + + BOOL _usesInspectorBar; } - initWithFrame: (NSRect) frame textContainer: (NSTextContainer *) container; - initWithFrame: (NSRect) frame; +- (void) _setTextStorage: (NSTextStorage *) storage; + - (NSTextContainer *) textContainer; - (NSSize) textContainerInset; @@ -250,8 +268,36 @@ APPKIT_EXPORT NSString *const NSAllRomanInputSourcesLocaleIdentifier; - (NSTextCheckingTypes) enabledTextCheckingTypes; - (void) setEnabledTextCheckingTypes: (NSTextCheckingTypes) checkingTypes; +- (BOOL) smartInsertDeleteEnabled; +- (void) setSmartInsertDeleteEnabled: (BOOL) boolForKey; + +- (BOOL) allowsDocumentBackgroundColorChange; +- (void) setAllowsDocumentBackgroundColorChange: (BOOL) value; + - (void) setSpellingState: (NSInteger) value range: (NSRange) characterRange; +- (BOOL) isIncrementalSearchingEnabled; +- (BOOL) usesFindBar; +- (BOOL) usesInspectorBar; +- (void) setIncrementalSearchingEnabled: (BOOL) value; +- (void) setUsesFindBar: (BOOL) value; +- (void) setUsesInspectorBar: (BOOL) value; + +- (void) setLayoutOrientation:(NSTextLayoutOrientation)orientation; + +- (BOOL) isGrammarCheckingEnabled; +- (BOOL) isAutomaticQuoteSubstitutionEnabled; +- (BOOL) isAutomaticDashSubstitutionEnabled; +- (BOOL) isAutomaticLinkDetectionEnabled; +- (BOOL) isAutomaticDataDetectionEnabled; +- (BOOL) isAutomaticTextReplacementEnabled; +- (void) setGrammarCheckingEnabled: (BOOL) value; +- (void) setAutomaticQuoteSubstitutionEnabled: (BOOL) value; +- (void) setAutomaticDashSubstitutionEnabled: (BOOL) value; +- (void) setAutomaticLinkDetectionEnabled: (BOOL) value; +- (void) setAutomaticDataDetectionEnabled: (BOOL) value; +- (void) setAutomaticTextReplacementEnabled: (BOOL) value; + @end @interface NSObject (NSTextView_undoManager) diff --git a/AppKit/include/AppKit/NSView.h b/AppKit/include/AppKit/NSView.h index 7f65ac772..20dbf5c67 100644 --- a/AppKit/include/AppKit/NSView.h +++ b/AppKit/include/AppKit/NSView.h @@ -24,6 +24,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #import #import #import +#import #import #import #import @@ -109,6 +110,7 @@ APPKIT_EXPORT const NSViewFullScreenModeOptionKey NSFullScreenModeApplicationPre NSInteger _rectsBeingRedrawnCount; CGFloat _frameRotation; CGFloat _boundsRotation; + BOOL _translatesAutoresizingMaskIntoConstraints; BOOL _validTrackingAreas; BOOL _validTransforms; @@ -134,7 +136,6 @@ APPKIT_EXPORT const NSViewFullScreenModeOptionKey NSFullScreenModeApplicationPre NSLayoutPriority _verticalContentHuggingPriority; NSLayoutPriority _horizontalContentCompressionResistancePriority; NSLayoutPriority _verticalContentCompressionResistancePriority; - BOOL _translatesAutoresizingMaskIntoConstraints; } @property(class, readonly) BOOL requiresConstraintBasedLayout;