diff --git a/Examples/LineNumberView/English.lproj/MainMenu.xib b/Examples/LineNumberView/English.lproj/MainMenu.xib index 764afd6..7de7b84 100644 --- a/Examples/LineNumberView/English.lproj/MainMenu.xib +++ b/Examples/LineNumberView/English.lproj/MainMenu.xib @@ -1,32 +1,33 @@ - 1050 - 10B504 - 732 - 1038.2 - 437.00 + 1060 + 11D50b + 2182 + 1138.32 + 568.00 com.apple.InterfaceBuilder.CocoaPlugin - 732 + 2182 - + YES - - + NSView + NSMenu + NSScrollView + NSWindowTemplate + NSMenuItem + NSTextView + NSScroller + NSCustomObject YES com.apple.InterfaceBuilder.CocoaPlugin - YES - - YES - - - YES - + PluginDependencyRecalculationVersion + YES @@ -734,12 +735,12 @@ 15 2 - {{159, 528}, {470, 498}} + {{227, 288}, {428, 456}} 1946157056 Window NSWindow - {1.79769e+308, 1.79769e+308} + 256 @@ -768,7 +769,6 @@ Apple PNG pasteboard type Apple URL pasteboard type CorePasteboardFlavorType 0x6D6F6F76 - CorePasteboardFlavorType 0x75726C20 NSColor pasteboard type NSFilenamesPboardType NSStringPboardType @@ -784,6 +784,8 @@ {428, 14} + + @@ -804,7 +806,7 @@ 1 - 10499 + 67119363 0 @@ -818,7 +820,7 @@ NSBackgroundColor NSColor - + YES 6 @@ -848,7 +850,7 @@ NSColor NSUnderline - + YES 1 @@ -858,21 +860,43 @@ + + 1 6 - {858, 1e+07} + {858, 10000000} {223, 0} {{1, 1}, {428, 456}} + - {4, -5} - 1 + {4, 5} + + 79691776 + + YES + + YES + + + + + file://localhost/Applications/Xcode.app/Contents/SharedFrameworks/DVTKit.framework/Resources/DVTIbeamCursor.tiff + + + + + + 3 + MCAwAA + + 4 @@ -881,6 +905,8 @@ -2147483392 {{282, 1}, {15, 188}} + + _doScroller: 0.98876399999999998 @@ -890,6 +916,8 @@ -2147483392 {{-100, -100}, {87, 18}} + + 1 _doScroller: @@ -897,20 +925,24 @@ 0.94565220000000005 - {{20, 20}, {430, 458}} + {{-1, -1}, {430, 458}} - - 530 + + + 133650 - {470, 498} + {428, 456} + + - {{0, 0}, {1920, 1178}} - {1.79769e+308, 1.79769e+308} + {{0, 0}, {1440, 878}} + {10000000000000, 10000000000000} + YES Controller @@ -919,6 +951,14 @@ YES + + + orderFrontStandardAboutPanel: + + + + 142 + performMiniaturize: @@ -959,14 +999,6 @@ 127 - - - orderFrontStandardAboutPanel: - - - - 142 - performClose: @@ -1253,7 +1285,9 @@ YES 0 - + + YES + @@ -1871,379 +1905,197 @@ YES YES + -1.IBPluginDependency + -2.IBPluginDependency -3.IBPluginDependency 103.IBPluginDependency - 103.ImportedFromIB2 106.IBPluginDependency - 106.ImportedFromIB2 - 106.editorWindowContentRectSynchronizationRect 111.IBPluginDependency - 111.ImportedFromIB2 112.IBPluginDependency - 112.ImportedFromIB2 124.IBPluginDependency - 124.ImportedFromIB2 125.IBPluginDependency - 125.ImportedFromIB2 - 125.editorWindowContentRectSynchronizationRect 126.IBPluginDependency - 126.ImportedFromIB2 129.IBPluginDependency - 129.ImportedFromIB2 130.IBPluginDependency - 130.ImportedFromIB2 - 130.editorWindowContentRectSynchronizationRect 131.IBPluginDependency - 131.ImportedFromIB2 134.IBPluginDependency - 134.ImportedFromIB2 136.IBPluginDependency - 136.ImportedFromIB2 143.IBPluginDependency - 143.ImportedFromIB2 144.IBPluginDependency - 144.ImportedFromIB2 145.IBPluginDependency - 145.ImportedFromIB2 149.IBPluginDependency - 149.ImportedFromIB2 150.IBPluginDependency - 150.ImportedFromIB2 19.IBPluginDependency - 19.ImportedFromIB2 195.IBPluginDependency - 195.ImportedFromIB2 196.IBPluginDependency - 196.ImportedFromIB2 197.IBPluginDependency - 197.ImportedFromIB2 198.IBPluginDependency - 198.ImportedFromIB2 199.IBPluginDependency - 199.ImportedFromIB2 200.IBPluginDependency - 200.ImportedFromIB2 - 200.editorWindowContentRectSynchronizationRect 201.IBPluginDependency - 201.ImportedFromIB2 202.IBPluginDependency - 202.ImportedFromIB2 203.IBPluginDependency - 203.ImportedFromIB2 204.IBPluginDependency - 204.ImportedFromIB2 - 205.IBEditorWindowLastContentRect 205.IBPluginDependency - 205.ImportedFromIB2 - 205.editorWindowContentRectSynchronizationRect 206.IBPluginDependency - 206.ImportedFromIB2 207.IBPluginDependency - 207.ImportedFromIB2 208.IBPluginDependency - 208.ImportedFromIB2 209.IBPluginDependency - 209.ImportedFromIB2 210.IBPluginDependency - 210.ImportedFromIB2 211.IBPluginDependency - 211.ImportedFromIB2 212.IBPluginDependency - 212.ImportedFromIB2 - 212.editorWindowContentRectSynchronizationRect 213.IBPluginDependency - 213.ImportedFromIB2 214.IBPluginDependency - 214.ImportedFromIB2 215.IBPluginDependency - 215.ImportedFromIB2 216.IBPluginDependency - 216.ImportedFromIB2 217.IBPluginDependency - 217.ImportedFromIB2 218.IBPluginDependency - 218.ImportedFromIB2 219.IBPluginDependency - 219.ImportedFromIB2 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect 221.IBPluginDependency - 221.ImportedFromIB2 23.IBPluginDependency - 23.ImportedFromIB2 236.IBPluginDependency - 236.ImportedFromIB2 239.IBPluginDependency - 239.ImportedFromIB2 24.IBPluginDependency - 24.ImportedFromIB2 - 24.editorWindowContentRectSynchronizationRect - 29.IBEditorWindowLastContentRect 29.IBPluginDependency - 29.ImportedFromIB2 - 29.WindowOrigin - 29.editorWindowContentRectSynchronizationRect 295.IBPluginDependency - 296.IBEditorWindowLastContentRect 296.IBPluginDependency - 296.editorWindowContentRectSynchronizationRect 297.IBPluginDependency 298.IBPluginDependency 346.IBPluginDependency - 346.ImportedFromIB2 348.IBPluginDependency - 348.ImportedFromIB2 349.IBPluginDependency - 349.ImportedFromIB2 - 349.editorWindowContentRectSynchronizationRect 350.IBPluginDependency - 350.ImportedFromIB2 351.IBPluginDependency - 351.ImportedFromIB2 354.IBPluginDependency - 354.ImportedFromIB2 - 371.IBEditorWindowLastContentRect 371.IBPluginDependency 371.IBWindowTemplateEditedContentRect 371.NSWindowTemplate.visibleAtLaunch - 371.editorWindowContentRectSynchronizationRect 372.IBPluginDependency 375.IBPluginDependency 376.IBPluginDependency 377.IBPluginDependency 378.IBPluginDependency + 379.IBPluginDependency 5.IBPluginDependency - 5.ImportedFromIB2 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect 58.IBPluginDependency - 58.ImportedFromIB2 72.IBPluginDependency - 72.ImportedFromIB2 73.IBPluginDependency - 73.ImportedFromIB2 74.IBPluginDependency - 74.ImportedFromIB2 75.IBPluginDependency - 75.ImportedFromIB2 77.IBPluginDependency - 77.ImportedFromIB2 78.IBPluginDependency - 78.ImportedFromIB2 79.IBPluginDependency - 79.ImportedFromIB2 80.IBPluginDependency - 80.ImportedFromIB2 81.IBPluginDependency - 81.ImportedFromIB2 - 81.editorWindowContentRectSynchronizationRect 82.IBPluginDependency - 82.ImportedFromIB2 83.IBPluginDependency - 83.ImportedFromIB2 92.IBPluginDependency - 92.ImportedFromIB2 - + YES com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{596, 852}, {216, 23}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{522, 812}, {146, 23}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{436, 809}, {64, 6}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{178, 871}, {243, 243}} com.apple.InterfaceBuilder.CocoaPlugin - - {{187, 434}, {243, 243}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {167, 43}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{0, 1114}, {404, 20}} com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 704}, {478, 20}} com.apple.InterfaceBuilder.CocoaPlugin - {{261, 1071}, {234, 43}} com.apple.InterfaceBuilder.CocoaPlugin - {{475, 832}, {234, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{73, 556}, {470, 498}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{73, 556}, {470, 498}} - {{33, 204}, {338, 255}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{12, 931}, {236, 183}} com.apple.InterfaceBuilder.CocoaPlugin - - {{23, 794}, {245, 183}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{145, 474}, {199, 203}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin YES - - YES - + YES - - YES - + 409 @@ -2251,27 +2103,6 @@ YES - - Controller - NSObject - - YES - - YES - scriptView - scrollView - - - YES - NSTextView - NSScrollView - - - - IBProjectSource - Examples/LineNumberView/Controller.h - - Controller NSObject @@ -2281,201 +2112,127 @@ YES doModal: doSheet: + toggleWindow: - + YES id id + id - + YES YES - alert - field - window + doModal: + doSheet: + toggleWindow: - + YES - id - id - id + + doModal: + id + + + doSheet: + id + + + toggleWindow: + id + - - IBProjectSource - Examples/ModalResponder/Controller.h - - - - Controller - NSObject YES YES _iPhoneTableView _stickyRowTableView + _tableView + _window + alert + field + scriptView + scrollView + window - + YES NSTableView NSTableView - - - - IBProjectSource - Examples/StickyRowTableView Revue/Controller.h - - - - Controller - NSObject - - toggleWindow: - id - - - _window - id - - - IBProjectSource - Examples/Window Effects/Controller.h - - - - NSObject - - IBProjectSource - NSObject-NoodlePerformWhenIdle.h - - - - NSObject - - IBProjectSource - NoodleStickyRowTableView.h - - - - NSResponder - - YES - - YES - cancelModal: - confirmModal: - - - YES + NoodleTableView id id + id + NSTextView + NSScrollView + id - - IBProjectSource - NSResponder-NoodleModalExtensions.h - - - - NSTableView - - scrollToStickyRow: - id - - - - - NSWindow - + YES YES - cancelModal: - confirmModal: + _iPhoneTableView + _stickyRowTableView + _tableView + _window + alert + field + scriptView + scrollView + window - + YES - id - id + + _iPhoneTableView + NSTableView + + + _stickyRowTableView + NSTableView + + + _tableView + NoodleTableView + + + _window + id + + + alert + id + + + field + id + + + scriptView + NSTextView + + + scrollView + NSScrollView + + + window + id + - - - - NSWindow IBProjectSource - NSWindow-NoodleEffects.h - - - - - YES - - NSApplication - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSApplication.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSApplicationScripting.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSColorPanel.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSHelpManager.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSPageLayout.h - - - - NSApplication - - IBFrameworkSource - AppKit.framework/Headers/NSUserInterfaceItemSearching.h - - - - NSBrowser - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSBrowser.h - - - - NSControl - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSControl.h + ./Classes/Controller.h NSDocument - NSObject YES @@ -2487,7 +2244,7 @@ saveDocumentAs: saveDocumentTo: - + YES id id @@ -2497,437 +2254,102 @@ id - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h - - - - NSDocument - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h - - - - NSDocumentController - NSObject - + YES YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: - + YES - id - id - id - id + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFormatter - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFormatter.h - - - - NSMatrix - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSMatrix.h - - - - NSMenu - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenu.h - - - - NSMenuItem - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSMenuItem.h - - - - NSMovieView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSMovieView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSAccessibility.h - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDictionaryController.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSDragging.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontPanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSKeyValueBinding.h - - - - NSObject - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSNibLoading.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSOutlineView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSPasteboard.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSSavePanel.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSTableView.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSToolbarItem.h - - - - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSView.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSError.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSFileManager.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyValueObserving.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSKeyedArchiver.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObject.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSObjectScripting.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSPortCoder.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSRunLoop.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptClassDescription.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptKeyValueCoding.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptObjectSpecifiers.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSScriptWhoseTests.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSThread.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURL.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLConnection.h - - - - NSObject - - IBFrameworkSource - Foundation.framework/Headers/NSURLDownload.h - - - - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSInterfaceStyle.h - - - - NSResponder - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSResponder.h - - - - NSScrollView - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSScrollView.h - - - - NSScroller - NSControl - - IBFrameworkSource - AppKit.framework/Headers/NSScroller.h + IBProjectSource + ./Classes/NSDocument.h NSTableView - NSControl - - - - NSText - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSText.h - - - - NSTextView - NSText - - IBFrameworkSource - AppKit.framework/Headers/NSTextView.h - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSClipView.h - - - - NSView - - - - NSView - - IBFrameworkSource - AppKit.framework/Headers/NSRulerView.h + + scrollToStickyRow: + id - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h + + scrollToStickyRow: + + scrollToStickyRow: + id + - - - NSWindow - NSResponder - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h + IBProjectSource + ./Classes/NSTableView.h - NSWindow + NoodleTableView + NSTableView - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h + IBProjectSource + ./Classes/NoodleTableView.h 0 + IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.macosx - + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 YES - ../../../NoodleKit.xcodeproj 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {11, 11} + {10, 3} + + diff --git a/NSTableView-NoodleExtensions.m b/NSTableView-NoodleExtensions.m index 4e354a8..108eb5c 100644 --- a/NSTableView-NoodleExtensions.m +++ b/NSTableView-NoodleExtensions.m @@ -37,7 +37,7 @@ void NoodleClearRect(NSRect rect) NSRectFill(rect); } -@interface NSTableView () +@interface NSTableView (NoodlePrivate) #pragma mark Sticky Row Header methods diff --git a/NoodleKit.xcodeproj/project.pbxproj b/NoodleKit.xcodeproj/project.pbxproj index 82210b1..7f2bf1e 100644 --- a/NoodleKit.xcodeproj/project.pbxproj +++ b/NoodleKit.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 45; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -780,8 +780,11 @@ /* Begin PBXProject section */ 0867D690FE84028FC02AAC07 /* Project object */ = { isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "NoodleKit" */; - compatibilityVersion = "Xcode 3.1"; + compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 1; knownRegions = ( @@ -1087,7 +1090,6 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1127,7 +1129,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; ONLY_ACTIVE_ARCH = YES; "OTHER_CFLAGS[arch=i386]" = ( "$(inherited)", @@ -1137,7 +1139,6 @@ "$(inherited)", "-fsingle-precision-constant", ); - PREBINDING = NO; SDKROOT = macosx10.6; }; name = Debug; @@ -1152,7 +1153,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.5; + MACOSX_DEPLOYMENT_TARGET = 10.6; "OTHER_CFLAGS[arch=i386]" = ( "$(inherited)", "-fsingle-precision-constant", @@ -1161,7 +1162,6 @@ "$(inherited)", "-fsingle-precision-constant", ); - PREBINDING = NO; SDKROOT = macosx10.6; }; name = Release; @@ -1172,7 +1172,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1185,7 +1184,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = "Window Effects"; }; name = Debug; @@ -1196,7 +1194,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; @@ -1208,7 +1205,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = "Window Effects"; ZERO_LINK = NO; }; @@ -1220,7 +1216,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1233,7 +1228,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = iToonz; }; name = Debug; @@ -1244,7 +1238,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; @@ -1256,7 +1249,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = iToonz; ZERO_LINK = NO; }; @@ -1268,7 +1260,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1281,7 +1272,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = ModalResponderTest; }; name = Debug; @@ -1292,7 +1282,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; @@ -1304,7 +1293,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = ModalResponderTest; ZERO_LINK = NO; }; @@ -1316,7 +1304,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1329,7 +1316,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = "StickyRowTableView Revue"; }; name = Debug; @@ -1340,7 +1326,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; @@ -1352,7 +1337,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = "StickyRowTableView Revue"; ZERO_LINK = NO; }; @@ -1364,7 +1348,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1377,7 +1360,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = LineNumberView; }; name = Debug; @@ -1388,7 +1370,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; @@ -1400,7 +1381,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = LineNumberView; ZERO_LINK = NO; }; @@ -1412,7 +1392,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1425,7 +1404,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = TimerLab; }; name = Debug; @@ -1436,7 +1414,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; @@ -1448,7 +1425,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = TimerLab; ZERO_LINK = NO; }; @@ -1460,7 +1436,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_MODEL_TUNING = G5; GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; @@ -1473,7 +1448,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = ImageLab; }; name = Debug; @@ -1484,7 +1458,6 @@ ALWAYS_SEARCH_USER_PATHS = NO; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_ENABLE_FIX_AND_CONTINUE = NO; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; @@ -1496,7 +1469,6 @@ "-framework", AppKit, ); - PREBINDING = NO; PRODUCT_NAME = ImageLab; ZERO_LINK = NO; }; diff --git a/NoodleLineNumberView.h b/NoodleLineNumberView.h index ac64f14..5a34d76 100644 --- a/NoodleLineNumberView.h +++ b/NoodleLineNumberView.h @@ -3,7 +3,7 @@ // NoodleKit // // Created by Paul Kim on 9/28/08. -// Copyright (c) 2008 Noodlesoft, LLC. All rights reserved. +// Copyright (c) 2008-2012 Noodlesoft, LLC. All rights reserved. // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -41,27 +41,25 @@ { // Array of character indices for the beginning of each line NSMutableArray *_lineIndices; + // When text is edited, this is the start of the editing region. All line calculations after this point are invalid + // and need to be recalculated. + NSUInteger _invalidCharacterIndex; + // Maps line numbers to markers NSMutableDictionary *_linesToMarkers; + NSFont *_font; NSColor *_textColor; NSColor *_alternateTextColor; NSColor *_backgroundColor; } -- (id)initWithScrollView:(NSScrollView *)aScrollView; - -- (void)setFont:(NSFont *)aFont; -- (NSFont *)font; - -- (void)setTextColor:(NSColor *)color; -- (NSColor *)textColor; +@property (readwrite, retain) NSFont *font; +@property (readwrite, retain) NSColor *textColor; +@property (readwrite, retain) NSColor *alternateTextColor; +@property (readwrite, retain) NSColor *backgroundColor; -- (void)setAlternateTextColor:(NSColor *)color; -- (NSColor *)alternateTextColor; - -- (void)setBackgroundColor:(NSColor *)color; -- (NSColor *)backgroundColor; +- (id)initWithScrollView:(NSScrollView *)aScrollView; - (NSUInteger)lineNumberForLocation:(CGFloat)location; - (NoodleLineNumberMarker *)markerAtLine:(NSUInteger)line; diff --git a/NoodleLineNumberView.m b/NoodleLineNumberView.m index 935056c..4494ddd 100644 --- a/NoodleLineNumberView.m +++ b/NoodleLineNumberView.m @@ -36,8 +36,11 @@ @interface NoodleLineNumberView (Private) +- (NSFont *)defaultFont; +- (NSColor *)defaultTextColor; +- (NSColor *)defaultAlternateTextColor; - (NSMutableArray *)lineIndices; -- (void)invalidateLineIndices; +- (void)invalidateLineIndicesFromCharacterIndex:(NSUInteger)charIndex; - (void)calculateLines; - (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)text; - (NSDictionary *)textAttributes; @@ -47,10 +50,16 @@ - (NSDictionary *)markerTextAttributes; @implementation NoodleLineNumberView +@synthesize font = _font; +@synthesize textColor = _textColor; +@synthesize alternateTextColor = _alternateTextColor; +@synthesize backgroundColor = _backgroundColor; + - (id)initWithScrollView:(NSScrollView *)aScrollView { if ((self = [super initWithScrollView:aScrollView orientation:NSVerticalRuler]) != nil) { + _lineIndices = [[NSMutableArray alloc] init]; _linesToMarkers = [[NSMutableDictionary alloc] init]; [self setClientView:[aScrollView documentView]]; @@ -60,6 +69,7 @@ - (id)initWithScrollView:(NSScrollView *)aScrollView - (void)awakeFromNib { + _lineIndices = [[NSMutableArray alloc] init]; _linesToMarkers = [[NSMutableDictionary alloc] init]; [self setClientView:[[self scrollView] documentView]]; } @@ -71,76 +81,26 @@ - (void)dealloc [_lineIndices release]; [_linesToMarkers release]; [_font release]; + [_textColor release]; + [_alternateTextColor release]; + [_backgroundColor release]; [super dealloc]; } -- (void)setFont:(NSFont *)aFont -{ - if (_font != aFont) - { - [_font autorelease]; - _font = [aFont retain]; - } -} - -- (NSFont *)font -{ - if (_font == nil) - { - return [NSFont labelFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]; - } - return _font; -} - -- (void)setTextColor:(NSColor *)color +- (NSFont *)defaultFont { - if (_textColor != color) - { - [_textColor autorelease]; - _textColor = [color retain]; - } + return [NSFont labelFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]; } -- (NSColor *)textColor +- (NSColor *)defaultTextColor { - if (_textColor == nil) - { - return [NSColor colorWithCalibratedWhite:0.42 alpha:1.0]; - } - return _textColor; + return [NSColor colorWithCalibratedWhite:0.42 alpha:1.0]; } -- (void)setAlternateTextColor:(NSColor *)color +- (NSColor *)defaultAlternateTextColor { - if (_alternateTextColor != color) - { - [_alternateTextColor autorelease]; - _alternateTextColor = [color retain]; - } -} - -- (NSColor *)alternateTextColor -{ - if (_alternateTextColor == nil) - { - return [NSColor whiteColor]; - } - return _alternateTextColor; -} - -- (void)setBackgroundColor:(NSColor *)color -{ - if (_backgroundColor != color) - { - [_backgroundColor autorelease]; - _backgroundColor = [color retain]; - } -} - -- (NSColor *)backgroundColor -{ - return _backgroundColor; + return [NSColor whiteColor]; } - (void)setClientView:(NSView *)aView @@ -156,87 +116,43 @@ - (void)setClientView:(NSView *)aView [super setClientView:aView]; if ((aView != nil) && [aView isKindOfClass:[NSTextView class]]) { - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textDidChange:) name:NSTextStorageDidProcessEditingNotification object:[(NSTextView *)aView textStorage]]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textStorageDidProcessEditing:) name:NSTextStorageDidProcessEditingNotification object:[(NSTextView *)aView textStorage]]; - [self invalidateLineIndices]; + [self invalidateLineIndicesFromCharacterIndex:0]; } } - (NSMutableArray *)lineIndices { - if (_lineIndices == nil) + if (_invalidCharacterIndex < NSUIntegerMax) { [self calculateLines]; } return _lineIndices; } -- (void)invalidateLineIndices +// Forces recalculation of line indicies starting from the given index +- (void)invalidateLineIndicesFromCharacterIndex:(NSUInteger)charIndex { - [_lineIndices release]; - _lineIndices = nil; + _invalidCharacterIndex = MIN(charIndex, _invalidCharacterIndex); } -- (void)textDidChange:(NSNotification *)notification +- (void)textStorageDidProcessEditing:(NSNotification *)notification { - // Invalidate the line indices. They will be recalculated and recached on demand. - [self invalidateLineIndices]; - - [self setNeedsDisplay:YES]; -} - -- (NSUInteger)lineNumberForLocation:(CGFloat)location -{ - NSUInteger line, count, index, rectCount, i; - NSRectArray rects; - NSRect visibleRect; - NSLayoutManager *layoutManager; - NSTextContainer *container; - NSRange nullRange; - NSMutableArray *lines; - id view; - - view = [self clientView]; - visibleRect = [[[self scrollView] contentView] bounds]; - - lines = [self lineIndices]; - - location += NSMinY(visibleRect); - - if ([view isKindOfClass:[NSTextView class]]) - { - nullRange = NSMakeRange(NSNotFound, 0); - layoutManager = [view layoutManager]; - container = [view textContainer]; - count = [lines count]; - - for (line = 0; line < count; line++) - { - index = [[lines objectAtIndex:line] unsignedIntegerValue]; - - rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0) - withinSelectedCharacterRange:nullRange - inTextContainer:container - rectCount:&rectCount]; - - for (i = 0; i < rectCount; i++) - { - if ((location >= NSMinY(rects[i])) && (location < NSMaxY(rects[i]))) - { - return line + 1; - } - } - } - } - return NSNotFound; -} + NSTextStorage *storage; + NSRange range; + + storage = [notification object]; -- (NoodleLineNumberMarker *)markerAtLine:(NSUInteger)line -{ - return [_linesToMarkers objectForKey:[NSNumber numberWithUnsignedInteger:line - 1]]; + // Invalidate the line indices. They will be recalculated and re-cached on demand. + range = [storage editedRange]; + if (range.location != NSNotFound) + { + [self invalidateLineIndicesFromCharacterIndex:range.location]; + [self setNeedsDisplay:YES]; + } } - - (void)calculateLines { id view; @@ -245,34 +161,51 @@ - (void)calculateLines if ([view isKindOfClass:[NSTextView class]]) { - NSUInteger index, numberOfLines, stringLength, lineEnd, contentEnd; + NSUInteger charIndex, stringLength, lineEnd, contentEnd, count, lineIndex; NSString *text; CGFloat oldThickness, newThickness; text = [view string]; stringLength = [text length]; - [_lineIndices release]; - _lineIndices = [[NSMutableArray alloc] init]; - - index = 0; - numberOfLines = 0; + count = [_lineIndices count]; + + charIndex = 0; + lineIndex = [self lineNumberForCharacterIndex:_invalidCharacterIndex inText:text]; + if (count > 0) + { + charIndex = [[_lineIndices objectAtIndex:lineIndex] unsignedIntegerValue]; + } do { - [_lineIndices addObject:[NSNumber numberWithUnsignedInteger:index]]; + if (lineIndex < count) + { + [_lineIndices replaceObjectAtIndex:lineIndex withObject:[NSNumber numberWithUnsignedInteger:charIndex]]; + } + else + { + [_lineIndices addObject:[NSNumber numberWithUnsignedInteger:charIndex]]; + } - index = NSMaxRange([text lineRangeForRange:NSMakeRange(index, 0)]); - numberOfLines++; + charIndex = NSMaxRange([text lineRangeForRange:NSMakeRange(charIndex, 0)]); + lineIndex++; + } + while (charIndex < stringLength); + + if (lineIndex < count) + { + [_lineIndices removeObjectsInRange:NSMakeRange(lineIndex, count - lineIndex)]; } - while (index < stringLength); + _invalidCharacterIndex = NSUIntegerMax; // Check if text ends with a new line. [text getLineStart:NULL end:&lineEnd contentsEnd:&contentEnd forRange:NSMakeRange([[_lineIndices lastObject] unsignedIntegerValue], 0)]; if (contentEnd < lineEnd) { - [_lineIndices addObject:[NSNumber numberWithUnsignedInteger:index]]; + [_lineIndices addObject:[NSNumber numberWithUnsignedInteger:charIndex]]; } + // See if we need to adjust the width of the view oldThickness = [self ruleThickness]; newThickness = [self requiredThickness]; if (fabs(oldThickness - newThickness) > 1) @@ -291,12 +224,21 @@ - (void)calculateLines } } -- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)text +- (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)charIndex inText:(NSString *)text { NSUInteger left, right, mid, lineStart; NSMutableArray *lines; - lines = [self lineIndices]; + if (_invalidCharacterIndex < NSUIntegerMax) + { + // We do not want to risk calculating the indices again since we are probably doing it right now, thus + // possibly causing an infinite loop. + lines = _lineIndices; + } + else + { + lines = [self lineIndices]; + } // Binary search left = 0; @@ -307,11 +249,11 @@ - (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)t mid = (right + left) / 2; lineStart = [[lines objectAtIndex:mid] unsignedIntegerValue]; - if (index < lineStart) + if (charIndex < lineStart) { right = mid; } - else if (index > lineStart) + else if (charIndex > lineStart) { left = mid; } @@ -325,18 +267,42 @@ - (NSUInteger)lineNumberForCharacterIndex:(NSUInteger)index inText:(NSString *)t - (NSDictionary *)textAttributes { - return [NSDictionary dictionaryWithObjectsAndKeys: - [self font], NSFontAttributeName, - [self textColor], NSForegroundColorAttributeName, - nil]; + NSFont *font; + NSColor *color; + + font = [self font]; + if (font == nil) + { + font = [self defaultFont]; + } + + color = [self textColor]; + if (color == nil) + { + color = [self defaultTextColor]; + } + + return [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, color, NSForegroundColorAttributeName, nil]; } - (NSDictionary *)markerTextAttributes { - return [NSDictionary dictionaryWithObjectsAndKeys: - [self font], NSFontAttributeName, - [self alternateTextColor], NSForegroundColorAttributeName, - nil]; + NSFont *font; + NSColor *color; + + font = [self font]; + if (font == nil) + { + font = [self defaultFont]; + } + + color = [self alternateTextColor]; + if (color == nil) + { + color = [self defaultAlternateTextColor]; + } + + return [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, color, NSForegroundColorAttributeName, nil]; } - (CGFloat)requiredThickness @@ -346,7 +312,11 @@ - (CGFloat)requiredThickness NSSize stringSize; lineCount = [[self lineIndices] count]; - digits = (NSUInteger)log10(lineCount) + 1; + digits = 1; + if (lineCount > 0) + { + digits = (NSUInteger)log10(lineCount) + 1; + } sampleString = [NSMutableString string]; for (i = 0; i < digits; i++) { @@ -481,6 +451,58 @@ - (void)drawHashMarksAndLabelsInRect:(NSRect)aRect } } + +- (NSUInteger)lineNumberForLocation:(CGFloat)location +{ + NSUInteger line, count, index, rectCount, i; + NSRectArray rects; + NSRect visibleRect; + NSLayoutManager *layoutManager; + NSTextContainer *container; + NSRange nullRange; + NSMutableArray *lines; + id view; + + view = [self clientView]; + visibleRect = [[[self scrollView] contentView] bounds]; + + lines = [self lineIndices]; + + location += NSMinY(visibleRect); + + if ([view isKindOfClass:[NSTextView class]]) + { + nullRange = NSMakeRange(NSNotFound, 0); + layoutManager = [view layoutManager]; + container = [view textContainer]; + count = [lines count]; + + for (line = 0; line < count; line++) + { + index = [[lines objectAtIndex:line] unsignedIntegerValue]; + + rects = [layoutManager rectArrayForCharacterRange:NSMakeRange(index, 0) + withinSelectedCharacterRange:nullRange + inTextContainer:container + rectCount:&rectCount]; + + for (i = 0; i < rectCount; i++) + { + if ((location >= NSMinY(rects[i])) && (location < NSMaxY(rects[i]))) + { + return line + 1; + } + } + } + } + return NSNotFound; +} + +- (NoodleLineNumberMarker *)markerAtLine:(NSUInteger)line +{ + return [_linesToMarkers objectForKey:[NSNumber numberWithUnsignedInteger:line - 1]]; +} + - (void)setMarkers:(NSArray *)markers { NSEnumerator *enumerator; diff --git a/NoodleTableView.h b/NoodleTableView.h index f669f9f..009e847 100644 --- a/NoodleTableView.h +++ b/NoodleTableView.h @@ -63,7 +63,7 @@ BOOL _isDrawingStickyRow; } -@property (getter=showsStickyRowHeader, setter=setShowsStickyRowHeader) BOOL showsStickyRowHeader; +@property (getter=showsStickyRowHeader, setter=setShowsStickyRowHeader:) BOOL showsStickyRowHeader; #pragma mark Row Spanning methods