Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeddable iTerm2Lib.framework + Demo App #366

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Binary file modified ColorPicker/ColorPicker.framework/Versions/A/ColorPicker
Binary file not shown.
Binary file modified ThirdParty/NMSSH.framework/Versions/A/NMSSH
Binary file not shown.
2,236 changes: 2,192 additions & 44 deletions iTerm2.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

80 changes: 80 additions & 0 deletions iTerm2.xcodeproj/xcshareddata/xcschemes/iTerm2Lib.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7F22BEA213682A900664A10"
BuildableName = "iTerm2Lib.framework"
BlueprintName = "iTerm2Lib"
ReferencedContainer = "container:iTerm2.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Library"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Library"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7F22BEA213682A900664A10"
BuildableName = "iTerm2Lib.framework"
BlueprintName = "iTerm2Lib"
ReferencedContainer = "container:iTerm2.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Library"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7F22BEA213682A900664A10"
BuildableName = "iTerm2Lib.framework"
BlueprintName = "iTerm2Lib"
ReferencedContainer = "container:iTerm2.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Library">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Library"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
91 changes: 91 additions & 0 deletions iTerm2.xcodeproj/xcshareddata/xcschemes/iTerm2LibDemo.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1000"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
BuildableName = "iTerm2LibDemo.app"
BlueprintName = "iTerm2LibDemo"
ReferencedContainer = "container:iTerm2.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Library"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
BuildableName = "iTerm2LibDemo.app"
BlueprintName = "iTerm2LibDemo"
ReferencedContainer = "container:iTerm2.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Library"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
BuildableName = "iTerm2LibDemo.app"
BlueprintName = "iTerm2LibDemo"
ReferencedContainer = "container:iTerm2.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Library"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "E7F22E0D2136A29500664A10"
BuildableName = "iTerm2LibDemo.app"
BlueprintName = "iTerm2LibDemo"
ReferencedContainer = "container:iTerm2.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Library">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Library"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
22 changes: 22 additions & 0 deletions iTerm2Lib/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?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>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>
7 changes: 7 additions & 0 deletions iTerm2Lib/NSWindow+iTermLib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#import <Cocoa/Cocoa.h>

@interface NSWindow (iTermLib)

- (double)approximateFractionOccluded;

@end
10 changes: 10 additions & 0 deletions iTerm2Lib/NSWindow+iTermLib.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#import "NSWindow+iTermLib.h"

@implementation NSWindow (iTermLib)

- (double)approximateFractionOccluded
{
return 0;
}

@end
9 changes: 9 additions & 0 deletions iTerm2Lib/SessionView+iTermLib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#import <Cocoa/Cocoa.h>

#import "SessionView.h"

extern NSString* const iTermLibSessionViewDidMoveToWindowNotification;

@interface SessionView (iTermLib)

@end
12 changes: 12 additions & 0 deletions iTerm2Lib/SessionView+iTermLib.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#import "SessionView+iTermLib.h"

NSString* const iTermLibSessionViewDidMoveToWindowNotification = @"iTermLibSessionViewDidMoveToWindowNotification";

@implementation SessionView (iTermLib)

- (void)viewDidMoveToWindow
{
[NSNotificationCenter.defaultCenter postNotificationName:iTermLibSessionViewDidMoveToWindowNotification object:self];
}

@end
7 changes: 7 additions & 0 deletions iTerm2Lib/iTerm2Lib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#import <Cocoa/Cocoa.h>

#import "iTermLibApplication.h"
#import "iTermLibController.h"
#import "iTermLibSessionController.h"
#import "SessionView+iTermLib.h"
#import "NSWindow+iTermLib.h"
11 changes: 11 additions & 0 deletions iTerm2Lib/iTermLibApplication.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#import <Cocoa/Cocoa.h>

@class iTermLibController;

@interface iTermLibApplication : NSObject

+ (instancetype)sharedApplication;

@property (readonly) iTermLibController *delegate;

@end
24 changes: 24 additions & 0 deletions iTerm2Lib/iTermLibApplication.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#import "iTermLibApplication.h"

#import "iTermLibController.h"

static iTermLibApplication* _gSharedApplication;

@implementation iTermLibApplication

+ (instancetype)sharedApplication
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_gSharedApplication = [[iTermLibApplication alloc] init];
});

return _gSharedApplication;
}

- (iTermLibController*)delegate
{
return iTermLibController.sharedController;
}

@end
29 changes: 29 additions & 0 deletions iTerm2Lib/iTermLibController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#import <Cocoa/Cocoa.h>

#import "iTermLibSessionController.h"

@class PTYSession;
@class iTermLibController;

@protocol iTermLibControllerDelegate<NSObject>

- (void)controller:(iTermLibController*)controller shouldRemoveSessionView:(iTermLibSessionController*)session;

@optional
- (void)controller:(iTermLibController*)controller sessionDidClose:(iTermLibSessionController*)session;
- (void)controller:(iTermLibController*)controller nameOfSession:(iTermLibSessionController*)session didChangeTo:(NSString*)newName;

@end

@interface iTermLibController : NSObject<iTermLibSessionDelegate>

+ (instancetype)sharedController;

@property (readonly, copy) NSArray<iTermLibSessionController*>* sessions;
@property (readonly) iTermLibSessionController* activeSession;
@property (assign) id<iTermLibControllerDelegate> delegate;
@property (assign) BOOL broadcasting;

- (iTermLibSessionController*)createSessionWithProfile:(Profile*)profile command:(NSString*)command initialSize:(NSSize)initialSize;

@end
Loading