diff --git a/.gitignore b/.gitignore index 248e034..267a840 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +graphics build highlight highlight-* diff --git a/ChangeLog.txt b/ChangeLog.txt index 1929088..26d0800 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,16 @@ +2.0.2: + * Modified ReadMe.txt to include the latest info on the Xcode 3.2 conflict + * Include a link to Andre Simon's page with previews of color styles + +2.0.1: + * Corrected build of Highlight to run on Leopard. + * Stop redirecting stdout of colorize.sh to stdin. Error output will appear + in the console instead of the preview. + * Added qlcc_debug option. To enable, use: + defaults write org.n8gray.qlcolorcode qlcc_debug 1 + To disable, use: + defaults delete org.n8gray.qlcolorcode qlcc_debug + 2.0: * Added a note about conflict with Xcode 3.2's source code QL plugin. If you're having problems with QLCC on Snow Leopard please read it! diff --git a/Common.m b/Common.m index 826e30c..70e5d8e 100644 --- a/Common.m +++ b/Common.m @@ -25,7 +25,8 @@ NSPipe *pipe; pipe = [NSPipe pipe]; [task setStandardOutput: pipe]; - [task setStandardError: pipe]; + // Let stderr go to the usual place + //[task setStandardError: pipe]; NSFileHandle *file; file = [pipe fileHandleForReading]; @@ -69,6 +70,9 @@ NSMutableDictionary *env = [NSMutableDictionary dictionaryWithDictionary: [[NSProcessInfo processInfo] environment]]; [env addEntriesFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: +#ifdef DEBUG + @"1", @"qlcc_debug", +#endif @"9", @"fontSizePoints", @"Monaco", @"font", @"ide-xcode", @"hlTheme", @@ -85,7 +89,8 @@ output = runTask(cmd, env, status); if (*status != 0) { - NSLog(@"QLColorCode: colorize.sh failed with exit code %d", *status); + NSLog(@"QLColorCode: colorize.sh failed with exit code %d. Command was (%@).", + *status, cmd); } return output; } diff --git a/Disable XCode QL Plugin.scpt b/Disable XCode QL Plugin.scpt new file mode 100755 index 0000000..2e7c964 --- /dev/null +++ b/Disable XCode QL Plugin.scpt @@ -0,0 +1,8 @@ +#!/usr/bin/osascript + +on run + do shell script "if test \\! -d /Developer/Applications/Xcode.app/Contents/Library/QuickLook/SourceCode.qlgenerator; then echo 'I could not locate the XCode plugin. Have you already disabled it?'; exit 1; fi" + do shell script "x=/Developer/Applications/Xcode.app/Contents/Library/QuickLook/SourceCode.qlgenerator; sudo rm -rf $x.disabled; sudo mv $x $x.disabled" with administrator privileges + do shell script "qlmanage -r" + display dialog "The XCode plugin has been disabled" buttons {"OK"} default button 1 +end run diff --git a/Notes.txt b/Notes.txt index f53e5f8..c2c30b7 100644 --- a/Notes.txt +++ b/Notes.txt @@ -2,8 +2,8 @@ Based on highlight: http://www.andre-simon.de/index.html (Was based on pygments: http://pygments.org) When installing a new version of highlight, make sure to update the -"highlight" symlink in the project dir. Also patch with -highlight-2.6.6-getConfDir.diff if necessary. +"highlight" symlink in the project dir. Also merge in any updates to +filetypes.conf The version is handled in the Current Project Version variable in the project. diff --git a/QLColorCode.xcodeproj/project.pbxproj b/QLColorCode.xcodeproj/project.pbxproj index 649bc18..71fd8f9 100644 --- a/QLColorCode.xcodeproj/project.pbxproj +++ b/QLColorCode.xcodeproj/project.pbxproj @@ -26,15 +26,11 @@ 0E8776580D08E004005040B4 /* Common.m in Sources */ = {isa = PBXBuildFile; fileRef = 0E8776560D08E004005040B4 /* Common.m */; }; 0E8776B70D08ED64005040B4 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E8776B60D08ED64005040B4 /* WebKit.framework */; }; 0E8776BD0D08EDA4005040B4 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0E8776BC0D08EDA4005040B4 /* AppKit.framework */; }; - 0E913A0A0D10B8060067BAD6 /* filetypes.conf in Copy .conf Files */ = {isa = PBXBuildFile; fileRef = 0E913A090D10B8060067BAD6 /* filetypes.conf */; }; + 0E8FBB64141DA09D00269094 /* override in Resources */ = {isa = PBXBuildFile; fileRef = 0E8FBB56141DA09D00269094 /* override */; }; 0EB495D50D0FB13C00E86E0B /* colorize.sh in Resources */ = {isa = PBXBuildFile; fileRef = 0ECBBB5D0CFD447E00416538 /* colorize.sh */; }; - 0EB496B10D0FC70D00E86E0B /* ml.lang in Copy .lang Files */ = {isa = PBXBuildFile; fileRef = 0EB4960D0D0FC24000E86E0B /* ml.lang */; }; 0EC047970CFBDADF009C986E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0EC047960CFBDADF009C986E /* Foundation.framework */; }; 0ECBBA6C0CFCA37500416538 /* QLColorCode.qlgenerator in Copy to Library */ = {isa = PBXBuildFile; fileRef = 8D576316048677EA00EA77CD /* QLColorCode.qlgenerator */; }; - 0EF57D440D122791006084D5 /* ide-xcode.style in Copy .style Files */ = {isa = PBXBuildFile; fileRef = 0EF57D430D122791006084D5 /* ide-xcode.style */; }; - 0EF57D6E0D122934006084D5 /* objc.lang in Copy .lang Files */ = {isa = PBXBuildFile; fileRef = 0EF57D6D0D122934006084D5 /* objc.lang */; }; - 0EF57E6A0D125AB2006084D5 /* slateGreen.style in Copy .style Files */ = {isa = PBXBuildFile; fileRef = 0EF57E690D125AB2006084D5 /* slateGreen.style */; }; - 0EF57F2F0D128219006084D5 /* c.lang in Copy .lang Files */ = {isa = PBXBuildFile; fileRef = 0EF57F2E0D128219006084D5 /* c.lang */; }; + 0EE90E861098CE5800468467 /* Script notes.txt in Resources */ = {isa = PBXBuildFile; fileRef = 0EE90E851098CE5800468467 /* Script notes.txt */; }; 2C05A19C06CAA52B00D84F6F /* GeneratePreviewForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */; }; 61E3BCFB0870B4F2002186A0 /* GenerateThumbnailForURL.m in Sources */ = {isa = PBXBuildFile; fileRef = 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */; }; 8D576312048677EA00EA77CD /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = 08FB77B6FE84183AC02AAC07 /* main.c */; settings = {ATTRIBUTES = (); }; }; @@ -56,30 +52,6 @@ /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ - 0E913A110D10B84D0067BAD6 /* Copy .conf Files */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = override/config; - dstSubfolderSpec = 7; - files = ( - 0E913A0A0D10B8060067BAD6 /* filetypes.conf in Copy .conf Files */, - ); - name = "Copy .conf Files"; - runOnlyForDeploymentPostprocessing = 0; - }; - 0EB496B00D0FC68300E86E0B /* Copy .lang Files */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = override/langDefs; - dstSubfolderSpec = 7; - files = ( - 0EF57F2F0D128219006084D5 /* c.lang in Copy .lang Files */, - 0EF57D6E0D122934006084D5 /* objc.lang in Copy .lang Files */, - 0EB496B10D0FC70D00E86E0B /* ml.lang in Copy .lang Files */, - ); - name = "Copy .lang Files"; - runOnlyForDeploymentPostprocessing = 0; - }; 0ECBBA6F0CFCA39E00416538 /* Copy to Library */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 12; @@ -91,18 +63,6 @@ name = "Copy to Library"; runOnlyForDeploymentPostprocessing = 0; }; - 0EF57D6C0D1228E3006084D5 /* Copy .style Files */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = override/themes; - dstSubfolderSpec = 7; - files = ( - 0EF57E6A0D125AB2006084D5 /* slateGreen.style in Copy .style Files */, - 0EF57D440D122791006084D5 /* ide-xcode.style in Copy .style Files */, - ); - name = "Copy .style Files"; - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -114,17 +74,15 @@ 0E8776560D08E004005040B4 /* Common.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Common.m; sourceTree = ""; }; 0E8776B60D08ED64005040B4 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = SDKs/MacOSX10.5.sdk/System/Library/Frameworks/WebKit.framework; sourceTree = DEVELOPER_DIR; }; 0E8776BC0D08EDA4005040B4 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework; sourceTree = DEVELOPER_DIR; }; - 0E913A090D10B8060067BAD6 /* filetypes.conf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = filetypes.conf; sourceTree = ""; }; - 0EB4960D0D0FC24000E86E0B /* ml.lang */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ml.lang; sourceTree = ""; }; + 0E8FBB56141DA09D00269094 /* override */ = {isa = PBXFileReference; lastKnownFileType = folder; path = override; sourceTree = ""; }; 0EC047960CFBDADF009C986E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; 0EC047F20CFC000A009C986E /* Notes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Notes.txt; sourceTree = ""; }; 0ECBBB360CFCF98600416538 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; 0ECBBB5D0CFD447E00416538 /* colorize.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = colorize.sh; sourceTree = ""; }; - 0EF57D430D122791006084D5 /* ide-xcode.style */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "ide-xcode.style"; sourceTree = ""; }; - 0EF57D6D0D122934006084D5 /* objc.lang */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = objc.lang; sourceTree = ""; }; + 0EE90E6F1098BE1E00468467 /* Disable XCode QL Plugin.scpt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.scpt; path = "Disable XCode QL Plugin.scpt"; sourceTree = ""; }; + 0EE90E841098CDDF00468467 /* Restore XCode QL Plugin.scpt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.scpt; path = "Restore XCode QL Plugin.scpt"; sourceTree = ""; }; + 0EE90E851098CE5800468467 /* Script notes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Script notes.txt"; sourceTree = ""; }; 0EF57E4D0D123DD0006084D5 /* LICENSE.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE.txt; sourceTree = ""; }; - 0EF57E690D125AB2006084D5 /* slateGreen.style */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = slateGreen.style; sourceTree = ""; }; - 0EF57F2E0D128219006084D5 /* c.lang */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = c.lang; sourceTree = ""; }; 2C05A19B06CAA52B00D84F6F /* GeneratePreviewForURL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratePreviewForURL.m; sourceTree = ""; }; 61E3BCFA0870B4F2002186A0 /* GenerateThumbnailForURL.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = GenerateThumbnailForURL.m; sourceTree = ""; }; 8D576316048677EA00EA77CD /* QLColorCode.qlgenerator */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = QLColorCode.qlgenerator; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -155,6 +113,7 @@ 089C166AFE841209C02AAC07 /* QLColorCode */ = { isa = PBXGroup; children = ( + 0EE90E7F1098C84600468467 /* Scripts */, 0EC047F20CFC000A009C986E /* Notes.txt */, 0ECBBB360CFCF98600416538 /* ReadMe.txt */, 0E51C65F0D04E492007853CB /* ChangeLog.txt */, @@ -184,12 +143,7 @@ 089C167CFE841241C02AAC07 /* Resources */ = { isa = PBXGroup; children = ( - 0EF57F2E0D128219006084D5 /* c.lang */, - 0EB4960D0D0FC24000E86E0B /* ml.lang */, - 0EF57D6D0D122934006084D5 /* objc.lang */, - 0EF57D430D122791006084D5 /* ide-xcode.style */, - 0EF57E690D125AB2006084D5 /* slateGreen.style */, - 0E913A090D10B8060067BAD6 /* filetypes.conf */, + 0E8FBB56141DA09D00269094 /* override */, 8D576317048677EA00EA77CD /* Info.plist */, 8D5B49A704867FD3000E48DA /* InfoPlist.strings */, ); @@ -209,6 +163,16 @@ name = Source; sourceTree = ""; }; + 0EE90E7F1098C84600468467 /* Scripts */ = { + isa = PBXGroup; + children = ( + 0EE90E851098CE5800468467 /* Script notes.txt */, + 0EE90E6F1098BE1E00468467 /* Disable XCode QL Plugin.scpt */, + 0EE90E841098CDDF00468467 /* Restore XCode QL Plugin.scpt */, + ); + name = Scripts; + sourceTree = ""; + }; 19C28FB6FE9D52B211CA2CBB /* Products */ = { isa = PBXGroup; children = ( @@ -239,9 +203,6 @@ 8D57630F048677EA00EA77CD /* Resources */, 8D576311048677EA00EA77CD /* Sources */, 8D576313048677EA00EA77CD /* Frameworks */, - 0EB496B00D0FC68300E86E0B /* Copy .lang Files */, - 0EF57D6C0D1228E3006084D5 /* Copy .style Files */, - 0E913A110D10B84D0067BAD6 /* Copy .conf Files */, 0E9139D70D10A8320067BAD6 /* Install highlight */, 0ECBBA6F0CFCA39E00416538 /* Copy to Library */, 0E1280381061C3EA0078EC05 /* Reset quicklookd */, @@ -263,7 +224,14 @@ isa = PBXProject; buildConfigurationList = 2CA326220896AD4900168862 /* Build configuration list for PBXProject "QLColorCode" */; compatibilityVersion = "Xcode 3.0"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); mainGroup = 089C166AFE841209C02AAC07 /* QLColorCode */; projectDirPath = ""; projectRoot = ""; @@ -281,6 +249,8 @@ files = ( 0EB495D50D0FB13C00E86E0B /* colorize.sh in Resources */, 8D5B49A804867FD3000E48DA /* InfoPlist.strings in Resources */, + 0EE90E861098CE5800468467 /* Script notes.txt in Resources */, + 0E8FBB64141DA09D00269094 /* override in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -327,8 +297,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = "/bin/zsh -x"; - shellScript = "set err_exit\ncd $PROJECT_DIR/highlight\nexport CFLAGS='-arch i386 -arch ppc -arch x86_64'\nexport LDFLAGS=$CFLAGS\nmake\n# Make sure it was built universal\nlipo -info src/highlight | grep -q ppc || exit 1\nlipo -info src/highlight | grep -q i386 || exit 1\nlipo -info src/highlight | grep -q x86_64 || exit 1\nmake \\\n\tDESTDIR=$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH \\\n\tPREFIX=/highlight/ \\\n\tinstall\n\n"; - showEnvVarsInLog = 0; + shellScript = "set err_exit\ncd $PROJECT_DIR/highlight\nX=\"-arch i386 -arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_DEPLOYMENT_TARGET\"\nexport CFLAGS=$X\nexport LDFLAGS=$X\nmake -j 2\n# Make sure it was built universal\nlipo -info src/highlight | grep -q i386 || exit 1\nlipo -info src/highlight | grep -q x86_64 || exit 1\nmake \\\n\tDESTDIR=$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH \\\n\tPREFIX=/highlight/ \\\n\tinstall\n\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -391,10 +360,6 @@ isa = XCBuildConfiguration; buildSettings = { COPY_PHASE_STRIP = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.5.sdk/System/Library/Frameworks\"", - ); GCC_DYNAMIC_NO_PIC = NO; GCC_ENABLE_FIX_AND_CONTINUE = YES; GCC_OPTIMIZATION_LEVEL = 0; @@ -412,10 +377,6 @@ isa = XCBuildConfiguration; buildSettings = { DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "\"$(DEVELOPER_DIR)/SDKs/MacOSX10.5.sdk/System/Library/Frameworks\"", - ); GCC_PRECOMPILE_PREFIX_HEADER = NO; INFOPLIST_FILE = Info.plist; INSTALL_PATH = /Library/QuickLook; @@ -427,28 +388,27 @@ 2CA326230896AD4900168862 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - CURRENT_PROJECT_VERSION = 2.0.0; + CURRENT_PROJECT_VERSION = 2.0.2; GCC_PREPROCESSOR_DEFINITIONS = DEBUG; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; PREBINDING = NO; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + SDKROOT = macosx; }; name = Debug; }; 2CA326240896AD4900168862 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = ( - ppc, - i386, - x86_64, - ); - CURRENT_PROJECT_VERSION = 2.0.0; + ARCHS = "$(ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1)"; + ARCHS_STANDARD_32_64_BIT_PRE_XCODE_3_1 = "x86_64 i386 ppc"; + CURRENT_PROJECT_VERSION = 2.0.2; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.6; PREBINDING = NO; - SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk"; + SDKROOT = macosx; }; name = Release; }; diff --git a/ReadMe.txt b/ReadMe.txt index 75dc200..19d8c65 100644 --- a/ReadMe.txt +++ b/ReadMe.txt @@ -5,8 +5,8 @@ QLColorCode =============================================================================== IMPORTANT NOTE FOR XCODE 3.2 (SHIPPED WITH SNOW LEOPARD) USERS: If you are running Xcode 3.2 or higher you will probably not see QLColorCode's -output. See here for details: - http://code.google.com/p/qlcolorcode/issues/detail?id=46 +output unless you disable Xcode's built-in source code qlgenerator. +See the end of this file for details. =============================================================================== This is a Quick Look plugin that renders source code with syntax highlighting, @@ -22,25 +22,24 @@ Setting the text encoding (default is UTF-8). Two settings are required. The first sets Highlight's encoding, the second sets Webkit's: defaults write org.n8gray.QLColorCode textEncoding UTF-16 defaults write org.n8gray.QLColorCode webkitTextEncoding UTF-16 + Setting the font: defaults write org.n8gray.QLColorCode font Monaco + the font size: defaults write org.n8gray.QLColorCode fontSizePoints 9 -the color style (see below): + +the color style (see http://www.andre-simon.de/dokuwiki/doku.php?id=theme_examples +or try slateGreen to see how I roll. Also included are solarized-light and solarized-dark +as seen at http://ethanschoonover.com/solarized): defaults write org.n8gray.QLColorCode hlTheme ide-xcode + any extra command-line flags for Highlight (see below): defaults write org.n8gray.QLColorCode extraHLFlags '-l -W' + the maximum size (in bytes) for previewed files: defaults write org.n8gray.QLColorCode maxFileSize 1000000 -The following color styles are included with QLColorCode: - acid, bipolar, blacknblue, bright, contrast, darkblue, - darkness, desert, easter, emacs, golden, greenlcd, ide-anjuta, - ide-codewarrior, ide-devcpp, ide-eclipse, ide-kdev, ide-msvcpp, ide-xcode, - kwrite, lucretia, matlab, moe, navy, nedit, neon, night, orion, pablo, - peachpuff, print, rand01, seashell, slateGreen, the, typical, vampire, - vim-dark, vim, whitengrey, zellner - Here are some useful 'highlight' command-line flags (from the man page): -F, --reformat=