Browse code
works?
Ed Langley authored on 29/10/2020 20:29:49
Showing 5 changed files
Showing 5 changed files
- OBJCBrowser.xcodeproj/project.pbxproj
- OBJCBrowser/AppDelegate.h
- OBJCBrowser/AppDelegate.m
- OBJCBrowser/Base.lproj/MainMenu.xib
- OBJCBrowser/OBJCBrowser.entitlements
... | ... |
@@ -269,6 +269,7 @@ |
269 | 269 |
buildSettings = { |
270 | 270 |
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
271 | 271 |
CODE_SIGN_ENTITLEMENTS = OBJCBrowser/OBJCBrowser.entitlements; |
272 |
+ CODE_SIGN_IDENTITY = "Mac Developer"; |
|
272 | 273 |
CODE_SIGN_STYLE = Automatic; |
273 | 274 |
COMBINE_HIDPI_IMAGES = YES; |
274 | 275 |
DEVELOPMENT_TEAM = 95L5D2X59B; |
... | ... |
@@ -279,6 +280,7 @@ |
279 | 280 |
); |
280 | 281 |
PRODUCT_BUNDLE_IDENTIFIER = com.fwoar.OBJCBrowser; |
281 | 282 |
PRODUCT_NAME = "$(TARGET_NAME)"; |
283 |
+ PROVISIONING_PROFILE_SPECIFIER = ""; |
|
282 | 284 |
}; |
283 | 285 |
name = Debug; |
284 | 286 |
}; |
... | ... |
@@ -287,6 +289,7 @@ |
287 | 289 |
buildSettings = { |
288 | 290 |
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
289 | 291 |
CODE_SIGN_ENTITLEMENTS = OBJCBrowser/OBJCBrowser.entitlements; |
292 |
+ CODE_SIGN_IDENTITY = "Mac Developer"; |
|
290 | 293 |
CODE_SIGN_STYLE = Automatic; |
291 | 294 |
COMBINE_HIDPI_IMAGES = YES; |
292 | 295 |
DEVELOPMENT_TEAM = 95L5D2X59B; |
... | ... |
@@ -297,6 +300,7 @@ |
297 | 300 |
); |
298 | 301 |
PRODUCT_BUNDLE_IDENTIFIER = com.fwoar.OBJCBrowser; |
299 | 302 |
PRODUCT_NAME = "$(TARGET_NAME)"; |
303 |
+ PROVISIONING_PROFILE_SPECIFIER = ""; |
|
300 | 304 |
}; |
301 | 305 |
name = Release; |
302 | 306 |
}; |
... | ... |
@@ -7,16 +7,89 @@ |
7 | 7 |
// |
8 | 8 |
|
9 | 9 |
#import "AppDelegate.h" |
10 |
+#include <objc/runtime.h> |
|
11 |
+#include <ScriptingBridge/ScriptingBridge.h> |
|
10 | 12 |
|
11 | 13 |
@interface AppDelegate () |
12 | 14 |
|
13 | 15 |
@property (weak) IBOutlet NSWindow *window; |
16 |
+@property (weak) IBOutlet NSOutlineView *classOutline; |
|
17 |
+ |
|
18 |
+@property NSMutableDictionary<NSString*, NSArray<NSString*>*> *classesSource; |
|
19 |
+@property NSArray<NSString*> *rootClass; |
|
20 |
+@property unsigned int classesSourceCount; |
|
21 |
+ |
|
22 |
+//@property (weak) IBOutlet NSWindow *window; |
|
14 | 23 |
@end |
15 | 24 |
|
16 | 25 |
@implementation AppDelegate |
17 | 26 |
|
27 |
+- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { |
|
28 |
+ if (item == nil) { |
|
29 |
+ return [self.rootClass count]; |
|
30 |
+ } else { |
|
31 |
+ return [[self.classesSource valueForKey:item] count]; |
|
32 |
+ } |
|
33 |
+} |
|
34 |
+ |
|
35 |
+- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { |
|
36 |
+ return item != nil && [item isKindOfClass:[NSString class]] && [self.classesSource valueForKey:item] != nil && [[self.classesSource valueForKey:item] count] != 0; |
|
37 |
+} |
|
38 |
+ |
|
39 |
+- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item { |
|
40 |
+ if (item == nil) { |
|
41 |
+ return [self.rootClass objectAtIndex:index]; |
|
42 |
+ } else { |
|
43 |
+ return [[self.classesSource objectForKey:(NSString*)item] |
|
44 |
+ objectAtIndex:index]; |
|
45 |
+ } |
|
46 |
+} |
|
47 |
+ |
|
48 |
+- (NSView *)outlineView:(NSOutlineView *)outlineView viewForTableColumn:(NSTableColumn *)tableColumn item:(id)item { |
|
49 |
+ NSTableCellView *v = [outlineView makeViewWithIdentifier:@"ItemName" |
|
50 |
+ owner:self]; |
|
51 |
+ [v.textField setStringValue:item]; |
|
52 |
+ return v; |
|
53 |
+} |
|
54 |
+ |
|
18 | 55 |
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { |
19 | 56 |
// Insert code here to initialize your application |
57 |
+ self.classesSourceCount = objc_getClassList(NULL, 0); |
|
58 |
+ Class *classesSource = (Class*)calloc(self.classesSourceCount, sizeof(Class)); |
|
59 |
+ NSMutableArray<NSString*> *classList = [[NSMutableArray alloc] initWithCapacity:self.classesSourceCount]; |
|
60 |
+ self.classesSource = [[NSMutableDictionary alloc] initWithCapacity:self.classesSourceCount]; |
|
61 |
+ |
|
62 |
+ |
|
63 |
+ printf("There are %d classes\n", self.classesSourceCount); |
|
64 |
+ printf("Got %d classes\n", |
|
65 |
+ objc_getClassList(classesSource, self.classesSourceCount)); |
|
66 |
+ |
|
67 |
+ |
|
68 |
+ for (unsigned int cur = 0; cur < self.classesSourceCount; cur++) { |
|
69 |
+ unsigned int methodCount = 0; |
|
70 |
+ Class cur_class = classesSource[cur]; |
|
71 |
+ Method *methods = class_copyMethodList(cur_class, &methodCount); |
|
72 |
+ NSString *class_name = [NSString stringWithUTF8String:class_getName(cur_class)]; |
|
73 |
+// if (!([class_name characterAtIndex:0] == '_')) { |
|
74 |
+ classList[cur] = class_name; |
|
75 |
+// } else { |
|
76 |
+// self.classesSourceCount -= 1; |
|
77 |
+// } |
|
78 |
+ |
|
79 |
+ NSMutableArray *method_arr = [[NSMutableArray alloc] initWithCapacity:methodCount]; |
|
80 |
+ for (int cur_m = 0; cur_m < methodCount; cur_m++) { |
|
81 |
+ Method cur_method = methods[cur_m]; |
|
82 |
+ NSString *method_name = [NSString stringWithUTF8String:sel_getName(method_getName(cur_method))]; |
|
83 |
+ method_arr[cur_m] = method_name; |
|
84 |
+ } |
|
85 |
+ self.classesSource[class_name] = [method_arr sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; |
|
86 |
+ } |
|
87 |
+ |
|
88 |
+ self.rootClass = [classList sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; |
|
89 |
+ |
|
90 |
+ self.classOutline.autoresizesOutlineColumn = YES; |
|
91 |
+ [self.classOutline setDelegate:self]; |
|
92 |
+ [self.classOutline setDataSource:self]; |
|
20 | 93 |
} |
21 | 94 |
|
22 | 95 |
|
... | ... |
@@ -1,7 +1,9 @@ |
1 |
-<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|
2 |
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> |
|
1 |
+<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="15705" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct"> |
|
3 | 3 |
<dependencies> |
4 |
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/> |
|
4 |
+ <deployment identifier="macosx"/> |
|
5 |
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15705"/> |
|
6 |
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> |
|
5 | 7 |
</dependencies> |
6 | 8 |
<objects> |
7 | 9 |
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication"> |
... | ... |
@@ -10,9 +12,10 @@ |
10 | 12 |
</connections> |
11 | 13 |
</customObject> |
12 | 14 |
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> |
13 |
- <customObject id="-3" userLabel="Application" customClass="NSApplication"/> |
|
14 |
- <customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider=""> |
|
15 |
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/> |
|
16 |
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate"> |
|
15 | 17 |
<connections> |
18 |
+ <outlet property="classOutline" destination="9gM-j3-zZr" id="Gyn-Xn-L0N"/> |
|
16 | 19 |
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/> |
17 | 20 |
</connections> |
18 | 21 |
</customObject> |
... | ... |
@@ -627,7 +630,7 @@ |
627 | 630 |
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE"> |
628 | 631 |
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/> |
629 | 632 |
<connections> |
630 |
- <action selector="toggleSourceList:" target="-1" id="iwa-gc-5KM"/> |
|
633 |
+ <action selector="toggleSidebar:" target="-1" id="iwa-gc-5KM"/> |
|
631 | 634 |
</connections> |
632 | 635 |
</menuItem> |
633 | 636 |
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa"> |
... | ... |
@@ -648,8 +651,8 @@ |
648 | 651 |
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/> |
649 | 652 |
</connections> |
650 | 653 |
</menuItem> |
651 |
- <menuItem title="Zoom" id="R4o-n2-Eq4"> |
|
652 |
- <modifierMask key="keyEquivalentModifierMask"/> |
|
654 |
+ <menuItem title="Zoom" keyEquivalent="z" id="R4o-n2-Eq4"> |
|
655 |
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/> |
|
653 | 656 |
<connections> |
654 | 657 |
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/> |
655 | 658 |
</connections> |
... | ... |
@@ -677,16 +680,93 @@ |
677 | 680 |
</menu> |
678 | 681 |
</menuItem> |
679 | 682 |
</items> |
683 |
+ <point key="canvasLocation" x="141" y="154"/> |
|
680 | 684 |
</menu> |
681 | 685 |
<window title="OBJCBrowser" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g"> |
682 | 686 |
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/> |
683 | 687 |
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/> |
684 | 688 |
<rect key="contentRect" x="335" y="390" width="480" height="360"/> |
685 |
- <rect key="screenRect" x="0.0" y="0.0" width="1680" height="1027"/> |
|
689 |
+ <rect key="screenRect" x="0.0" y="0.0" width="3840" height="2137"/> |
|
686 | 690 |
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ"> |
687 | 691 |
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/> |
688 | 692 |
<autoresizingMask key="autoresizingMask"/> |
693 |
+ <subviews> |
|
694 |
+ <scrollView autohidesScrollers="YES" horizontalLineScroll="19" horizontalPageScroll="10" verticalLineScroll="19" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="L1l-cs-6Pe"> |
|
695 |
+ <rect key="frame" x="0.0" y="0.0" width="480" height="360"/> |
|
696 |
+ <clipView key="contentView" id="hhP-Hp-4Mw"> |
|
697 |
+ <rect key="frame" x="1" y="0.0" width="478" height="359"/> |
|
698 |
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
|
699 |
+ <subviews> |
|
700 |
+ <outlineView identifier="ClassOutline" verticalHuggingPriority="750" ambiguous="YES" allowsExpansionToolTips="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="ujS-4U-HNi" viewBased="YES" indentationPerLevel="16" outlineTableColumn="1JD-6m-U0N" id="9gM-j3-zZr"> |
|
701 |
+ <rect key="frame" x="0.0" y="0.0" width="478" height="336"/> |
|
702 |
+ <autoresizingMask key="autoresizingMask"/> |
|
703 |
+ <size key="intercellSpacing" width="3" height="2"/> |
|
704 |
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> |
|
705 |
+ <color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/> |
|
706 |
+ <tableColumns> |
|
707 |
+ <tableColumn identifier="nameColumn" width="475" minWidth="200" maxWidth="1000" id="1JD-6m-U0N"> |
|
708 |
+ <tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border"> |
|
709 |
+ <font key="font" metaFont="smallSystem"/> |
|
710 |
+ <color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/> |
|
711 |
+ <color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/> |
|
712 |
+ </tableHeaderCell> |
|
713 |
+ <textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="2nq-Mb-fsn"> |
|
714 |
+ <font key="font" metaFont="system"/> |
|
715 |
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> |
|
716 |
+ <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> |
|
717 |
+ </textFieldCell> |
|
718 |
+ <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> |
|
719 |
+ <prototypeCellViews> |
|
720 |
+ <tableCellView identifier="ItemName" id="AzW-d4-xYG"> |
|
721 |
+ <rect key="frame" x="1" y="1" width="475" height="17"/> |
|
722 |
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> |
|
723 |
+ <subviews> |
|
724 |
+ <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="i3R-W4-hZC"> |
|
725 |
+ <rect key="frame" x="0.0" y="1" width="475" height="16"/> |
|
726 |
+ <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="7kw-GD-aOr"> |
|
727 |
+ <font key="font" metaFont="system"/> |
|
728 |
+ <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> |
|
729 |
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/> |
|
730 |
+ </textFieldCell> |
|
731 |
+ </textField> |
|
732 |
+ </subviews> |
|
733 |
+ <constraints> |
|
734 |
+ <constraint firstItem="i3R-W4-hZC" firstAttribute="centerY" secondItem="AzW-d4-xYG" secondAttribute="centerY" id="O8J-Kp-PXd"/> |
|
735 |
+ <constraint firstItem="i3R-W4-hZC" firstAttribute="leading" secondItem="AzW-d4-xYG" secondAttribute="leading" constant="2" id="OCV-Ui-4mu"/> |
|
736 |
+ <constraint firstItem="i3R-W4-hZC" firstAttribute="centerX" secondItem="AzW-d4-xYG" secondAttribute="centerX" id="iZy-P9-V6f"/> |
|
737 |
+ </constraints> |
|
738 |
+ <connections> |
|
739 |
+ <outlet property="textField" destination="i3R-W4-hZC" id="peV-MX-vSp"/> |
|
740 |
+ </connections> |
|
741 |
+ </tableCellView> |
|
742 |
+ </prototypeCellViews> |
|
743 |
+ </tableColumn> |
|
744 |
+ </tableColumns> |
|
745 |
+ </outlineView> |
|
746 |
+ </subviews> |
|
747 |
+ </clipView> |
|
748 |
+ <scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="ad9-VT-hzi"> |
|
749 |
+ <rect key="frame" x="1" y="119" width="223" height="15"/> |
|
750 |
+ <autoresizingMask key="autoresizingMask"/> |
|
751 |
+ </scroller> |
|
752 |
+ <scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="y12-a9-Q4J"> |
|
753 |
+ <rect key="frame" x="224" y="17" width="15" height="102"/> |
|
754 |
+ <autoresizingMask key="autoresizingMask"/> |
|
755 |
+ </scroller> |
|
756 |
+ <tableHeaderView key="headerView" id="ujS-4U-HNi"> |
|
757 |
+ <rect key="frame" x="0.0" y="0.0" width="478" height="23"/> |
|
758 |
+ <autoresizingMask key="autoresizingMask"/> |
|
759 |
+ </tableHeaderView> |
|
760 |
+ </scrollView> |
|
761 |
+ </subviews> |
|
762 |
+ <constraints> |
|
763 |
+ <constraint firstItem="L1l-cs-6Pe" firstAttribute="height" secondItem="EiT-Mj-1SZ" secondAttribute="height" id="EsN-WZ-gpi"/> |
|
764 |
+ <constraint firstItem="L1l-cs-6Pe" firstAttribute="width" secondItem="EiT-Mj-1SZ" secondAttribute="width" id="OiX-cG-bXS"/> |
|
765 |
+ <constraint firstItem="L1l-cs-6Pe" firstAttribute="centerY" secondItem="EiT-Mj-1SZ" secondAttribute="centerY" id="YBx-Td-eeD"/> |
|
766 |
+ <constraint firstItem="L1l-cs-6Pe" firstAttribute="centerX" secondItem="EiT-Mj-1SZ" secondAttribute="centerX" id="kYq-jG-3tJ"/> |
|
767 |
+ </constraints> |
|
689 | 768 |
</view> |
769 |
+ <point key="canvasLocation" x="141" y="278"/> |
|
690 | 770 |
</window> |
691 | 771 |
</objects> |
692 | 772 |
</document> |
... | ... |
@@ -2,9 +2,9 @@ |
2 | 2 |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
3 | 3 |
<plist version="1.0"> |
4 | 4 |
<dict> |
5 |
- <key>com.apple.security.app-sandbox</key> |
|
6 |
- <true/> |
|
7 |
- <key>com.apple.security.files.user-selected.read-only</key> |
|
8 |
- <true/> |
|
5 |
+ <key>com.apple.security.app-sandbox</key> |
|
6 |
+ <false/> |
|
7 |
+ <key>com.apple.security.files.user-selected.read-only</key> |
|
8 |
+ <false/> |
|
9 | 9 |
</dict> |
10 | 10 |
</plist> |