diff --git a/PreviewAssistant.xcodeproj/project.pbxproj b/PreviewAssistant.xcodeproj/project.pbxproj index 14b804c..355f008 100644 --- a/PreviewAssistant.xcodeproj/project.pbxproj +++ b/PreviewAssistant.xcodeproj/project.pbxproj @@ -9,7 +9,6 @@ /* Begin PBXBuildFile section */ 2B698D6D1AD441D10012F1DB /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B698D5B1AD441D10012F1DB /* AppDelegate.m */; }; 2B698D6E1AD441D10012F1DB /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2B698D5D1AD441D10012F1DB /* MainMenu.xib */; }; - 2B698D6F1AD441D10012F1DB /* globalkeypress.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B698D5F1AD441D10012F1DB /* globalkeypress.c */; }; 2B698D701AD441D10012F1DB /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2B698D601AD441D10012F1DB /* Images.xcassets */; }; 2B698D711AD441D10012F1DB /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 2B698D611AD441D10012F1DB /* Info.plist */; }; 2B698D721AD441D10012F1DB /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2B698D631AD441D10012F1DB /* main.m */; }; @@ -35,7 +34,6 @@ 2B698D5B1AD441D10012F1DB /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 2B698D5C1AD441D10012F1DB /* Assistant.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Assistant.h; sourceTree = ""; }; 2B698D5E1AD441D10012F1DB /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; - 2B698D5F1AD441D10012F1DB /* globalkeypress.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = globalkeypress.c; sourceTree = ""; }; 2B698D601AD441D10012F1DB /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 2B698D611AD441D10012F1DB /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 2B698D621AD441D10012F1DB /* KeyCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyCode.h; sourceTree = ""; }; @@ -80,7 +78,6 @@ 2B698D5B1AD441D10012F1DB /* AppDelegate.m */, 2B698D5C1AD441D10012F1DB /* Assistant.h */, 2B698D5D1AD441D10012F1DB /* MainMenu.xib */, - 2B698D5F1AD441D10012F1DB /* globalkeypress.c */, 2B698D601AD441D10012F1DB /* Images.xcassets */, 2B698D611AD441D10012F1DB /* Info.plist */, 2B698D621AD441D10012F1DB /* KeyCode.h */, @@ -238,7 +235,6 @@ 2B698D741AD441D10012F1DB /* MyWindow.m in Sources */, 2B698D731AD441D10012F1DB /* MyLabel.m in Sources */, 2B698D6D1AD441D10012F1DB /* AppDelegate.m in Sources */, - 2B698D6F1AD441D10012F1DB /* globalkeypress.c in Sources */, 2B698D751AD441D10012F1DB /* UIElementInfo.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -356,6 +352,7 @@ COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = PreviewAssistant/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -367,6 +364,7 @@ COMBINE_HIDPI_IMAGES = YES; INFOPLIST_FILE = PreviewAssistant/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.10; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; diff --git a/PreviewAssistant.xcodeproj/project.xcworkspace/xcuserdata/milu.xcuserdatad/UserInterfaceState.xcuserstate b/PreviewAssistant.xcodeproj/project.xcworkspace/xcuserdata/milu.xcuserdatad/UserInterfaceState.xcuserstate index fc260aa..97cff2d 100644 Binary files a/PreviewAssistant.xcodeproj/project.xcworkspace/xcuserdata/milu.xcuserdatad/UserInterfaceState.xcuserstate and b/PreviewAssistant.xcodeproj/project.xcworkspace/xcuserdata/milu.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PreviewAssistant.xcodeproj/xcuserdata/milu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/PreviewAssistant.xcodeproj/xcuserdata/milu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 918b4c6..a901511 100644 --- a/PreviewAssistant.xcodeproj/xcuserdata/milu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/PreviewAssistant.xcodeproj/xcuserdata/milu.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -186,11 +186,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "PreviewAssistant/MyLabel.m" - timestampString = "450116958.889416" + timestampString = "450121672.46165" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "185" - endingLineNumber = "185" + startingLineNumber = "187" + endingLineNumber = "187" landmarkName = "-performAction" landmarkType = "5"> @@ -227,5 +227,37 @@ landmarkType = "5"> + + + + + + + + diff --git a/PreviewAssistant/MyLabel.m b/PreviewAssistant/MyLabel.m index fa3e74e..b6ac295 100644 --- a/PreviewAssistant/MyLabel.m +++ b/PreviewAssistant/MyLabel.m @@ -117,6 +117,8 @@ - (void) updateLabel - (void) updateColor { + if(s == nil) + return; NSString *str = s; NSMutableAttributedString *attrstr = [[NSMutableAttributedString alloc] initWithString:str]; diff --git a/PreviewAssistant/Utility.h b/PreviewAssistant/Utility.h index 346aebd..4068356 100644 --- a/PreviewAssistant/Utility.h +++ b/PreviewAssistant/Utility.h @@ -396,12 +396,13 @@ NSPointerArray* getAppMainWindow() for(int i = 0;i < CFArrayGetCount(windows);++i) { AXUIElementRef window = (AXUIElementRef) CFArrayGetValueAtIndex(windows, i); - CFBooleanRef main; - AXUIElementCopyAttributeValue(window,kAXMainAttribute,(CFTypeRef *)&main); - if(main == kCFBooleanTrue) - { - [arr addPointer:window]; - } + [arr addPointer:window]; +// CFBooleanRef main; +// AXUIElementCopyAttributeValue(window,kAXMainAttribute,(CFTypeRef *)&main); +// if(main == kCFBooleanTrue) +// { +// [arr addPointer:window]; +// } // AXUIElementCopyAttributeValue(window,kAXMainAttribute,(CFTypeRef *)&main); @@ -566,16 +567,6 @@ void enumWindowChildren(AXUIElementRef elem,NSMutableArray* arr) return; // 2. return close btn - if([info.role isEqualToString:@"AXButton"]) - { - NSArray* ignore = [[NSArray alloc] initWithObjects:@"AXCloseButton",@"AXZoomButton",@"AXMinimizeButton",@"AXFullScreenButton",nil]; - if([ignore containsObject:info.subRole]) - return; - info.type = buttonType; - [arr addObject:info]; - return; - } - // 3. non-inputable AXSearchField if(info.subRole != nil && [info.subRole isEqualToString:@"AXSearchField"]) { @@ -598,10 +589,73 @@ void enumWindowChildren(AXUIElementRef elem,NSMutableArray* arr) return; } + if([info.role isEqualToString:@"AXTextArea"]) + { + info.type = input; + [arr addObject:info]; + return; + } // 4. AXRow if([info.role isEqualToString:@"AXRow"]) { - info.type = inputType; + error = AXUIElementCopyAttributeValue(elem, kAXChildrenAttribute, (CFTypeRef *)&cfchilds); + if(error != kAXErrorSuccess || cfchilds == nil) + { + info.type = input; + [arr addObject:info]; + return; + } + AXUIElementRef btn_ = nil; + AXUIElementRef input_ = nil; + AXUIElementRef cell_ = nil; + UIElementInfo* info_ = nil; + for(int i = 0;i < CFArrayGetCount(cfchilds);++i) + { + AXUIElementRef child = (AXUIElementRef) CFArrayGetValueAtIndex( cfchilds, i); + info_ = getUIElementInfo(child); + if([info_.role isEqualToString:@"AXCell"]) + { + cell_ = info_.ref; + break; + } + if([info_.role isEqualToString:@"AXButton"]) + { + btn_ = info_.ref; + } + else if([info_.role isEqualToString:@"AXTextField"]) + { + input_ = info_.ref; + break; + } + } + + if(cell_ == nil && btn_ == nil && input_ == nil) + { + info.type = input; + [arr addObject:info]; + return; + } + else if(cell_ == nil && input_ != nil) + { + info_.type = input; + [arr addObject:info_]; + return; + } + else if(cell_ == nil && btn_ != nil) + { + info_.type = button; + [arr addObject:info_]; + return; + } + + } + // btn + if([info.role isEqualToString:@"AXButton"]) + { + NSArray* ignore = [[NSArray alloc] initWithObjects:@"AXCloseButton",@"AXZoomButton",@"AXMinimizeButton",@"AXFullScreenButton",nil]; + if([ignore containsObject:info.subRole]) + return; + info.type = buttonType; [arr addObject:info]; return; } @@ -618,13 +672,11 @@ void enumWindowChildren(AXUIElementRef elem,NSMutableArray* arr) info.type = buttonType; [arr addObject:info]; return; - } if([info.role isEqualToString:@"AXTable"] || [info.role isEqualToString:@"AXOutline"]) { error = AXUIElementCopyAttributeValue(elem, kAXVisibleRowsAttribute, (CFTypeRef *)&cfchilds); - } else { diff --git a/PreviewAssistant/WindowController.m b/PreviewAssistant/WindowController.m index c0f75a3..3bf0d05 100644 --- a/PreviewAssistant/WindowController.m +++ b/PreviewAssistant/WindowController.m @@ -643,7 +643,7 @@ - (bool) handleKeyPress_:(CGKeyCode) k if(duration < 10000) { [self toReady]; - return true; + return false; } } }