diff --git a/Tools/capp/Resources/Templates/NibApplication/Resources/MainMenu.xib b/Tools/capp/Resources/Templates/NibApplication/Resources/MainMenu.xib index e9ae190c4..0c98cf0b6 100644 --- a/Tools/capp/Resources/Templates/NibApplication/Resources/MainMenu.xib +++ b/Tools/capp/Resources/Templates/NibApplication/Resources/MainMenu.xib @@ -1,28 +1,37 @@ - + 1050 - 9G55 - 677 - 949.43 - 353.00 - + 10J869 + 1306 + 1038.35 + 461.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 1306 + + YES - + NSView + NSMenu + NSWindowTemplate + NSMenuItem + NSSliderCell + NSTextField + NSTextFieldCell + NSSlider + NSCustomObject YES - com.apple.InterfaceBuilderKit com.apple.InterfaceBuilder.CocoaPlugin YES - - YES - - + YES + YES @@ -79,7 +88,7 @@ - UHJlZmVyZW5jZXPigKY + Preferences… , 1048576 2147483647 @@ -200,7 +209,7 @@ - T3BlbuKApg + Open… o 1048576 2147483647 @@ -264,7 +273,7 @@ - U2F2ZSBBc+KApg + Save As… S 1179648 2147483647 @@ -302,7 +311,7 @@ - UHJpbnTigKY + Print… p 1048576 2147483647 @@ -425,7 +434,7 @@ YES - RmluZOKApg + Find… f 1048576 2147483647 @@ -490,7 +499,7 @@ YES - U2hvdyBTcGVsbGluZ+KApg + Show Spelling… : 1048576 2147483647 @@ -1017,7 +1026,7 @@ - Q3VzdG9taXplIFRvb2xiYXLigKY + Customize Toolbar… 1048576 2147483647 @@ -1118,7 +1127,6 @@ Window NSWindow - {3.40282e+38, 3.40282e+38} 256 @@ -1129,21 +1137,22 @@ 301 {{192, 143}, {96, 21}} + YES - -2080244224 + -2079981824 0 Helvetica - 1.200000e+01 + 12 16 - 1.000000e+02 - 0.000000e+00 - 5.000000e+01 - 0.000000e+00 + 100 + 0.0 + 50 + 0.0 0 1 NO @@ -1155,6 +1164,7 @@ 301 {{192, 191}, {96, 22}} + YES -1804468671 @@ -1162,7 +1172,7 @@ LucidaGrande - 1.300000e+01 + 13 1044 @@ -1188,11 +1198,12 @@ - {480, 360} + {{7, 11}, {480, 360}} + {{0, 0}, {1440, 878}} - {3.40282e+38, 3.40282e+38} + {1e+13, 1e+13} AppController @@ -1719,28 +1730,26 @@ YES 0 - - YES - + -2 - - RmlsZSdzIE93bmVyA + + File's Owner -1 - + First Responder -3 - + Application @@ -1756,7 +1765,7 @@ - + MainMenu @@ -2292,7 +2301,7 @@ YES - + 372 @@ -2612,7 +2621,7 @@ 450 - + 452 @@ -2646,7 +2655,7 @@ YES - + YES -1.IBPluginDependency -2.IBPluginDependency @@ -2781,10 +2790,10 @@ 354.IBPluginDependency 354.ImportedFromIB2 371.IBEditorWindowLastContentRect + 371.IBPluginDependency 371.IBWindowTemplateEditedContentRect 371.NSWindowTemplate.visibleAtLaunch 371.editorWindowContentRectSynchronizationRect - 371.windowTemplate.maxSize 372.IBPluginDependency 375.IBPluginDependency 376.IBEditorWindowLastContentRect @@ -2877,117 +2886,117 @@ YES com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilderKit - com.apple.InterfaceBuilderKit com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin + + com.apple.InterfaceBuilder.CocoaPlugin + {{596, 852}, {216, 23}} 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 - + com.apple.InterfaceBuilder.CocoaPlugin - + {{608, 612}, {275, 83}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + 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 - + com.apple.InterfaceBuilder.CocoaPlugin - + {{608, 612}, {241, 103}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + {{525, 802}, {197, 73}} {{143, 285}, {478, 20}} com.apple.InterfaceBuilder.CocoaPlugin - + {74, 862} {{6, 978}, {478, 20}} com.apple.InterfaceBuilder.CocoaPlugin @@ -2996,23 +3005,23 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + {{608, 612}, {215, 63}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + {{303, 221}, {480, 360}} + com.apple.InterfaceBuilder.CocoaPlugin {{303, 221}, {480, 360}} - + {{33, 99}, {480, 360}} - {3.40282e+38, 3.40282e+38} com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin {{437, 242}, {86, 43}} @@ -3067,60 +3076,52 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + {{155, 102}, {245, 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 - + com.apple.InterfaceBuilder.CocoaPlugin - + {{145, 474}, {199, 203}} com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - + YES - - YES - - - YES - + + YES - - YES - - - YES - + + 459 @@ -3134,15 +3135,44 @@ theWindow NSWindow + + theWindow + + theWindow + NSWindow + + - IBUserSource - + IBProjectSource + ./Classes/AppController.h 0 - ../adsfsdf.xcodeproj + 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/Tools/nib2cib/main.j b/Tools/nib2cib/main.j index 4102d29ae..7ab91ef33 100644 --- a/Tools/nib2cib/main.j +++ b/Tools/nib2cib/main.j @@ -439,7 +439,7 @@ function logFormatter(aString, aLevel, aTitle) function getThemeList(defaultTheme, options) { - var themes = [defaultTheme || getDefaultThemeName()]; + var themes = [defaultTheme || getAppKitDefaultThemeName()]; if (options.extraThemes) for (var i = 0; i < options.extraThemes.length; ++i) @@ -449,23 +449,62 @@ function getThemeList(defaultTheme, options) return themes; } -function getDefaultThemeName() +// Returns undefined if $CAPP_BUILD is not defined, false if path cannot be found in $CAPP_BUILD +function findInCappBuild(path, isDirectory, callback) { - var themeName = nil, - cappBuild = SYS.env["CAPP_BUILD"]; + var cappBuild = SYS.env["CAPP_BUILD"]; - if (cappBuild) + if (!cappBuild) + return undefined; + + cappBuild = FILE.canonical(cappBuild); + + if (FILE.isDirectory(cappBuild)) { - for (var i = 0; i < BuildTypes.length; ++i) + var result = null; + + for (var i = 0; i < BuildTypes.length && !result; ++i) { - var path = FILE.join(cappBuild, BuildTypes[i], "AppKit", "Info.plist"); + var findPath = FILE.join(cappBuild, BuildTypes[i], path); - themeName = themeNameFromPropertyList(path); - - if (themeName) - break; + if ((isDirectory && FILE.isDirectory(findPath)) || (!isDirectory && FILE.exists(findPath))) + result = callback(findPath); } + + return result; } + else + return false; +} + +function findInInstalledFrameworks(path, isDirectory, callback) +{ + // NOTE: It's safe to use '/' directly in the path, we're guaranteed to be on a Mac + var frameworks = FILE.canonical(FILE.join(SYS.prefix, "packages/cappuccino/Frameworks")), + result = null, + findPath = FILE.join(frameworks, "Debug", path); + + if ((isDirectory && FILE.isDirectory(findPath)) || (!isDirectory && FILE.exists(findPath))) + result = callback(findPath); + + if (!result) + { + findPath = FILE.join(frameworks, path); + + if ((isDirectory && FILE.isDirectory(findPath)) || (!isDirectory && FILE.exists(findPath))) + result = callback(findPath); + } + + return result; +} + +function getAppKitDefaultThemeName() +{ + var callback = function(path) { return themeNameFromPropertyList(path); }, + themeName = findInCappBuild("AppKit/Info.plist", false, callback); + + if (!themeName) + themeName = findInInstalledFrameworks("AppKit/Info.plist", false, callback); return themeName || DefaultTheme; } @@ -512,25 +551,12 @@ function loadTheme(themeName, themeDir) if (!themeDir) { - // Try in $CAPP_BUILD - cappBuild = FILE.canonical(SYS.env["CAPP_BUILD"]); + var returnPath = function(path) { return path; }; - if (!cappBuild) - fail("$CAPP_BUILD is not set, exiting."); + themePath = findInCappBuild(blendName, true, returnPath); - if (!FILE.isDirectory(cappBuild)) - fail("$CAPP_BUILD does not exist: " + cappBuild) - - for (var i = 0; i < BuildTypes.length; ++i) - { - var path = FILE.join(cappBuild, BuildTypes[i], blendName); - - if (FILE.isDirectory(path)) - { - themePath = path; - break; - } - } + if (!themePath) + themePath = findInInstalledFrameworks("AppKit/Resources/" + blendName, true, returnPath); // Last resort, try the cwd if (!themePath) @@ -543,7 +569,7 @@ function loadTheme(themeName, themeDir) } if (!themePath) - fail("Cannot find the theme \"" + themeName + "\""); + fail('Cannot find the theme "' + themeName + '"'); return readTheme(themeName, themePath); }