diff -r -u mobileterminal-286/GestureView.m mobileterminal-286+iPhone/GestureView.m --- mobileterminal-286/GestureView.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/GestureView.m 2008-07-06 19:51:22.000000000 +0000 @@ -13,6 +13,11 @@ #import "Tools.h" #include +@protocol UITouchCompatibility +- (CGPoint)locationInView:(UIView *)view; +- (CGPoint)previousLocationInView:(UIView *)view; +@end + @implementation GestureView //_______________________________________________________________________________ @@ -77,9 +82,23 @@ //_______________________________________________________________________________ +- (BOOL)beginTrackingWithTouch:(id)touch withEvent:(id)event { + return [self beginTrackingAt:[touch locationInView:self] withEvent:event]; +} + +- (BOOL)continueTrackingWithTouch:(id)touch withEvent:(id)event { + return [self continueTrackingAt:[touch locationInView:self] previous:[touch previousLocationInView:self] withEvent:event]; +} + +- (void)endTrackingWithTouch:(id)touch withEvent:(id)event { + return [self endTrackingAt:[touch locationInView:self] previous:[touch previousLocationInView:self] withEvent:event]; +} + +//_______________________________________________________________________________ + - (void) mouseDown:(GSEvent*)event { - mouseDownPos = [delegate viewPointForWindowPoint:GSEventGetLocationInWindow(event)]; + mouseDownPos = [delegate viewPointForWindowPoint:GSEventGetLocationInWindow(event).origin]; [delegate showMenu:mouseDownPos]; [super mouseDown:event]; @@ -132,7 +151,7 @@ if (![[MenuView sharedInstance] visible]) { - CGPoint end = [delegate viewPointForWindowPoint:GSEventGetLocationInWindow(event)]; + CGPoint end = [delegate viewPointForWindowPoint:GSEventGetLocationInWindow(event).origin]; CGPoint vector = CGPointMake(end.x - mouseDownPos.x, end.y - mouseDownPos.y); float r = sqrtf(vector.x*vector.x + vector.y*vector.y); @@ -168,7 +187,7 @@ } else if (r < 10.0f) { - mouseDownPos = [delegate viewPointForWindowPoint:GSEventGetLocationInWindow(event)]; + mouseDownPos = [delegate viewPointForWindowPoint:GSEventGetLocationInWindow(event).origin]; if ([[MenuView sharedInstance] visible]) { [[MenuView sharedInstance] hide]; diff -r -u mobileterminal-286/Log.h mobileterminal-286+iPhone/Log.h --- mobileterminal-286/Log.h 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/Log.h 2008-05-07 08:15:04.000000000 +0000 @@ -1,6 +1,7 @@ #include #include +#include #define logf(s,...) [FileLog logFile:__FILE__ lineNumber:__LINE__ format:(s),##__VA_ARGS__] #define logfRect(s, r) [FileLog logFile:__FILE__ lineNumber:__LINE__ string:(s) rect:(r)] diff -r -u mobileterminal-286/Log.m mobileterminal-286+iPhone/Log.m --- mobileterminal-286/Log.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/Log.m 2008-05-07 08:16:51.000000000 +0000 @@ -21,7 +21,7 @@ aFileHandle = [NSFileHandle fileHandleForWritingAtPath:aFile]; [aFileHandle truncateFileAtOffset:[aFileHandle seekToEndOfFile]]; - [aFileHandle writeData:[[NSString stringWithFormat: @"%@\n", str] dataUsingEncoding:nil]]; + [aFileHandle writeData:[[NSString stringWithFormat: @"%@\n", str] dataUsingEncoding:kCFStringEncodingUTF8]]; } //_______________________________________________________________________________ diff -r -u mobileterminal-286/Makefile.build mobileterminal-286+iPhone/Makefile.build --- mobileterminal-286/Makefile.build 2008-05-07 08:07:55.000000000 +0000 +++ mobileterminal-286+iPhone/Makefile.build 2008-07-20 04:23:48.000000000 +0000 @@ -2,9 +2,18 @@ CFLAGS=-Wall -O7 +ifeq ($(PKG_ARCH),iphoneos-arm) +QUARTZ=QuartzCore -framework ImageIO +i20=-I/apl/i20 +else +QUARTZ=LayerKit +i20= +endif + LDFLAGS=-lobjc -framework CoreFoundation -framework Foundation \ - -framework UIKit -framework LayerKit -framework CoreGraphics \ - -framework GraphicsServices -lcurses -lobjc + -framework UIKit -framework $(QUARTZ) -framework CoreGraphics \ + -framework GraphicsServices -lcurses -lobjc \ + -F${PKG_ROOT}/System/Library/PrivateFrameworks all: Terminal @@ -27,7 +36,7 @@ $(CC) $(LDFLAGS) -o $@ $^ %.o: %.m - $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ + $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ $(i20) depend: @makedepend *.m &> /dev/null diff -r -u mobileterminal-286/Menu.m mobileterminal-286+iPhone/Menu.m --- mobileterminal-286/Menu.m 2008-05-07 08:07:55.000000000 +0000 +++ mobileterminal-286+iPhone/Menu.m 2008-07-05 21:29:08.000000000 +0000 @@ -127,7 +127,7 @@ + (Menu*) menuWithArray:(NSArray*)array { int i; - Menu * menu = [[Menu alloc] init]; + Menu * menu = [[[Menu alloc] init] autorelease]; for (i = 0; i < 12; i++) { MenuItem * item = [[menu items] objectAtIndex:i]; diff -r -u mobileterminal-286/MobileTerminal.m mobileterminal-286+iPhone/MobileTerminal.m --- mobileterminal-286/MobileTerminal.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/MobileTerminal.m 2008-07-06 19:43:12.000000000 +0000 @@ -17,9 +17,17 @@ #import #import #import -#import #import +#ifdef __OBJC2__ +#import +#define LKAnimation CAAnimation +#define LKTimingFunction CAMediaTimingFunction +#define LKTransition CATransition +#else +#import +#endif + //_______________________________________________________________________________ //_______________________________________________________________________________ @@ -57,7 +65,7 @@ [settings registerDefaults]; [settings readUserDefaults]; - menu = [Menu menuWithArray:[settings menu]]; + menu = [[Menu menuWithArray:[settings menu]] retain]; activeTerminal = 0; @@ -78,10 +86,10 @@ for (numTerminals = 0; numTerminals < ([settings multipleTerminals] ? MAXTERMINALS : 1); numTerminals++) { - VT100Terminal * terminal = [[VT100Terminal alloc] init]; - VT100Screen * screen = [[VT100Screen alloc] initWithIdentifier: numTerminals]; - SubProcess * process = [[SubProcess alloc] initWithDelegate:self identifier: numTerminals]; - UIScroller * scroller = [[UIScroller alloc] init]; + VT100Terminal * terminal = [[[VT100Terminal alloc] init] autorelease]; + VT100Screen * screen = [[[VT100Screen alloc] initWithIdentifier: numTerminals] autorelease]; + SubProcess * process = [[[SubProcess alloc] initWithDelegate:self identifier: numTerminals] autorelease]; + UIScroller * scroller = [[[UIScroller alloc] init] autorelease]; [screens addObject: screen]; [terminals addObject: terminal]; @@ -91,10 +99,10 @@ [screen setTerminal:terminal]; [terminal setScreen:screen]; - PTYTextView * textview = [[PTYTextView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 244.0f) + PTYTextView * textview = [[[PTYTextView alloc] initWithFrame: CGRectMake(0.0f, 0.0f, 320.0f, 244.0f) source: screen scroller: scroller - identifier: numTerminals]; + identifier: numTerminals] autorelease]; [textviews addObject:textview]; } @@ -356,7 +364,7 @@ } else { - [[self activeProcess] write:[input cString] length:[input length]]; + [[self activeProcess] write:[input UTF8String] length:[input length]]; } } @@ -404,7 +412,7 @@ { if (numTerminals > 1) { - CGPoint pos = GSEventGetLocationInWindow(event); + CGPoint pos = GSEventGetLocationInWindow(event).origin; float width = landscape ? window.frame.size.height : window.frame.size.width; if (pos.x > width/2 && pos.x < width*3/4) { @@ -679,20 +687,18 @@ { //log(@"create terminal"); VT100Terminal * terminal = [[VT100Terminal alloc] init]; + [terminals addObject: terminal]; //log(@"create screen"); VT100Screen * screen = [[VT100Screen alloc] initWithIdentifier: numTerminals]; + [screens addObject: screen]; + [screen setTerminal:terminal]; + [terminal setScreen:screen]; //log(@"create process"); - SubProcess * process = [[SubProcess alloc] initWithDelegate:self identifier: numTerminals]; //log(@"process created"); UIScroller * scroller = [[UIScroller alloc] init]; - - [screens addObject: screen]; - [terminals addObject: terminal]; - [processes addObject: process]; [scrollers addObject: scroller]; + - [screen setTerminal:terminal]; - [terminal setScreen:screen]; //log(@"create textview"); @@ -702,6 +708,8 @@ identifier: numTerminals]; //log(@"textview created"); [textviews addObject:textview]; + SubProcess * process = [[SubProcess alloc] initWithDelegate:self identifier: numTerminals]; + [processes addObject: process]; } [self addStatusBarImageNamed:[NSString stringWithFormat:@"MobileTerminal0"] removeOnAbnormalExit:YES]; diff -r -u mobileterminal-286/PieView.m mobileterminal-286+iPhone/PieView.m --- mobileterminal-286/PieView.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/PieView.m 2008-05-07 08:13:35.000000000 +0000 @@ -71,7 +71,7 @@ float height = 14.0f; NSString *fontName = @"HelveticaBold"; - CGContextSelectFont(context, [fontName cString], height, kCGEncodingMacRoman); + CGContextSelectFont(context, [fontName UTF8String], height, kCGEncodingMacRoman); CGFontRef font = CGContextGetFont(context); NSString * text = [self title]; diff -r -u mobileterminal-286/Preferences.h mobileterminal-286+iPhone/Preferences.h --- mobileterminal-286/Preferences.h 2008-05-07 08:07:55.000000000 +0000 +++ mobileterminal-286+iPhone/Preferences.h 2008-07-04 09:50:46.000000000 +0000 @@ -10,7 +10,6 @@ #import #import "UINavigationController.h" #import -#import #import #import "Color.h" @@ -24,7 +23,7 @@ //_______________________________________________________________________________ -@interface UIPickerTable (PickerTableExtensions) +@interface UITable (PickerTableExtensions) @end @interface UIPickerView (PickerViewExtensions) @@ -39,7 +38,7 @@ NSArray * fontNames; UIPickerView * fontPicker; - UIPickerTable * pickerTable; + UITable * pickerTable; NSString * selectedFont; } diff -r -u mobileterminal-286/Preferences.m mobileterminal-286+iPhone/Preferences.m --- mobileterminal-286/Preferences.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/Preferences.m 2008-07-04 09:51:01.000000000 +0000 @@ -13,12 +13,12 @@ #import "Log.h" #import -#import "UIFieldEditor.h" +#import //_______________________________________________________________________________ //_______________________________________________________________________________ -@implementation UIPickerTable (PickerTableExtensions) +@implementation UITable (PickerTableExtensions) //_______________________________________________________________________________ @@ -40,7 +40,9 @@ @implementation UIPickerView (PickerViewExtensions) -(float) tableRowHeight { return 22.0f; } +#ifndef __OBJC2__ -(id) delegate { return _delegate; } +#endif //_______________________________________________________________________________ @@ -50,7 +52,7 @@ for (c = 0; c < [self numberOfColumns]; c++) { - UIPickerTable * table = [self tableForColumn:c]; + UITable * table = [self tableForColumn:c]; for (r = 0; r < [table numberOfRows]; r++) { [[[table cellAtRow:r column:0] iconImageView] setFrame:CGRectMake(0,0,0,0)]; diff -r -u mobileterminal-286/PTYTextView.m mobileterminal-286+iPhone/PTYTextView.m --- mobileterminal-286/PTYTextView.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/PTYTextView.m 2008-07-05 21:25:52.000000000 +0000 @@ -238,11 +238,13 @@ if (!fontRef) { TerminalConfig * config = [[[Settings sharedInstance] terminalConfigs] objectAtIndex:termid]; - const char * font = [config.font cString]; + const char * font = [config.font UTF8String]; // First time through: cache the fontRef. This lookup is expensive. fontSize = config.fontSize; CGContextSelectFont(context, font, floor(lineHeight), kCGEncodingMacRoman); - fontRef = (CGFontRef)CFRetain(CGContextGetFont(context)); + fontRef = CGContextGetFont(context); + if (fontRef != NULL) + fontRef = (CGFontRef)CFRetain(fontRef); } else { diff -r -u mobileterminal-286/Settings.h mobileterminal-286+iPhone/Settings.h --- mobileterminal-286/Settings.h 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/Settings.h 2008-05-07 08:30:30.000000000 +0000 @@ -18,12 +18,13 @@ NSString * font; NSString * args; - RGBAColor colors[NUM_TERMINAL_COLORS]; + RGBAColor _colors[NUM_TERMINAL_COLORS]; } - (NSString*) fontDescription; +- (RGBAColor *) colors; -@property RGBAColor * colors; +@property (getter = colors) RGBAColor *colors; @property BOOL autosize; @property int width; @property int fontSize; diff -r -u mobileterminal-286/Settings.m mobileterminal-286+iPhone/Settings.m --- mobileterminal-286/Settings.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/Settings.m 2008-07-20 04:29:04.000000000 +0000 @@ -24,7 +24,7 @@ width = 45; fontSize = 12; fontWidth = 0.6f; - font = @"CourierNewBold"; + font = @"CourierNewPS-BoldMT"; args = @""; return self; @@ -62,7 +62,7 @@ } - (RGBAColor*) colors { - return colors; + return _colors; } //_______________________________________________________________________________ @@ -97,11 +97,11 @@ { self = [super init]; - terminalConfigs = [NSArray arrayWithObjects: + terminalConfigs = [[NSArray arrayWithObjects: [[TerminalConfig alloc] init], [[TerminalConfig alloc] init], [[TerminalConfig alloc] init], - [[TerminalConfig alloc] init], nil]; + [[TerminalConfig alloc] init], nil] retain]; gestureFrameColor = RGBAColorMake(1.0f, 1.0f, 1.0f, 0.05f); multipleTerminals = NO; @@ -154,7 +154,7 @@ [tc setObject:[NSNumber numberWithInt:45] forKey:@"width"]; [tc setObject:[NSNumber numberWithInt:12] forKey:@"fontSize"]; [tc setObject:[NSNumber numberWithFloat:0.6f] forKey:@"fontWidth"]; - [tc setObject:@"CourierNewBold" forKey:@"font"]; + [tc setObject:@"CourierNewPS-BoldMT" forKey:@"font"]; [tc setObject:(i > 0 ? @"clear" : @"") forKey:@"args"]; NSMutableArray * ca = [NSMutableArray arrayWithCapacity:NUM_TERMINAL_COLORS]; diff -r -u mobileterminal-286/ShellKeyboard.m mobileterminal-286+iPhone/ShellKeyboard.m --- mobileterminal-286/ShellKeyboard.m 2008-05-07 08:07:55.000000000 +0000 +++ mobileterminal-286+iPhone/ShellKeyboard.m 2008-07-06 19:33:23.000000000 +0000 @@ -1,6 +1,56 @@ // ShellKeyboard.m #import "ShellKeyboard.h" +/* iPhoneOS 2.0 Compatibility {{{ */ +#ifdef __OBJC2__ +@interface UICGColor : NSObject { +} + +- (id) initWithCGColor:(CGColorRef)color; +@end + +@interface UIFont { +} + +- (UIFont *) fontWithSize:(CGFloat)size; +@end + +@interface NSObject (iPhoneOS) +- (CGColorRef) cgColor; +- (CGColorRef) CGColor; +- (void) set; +@end + +@implementation NSObject (iPhoneOS) + +- (CGColorRef) cgColor { + return [self CGColor]; +} + +- (CGColorRef) CGColor { + return (CGColorRef) self; +} + +- (void) set { + [[[[objc_getClass("UICGColor") alloc] initWithCGColor:[self CGColor]] autorelease] set]; +} + +@end + +@interface UITextView (iPhoneOS) +- (void) setTextSize:(float)size; +@end + +@implementation UITextView (iPhoneOS) + +- (void) setTextSize:(float)size { + [self setFont:[[self font] fontWithSize:size]]; +} + +@end +#endif +/* }}} */ + // Override settings of the default keyboard implementation @implementation UIKeyboardImpl (DisableFeatures) @@ -37,6 +87,14 @@ - (BOOL)webView:(id)fp8 shouldDeleteDOMRange:(id)fp12 { [shellKeyboard handleKeyPress:0x08]; + return false; +} + +- (BOOL)webView:(id)fp8 doCommandBySelector:(SEL)fp12 +{ + if (fp12 == @selector(deleteBackward:)) + [shellKeyboard handleKeyPress:0x08]; + return false; } - (BOOL)webView:(id)fp8 shouldInsertText:(id)character @@ -48,6 +106,17 @@ return false; } [shellKeyboard handleKeyPress:[character characterAtIndex:0]]; + return false; +} + +- (NSMethodSignature *) methodSignatureForSelector:(SEL)selector { + fprintf(stderr, "[%s]S-%s\n", class_getName(self->isa), sel_getName(selector)); + return [super methodSignatureForSelector:selector]; +} + +- (BOOL) respondsToSelector:(SEL)selector { + fprintf(stderr, "[%s]R-%s\n", class_getName(self->isa), sel_getName(selector)); + return [super respondsToSelector:selector]; } @end diff -r -u mobileterminal-286/SubProcess.m mobileterminal-286+iPhone/SubProcess.m --- mobileterminal-286/SubProcess.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/SubProcess.m 2008-05-07 08:13:35.000000000 +0000 @@ -140,7 +140,7 @@ if (arg != nil && [arg length] > 0) { // A command line argument was passed to the program - const char* path = [arg cString]; + const char* path = [arg UTF8String]; struct stat st; if ((stat(path, &st) == 0) && ((st.st_mode & S_IFDIR) != 0)) // it's a path, issue a cd command { @@ -150,7 +150,7 @@ } else // just print the command { - write(fd, [arg cString], [arg length]); + write(fd, [arg UTF8String], [arg length]); write(fd, "\n", 1); } } @@ -186,7 +186,7 @@ { // HACK: Just pretend the message came from the child NSLog(message); - [delegate handleStreamOutput:[message cString] length:[message length] identifier:termid]; + [delegate handleStreamOutput:[message UTF8String] length:[message length] identifier:termid]; } - (void)setWidth:(int)width height:(int)height diff -r -u mobileterminal-286/svnversion.h mobileterminal-286+iPhone/svnversion.h --- mobileterminal-286/svnversion.h 2008-05-07 08:13:19.000000000 +0000 +++ mobileterminal-286+iPhone/svnversion.h 2008-07-06 19:26:10.000000000 +0000 @@ -1 +1 @@ -#define SVN_VERSION @"287" +#define SVN_VERSION @"298" diff -r -u mobileterminal-286/Tools.h mobileterminal-286+iPhone/Tools.h --- mobileterminal-286/Tools.h 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/Tools.h 2008-05-07 08:19:04.000000000 +0000 @@ -3,6 +3,7 @@ // Terminal #import +#import //_______________________________________________________________________________ diff -r -u mobileterminal-286/Tools.m mobileterminal-286+iPhone/Tools.m --- mobileterminal-286/Tools.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/Tools.m 2008-05-07 08:21:40.000000000 +0000 @@ -4,6 +4,7 @@ #import "Tools.h" #import "Log.h" +#include //_______________________________________________________________________________ //_______________________________________________________________________________ @@ -28,7 +29,7 @@ BOOL writeImageToPNG (CGImageRef image, NSString * filePath) { if (image == nil) { log(@"[ERROR] no image"); return NO; } - CFURLRef cfurl = CFURLCreateFromFileSystemRepresentation (NULL, (const UInt8 *)[filePath cString], [filePath length], 0); + CFURLRef cfurl = CFURLCreateFromFileSystemRepresentation (NULL, (const UInt8 *)[filePath UTF8String], [filePath length], 0); CGImageDestinationRef imageDest = CGImageDestinationCreateWithURL(cfurl, (CFStringRef)@"public.png", 1, nil); if (imageDest==nil) { log(@"[ERROR] no image destination"); return NO; } CGImageDestinationAddImage(imageDest, image, nil); diff -r -u mobileterminal-286/VT100Terminal.m mobileterminal-286+iPhone/VT100Terminal.m --- mobileterminal-286/VT100Terminal.m 2008-05-07 08:33:09.000000000 +0000 +++ mobileterminal-286+iPhone/VT100Terminal.m 2008-05-07 08:13:35.000000000 +0000 @@ -1226,12 +1226,12 @@ static int issetup = 0; if (!issetup) { issetup = 1; // this crashes on non-Cydia systems when called multiple times - setupterm((char *)[termType cString], fileno(stdout), &r); + setupterm((char *)[termType UTF8String], fileno(stdout), &r); } if (r!=1) { - log(@"Terminal type %s is not defined (%d)", [termType cString], r); + log(@"Terminal type %s is not defined (%d)", [termType UTF8String], r); for(i = 0; i < TERMINFO_KEYS; i ++) { if (key_strings[i]) free(key_strings[i]);