Changeset 437
- Timestamp:
- 08/22/08 09:04:39 (3 months ago)
- Location:
- trunk/data/mobileterminal
- Files:
-
- 1 removed
- 2 modified
-
_metadata/author (deleted)
-
_metadata/description (modified) (1 diff)
-
port.diff (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/data/mobileterminal/_metadata/description
r390 r437 1 1 local UIKit-based Terminal emulator 2 This is a Terminal emulator for the iPhone. With it you can do all of your standard system administration tasks from anywhere: ssh into remote boxes, download files, edit configuration files . Please note, though, that this package does not fully work yet on iPhoneOS 2.x. For more information (and a status update) please click below for More Information.2 This is a Terminal emulator for the iPhone. With it you can do all of your standard system administration tasks from anywhere: ssh into remote boxes, download files, edit configuration files, whatever. Please note, though, that this package does not fully work yet on iPhoneOS 2.x. For more information (and a status update) please click below for More Information. -
trunk/data/mobileterminal/port.diff
r391 r437 1 diff -ru mobileterminal-286/main.m mobileterminal-286+iPhone/main.m2 --- mobileterminal-286/main.m 2008-05-07 08:07:55.000000000 +00003 +++ mobileterminal-286+iPhone/main.m 2008-07-25 09:22:12.000000000 +00004 @@ -3,6 +3,8 @@5 #import "MobileTerminal.h"6 #import "Settings.h"7 8 +void UIApplicationUseLegacyEvents(BOOL use);9 +10 int main(int argc, char **argv)11 {12 [[NSAutoreleasePool alloc] init];13 @@ -27,5 +29,6 @@14 [[Settings sharedInstance] setArguments:args];15 }16 17 + UIApplicationUseLegacyEvents(1);18 return UIApplicationMain(argc, argv, [MobileTerminal class]);19 }20 1 diff -r -u mobileterminal-286/GestureView.m mobileterminal-286+iPhone/GestureView.m 21 2 --- mobileterminal-286/GestureView.m 2008-05-07 08:33:09.000000000 +0000 22 3 +++ mobileterminal-286+iPhone/GestureView.m 2008-07-06 19:51:22.000000000 +0000 23 @@ -77,9 +82,9 @@ 24 25 //_______________________________________________________________________________ 26 4 @@ -13,6 +13,11 @@ 5 #import "Tools.h" 6 #include <math.h> 7 8 +@protocol UITouchCompatibility 9 +- (CGPoint)locationInView:(UIView *)view; 10 +- (CGPoint)previousLocationInView:(UIView *)view; 11 +@end 12 + 13 @implementation GestureView 14 15 //_______________________________________________________________________________ 16 @@ -77,9 +82,23 @@ 17 18 //_______________________________________________________________________________ 19 20 +- (BOOL)beginTrackingWithTouch:(id)touch withEvent:(id)event { 21 + return [self beginTrackingAt:[touch locationInView:self] withEvent:event]; 22 +} 23 + 24 +- (BOOL)continueTrackingWithTouch:(id)touch withEvent:(id)event { 25 + return [self continueTrackingAt:[touch locationInView:self] previous:[touch previousLocationInView:self] withEvent:event]; 26 +} 27 + 28 +- (void)endTrackingWithTouch:(id)touch withEvent:(id)event { 29 + return [self endTrackingAt:[touch locationInView:self] previous:[touch previousLocationInView:self] withEvent:event]; 30 +} 31 + 32 +//_______________________________________________________________________________ 33 + 27 34 - (void) mouseDown:(GSEvent*)event 28 35 { … … 73 80 74 81 //_______________________________________________________________________________ 82 diff -r -u mobileterminal-286/main.m mobileterminal-286+iPhone/main.m 83 --- mobileterminal-286/main.m 2008-05-07 08:07:55.000000000 +0000 84 +++ mobileterminal-286+iPhone/main.m 2008-08-02 09:38:12.000000000 +0000 85 @@ -2,6 +2,9 @@ 86 #import <UIKit/UIKit.h> 87 #import "MobileTerminal.h" 88 #import "Settings.h" 89 +#include <objc/runtime.h> 90 + 91 +void UIApplicationUseLegacyEvents(BOOL use); 92 93 int main(int argc, char **argv) 94 { 95 @@ -27,5 +30,6 @@ 96 [[Settings sharedInstance] setArguments:args]; 97 } 98 99 + UIApplicationUseLegacyEvents(1); 100 return UIApplicationMain(argc, argv, [MobileTerminal class]); 101 } 75 102 diff -r -u mobileterminal-286/Makefile.build mobileterminal-286+iPhone/Makefile.build 76 103 --- mobileterminal-286/Makefile.build 2008-05-07 08:07:55.000000000 +0000 … … 120 147 diff -r -u mobileterminal-286/MobileTerminal.m mobileterminal-286+iPhone/MobileTerminal.m 121 148 --- mobileterminal-286/MobileTerminal.m 2008-05-07 08:33:09.000000000 +0000 122 +++ mobileterminal-286+iPhone/MobileTerminal.m 2008-0 7-06 19:43:12.000000000 +0000149 +++ mobileterminal-286+iPhone/MobileTerminal.m 2008-08-02 09:40:25.000000000 +0000 123 150 @@ -17,9 +17,17 @@ 124 151 #import <Foundation/Foundation.h> … … 177 204 } 178 205 179 @@ -356,7 +364,7 @@ 206 @@ -112,7 +120,6 @@ 207 [mainView addSubview:[scrollers objectAtIndex:i]]; 208 } 209 [mainView addSubview:keyboardView]; 210 - [mainView addSubview:[keyboardView inputView]]; 211 [mainView addSubview:gestureView]; 212 [mainView addSubview:[MenuView sharedInstance]]; 213 activeView = mainView; 214 @@ -131,7 +138,7 @@ 215 [[MenuView sharedInstance] hideSlow:YES]; 216 217 // Input focus 218 - [[keyboardView inputView] becomeFirstResponder]; 219 + [keyboardView enable]; 220 221 if (numTerminals > 1) 222 { 223 @@ -165,10 +172,9 @@ 224 [keyboardView setAlpha:0.0f]; 225 } 226 227 - [mainView addSubview:[keyboardView inputView]]; 228 [mainView bringSubviewToFront:gestureView]; 229 [mainView bringSubviewToFront:[MenuView sharedInstance]]; 230 - [[keyboardView inputView] becomeFirstResponder]; 231 + [keyboardView enable]; 232 233 [self setActiveTerminal:0]; 234 [self updateStatusBar]; 235 @@ -198,7 +204,6 @@ 236 if (activeView != mainView) // preferences active 237 [self togglePreferences]; 238 239 - [[keyboardView inputView] removeFromSuperview]; 240 [keyboardView removeFromSuperview]; 241 242 for (i = 0; i < MAXTERMINALS; i++) 243 @@ -356,7 +361,7 @@ 180 244 } 181 245 else … … 186 250 } 187 251 188 @@ -404,7 +4 12,7 @@252 @@ -404,7 +409,7 @@ 189 253 { 190 254 if (numTerminals > 1) … … 195 259 if (pos.x > width/2 && pos.x < width*3/4) 196 260 { 197 @@ -679,20 +68 7,18 @@261 @@ -679,20 +684,18 @@ 198 262 { 199 263 //log(@"create terminal"); … … 221 285 //log(@"create textview"); 222 286 223 @@ -702,6 +70 8,8 @@287 @@ -702,6 +705,8 @@ 224 288 identifier: numTerminals]; 225 289 //log(@"textview created"); … … 390 454 391 455 NSMutableArray * ca = [NSMutableArray arrayWithCapacity:NUM_TERMINAL_COLORS]; 456 diff -r -u mobileterminal-286/ShellKeyboard.h mobileterminal-286+iPhone/ShellKeyboard.h 457 --- mobileterminal-286/ShellKeyboard.h 2008-05-07 08:07:55.000000000 +0000 458 +++ mobileterminal-286+iPhone/ShellKeyboard.h 2008-08-02 09:40:25.000000000 +0000 459 @@ -11,12 +11,12 @@ 460 @interface ShellKeyboard : UIKeyboard<KeyboardInputProtocol> 461 { 462 id inputDelegate; 463 - UITextView* inputView; 464 + id handler; 465 } 466 467 - (id)initWithFrame:(CGRect)frame; 468 -- (UITextView*)inputView; 469 - (void)setInputDelegate:(id)delegate; 470 - (void)handleKeyPress:(unichar)c; 471 +- (void)enable; 472 473 @end 392 474 diff -r -u mobileterminal-286/ShellKeyboard.m mobileterminal-286+iPhone/ShellKeyboard.m 393 475 --- mobileterminal-286/ShellKeyboard.m 2008-05-07 08:07:55.000000000 +0000 394 +++ mobileterminal-286+iPhone/ShellKeyboard.m 2008-0 7-06 19:33:23.000000000 +0000395 @@ -1, 6 +1,56@@476 +++ mobileterminal-286+iPhone/ShellKeyboard.m 2008-08-02 09:40:49.000000000 +0000 477 @@ -1,22 +1,69 @@ 396 478 // ShellKeyboard.m 397 479 #import "ShellKeyboard.h" 398 480 +#include <objc/runtime.h> 481 +#import <UIKit/UIDefaultKeyboardInput.h> 482 483 -// Override settings of the default keyboard implementation 484 -@implementation UIKeyboardImpl (DisableFeatures) 399 485 +/* iPhoneOS 2.0 Compatibility {{{ */ 400 486 +#ifdef __OBJC2__ 401 487 +@interface UICGColor : NSObject { 402 488 +} 403 + 489 490 -- (BOOL)autoCapitalizationPreference 491 -{ 492 - return false; 404 493 +- (id) initWithCGColor:(CGColorRef)color; 405 494 +@end 406 495 + 407 496 +@interface UIFont { 408 +} 409 + 497 } 498 499 -- (BOOL)autoCorrectionPreference 500 -{ 501 - return false; 410 502 +- (UIFont *) fontWithSize:(CGFloat)size; 411 503 +@end … … 421 513 +- (CGColorRef) cgColor { 422 514 + return [self CGColor]; 423 +}424 + 515 } 516 425 517 +- (CGColorRef) CGColor { 426 518 + return (CGColorRef) self; … … 444 536 + 445 537 +@end 538 + 539 +@interface UIDefaultKeyboardInput (iPhoneOS) 540 +- (id)textInputTraits; 541 +@end 542 + 543 +@interface UITextInputTraits 544 +- (void)setAutocorrectionType:(int)type; 545 +- (void)setAutocapitalizationType:(int)type; 546 +- (void)setEnablesReturnKeyAutomatically:(BOOL)val; 547 @end 446 548 +#endif 447 549 +/* }}} */ 448 + 449 // Override settings of the default keyboard implementation 450 @implementation UIKeyboardImpl (DisableFeatures) 451 452 @@ -37,6 +87,14 @@ 550 551 -@interface TextInputHandler : UITextView 552 +@interface TextInputHandler : UIDefaultKeyboardInput 553 { 554 ShellKeyboard* shellKeyboard; 555 } 556 @@ -30,26 +77,49 @@ 557 - (id)initWithKeyboard:(ShellKeyboard*)keyboard; 558 { 559 self = [super initWithFrame:CGRectMake(0.0f, 0.0f, 0.0f, 0.0f)]; 560 - shellKeyboard = keyboard; 561 + if ( self ) { 562 + shellKeyboard = keyboard; 563 + [[self textInputTraits] setAutocorrectionType:1]; 564 + [[self textInputTraits] setAutocapitalizationType:0]; 565 + [[self textInputTraits] setEnablesReturnKeyAutomatically:NO]; 566 + } 567 return self; 568 } 569 570 +#if 0 453 571 - (BOOL)webView:(id)fp8 shouldDeleteDOMRange:(id)fp12 454 572 { … … 457 575 +} 458 576 + 459 +- (BOOL)webView:(id)fp8 doCommandBySelector:(SEL)fp12 577 +#endif 578 + 579 +- (void)deleteBackward 460 580 +{ 461 + if (fp12 == @selector(deleteBackward:))462 581 + [shellKeyboard handleKeyPress:0x08]; 463 + return false; 464 } 465 466 - (BOOL)webView:(id)fp8 shouldInsertText:(id)character 467 @@ -48,6 +106,17 @@ 468 return false; 582 } 583 584 -- (BOOL)webView:(id)fp8 shouldInsertText:(id)character 585 - replacingDOMRange:(id)fp16 586 - givenAction:(int)fp20 587 +- (void)insertText:(id)character 588 { 589 if ([character length] != 1) { 590 [NSException raise:@"Unsupported" format:@"Unhandled multi-char insert!"]; 591 - return false; 469 592 } 470 593 [shellKeyboard handleKeyPress:[character characterAtIndex:0]]; 471 + return false; 472 +} 473 + 594 } 595 596 +#if 0 // for Debugging 474 597 +- (NSMethodSignature *) methodSignatureForSelector:(SEL)selector { 475 598 + fprintf(stderr, "[%s]S-%s\n", class_getName(self->isa), sel_getName(selector)); … … 480 603 + fprintf(stderr, "[%s]R-%s\n", class_getName(self->isa), sel_getName(selector)); 481 604 + return [super respondsToSelector:selector]; 482 } 483 605 +} 606 +#endif 607 + 608 @end 609 610 // ShellKeyboard 611 @@ -59,16 +129,12 @@ 612 - (id)initWithFrame:(CGRect)frame 613 { 614 self = [super initWithFrame:frame]; 615 - inputDelegate = nil; 616 - inputView = [[TextInputHandler alloc] initWithKeyboard:self]; 617 + if ( self ) { 618 + handler = [[TextInputHandler alloc] initWithKeyboard:self]; 619 + } 620 return self; 621 } 622 623 -- (UITextView*)inputView 624 -{ 625 - return inputView; 626 -} 627 - 628 - (void)setInputDelegate:(id)delegate; 629 { 630 inputDelegate = delegate; 631 @@ -79,4 +145,17 @@ 632 [inputDelegate handleKeyPress:c]; 633 } 634 635 +- (void)enable 636 +{ 637 + [self activate]; 638 + [[UIKeyboardImpl activeInstance] setDelegate:handler]; 639 +} 640 + 641 +- (void)dealloc 642 +{ 643 + [handler release]; 644 + 645 + [super dealloc]; 646 +} 647 + 484 648 @end 485 649 diff -r -u mobileterminal-286/SubProcess.m mobileterminal-286+iPhone/SubProcess.m
