mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2024-12-21 01:30:05 +00:00
git-svn-id: svn://qnap.local/TwoTerm/trunk@1792 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
parent
9c9741dcc8
commit
7d5ddda36d
@ -28,17 +28,17 @@ static NSMutableArray *array = nil;
|
||||
return nil;
|
||||
}
|
||||
|
||||
+(void)load
|
||||
{
|
||||
array = [NSMutableArray new];
|
||||
}
|
||||
|
||||
// can be called before +load.
|
||||
+(void)registerClass: (Class)klass
|
||||
{
|
||||
if (klass && [klass conformsToProtocol: @protocol(Emulator)])
|
||||
{
|
||||
@synchronized (self)
|
||||
{
|
||||
if (!array)
|
||||
array = [NSMutableArray new];
|
||||
|
||||
[array addObject: klass];
|
||||
}
|
||||
}
|
||||
@ -69,7 +69,7 @@ static NSMutableArray *array = nil;
|
||||
{
|
||||
@synchronized(self)
|
||||
{
|
||||
if (tag && tag < [array count])
|
||||
if (tag && tag <= [array count])
|
||||
{
|
||||
return [array objectAtIndex: tag - 1];
|
||||
}
|
||||
|
@ -46,7 +46,7 @@
|
||||
<object class="NSWindowTemplate" id="1005">
|
||||
<int key="NSWindowStyleMask">263</int>
|
||||
<int key="NSWindowBacking">2</int>
|
||||
<string key="NSWindowRect">{{196, 240}, {300, 175}}</string>
|
||||
<string key="NSWindowRect">{{196, 240}, {400, 175}}</string>
|
||||
<int key="NSWTFlags">544736256</int>
|
||||
<string key="NSWindowTitle">New Terminal</string>
|
||||
<string key="NSWindowClass">NSWindow</string>
|
||||
@ -59,14 +59,13 @@
|
||||
<object class="NSPopUpButton" id="988010808">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">266</int>
|
||||
<string key="NSFrame">{{121, 130}, {159, 26}}</string>
|
||||
<string key="NSFrame">{{121, 130}, {259, 26}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="391841165"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSPopUpButtonCell" key="NSCell" id="49383316">
|
||||
<int key="NSCellFlags">-2080244160</int>
|
||||
<int key="NSCellFlags2">134219776</int>
|
||||
<int key="NSCellFlags2">2048</int>
|
||||
<object class="NSFont" key="NSSupport" id="1027415380">
|
||||
<string key="NSName">LucidaGrande</string>
|
||||
<double key="NSSize">13</double>
|
||||
@ -85,6 +84,7 @@
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<int key="NSState">1</int>
|
||||
<object class="NSCustomResource" key="NSOnImage" id="1036081624">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuCheckmark</string>
|
||||
@ -118,7 +118,7 @@
|
||||
</object>
|
||||
<reference key="NSMenuFont" ref="1027415380"/>
|
||||
</object>
|
||||
<int key="NSPreferredEdge">1</int>
|
||||
<int key="NSPreferredEdge">2</int>
|
||||
<bool key="NSUsesItemFromMenu">YES</bool>
|
||||
<bool key="NSAltersState">YES</bool>
|
||||
<int key="NSArrowPosition">2</int>
|
||||
@ -129,7 +129,6 @@
|
||||
<int key="NSvFlags">268</int>
|
||||
<string key="NSFrame">{{17, 135}, {99, 17}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="988010808"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSTextFieldCell" key="NSCell" id="1072357374">
|
||||
@ -161,10 +160,8 @@
|
||||
<object class="NSButton" id="839562449">
|
||||
<reference key="NSNextResponder" ref="1006"/>
|
||||
<int key="NSvFlags">289</int>
|
||||
<string key="NSFrame">{{162, 18}, {118, 25}}</string>
|
||||
<string key="NSFrame">{{262, 18}, {118, 25}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="1046436309">
|
||||
<int key="NSCellFlags">-2080244224</int>
|
||||
@ -185,7 +182,6 @@
|
||||
<int key="NSvFlags">292</int>
|
||||
<string key="NSFrame">{{20, 18}, {118, 25}}</string>
|
||||
<reference key="NSSuperview" ref="1006"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="839562449"/>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="779500661">
|
||||
@ -203,9 +199,8 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSFrame">{{7, 11}, {300, 175}}</string>
|
||||
<string key="NSFrame">{{7, 11}, {400, 175}}</string>
|
||||
<reference key="NSSuperview"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView" ref="497952356"/>
|
||||
</object>
|
||||
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
|
||||
@ -447,36 +442,7 @@
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">48</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">NewTerminalWindowController</string>
|
||||
<string key="superclassName">NSWindowController</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>cancelButton:</string>
|
||||
<string>connectButton:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<string key="NS.key.0">_terminalTypeButton</string>
|
||||
<string key="NS.object.0">NSPopUpButton</string>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./classes-xjh84/NewTerminalWindowController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes"/>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<object class="NSDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#import "NewTerminalWindowController.h"
|
||||
#import "Emulator.h"
|
||||
#import "Defaults.h"
|
||||
|
||||
@implementation NewTerminalWindowController
|
||||
|
||||
@ -22,7 +23,7 @@
|
||||
- (void)dealloc {
|
||||
// Clean-up code here.
|
||||
|
||||
[_terminalTypeButton release];
|
||||
//[_terminalTypeButton release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@ -53,6 +54,13 @@
|
||||
|
||||
if (klass)
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
klass, @"Class",
|
||||
nil];
|
||||
|
||||
[nc postNotificationName: kNotificationNewTerminal object: self userInfo: userInfo];
|
||||
|
||||
// post notificiation...
|
||||
}
|
||||
|
||||
|
11
PTSE.mm
11
PTSE.mm
@ -33,10 +33,9 @@ enum {
|
||||
|
||||
};
|
||||
|
||||
|
||||
-(const char *)termName
|
||||
+(void)load
|
||||
{
|
||||
return "proterm-special";
|
||||
[EmulatorManager registerClass: self];
|
||||
}
|
||||
|
||||
+(NSString *)name
|
||||
@ -49,6 +48,12 @@ enum {
|
||||
return @"Proterm Special Emulation";
|
||||
}
|
||||
|
||||
-(const char *)termName
|
||||
{
|
||||
return "proterm-special";
|
||||
}
|
||||
|
||||
|
||||
-(void)reset
|
||||
{
|
||||
_state = StateText;
|
||||
|
@ -34,7 +34,7 @@
|
||||
-(void)dealloc
|
||||
{
|
||||
[_emulator release];
|
||||
[_emulatorView release];
|
||||
//[_emulatorView release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@ -51,7 +51,7 @@
|
||||
int pid;
|
||||
int fd;
|
||||
struct termios term;
|
||||
struct winsize ws = { 24, 80, 0, 0 };
|
||||
struct winsize ws = [_emulator defaultSize];
|
||||
//int flags;
|
||||
|
||||
memset(&term, 0, sizeof(term));
|
||||
@ -75,7 +75,9 @@
|
||||
|
||||
if (pid < 0)
|
||||
{
|
||||
//error
|
||||
fprintf(stderr, "forkpty failed\n");
|
||||
fflush(stderr);
|
||||
|
||||
return;
|
||||
}
|
||||
if (pid == 0)
|
||||
@ -83,7 +85,7 @@
|
||||
|
||||
std::vector<const char *> environ;
|
||||
std::string s;
|
||||
;
|
||||
|
||||
|
||||
s.append("TERM_PROGRAM=2Term");
|
||||
s.append(1, (char)0);
|
||||
@ -118,6 +120,7 @@
|
||||
|
||||
// TODO -- option for localhost, telnet, ssh, etc.
|
||||
execle("/usr/bin/login", "login", "-pf", getlogin(), NULL, &environ[0]);
|
||||
|
||||
fprintf(stderr, "execle failed\n");
|
||||
fflush(stderr);
|
||||
|
||||
@ -130,6 +133,18 @@
|
||||
fcntl(fd, F_SETFL, flags | O_NONBLOCK);
|
||||
*/
|
||||
|
||||
if (![_emulator resizable])
|
||||
{
|
||||
|
||||
NSWindow *window = [self window];
|
||||
NSUInteger mask = [window styleMask];
|
||||
|
||||
|
||||
[window setShowsResizeIndicator: NO];
|
||||
|
||||
[window setStyleMask: mask & ~NSResizableWindowMask];
|
||||
}
|
||||
|
||||
_child = pid;
|
||||
|
||||
[_emulatorView setFd: fd];
|
||||
|
@ -17,6 +17,7 @@
|
||||
@property (assign) IBOutlet NSImageView *imageView;
|
||||
|
||||
|
||||
|
||||
-(void)newTerminal: (NSNotification *)notification;
|
||||
|
||||
@end
|
||||
|
@ -9,6 +9,7 @@
|
||||
#import "TwoTermAppDelegate.h"
|
||||
|
||||
#import "TermWindowController.h"
|
||||
#import "NewTerminalWindowController.h"
|
||||
#import "Defaults.h"
|
||||
#import "VT52.h"
|
||||
|
||||
@ -41,6 +42,18 @@
|
||||
}
|
||||
|
||||
|
||||
-(IBAction)newDocument: (id)sender
|
||||
{
|
||||
NewTerminalWindowController *controller = [NewTerminalWindowController new];
|
||||
|
||||
|
||||
[controller showWindow: nil];
|
||||
// this leak is ok.
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Notificiations
|
||||
|
||||
-(void)newTerminal: (NSNotification *)notification
|
||||
{
|
||||
|
||||
@ -50,7 +63,7 @@
|
||||
|
||||
|
||||
Class klass = [userInfo objectForKey: @"Class"];
|
||||
if ([klass conformsToProtocol: @protocol(Emulator)])
|
||||
if (![klass conformsToProtocol: @protocol(Emulator)])
|
||||
klass = [VT52 class];
|
||||
|
||||
|
||||
|
8
VT05.mm
8
VT05.mm
@ -40,15 +40,19 @@ enum {
|
||||
|
||||
};
|
||||
|
||||
+(void)load
|
||||
{
|
||||
[EmulatorManager registerClass: self];
|
||||
}
|
||||
|
||||
+(NSString *)name
|
||||
{
|
||||
return @"vt05";
|
||||
return @"VT05";
|
||||
}
|
||||
|
||||
-(NSString *)name
|
||||
{
|
||||
return @"vt05";
|
||||
return @"VT05";
|
||||
}
|
||||
|
||||
-(const char *)termName
|
||||
|
5
VT100.mm
5
VT100.mm
@ -30,6 +30,11 @@ enum {
|
||||
};
|
||||
|
||||
|
||||
+(void)load
|
||||
{
|
||||
[EmulatorManager registerClass: self];
|
||||
}
|
||||
|
||||
-(id)init
|
||||
{
|
||||
self = [super init];
|
||||
|
Loading…
Reference in New Issue
Block a user