2010-07-08 22:26:58 +00:00
|
|
|
//
|
|
|
|
// TwoTermAppDelegate.m
|
|
|
|
// 2Term
|
|
|
|
//
|
|
|
|
// Created by Kelvin Sherlock on 6/29/2010.
|
|
|
|
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "TwoTermAppDelegate.h"
|
|
|
|
|
|
|
|
#import "TermWindowController.h"
|
2010-10-06 00:39:09 +00:00
|
|
|
#import "NewTerminalWindowController.h"
|
2010-10-05 18:56:45 +00:00
|
|
|
#import "Defaults.h"
|
|
|
|
#import "VT52.h"
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
@implementation TwoTermAppDelegate
|
|
|
|
|
|
|
|
@synthesize window;
|
|
|
|
@synthesize imageView;
|
|
|
|
|
|
|
|
|
|
|
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
2010-10-05 18:56:45 +00:00
|
|
|
|
|
|
|
TermWindowController *controller;
|
|
|
|
|
|
|
|
|
|
|
|
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
|
|
|
|
|
|
|
[nc addObserver: self selector: @selector(newTerminal:) name: kNotificationNewTerminal object: nil];
|
2010-07-08 22:26:58 +00:00
|
|
|
|
|
|
|
|
2010-10-05 18:56:45 +00:00
|
|
|
controller = [TermWindowController new];
|
|
|
|
[controller showWindow: nil];
|
|
|
|
// this leak is ok.
|
|
|
|
}
|
|
|
|
|
|
|
|
-(void)dealloc {
|
|
|
|
|
|
|
|
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
2010-07-08 22:26:58 +00:00
|
|
|
|
2010-10-05 18:56:45 +00:00
|
|
|
[super dealloc];
|
2010-07-08 22:26:58 +00:00
|
|
|
}
|
|
|
|
|
2010-10-05 18:56:45 +00:00
|
|
|
|
2010-10-06 00:39:09 +00:00
|
|
|
-(IBAction)newDocument: (id)sender
|
|
|
|
{
|
|
|
|
NewTerminalWindowController *controller = [NewTerminalWindowController new];
|
|
|
|
|
|
|
|
|
|
|
|
[controller showWindow: nil];
|
|
|
|
// this leak is ok.
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark -
|
|
|
|
#pragma mark Notificiations
|
|
|
|
|
2010-10-05 18:56:45 +00:00
|
|
|
-(void)newTerminal: (NSNotification *)notification
|
|
|
|
{
|
|
|
|
|
|
|
|
TermWindowController *controller;
|
|
|
|
|
|
|
|
NSDictionary *userInfo = [notification userInfo];
|
|
|
|
|
|
|
|
|
|
|
|
Class klass = [userInfo objectForKey: @"Class"];
|
2010-10-06 00:39:09 +00:00
|
|
|
if (![klass conformsToProtocol: @protocol(Emulator)])
|
2010-10-05 18:56:45 +00:00
|
|
|
klass = [VT52 class];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
controller = [TermWindowController new];
|
|
|
|
[controller setEmulator: [[klass new] autorelease]];
|
|
|
|
[controller showWindow: nil];
|
|
|
|
// this leak is ok.
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-07-08 22:26:58 +00:00
|
|
|
@end
|