From adfa226fc14a4e32c8a64df067b210a529c3d020 Mon Sep 17 00:00:00 2001 From: shpakovski Date: Fri, 22 Apr 2011 18:37:09 +0300 Subject: [PATCH] Added: Demo project. --- .gitignore | 17 + Demo/Demo.xcodeproj/project.pbxproj | 309 ++ Demo/Demo/AdvancedPreferencesView.xib | 412 ++ Demo/Demo/AdvancedPreferencesViewController.h | 11 + Demo/Demo/AdvancedPreferencesViewController.m | 35 + Demo/Demo/Demo-Info.plist | 44 + Demo/Demo/Demo-Prefix.pch | 7 + Demo/Demo/DemoAppDelegate.h | 21 + Demo/Demo/DemoAppDelegate.m | 58 + Demo/Demo/GeneralPreferencesView.xib | 219 + Demo/Demo/GeneralPreferencesViewController.h | 11 + Demo/Demo/GeneralPreferencesViewController.m | 35 + Demo/Demo/en.lproj/MainMenu.xib | 3801 +++++++++++++++++ Demo/Demo/main.m | 12 + Demo/Shared/MASPreferencesViewController.h | 21 + Demo/Shared/MASPreferencesWindow.xib | 261 ++ Demo/Shared/MASPreferencesWindowController.h | 33 + Demo/Shared/MASPreferencesWindowController.m | 302 ++ 18 files changed, 5609 insertions(+) create mode 100644 .gitignore create mode 100644 Demo/Demo.xcodeproj/project.pbxproj create mode 100644 Demo/Demo/AdvancedPreferencesView.xib create mode 100644 Demo/Demo/AdvancedPreferencesViewController.h create mode 100644 Demo/Demo/AdvancedPreferencesViewController.m create mode 100644 Demo/Demo/Demo-Info.plist create mode 100644 Demo/Demo/Demo-Prefix.pch create mode 100644 Demo/Demo/DemoAppDelegate.h create mode 100644 Demo/Demo/DemoAppDelegate.m create mode 100644 Demo/Demo/GeneralPreferencesView.xib create mode 100644 Demo/Demo/GeneralPreferencesViewController.h create mode 100644 Demo/Demo/GeneralPreferencesViewController.m create mode 100644 Demo/Demo/en.lproj/MainMenu.xib create mode 100644 Demo/Demo/main.m create mode 100644 Demo/Shared/MASPreferencesViewController.h create mode 100644 Demo/Shared/MASPreferencesWindow.xib create mode 100644 Demo/Shared/MASPreferencesWindowController.h create mode 100644 Demo/Shared/MASPreferencesWindowController.m diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f72ba0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +# Xcode +build/* +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +*.xcworkspace +!default.xcworkspace +xcuserdata +profile +*.moved-aside +# Finder +.DS_Store \ No newline at end of file diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj new file mode 100644 index 0000000..2dca03f --- /dev/null +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -0,0 +1,309 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 2E8B1C511361CCEB002B7CD7 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E8B1C501361CCEB002B7CD7 /* Cocoa.framework */; }; + 2E8B1C5E1361CCEB002B7CD7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E8B1C5D1361CCEB002B7CD7 /* main.m */; }; + 2E8B1C641361CCEB002B7CD7 /* DemoAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E8B1C631361CCEB002B7CD7 /* DemoAppDelegate.m */; }; + 2E8B1C671361CCEC002B7CD7 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2E8B1C651361CCEC002B7CD7 /* MainMenu.xib */; }; + 2E8B1C7A1361CED9002B7CD7 /* MASPreferencesWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E8B1C791361CED9002B7CD7 /* MASPreferencesWindowController.m */; }; + 2E8B1C7E1361D014002B7CD7 /* MASPreferencesWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2E8B1C7D1361D014002B7CD7 /* MASPreferencesWindow.xib */; }; + 2E8B1C811361D16A002B7CD7 /* GeneralPreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E8B1C801361D16A002B7CD7 /* GeneralPreferencesViewController.m */; }; + 2E8B1C841361D254002B7CD7 /* AdvancedPreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E8B1C831361D254002B7CD7 /* AdvancedPreferencesViewController.m */; }; + 2E8B1C871361D2EC002B7CD7 /* AdvancedPreferencesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2E8B1C851361D2EC002B7CD7 /* AdvancedPreferencesView.xib */; }; + 2E8B1C881361D2EC002B7CD7 /* GeneralPreferencesView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2E8B1C861361D2EC002B7CD7 /* GeneralPreferencesView.xib */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 2E8B1C4C1361CCEB002B7CD7 /* Demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 2E8B1C501361CCEB002B7CD7 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + 2E8B1C531361CCEB002B7CD7 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + 2E8B1C541361CCEB002B7CD7 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + 2E8B1C551361CCEB002B7CD7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 2E8B1C581361CCEB002B7CD7 /* Demo-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Demo-Info.plist"; sourceTree = ""; }; + 2E8B1C5C1361CCEB002B7CD7 /* Demo-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Demo-Prefix.pch"; sourceTree = ""; }; + 2E8B1C5D1361CCEB002B7CD7 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 2E8B1C621361CCEB002B7CD7 /* DemoAppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DemoAppDelegate.h; sourceTree = ""; }; + 2E8B1C631361CCEB002B7CD7 /* DemoAppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DemoAppDelegate.m; sourceTree = ""; }; + 2E8B1C661361CCEC002B7CD7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; + 2E8B1C771361CED9002B7CD7 /* MASPreferencesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASPreferencesViewController.h; sourceTree = ""; }; + 2E8B1C781361CED9002B7CD7 /* MASPreferencesWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MASPreferencesWindowController.h; sourceTree = ""; }; + 2E8B1C791361CED9002B7CD7 /* MASPreferencesWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MASPreferencesWindowController.m; sourceTree = ""; }; + 2E8B1C7D1361D014002B7CD7 /* MASPreferencesWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MASPreferencesWindow.xib; sourceTree = ""; }; + 2E8B1C7F1361D16A002B7CD7 /* GeneralPreferencesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneralPreferencesViewController.h; sourceTree = ""; }; + 2E8B1C801361D16A002B7CD7 /* GeneralPreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneralPreferencesViewController.m; sourceTree = ""; }; + 2E8B1C821361D254002B7CD7 /* AdvancedPreferencesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdvancedPreferencesViewController.h; sourceTree = ""; }; + 2E8B1C831361D254002B7CD7 /* AdvancedPreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AdvancedPreferencesViewController.m; sourceTree = ""; }; + 2E8B1C851361D2EC002B7CD7 /* AdvancedPreferencesView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AdvancedPreferencesView.xib; sourceTree = ""; }; + 2E8B1C861361D2EC002B7CD7 /* GeneralPreferencesView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GeneralPreferencesView.xib; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2E8B1C491361CCEB002B7CD7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2E8B1C511361CCEB002B7CD7 /* Cocoa.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 2E8B1C411361CCEB002B7CD7 = { + isa = PBXGroup; + children = ( + 2E8B1C6D1361CCFC002B7CD7 /* Shared */, + 2E8B1C561361CCEB002B7CD7 /* Demo */, + 2E8B1C4F1361CCEB002B7CD7 /* Frameworks */, + 2E8B1C4D1361CCEB002B7CD7 /* Products */, + ); + sourceTree = ""; + }; + 2E8B1C4D1361CCEB002B7CD7 /* Products */ = { + isa = PBXGroup; + children = ( + 2E8B1C4C1361CCEB002B7CD7 /* Demo.app */, + ); + name = Products; + sourceTree = ""; + }; + 2E8B1C4F1361CCEB002B7CD7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2E8B1C501361CCEB002B7CD7 /* Cocoa.framework */, + 2E8B1C521361CCEB002B7CD7 /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + 2E8B1C521361CCEB002B7CD7 /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + 2E8B1C531361CCEB002B7CD7 /* AppKit.framework */, + 2E8B1C541361CCEB002B7CD7 /* CoreData.framework */, + 2E8B1C551361CCEB002B7CD7 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + 2E8B1C561361CCEB002B7CD7 /* Demo */ = { + isa = PBXGroup; + children = ( + 2E8B1C891361D301002B7CD7 /* Preferences */, + 2E8B1C621361CCEB002B7CD7 /* DemoAppDelegate.h */, + 2E8B1C631361CCEB002B7CD7 /* DemoAppDelegate.m */, + 2E8B1C651361CCEC002B7CD7 /* MainMenu.xib */, + 2E8B1C571361CCEB002B7CD7 /* Supporting Files */, + ); + path = Demo; + sourceTree = ""; + }; + 2E8B1C571361CCEB002B7CD7 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2E8B1C581361CCEB002B7CD7 /* Demo-Info.plist */, + 2E8B1C5C1361CCEB002B7CD7 /* Demo-Prefix.pch */, + 2E8B1C5D1361CCEB002B7CD7 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 2E8B1C6D1361CCFC002B7CD7 /* Shared */ = { + isa = PBXGroup; + children = ( + 2E8B1C7D1361D014002B7CD7 /* MASPreferencesWindow.xib */, + 2E8B1C771361CED9002B7CD7 /* MASPreferencesViewController.h */, + 2E8B1C781361CED9002B7CD7 /* MASPreferencesWindowController.h */, + 2E8B1C791361CED9002B7CD7 /* MASPreferencesWindowController.m */, + ); + path = Shared; + sourceTree = ""; + }; + 2E8B1C891361D301002B7CD7 /* Preferences */ = { + isa = PBXGroup; + children = ( + 2E8B1C7F1361D16A002B7CD7 /* GeneralPreferencesViewController.h */, + 2E8B1C801361D16A002B7CD7 /* GeneralPreferencesViewController.m */, + 2E8B1C861361D2EC002B7CD7 /* GeneralPreferencesView.xib */, + 2E8B1C821361D254002B7CD7 /* AdvancedPreferencesViewController.h */, + 2E8B1C831361D254002B7CD7 /* AdvancedPreferencesViewController.m */, + 2E8B1C851361D2EC002B7CD7 /* AdvancedPreferencesView.xib */, + ); + name = Preferences; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 2E8B1C4B1361CCEB002B7CD7 /* Demo */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2E8B1C6A1361CCEC002B7CD7 /* Build configuration list for PBXNativeTarget "Demo" */; + buildPhases = ( + 2E8B1C481361CCEB002B7CD7 /* Sources */, + 2E8B1C491361CCEB002B7CD7 /* Frameworks */, + 2E8B1C4A1361CCEB002B7CD7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Demo; + productName = Demo; + productReference = 2E8B1C4C1361CCEB002B7CD7 /* Demo.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 2E8B1C431361CCEB002B7CD7 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = 2E8B1C461361CCEB002B7CD7 /* Build configuration list for PBXProject "Demo" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 2E8B1C411361CCEB002B7CD7; + productRefGroup = 2E8B1C4D1361CCEB002B7CD7 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 2E8B1C4B1361CCEB002B7CD7 /* Demo */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2E8B1C4A1361CCEB002B7CD7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2E8B1C671361CCEC002B7CD7 /* MainMenu.xib in Resources */, + 2E8B1C7E1361D014002B7CD7 /* MASPreferencesWindow.xib in Resources */, + 2E8B1C871361D2EC002B7CD7 /* AdvancedPreferencesView.xib in Resources */, + 2E8B1C881361D2EC002B7CD7 /* GeneralPreferencesView.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2E8B1C481361CCEB002B7CD7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2E8B1C5E1361CCEB002B7CD7 /* main.m in Sources */, + 2E8B1C641361CCEB002B7CD7 /* DemoAppDelegate.m in Sources */, + 2E8B1C7A1361CED9002B7CD7 /* MASPreferencesWindowController.m in Sources */, + 2E8B1C811361D16A002B7CD7 /* GeneralPreferencesViewController.m in Sources */, + 2E8B1C841361D254002B7CD7 /* AdvancedPreferencesViewController.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 2E8B1C651361CCEC002B7CD7 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + 2E8B1C661361CCEC002B7CD7 /* en */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 2E8B1C681361CCEC002B7CD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = DEBUG; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + 2E8B1C691361CCEC002B7CD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; + SDKROOT = macosx; + }; + name = Release; + }; + 2E8B1C6B1361CCEC002B7CD7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch"; + INFOPLIST_FILE = "Demo/Demo-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + 2E8B1C6C1361CCEC002B7CD7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Demo/Demo-Prefix.pch"; + INFOPLIST_FILE = "Demo/Demo-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2E8B1C461361CCEB002B7CD7 /* Build configuration list for PBXProject "Demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2E8B1C681361CCEC002B7CD7 /* Debug */, + 2E8B1C691361CCEC002B7CD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2E8B1C6A1361CCEC002B7CD7 /* Build configuration list for PBXNativeTarget "Demo" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2E8B1C6B1361CCEC002B7CD7 /* Debug */, + 2E8B1C6C1361CCEC002B7CD7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 2E8B1C431361CCEB002B7CD7 /* Project object */; +} diff --git a/Demo/Demo/AdvancedPreferencesView.xib b/Demo/Demo/AdvancedPreferencesView.xib new file mode 100644 index 0000000..2dfd6b0 --- /dev/null +++ b/Demo/Demo/AdvancedPreferencesView.xib @@ -0,0 +1,412 @@ + + + + 1060 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 1306 + + + YES + NSCustomView + NSButtonCell + NSMatrix + NSCustomObject + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + + + YES + + AdvancedPreferencesViewController + + + FirstResponder + + + NSApplication + + + + 268 + + YES + + + 268 + {{141, 71}, {78, 38}} + + + + YES + 2 + 1 + + YES + + -2080244224 + 0 + Option 1 + + LucidaGrande + 13 + 1044 + + + 1 + 1211912703 + 0 + + NSRadioButton + + + + 200 + 25 + + + 67239424 + 0 + Option 2 + + + 1211912703 + 0 + + 549453824 + {18, 18} + + YES + + YES + + + + TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw +IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ +29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 +dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA +AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG +AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/ +0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/ +7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ +5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/ +3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD +AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns +AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/ +6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/ +/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ +///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl +YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA +AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF +A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FvN/87Rz6PQdtFK0vHTxtSb +1kXXG9fx2MjZn9tO3Cbc/93Y3rHfiuBk4hni9ePQ5KzliOZk50HoH+j86drqueuX7HbtVu427xbv9/DX +8bnymvN89F/1QvYl9wj37PjQ+bX6mvt//GX9S/4x//8AAGRlc2MAAAAAAAAACkNvbG9yIExDRAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAAAAAAAAAAAAAABtbHVjAAAAAAAAAAEAAAAMZW5VUwAAABIAAAAcAEMAbwBsAG8AcgAgAEwAQwBE +AABtbW9kAAAAAAAABhAAAJxOAAAAAL5zkQAAAAAAAAAAAAAAAAAAAAAAdGV4dAAAAABDb3B5cmlnaHQg +QXBwbGUgQ29tcHV0ZXIsIEluYy4sIDIwMDUAAAAAA + + + + + + 3 + MCAwAA + + + + 400 + 75 + + + {78, 18} + {4, 2} + 1151868928 + NSActionCell + + 67239424 + 0 + Radio + + 1211912703 + 0 + + 549453824 + {18, 18} + + YES + + YES + + + + TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw +IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ +29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 +dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA +AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG +AAAAAwAAAAAAAAA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AAAXAAAAJAAAAC4AAAAu +AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQEAAAMAAAABABIAAAEB +AAMAAAABABIAAAECAAMAAAAEAAAFugEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES +AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS +AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + + + + + + + 400 + 75 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 3 + MQA + + + + + {360, 180} + + + + NSView + + + + + YES + + + view + + + + 11 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 63 + + + YES + + + + + + + + 64 + + + + + 65 + + + + + 66 + + + + + + + YES + + YES + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBUserGuides + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 63.IBPluginDependency + 64.IBPluginDependency + 65.IBPluginDependency + 66.IBPluginDependency + + + YES + {{341, 676}, {360, 180}} + com.apple.InterfaceBuilder.CocoaPlugin + + {628, 654} + {{217, 442}, {480, 272}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + + + + YES + + + + + 66 + + + + YES + + AdvancedPreferencesViewController + NSViewController + + IBProjectSource + ./Classes/AdvancedPreferencesViewController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + diff --git a/Demo/Demo/AdvancedPreferencesViewController.h b/Demo/Demo/AdvancedPreferencesViewController.h new file mode 100644 index 0000000..e85dd14 --- /dev/null +++ b/Demo/Demo/AdvancedPreferencesViewController.h @@ -0,0 +1,11 @@ +// +// AdvancedPreferencesViewController.h +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +#import "MASPreferencesViewController.h" + +@interface AdvancedPreferencesViewController : NSViewController +@end diff --git a/Demo/Demo/AdvancedPreferencesViewController.m b/Demo/Demo/AdvancedPreferencesViewController.m new file mode 100644 index 0000000..9744e91 --- /dev/null +++ b/Demo/Demo/AdvancedPreferencesViewController.m @@ -0,0 +1,35 @@ +// +// AdvancedPreferencesViewController.m +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +#import "AdvancedPreferencesViewController.h" + +@implementation AdvancedPreferencesViewController + +- (id)init +{ + return [super initWithNibName:@"AdvancedPreferencesView" bundle:nil]; +} + +#pragma mark - +#pragma mark MASPreferencesViewController + +- (NSString *)toolbarItemIdentifier +{ + return @"AdvancedPreferences"; +} + +- (NSImage *)toolbarItemImage +{ + return [NSImage imageNamed:NSImageNameAdvanced]; +} + +- (NSString *)toolbarItemLabel +{ + return NSLocalizedString(@"Advanced", @"Toolbar item name for the Advanced preference pane"); +} + +@end diff --git a/Demo/Demo/Demo-Info.plist b/Demo/Demo/Demo-Info.plist new file mode 100644 index 0000000..9c2a0a3 --- /dev/null +++ b/Demo/Demo/Demo-Info.plist @@ -0,0 +1,44 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDocumentTypes + + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + com.shpakovski.mac.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleURLTypes + + CFBundleVersion + 1 + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSHumanReadableCopyright + Copyright © 2001 Shpakovski + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + NSServices + + UTExportedTypeDeclarations + + UTImportedTypeDeclarations + + + diff --git a/Demo/Demo/Demo-Prefix.pch b/Demo/Demo/Demo-Prefix.pch new file mode 100644 index 0000000..4d23fbe --- /dev/null +++ b/Demo/Demo/Demo-Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'Demo' target in the 'Demo' project +// + +#ifdef __OBJC__ + #import +#endif diff --git a/Demo/Demo/DemoAppDelegate.h b/Demo/Demo/DemoAppDelegate.h new file mode 100644 index 0000000..760b136 --- /dev/null +++ b/Demo/Demo/DemoAppDelegate.h @@ -0,0 +1,21 @@ +// +// DemoAppDelegate.h +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +@interface DemoAppDelegate : NSObject +{ +@private + + NSWindow *_window; + NSWindowController *_preferencesWindowController; +} + +@property (nonatomic, assign) IBOutlet NSWindow *window; +@property (nonatomic, readonly) NSWindowController *preferencesWindowController; + +- (IBAction)openPreferences:(id)sender; + +@end diff --git a/Demo/Demo/DemoAppDelegate.m b/Demo/Demo/DemoAppDelegate.m new file mode 100644 index 0000000..9543534 --- /dev/null +++ b/Demo/Demo/DemoAppDelegate.m @@ -0,0 +1,58 @@ +// +// DemoAppDelegate.m +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +#import "DemoAppDelegate.h" +#import "MASPreferencesWindowController.h" +#import "GeneralPreferencesViewController.h" +#import "AdvancedPreferencesViewController.h" + +@implementation DemoAppDelegate + +@synthesize window = _window; + +#pragma mark - + +- (void)dealloc +{ + [_preferencesWindowController release]; + [super dealloc]; +} + +#pragma mark - NSApplicationDelegate + +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender +{ + return YES; +} + +#pragma mark - Public accessors + +- (NSWindowController *)preferencesWindowController +{ + if (_preferencesWindowController == nil) + { + NSViewController *generalViewController = [[GeneralPreferencesViewController alloc] init]; + NSViewController *advancedViewController = [[AdvancedPreferencesViewController alloc] init]; + NSArray *controllers = [[NSArray alloc] initWithObjects:generalViewController, advancedViewController, nil]; + [generalViewController release]; + [advancedViewController release]; + + NSString *title = NSLocalizedString(@"Preferences", @"Common title for Preferences window"); + _preferencesWindowController = [[MASPreferencesWindowController alloc] initWithViewControllers:controllers title:title]; + [controllers release]; + } + return _preferencesWindowController; +} + +#pragma mark - Actions + +- (IBAction)openPreferences:(id)sender +{ + [self.preferencesWindowController showWindow:nil]; +} + +@end diff --git a/Demo/Demo/GeneralPreferencesView.xib b/Demo/Demo/GeneralPreferencesView.xib new file mode 100644 index 0000000..c458913 --- /dev/null +++ b/Demo/Demo/GeneralPreferencesView.xib @@ -0,0 +1,219 @@ + + + + 1060 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 1306 + + + YES + NSCustomView + NSButtonCell + NSButton + NSCustomObject + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + + + YES + + GeneralPreferencesViewController + + + FirstResponder + + + NSApplication + + + + 268 + + YES + + + 268 + {{148, 121}, {65, 18}} + + + + YES + + -2080244224 + 0 + Option + + LucidaGrande + 13 + 1044 + + + 1211912703 + 2 + + NSImage + NSSwitch + + + NSSwitch + + + + 200 + 25 + + + + {360, 260} + + + + NSView + + + + + YES + + + view + + + + 2 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 161 + + + YES + + + + + + 162 + + + + + + + YES + + YES + 1.IBEditorWindowLastContentRect + 1.IBPluginDependency + 1.IBUserGuides + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 161.IBPluginDependency + 162.IBPluginDependency + + + YES + {{646, 500}, {360, 116}} + com.apple.InterfaceBuilder.CocoaPlugin + + {628, 654} + {{217, 442}, {480, 272}} + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + + + + YES + + + + + 162 + + + + YES + + GeneralPreferencesViewController + NSViewController + + IBProjectSource + ./Classes/GeneralPreferencesViewController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + NSSwitch + {15, 15} + + + diff --git a/Demo/Demo/GeneralPreferencesViewController.h b/Demo/Demo/GeneralPreferencesViewController.h new file mode 100644 index 0000000..6f4850b --- /dev/null +++ b/Demo/Demo/GeneralPreferencesViewController.h @@ -0,0 +1,11 @@ +// +// GeneralPreferencesViewController.h +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +#import "MASPreferencesViewController.h" + +@interface GeneralPreferencesViewController : NSViewController +@end diff --git a/Demo/Demo/GeneralPreferencesViewController.m b/Demo/Demo/GeneralPreferencesViewController.m new file mode 100644 index 0000000..1555535 --- /dev/null +++ b/Demo/Demo/GeneralPreferencesViewController.m @@ -0,0 +1,35 @@ +// +// GeneralPreferencesViewController.m +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +#import "GeneralPreferencesViewController.h" + +@implementation GeneralPreferencesViewController + +- (id)init +{ + return [super initWithNibName:@"GeneralPreferencesView" bundle:nil]; +} + +#pragma mark - +#pragma mark MASPreferencesViewController + +- (NSString *)toolbarItemIdentifier +{ + return @"GeneralPreferences"; +} + +- (NSImage *)toolbarItemImage +{ + return [NSImage imageNamed:NSImageNamePreferencesGeneral]; +} + +- (NSString *)toolbarItemLabel +{ + return NSLocalizedString(@"General", @"Toolbar item name for the General preference pane"); +} + +@end diff --git a/Demo/Demo/en.lproj/MainMenu.xib b/Demo/Demo/en.lproj/MainMenu.xib new file mode 100644 index 0000000..b07faa0 --- /dev/null +++ b/Demo/Demo/en.lproj/MainMenu.xib @@ -0,0 +1,3801 @@ + + + + 1060 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 1306 + + + YES + NSView + NSMenu + NSWindowTemplate + NSMenuItem + NSButtonCell + NSButton + NSCustomObject + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + AMainMenu + + YES + + + Demo + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + Demo + + YES + + + About Demo + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + Services + + YES + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide Demo + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit Demo + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + File + + YES + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + Open Recent + + YES + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save + s + 1048576 + 2147483647 + + + + + + Save As… + S + 1179648 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + Edit + + YES + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + Find + + YES + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + Spelling and Grammar + + YES + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + Substitutions + + YES + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + Transformations + + YES + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + Speech + + YES + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + Format + + YES + + + Font + + 2147483647 + + + submenuAction: + + Font + + YES + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + Kern + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + Ligature + + YES + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + Baseline + + YES + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + Text + + YES + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + Writing Direction + + YES + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + View + + YES + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + Window + + YES + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + Help + + YES + + + Demo Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + 15 + 2 + {{450, 310}, {547, 406}} + 1954021376 + Demo + NSWindow + + + + 256 + + YES + + + 301 + {{217, 185}, {113, 32}} + + + + YES + + 67239424 + 134217728 + Preferences + + LucidaGrande + 13 + 1044 + + + -2038284033 + 129 + + + 200 + 25 + + + + {{7, 11}, {547, 406}} + + + + + {{0, 0}, {1440, 878}} + {1e+13, 1e+13} + + + DemoAppDelegate + + + NSFontManager + + + + + YES + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + saveDocumentAs: + + + + 363 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + addFontTrait: + + + + 421 + + + + addFontTrait: + + + + 422 + + + + modifyFont: + + + + 423 + + + + orderFrontFontPanel: + + + + 424 + + + + modifyFont: + + + + 425 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + terminate: + + + + 449 + + + + toggleAutomaticSpellingCorrection: + + + + 456 + + + + orderFrontSubstitutionsPanel: + + + + 458 + + + + toggleAutomaticDashSubstitution: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + uppercaseWord: + + + + 464 + + + + capitalizeWord: + + + + 467 + + + + lowercaseWord: + + + + 468 + + + + pasteAsPlainText: + + + + 486 + + + + performFindPanelAction: + + + + 487 + + + + performFindPanelAction: + + + + 488 + + + + performFindPanelAction: + + + + 489 + + + + showHelp: + + + + 493 + + + + delegate + + + + 495 + + + + alignCenter: + + + + 518 + + + + pasteRuler: + + + + 519 + + + + toggleRuler: + + + + 520 + + + + alignRight: + + + + 521 + + + + copyRuler: + + + + 522 + + + + alignJustified: + + + + 523 + + + + alignLeft: + + + + 524 + + + + makeBaseWritingDirectionNatural: + + + + 525 + + + + makeBaseWritingDirectionLeftToRight: + + + + 526 + + + + makeBaseWritingDirectionRightToLeft: + + + + 527 + + + + makeTextWritingDirectionNatural: + + + + 528 + + + + makeTextWritingDirectionLeftToRight: + + + + 529 + + + + makeTextWritingDirectionRightToLeft: + + + + 530 + + + + window + + + + 532 + + + + openPreferences: + + + + 533 + + + + openPreferences: + + + + 536 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + YES + + + + + + + + + + + + 19 + + + YES + + + + + + 56 + + + YES + + + + + + 217 + + + YES + + + + + + 83 + + + YES + + + + + + 81 + + + YES + + + + + + + + + + + + + + + + 75 + + + + + 80 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + YES + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + YES + + + + + + 126 + + + + + 205 + + + YES + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + YES + + + + + + 216 + + + YES + + + + + + 200 + + + YES + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + YES + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + YES + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + YES + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + YES + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + YES + + + + + + 296 + + + YES + + + + + + + 297 + + + + + 298 + + + + + 211 + + + YES + + + + + + 212 + + + YES + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + YES + + + + + + 349 + + + YES + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + 375 + + + YES + + + + + + 376 + + + YES + + + + + + + 377 + + + YES + + + + + + 388 + + + YES + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + YES + + + + + + 398 + + + YES + + + + + + 399 + + + YES + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + YES + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + YES + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + YES + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 420 + + + + + 450 + + + YES + + + + + + 451 + + + YES + + + + + + + + 452 + + + + + 453 + + + + + 454 + + + + + 457 + + + + + 459 + + + + + 460 + + + + + 462 + + + + + 465 + + + + + 466 + + + + + 485 + + + + + 490 + + + YES + + + + + + 491 + + + YES + + + + + + 492 + + + + + 494 + + + + + 496 + + + YES + + + + + + 497 + + + YES + + + + + + + + + + + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + 503 + + + YES + + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + 508 + + + YES + + + + + + + + + + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 517 + + + + + 534 + + + YES + + + + + + 535 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -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 + 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.IBNSWindowAutoPositionCentersHorizontal + 371.IBNSWindowAutoPositionCentersVertical + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 371.editorWindowContentRectSynchronizationRect + 372.IBPluginDependency + 375.IBPluginDependency + 376.IBEditorWindowLastContentRect + 376.IBPluginDependency + 377.IBPluginDependency + 388.IBEditorWindowLastContentRect + 388.IBPluginDependency + 389.IBPluginDependency + 390.IBPluginDependency + 391.IBPluginDependency + 392.IBPluginDependency + 393.IBPluginDependency + 394.IBPluginDependency + 395.IBPluginDependency + 396.IBPluginDependency + 397.IBPluginDependency + 398.IBPluginDependency + 399.IBPluginDependency + 400.IBPluginDependency + 401.IBPluginDependency + 402.IBPluginDependency + 403.IBPluginDependency + 404.IBPluginDependency + 405.IBPluginDependency + 406.IBPluginDependency + 407.IBPluginDependency + 408.IBPluginDependency + 409.IBPluginDependency + 410.IBPluginDependency + 411.IBPluginDependency + 412.IBPluginDependency + 413.IBPluginDependency + 414.IBPluginDependency + 415.IBPluginDependency + 416.IBPluginDependency + 417.IBPluginDependency + 418.IBPluginDependency + 419.IBPluginDependency + 420.IBPluginDependency + 450.IBPluginDependency + 451.IBEditorWindowLastContentRect + 451.IBPluginDependency + 452.IBPluginDependency + 453.IBPluginDependency + 454.IBPluginDependency + 457.IBPluginDependency + 459.IBPluginDependency + 460.IBPluginDependency + 462.IBPluginDependency + 465.IBPluginDependency + 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 + 503.IBPluginDependency + 504.IBPluginDependency + 505.IBPluginDependency + 506.IBPluginDependency + 507.IBPluginDependency + 508.IBEditorWindowLastContentRect + 508.IBPluginDependency + 509.IBPluginDependency + 510.IBPluginDependency + 511.IBPluginDependency + 512.IBPluginDependency + 513.IBPluginDependency + 514.IBPluginDependency + 515.IBPluginDependency + 516.IBPluginDependency + 517.IBPluginDependency + 534.IBPluginDependency + 535.IBPluginDependency + 56.IBPluginDependency + 56.ImportedFromIB2 + 57.IBEditorWindowLastContentRect + 57.IBPluginDependency + 57.ImportedFromIB2 + 57.editorWindowContentRectSynchronizationRect + 58.IBPluginDependency + 58.ImportedFromIB2 + 72.IBPluginDependency + 72.ImportedFromIB2 + 73.IBPluginDependency + 73.ImportedFromIB2 + 74.IBPluginDependency + 74.ImportedFromIB2 + 75.IBPluginDependency + 75.ImportedFromIB2 + 77.IBPluginDependency + 77.ImportedFromIB2 + 78.IBPluginDependency + 78.ImportedFromIB2 + 79.IBPluginDependency + 79.ImportedFromIB2 + 80.IBPluginDependency + 80.ImportedFromIB2 + 81.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 + + 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 + {{380, 496}, {480, 360}} + + {{33, 99}, {480, 360}} + 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 + 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 + com.apple.InterfaceBuilder.CocoaPlugin + {{753, 197}, {170, 63}} + 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 + {{725, 289}, {246, 23}} + com.apple.InterfaceBuilder.CocoaPlugin + 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 + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + 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 + 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 + + {{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 + + + + + YES + + + + + + YES + + + + + 536 + + + + YES + + DemoAppDelegate + NSObject + + openPreferences: + id + + + openPreferences: + + openPreferences: + id + + + + window + NSWindow + + + window + + window + NSWindow + + + + IBProjectSource + ./Classes/DemoAppDelegate.h + + + + NSDocument + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + id + id + id + id + id + id + + + + YES + + YES + printDocument: + revertDocumentToSaved: + runPageLayout: + saveDocument: + saveDocumentAs: + saveDocumentTo: + + + YES + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + + + IBProjectSource + ./Classes/NSDocument.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + YES + + YES + NSMenuCheckmark + NSMenuMixedState + + + YES + {9, 8} + {7, 2} + + + + diff --git a/Demo/Demo/main.m b/Demo/Demo/main.m new file mode 100644 index 0000000..0815ab2 --- /dev/null +++ b/Demo/Demo/main.m @@ -0,0 +1,12 @@ +// +// main.m +// Demo +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **)argv); +} diff --git a/Demo/Shared/MASPreferencesViewController.h b/Demo/Shared/MASPreferencesViewController.h new file mode 100644 index 0000000..fff5286 --- /dev/null +++ b/Demo/Shared/MASPreferencesViewController.h @@ -0,0 +1,21 @@ +// +// MASPreferencesViewController.h +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +@protocol MASPreferencesViewController + +@optional + +- (void)viewWillAppear; +- (void)viewDidDisappear; + +@required + +@property (nonatomic, readonly) NSString *toolbarItemIdentifier; +@property (nonatomic, readonly) NSImage *toolbarItemImage; +@property (nonatomic, readonly) NSString *toolbarItemLabel; + +@end diff --git a/Demo/Shared/MASPreferencesWindow.xib b/Demo/Shared/MASPreferencesWindow.xib new file mode 100644 index 0000000..589c5e4 --- /dev/null +++ b/Demo/Shared/MASPreferencesWindow.xib @@ -0,0 +1,261 @@ + + + + 1060 + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 1306 + + + YES + NSWindowTemplate + NSView + NSToolbar + NSCustomObject + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + YES + + YES + + + + + YES + + MASPreferencesWindowController + + + FirstResponder + + + NSApplication + + + 3 + 2 + {{540, 400}, {360, 270}} + 1618478080 + + NSWindow + + + A3419266-C6CB-4FAA-AB63-B91B70C196EA + + + YES + YES + NO + NO + 1 + 1 + + YES + + + + + + YES + + + YES + + + + + 256 + {{7, 11}, {360, 270}} + + + + + {{0, 0}, {1440, 878}} + {1e+13, 1e+13} + + + + + + YES + + + window + + + + 3 + + + + delegate + + + + 12 + + + + + YES + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + + 2 + + + + + 4 + + + YES + + + + + + + YES + + YES + 1.IBEditorWindowLastContentRect + 1.IBNSWindowAutoPositionCentersHorizontal + 1.IBNSWindowAutoPositionCentersVertical + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 1.WindowOrigin + 1.editorWindowContentRectSynchronizationRect + 2.IBPluginDependency + 4.IBEditorWindowLastContentRect + 4.IBPluginDependency + + + YES + {{484, 402}, {360, 270}} + + + com.apple.InterfaceBuilder.CocoaPlugin + {{484, 402}, {360, 270}} + + {196, 240} + {{202, 428}, {480, 270}} + com.apple.InterfaceBuilder.CocoaPlugin + {{416, 672}, {616, 0}} + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + + + + YES + + + + + 19 + + + + YES + + MASPreferencesWindowController + NSWindowController + + YES + + YES + goNextTab: + goPreviousTab: + + + YES + id + id + + + + YES + + YES + goNextTab: + goPreviousTab: + + + YES + + goNextTab: + id + + + goPreviousTab: + id + + + + + IBProjectSource + ./Classes/MASPreferencesWindowController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + diff --git a/Demo/Shared/MASPreferencesWindowController.h b/Demo/Shared/MASPreferencesWindowController.h new file mode 100644 index 0000000..840ebe2 --- /dev/null +++ b/Demo/Shared/MASPreferencesWindowController.h @@ -0,0 +1,33 @@ +// +// MASPreferencesWindowController.h +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +extern NSString *const kMASPreferencesWindowControllerDidChangeViewNotification; + +@interface MASPreferencesWindowController : NSWindowController +{ +@private + NSArray *_viewControllers; + NSString *_title; + id _lastSelectedController; +} + +@property (nonatomic, readonly) NSArray *viewControllers; +@property (nonatomic, readonly) NSUInteger indexOfSelectedController; +@property (nonatomic, readonly) NSViewController *selectedViewController; +@property (nonatomic, readonly) NSString *title; + +- (id)initWithViewControllers:(NSArray *)viewControllers; +- (id)initWithViewControllers:(NSArray *)viewControllers title:(NSString *)title; + +- (void)selectControllerAtIndex:(NSUInteger)controllerIndex withAnimation:(BOOL)animate; + +- (IBAction)goNextTab:(id)sender; +- (IBAction)goPreviousTab:(id)sender; + +- (void)resetFirstResponderInView:(NSView *)view; + +@end diff --git a/Demo/Shared/MASPreferencesWindowController.m b/Demo/Shared/MASPreferencesWindowController.m new file mode 100644 index 0000000..f2dc198 --- /dev/null +++ b/Demo/Shared/MASPreferencesWindowController.m @@ -0,0 +1,302 @@ +// +// MASPreferencesWindowController.m +// +// Created by Vadim Shpakovski on 4/22/11. +// Copyright 2011 Shpakovski. All rights reserved. +// + +#import "MASPreferencesViewController.h" +#import "MASPreferencesWindowController.h" + +NSString *const kMASPreferencesWindowControllerDidChangeViewNotification = @"MASPreferencesWindowControllerDidChangeViewNotification"; + +@interface MASPreferencesWindowController () // Private + +- (void)updateViewControllerWithAnimation:(BOOL)animate; + +@end + +#pragma mark - + +@implementation MASPreferencesWindowController + +@synthesize viewControllers = _viewControllers; +@synthesize title = _title; + +#pragma mark - + +- (id)initWithViewControllers:(NSArray *)viewControllers +{ + return [self initWithViewControllers:viewControllers title:nil]; +} + +- (id)initWithViewControllers:(NSArray *)viewControllers title:(NSString *)title +{ + if ((self = [super initWithWindowNibName:@"MASPreferencesWindow"])) + { + _viewControllers = [viewControllers retain]; + _title = [title copy]; + } + return self; +} + +- (void)dealloc +{ + [[self window] setDelegate:nil]; + + [_viewControllers release]; + [_title release]; + + [super dealloc]; +} + +#pragma mark - + +- (void)awakeFromNib +{ + [super awakeFromNib]; + + // Watch for resigning and closing to commit editing + [[self window] setDelegate:self]; + + if ([self.title length] > 0) + [[self window] setTitle:self.title]; + [self selectControllerAtIndex:0 withAnimation:NO]; +} + +#pragma mark - +#pragma mark NSWindowDelegate + +- (void)commitPreferences +{ + [[self window] makeFirstResponder:[self window]]; +} + +- (void)windowWillClose:(NSNotification *)notification +{ + [self commitPreferences]; +} + +- (void)windowDidResignKey:(NSNotification *)notification +{ + [self commitPreferences]; +} + +- (void)windowDidBecomeKey:(NSNotification *)notification +{ + [self resetFirstResponderInView:[[self window] contentView]]; +} + +#pragma mark - +#pragma mark Accessors + +- (NSArray *)toolbarItemIdentifiers +{ + NSArray *identifiers = [_viewControllers valueForKey:@"toolbarItemIdentifier"]; + return identifiers; +} + +#pragma mark - + +- (NSUInteger)indexOfSelectedController +{ + NSString *selectedIdentifier = self.window.toolbar.selectedItemIdentifier; + NSArray *identifiers = self.toolbarItemIdentifiers; + NSUInteger selectedIndex = [identifiers indexOfObject:selectedIdentifier]; + return selectedIndex; +} + +- (NSViewController *)selectedViewController +{ + NSString *selectedIdentifier = self.window.toolbar.selectedItemIdentifier; + NSArray *identifiers = self.toolbarItemIdentifiers; + NSUInteger selectedIndex = [identifiers indexOfObject:selectedIdentifier]; + NSViewController *selectedController = nil; + if (NSLocationInRange(selectedIndex, NSMakeRange(0, self.viewControllers.count))) + selectedController = [self.viewControllers objectAtIndex:selectedIndex]; + return selectedController; +} + +#pragma mark - +#pragma mark NSToolbarDelegate + +- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar +{ + NSArray *identifiers = self.toolbarItemIdentifiers; + return identifiers; +} + +- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar +{ + NSArray *identifiers = self.toolbarItemIdentifiers; + return identifiers; +} + +- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar +{ + NSArray *identifiers = self.toolbarItemIdentifiers; + return identifiers; +} + +- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag +{ + NSToolbarItem *toolbarItem = [[NSToolbarItem alloc] initWithItemIdentifier:itemIdentifier]; + NSArray *identifiers = self.toolbarItemIdentifiers; + NSUInteger controllerIndex = [identifiers indexOfObject:itemIdentifier]; + if (controllerIndex != NSNotFound) + { + id controller = [_viewControllers objectAtIndex:controllerIndex]; + toolbarItem.image = controller.toolbarItemImage; + toolbarItem.label = controller.toolbarItemLabel; + toolbarItem.target = self; + toolbarItem.action = @selector(toolbarItemDidClick:); + } + return [toolbarItem autorelease]; +} + +#pragma mark - +#pragma mark Private methods + +- (void)clearResponderChain +{ + // Remove view controller from the responder chain + NSResponder *chainedController = self.window.nextResponder; + if ([self.viewControllers indexOfObject:chainedController] == NSNotFound) + return; + self.window.nextResponder = chainedController.nextResponder; + chainedController.nextResponder = nil; +} + +- (void)patchResponderChain +{ + [self clearResponderChain]; + + NSViewController *selectedController = self.selectedViewController; + if (!selectedController) + return; + + // Add current controller to the responder chain + NSResponder *nextResponder = self.window.nextResponder; + self.window.nextResponder = selectedController; + selectedController.nextResponder = nextResponder; +} + +#pragma mark - + +- (void)updateViewControllerWithAnimation:(BOOL)animate +{ + // Retrieve currently selected view controller + NSArray *identifiers = self.toolbarItemIdentifiers; + NSString *itemIdentifier = self.window.toolbar.selectedItemIdentifier; + NSUInteger controllerIndex = [identifiers indexOfObject:itemIdentifier]; + if (controllerIndex == NSNotFound) return; + NSViewController *controller = [_viewControllers objectAtIndex:controllerIndex]; + + // Retrieve the new window tile from the controller view + if ([self.title length] == 0) + { + NSString *label = controller.toolbarItemLabel; + self.window.title = label; + } + + // Retrieve the view to place into window + NSView *controllerView = controller.view; + + // Calculate changes for window size and position + NSSize controllerViewSize = controllerView.bounds.size; + NSView *contentView = self.window.contentView; + NSSize contentSize = contentView.bounds.size; + CGFloat widthChange = contentSize.width - controllerViewSize.width; + CGFloat heightChange = contentSize.height - controllerViewSize.height; + + // Calculate new window size and position + NSRect windowFrame = self.window.frame; + windowFrame.size.width -= widthChange; + windowFrame.size.height -= heightChange; + windowFrame.origin.y += heightChange; + + // Place the view into window and perform reposition + NSArray *subviews = [contentView.subviews retain]; + for (NSView *subview in contentView.subviews) + [subview removeFromSuperviewWithoutNeedingDisplay]; + [subviews release]; + [self.window setFrame:windowFrame display:YES animate:animate]; + + if ([_lastSelectedController respondsToSelector:@selector(viewDidDisappear)]) + [_lastSelectedController viewDidDisappear]; + if ([controller respondsToSelector:@selector(viewWillAppear)]) + [controller viewWillAppear]; + _lastSelectedController = controller; + + // Add controller view only after animation is ended to avoid blinking + if (animate) + [self performSelector:@selector(setContentView:) withObject:controllerView afterDelay:0.0]; + else + [self performSelector:@selector(setContentView:) withObject:controllerView]; + + // Insert view controller into responder chain + [self patchResponderChain]; +} + +- (void)resetFirstResponderInView:(NSView *)view +{ + BOOL isNotButton = ![view isKindOfClass:[NSButton class]]; + BOOL canBecomeKey = view.canBecomeKeyView; + if (isNotButton && canBecomeKey) + { + [self.window makeFirstResponder:view]; + } + else + { + for (NSView *subview in view.subviews) + [self resetFirstResponderInView:subview]; + } +} + +- (void)setContentView:(NSView *)view +{ + [self.window.contentView addSubview:view]; + [self resetFirstResponderInView:self.window.contentView]; +} + +- (void)toolbarItemDidClick:(id)sender +{ + [self updateViewControllerWithAnimation:YES]; + + [[NSNotificationCenter defaultCenter] postNotificationName:kMASPreferencesWindowControllerDidChangeViewNotification object:self]; +} + +#pragma mark - +#pragma mark Public methods + +- (void)selectControllerAtIndex:(NSUInteger)controllerIndex withAnimation:(BOOL)animate +{ + if (!NSLocationInRange(controllerIndex, NSMakeRange(0, _viewControllers.count))) + return; + + NSViewController *controller = [_viewControllers objectAtIndex:controllerIndex]; + NSString *newItemIdentifier = controller.toolbarItemIdentifier; + self.window.toolbar.selectedItemIdentifier = newItemIdentifier; + [self updateViewControllerWithAnimation:animate]; +} + +#pragma mark - +#pragma mark Actions + +- (IBAction)goNextTab:(id)sender +{ + NSUInteger selectedIndex = self.indexOfSelectedController; + NSUInteger numberOfControllers = [_viewControllers count]; + selectedIndex = (selectedIndex + 1) % numberOfControllers; + [self selectControllerAtIndex:selectedIndex withAnimation:YES]; +} + +- (IBAction)goPreviousTab:(id)sender +{ + NSUInteger selectedIndex = self.indexOfSelectedController; + NSUInteger numberOfControllers = [_viewControllers count]; + selectedIndex = (selectedIndex + numberOfControllers - 1) % numberOfControllers; + [self selectControllerAtIndex:selectedIndex withAnimation:YES]; +} + +@end