Skip to content
Browse files

Initial commit

  • Loading branch information...
0 parents commit b01daeb758d4e103b09b26417b359d2b90b5805a @shnhrrsn shnhrrsn committed Jul 2, 2011
7 .gitignore
@@ -0,0 +1,7 @@
+build
+*.mode1v3
+*.pbxuser
+*.DS_Store
+*.xcworkspace
+xcuserdata
+
290 EGOTextMateFullScreen.xcodeproj/project.pbxproj
@@ -0,0 +1,290 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 9AA3EA2313BFDA6B0057B4CC /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9AA3EA2213BFDA6B0057B4CC /* Cocoa.framework */; };
+ 9AA3EA2D13BFDA6B0057B4CC /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9AA3EA2B13BFDA6B0057B4CC /* InfoPlist.strings */; };
+ 9AA3EA3C13BFDAA10057B4CC /* EGOTextMateFullScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AA3EA3B13BFDAA10057B4CC /* EGOTextMateFullScreen.m */; };
+ 9AA3EA4113BFE1630057B4CC /* OakProjectController_EGOTextMateFullScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AA3EA4013BFE1630057B4CC /* OakProjectController_EGOTextMateFullScreen.m */; };
+ 9AA3EA4413BFE1740057B4CC /* OakDocumentController_EGOTextMateFullScreen.m in Sources */ = {isa = PBXBuildFile; fileRef = 9AA3EA4313BFE1740057B4CC /* OakDocumentController_EGOTextMateFullScreen.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 9AA3EA1F13BFDA6B0057B4CC /* EGOTextMateFullScreen.tmplugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = EGOTextMateFullScreen.tmplugin; sourceTree = BUILT_PRODUCTS_DIR; };
+ 9AA3EA2213BFDA6B0057B4CC /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
+ 9AA3EA2513BFDA6B0057B4CC /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
+ 9AA3EA2613BFDA6B0057B4CC /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
+ 9AA3EA2713BFDA6B0057B4CC /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 9AA3EA2A13BFDA6B0057B4CC /* EGOTextMateFullScreen-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "EGOTextMateFullScreen-Info.plist"; sourceTree = "<group>"; };
+ 9AA3EA2C13BFDA6B0057B4CC /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+ 9AA3EA2E13BFDA6B0057B4CC /* EGOTextMateFullScreen-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "EGOTextMateFullScreen-Prefix.pch"; sourceTree = "<group>"; };
+ 9AA3EA3A13BFDAA10057B4CC /* EGOTextMateFullScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EGOTextMateFullScreen.h; sourceTree = "<group>"; };
+ 9AA3EA3B13BFDAA10057B4CC /* EGOTextMateFullScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EGOTextMateFullScreen.m; sourceTree = "<group>"; };
+ 9AA3EA3F13BFE1630057B4CC /* OakProjectController_EGOTextMateFullScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OakProjectController_EGOTextMateFullScreen.h; sourceTree = "<group>"; };
+ 9AA3EA4013BFE1630057B4CC /* OakProjectController_EGOTextMateFullScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OakProjectController_EGOTextMateFullScreen.m; sourceTree = "<group>"; };
+ 9AA3EA4213BFE1740057B4CC /* OakDocumentController_EGOTextMateFullScreen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OakDocumentController_EGOTextMateFullScreen.h; sourceTree = "<group>"; };
+ 9AA3EA4313BFE1740057B4CC /* OakDocumentController_EGOTextMateFullScreen.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OakDocumentController_EGOTextMateFullScreen.m; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 9AA3EA1C13BFDA6B0057B4CC /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9AA3EA2313BFDA6B0057B4CC /* Cocoa.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 9AA3EA1413BFDA6B0057B4CC = {
+ isa = PBXGroup;
+ children = (
+ 9AA3EA2813BFDA6B0057B4CC /* EGOTextMateFullScreen */,
+ 9AA3EA2113BFDA6B0057B4CC /* Frameworks */,
+ 9AA3EA2013BFDA6B0057B4CC /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 9AA3EA2013BFDA6B0057B4CC /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 9AA3EA1F13BFDA6B0057B4CC /* EGOTextMateFullScreen.tmplugin */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 9AA3EA2113BFDA6B0057B4CC /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 9AA3EA2213BFDA6B0057B4CC /* Cocoa.framework */,
+ 9AA3EA2413BFDA6B0057B4CC /* Other Frameworks */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 9AA3EA2413BFDA6B0057B4CC /* Other Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 9AA3EA2513BFDA6B0057B4CC /* AppKit.framework */,
+ 9AA3EA2613BFDA6B0057B4CC /* CoreData.framework */,
+ 9AA3EA2713BFDA6B0057B4CC /* Foundation.framework */,
+ );
+ name = "Other Frameworks";
+ sourceTree = "<group>";
+ };
+ 9AA3EA2813BFDA6B0057B4CC /* EGOTextMateFullScreen */ = {
+ isa = PBXGroup;
+ children = (
+ 9AA3EA3E13BFE1480057B4CC /* Full Screen Classes */,
+ 9AA3EA2913BFDA6B0057B4CC /* Supporting Files */,
+ );
+ path = EGOTextMateFullScreen;
+ sourceTree = "<group>";
+ };
+ 9AA3EA2913BFDA6B0057B4CC /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 9AA3EA2A13BFDA6B0057B4CC /* EGOTextMateFullScreen-Info.plist */,
+ 9AA3EA2B13BFDA6B0057B4CC /* InfoPlist.strings */,
+ 9AA3EA2E13BFDA6B0057B4CC /* EGOTextMateFullScreen-Prefix.pch */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 9AA3EA3E13BFE1480057B4CC /* Full Screen Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 9AA3EA3A13BFDAA10057B4CC /* EGOTextMateFullScreen.h */,
+ 9AA3EA3B13BFDAA10057B4CC /* EGOTextMateFullScreen.m */,
+ 9AA3EA3F13BFE1630057B4CC /* OakProjectController_EGOTextMateFullScreen.h */,
+ 9AA3EA4013BFE1630057B4CC /* OakProjectController_EGOTextMateFullScreen.m */,
+ 9AA3EA4213BFE1740057B4CC /* OakDocumentController_EGOTextMateFullScreen.h */,
+ 9AA3EA4313BFE1740057B4CC /* OakDocumentController_EGOTextMateFullScreen.m */,
+ );
+ name = "Full Screen Classes";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 9AA3EA1E13BFDA6B0057B4CC /* EGOTextMateFullScreen */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 9AA3EA3113BFDA6C0057B4CC /* Build configuration list for PBXNativeTarget "EGOTextMateFullScreen" */;
+ buildPhases = (
+ 9AA3EA1B13BFDA6B0057B4CC /* Sources */,
+ 9AA3EA1C13BFDA6B0057B4CC /* Frameworks */,
+ 9AA3EA1D13BFDA6B0057B4CC /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = EGOTextMateFullScreen;
+ productName = EGOTextMateFullScreen;
+ productReference = 9AA3EA1F13BFDA6B0057B4CC /* EGOTextMateFullScreen.tmplugin */;
+ productType = "com.apple.product-type.bundle";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 9AA3EA1613BFDA6B0057B4CC /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ ORGANIZATIONNAME = enormego;
+ };
+ buildConfigurationList = 9AA3EA1913BFDA6B0057B4CC /* Build configuration list for PBXProject "EGOTextMateFullScreen" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 9AA3EA1413BFDA6B0057B4CC;
+ productRefGroup = 9AA3EA2013BFDA6B0057B4CC /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 9AA3EA1E13BFDA6B0057B4CC /* EGOTextMateFullScreen */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 9AA3EA1D13BFDA6B0057B4CC /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9AA3EA2D13BFDA6B0057B4CC /* InfoPlist.strings in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 9AA3EA1B13BFDA6B0057B4CC /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9AA3EA3C13BFDAA10057B4CC /* EGOTextMateFullScreen.m in Sources */,
+ 9AA3EA4113BFE1630057B4CC /* OakProjectController_EGOTextMateFullScreen.m in Sources */,
+ 9AA3EA4413BFE1740057B4CC /* OakDocumentController_EGOTextMateFullScreen.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 9AA3EA2B13BFDA6B0057B4CC /* InfoPlist.strings */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 9AA3EA2C13BFDA6B0057B4CC /* en */,
+ );
+ name = InfoPlist.strings;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 9AA3EA2F13BFDA6C0057B4CC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CLANG_ENABLE_OBJC_ARC = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ 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_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 9AA3EA3013BFDA6C0057B4CC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+ CLANG_ENABLE_OBJC_ARC = NO;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.7;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 9AA3EA3213BFDA6C0057B4CC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "EGOTextMateFullScreen/EGOTextMateFullScreen-Prefix.pch";
+ INFOPLIST_FILE = "EGOTextMateFullScreen/EGOTextMateFullScreen-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = tmplugin;
+ };
+ name = Debug;
+ };
+ 9AA3EA3313BFDA6C0057B4CC /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "EGOTextMateFullScreen/EGOTextMateFullScreen-Prefix.pch";
+ INFOPLIST_FILE = "EGOTextMateFullScreen/EGOTextMateFullScreen-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ WRAPPER_EXTENSION = tmplugin;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 9AA3EA1913BFDA6B0057B4CC /* Build configuration list for PBXProject "EGOTextMateFullScreen" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 9AA3EA2F13BFDA6C0057B4CC /* Debug */,
+ 9AA3EA3013BFDA6C0057B4CC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 9AA3EA3113BFDA6C0057B4CC /* Build configuration list for PBXNativeTarget "EGOTextMateFullScreen" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 9AA3EA3213BFDA6C0057B4CC /* Debug */,
+ 9AA3EA3313BFDA6C0057B4CC /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 9AA3EA1613BFDA6B0057B4CC /* Project object */;
+}
30 EGOTextMateFullScreen/EGOTextMateFullScreen-Info.plist
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.enormego.${PRODUCT_NAME:rfc1034identifier}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2011 enormego. All rights reserved.</string>
+ <key>NSPrincipalClass</key>
+ <string>EGOTextMateFullScreen</string>
+</dict>
+</plist>
7 EGOTextMateFullScreen/EGOTextMateFullScreen-Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'EGOTextMateFullScreen' target in the 'EGOTextMateFullScreen' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif
17 EGOTextMateFullScreen/EGOTextMateFullScreen.h
@@ -0,0 +1,17 @@
+//
+// EGOTextMateFullScreen.h
+// EGOTextMateFullScreen
+//
+// Created by Shaun Harrison on 7/2/11.
+// Copyright 2011 enormego. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+@interface EGOTextMateFullScreen : NSObject {
+
+}
+
+- (id)initWithPlugInController:(id)aController;
+
+@end
147 EGOTextMateFullScreen/EGOTextMateFullScreen.m
@@ -0,0 +1,147 @@
+//
+// EGOTextMateFullScreen.m
+// EGOTextMateFullScreen
+//
+// Created by Shaun Harrison on 7/2/11.
+// Copyright 2011 enormego. All rights reserved.
+//
+
+#import "EGOTextMateFullScreen.h"
+#import </Developer/SDKs/MacOSX10.7.sdk/usr/include/objc/objc-class.h>
+#import "OakDocumentController_EGOTextMateFullScreen.h"
+#import "OakProjectController_EGOTextMateFullScreen.h"
+
+void egotmfs_appendMethod(Class aClass, Class bClass, SEL bSel);
+BOOL egotmfs_methodSwizzle(Class klass, SEL origSel, SEL altSel, BOOL forInstance);
+
+static BOOL hasSwizzled = NO;
+
+
+@implementation EGOTextMateFullScreen
+
++ (void)initialize {
+ [super initialize];
+
+ if(!hasSwizzled) {
+ egotmfs_appendMethod(NSClassFromString(@"OakDocumentController"), [OakDocumentController_EGOTextMateFullScreen class], @selector(windowDidLoad_EGOTextMateFullScreen));
+ egotmfs_methodSwizzle(NSClassFromString(@"OakDocumentController"), @selector(windowDidLoad), @selector(windowDidLoad_EGOTextMateFullScreen), YES);
+
+ egotmfs_appendMethod(NSClassFromString(@"OakProjectController"), [OakProjectController_EGOTextMateFullScreen class], @selector(windowDidLoad_EGOTextMateFullScreen));
+ egotmfs_methodSwizzle(NSClassFromString(@"OakProjectController"), @selector(windowDidLoad), @selector(windowDidLoad_EGOTextMateFullScreen), YES);
+
+ hasSwizzled = YES;
+
+ // If windows were opened before this plugin was loaded, we loop through and turn on full screen
+ for(NSWindow* window in [NSApplication sharedApplication].windows) {
+ if([window.windowController isKindOfClass:NSClassFromString(@"OakDocumentController")] ||
+ [window.windowController isKindOfClass:NSClassFromString(@"OakProjectController")]) {
+ window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
+ }
+ }
+ }
+}
+
+- (id)initWithPlugInController:(id)aController {
+ if ((self = [super init])) {
+ // Initialization code here.
+ }
+
+ return self;
+}
+
+@end
+
+#pragma mark -
+#pragma mark Method swizzling
+
+void egotmfs_appendMethod(Class aClass, Class bClass, SEL bSel) {
+ if(!aClass) return;
+ if(!bClass) return;
+ Method bMethod = class_getInstanceMethod(bClass, bSel);
+ class_addMethod(aClass, method_getName(bMethod), method_getImplementation(bMethod), method_getTypeEncoding(bMethod));
+}
+
+/**
+ * @credit http://www.cocoadev.com/index.pl?MethodSwizzling
+ */
+BOOL egotmfs_methodSwizzle(Class klass, SEL origSel, SEL altSel, BOOL forInstance) {
+ // Make sure the class isn't nil
+ if (klass == nil)
+ return NO;
+
+ // Look for the methods in the implementation of the immediate class
+ Class iterKlass = (forInstance ? klass : klass->isa);
+ Method origMethod = NULL, altMethod = NULL;
+ unsigned int methodCount = 0;
+ Method *mlist = class_copyMethodList(iterKlass, &methodCount);
+ if(mlist != NULL) {
+ int i;
+ for (i = 0; i < methodCount; ++i) {
+ if(method_getName(mlist[i]) == origSel )
+ origMethod = mlist[i];
+ if (method_getName(mlist[i]) == altSel)
+ altMethod = mlist[i];
+ }
+ }
+
+ // if origMethod was not found, that means it is not in the immediate class
+ // try searching the entire class hierarchy with class_getInstanceMethod
+ // if not found or not added, bail out
+ if(origMethod == NULL) {
+ origMethod = class_getInstanceMethod(iterKlass, origSel);
+ if(origMethod == NULL) {
+ return NO;
+ }
+
+ if(class_addMethod(iterKlass, method_getName(origMethod), method_getImplementation(origMethod), method_getTypeEncoding(origMethod)) == NO) {
+ return NO;
+ }
+ }
+
+ // same thing with altMethod
+ if(altMethod == NULL) {
+ altMethod = class_getInstanceMethod(iterKlass, altSel);
+ if(altMethod == NULL )
+ return NO;
+ if(class_addMethod(iterKlass, method_getName(altMethod), method_getImplementation(altMethod), method_getTypeEncoding(altMethod)) == NO )
+ return NO;
+ }
+
+ //clean up
+ free(mlist);
+
+ // we now have to look up again for the methods in case they were not in the class implementation,
+ //but in one of the superclasses. In the latter, that means we added the method to the class,
+ //but the Leopard APIs is only 'class_addMethod', in which case we need to have the pointer
+ //to the Method objects actually stored in the Class structure (in the Tiger implementation,
+ //a new mlist was explicitely created with the added methods and directly added to the class;
+ //thus we were able to add a new Method AND get the pointer to it)
+
+ // for simplicity, just use the same code as in the first step
+ origMethod = NULL;
+ altMethod = NULL;
+ methodCount = 0;
+ mlist = class_copyMethodList(iterKlass, &methodCount);
+ if(mlist != NULL) {
+ int i;
+ for (i = 0; i < methodCount; ++i) {
+ if(method_getName(mlist[i]) == origSel )
+ origMethod = mlist[i];
+ if (method_getName(mlist[i]) == altSel)
+ altMethod = mlist[i];
+ }
+ }
+
+ // bail if one of the methods doesn't exist anywhere
+ // with all we did, this should not happen, though
+ if (origMethod == NULL || altMethod == NULL)
+ return NO;
+
+ // now swizzle
+ method_exchangeImplementations(origMethod, altMethod);
+
+ //clean up
+ free(mlist);
+
+ return YES;
+}
15 EGOTextMateFullScreen/OakDocumentController_EGOTextMateFullScreen.h
@@ -0,0 +1,15 @@
+//
+// OakDocumentController_EGOTextMateFullScreen.h
+// EGOTextMateFullScreen
+//
+// Created by Shaun Harrison on 7/2/11.
+// Copyright 2011 enormego. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface OakDocumentController_EGOTextMateFullScreen : NSWindowController
+
+- (void)windowDidLoad_EGOTextMateFullScreen;
+
+@end
18 EGOTextMateFullScreen/OakDocumentController_EGOTextMateFullScreen.m
@@ -0,0 +1,18 @@
+//
+// OakDocumentController_EGOTextMateFullScreen.m
+// EGOTextMateFullScreen
+//
+// Created by Shaun Harrison on 7/2/11.
+// Copyright 2011 enormego. All rights reserved.
+//
+
+#import "OakDocumentController_EGOTextMateFullScreen.h"
+
+@implementation OakDocumentController_EGOTextMateFullScreen
+
+- (void)windowDidLoad_EGOTextMateFullScreen {
+ [self windowDidLoad_EGOTextMateFullScreen];
+ self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
+}
+
+@end
15 EGOTextMateFullScreen/OakProjectController_EGOTextMateFullScreen.h
@@ -0,0 +1,15 @@
+//
+// OakProjectController_EGOTextMateFullScreen.h
+// EGOTextMateFullScreen
+//
+// Created by Shaun Harrison on 7/2/11.
+// Copyright 2011 enormego. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@interface OakProjectController_EGOTextMateFullScreen : NSWindowController
+
+- (void)windowDidLoad_EGOTextMateFullScreen;
+
+@end
18 EGOTextMateFullScreen/OakProjectController_EGOTextMateFullScreen.m
@@ -0,0 +1,18 @@
+//
+// OakProjectController_EGOTextMateFullScreen.m
+// EGOTextMateFullScreen
+//
+// Created by Shaun Harrison on 7/2/11.
+// Copyright 2011 enormego. All rights reserved.
+//
+
+#import "OakProjectController_EGOTextMateFullScreen.h"
+
+@implementation OakProjectController_EGOTextMateFullScreen
+
+- (void)windowDidLoad_EGOTextMateFullScreen {
+ [self windowDidLoad_EGOTextMateFullScreen];
+ self.window.collectionBehavior = NSWindowCollectionBehaviorFullScreenPrimary;
+}
+
+@end
2 EGOTextMateFullScreen/en.lproj/InfoPlist.strings
@@ -0,0 +1,2 @@
+/* Localized versions of Info.plist keys */
+
1 README
@@ -0,0 +1 @@
+This plugin adds native full screen app support to TextMate in Mac OS X Lion.

0 comments on commit b01daeb

Please sign in to comment.
Something went wrong with that request. Please try again.