diff --git a/Lookin.xcodeproj/project.pbxproj b/Lookin.xcodeproj/project.pbxproj index 60a5296b..ab781d32 100644 --- a/Lookin.xcodeproj/project.pbxproj +++ b/Lookin.xcodeproj/project.pbxproj @@ -679,7 +679,10 @@ AA05CCD1221ED50B0086CDD1 /* AttributeView */ = { isa = PBXGroup; children = ( + AA0A2DD3233F7D2B008BF946 /* Constraint */, + A721E4882B1CE18800546017 /* JSON */, AA05CCD8221ED5F60086CDD1 /* LKDashboardAttributeColorView.h */, + AA05CCD9221ED5F60086CDD1 /* LKDashboardAttributeColorView.m */, 1822E2C92B9396B50007C0B2 /* LKDashboardTextControlEditingFlag.h */, 1822E2CA2B9396B50007C0B2 /* LKDashboardTextControlEditingFlag.m */, AAB636BE22B3854100885A2C /* LKDashboardAttributeClassView.h */, @@ -687,11 +690,9 @@ AAB636C122B3981200885A2C /* LKDashboardAttributeRelationView.h */, AAB636C222B3981200885A2C /* LKDashboardAttributeRelationView.m */, AAAEB36C22B408DF00A3DDE7 /* LKDashboardAttributeStringArrayView.h */, + AAAEB36D22B408DF00A3DDE7 /* LKDashboardAttributeStringArrayView.m */, D41874D2234B68AE004D68A2 /* LKDashboardAttributeOpenImageView.h */, D41874D3234B68AE004D68A2 /* LKDashboardAttributeOpenImageView.m */, - AA0A2DD3233F7D2B008BF946 /* Constraint */, - AAAEB36D22B408DF00A3DDE7 /* LKDashboardAttributeStringArrayView.m */, - AA05CCD9221ED5F60086CDD1 /* LKDashboardAttributeColorView.m */, AA05CCDB221ED6110086CDD1 /* LKDashboardAttributeEnumsView.h */, AA05CCDC221ED6110086CDD1 /* LKDashboardAttributeEnumsView.m */, AACBACB022AEA6E900A8F89D /* LKDashboardAttributeInsetsView.h */, @@ -705,12 +706,11 @@ AA28179D22B0305400A0874C /* LKDashboardAttributeRowsCountView.h */, AA28179E22B0305400A0874C /* LKDashboardAttributeRowsCountView.m */, AAED8ED622AFED490051242B /* LKDashboardAttributeSizeView.h */, + AAED8ED722AFED490051242B /* LKDashboardAttributeSizeView.m */, AA17F38E232FBD710082F393 /* LKDashboardAttributeTextView.h */, + AA17F38F232FBD710082F393 /* LKDashboardAttributeTextView.m */, A70A0C2C2B179754009A1937 /* LKDashboardAttributeShadowView.h */, - A721E4882B1CE18800546017 /* JSON */, A70A0C2D2B179754009A1937 /* LKDashboardAttributeShadowView.m */, - AA17F38F232FBD710082F393 /* LKDashboardAttributeTextView.m */, - AAED8ED722AFED490051242B /* LKDashboardAttributeSizeView.m */, AA05CCD5221ED5E80086CDD1 /* LKDashboardAttributeSwitchView.h */, AA05CCD6221ED5E80086CDD1 /* LKDashboardAttributeSwitchView.m */, AAA8C0E021CC17680017A345 /* LKDashboardAttributeView.h */, @@ -918,12 +918,12 @@ AAA8C08721CC17670017A345 /* Connection */ = { isa = PBXGroup; children = ( - AAA8C08B21CC17670017A345 /* LKAppsManager.m */, AAA8C08821CC17670017A345 /* LKAppsManager.h */, + AAA8C08B21CC17670017A345 /* LKAppsManager.m */, + AAA8C08921CC17670017A345 /* LKConnectionManager.h */, AAA8C08C21CC17670017A345 /* LKConnectionManager.m */, AA7F157622C0F2B9004436AD /* LKConnectionRequest.h */, AA7F157722C0F2B9004436AD /* LKConnectionRequest.m */, - AAA8C08921CC17670017A345 /* LKConnectionManager.h */, AAA8C08D21CC17670017A345 /* LKInspectableApp.h */, AAA8C08A21CC17670017A345 /* LKInspectableApp.m */, ); @@ -1038,8 +1038,8 @@ AAC41E1522686A28005CDD6E /* LKStaticHierarchyDataSource.m */, AAA8C0D421CC17680017A345 /* LKStaticWindowController.h */, AAA8C11221CC17680017A345 /* LKStaticWindowController.m */, - AAA8C0CA21CC17670017A345 /* LKStaticHierarchyController.m */, AAA8C0D121CC17670017A345 /* LKStaticHierarchyController.h */, + AAA8C0CA21CC17670017A345 /* LKStaticHierarchyController.m */, A77AA1792AEED1B8006A7BF4 /* LKMessageManager.h */, A77AA17A2AEED1B8006A7BF4 /* LKMessageManager.m */, ); @@ -1052,9 +1052,9 @@ AAB65C0D2320FCFA001E4299 /* Search */, AA05CCD1221ED50B0086CDD1 /* AttributeView */, AAA8C0DA21CC17680017A345 /* LKDashboardCardView.h */, + AAA8C0EA21CC17680017A345 /* LKDashboardCardView.m */, AA66C59F231924BD00085C76 /* LKDashboardAccessoryWindowController.h */, AA66C5A0231924BD00085C76 /* LKDashboardAccessoryWindowController.m */, - AAA8C0EA21CC17680017A345 /* LKDashboardCardView.m */, 7BFFDF132AF134240039B828 /* LKDashboardSectionViewPool.h */, 7BFFDF142AF134240039B828 /* LKDashboardSectionViewPool.m */, AAB636C422B3BA0F00885A2C /* LKDashboardCardTitleControl.h */, @@ -1631,7 +1631,7 @@ COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 14; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 5V3Z8FVWHU; + DEVELOPMENT_TEAM = D5Q73692VW; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -1672,7 +1672,7 @@ COMBINE_HIDPI_IMAGES = YES; CURRENT_PROJECT_VERSION = 14; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = 5V3Z8FVWHU; + DEVELOPMENT_TEAM = D5Q73692VW; ENABLE_HARDENED_RUNTIME = YES; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", diff --git a/LookinClient/Assets.xcassets/icon_mac_big.imageset/Contents.json b/LookinClient/Assets.xcassets/icon_mac_big.imageset/Contents.json new file mode 100644 index 00000000..dc656d1e --- /dev/null +++ b/LookinClient/Assets.xcassets/icon_mac_big.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "icon_mac_big.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/LookinClient/Assets.xcassets/icon_mac_big.imageset/icon_mac_big.png b/LookinClient/Assets.xcassets/icon_mac_big.imageset/icon_mac_big.png new file mode 100644 index 00000000..985f0d63 Binary files /dev/null and b/LookinClient/Assets.xcassets/icon_mac_big.imageset/icon_mac_big.png differ diff --git a/LookinClient/Assets.xcassets/icon_mac_small.imageset/Contents.json b/LookinClient/Assets.xcassets/icon_mac_small.imageset/Contents.json new file mode 100644 index 00000000..57a60155 --- /dev/null +++ b/LookinClient/Assets.xcassets/icon_mac_small.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "icon_mac_small.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/LookinClient/Assets.xcassets/icon_mac_small.imageset/icon_mac_small.png b/LookinClient/Assets.xcassets/icon_mac_small.imageset/icon_mac_small.png new file mode 100644 index 00000000..89c44704 Binary files /dev/null and b/LookinClient/Assets.xcassets/icon_mac_small.imageset/icon_mac_small.png differ diff --git a/LookinClient/Base/Category/LookinDisplayItem+LookinClient.m b/LookinClient/Base/Category/LookinDisplayItem+LookinClient.m index 438266e5..8b941bff 100644 --- a/LookinClient/Base/Category/LookinDisplayItem+LookinClient.m +++ b/LookinClient/Base/Category/LookinDisplayItem+LookinClient.m @@ -20,6 +20,8 @@ - (NSString *)title { return self.viewObject.lk_simpleDemangledClassName; } else if (self.layerObject) { return self.layerObject.lk_simpleDemangledClassName; + } else if (self.windowObject) { + return self.windowObject.lk_simpleDemangledClassName; } else { return nil; } @@ -35,7 +37,7 @@ - (NSString *)subtitle { return [NSString stringWithFormat:@"%@.view", text]; } - LookinObject *representedObject = self.viewObject ? : self.layerObject; + LookinObject *representedObject = self.windowObject ? : self.viewObject ? : self.layerObject; if (representedObject.specialTrace.length) { return representedObject.specialTrace; @@ -51,7 +53,7 @@ - (NSString *)subtitle { } - (BOOL)representedForSystemClass { - return [self.title hasPrefix:@"UI"] || [self.title hasPrefix:@"CA"] || [self.title hasPrefix:@"_"]; + return [self.title hasPrefix:@"UI"] || [self.title hasPrefix:@"CA"] || [self.title hasPrefix:@"_"] || [self.title hasPrefix:@"NS"]; } - (NSImage *)appropriateScreenshot { @@ -82,6 +84,25 @@ - (BOOL)hasValidFrameToRoot { return [LKHelper validateFrame:self.frame]; } +//- (CGRect)calculateFrameToRoot { +// if (self.customInfo) { +// return [self.customInfo.frameInWindow rectValue]; +// } +// if (!self.superItem) { +// return self.frame; +// } +// CGRect superFrameToRoot = [self.superItem calculateFrameToRoot]; +// CGRect superBounds = self.superItem.bounds; +// CGRect selfFrame = self.frame; +// +// CGFloat x = selfFrame.origin.x - superBounds.origin.x + superFrameToRoot.origin.x; +// CGFloat y = selfFrame.origin.y - superBounds.origin.y + superFrameToRoot.origin.y; +// +// CGFloat width = selfFrame.size.width; +// CGFloat height = selfFrame.size.height; +// return CGRectMake(x, y, width, height); +//} + - (CGRect)calculateFrameToRoot { if (self.customInfo) { return [self.customInfo.frameInWindow rectValue]; @@ -89,18 +110,41 @@ - (CGRect)calculateFrameToRoot { if (!self.superItem) { return self.frame; } + CGRect superFrameToRoot = [self.superItem calculateFrameToRoot]; CGRect superBounds = self.superItem.bounds; CGRect selfFrame = self.frame; CGFloat x = selfFrame.origin.x - superBounds.origin.x + superFrameToRoot.origin.x; - CGFloat y = selfFrame.origin.y - superBounds.origin.y + superFrameToRoot.origin.y; + CGFloat y; + + if (self.superItem.isFlipped) { + y = superFrameToRoot.origin.y + (superBounds.size.height - selfFrame.origin.y - selfFrame.size.height); + } else { + y = selfFrame.origin.y - superBounds.origin.y + superFrameToRoot.origin.y; + } + /* + // 处理当前视图坐标系到父视图坐标系的转换 + if (self.isFlipped == self.superItem.isFlipped) { + // 父子视图坐标系相同 + + } else { + // 父子视图坐标系不同 + if (self.isFlipped) { + // 当前视图原点在左上角,父视图原点在左下角 + } else { + // 当前视图原点在左下角,父视图原点在左上角 + y = superFrameToRoot.origin.y + selfFrame.origin.y; + } + } + */ CGFloat width = selfFrame.size.width; CGFloat height = selfFrame.size.height; return CGRectMake(x, y, width, height); } + - (BOOL)isMatchedWithSearchString:(NSString *)string { if (string.length == 0) { NSAssert(NO, @""); @@ -119,6 +163,9 @@ - (BOOL)isMatchedWithSearchString:(NSString *)string { if ([self.layerObject.memoryAddress containsString:searchString]) { return YES; } + if ([self.windowObject.memoryAddress containsString:searchString]) { + return YES; + } return NO; } @@ -164,7 +211,7 @@ - (BOOL)itemIsKindOfClassesWithNames:(NSSet *)targetClassNames { if (!targetClassNames.count) { return NO; } - LookinObject *selfObj = self.viewObject ? : self.layerObject; + LookinObject *selfObj = self.windowObject ? : self.viewObject ? : self.layerObject; if (!selfObj) { return NO; } diff --git a/LookinClient/Base/LKTipsView.m b/LookinClient/Base/LKTipsView.m index 2a0eedb1..e361df26 100644 --- a/LookinClient/Base/LKTipsView.m +++ b/LookinClient/Base/LKTipsView.m @@ -135,12 +135,14 @@ - (void)setImage:(NSImage *)image { } - (void)setImageByDeviceType:(LookinAppInfoDevice)type { - if (type == 0) { + if (type == LookinAppInfoDeviceSimulator) { self.image = NSImageMake(@"icon_simulator_big"); - } else if (type == 1) { + } else if (type == LookinAppInfoDeviceIPad) { self.image = NSImageMake(@"icon_ipad_big"); - } else if (type == 2) { + } else if (type == LookinAppInfoDeviceOthers) { self.image = NSImageMake(@"icon_iphone_big"); + } else if (type == LookinAppInfoDeviceMac) { + self.image = NSImageMake(@"icon_mac_big"); } else { NSAssert(NO, @""); } diff --git a/LookinClient/Connection/LKConnectionManager.m b/LookinClient/Connection/LKConnectionManager.m index c42db6df..b89950b7 100644 --- a/LookinClient/Connection/LKConnectionManager.m +++ b/LookinClient/Connection/LKConnectionManager.m @@ -15,7 +15,7 @@ #import "LKConnectionRequest.h" #import "LKServerVersionRequestor.h" -static NSIndexSet * PushFrameTypeList() { +static NSIndexSet * PushFrameTypeList(void) { static NSIndexSet *list; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ diff --git a/LookinClient/Console/LKConsoleDataSource.m b/LookinClient/Console/LKConsoleDataSource.m index 36bc9fb5..627e7749 100644 --- a/LookinClient/Console/LKConsoleDataSource.m +++ b/LookinClient/Console/LKConsoleDataSource.m @@ -49,7 +49,7 @@ - (instancetype)initWithHierarchyDataSource:(LKHierarchyDataSource *)hierarchyDa if (!item) { return nil; } - NSArray *objs = $(item.hostViewControllerObject, item.layerObject, item.viewObject).array; + NSArray *objs = $(item.hostViewControllerObject, item.layerObject, item.viewObject, item.windowObject).array; return objs; }]; } diff --git a/LookinClient/Dashboard/LKDashboardCardView.m b/LookinClient/Dashboard/LKDashboardCardView.m index 688f2a5a..c669ef3d 100644 --- a/LookinClient/Dashboard/LKDashboardCardView.m +++ b/LookinClient/Dashboard/LKDashboardCardView.m @@ -266,6 +266,15 @@ + (NSImage *)imageWithAttrGroup:(LookinAttributesGroup *)group { LookinAttrGroup_UITextField: NSImageMake(@"dashboard_textfield"), LookinAttrGroup_UIVisualEffectView: NSImageMake(@"dashboard_effectview"), LookinAttrGroup_UIStackView: NSImageMake(@"dashboard_stackview"), + LookinAttrGroup_NSImageView: NSImageMake(@"dashboard_imageview"), + LookinAttrGroup_NSButton: NSImageMake(@"dashboard_button"), + LookinAttrGroup_NSControl: NSImageMake(@"dashboard_control"), + LookinAttrGroup_NSScrollView: NSImageMake(@"dashboard_scrollview"), + LookinAttrGroup_NSTableView: NSImageMake(@"dashboard_tableview"), + LookinAttrGroup_NSTextView: NSImageMake(@"dashboard_textview"), + LookinAttrGroup_NSTextField: NSImageMake(@"dashboard_textfield"), + LookinAttrGroup_NSVisualEffectView: NSImageMake(@"dashboard_effectview"), + LookinAttrGroup_NSStackView: NSImageMake(@"dashboard_stackview"), LookinAttrGroup_UserCustom: NSImageMake(@"dashboard_custom") }; }); diff --git a/LookinClient/Dashboard/LKDashboardSectionView.m b/LookinClient/Dashboard/LKDashboardSectionView.m index 65f26177..c46551bc 100644 --- a/LookinClient/Dashboard/LKDashboardSectionView.m +++ b/LookinClient/Dashboard/LKDashboardSectionView.m @@ -253,6 +253,9 @@ - (Class)_targetAttrClassForType:(LookinAttrType)type identifier:(LookinAttrIden case LookinAttrTypeFloat: case LookinAttrTypeDouble: case LookinAttrTypeLong: + case LookinAttrTypeUnsignedLong: + case LookinAttrTypeInt: + case LookinAttrTypeUnsignedInt: return [LKDashboardAttributeNumberInputView class]; case LookinAttrTypeUIColor: return [LKDashboardAttributeColorView class]; @@ -279,7 +282,7 @@ - (Class)_targetAttrClassForType:(LookinAttrType)type identifier:(LookinAttrIden return [LKDashboardAttributeRelationView class]; } else if ([identifier isEqualToString:LookinAttr_AutoLayout_Constraints_Constraints]) { return [LKDashboardAttributeConstraintsView class]; - } else if ([identifier isEqualToString:LookinAttr_UIImageView_Open_Open]) { + } else if ([identifier isEqualToString:LookinAttr_UIImageView_Open_Open] || [identifier isEqualToString:LookinAttr_NSImageView_Open_Open]) { return [LKDashboardAttributeOpenImageView class]; } else if ([identifier isEqualToString:LookinAttr_UIVisualEffectView_Style_Style]) { return [LKDashboardAttributeEnumsView class]; diff --git a/LookinClient/Dashboard/LKDashboardViewController.m b/LookinClient/Dashboard/LKDashboardViewController.m index bccf40a3..bde6f271 100644 --- a/LookinClient/Dashboard/LKDashboardViewController.m +++ b/LookinClient/Dashboard/LKDashboardViewController.m @@ -273,6 +273,8 @@ - (RACSignal *)modifyInbuiltAttribute:(LookinAttribute *)attribute newValue:(id) modification.clientReadableVersion = [LKHelper lookinReadableVersion]; if ([LookinDashboardBlueprint isUIViewPropertyWithAttrID:attribute.identifier]) { modification.targetOid = modifyingItem.viewObject.oid; + } else if ([LookinDashboardBlueprint isWindowPropertyWithAttrID:attribute.identifier]) { + modification.targetOid = modifyingItem.windowObject.oid; } else { modification.targetOid = modifyingItem.layerObject.oid; } @@ -406,7 +408,7 @@ - (void)dashboardHeaderView:(LKDashboardHeaderView *)view didInputString:(NSStri [self.searchContainerView addSubview:self.searchMethodsView]; } - LookinObject *selectedObj = self.currentDataSource.selectedItem.viewObject ? : self.currentDataSource.selectedItem.layerObject; + LookinObject *selectedObj = self.currentDataSource.selectedItem.windowObject ? : self.currentDataSource.selectedItem.viewObject ? : self.currentDataSource.selectedItem.layerObject; NSString *selectedClassName = [selectedObj rawClassName]; @weakify(self); [[self.methodsDataSource fetchNonArgMethodsListWithClass:selectedClassName] subscribeNext:^(NSArray *methodsList) { diff --git a/LookinClient/Dashboard/LKEnumListRegistry.m b/LookinClient/Dashboard/LKEnumListRegistry.m index 58036fe3..e6cb2a97 100644 --- a/LookinClient/Dashboard/LKEnumListRegistry.m +++ b/LookinClient/Dashboard/LKEnumListRegistry.m @@ -166,7 +166,211 @@ - (instancetype)init { MakeItem(@"UIStackViewAlignmentTrailing (Bottom)", 4), MakeItem(@"UIStackViewAlignmentLastBaseline", 5) ]; + mData[@"NSWritingDirection"] = @[ + MakeItem(@"NSWritingDirectionNatural", -1), + MakeItem(@"NSWritingDirectionLeftToRight", 0), + MakeItem(@"NSWritingDirectionRightToLeft", 1) + ]; + mData[@"NSTextAlignment_AppKit"] = @[ + MakeItem(@"NSTextAlignmentLeft", 0), + MakeItem(@"NSTextAlignmentRight", 1), + MakeItem(@"NSTextAlignmentCenter", 2), + MakeItem(@"NSTextAlignmentJustified", 3), + MakeItem(@"NSTextAlignmentNatural", 4) + ]; + mData[@"NSButtonType"] = @[ + MakeItem(@"NSButtonTypeMomentaryLight", 0), + MakeItem(@"NSButtonTypePushOnPushOff", 1), + MakeItem(@"NSButtonTypeToggle", 2), + MakeItem(@"NSButtonTypeSwitch", 3), + MakeItem(@"NSButtonTypeRadio", 4), + MakeItem(@"NSButtonTypeMomentaryChange", 5), + MakeItem(@"NSButtonTypeOnOff", 6), + MakeItem(@"NSButtonTypeMomentaryPushIn", 7), + MakeItem(@"NSButtonTypeAccelerator", 8), + MakeItem(@"NSButtonTypeMultiLevelAccelerator", 9), + ]; + mData[@"NSBezelStyle"] = @[ + MakeItem(@"NSBezelStyleAutomatic", 0), + MakeItem(@"NSBezelStylePush", 1), + MakeItem(@"NSBezelStyleFlexiblePush", 2), + MakeItem(@"NSBezelStyleDisclosure", 5), + MakeItem(@"NSBezelStyleShadowlessSquare", 6), + MakeItem(@"NSBezelStyleCircular", 7), + MakeItem(@"NSBezelStyleTexturedSquare", 8), + MakeItem(@"NSBezelStyleHelpButton", 9), + MakeItem(@"NSBezelStyleSmallSquare", 10), + MakeItem(@"NSBezelStyleToolbar", 11), + MakeItem(@"NSBezelStyleAccessoryBarAction", 12), + MakeItem(@"NSBezelStyleAccessoryBar", 13), + MakeItem(@"NSBezelStylePushDisclosure", 14), + MakeItem(@"NSBezelStyleBadge", 15), + ]; + mData[@"NSCellImagePosition"] = @[ + MakeItem(@"NSNoImage", 0), + MakeItem(@"NSImageOnly", 1), + MakeItem(@"NSImageLeft", 2), + MakeItem(@"NSImageRight", 3), + MakeItem(@"NSImageBelow", 4), + MakeItem(@"NSImageAbove", 5), + MakeItem(@"NSImageOverlaps", 6), + MakeItem(@"NSImageLeading", 7), + MakeItem(@"NSImageTrailing", 8), + ]; + mData[@"NSImageScaling"] = @[ + MakeItem(@"NSImageScaleProportionallyDown", 0), + MakeItem(@"NSImageScaleAxesIndependently", 1), + MakeItem(@"NSImageScaleNone", 2), + MakeItem(@"NSImageScaleProportionallyUpOrDown", 3), + ]; + mData[@"NSControlStateValue"] = @[ + MakeItem(@"NSControlStateValueOff", 0), + MakeItem(@"NSControlStateValueOn", 1), + MakeItem(@"NSControlStateValueMixed", -1), + ]; + mData[@"NSControlSize"] = @[ + MakeItem(@"NSControlSizeRegular", 0), + MakeItem(@"NSControlSizeSmall", 1), + MakeItem(@"NSControlSizeMini", 2), + MakeItem(@"NSControlSizeLarge", 3), + ]; + mData[@"NSEventModifierFlags"] = @[ + MakeItem(@"NSEventModifierFlagCapsLock", 1 << 16), + MakeItem(@"NSEventModifierFlagShift", 1 << 17), + MakeItem(@"NSEventModifierFlagControl", 1 << 18), + MakeItem(@"NSEventModifierFlagOption", 1 << 19), + MakeItem(@"NSEventModifierFlagCommand", 1 << 20), + MakeItem(@"NSEventModifierFlagNumericPad", 1 << 21), + MakeItem(@"NSEventModifierFlagHelp", 1 << 22), + MakeItem(@"NSEventModifierFlagFunction", 1 << 23), + ]; + mData[@"NSScrollElasticity"] = @[ + MakeItem(@"NSScrollElasticityAutomatic", 0), + MakeItem(@"NSScrollElasticityNone", 1), + MakeItem(@"NSScrollElasticityAllowed", 2), + ]; + mData[@"NSBorderType"] = @[ + MakeItem(@"NSNoBorder", 0), + MakeItem(@"NSLineBorder", 1), + MakeItem(@"NSBezelBorder", 2), + MakeItem(@"NSGrooveBorder", 3), + ]; + mData[@"NSScrollerStyle"] = @[ + MakeItem(@"NSScrollerStyleLegacy", 0), + MakeItem(@"NSScrollerStyleOverlay", 1), + ]; + mData[@"NSScrollerKnobStyle"] = @[ + MakeItem(@"NSScrollerKnobStyleDefault", 0), + MakeItem(@"NSScrollerKnobStyleDark", 1), + MakeItem(@"NSScrollerKnobStyleLight", 2), + ]; + mData[@"NSTableViewColumnAutoresizingStyle"] = @[ + MakeItem(@"NSTableViewNoColumnAutoresizing", 0), + MakeItem(@"NSTableViewUniformColumnAutoresizingStyle", 1), + MakeItem(@"NSTableViewSequentialColumnAutoresizingStyle", 2), + MakeItem(@"NSTableViewReverseSequentialColumnAutoresizingStyle", 3), + MakeItem(@"NSTableViewLastColumnOnlyAutoresizingStyle", 4), + MakeItem(@"NSTableViewFirstColumnOnlyAutoresizingStyle", 5), + ]; + mData[@"NSTableViewGridLineStyle"] = @[ + MakeItem(@"NSTableViewGridNone", 0), + MakeItem(@"NSTableViewSolidVerticalGridLineMask", 1 << 0), + MakeItem(@"NSTableViewSolidHorizontalGridLineMask", 1 << 1), + MakeItem(@"NSTableViewDashedHorizontalGridLineMask", 1 << 3), + ]; + mData[@"NSTableViewRowSizeStyle"] = @[ + MakeItem(@"NSTableViewRowSizeStyleDefault", -1), + MakeItem(@"NSTableViewRowSizeStyleCustom", 0), + MakeItem(@"NSTableViewRowSizeStyleSmall", 1), + MakeItem(@"NSTableViewRowSizeStyleMedium", 2), + MakeItem(@"NSTableViewRowSizeStyleLarge", 3), + ]; + mData[@"NSTableViewStyle"] = @[ + MakeItem(@"NSTableViewStyleAutomatic", 0), + MakeItem(@"NSTableViewStyleFullWidth", 1), + MakeItem(@"NSTableViewStyleInset", 2), + MakeItem(@"NSTableViewStyleSourceList", 3), + MakeItem(@"NSTableViewStylePlain", 4), + ]; + mData[@"NSTableViewSelectionHighlightStyle"] = @[ + MakeItem(@"NSTableViewSelectionHighlightStyleNone", -1), + MakeItem(@"NSTableViewSelectionHighlightStyleRegular", 0), + MakeItem(@"NSTableViewSelectionHighlightStyleSourceList", 1), + ]; + mData[@"NSTableViewDraggingDestinationFeedbackStyle"] = @[ + MakeItem(@"NSTableViewDraggingDestinationFeedbackStyleNone", -1), + MakeItem(@"NSTableViewDraggingDestinationFeedbackStyleRegular", 0), + MakeItem(@"NSTableViewDraggingDestinationFeedbackStyleSourceList", 1), + MakeItem(@"NSTableViewDraggingDestinationFeedbackStyleGap", 2), + ]; + mData[@"NSUserInterfaceLayoutDirection"] = @[ + MakeItem(@"NSUserInterfaceLayoutDirectionLeftToRight", 0), + MakeItem(@"NSUserInterfaceLayoutDirectionRightToLeft", 1), + ]; + mData[@"NSVisualEffectMaterial"] = @[ + MakeItem(@"NSVisualEffectMaterialAppearanceBased", 0), + MakeItem(@"NSVisualEffectMaterialLight", 1), + MakeItem(@"NSVisualEffectMaterialDark", 2), + MakeItem(@"NSVisualEffectMaterialTitlebar", 3), + MakeItem(@"NSVisualEffectMaterialSelection", 4), + MakeItem(@"NSVisualEffectMaterialMenu", 5), + MakeItem(@"NSVisualEffectMaterialPopover", 6), + MakeItem(@"NSVisualEffectMaterialSidebar", 7), + MakeItem(@"NSVisualEffectMaterialMediumLight", 8), + MakeItem(@"NSVisualEffectMaterialUltraDark", 9), + MakeItem(@"NSVisualEffectMaterialHeaderView", 10), + MakeItem(@"NSVisualEffectMaterialSheet", 11), + MakeItem(@"NSVisualEffectMaterialWindowBackground", 12), + MakeItem(@"NSVisualEffectMaterialHUDWindow", 13), + MakeItem(@"NSVisualEffectMaterialFullScreenUI", 15), + MakeItem(@"NSVisualEffectMaterialToolTip", 17), + MakeItem(@"NSVisualEffectMaterialContentBackground", 18), + MakeItem(@"NSVisualEffectMaterialUnderWindowBackground", 21), + MakeItem(@"NSVisualEffectMaterialUnderPageBackground", 22), + ]; + mData[@"NSVisualEffectBlendingMode"] = @[ + MakeItem(@"NSVisualEffectBlendingModeBehindWindow", 0), + MakeItem(@"NSVisualEffectBlendingModeWithinWindow", 1), + ]; + mData[@"NSVisualEffectState"] = @[ + MakeItem(@"NSVisualEffectStateFollowsWindowActiveState", 0), + MakeItem(@"NSVisualEffectStateActive", 1), + MakeItem(@"NSVisualEffectStateInactive", 2), + ]; + mData[@"NSBackgroundStyle"] = @[ + MakeItem(@"NSBackgroundStyleNormal", 0), + MakeItem(@"NSBackgroundStyleEmphasized", 1), + MakeItem(@"NSBackgroundStyleRaised", 2), + MakeItem(@"NSBackgroundStyleLowered", 3), + ]; + mData[@"NSStackViewDistribution"] = @[ + MakeItem(@"NSStackViewDistributionGravityAreas", -1), + MakeItem(@"NSStackViewDistributionFill", 0), + MakeItem(@"NSStackViewDistributionFillEqually", 1), + MakeItem(@"NSStackViewDistributionFillProportionally", 2), + MakeItem(@"NSStackViewDistributionEqualSpacing", 3), + MakeItem(@"NSStackViewDistributionEqualCentering", 4), + ]; + mData[@"NSUserInterfaceLayoutOrientation"] = @[ + MakeItem(@"NSUserInterfaceLayoutOrientationHorizontal", 0), + MakeItem(@"NSUserInterfaceLayoutOrientationVertical", 1), + ]; + mData[@"NSLayoutAttribute"] = @[ + MakeItem(@"NSLayoutAttributeNotAnAttribute", 0), + MakeItem(@"NSLayoutAttributeLeft", 1), + MakeItem(@"NSLayoutAttributeRight", 2), + MakeItem(@"NSLayoutAttributeTop", 3), + MakeItem(@"NSLayoutAttributeBottom", 4), + MakeItem(@"NSLayoutAttributeLeading", 5), + MakeItem(@"NSLayoutAttributeTrailing", 6), + MakeItem(@"NSLayoutAttributeWidth", 7), + MakeItem(@"NSLayoutAttributeHeight", 8), + MakeItem(@"NSLayoutAttributeCenterX", 9), + MakeItem(@"NSLayoutAttributeCenterY", 10), + MakeItem(@"NSLayoutAttributeLastBaseline", 11), + MakeItem(@"NSLayoutAttributeFirstBaseline", 12), + ]; self.data = mData; } return self; diff --git a/LookinClient/Hierarchy/LKHierarchyDataSource.m b/LookinClient/Hierarchy/LKHierarchyDataSource.m index 00714626..7093b508 100644 --- a/LookinClient/Hierarchy/LKHierarchyDataSource.m +++ b/LookinClient/Hierarchy/LKHierarchyDataSource.m @@ -528,6 +528,9 @@ - (void)setRawFlatItems:(NSArray *)rawFlatItems { if (obj.layerObject.oid) { map[@(obj.layerObject.oid)] = obj; } + if (obj.windowObject.oid) { + map[@(obj.windowObject.oid)] = obj; + } }]; self.oidToDisplayItemMap = map; } diff --git a/LookinClient/Hierarchy/LKHierarchyRowView.m b/LookinClient/Hierarchy/LKHierarchyRowView.m index ca3dbfa9..e4e99c6c 100644 --- a/LookinClient/Hierarchy/LKHierarchyRowView.m +++ b/LookinClient/Hierarchy/LKHierarchyRowView.m @@ -326,7 +326,23 @@ - (NSImage *)resolveIconImage { @{@"UIButton": @"hierarchy_button"}, @{@"UIImageView": @"hierarchy_imageview"}, @{@"UIControl": @"hierarchy_control"}, - @{@"UIVisualEffectView": @"hierarchy_effectview"} + @{@"UIVisualEffectView": @"hierarchy_effectview"}, + + @{@"NSWindow": @"hierarchy_window"}, + @{@"NSTabView": @"hierarchy_tabbar"}, + @{@"NSTextView": @"hierarchy_textview"}, + @{@"NSStackView": @"hierarchy_stackview"}, + @{@"NSTextField": @"hierarchy_textfield"}, + @{@"NSTableView": @"hierarchy_tableview"}, + @{@"NSCollectionView": @"hierarchy_collectionview"}, + @{@"NSCollectionViewItem": @"hierarchy_collectioncell"}, + @{@"NSTableCellView": @"hierarchy_tablecell"}, + @{@"NSSlider": @"hierarchy_slider"}, + @{@"NSScrollView": @"hierarchy_scrollview"}, + @{@"NSButton": @"hierarchy_button"}, + @{@"NSImageView": @"hierarchy_imageview"}, + @{@"NSControl": @"hierarchy_control"}, + @{@"NSVisualEffectView": @"hierarchy_effectview"} ]; }); @@ -372,6 +388,8 @@ - (NSImage *)resolveIconImage { if (!imageName) { imageName = @"hierarchy_layer"; } + } else if (item.windowObject) { + imageName = @"hierarchy_window"; } if (!imageName) { diff --git a/LookinClient/Launch/LKLaunchAppView.m b/LookinClient/Launch/LKLaunchAppView.m index 42b9d0d9..b72db3f6 100644 --- a/LookinClient/Launch/LKLaunchAppView.m +++ b/LookinClient/Launch/LKLaunchAppView.m @@ -162,11 +162,13 @@ - (void)setApp:(LKInspectableApp *)app { self.iconImageView.image = NSImageMake(@"icon_simulator_big"); } else if (app.appInfo.deviceType == LookinAppInfoDeviceIPad) { self.iconImageView.image = NSImageMake(@"icon_ipad_big"); + } else if (app.appInfo.deviceType == LookinAppInfoDeviceMac) { + self.iconImageView.image = NSImageMake(@"icon_mac_big"); } else { self.iconImageView.image = NSImageMake(@"icon_iphone_big"); } self.titleLabel.stringValue = app.appInfo.deviceDescription; - self.subtitleLabel.stringValue = [NSString stringWithFormat:@"iOS %@", app.appInfo.osDescription]; + self.subtitleLabel.stringValue = [NSString stringWithFormat:@"%@", app.appInfo.osDescription]; } [self updateLayer]; diff --git a/LookinClient/Manager/LKPreferenceManager.m b/LookinClient/Manager/LKPreferenceManager.m index 2d1b97d6..01605ffe 100644 --- a/LookinClient/Manager/LKPreferenceManager.m +++ b/LookinClient/Manager/LKPreferenceManager.m @@ -449,7 +449,39 @@ - (void)hideSection:(LookinAttrSectionIdentifier)secID { LookinAttrSec_UITextField_Text, LookinAttrSec_UITextField_Font, LookinAttrSec_UITextField_TextColor, - LookinAttrSec_UITextField_Alignment + LookinAttrSec_UITextField_Alignment, + + LookinAttrSec_NSImageView_Name, + LookinAttrSec_NSImageView_Open, + + LookinAttrSec_NSControl_State, + LookinAttrSec_NSControl_ControlSize, + LookinAttrSec_NSControl_Font, + LookinAttrSec_NSControl_Alignment, + LookinAttrSec_NSControl_Value, + + LookinAttrSec_NSButton_Title, + LookinAttrSec_NSButton_Bordered, + LookinAttrSec_NSButton_Transparent, + LookinAttrSec_NSButton_ButtonType, + LookinAttrSec_NSButton_BezelStyle, + + LookinAttrSec_NSTextField_Bezeled, + LookinAttrSec_NSTextField_BezelStyle, + LookinAttrSec_NSTextField_Bordered, + LookinAttrSec_NSTextField_Editable, + LookinAttrSec_NSTextField_Selectable, + LookinAttrSec_NSTextField_TextColor, + LookinAttrSec_NSTextField_Placeholder, + + LookinAttrSec_NSTextView_String, + LookinAttrSec_NSTextView_Basic, + LookinAttrSec_NSTextView_Font, + LookinAttrSec_NSTextView_TextColor, + LookinAttrSec_NSTextView_Alignment, + LookinAttrSec_NSTextView_Size, + LookinAttrSec_NSTextView_ContainerInset, + ]; targetSet = [NSSet setWithArray:array]; }); diff --git a/LookinClient/Static/Preview/LKDisplayItemNode.m b/LookinClient/Static/Preview/LKDisplayItemNode.m index 04dae59f..33130ad2 100644 --- a/LookinClient/Static/Preview/LKDisplayItemNode.m +++ b/LookinClient/Static/Preview/LKDisplayItemNode.m @@ -10,6 +10,8 @@ #import "LookinDisplayItem.h" #import "LKPreferenceManager.h" #import "LKHierarchyDataSource.h" +#import "LookinHierarchyInfo.h" +#import "LookinAppInfo.h" @interface LKDisplayItemNode () @@ -25,6 +27,7 @@ @interface LKDisplayItemNode () @property(nonatomic, strong) SCNNode *maskNode; @property(nonatomic, strong) SCNPlane *maskPlane; +@property(nonatomic, assign) BOOL isMacTarget; @end @implementation LKDisplayItemNode @@ -34,7 +37,7 @@ - (instancetype)initWithDataSource:(LKHierarchyDataSource *)dataSource { if (self = [super init]) { self.dataSource = dataSource; - + self.isMacTarget = self.dataSource.rawHierarchyInfo.appInfo.deviceType == LookinAppInfoDeviceMac; self.contentPlane = [SCNPlane geometry]; self.contentPlane.firstMaterial.doubleSided = YES; self.contentPlane.firstMaterial.lightingModelName = SCNLightingModelConstant; @@ -245,9 +248,20 @@ - (void)displayItem:(LookinDisplayItem *)displayItem propertyDidChange:(LookinDi CGFloat height = frameToRoot.size.height; CGFloat xOffSet = -self.screenSize.width / 2; CGFloat yOffSet = self.screenSize.height / 2; - CGFloat transformedX = (originX + width / 2 + xOffSet) ; - CGFloat transformedY = (-(originY + height / 2) + yOffSet); + CGFloat transformedX = 0; + CGFloat transformedY = 0; + + if (self.isMacTarget) { + transformedX = (originX + width / 2 + xOffSet); + // Mac的坐标系本身就是 y 轴向上,所以这里不用取反 + transformedY = (originY + height / 2 - yOffSet); + } else { + transformedX = (originX + width / 2 + xOffSet) ; + // iOS坐标系是 y 轴向下,所以这里要取反 + transformedY = (-(originY + height / 2) + yOffSet); + } + CGFloat factor = 0.01; self.contentPlane.width = width * factor; diff --git a/LookinClient/Toolbar/LKWindowToolbarAppButton.m b/LookinClient/Toolbar/LKWindowToolbarAppButton.m index 93e9ab52..834742d6 100644 --- a/LookinClient/Toolbar/LKWindowToolbarAppButton.m +++ b/LookinClient/Toolbar/LKWindowToolbarAppButton.m @@ -93,6 +93,9 @@ - (void)setAppInfo:(LookinAppInfo *)appInfo { case LookinAppInfoDeviceOthers: deviceIcon = NSImageMake(@"icon_iphone_small"); break; + case LookinAppInfoDeviceMac: + deviceIcon = NSImageMake(@"icon_mac_small"); + break; default: deviceIcon = NSImageMake(@"icon_simulator_small"); break;