Share
Embed
NSTextView とは何なのか / What is NSTextView
macOS native symposium (http://macos-native.github.io) #05 登壇資料
AppKitにおいてテキストを表示するビューとして不動の地位を誇るNSTextViewさん。日常的に使う反面、どこかミステリアスな雰囲気で謎に包まれていますよね。どんな性格なの? 年齢は? 家族構成は? 調べてみました。
1024jp
September 08, 2019
Transcript
57 slides
-
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ࣗݾհ KQ NBD04 ΞϓϦέʔγϣϯઐͷϗϏʔ։ൃऀɻ 044 ϓϩδΣΫτӡӦ͔ΒϓϩάϥϛϯάɺΞΠίϯͷσ βΠϯ·ͰɺNBD04 ͷΞϓϦέʔγϣϯ։ൃʹؔΘΔ͜
ͱͳΒશ෦ΔϚϯͰ͋Δɻ ͤΜʹ͡Ύ͏ΑΜ ͐͡ʔͽʔ 本業ではないよ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ࣗݾհ CotEditor Gapplin BathyScaphe
Qli application work plain-text editor SVG viewer 5ch browser movie player 2014年に 正式引き継ぎ サポーtメンバー (主にデザイン・UI) -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp $PU&EJUPS lightweight plain-text editor
written in Swift + Cocoa github.com/coteditor NSTextView subclass -
macOS native ܹNBD04$BUBMJOB © 2019 1024jp લճͷ ࣍ճ༧ࠂ 欭 䥛孉勦
⬕㔡 㣆↹ /45FYU7JFXͱͦͷϚϧνΧʔιϧ࣮ KQ NBD04OBUJWF4ZNQPTJVN -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ࠓͷτϐοΫ ѻ͏ – NSTextViewͷཱͪҐஔ
– NSTextViewͷ͘͠Έ – TextKitͷมભ ѻΘͳ͍ – ϚϧνΧʔιϧ – ΩʔϘʔυೖྗ – λΠϙάϥϑΟ – Core Text -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU,JU "QQ,JU ͦͯ͠ /45FYU7JFX Core
Graphics TextKit AppKit NSTextView NSTextField NSTextInputContext NSParagraphStyle NSGlyphInfo NSLayoutManager Foundation Core Text UIKit UITextField UITextView UILabel NSSpellChecker UITextInput NSTextAttachment UITextChecker -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYU'JFME ͱ /45FYU7JFX จςΩετ Lorem ipsum
dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor NSTextView NSTextView NSTextField จςΩετ දࣔ ೖྗ ΖΕΉ͍͞m NSTextView ラベルや表のセル、一行の入力欄など 文書や複数行のテキストなど Name: Clarus Clarus Name: field editor -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ςΩετฤूͷػೳΛఏڙ͢ΔͨΊʹɺ ฤू༻ͷϏϡʔ ϑΟʔϧυΤσΟλ ͕
ϏϡʔώΤϥϧΩʔʹࠩ͠ࠐ·ΕΔɻ Πϯυ͕͚ͭͩ ϑΟʔϧυΤσΟλΛ࣋ͭ ෳͷςΩετೖྗཝ͕ ಉ࣌ʹฤूঢ়ଶʹͳΔ͜ͱ͋Γಘͳ͍ ϑΟʔϧυΤσΟλ NSTextFieldを編集するときだけ現れる不思議なビュー NSTextView NSTextField 35 Species: Age: Barks: Clarus Moof! Characteristic: Kawaii dogcow field editor Field Editor = First Responder しんどい -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYU7JFX ͷͭͷׂ ςΩετσʔλͷϏϡʔ ϑΟʔϧυΤσΟλ Moof!
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor heavy-weight ͳ ೖྗΛड͚Δ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU,JU ただし 仕組みは同一ではない NBD04J04UW04ʹ
ଘࡏ ಠཱͨ͠GSBNFXPSLͰͳ͘ "QQ,JU6*,JUͷҰ෦ 5FYU7JFXΛච಄ͱͨ͠ ςΩετೖग़ྗ·ΘΓͷ Ϋϥεͷू߹ମ 範囲があいまい -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp J04UW04 ʹ͓͚Δ 5FYU7JFX NSTextStorage NSLayoutManager NSTextContainer
CoreText UITextView スタイル付き テキストデータ テキストデータを 表示空間に割り付ける テキスト表示空間 ユーザとのやり取り 入力 実際の描画計算 ref. “Getting to Know TextKit” (2013) by Max Seelemann @Ulysses https://www.objc.io/issues/5-ios7/getting-to-know-textkit/ View Model Model Controller Pr UITextInput -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp NBD04 ʹ͓͚Δ 5FYU7JFX NSTextStorage NSLayoutManager NSTextContainer
CoreText NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator スタイル付き テキストデータ テキストデータを 表示空間に割り付ける ユーザとのやり取り 入力 各行にグリフを流し込む グリフを生成 テキスト表示空間 ref. “Getting to Know TextKit” (2013) by Max Seelemann @Ulysses https://www.objc.io/issues/5-ios7/getting-to-know-textkit/ View Model Model Controller Controller Controller Pr NSTextInputClient 実際の描画計算 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp J04UW04 ͱ NBD04 ͷҧ͍ 両方TextKitだが、わりと違うものとして扱った方が良い。 (= iOSのTextKitに関するノウハウはあまり役に立たない)
NSTextStorage NSLayoutManager NSTextContainer CoreText UITextView JOJ04UW04 NSTextStorage NSLayoutManager NSTextContainer CoreText NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator JONBD04 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU,JU ͷྺ࢙ iPhone OS iOS
3.2 Mac OS X 10.4 1998 macOS (Mac OS X) 2020 2007 iOS TextKitという名称が 初めて出てくる Mac OS 8.5 2001 2005 2013 2010 Apple Type Services for Unicode Imaging Mac OS Mac OS X 10.0 NSTextView, etc UITextView TextKit CoreText CoreText ATSUI iOS 7 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU7JFXJONBD04 スタイル付き テキストデータ テキストデータを
表示空間に割り付ける ユーザとのやり取り 入力 テキスト表示空間 NSTextStorage NSLayoutManager NSTextContainer NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator View Model Model Controller Controller Controller Pr NSTextInputClient 各行にグリフを流し込む グリフを生成 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU7JFXJONBD04 NSTextStorage NSLayoutManager NSTextContainer
NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator View Model Model Controller Controller Controller ͜ͷͭͷΫϥε͕ڠۀͯ͠ςΩετͷೖྗ͔Βग़ྗ·Ͱ͕݁͢Δɻ → 必要に応じてこれらをサブクラスして使う delegate delegate delegate ・デリゲートを受ける -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ モデルから出力までの流れを説明 Fig. Text
object configuration for a single flow of text in Cocoa Text Architecture Guide Appleによる -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ “Advanced Cocoa Text
Tips and Tricks” | WWDC2010 Session114 各クラスをModel-View-Controllerで分類して説明 Cocoa Text System The Cocoa Text System helper classes Vi ew Controller Model NSTextView NSLayoutManager NSTextStorage NSTextContainer NSTextAttachment NSGlyphGenerator NSTypesetter Appleによる -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ 入出力からモデルまでの流れをMVCの観点から説明 in Cocoa
Text Arcihtecture Guide Appleによる -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ 描画におけるそれぞれのクラスの役割を説明 Fig. Composition
of text display in Text Layout Programming Guide Appleによる We the People of the United We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America. Section 1. All legislative Powers herein granted shall be vested in a Congress of the United States, which shall consist of a Senate and House of We the People of the United Window Glyph generator provides glyphs for characters. Typesetter places glyphs in line fragment rectangles. Text container models area on page to lay out text. Text view displays text within content view and handles user interactions. Window content view -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ テキストレイアウト時のメソッド呼び出し順序を説明 Fig. The
text layout process in Text Layout Programming Guide Appleによる anNSTypesetter anNSTextContainer anNSTextStorage anNSTextView r epl ac eChar ac t er s I nRange: wi t h s t r i ng: anNSLayoutManager l ayout Gl yphs I nLayout M anager : s t ar t i ngAt Gl yphI ndex: m axNum ber Of Li neFr agm ent s : next Gl yphI ndex: l i neFr agm ent Rec t For Pr opos edRec t : s weepDi r ec t i on: m ovem ent Di r ec t i on: r em ai ni ngRec t : t ext St or age: edi t ed: r ange: c hangeI nLengt h i nval i dat edRange: 2 3 8 9 s et Needs Di s pl ayI nRec t : avoi dAddi t i onal Layout : 4 6 7 5 1 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ༷ʑͳ֓೦ਤ Cocoa Text System
The Cocoa Text System helper classes Vi ew Controller Model NSTextView NSLayoutManager NSTextStorage NSTextContainer NSTextAttachment NSGlyphGenerator NSTypesetter Appleによる We the People of the United We the People of the United States, in Order to form a more perfect Union, establish Justice, insure domestic Tranquility, provide for the common defence, promote the general Welfare, and secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this Constitution for the United States of America. Section 1. All legislative Powers herein granted shall be vested in a Congress of the United States, which shall consist of a Senate and House of We the People of the United Window Glyph generator provides glyphs for characters. Typesetter places glyphs in line fragment rectangles. Text container models area on page to lay out text. Text view displays text within content view and handles user interactions. Window content view anNSTypesetter anNSTextContainer anNSTextStorage anNSTextView r epl ac eChar ac t er s I nRange: wi t h s t r i ng: anNSLayoutManager l ayout Gl yphs I nLayout M anager : s t ar t i ngAt Gl yphI ndex: m axNum ber Of Li neFr agm ent s : next Gl yphI ndex: l i neFr agm ent Rec t For Pr opos edRec t : s weepDi r ec t i on: m ovem ent Di r ec t i on: r em ai ni ngRec t : t ext St or age: edi t ed: r ange: c hangeI nLengt h i nval i dat edRange: 2 3 8 9 s et Needs Di s pl ayI nRec t : avoi dAddi t i onal Layout : 4 6 7 5 1 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ෳͷ -BZPVU.BOBHFS5FYU$POUBJOFS NSTextStorage NSLayoutManager NSTextContainer
NSTextView NSTextStorage NSLayoutManager NSTextContainer NSTextView NSTextContainer NSTextView NSTextStorage NSLayoutManager NSTextContainer NSTextView NSLayoutManager NSTextContainer NSTextView Multiple layout managers allow you to have multiple presentations of the same text. The text within each view can have separate layout and selections. Multiple layout managers allow you to have multiple presentations of the same text. The text within each view can have separate layout and selections. With one text view, all of the text flows within a single, typically recutangular, area. As text is added, it fills the recion defined by the first text containers. The text is displayed in the text view that is paired with the text container. When there’s no ⾭ more room, another text container (and associated text view) is added, and the text flows onto the second page. CBTJD NVMUJDPOUBJOFST NVMUJMBZPVU.BOBHFST -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYU7JFX ͷ֎ଆ NSScrollView NSRulerViews NSClipView
NSTextView NSScrollers Font Panel, etc Interactions – Menu Actions – Keybindings – Find/Replace – Print – … Touch Bar TextView component Inspector Bar -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYU7JFX ͕४ڌ͍ͯ͠Δϓϩτίϧ Responder – NSColorChanging
– NSDraggingSource – NSUserActivityRestoring Touch Bar – NSTouchBarProvider – NSCandidateListTouchBarItemDelegate – NSTextLayoutOrientationProvider – NSTouchBarDelegate UI Validations – NSUserInterfaceValidations – NSMenuItemValidation Spell Check – NSChangeSpelling – NSIgnoreMisspelledWords Text Typing – NSTextInput (slated for deprecation) – NSTextInputClient – NSAccessibilityNavigableStaticText – NSStandardKeyBindingResponding -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYU7JFX ͷܧঝؔ NSText NSView subclass
subclass お前だれだ? NSObject NSResponder subclass subclass UITextView UIScrollView UIView subclass subclass NSObject UIResponder subclass subclass 6*5FYU7JFX /45FYU7JFX NSTextView -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYUͱ –NSTextView以外では使われてない –サブクラスもとくに推奨されてない –これだけだと使えない
AppKit reference (2019/macOS 10.14) Class NSText The most general programmatic interface for objects that manage text. var string: String var isEditable: Bool var isFieldEditor: Bool var baseWritingDirection: NSWritingDirection func replaceCharacters(in: NSRange, with: String) func paste(Any?) func scrollRangeToVisible(NSRange) NSTextͷAPI (ൈਮ) var textStorage var layoutManager var textContainer NSTextViewͷAPI (ൈਮ) NSTextʹͳ͍ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYUͱ Protocol NSTextInputClient A
set of methods that text views must implement to interact properly with the text input management system. Overview To create another text view class, you can either subclass NSTextView (and not NSText, for historical reasons), or subclass NSView and implement the NSTextInputClient protocol AppKit reference (2019/macOS 10.14) → NSTextInputContextとやり取りできない。 NSTextViewが準拠してるヤツ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYUͱ 欭 䥛孉勦 ⬕㔡
㣆↹ (/6TUFQͱ$PDPUSPO KQ NBD04OBUJWF4ZNQPTJVN “GNUstepͱCocotron”, macOS native Symposium #03 https://speakerdeck.com/1024jp/gnustep-and-cocotron -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /45FYUͱ macOS native (/6TUFQͱ$PDPUSPO
© 2019 1024jp "QQMJDBUJPO,JU 0QFO4UFQ NSColorList NSObject NSColor NSCell NSColorPicker NSCursor NSDataLink NSDataLinkManager NSEvent NSFont NSFontManager NSImage NSImageRep NSPasteboard NSPrintInfo NSPrintOperation NSPrinter NSResponder NSScreen NSSelection NSSpellChecker NSSpellServer NSWorkspace NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSCachedImageRep NSCustomImageRep NSWindow NSApplication NSView NSButtonCell NSFormCell NSSliderCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSDataLinkPanel NSFontPanel NSHelpPanel NSMenu NSPageLayout NSPrintPanel NSSavePanel NSOpenPanel NSTextField NSBrowser NSButton NSColorWell NSMatrix NSScroller NSSlider NSPopUpButton NSForm “GNUstepͱCocotron”, macOS native Symposium #03 https://speakerdeck.com/1024jp/gnustep-and-cocotron ger n NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSCachedImageRep NSCustomImageRep NSWindow NSApplication NSView NSButtonCell NSFormCell NSSliderCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSDataLinkPanel NSFontPanel NSHelpPanel NSMenu NSPageLayout NSPrintPanel NSSavePanel NSOpenPanel NSTextField NSBrowser NSButton NSColorWell NSMatrix NSScroller NSSlider NSPopUpButton NSForm 0QFO4UFQ NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSCachedImageRep NSCustomImageRep NSWindow NSApplication NSView NSButtonCell NSFormCell NSSliderCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSDataLinkPanel NSFontPanel NSHelpPanel NSMenu NSTextField NSBrowser NSButton NSColorWell NSMatrix NSScroller NSSlider NSPopUpButton NSForm 0QFO4UFQ ޙظNeXT༻ϑϨʔϜϫʔΫɻ چNeXTSTEPɻ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp NSText Inherits From: NSView
: NSResponder : NSObject Conforms To: NSChangeSpelling, NSIgnoreMisspelledWords NSCoding (NSResponder) NSObject (NSObject) Declared In: AppKit/NSTextView.h Class Description The NSText class declares the programmatic interface to objects that manage text. NSText objects are used by the Application Kit wherever text appears in interface objects: An NSText object draws the title of a window, the commands in a menu, the title of a button, and the items in a browser. Your application inherits these uses of the NSText class when it incorporates any of these objects into its interface. Your application can also create NSText objects for its own purposes. The NSText class is unlike most other classes in the Application Kit in its complexity and range of features. One of its design goals is to provide a comprehensive set of text-handling features so that you’ll rarely need to create a subclass. An NSText object can (among other things): • Control the color of its text and background. • Control the font and layout characteristics of its text. /45FYUͱ OpenStep specification (1994) -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp Class NSText The NSText
class declares the programmatic interface to objects that manage text. Class NSText The most general programmatic interface for objects that manage text. /45FYUͱ AppKit reference (2019) OpenStep specification (1994) -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp NSText Inherits From: NSView
: NSResponder : NSObject Conforms To: NSChangeSpelling, NSIgnoreMisspelledWords NSCoding (NSResponder) NSObject (NSObject) Declared In: AppKit/NSTextView.h Class Description The NSText class declares the programmatic interface to objects that manage text. NSText objects are used by the Application Kit wherever text appears in interface objects: An NSText object draws the title of a window, the commands in a menu, the title of a button, and the items in a browser. Your application inherits these uses of the NSText class when it incorporates any of these objects into its interface. Your application can also create NSText objects for its own purposes. The NSText class is unlike most other classes in the Application Kit in its complexity and range of features. One of its design goals is to provide a comprehensive set of text-handling features so that you’ll rarely need to create a subclass. An NSText object can (among other things): • Control the color of its text and background. • Control the font and layout characteristics of its text. OpenStep specification (1994) /45FYUͱ !? –NSTextサブクラスであるNSCStringTextのAPIはNSTextViewとあまり似ていない。 –OpenStepの仕様書にNSTextViewは存在しないが… -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /F9545&1 ͷόʔδϣϯวྺ 1989 1997 1993
1991 1995 1992 1990 1994 1996 NeXTSTEP OPENSTEP 1998 1.0 2.0 3.0 ༷ॻ 4.0 Sun Microsystemsと NeXTが提携 NeXT買収 Rhapsody開発版リリース NSText.h /* NSText.h Application Kit Copyright (c) 1994-2018, Apple Inc. All rights reserved. */ (AppKit) 3.3 4.2 -
macOS native (/6TUFQͱ$PDPUSPO © 2019 1024jp "QQMJDBUJPO,JU 0QFO4UFQESBGU NSCell NSWorkspace
NSActionCell NSBrowserCell NSBitmapImageRep NSEPSImageRep NSWindow NSApplication NSView NSButtonCell NSTextFieldCell NSMenuCell NSPanel NSText NSCStringText NSBox NSColorPanel NSMenu NSPageLayout NSPrintPanel NSSavePanel NSOpenPanel NSTextField NSBrowser NSMatrix NSPopUpButton NSForm NSFormCell NSSliderCell NSCachedImageRep NSCustomImageRep NSClipView NSControl NSScrollView NSSplitView NSColorList NSColor NSColorPicker NSCursor NSDataLink NSDataLinkManager NSEvent NSFont NSFontManager NSImage NSImageRep NSPasteboard NSPrintInfo NSPrintOperation NSPrinter NSResponder NSScreen NSSelection NSSpellChecker NSSpellServer NSButton NSColorWell NSScroller NSSlider NSDataLinkPanel NSFontPanel NSHelpPanel #03 再掲 NSObject -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp "QQMJDBUJPO,JU 0QFO4UFQ NSCell NSSpellServer
NSActionCell NSBitmapImageRep NSEPSImageRep NSWindow NSApplication NSView NSButtonCell NSTextFieldCell NSPanel NSText NSCStringText NSSplitView NSScrollView NSControl NSBox NSClipView NSColorPanel NSPageLayout NSSavePanel NSOpenPanel NSTextField NSBrowser NSColorWell NSMatrix NSPopUpButton NSForm NSFormCell NSSliderCell NSCachedImageRep NSCustomImageRep NSColorList NSColor NSColorPicker NSCursor NSDataLink NSDataLinkManager NSEvent NSObject NSPrintOperation NSPrinter NSResponder NSSelection NSScroller NSSlider NSPrintPanel NSDataLinkPanel NSFontPanel NSTextView NSTextAttachmentCell NSComboBoxCell NSTableHeaderCell NSRulerView NSTableHeaderView NSComboBox NSSecureTextField NSTableView NSDPSContext NSDPSServerContext NSFileWRapper NSInputManager NSInputServer NSMenu NSMenuItem NSParagraphStyle NSRulerMarker NSTextStorage NSSecureTextFieldCell NSButton NSImageView NSBrowserCell NSImageCell NSFont NSFontManager NSImage NSImageRep NSPasteboard NSSpellChecker NSScreen NSPrintInfo NSMutableAttributedString NSTableColumn NSTextContainer NSTextTab NSTextAttachment NSWorkspace OpenStep 4.0ͰՃ/มߋ OpenStep draftʹଘࡏ NSWindowサブクラスから NSObject下に移動 NSLayoutManager -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 01&/45&1 Ҏલ r /4QSFpY͕Ճ r
/45FYU7JFXొ r 0CKFDUJWF$ r ΦϒδΣΫτࢦ 新 NeXTSTEP 1.0-3.3 OPENSTEP 4.x macOS 10.0 – -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp "QQMJDBUJPO,JU /F9545&1 Cell ActionCell
SelectionCell Window Application View ButtonCell TextFieldCell MenuCell Panel Text Box FontPanel Menu PageLayout PrintPanel SavePanel OpenPanel TextField Matrix PopUpList Form FormCell SliderCell Control ScrollView Bitmap Font FontManager Listener Pasteboard PrintInfo Responder Speaker Button Scroller Slider ChoosePrinter Object Cursor OpenStep draftʹଘࡏ͠ͳ͍ OpenStep draftʹଘࡏ ClipView -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp "QQMJDBUJPO,JU /F9545&1 Cell ActionCell
SelectionCell Window Application View ButtonCell TextFieldCell MenuCell Panel Text Box FontPanel Menu PageLayout PrintPanel SavePanel OpenPanel TextField Matrix PopUpList Form FormCell SliderCell Control ScrollView Font FontManager Listener Pasteboard PrintInfo Responder Speaker Button Scroller Slider Object NeXTSTEP 2.0–3.3ͰՃ NXColorPicker NXColorList NXCursor NXImage NXImageRep NXDataLink NXDataLinkManager NXSelection NXJournaler NXSpellChecker NXSpellServer NXBrowserCell NXBitmapImageRep NXCachedImageRep NXEPSImageRep NXCustomImageRep NXSplitView ClipView NXColorWell NXBrowser NXHelpPanel NXDataLinkPanel NXColorPanel -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU Ϋϥε -setText:(const char*)string -(BOOL)isEditable
-(float)backgroundGray -(id)delegate -replaceSel:(const char*)string -setSel:(int)start :(int)end -paste:(id)sender -sizeToFit -scrollSelToVisible -setString:(NSString*)string -(BOOL)isEditable -(NSColor*)backgroundColor -(id<NSTextDelegate>)delegate -replaceCharactersInRange:(NSRange)range withString:(NSString*)str -setSelectedRange:(NSRange)range -paste:(id)sender -sizeToFit -scrollRangeToVisible:(NSRange)range ref. “Text class” (1989) http://lisp.hopto.org/Documentation/NEXTSTEP-1.0/NeXT/SysRefMan/22_ClassSpecs/AppKit/Text.htmld/ NSText class Text class NeXTSTEP 1.0 – 3.3 OPENSTEP 4.0 – macOS 10.14 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU Ϋϥε NeXTSTEP 1.0 –
3.3 OPENSTEP 4.0 – macOS 10.14 ref. “Window class” (1989) http://lisp.hopto.org/Documentation/NEXTSTEP-1.0/NeXT/SysRefMan/22_ClassSpecs/AppKit/Window.htmld/ -(Text*)getFieldEditor:(BOOL)create for:(id)anObject -(NSText*)fieldEditor:(BOOL)createFlag forObject:(id)object -textDidChange:(Text*)textObject -textDidEnd:(Text*)textObject endChar:(unsigned short)whyEnd -textDidChange:(NSNotification*)note -textDidEndEditing:(NSNotification*)note a movement character (Tab, Shift-Tab, or Return) (userInfo: NSTextMovementUserInfoKey) NSTextDelegate protocol Text delegate NSWindow class Window class -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 01&/45&1 Ҏલ r /4QSFpY͕Ճ r
/45FYU7JFXొ r 0CKFDUJWF$ r ΦϒδΣΫτࢦ 新 NeXTSTEP 1.0-3.3 OPENSTEP 4.x macOS 10.0 – r 5FYUΫϥεطʹଘࡏ r 4DSPMM7JFXʹೖΕͯ5FYUΛར༻͢Δ r ϑΟʔϧυΤσΟλ (NS)Textこそが“Text”のクラス r /9QSFpY͕Ճ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp /F95 ͔Β $PDPB ref. “The OPENSTEP
Text System” (1997) http://lisp.hopto.org/Documentation/OPENSTEP/NextDev/ TasksAndConcepts/ProgrammingTopics/TextOverview.htmld/ ref. “Cocoa Text Architecture Guide” (2012) https://developer.apple.com/library/archive/documentation/ TextFonts/Conceptual/CocoaTextArchitecture/ TextSystemArchitecture/ArchitectureOverview.html $PDPB5FYU4ZTUFN 01&/45&15FYU4ZTUFN 現在のTextKitの仕組みはNeXTの時点で完成されていた ͍͍ʂ Ϋ˓ϨΨγʔ ͡ΌͶ͔͐ʜ ރΕͯΔ͎ʂ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU,JU ͷྺ࢙ iPhone OS iOS
3.2 Mac OS X 10.4 iOS 7 1998 macOS (Mac OS X) 2020 2007 iOS TextKitという名称が 初めて出てくる Mac OS 8.5 2001 2005 2013 2010 Apple Type Services for Unicode Imaging Mac OS Mac OS X 10.0 NSTextView, etc UITextView TextKit CoreText CoreText ATSUI ࠶ܝ -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU,JU ͷྺ࢙ iPhone OS iOS
3.2 Mac OS X 10.4 iOS 7 1998 macOS (Mac OS X) 2007 iOS TextKitという名称が 初めて出てくる Mac OS 8.5 2001 2005 2013 2010 Apple Type Services for Unicode Imaging Mac OS Mac OS X 10.0 NSTextView, etc UITextView TextKit CoreText CoreText ATSUI NeXTSTEP OPENSTEP 4.0 NSTextView, etc 1996 NeXTSTEP 1.0 Text 1989 શ൛ 2020 NSTextの前身 かつfield editorの祖 -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp 5FYU,JU ·ͱΊ – CocoaͷςΩετγεςϜNeXTSTEP༝དྷͰ͋Γ1989·ͰḪΕΔ –
TextKitCocoaʹ͓͍ͯςΩετͷϞσϧ͔ΒϏϡʔ·Ͱఏڙ͢Δ ϓϥοτϑΥʔϜϨϕϧͷγεςϜͰ͋Δ – iOS/tvOSͷTextKitͱmacOSͷTextKit͍ͩͿҧ͏ – NSTextViewओʹҎԼͷ6ͭͷΫϥε͔ΒΓཱͭɿ NSTextStorage NSLayoutManager NSTextContainer CoreText NSTextView NSTextInputContext NSTypesetter NSGlyphGenerator -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ࢀߟจݙ API Reference –
TextKit | Apple Developer Documentation (2019) https://developer.apple.com/documentation/appkit/textkit Documentation – Cocoa Text Architecture Guide (2014) https://developer.apple.com/library/archive/documentation/TextFonts/Conceptual/ CocoaTextArchitecture/ – Text Layout Programming Guilde (2003, 2014) https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextLayout/ – Text System User Interface Layer Programming Guide (1997, 2012) https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/TextUILayer/ – Text System Storage Layer Overview (1997, 2012) https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ TextStorageLayer/ Source Code – TextEdit | Apple Developer Documentation (2013) https://developer.apple.com/library/archive/samplecode/TextEdit/ archived archived Apple -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ࢀߟจݙ Video – Session
114: Advanced Cocoa Text Tips and Tricks | WWDC 2010 (2010) https://developer.apple.com/devcenter/download.action?path=/videos/wwdc_2010__hd/ session_114__advanced_cocoa_text_tips_and_tricks.mov – Session 221: TextKit Best Practices | WWDC 2018 (2018) https://developer.apple.com/videos/play/wwdc2018/221/ Apple -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ࢀߟจݙ API Reference –
OpenStep Specification (1994) http://www.gnustep.org/resources/OpenStepSpec.pdf.gz – AppKit Class in NeXTSTEP 1.0 (1989) http://lisp.hopto.org/Documentation/NEXTSTEP-1.0/NeXT/SysRefMan/22_ClassSpecs/AppKit/ – AppKit Classes in OPENSTEP (1996) http://lisp.hopto.org/Documentation/OPENSTEP/NextDev/Reference/AppKit/Classes/ Article – The OPENSTEP Text System (1997) http://lisp.hopto.org/Documentation/OPENSTEP/NextDev/TasksAndConcepts/ ProgrammingTopics/TextOverview.htmld/ Book – NeXtstep Programming: Step One: Object-Oriented Applications (1993) by Simson L. Garfinkel, Michael K. Mahoney Article – Porting NEXTSTEP3.2/3.3 Applications to OpenStep on Solaris (1997) http://www.nextcomputers.org/NeXTfiles/Docs/Software/OPENSTEP/802-2115.pdf NeXT SunSoft -
macOS native /45FYU7JFX ͱԿͳͷ͔ © 2019 1024jp ࢀߟจݙ Source Code –
gnustep/libs-gui (2019) https://github.com/gnustep/libs-gui Article – Getting to Know TextKit (2013) https://www.objc.io/issues/5-ios7/getting-to-know-textkit/ Article – NeXTSTEP (2019) https://en.wikipedia.org/wiki/NeXTSTEP GNUstep objc.io wikipedia