From 13b6207834068fbde2084d020c586d3201a3e8b8 Mon Sep 17 00:00:00 2001 From: Rex Feany Date: Wed, 30 Nov 2011 20:29:24 -0800 Subject: [PATCH] first working pass --- .gitignore | 1 + usblister.xcodeproj/project.pbxproj | 18 +- usblister/OutlineData.h | 18 + usblister/OutlineData.m | 91 ++ usblister/en.lproj/MainMenu.xib | 1927 ++++++++++++++++----------- usblister/usblisterAppDelegate.h | 24 +- usblister/usblisterAppDelegate.m | 111 ++ 7 files changed, 1418 insertions(+), 772 deletions(-) create mode 100644 .gitignore create mode 100644 usblister/OutlineData.h create mode 100644 usblister/OutlineData.m diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/usblister.xcodeproj/project.pbxproj b/usblister.xcodeproj/project.pbxproj index c5ce080..ab1c899 100644 --- a/usblister.xcodeproj/project.pbxproj +++ b/usblister.xcodeproj/project.pbxproj @@ -7,28 +7,33 @@ objects = { /* Begin PBXBuildFile section */ + 4131B1C7134F7FA800DBE700 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4131B1C6134F7FA800DBE700 /* IOKit.framework */; }; 419B835C134F7BF60040C6E2 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 419B835B134F7BF60040C6E2 /* Cocoa.framework */; }; 419B8366134F7BF60040C6E2 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 419B8364134F7BF60040C6E2 /* InfoPlist.strings */; }; 419B8369134F7BF60040C6E2 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 419B8368134F7BF60040C6E2 /* main.m */; }; 419B836C134F7BF60040C6E2 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 419B836A134F7BF60040C6E2 /* Credits.rtf */; }; 419B836F134F7BF60040C6E2 /* usblisterAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 419B836E134F7BF60040C6E2 /* usblisterAppDelegate.m */; }; 419B8372134F7BF60040C6E2 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 419B8370134F7BF60040C6E2 /* MainMenu.xib */; }; + 41EC82CB134FD82900088371 /* OutlineData.m in Sources */ = {isa = PBXBuildFile; fileRef = 41EC82CA134FD82900088371 /* OutlineData.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 4131B1C6134F7FA800DBE700 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; 419B8357134F7BF60040C6E2 /* usblister.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = usblister.app; sourceTree = BUILT_PRODUCTS_DIR; }; 419B835B134F7BF60040C6E2 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; 419B835E134F7BF60040C6E2 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; 419B835F134F7BF60040C6E2 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 419B8360134F7BF60040C6E2 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 419B8363134F7BF60040C6E2 /* usblister-Info.plist */ = {isa = PBXFileReference; path = "usblister-Info.plist"; sourceTree = ""; }; + 419B8363134F7BF60040C6E2 /* usblister-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "usblister-Info.plist"; sourceTree = ""; }; 419B8365134F7BF60040C6E2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; - 419B8367134F7BF60040C6E2 /* usblister-Prefix.pch */ = {isa = PBXFileReference; path = "usblister-Prefix.pch"; sourceTree = ""; }; + 419B8367134F7BF60040C6E2 /* usblister-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "usblister-Prefix.pch"; sourceTree = ""; }; 419B8368134F7BF60040C6E2 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 419B836B134F7BF60040C6E2 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; - 419B836D134F7BF60040C6E2 /* usblisterAppDelegate.h */ = {isa = PBXFileReference; path = usblisterAppDelegate.h; sourceTree = ""; }; + 419B836D134F7BF60040C6E2 /* usblisterAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = usblisterAppDelegate.h; sourceTree = ""; }; 419B836E134F7BF60040C6E2 /* usblisterAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = usblisterAppDelegate.m; sourceTree = ""; }; 419B8371134F7BF60040C6E2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; + 41EC82C9134FD82900088371 /* OutlineData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OutlineData.h; sourceTree = ""; }; + 41EC82CA134FD82900088371 /* OutlineData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OutlineData.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -36,6 +41,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 4131B1C7134F7FA800DBE700 /* IOKit.framework in Frameworks */, 419B835C134F7BF60040C6E2 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -63,6 +69,7 @@ 419B835A134F7BF60040C6E2 /* Frameworks */ = { isa = PBXGroup; children = ( + 4131B1C6134F7FA800DBE700 /* IOKit.framework */, 419B835B134F7BF60040C6E2 /* Cocoa.framework */, 419B835D134F7BF60040C6E2 /* Other Frameworks */, ); @@ -86,6 +93,8 @@ 419B836E134F7BF60040C6E2 /* usblisterAppDelegate.m */, 419B8370134F7BF60040C6E2 /* MainMenu.xib */, 419B8362134F7BF60040C6E2 /* Supporting Files */, + 41EC82C9134FD82900088371 /* OutlineData.h */, + 41EC82CA134FD82900088371 /* OutlineData.m */, ); path = usblister; sourceTree = ""; @@ -128,6 +137,7 @@ 419B834E134F7BF60040C6E2 /* Project object */ = { isa = PBXProject; attributes = { + LastUpgradeCheck = 0420; ORGANIZATIONNAME = "Fnordsoft, Inc."; }; buildConfigurationList = 419B8351134F7BF60040C6E2 /* Build configuration list for PBXProject "usblister" */; @@ -167,6 +177,7 @@ files = ( 419B8369134F7BF60040C6E2 /* main.m in Sources */, 419B836F134F7BF60040C6E2 /* usblisterAppDelegate.m in Sources */, + 41EC82CB134FD82900088371 /* OutlineData.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -281,6 +292,7 @@ 419B8377134F7BF60040C6E2 /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/usblister/OutlineData.h b/usblister/OutlineData.h new file mode 100644 index 0000000..f1a07b2 --- /dev/null +++ b/usblister/OutlineData.h @@ -0,0 +1,18 @@ +// +// OutlineData.h +// usblister +// +// Created by Rex Feany on 4/8/11. +// Copyright 2011 Fnordsoft, Inc. All rights reserved. +// + +#import + + +@interface OutlineData : NSObject { + NSArray *data; +} + +@property (retain, nonatomic) NSArray *data; + +@end diff --git a/usblister/OutlineData.m b/usblister/OutlineData.m new file mode 100644 index 0000000..f2ffc26 --- /dev/null +++ b/usblister/OutlineData.m @@ -0,0 +1,91 @@ +// +// OutlineData.m +// usblister +// +// Created by Rex Feany on 4/8/11. +// Copyright 2011 Fnordsoft, Inc. All rights reserved. +// + +#import "OutlineData.h" + + +@implementation OutlineData + +@synthesize data; + +- (id)init { + self = [super init]; + if (self) { + // Initialization code here. + } + return self; +} + +- (void)dealloc { + self.data = nil; + [super dealloc]; +} + +static BOOL is_array(id item) { + return ([item isKindOfClass:[NSArray class]]); +} + +// How many children does this object have? +- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { + // The root node is special; if the NSOutline view asks for the children of nil, + // we give it the count of the root dictionary. + if (item == nil) { + return [self.data count]; + } + + // otherwise the item will be an array.. + if (is_array(item) && is_array([item objectAtIndex:1])) { + return [[item objectAtIndex:1] count]; + } + return 0; +} + +// Can the item be expanded? If the value of the k/v pair is an array, yes! +- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { + if (is_array(item) && is_array([item objectAtIndex:1])) + return YES; + return NO; +} + +// child at index of this item +- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item { + if (item == nil) + return [data objectAtIndex:index]; + + NSArray *row = [item objectAtIndex:1]; + + if (is_array(row)) + return [row objectAtIndex:index]; + + return nil; +} + +// column data for child at index +- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { + if ([outlineView levelForItem:item] == 0) { + if ([[tableColumn identifier] isEqualToString:@"name"]) { + return [item objectAtIndex:0]; + } + } else { + + if ([[tableColumn identifier] isEqualToString:@"name"]) { + return [item objectAtIndex:0]; + } + + if ([[tableColumn identifier] isEqualToString:@"value"]) { + if (is_array([item objectAtIndex:1])) { + return @""; + } else { + return [item objectAtIndex:1]; + } + } + } + return @""; +} + +@end diff --git a/usblister/en.lproj/MainMenu.xib b/usblister/en.lproj/MainMenu.xib index 87ff96f..8b7085f 100644 --- a/usblister/en.lproj/MainMenu.xib +++ b/usblister/en.lproj/MainMenu.xib @@ -1,32 +1,44 @@ - 1060 - 10A324 - 719 - 1015 - 418.00 + 1070 + 11C74 + 1938 + 1138.23 + 567.00 com.apple.InterfaceBuilder.CocoaPlugin - 719 + 1938 - + YES - - + NSTableColumn + NSToolbar + NSToolbarFlexibleSpaceItem + NSScroller + NSMenuItem + NSMenu + NSScrollView + NSTextFieldCell + NSToolbarSpaceItem + NSTableHeaderView + NSToolbarSeparatorItem + NSTabView + NSOutlineView + NSCustomObject + NSTabViewItem + NSView + NSWindowTemplate + NSTextView + NSToolbarItem YES com.apple.InterfaceBuilder.CocoaPlugin - YES - - YES - - - YES - + PluginDependencyRecalculationVersion + YES @@ -1322,16 +1334,643 @@ 1954021376 usblister NSWindow - - {1.79769e+308, 1.79769e+308} + + + DF7691C0-CD87-4761-BCC6-37192034D96B + + + YES + YES + YES + NO + 1 + 1 + + YES + + YES + 6B9BF421-F8D4-4A8F-89D7-55F8E973140D + 80F83801-C55D-4DA3-8AE1-598C2453526D + NSToolbarCustomizeToolbarItem + NSToolbarFlexibleSpaceItem + NSToolbarSeparatorItem + NSToolbarSpaceItem + + + YES + + + 6B9BF421-F8D4-4A8F-89D7-55F8E973140D + + Save + Save + + + + NSImage + NSMultipleDocuments + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + + 80F83801-C55D-4DA3-8AE1-598C2453526D + + Rescan + Rescan + + + + NSImage + NSRefreshTemplate + + + + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarCustomizeToolbarItem + Customize + Customize + Customize Toolbar + + + NSImage + NSToolbarCustomizeToolbarItemImage + + + runToolbarCustomizationPalette: + {0, 0} + {0, 0} + YES + YES + -1 + YES + 0 + + + NSToolbarFlexibleSpaceItem + + Flexible Space + + + + + + {1, 5} + {20000, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + NSToolbarSeparatorItem + + Separator + + + + + + {12, 5} + {12, 1000} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + NSToolbarSpaceItem + + Space + + + + + + {32, 5} + {32, 32} + YES + YES + -1 + YES + 0 + + YES + YES + + + 1048576 + 2147483647 + + + + + + + + YES + + + + + + + + + YES + + + + + + + + + YES + + + 256 + + YES + + + 18 + {{-8, -10}, {496, 364}} + + + + + YES + + 1 + + + 256 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 256 + {500, 281} + + + + YES + + + 256 + {500, 17} + + + + + + + + -2147483392 + {{224, 0}, {16, 17}} + + + YES + + name + 252 + 16 + 1000 + + 75628096 + 2048 + Name + + LucidaGrande + 11 + 3100 + + + 3 + MC4zMzMzMzI5ODU2AA + + + 6 + System + headerTextColor + + 3 + MAA + + + + + 337772096 + 33556480 + Text Cell + + LucidaGrande + 13 + 1044 + + + + 6 + System + controlBackgroundColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 6 + System + controlTextColor + + + + 3 + YES + + + + value + 242 + 10 + 3.4028234663852886e+38 + + 75628096 + 2048 + Value + + + 6 + System + headerColor + + 3 + MQA + + + + + + 337772096 + 33556480 + Text Cell + + + + + + 3 + YES + + + + 3 + 2 + + + 6 + System + gridColor + + 3 + MC41AA + + + 17 + 1379926016 + + + 4 + 15 + 0 + YES + 0 + 1 + + + {{0, 17}, {442, 281}} + + + + + + 6 + + + + -2147483392 + {{427, 0}, {15, 283}} + + + + + _doScroller: + 0.99645390070921991 + + + + 256 + {{0, 283}, {442, 15}} + + + + YES + 1 + + _doScroller: + 0.88400000000000001 + + + + 2304 + + YES + + + {442, 17} + + + + + + 4 + + + {{17, 17}, {442, 298}} + + + + 133808 + + + + + QSAAAEEgAABBmAAAQZgAAA + + + {{10, 33}, {476, 318}} + + + + + Cooked + + 6 + System + controlColor + + + + + + 2 + + + 256 + + YES + + + 274 + + YES + + + 2304 + + YES + + + 2322 + {{0, 20}, {440, 14}} + + + + + + + + + + + + YES + + + 134 + + + + 440 + 1 + + + 67120389 + 0 + + + + YES + + YES + NSBackgroundColor + NSColor + + + YES + + 6 + System + selectedTextBackgroundColor + + + + 6 + System + selectedTextColor + + + + + + + YES + + YES + NSColor + NSCursor + NSUnderline + + + YES + + 1 + MCAwIDEAA + + + {8, -8} + 13 + + + + + + + 1 + + 6 + {463, 10000000} + {223, 0} + + + + {{1, 1}, {440, 296}} + + + + + 1 + MSAxIDEAA + + + {4, 5} + + 12582912 + + YES + + YES + + + + TU0AKgAAAHCAFUqgBVKsAAAAwdVQUqwaEQeIRGJRGFlYqwWLQ+JxuOQpVRmEx2RROKwOQyOUQSPyaUym +SxqWyKXyeYxyZzWbSuJTScRCbz2Nz+gRKhUOfTqeUai0OSxiWTiBQSHSGFquGwekxyAgAAAOAQAAAwAA +AAEAEAAAAQEAAwAAAAEAEAAAAQIAAwAAAAIACAAIAQMAAwAAAAEABQAAAQYAAwAAAAEAAQAAAREABAAA +AAEAAAAIARIAAwAAAAEAAQAAARUAAwAAAAEAAgAAARYAAwAAAAEAEAAAARcABAAAAAEAAABnARwAAwAA +AAEAAQAAAT0AAwAAAAEAAgAAAVIAAwAAAAEAAQAAAVMAAwAAAAIAAQABAAAAAA + + + + + + 3 + MCAwAA + + + + 4 + + + + -2147483392 + {{424, 1}, {15, 263}} + + + + _doScroller: + 1 + 0.85256409645080566 + + + + -2147483392 + {{1, 264}, {423, 15}} + + 1 + + _doScroller: + 1 + 0.94565218687057495 + + + {{17, 17}, {442, 298}} + + + 133682 + + + + + + {{10, 33}, {476, 318}} + + + Raw + + + + + + + 0 + YES + YES + + YES + + + + {480, 360} + + {{0, 0}, {1920, 1178}} - {1.79769e+308, 1.79769e+308} + {10000000000000, 10000000000000} + YES usblisterAppDelegate @@ -1343,6 +1982,22 @@ YES + + + terminate: + + + + 449 + + + + orderFrontStandardAboutPanel: + + + + 142 + performMiniaturize: @@ -1383,14 +2038,6 @@ 127 - - - orderFrontStandardAboutPanel: - - - - 142 - performClose: @@ -1631,46 +2278,6 @@ 374 - - - addFontTrait: - - - - 421 - - - - addFontTrait: - - - - 422 - - - - modifyFont: - - - - 423 - - - - orderFrontFontPanel: - - - - 424 - - - - modifyFont: - - - - 425 - raiseBaseline: @@ -1799,14 +2406,6 @@ 441 - - - terminate: - - - - 449 - toggleAutomaticSpellingCorrection: @@ -1903,14 +2502,6 @@ 493 - - - delegate - - - - 495 - alignCenter: @@ -2015,6 +2606,46 @@ 530 + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + window @@ -2023,6 +2654,54 @@ 532 + + + field + + + + 549 + + + + scanClick: + + + + 574 + + + + saveClick: + + + + 575 + + + + tabs + + + + 576 + + + + outline + + + + 577 + + + + delegate + + + + 548 + @@ -2065,6 +2744,7 @@ + Main Menu 19 @@ -2570,12 +3250,17 @@ YES + 372 + + YES + + @@ -3064,153 +3749,261 @@ - - - - YES - - YES - -3.IBPluginDependency - 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 + + 552 + + + YES + + + + + + + + + + + 559 + + + + + 557 + + + + + 556 + + + + + 555 + + + + + 554 + + + + + 553 + + + + + 560 + + + YES + + + + + + + 561 + + + YES + + + + + + 562 + + + YES + + + + + + 563 + + + YES + + + + + + 564 + + + YES + + + + + + 542 + + + YES + + + + + + + + 543 + + + + + 544 + + + + + 545 + + + + + 565 + + + YES + + + + + + + + + 566 + + + + + 568 + + + + + 569 + + + YES + + + + + + + 570 + + + YES + + + + Table Column - Name + + + 573 + + + + + 578 + + + YES + + + + + + 579 + + + + + 580 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 112.IBPluginDependency + 124.IBPluginDependency + 125.IBPluginDependency + 126.IBPluginDependency + 129.IBPluginDependency + 130.IBPluginDependency + 131.IBPluginDependency 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.IBEditorWindowLastContentRect 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.IBEditorWindowLastContentRect 220.IBPluginDependency - 220.ImportedFromIB2 - 220.editorWindowContentRectSynchronizationRect 221.IBPluginDependency - 221.ImportedFromIB2 23.IBPluginDependency - 23.ImportedFromIB2 236.IBPluginDependency - 236.ImportedFromIB2 239.IBPluginDependency - 239.ImportedFromIB2 - 24.IBEditorWindowLastContentRect 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.IBEditorWindowLastContentRect 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 - 371.windowTemplate.maxSize 372.IBPluginDependency 375.IBPluginDependency - 376.IBEditorWindowLastContentRect 376.IBPluginDependency 377.IBPluginDependency - 388.IBEditorWindowLastContentRect 388.IBPluginDependency 389.IBPluginDependency 390.IBPluginDependency @@ -3243,8 +4036,8 @@ 417.IBPluginDependency 418.IBPluginDependency 419.IBPluginDependency + 420.IBPluginDependency 450.IBPluginDependency - 451.IBEditorWindowLastContentRect 451.IBPluginDependency 452.IBPluginDependency 453.IBPluginDependency @@ -3257,16 +4050,14 @@ 466.IBPluginDependency 485.IBPluginDependency 490.IBPluginDependency - 491.IBEditorWindowLastContentRect 491.IBPluginDependency 492.IBPluginDependency + 494.IBPluginDependency 496.IBPluginDependency - 497.IBEditorWindowLastContentRect 497.IBPluginDependency 498.IBPluginDependency 499.IBPluginDependency 5.IBPluginDependency - 5.ImportedFromIB2 500.IBPluginDependency 501.IBPluginDependency 502.IBPluginDependency @@ -3275,7 +4066,6 @@ 505.IBPluginDependency 506.IBPluginDependency 507.IBPluginDependency - 508.IBEditorWindowLastContentRect 508.IBPluginDependency 509.IBPluginDependency 510.IBPluginDependency @@ -3286,184 +4076,116 @@ 515.IBPluginDependency 516.IBPluginDependency 517.IBPluginDependency + 542.IBPluginDependency + 543.IBPluginDependency + 544.IBPluginDependency + 545.IBPluginDependency + 552.IBPluginDependency + 553.IBPluginDependency + 554.IBPluginDependency + 555.IBPluginDependency + 556.IBPluginDependency + 557.IBPluginDependency + 559.IBPluginDependency 56.IBPluginDependency - 56.ImportedFromIB2 - 57.IBEditorWindowLastContentRect + 560.IBPluginDependency + 561.IBPluginDependency + 562.IBPluginDependency + 563.IBPluginDependency + 564.IBPluginDependency + 565.IBPluginDependency + 566.IBPluginDependency + 568.IBPluginDependency + 569.IBPluginDependency 57.IBPluginDependency - 57.ImportedFromIB2 - 57.editorWindowContentRectSynchronizationRect + 570.IBPluginDependency + 573.IBPluginDependency + 578.IBPluginDependency + 579.IBPluginDependency 58.IBPluginDependency - 58.ImportedFromIB2 + 580.IBPluginDependency 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.IBEditorWindowLastContentRect 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 - 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 - - {{753, 187}, {275, 113}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {275, 83}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{547, 180}, {254, 283}} 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 - - {{753, 217}, {238, 103}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {241, 103}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{654, 239}, {194, 73}} com.apple.InterfaceBuilder.CocoaPlugin - - {{525, 802}, {197, 73}} - {{380, 836}, {512, 20}} com.apple.InterfaceBuilder.CocoaPlugin - - {74, 862} - {{6, 978}, {478, 20}} com.apple.InterfaceBuilder.CocoaPlugin - {{604, 269}, {231, 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 - - {{746, 287}, {220, 133}} com.apple.InterfaceBuilder.CocoaPlugin - - {{608, 612}, {215, 63}} com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - {{380, 496}, {480, 360}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{380, 496}, {480, 360}} - {{33, 99}, {480, 360}} - {3.40282e+38, 3.40282e+38} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{591, 420}, {83, 43}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{523, 2}, {178, 283}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3497,7 +4219,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{753, 197}, {170, 63}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3510,16 +4231,13 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{725, 289}, {246, 23}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{674, 260}, {204, 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 @@ -3528,7 +4246,6 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - {{878, 180}, {164, 173}} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -3540,139 +4257,68 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - {{286, 129}, {275, 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 - - {{452, 109}, {196, 203}} com.apple.InterfaceBuilder.CocoaPlugin - - {{145, 474}, {199, 203}} 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 + 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 YES - - YES - + YES - - YES - + - 532 + 581 YES - - usblisterAppDelegate - NSObject - - window - NSWindow - - - IBProjectSource - usblisterAppDelegate.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 - - NSDocument - NSObject YES @@ -3694,426 +4340,171 @@ id - - IBFrameworkSource - AppKit.framework/Headers/NSDocument.h + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + - - - NSDocument - IBFrameworkSource - AppKit.framework/Headers/NSDocumentScripting.h + IBProjectSource + ./Classes/NSDocument.h - NSDocumentController + usblisterAppDelegate NSObject YES YES - clearRecentDocuments: - newDocument: - openDocument: - saveAllDocuments: + saveClick: + scanClick: YES id id - id - id - - IBFrameworkSource - AppKit.framework/Headers/NSDocumentController.h - - - - NSFontManager - NSObject - - IBFrameworkSource - AppKit.framework/Headers/NSFontManager.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 - - - - 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 - - - - 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 + + YES + + YES + saveClick: + scanClick: + + + YES + + saveClick: + id + + + scanClick: + id + + - - - NSView - NSResponder - - - - NSWindow - - IBFrameworkSource - AppKit.framework/Headers/NSDrawer.h + + YES + + YES + button + field + outline + tabs + window + + + YES + NSButton + NSTextView + NSOutlineView + NSTabView + NSWindow + - - - NSWindow - NSResponder - - IBFrameworkSource - AppKit.framework/Headers/NSWindow.h + + YES + + YES + button + field + outline + tabs + window + + + YES + + button + NSButton + + + field + NSTextView + + + outline + NSOutlineView + + + tabs + NSTabView + + + window + NSWindow + + - - - NSWindow - IBFrameworkSource - AppKit.framework/Headers/NSWindowScripting.h + IBProjectSource + ./Classes/usblisterAppDelegate.h 0 - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - + IBCocoaFramework com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 YES - ../usblister.xcodeproj 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + NSMultipleDocuments + NSRefreshTemplate + NSToolbarCustomizeToolbarItemImage + + + YES + {9, 8} + {7, 2} + {32, 32} + {10, 12} + {32, 32} + + diff --git a/usblister/usblisterAppDelegate.h b/usblister/usblisterAppDelegate.h index df8bc34..5c4e4bb 100644 --- a/usblister/usblisterAppDelegate.h +++ b/usblister/usblisterAppDelegate.h @@ -8,11 +8,33 @@ #import -@interface usblisterAppDelegate : NSObject { +@class OutlineData; + +@interface usblisterAppDelegate : NSObject { @private NSWindow *window; + NSButton *button; + NSOutlineView *outline; + NSTextView *field; + + NSMutableArray *hash_a; + NSMutableArray *array_a; + + NSTabView *tabs; + OutlineData *data; } @property (assign) IBOutlet NSWindow *window; +@property (retain, nonatomic) IBOutlet NSButton *button; +@property (retain, nonatomic) IBOutlet NSTextView *field; +@property (retain, nonatomic) NSMutableArray *hash_a; +@property (retain, nonatomic) NSMutableArray *array_a; +@property (retain, nonatomic) IBOutlet NSTabView *tabs; +@property (retain, nonatomic) IBOutlet NSOutlineView *outline; +@property (retain, nonatomic) OutlineData *data; + +- (IBAction)scanClick:(id)sender; +- (IBAction)saveClick:(id)sender; + @end diff --git a/usblister/usblisterAppDelegate.m b/usblister/usblisterAppDelegate.m index 94f358c..68c02da 100644 --- a/usblister/usblisterAppDelegate.m +++ b/usblister/usblisterAppDelegate.m @@ -8,13 +8,124 @@ #import "usblisterAppDelegate.h" +#include +#include +#include +#include + +#import "OutlineData.h" + @implementation usblisterAppDelegate @synthesize window; +@synthesize field; +@synthesize button; +@synthesize hash_a; +@synthesize array_a; +@synthesize tabs; +@synthesize data; +@synthesize outline; + +static NSArray *kv_pair(NSString *key, id value) +{ + return [NSArray arrayWithObjects:key, value, nil]; +} + +static NSArray *dict_to_array(NSDictionary *d) +{ + NSMutableArray *a = [NSMutableArray array]; + [d enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + if ([obj isKindOfClass:[NSDictionary class]]) { + obj = dict_to_array(obj); + } + [a addObject:kv_pair(key, obj)]; + } + ]; + return a; +} + +static BOOL iterate(NSMutableArray *hash_a, NSMutableArray *array_a, const io_name_t plane) { + IOReturn result; + io_iterator_t hidObjectIterator = 0; + io_object_t hidDevice = IO_OBJECT_NULL; + CFMutableDictionaryRef hidProperties = 0; + + result = IORegistryCreateIterator(kIOMasterPortDefault, kIOUSBPlane, kIORegistryIterateRecursively, &hidObjectIterator); + + if ((result != kIOReturnSuccess) || (hidObjectIterator == 0)) { + NSLog(@"Can't obtain an IO iterator\n"); + return NO; + } + + while ((hidDevice = IOIteratorNext(hidObjectIterator))) { + hidProperties = 0; + result = IORegistryEntryCreateCFProperties(hidDevice, &hidProperties, + kCFAllocatorDefault, kNilOptions); + if ((result == KERN_SUCCESS) && hidProperties) { + NSDictionary *d = (NSDictionary *)hidProperties; + NSString *s = [d objectForKey:@"USB Product Name"]; + + if (s) { + CFRetain(hidProperties); + [hash_a addObject:d]; + [array_a addObject:kv_pair(s, dict_to_array(d))]; + } + } + IOObjectRelease(hidDevice); + } + IOObjectRelease(hidObjectIterator); + return YES; +} + +static BOOL magic(NSMutableArray *hash_a, NSMutableArray *array_a) { + [hash_a removeAllObjects]; + [array_a removeAllObjects]; + + if (!iterate(hash_a, array_a, kIOUSBPlane)) return NO; + + return YES; +} - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application + [self performSelector:@selector(scanClick:) withObject:nil afterDelay:.3]; + NSLog(@"wtf"); +} + +- (IBAction)scanClick:(id)sender { + if (self.hash_a == nil) { + self.hash_a = [NSMutableArray array]; + } + if (self.array_a == nil) { + self.array_a = [NSMutableArray array]; + } + if (self.data == nil) { + self.data = [[OutlineData alloc] init]; + self.data.data = self.array_a; + [self.outline setDataSource:self.data]; + } + magic(self.hash_a, self.array_a); + [self.field setString:[NSString stringWithFormat:@"%@", self.hash_a]]; + [self.outline reloadData]; +} + +- (IBAction)saveClick:(id)sender { + NSSavePanel *spanel = [NSSavePanel savePanel]; + NSArray *array = [NSArray arrayWithObject:@"txt"]; + + [spanel setAllowedFileTypes:array]; + + if ([spanel runModal] == NSFileHandlingPanelOKButton) { + NSString *str = [self.field string]; + [str writeToURL:[spanel URL] atomically:FALSE encoding:NSASCIIStringEncoding error:NULL]; + } } +- (BOOL)textView:(NSTextView *)aTextView shouldChangeTextInRange:(NSRange)affectedCharRange replacementString:(NSString *)replacementString { + return NO; +} + + @end + -- 2.30.2