├── .gitignore ├── .travis.yml ├── Code ├── CommonType.h ├── CommonType.m ├── NSString+ext.h ├── NSString+ext.m ├── Nally_Prefix.pch ├── PasteController.h ├── PasteController.m ├── YLApplication.h ├── YLApplication.mm ├── YLApplicationKitAddition.h ├── YLApplicationKitAddition.m ├── YLBundle.h ├── YLBundle.m ├── YLConnection.h ├── YLConnection.mm ├── YLContextualMenuManager.h ├── YLContextualMenuManager.m ├── YLController.h ├── YLController.mm ├── YLDataSourceProtocol.h ├── YLEmoticon.h ├── YLEmoticon.m ├── YLExifController.h ├── YLExifController.m ├── YLFloatingView.h ├── YLFloatingView.m ├── YLImagePreviewer.h ├── YLImagePreviewer.m ├── YLImageView.h ├── YLImageView.m ├── YLLGlobalConfig.h ├── YLLGlobalConfig.m ├── YLLine.h ├── YLLine.m ├── YLMarkedTextView.h ├── YLMarkedTextView.m ├── YLPluginLoader.h ├── YLPluginLoader.m ├── YLRun.h ├── YLRun.m ├── YLSSH.h ├── YLSSH.mm ├── YLSimpleDataSource.h ├── YLSimpleDataSource.m ├── YLSite.h ├── YLSite.m ├── YLTelnet.h ├── YLTelnet.mm ├── YLTerminal.h ├── YLTerminal.mm ├── YLTextSuite.h ├── YLTextSuite.m ├── YLView.h ├── YLView.mm ├── encoding.h ├── encoding.m └── main.m ├── Dependencies ├── DBPrefsWindowController.h ├── DBPrefsWindowController.m ├── PSMTabBarControl │ ├── NSBezierPath_AMShading.h │ ├── NSBezierPath_AMShading.m │ ├── NSString_AITruncation.h │ ├── NSString_AITruncation.m │ ├── PSMMetalTabStyle.h │ ├── PSMMetalTabStyle.m │ ├── PSMOverflowPopUpButton.h │ ├── PSMOverflowPopUpButton.m │ ├── PSMProgressIndicator.h │ ├── PSMProgressIndicator.m │ ├── PSMRolloverButton.h │ ├── PSMRolloverButton.m │ ├── PSMTabBarCell.h │ ├── PSMTabBarCell.m │ ├── PSMTabBarControl.bundle │ │ ├── btn_add_tab.png │ │ ├── btn_add_tab_hover.png │ │ ├── btn_add_tab_pressed.png │ │ ├── btn_close.png │ │ ├── btn_close_dirty.png │ │ ├── btn_close_dirty_hover.png │ │ ├── btn_close_dirty_pressed.png │ │ ├── btn_close_hover.png │ │ ├── btn_close_pressed.png │ │ ├── btn_overflow.png │ │ ├── btn_overflow_pressed.png │ │ └── pi.png │ ├── PSMTabBarControl.h │ ├── PSMTabBarControl.m │ ├── PSMTabBarController.h │ ├── PSMTabBarController.m │ ├── PSMTabContentViewController.h │ ├── PSMTabContentViewController.m │ ├── PSMTabDragAssistant.h │ ├── PSMTabDragAssistant.m │ ├── PSMTabDragView.h │ ├── PSMTabDragView.m │ ├── PSMTabDragWindow.h │ ├── PSMTabDragWindow.m │ ├── PSMTabDragWindowController.h │ ├── PSMTabDragWindowController.m │ └── PSMTabStyle.h └── SSKeychain │ ├── SSKeychain.h │ ├── SSKeychain.m │ ├── SSKeychainQuery.h │ ├── SSKeychainQuery.m │ └── en.lproj │ └── SSKeychain.strings ├── Deploy ├── Changelog.markdown ├── Changelog.zh_CN.markdown ├── Changelog.zh_TW.markdown ├── Nally.xml ├── Nally.zh_CN.xml ├── Nally.zh_TW.xml ├── Release.html ├── appcast.template.xml ├── global.css └── nally.public.pem ├── Documents ├── graphics.graffle └── vtscore.txt ├── LICENSE ├── Makefile ├── Nally.entitlements ├── Nally.xcodeproj ├── project.pbxproj └── xcshareddata │ └── xcschemes │ └── Nally-Force_zhTW.xcscheme ├── Nally.xcworkspace ├── contents.xcworkspacedata ├── xcshareddata │ ├── IDEWorkspaceChecks.plist │ └── xcschemes │ │ ├── Nally-Release.xcscheme │ │ └── Nally.xcscheme └── xcuserdata │ └── rayer.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── Nally └── Images.xcassets │ └── AppIcon.appiconset │ ├── Contents.json │ ├── icon512x512.png │ └── icon512x512@2x.png ├── Plugins ├── HelloNally │ ├── English.lproj │ │ ├── InfoPlist.strings │ │ └── Localizable.strings │ ├── HelloNally.h │ ├── HelloNally.icns │ ├── HelloNally.m │ ├── HelloNally.xcodeproj │ │ ├── TemplateIcon.icns │ │ └── project.pbxproj │ ├── HelloNally_Prefix.pch │ └── Info.plist └── ImagePreviewer │ ├── English.lproj │ ├── InfoPlist.strings │ └── Localizable.strings │ ├── ImagePreviewer.h │ ├── ImagePreviewer.m │ ├── ImagePreviewer.xcodeproj │ ├── TemplateIcon.icns │ └── project.pbxproj │ ├── ImagePreviewer_Prefix.pch │ └── Info.plist ├── Podfile ├── README.md ├── Resources ├── Credits.rtf ├── DragonBall.v1.png ├── English.lproj │ ├── Localizable.strings │ ├── MainMenu.English.strings │ ├── MainMenu.xib │ ├── Preferences.English.strings │ └── Preferences.xib ├── HUDSave.tiff ├── HUDSaveActive.tiff ├── Info.plist ├── Whit.aiff ├── bookmark.pdf ├── connect.pdf ├── icon.icns ├── message.pdf ├── offline.pdf ├── reload.pdf ├── sleep.pdf ├── zh_CN.lproj │ ├── Localizable.strings │ ├── MainMenu.zh_CN.strings │ └── Preferences.zh_CN.strings └── zh_TW.lproj │ ├── Localizable.strings │ ├── MainMenu.zh_TW.strings │ └── Preferences.zh_TW.strings ├── Scripts └── package.py ├── Tests ├── TextSuiteTests.h └── TextSuiteTests.m └── TextSuiteTests-Info.plist /.gitignore: -------------------------------------------------------------------------------- 1 | .idea/* 2 | *.pbxuser 3 | *.perspectivev3 4 | *.mode1v3 5 | *.swp 6 | build/* 7 | .DS_Store 8 | *xcodeproj/project.xcworkspace 9 | *xcodeproj/xcuserdata 10 | *.xcworkspace/xcuserdata 11 | *~ 12 | .svn 13 | Podfile.lock 14 | Pods/ 15 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: osx 2 | language: objective-c 3 | osx_image: xcode10 4 | script: 5 | - xcodebuild -workspace Nally.xcworkspace -list 6 | - xcodebuild -workspace Nally.xcworkspace -scheme Pods-Nally 7 | -------------------------------------------------------------------------------- /Code/CommonType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CommonType.h 3 | * Nally 4 | * 5 | * Created by Yung-Luen Lan on 9/11/07. 6 | * Copyright 2007 yllan.org. All rights reserved. 7 | * 8 | */ 9 | 10 | typedef union { 11 | unsigned short v; 12 | struct { 13 | unsigned int fgColor : 4; 14 | unsigned int bgColor : 4; 15 | unsigned int bold : 1; 16 | unsigned int underline : 1; 17 | unsigned int blink : 1; 18 | unsigned int reverse : 1; 19 | unsigned int doubleByte : 2; 20 | unsigned int url : 1; 21 | unsigned int nothing : 1; 22 | } f; 23 | } attribute; 24 | 25 | typedef struct { 26 | unsigned char byte; 27 | attribute attr; 28 | } cell; 29 | 30 | typedef enum {C0, INTERMEDIATE, ALPHABETIC, DELETE, C1, G1, SPECIAL, ERROR} ASCII_CODE; 31 | 32 | typedef enum YLEncoding { 33 | YLBig5Encoding, 34 | YLGBKEncoding 35 | } YLEncoding; 36 | 37 | typedef enum YLANSIColorKey { 38 | YLCtrlUANSIColorKey, 39 | YLEscEscEscANSIColorKey 40 | } YLANSIColorKey; 41 | 42 | int isHiddenAttribute(attribute a) ; 43 | int isBlinkCell(cell c) ; 44 | int bgColorIndexOfAttribute(attribute a) ; 45 | int fgColorIndexOfAttribute(attribute a) ; 46 | int bgBoldOfAttribute(attribute a) ; 47 | int fgBoldOfAttribute(attribute a) ; -------------------------------------------------------------------------------- /Code/CommonType.m: -------------------------------------------------------------------------------- 1 | /* 2 | * CommonType.c 3 | * Nally 4 | * 5 | * Created by Yung-Luen Lan on 12/7/07. 6 | * Copyright 2007 yllan.org. All rights reserved. 7 | * 8 | */ 9 | 10 | #import "CommonType.h" 11 | 12 | int isHiddenAttribute(attribute a) 13 | { 14 | return (!a.f.bold && ((a.f.fgColor == a.f.bgColor) || 15 | (a.f.fgColor == 0 && a.f.bgColor == 9))); 16 | } 17 | 18 | int isBlinkCell(cell c) 19 | { 20 | if (c.attr.f.blink && (c.attr.f.doubleByte != 0 || (c.byte != ' ' && c.byte != '\0'))) 21 | return 1; 22 | return 0; 23 | } 24 | 25 | int bgColorIndexOfAttribute(attribute a) 26 | { 27 | return (a.f.reverse ? a.f.fgColor : a.f.bgColor); 28 | } 29 | 30 | int fgColorIndexOfAttribute(attribute a) 31 | { 32 | return (a.f.reverse ? a.f.bgColor : a.f.fgColor); 33 | } 34 | 35 | int bgBoldOfAttribute(attribute a) 36 | { 37 | return (a.f.reverse && a.f.bold); 38 | } 39 | 40 | int fgBoldOfAttribute(attribute a) 41 | { 42 | return (!a.f.reverse && a.f.bold); 43 | } -------------------------------------------------------------------------------- /Code/NSString+ext.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+ext.h 3 | // Nally 4 | // 5 | // Created by Rayer on 2019/3/17. 6 | // 7 | 8 | #import 9 | 10 | NS_ASSUME_NONNULL_BEGIN 11 | 12 | @interface NSString (UJStringUrlCategory) 13 | - (BOOL) UJ_isUrlLike; 14 | - (NSString *) UJ_protocolPrefixAppendedUrlString; 15 | @end 16 | 17 | NS_ASSUME_NONNULL_END 18 | -------------------------------------------------------------------------------- /Code/NSString+ext.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+ext.m 3 | // Nally 4 | // 5 | // Created by Rayer on 2019/3/17. 6 | // 7 | 8 | #import "NSString+ext.h" 9 | 10 | @implementation NSString (UJStringUrlCategory) 11 | - (BOOL) UJ_isUrlLike 12 | { 13 | NSURL *url = [NSURL URLWithString:self]; 14 | return url && url.scheme && url.host; 15 | } 16 | 17 | - (NSString *) UJ_protocolPrefixAppendedUrlString 18 | { 19 | NSArray *protocols = @[@"http://", @"https://", @"ftp://", @"telnet://", 20 | @"bbs://", @"ssh://", @"mailto:"]; 21 | for (NSString *p in protocols) 22 | { 23 | if ([self hasPrefix:p]) 24 | return self; 25 | } 26 | return [@"http://" stringByAppendingString:self]; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Code/Nally_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Nally' target in the 'Nally' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Code/PasteController.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Rayer on 2019-03-17. 3 | // 4 | 5 | #import 6 | #import 7 | 8 | 9 | @interface PasteController : NSObject { 10 | 11 | } 12 | 13 | @property bool anotherPasteStillOnGoing; 14 | 15 | + (instancetype)sharedInstance; 16 | 17 | - (void)handlePasteWithPasteboard:(NSPasteboard*) pasteBoard; 18 | 19 | - (void)defaultPasteWithPasteboard:(NSPasteboard*) pb; 20 | 21 | - (void)tinyurl:(id)sender; 22 | 23 | - (void)imgur:(id)sender; 24 | @end 25 | -------------------------------------------------------------------------------- /Code/PasteController.m: -------------------------------------------------------------------------------- 1 | // 2 | // Created by Rayer on 2019-03-17. 3 | // 4 | 5 | #import 6 | #import "PasteController.h" 7 | #import "YLLGlobalConfig.h" 8 | #import "YLController.h" 9 | #import "NSString+ext.h" 10 | 11 | 12 | @implementation PasteController { 13 | 14 | @private 15 | bool _anotherPasteStillOnGoing; 16 | } 17 | 18 | @synthesize anotherPasteStillOnGoing = _anotherPasteStillOnGoing; 19 | 20 | + (instancetype)sharedInstance { 21 | static id _sharedInstance = nil; 22 | static dispatch_once_t onceToken; 23 | dispatch_once(&onceToken, ^{ 24 | _sharedInstance = [[self alloc] init]; 25 | }); 26 | 27 | return _sharedInstance; 28 | } 29 | 30 | 31 | - (void)handlePasteWithPasteboard:(NSPasteboard*) pasteBoard { 32 | if ([[YLLGlobalConfig sharedInstance] smartPaste] == YES) { 33 | NSString *clipped = [pasteBoard stringForType:NSPasteboardTypeString]; 34 | //Handle URL & Transform to TinyURL 35 | if ([clipped UJ_isUrlLike] && [clipped length] > 40) { 36 | YLController *controller = (id) [NSApp delegate]; 37 | [[controller telnetView] insertText:[self tinyurlWithSourceURLString:clipped]]; 38 | return; 39 | } 40 | 41 | //Handle imgur with filepath 42 | NSString *filePath = [pasteBoard stringForType:@"public.file-url"]; //In 10.13, it is [pasteBoard stringForType:NSPasteboardTypeFileURL] 43 | if (filePath) { 44 | //Check if it is image 45 | NSURL *url = [NSURL URLWithString:filePath]; 46 | NSImage *img = [[[NSImage alloc] initWithContentsOfURL:url] autorelease]; 47 | if (img) { 48 | [self imgurWithData:[img TIFFRepresentation] withCompletionHandler:^(NSURL *imgurURL, NSError *error) { 49 | if (error) { 50 | NSLog(@"Error! %@", error); 51 | } 52 | YLController *controller = (id) [NSApp delegate]; 53 | [[controller telnetView] insertText:[imgurURL absoluteString]]; 54 | }]; 55 | return; 56 | } 57 | } 58 | 59 | //Handle imgur pasteboard 60 | if ([pasteBoard dataForType:NSPasteboardTypePNG] || [pasteBoard dataForType:NSPasteboardTypeTIFF]) { 61 | NSData *dataImgPng = [pasteBoard dataForType:NSPasteboardTypePNG]; 62 | NSData *dataImgTiff = [pasteBoard dataForType:NSPasteboardTypeTIFF]; 63 | [self imgurWithData:dataImgPng ? dataImgPng : dataImgTiff withCompletionHandler:^(NSURL *imgurURL, NSError *error) { 64 | if (error) { 65 | NSLog(@"Error! %@", error); 66 | } 67 | YLController *controller = (id) [NSApp delegate]; 68 | [[controller telnetView] insertText:[imgurURL absoluteString]]; 69 | }]; 70 | return; 71 | } 72 | 73 | [self defaultPasteWithPasteboard:pasteBoard]; 74 | } else { 75 | [self defaultPasteWithPasteboard:pasteBoard]; 76 | } 77 | 78 | 79 | } 80 | 81 | - (void)defaultPasteWithPasteboard:(NSPasteboard*) pb { 82 | NSArray *types = [pb types]; 83 | if ([types containsObject: NSStringPboardType]) { 84 | NSString *str = [pb stringForType: NSStringPboardType]; 85 | YLController *controller = (id) [NSApp delegate]; 86 | [[controller telnetView] insertText:str withDelay:100]; 87 | } 88 | } 89 | 90 | - (NSString*)tinyurlWithSourceURLString:(NSString*) urlString { 91 | [self setAnotherPasteStillOnGoing:YES]; 92 | NSAlert *alert = [self alertWithTitle:NSLocalizedString(@"Converting URL to TinyURL...", @"Converting URL to TinyURL...") andDetail:NSLocalizedString(@"It may take several seconds, please wait", @"It may take several seconds, please wait")]; 93 | NSString* APIRequestString = [@"http://tinyurl.com/api-create.php?url=" stringByAppendingString:urlString]; 94 | NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; 95 | [request setURL:[NSURL URLWithString:APIRequestString]]; 96 | [request setHTTPMethod:@"GET"]; 97 | NSError *error = nil; 98 | NSHTTPURLResponse *responseCode = nil; 99 | 100 | NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&responseCode error:&error]; 101 | 102 | if([responseCode statusCode] != 200){ 103 | NSLog(@"Error getting %@, HTTP status code %li", APIRequestString, (long)[responseCode statusCode]); 104 | return @""; 105 | } 106 | 107 | NSString *tinyurlResult = [[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding] autorelease]; 108 | 109 | [[NSApp mainWindow] endSheet:alert.window]; 110 | [self setAnotherPasteStillOnGoing:NO]; 111 | return tinyurlResult; 112 | } 113 | 114 | - (void)imgurWithData:(NSData*) imgData withCompletionHandler:(void (^)(NSURL *, NSError *))completionHandler; { 115 | [self setAnotherPasteStillOnGoing:YES]; 116 | NSAlert *alert = [self alertWithTitle:NSLocalizedString(@"Pasting to imgur...", @"Pasting to imgur...") andDetail:NSLocalizedString(@"It may take several seconds, please wait", @"It may take several seconds, please wait")]; 117 | 118 | [[ImgurAnonymousAPIClient sharedClient] uploadImageData:imgData withFilename:@"nally-uploaded" completionHandler:^(NSURL *imgurURL, NSError *error) { 119 | completionHandler(imgurURL, error); 120 | [[NSApp mainWindow] endSheet:alert.window]; 121 | //It will clear contents so it won't be paste again 122 | [[NSPasteboard generalPasteboard] clearContents]; 123 | [self setAnotherPasteStillOnGoing:NO]; 124 | }]; 125 | } 126 | 127 | - (void)tinyurl: (id)sender 128 | { 129 | NSString *tinyUrlResult = [self tinyurlWithSourceURLString:[sender representedObject]]; 130 | YLController *controller = (id) [NSApp delegate]; 131 | [[controller telnetView] insertText: tinyUrlResult]; 132 | } 133 | 134 | - (void)imgur:(id)sender { 135 | [self imgurWithData:[sender representedObject] withCompletionHandler:^(NSURL *imgurURL, NSError *error) { 136 | if(error) { 137 | NSLog(@"Error! %@", error); 138 | } 139 | YLController *controller = (id) [NSApp delegate]; 140 | [[controller telnetView] insertText:[imgurURL absoluteString]]; 141 | }]; 142 | } 143 | 144 | -(NSAlert*) alertWithTitle:(NSString*)title andDetail:(NSString*)detail { 145 | NSAlert *alert = [[NSAlert new] autorelease]; 146 | [alert setMessageText:title]; 147 | [alert setInformativeText:detail]; 148 | NSButton* dismissBtn = [alert addButtonWithTitle:NSLocalizedString(@"Dismiss", @"Dismiss alert when it freeze...")]; 149 | [dismissBtn setHidden:YES]; 150 | NSTimer* timer = [NSTimer timerWithTimeInterval:10 repeats:NO block:^(NSTimer * _Nonnull timer) { 151 | [dismissBtn setHidden:NO]; 152 | }]; 153 | 154 | [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode]; 155 | 156 | [alert setAlertStyle:NSAlertStyleInformational]; 157 | [alert beginSheetModalForWindow:[NSApp mainWindow] completionHandler:nil]; 158 | return alert; 159 | } 160 | @end 161 | -------------------------------------------------------------------------------- /Code/YLApplication.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLApplication.h 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 11/17/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | @class YLController; 11 | 12 | @interface YLApplication : NSApplication { 13 | IBOutlet YLController *_controller; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Code/YLApplication.mm: -------------------------------------------------------------------------------- 1 | // 2 | // YLApplication.m 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 11/17/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLApplication.h" 10 | #import "YLController.h" 11 | 12 | static NSString *gLeftString, *gRightString; 13 | 14 | @implementation YLApplication 15 | 16 | + (void) initialize 17 | { 18 | unichar r = NSRightArrowFunctionKey; 19 | unichar l = NSLeftArrowFunctionKey; 20 | gLeftString = [[NSString stringWithCharacters: &l length: 1] retain]; 21 | gRightString = [[NSString stringWithCharacters: &r length: 1] retain]; 22 | 23 | [NSColor setIgnoresAlpha: NO]; 24 | } 25 | 26 | - (void) sendEvent: (NSEvent *)event 27 | { 28 | NSAutoreleasePool *pool = [NSAutoreleasePool new]; 29 | if ([event type] == NSKeyDown) { 30 | if ((([event modifierFlags] & NSCommandKeyMask) == NSCommandKeyMask) && 31 | (([event modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask) && 32 | [[event charactersIgnoringModifiers] isEqualToString: gRightString] ) { 33 | 34 | event = [NSEvent keyEventWithType: [event type] 35 | location: [event locationInWindow] 36 | modifierFlags: [event modifierFlags] ^ NSShiftKeyMask 37 | timestamp: [event timestamp] 38 | windowNumber: [event windowNumber] 39 | context: [event context] 40 | characters: gRightString 41 | charactersIgnoringModifiers: gRightString 42 | isARepeat: [event isARepeat] 43 | keyCode:[event keyCode]]; 44 | } else if ((([event modifierFlags] & NSCommandKeyMask) == NSCommandKeyMask) && 45 | (([event modifierFlags] & NSShiftKeyMask) == NSShiftKeyMask) && 46 | [[event charactersIgnoringModifiers] isEqualToString: gLeftString] ) { 47 | 48 | event = [NSEvent keyEventWithType: [event type] 49 | location: [event locationInWindow] 50 | modifierFlags: [event modifierFlags] ^ NSShiftKeyMask 51 | timestamp: [event timestamp] 52 | windowNumber: [event windowNumber] 53 | context: [event context] 54 | characters: gLeftString 55 | charactersIgnoringModifiers: gLeftString 56 | isARepeat: [event isARepeat] 57 | keyCode:[event keyCode]]; 58 | } else if (([event modifierFlags] & NSCommandKeyMask) == NSCommandKeyMask && 59 | ([event modifierFlags] & NSAlternateKeyMask) == 0 && 60 | ([event modifierFlags] & NSControlKeyMask) == 0 && 61 | ([event modifierFlags] & NSShiftKeyMask) == 0 && 62 | [[event characters] intValue] > 0 && 63 | [[event characters] intValue] < 10) { 64 | [_controller selectTabNumber: [[event characters] intValue]]; 65 | [pool release]; 66 | return; 67 | } else if (([event modifierFlags] & NSCommandKeyMask) == NSCommandKeyMask && 68 | ([event modifierFlags] & NSAlternateKeyMask) == 0 && 69 | ([event modifierFlags] & NSControlKeyMask) == 0 && 70 | ([event modifierFlags] & NSShiftKeyMask) == 0 && 71 | [[event characters] isEqualToString: @"r"] && 72 | [[NSUserDefaults standardUserDefaults] boolForKey: @"CommandRHotkey"]) { 73 | [_controller reconnect: self]; 74 | [pool release]; 75 | return; 76 | } else if (([event modifierFlags] & NSCommandKeyMask) == NSCommandKeyMask && 77 | ([event modifierFlags] & NSAlternateKeyMask) == 0 && 78 | ([event modifierFlags] & NSControlKeyMask) == 0 && 79 | ([event modifierFlags] & NSShiftKeyMask) == 0 && 80 | [[event characters] isEqualToString: @"n"]) { 81 | [_controller editSites: self]; 82 | [pool release]; 83 | return; 84 | } 85 | } 86 | 87 | [super sendEvent:event]; 88 | [pool release]; 89 | } 90 | 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /Code/YLApplicationKitAddition.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLApplicationKitAddition.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/5/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | #import 9 | 10 | @interface NSMutableArray (QueueLikeOperation) 11 | - (id) popFirstObject; 12 | - (id) popLastObject; 13 | - (void) addObjectToFront: (id)object; 14 | - (void) insertObjects: (NSArray *)objects atIndex: (NSUInteger)index; 15 | - (void) addObjectsToFront: (NSArray *)objects; 16 | @end 17 | -------------------------------------------------------------------------------- /Code/YLApplicationKitAddition.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLApplicationKitAddition.m 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/5/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLApplicationKitAddition.h" 10 | 11 | @implementation NSMutableArray (QueueLikeOperation) 12 | - (id) popFirstObject 13 | { 14 | if ([self count] == 0) return nil; 15 | id firstObject = [[[self objectAtIndex: 0] retain] autorelease]; 16 | [self removeObjectAtIndex: 0]; 17 | return firstObject; 18 | } 19 | 20 | - (id) popLastObject 21 | { 22 | if ([self count] == 0) return nil; 23 | id lastObject = [[[self lastObject] retain] autorelease]; 24 | [self removeLastObject]; 25 | return lastObject; 26 | } 27 | 28 | - (void) addObjectToFront: (id)object 29 | { 30 | if (!object) return; 31 | [self insertObject: object atIndex: 0]; 32 | } 33 | 34 | - (void) insertObjects: (NSArray *)objects atIndex: (NSUInteger)index 35 | { 36 | if (!objects) return; 37 | for (id obj in [objects reverseObjectEnumerator]) 38 | [self insertObject: obj atIndex: index]; 39 | } 40 | 41 | - (void) addObjectsToFront: (NSArray *)objects 42 | { 43 | if (!objects) return; 44 | [self insertObjects: objects atIndex: 0]; 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /Code/YLBundle.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLBundle.h 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 8/17/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface YLBundle : NSBundle { 13 | NSString *title; 14 | NSString *description; 15 | NSMenu *pluginsMenu; 16 | } 17 | 18 | @property (copy) NSString *title; 19 | @property (copy) NSString *description; 20 | - (NSImage *) icon; 21 | 22 | - (NSString *) localizedStringForKey: (NSString *)key; 23 | - (NSMenu *) pluginMenu; 24 | - (void) addMenuItem: (NSMenuItem *)item; 25 | - (NSMenuItem *) addMenuItemWithTitle: (NSString *)title 26 | action: (SEL)action 27 | keyEquivalent: (NSString *)keyEquiv; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /Code/YLBundle.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLBundle.m 3 | // MacBlueTelnet 4 | // 5 | // Created by Jjgod Jiang on 8/17/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import "YLBundle.h" 10 | 11 | @implementation YLBundle 12 | 13 | @synthesize title; 14 | @synthesize description; 15 | 16 | - (id) init 17 | { 18 | if (self = [super init]) 19 | { 20 | // since this is a semi-abstract class, these need to be defined in the subclasses: 21 | title = [NSString stringWithString: @""]; 22 | description = [NSString stringWithString: @""]; 23 | pluginsMenu = [[[NSApp mainMenu] itemWithTitle: @"Plugins"] submenu]; 24 | } 25 | 26 | return self; 27 | } 28 | 29 | - (NSImage *) icon 30 | { 31 | NSBundle *currBundle = [NSBundle bundleForClass: [self class]]; 32 | NSString *bundleIconName = [currBundle objectForInfoDictionaryKey: @"CFBundleIconFile"]; 33 | NSImage *iconImage = nil; 34 | 35 | if (bundleIconName != nil) 36 | { 37 | NSString *iconPathStr = [currBundle pathForResource: bundleIconName 38 | ofType: nil]; 39 | iconImage = [[[NSImage alloc] initWithContentsOfFile: iconPathStr] autorelease]; 40 | } 41 | 42 | return iconImage; 43 | } 44 | 45 | - (NSMenu *) pluginMenu 46 | { 47 | if (! pluginsMenu) 48 | return nil; 49 | 50 | NSMenu *pluginMenu = [[pluginsMenu itemWithTitle: [self title]] submenu]; 51 | if (! pluginMenu) 52 | { 53 | NSMenuItem *pluginMenuItem = [[NSMenuItem alloc] initWithTitle: [self title] 54 | action: nil 55 | keyEquivalent: @""]; 56 | [pluginMenuItem setToolTip: [self description]]; 57 | [pluginsMenu addItem: pluginMenuItem]; 58 | [pluginMenuItem release]; 59 | 60 | pluginMenu = [[NSMenu alloc] initWithTitle: title]; 61 | [pluginMenuItem setSubmenu: pluginMenu]; 62 | [pluginMenu release]; 63 | } 64 | 65 | return pluginMenu; 66 | } 67 | 68 | - (NSString *) localizedStringForKey: (NSString *) key 69 | { 70 | return [[NSBundle bundleForClass: [self class]] localizedStringForKey: key 71 | value: @"" 72 | table: nil]; 73 | } 74 | 75 | - (void) addMenuItem: (NSMenuItem *) item 76 | { 77 | [item setTarget: self]; 78 | [[self pluginMenu] addItem: item]; 79 | } 80 | 81 | - (NSMenuItem *) addMenuItemWithTitle: (NSString *) menuTitle 82 | action: (SEL) action 83 | keyEquivalent: (NSString *) keyEquiv 84 | { 85 | return [[self pluginMenu] addItemWithTitle: menuTitle 86 | action: action 87 | keyEquivalent: keyEquiv]; 88 | } 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /Code/YLConnection.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLConnection.h 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 12/7/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLTerminal.h" 11 | 12 | @class YLSite; 13 | 14 | @protocol YLConnectionProtocol 15 | - (void) close; 16 | - (void) reconnect; 17 | 18 | - (BOOL) connectToSite: (YLSite *)s; 19 | - (BOOL) connectToAddress: (NSString *)addr; 20 | - (BOOL) connectToAddress: (NSString *)addr port: (unsigned int)port; 21 | 22 | - (void) receiveBytes: (unsigned char *)bytes length: (NSUInteger)length; 23 | - (void) sendBytes: (unsigned char *)msg length: (NSInteger)length; 24 | - (void) sendData: (NSData *)msg; 25 | 26 | @property (retain) YLTerminal *terminal; 27 | @property BOOL connected; 28 | @property (copy) NSString *connectionName; 29 | @property (copy) NSString *connectionAddress; 30 | @property (retain) NSImage *icon; 31 | @property BOOL isProcessing; 32 | @property (retain) YLSite *site; 33 | - (NSDate *) lastTouchDate; 34 | @end 35 | 36 | @interface YLConnection : NSObject { 37 | NSString *_connectionName; 38 | NSString *_connectionAddress; 39 | NSImage *_icon; 40 | BOOL _processing; 41 | BOOL _connected; 42 | 43 | NSDate *_lastTouchDate; 44 | 45 | YLTerminal *_terminal; 46 | YLSite *_site; 47 | } 48 | 49 | + (YLConnection *) connectionWithAddress: (NSString *)addr; 50 | @end 51 | -------------------------------------------------------------------------------- /Code/YLConnection.mm: -------------------------------------------------------------------------------- 1 | // 2 | // YLConnection.mm 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 12/7/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLConnection.h" 10 | 11 | 12 | @implementation YLConnection 13 | 14 | + (YLConnection *) connectionWithAddress: (NSString *)addr 15 | { 16 | Class c; 17 | if ([addr hasPrefix: @"ssh://"]) 18 | c = NSClassFromString(@"YLSSH"); 19 | else 20 | c = NSClassFromString(@"YLTelnet"); 21 | // NSLog(@"CONNECTION wih addr: %@ %@", addr, c); 22 | return (YLConnection *)[[c new] autorelease]; 23 | } 24 | 25 | - (void) dealloc 26 | { 27 | [_lastTouchDate release]; 28 | [_icon release]; 29 | [_connectionName release]; 30 | [_connectionAddress release]; 31 | [_terminal release]; 32 | [super dealloc]; 33 | } 34 | 35 | - (YLTerminal *) terminal 36 | { 37 | return _terminal; 38 | } 39 | 40 | - (void) setTerminal: (YLTerminal *) term 41 | { 42 | if (term != _terminal) { 43 | [_terminal release]; 44 | _terminal = [term retain]; 45 | [_terminal setConnection: self]; 46 | } 47 | } 48 | 49 | - (BOOL) connected 50 | { 51 | return _connected; 52 | } 53 | 54 | - (void) setConnected: (BOOL)value 55 | { 56 | _connected = value; 57 | if (_connected) 58 | [self setIcon: [NSImage imageNamed: @"connect.pdf"]]; 59 | else { 60 | [[self terminal] setHasMessage: NO]; 61 | [self setIcon: [NSImage imageNamed: @"offline.pdf"]]; 62 | } 63 | } 64 | 65 | @synthesize connectionName = _connectionName; 66 | @synthesize connectionAddress = _connectionAddress; 67 | @synthesize icon = _icon; 68 | @synthesize isProcessing = _processing; 69 | @synthesize site = _site; 70 | 71 | - (NSDate *) lastTouchDate 72 | { 73 | return _lastTouchDate; 74 | } 75 | 76 | #pragma mark - 77 | #pragma mark Dummy Behavior 78 | - (void) close 79 | { 80 | } 81 | - (void) reconnect 82 | { 83 | } 84 | - (BOOL) connectToSite: (YLSite *)site 85 | { 86 | [self setSite: site]; 87 | return [self connectToAddress: (NSString *)[site address]]; 88 | } 89 | 90 | - (BOOL) connectToAddress: (NSString *)addr 91 | { 92 | return YES; 93 | } 94 | - (BOOL) connectToAddress: (NSString *)addr port: (unsigned int)port 95 | { 96 | return YES; 97 | } 98 | 99 | - (void) receiveBytes: (unsigned char *)bytes length: (NSUInteger)length 100 | { 101 | } 102 | - (void) sendBytes: (unsigned char *)msg length: (NSInteger)length 103 | { 104 | } 105 | - (void) sendData: (NSData *)msg 106 | { 107 | } 108 | 109 | @end -------------------------------------------------------------------------------- /Code/YLContextualMenuManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLContextualMenuManager.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 11/28/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface YLContextualMenuManager : NSObject 13 | { 14 | NSArray *_urlsToOpen; 15 | } 16 | 17 | @property bool anotherPasteStillOnGoing; 18 | 19 | + (YLContextualMenuManager *) sharedInstance ; 20 | - (id) init ; 21 | - (NSArray *) availableMenuItemForSelectionString: (NSString *)selectedString; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Code/YLController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLController.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 9/11/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLView.h" 11 | #import "../Dependencies/PSMTabBarControl/PSMTabBarControl.h" 12 | #import "YLSite.h" 13 | #import "YLPluginLoader.h" 14 | #import "YLExifController.h" 15 | 16 | @class YLTerminal; 17 | 18 | @interface YLController : NSObject { 19 | IBOutlet NSPanel *_sitesWindow; 20 | IBOutlet NSPanel *_emoticonsWindow; 21 | IBOutlet NSWindow *_mainWindow; 22 | IBOutlet id _telnetView; 23 | IBOutlet id _addressBar; 24 | IBOutlet id _smartPasteButton; 25 | IBOutlet id _detectDoubleByteButton; 26 | 27 | IBOutlet PSMTabBarControl *_tab; 28 | IBOutlet NSMenuItem *_detectDoubleByteMenuItem; 29 | IBOutlet NSMenuItem *_closeWindowMenuItem; 30 | IBOutlet NSMenuItem *_closeTabMenuItem; 31 | NSMutableArray *_sites; 32 | NSMutableArray *_emoticons; 33 | IBOutlet NSArrayController *_sitesController; 34 | IBOutlet NSArrayController *_emoticonsController; 35 | IBOutlet NSMenuItem *_sitesMenu; 36 | IBOutlet NSTextField *_siteNameField; 37 | IBOutlet NSMenuItem *_showHiddenTextMenuItem; 38 | IBOutlet NSMenuItem *_encodingMenuItem; 39 | IBOutlet YLExifController *_exifController; 40 | 41 | YLPluginLoader *_pluginLoader; 42 | } 43 | 44 | - (void) updateSitesMenu; 45 | - (void) loadSites; 46 | - (void) loadEmoticons; 47 | - (void) loadLastConnections; 48 | 49 | - (IBAction) setEncoding: (id)sender; 50 | - (IBAction) setDetectDoubleByteAction: (id)sender; 51 | 52 | - (IBAction) newTab: (id)sender; 53 | - (IBAction) connect: (id)sender; 54 | - (IBAction) openLocation: (id)sender; 55 | - (IBAction) selectNextTab: (id)sender; 56 | - (IBAction) selectPrevTab: (id)sender; 57 | - (IBAction) selectTabNumber: (int)index; 58 | - (IBAction) closeTab: (id)sender; 59 | - (IBAction) reconnect: (id)sender; 60 | - (IBAction) openSites: (id)sender; 61 | - (IBAction) editSites: (id)sender; 62 | - (IBAction) closeSites: (id)sender; 63 | - (IBAction) addSites: (id)sender; 64 | - (IBAction) autoLogin: (id)sender; 65 | - (IBAction) showHiddenText: (id)sender; 66 | 67 | - (IBAction) setSmartPasteAction:(id)sender; 68 | - (IBAction) openPreferencesWindow: (id)sender; 69 | - (void) newConnectionWithSite: (YLSite *)site; 70 | 71 | - (IBAction) closeEmoticons: (id)sender; 72 | - (IBAction) inputEmoticons: (id)sender; 73 | - (IBAction) openEmoticonsWindow: (id)sender; 74 | 75 | - (YLExifController *) exifController; 76 | - (id) telnetView; 77 | 78 | - (NSArray *) sites; 79 | - (unsigned) countOfSites; 80 | - (id) objectInSitesAtIndex: (unsigned)theIndex; 81 | - (void) getSites: (id *)objsPtr range: (NSRange)range; 82 | - (void) insertObject: (id)obj inSitesAtIndex: (unsigned)theIndex; 83 | - (void) removeObjectFromSitesAtIndex: (unsigned)theIndex; 84 | - (void) replaceObjectInSitesAtIndex: (unsigned)theIndex withObject: (id)obj; 85 | 86 | - (void) refreshTabLabelNumber: (NSTabView *)tabView; 87 | 88 | - (NSArray *) emoticons; 89 | - (unsigned) countOfEmoticons; 90 | - (id) objectInEmoticonsAtIndex: (unsigned)theIndex; 91 | - (void) getEmoticons: (id *)objsPtr range: (NSRange)range; 92 | - (void) insertObject: (id)obj inEmoticonsAtIndex: (unsigned)theIndex; 93 | - (void) removeObjectFromEmoticonsAtIndex: (unsigned)theIndex; 94 | - (void) replaceObjectInEmoticonsAtIndex: (unsigned)theIndex withObject: (id)obj; 95 | 96 | @end 97 | -------------------------------------------------------------------------------- /Code/YLDataSourceProtocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | * YLDataSourceProtocol.h 3 | * MacBlueTelnet 4 | * 5 | * Created by Yung-Luen Lan on 9/1/07. 6 | * Copyright 2007 yllan.org. All rights reserved. 7 | * 8 | */ 9 | 10 | 11 | 12 | @interface NSObject (YLDataSourceProtocol) 13 | - (int) row; 14 | - (int) column; 15 | - (BOOL) isDirtyAtRow: (int) r column:(int) c; 16 | - (NSColor *) fgColorAtRow: (int) r column: (int) c; 17 | - (NSColor *) bgColorAtRow: (int) r column: (int) c; 18 | - (int) fgColorIndexAtRow: (int) r column: (int) c ; 19 | - (int) bgColorIndexAtRow: (int) r column: (int) c ; 20 | - (unichar) charAtRow: (int) r column: (int) c; 21 | - (int) isDoubleByteAtRow: (int) r column:(int) c; 22 | @end -------------------------------------------------------------------------------- /Code/YLEmoticon.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLEmoticon.h 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 12/4/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface YLEmoticon : NSObject { 13 | NSString *_name; 14 | NSString *_content; 15 | } 16 | 17 | + (YLEmoticon *) emoticonWithDictionary: (NSDictionary *)dict; 18 | - (NSDictionary *) dictionaryOfEmoticon; 19 | 20 | @property (copy) NSString *name; 21 | @property (copy) NSString *content; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Code/YLEmoticon.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLEmoticon.m 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 12/4/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLEmoticon.h" 10 | 11 | 12 | @implementation YLEmoticon 13 | 14 | + (YLEmoticon *) emoticonWithDictionary: (NSDictionary *)dict 15 | { 16 | YLEmoticon *e = [[YLEmoticon alloc] init]; 17 | // [e setName: [d valueForKey: @"name"]]; 18 | [e setContent: [dict valueForKey: @"content"]]; 19 | return [e autorelease]; 20 | } 21 | 22 | + (NSSet *) keyPathsForValuesAffectingDescription 23 | { 24 | return [NSSet setWithObjects: @"content", nil]; 25 | } 26 | 27 | - (NSDictionary *) dictionaryOfEmoticon 28 | { 29 | return [NSDictionary dictionaryWithObjectsAndKeys: [self content], @"content", nil]; 30 | } 31 | 32 | + (YLEmoticon *) emoticonWithName: (NSString *)n content: (NSString *)c 33 | { 34 | YLEmoticon *e = [YLEmoticon new]; 35 | // [e setName: n]; 36 | [e setContent: c]; 37 | return [e autorelease]; 38 | } 39 | 40 | - (YLEmoticon *) init 41 | { 42 | if ([super init]) { 43 | [self setContent: @":)"]; 44 | } 45 | return self; 46 | } 47 | 48 | - (void) dealloc 49 | { 50 | [_content release]; 51 | [_name release]; 52 | [super dealloc]; 53 | } 54 | 55 | @synthesize name = _name; 56 | @synthesize content = _content; 57 | 58 | - (NSString *) description 59 | { 60 | return [NSString stringWithFormat: @"%@", [[[self content] componentsSeparatedByString: @"\n"] componentsJoinedByString: @""]]; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /Code/YLExifController.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLExifController.h 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 1/5/09. 6 | // Copyright 2009 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YLExifController : NSObject { 12 | IBOutlet NSTextField *exposure; 13 | IBOutlet NSTextField *fNumber; 14 | IBOutlet NSTextField *iso; 15 | IBOutlet NSTextField *model; 16 | IBOutlet NSTextField *date; 17 | IBOutlet NSPanel *exifPanel; 18 | 19 | NSDictionary *exifData; 20 | NSString *isoSpeed; 21 | NSString *exposureTime; 22 | NSString *modelName; 23 | } 24 | 25 | @property (retain) NSDictionary *exifData; 26 | @property (assign) NSString *isoSpeed; 27 | @property (assign) NSString *exposureTime; 28 | @property (assign) NSString *modelName; 29 | 30 | - (void) showExifPanel; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /Code/YLExifController.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLExifController.m 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 1/5/09. 6 | // Copyright 2009 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import "YLExifController.h" 10 | 11 | @implementation YLExifController 12 | 13 | @synthesize exifData; 14 | @synthesize isoSpeed; 15 | @synthesize exposureTime; 16 | @synthesize modelName; 17 | 18 | - (void) showExifPanel 19 | { 20 | NSArray *isoArray = [exifData objectForKey: (NSString *) kCGImagePropertyExifISOSpeedRatings]; 21 | NSNumber *isoNumber = nil; 22 | if (isoArray && [isoArray count]) 23 | isoNumber = [isoArray objectAtIndex: 0]; 24 | [self setIsoSpeed: [isoNumber stringValue]]; 25 | 26 | NSNumber *eTime = [exifData objectForKey: (NSString *) kCGImagePropertyExifExposureTime]; 27 | // readable exposure time 28 | NSString *eTimeStr = nil; 29 | if (eTime) { 30 | double eTimeVal = [eTime doubleValue]; 31 | // zero exposure time... 32 | if (eTimeVal < 1 && eTimeVal != 0) { 33 | eTimeStr = [NSString stringWithFormat:@"1/%g", 1/eTimeVal]; 34 | } else 35 | eTimeStr = [eTime stringValue]; 36 | } 37 | [self setExposureTime: eTimeStr]; 38 | 39 | [exifPanel center]; 40 | [exifPanel makeKeyAndOrderFront: nil]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Code/YLFloatingView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLFloatingView.h 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 12/29/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface YLFloatingView : NSView { 13 | BOOL mouseDown; 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Code/YLFloatingView.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLFloatingView.m 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 12/29/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import "YLFloatingView.h" 10 | #import "YLImageView.h" 11 | 12 | @interface NSBezierPath (RoundRect) 13 | 14 | - (void) appendBezierPathWithRoundedRect:(NSRect)rect cornerRadius: (float)radius; 15 | + (NSBezierPath *) bezierPathWithRoundedRect:(NSRect)rect cornerRadius: (float)radius; 16 | 17 | @end 18 | 19 | 20 | @implementation NSBezierPath (RoundRect) 21 | 22 | - (void) appendBezierPathWithRoundedRect:(NSRect)rect cornerRadius: (float)radius { 23 | if (! NSIsEmptyRect(rect)) 24 | { 25 | if (radius > 0.0) { 26 | // Clamp radius to be no larger than half the rect's width or height. 27 | float clampedRadius = MIN(radius, 0.5 * MIN(rect.size.width, 28 | rect.size.height)); 29 | 30 | NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); 31 | NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); 32 | NSPoint bottomRight = NSMakePoint(NSMaxX(rect), NSMinY(rect)); 33 | 34 | [self moveToPoint:NSMakePoint(NSMidX(rect), NSMaxY(rect))]; 35 | [self appendBezierPathWithArcFromPoint:topLeft 36 | toPoint:rect.origin radius:clampedRadius]; 37 | [self appendBezierPathWithArcFromPoint:rect.origin 38 | toPoint:bottomRight radius:clampedRadius]; 39 | [self appendBezierPathWithArcFromPoint:bottomRight 40 | toPoint:topRight radius:clampedRadius]; 41 | [self appendBezierPathWithArcFromPoint:topRight 42 | toPoint:topLeft radius:clampedRadius]; 43 | [self closePath]; 44 | } else { 45 | // When radius == 0.0, this degenerates to the simple case of a plain rectangle. 46 | [self appendBezierPathWithRect:rect]; 47 | } 48 | } 49 | } 50 | 51 | + (NSBezierPath *) bezierPathWithRoundedRect:(NSRect)rect cornerRadius: (float)radius 52 | { 53 | NSBezierPath *result = [NSBezierPath bezierPath]; 54 | [result appendBezierPathWithRoundedRect:rect cornerRadius:radius]; 55 | return result; 56 | } 57 | 58 | @end 59 | 60 | @implementation YLFloatingView 61 | 62 | - (void) drawRect: (NSRect)rect 63 | { 64 | NSColor *color = [NSColor colorWithCalibratedRed: 0 65 | green: 0 66 | blue: 0 67 | alpha: 1]; 68 | [color set]; 69 | NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect: rect 70 | cornerRadius: 10.0]; 71 | [path fill]; 72 | 73 | NSString *imageFile = @"HUDSave"; 74 | if (mouseDown) 75 | imageFile = @"HUDSaveActive"; 76 | NSImage *img = [[NSImage alloc] initWithContentsOfFile: [[NSBundle mainBundle] pathForResource: imageFile 77 | ofType: @"tiff"]]; 78 | [img drawAtPoint: NSMakePoint((rect.size.width - [img size].width) / 2, (rect.size.height - [img size].height) / 2) 79 | fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1.0]; 80 | [img release]; 81 | } 82 | 83 | - (void) mouseDown: (NSEvent *)event 84 | { 85 | mouseDown = YES; 86 | [self setNeedsDisplay: YES]; 87 | } 88 | 89 | - (void) mouseUp: (NSEvent *)event 90 | { 91 | NSSavePanel *panel = [NSSavePanel savePanel]; 92 | YLImagePreviewer *previewer = [(YLImageView *)[self superview] previewer]; 93 | 94 | [panel setNameFieldStringValue: [previewer filename]]; 95 | if ([panel runModal] == NSFileHandlingPanelOKButton) 96 | { 97 | /* BOOL ret = */ [[previewer receivedData] writeToFile: [[panel URL] path] 98 | atomically: YES]; 99 | // NSLog(@"save as %@: %s", [panel filename], ret == YES ? "done" : "failed"); 100 | } 101 | 102 | mouseDown = NO; 103 | [self setNeedsDisplay: YES]; 104 | } 105 | 106 | 107 | @end 108 | -------------------------------------------------------------------------------- /Code/YLImagePreviewer.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLImagePreviewer.h 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 2/17/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface YLImagePreviewer : NSObject { 12 | NSURL *_currentFileUrlDownloading; 13 | NSString *_currentFileDownloading; 14 | NSMutableData *_receivedData; 15 | NSURLConnection *_connection; 16 | NSProgressIndicator *_indicator; 17 | long long _totalLength; 18 | NSPanel *_window; 19 | } 20 | 21 | - (id) initWithURL: (NSURL *)url; 22 | - (void) showLoadingWindow; 23 | - (void) releaseConnection; 24 | - (NSMutableData *) receivedData; 25 | - (NSString *) filename; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Code/YLImageView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLImageView.h 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 3/27/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLImagePreviewer.h" 11 | #import "YLFloatingView.h" 12 | 13 | enum showTips { kShowTipsNone, kShowTipsWhite, kShowTipsGray }; 14 | 15 | @interface YLImageView : NSImageView { 16 | NSRect tipsRect; 17 | enum showTips tipsState; 18 | 19 | YLImagePreviewer *previewer; 20 | YLFloatingView *indicator; 21 | 22 | NSDictionary *tiffData; 23 | } 24 | 25 | @property (retain) NSDictionary *tiffData; 26 | 27 | - (id) initWithFrame: (NSRect)frame previewer: (YLImagePreviewer *)thePreviewer; 28 | - (void) setPreviewer: (YLImagePreviewer *)thePreviewer; 29 | - (YLImagePreviewer *)previewer; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /Code/YLImageView.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLImageView.m 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 3/27/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import "YLImageView.h" 10 | #import "YLController.h" 11 | 12 | enum { 13 | kFloatRectWidth = 100, 14 | kFloatRectHeight = 60, 15 | }; 16 | 17 | @implementation YLImageView 18 | 19 | @synthesize tiffData; 20 | 21 | - (id) initWithFrame: (NSRect)frame previewer: (YLImagePreviewer *)thePreviewer 22 | { 23 | self = [super initWithFrame: frame]; 24 | if (self) 25 | { 26 | tipsState = kShowTipsGray; 27 | tipsRect = NSMakeRect((frame.size.width - kFloatRectWidth) / 2, 10, kFloatRectWidth, kFloatRectHeight); 28 | 29 | previewer = thePreviewer; 30 | [self addTrackingRect: frame 31 | owner: self 32 | userData: nil 33 | assumeInside: NO]; 34 | 35 | indicator = [[YLFloatingView alloc] initWithFrame: tipsRect]; 36 | [indicator setWantsLayer: YES]; 37 | [indicator setAlphaValue: 0.0]; 38 | [self addSubview: indicator]; 39 | } 40 | 41 | return self; 42 | } 43 | 44 | - (void) dealloc 45 | { 46 | [indicator release]; 47 | [super dealloc]; 48 | } 49 | 50 | - (void) keyDown: (NSEvent *)event 51 | { 52 | if ([[event characters] isEqual: @"i"]) 53 | { 54 | NSBitmapImageRep *rep = [[[self image] representations] objectAtIndex: 0]; 55 | NSDictionary *exif = [rep valueForProperty: NSImageEXIFData]; 56 | 57 | // NSLog(@"exif = %@", exif); 58 | 59 | YLController *controller = [NSApp delegate]; 60 | YLExifController *exifController = [controller exifController]; 61 | 62 | NSString *makeName = [tiffData objectForKey:(NSString *) kCGImagePropertyTIFFMake]; 63 | NSString *modelName = [tiffData objectForKey: (NSString *) kCGImagePropertyTIFFModel]; 64 | // NSLog(@"tiff = %@, modelName = %@", tiff, modelName); 65 | 66 | [exifController setExifData: exif]; 67 | [exifController setModelName: [NSString stringWithFormat: @"%@ %@", makeName, modelName]]; 68 | [exifController showExifPanel]; 69 | } 70 | } 71 | 72 | - (void) mouseMoved: (NSEvent *)event 73 | { 74 | [[indicator animator] setAlphaValue: 0.8]; 75 | [[self window] setAcceptsMouseMovedEvents: NO]; 76 | } 77 | 78 | - (void) mouseEntered: (NSEvent *)event 79 | { 80 | [[indicator animator] setAlphaValue: 0.8]; 81 | } 82 | 83 | - (void) mouseExited: (NSEvent *)event 84 | { 85 | [[indicator animator] setAlphaValue: 0.0]; 86 | } 87 | 88 | - (void) setPreviewer: (YLImagePreviewer *)thePreviewer 89 | { 90 | previewer = thePreviewer; 91 | } 92 | 93 | - (YLImagePreviewer *) previewer 94 | { 95 | return previewer; 96 | } 97 | 98 | @end 99 | -------------------------------------------------------------------------------- /Code/YLLGlobalConfig.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLLGlobalConfig.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 2006/11/12. 6 | // Copyright 2006 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CommonType.h" 11 | #import 12 | #define NUM_COLOR 10 13 | 14 | @interface YLLGlobalConfig : NSObject { 15 | @public 16 | int _messageCount; 17 | int _row; 18 | int _column; 19 | CGFloat _cellWidth; 20 | CGFloat _cellHeight; 21 | 22 | int _bgColorIndex; 23 | int _fgColorIndex; 24 | 25 | BOOL _showHiddenText; 26 | BOOL _blinkTicker; 27 | BOOL _shouldSmoothFonts; 28 | BOOL _detectDoubleByte; 29 | BOOL _repeatBounce; 30 | BOOL _shouldPreferImagePreviewer; 31 | BOOL _smartPaste; 32 | YLEncoding _defaultEncoding; 33 | YLANSIColorKey _defaultANSIColorKey; 34 | 35 | CGFloat _chineseFontSize; 36 | CGFloat _englishFontSize; 37 | CGFloat _chineseFontPaddingLeft; 38 | CGFloat _englishFontPaddingLeft; 39 | CGFloat _chineseFontPaddingBottom; 40 | CGFloat _englishFontPaddingBottom; 41 | NSString *_chineseFontName; 42 | NSString *_englishFontName; 43 | 44 | CTFontRef _cCTFont; 45 | CTFontRef _eCTFont; 46 | CGFontRef _cCGFont; 47 | CGFontRef _eCGFont; 48 | 49 | NSColor *_colorTable[2][NUM_COLOR]; 50 | 51 | CFDictionaryRef _cCTAttribute[2][NUM_COLOR]; 52 | CFDictionaryRef _eCTAttribute[2][NUM_COLOR]; 53 | } 54 | 55 | 56 | + (YLLGlobalConfig *) sharedInstance; 57 | 58 | - (void) refreshFont; 59 | 60 | - (int)messageCount; 61 | - (void)setMessageCount:(int)value; 62 | 63 | - (int)row; 64 | - (void)setRow:(int)value; 65 | - (int)column; 66 | - (void)setColumn:(int)value; 67 | - (CGFloat)cellWidth; 68 | - (void)setCellWidth:(CGFloat)value; 69 | - (CGFloat)cellHeight; 70 | - (void)setCellHeight:(CGFloat)value; 71 | 72 | - (BOOL)showHiddenText; 73 | - (void)setShowHiddenText:(BOOL)value; 74 | - (BOOL)shouldSmoothFonts; 75 | - (void)setShouldSmoothFonts:(BOOL)value; 76 | - (BOOL)detectDoubleByte; 77 | - (void)setDetectDoubleByte:(BOOL)value; 78 | 79 | - (BOOL)smartPaste; 80 | 81 | - (void)setSmartPaste:(BOOL)value; 82 | - (BOOL)repeatBounce; 83 | - (void)setRepeatBounce:(BOOL)value; 84 | - (BOOL)shouldPreferImagePreviewer; 85 | - (void)setShouldPreferImagePreviewer:(BOOL)value; 86 | 87 | - (YLEncoding)defaultEncoding; 88 | - (void)setDefaultEncoding:(YLEncoding)value; 89 | - (YLANSIColorKey)defaultANSIColorKey; 90 | - (void)setDefaultANSIColorKey:(YLANSIColorKey)value; 91 | 92 | 93 | 94 | - (NSColor *) colorAtIndex: (int) i hilite: (BOOL) h ; 95 | - (void) setColor: (NSColor *) c hilite: (BOOL) h atIndex: (int) i ; 96 | 97 | - (BOOL)blinkTicker; 98 | - (void)setBlinkTicker:(BOOL)value; 99 | - (void)updateBlinkTicker; 100 | 101 | - (CGFloat)chineseFontSize; 102 | - (void)setChineseFontSize:(CGFloat)value; 103 | 104 | - (CGFloat)englishFontSize; 105 | - (void)setEnglishFontSize:(CGFloat)value; 106 | 107 | - (CGFloat)chineseFontPaddingLeft; 108 | - (void)setChineseFontPaddingLeft:(CGFloat)value; 109 | 110 | - (CGFloat)englishFontPaddingLeft; 111 | - (void)setEnglishFontPaddingLeft:(CGFloat)value; 112 | 113 | - (CGFloat)chineseFontPaddingBottom; 114 | - (void)setChineseFontPaddingBottom:(CGFloat)value; 115 | 116 | - (CGFloat)englishFontPaddingBottom; 117 | - (void)setEnglishFontPaddingBottom:(CGFloat)value; 118 | 119 | - (NSString *)chineseFontName; 120 | - (void)setChineseFontName:(NSString *)value; 121 | 122 | - (NSString *)englishFontName; 123 | - (void)setEnglishFontName:(NSString *)value; 124 | 125 | /* Color */ 126 | - (NSColor *) colorBlack ; 127 | - (void) setColorBlack: (NSColor *) c; 128 | - (NSColor *) colorBlackHilite ; 129 | - (void) setColorBlackHilite: (NSColor *) c; 130 | 131 | - (NSColor *) colorRed ; 132 | - (void) setColorRed: (NSColor *) c; 133 | - (NSColor *) colorRedHilite ; 134 | - (void) setColorRedHilite: (NSColor *) c; 135 | 136 | - (NSColor *) colorGreen ; 137 | - (void) setColorGreen: (NSColor *) c; 138 | - (NSColor *) colorGreenHilite ; 139 | - (void) setColorGreenHilite: (NSColor *) c; 140 | 141 | - (NSColor *) colorYellow ; 142 | - (void) setColorYellow: (NSColor *) c; 143 | - (NSColor *) colorYellowHilite ; 144 | - (void) setColorYellowHilite: (NSColor *) c; 145 | 146 | - (NSColor *) colorBlue ; 147 | - (void) setColorBlue: (NSColor *) c; 148 | - (NSColor *) colorBlueHilite ; 149 | - (void) setColorBlueHilite: (NSColor *) c; 150 | 151 | - (NSColor *) colorMagenta ; 152 | - (void) setColorMagenta: (NSColor *) c; 153 | - (NSColor *) colorMagentaHilite ; 154 | - (void) setColorMagentaHilite: (NSColor *) c; 155 | 156 | - (NSColor *) colorCyan ; 157 | - (void) setColorCyan: (NSColor *) c; 158 | - (NSColor *) colorCyanHilite ; 159 | - (void) setColorCyanHilite: (NSColor *) c; 160 | 161 | - (NSColor *) colorWhite ; 162 | - (void) setColorWhite: (NSColor *) c; 163 | - (NSColor *) colorWhiteHilite; 164 | - (void) setColorWhiteHilite: (NSColor *) c; 165 | 166 | - (NSColor *) colorBG ; 167 | - (void) setColorBG: (NSColor *) c; 168 | - (NSColor *) colorBGHilite ; 169 | - (void) setColorBGHilite: (NSColor *) c; 170 | 171 | @end 172 | -------------------------------------------------------------------------------- /Code/YLLine.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLLine.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/4/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLRun.h" 11 | 12 | @interface YLLine : NSObject { 13 | NSMutableArray *_runs; 14 | NSUInteger _width; 15 | } 16 | 17 | @property (nonatomic, assign) NSUInteger width; 18 | @property (nonatomic, retain) NSArray *runs; 19 | @property (readonly) NSUInteger length; 20 | 21 | + (id) lineWithWidth: (NSUInteger)width; 22 | - (id) initWithWidth: (NSUInteger)width; 23 | 24 | - (NSString *) description; 25 | 26 | - (BOOL) hasRoomForRun: (YLRun *)run; 27 | - (void) addRun: (YLRun *)run; 28 | - (YLRun *) lastStringRun; 29 | - (NSArray *) popRunsToWrapLine; 30 | 31 | @end 32 | 33 | 34 | -------------------------------------------------------------------------------- /Code/YLLine.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLLine.m 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/4/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLLine.h" 10 | #import "YLApplicationKitAddition.h" 11 | 12 | #define TAB_SIZE 4 13 | 14 | @implementation YLLine 15 | 16 | @synthesize width = _width; 17 | @synthesize runs = _runs; 18 | 19 | + (id) lineWithWidth: (NSUInteger)width 20 | { 21 | return [[[YLLine alloc] initWithWidth: width] autorelease]; 22 | } 23 | 24 | - (id) initWithWidth: (NSUInteger)width 25 | { 26 | if ((self = [super init])) { 27 | _runs = [NSMutableArray new]; 28 | self.width = width; 29 | } 30 | return self; 31 | } 32 | 33 | - (NSUInteger) length 34 | { 35 | NSUInteger length = 0; 36 | for (YLRun *run in _runs) { 37 | if (length >= _width && run.type == YLRunTypeSpace) continue; 38 | 39 | if (run.type == YLRunTypeTab) { 40 | length += (TAB_SIZE - (length % TAB_SIZE)); 41 | if (length >= _width) 42 | length = _width; 43 | continue; 44 | } 45 | length += [run length]; 46 | } 47 | return length; 48 | } 49 | 50 | - (BOOL) hasRoomForRun: (YLRun *)run 51 | { 52 | if (run.type == YLRunTypeSpace) return YES; 53 | if (run.type == YLRunTypeTab) return YES; 54 | if (run.type == YLRunTypeNewLine) return NO; 55 | 56 | return run.length + self.length <= self.width; 57 | } 58 | 59 | - (void) addRun: (YLRun *)run 60 | { 61 | [_runs addObject: run]; 62 | } 63 | 64 | - (YLRun *) lastStringRun 65 | { 66 | for (YLRun *run in [_runs reverseObjectEnumerator]) 67 | if (run.type == YLRunTypeString) return run; 68 | return nil; 69 | } 70 | 71 | - (NSArray *) popRunsToWrapLine 72 | { 73 | NSMutableArray *originRuns = [[NSMutableArray alloc] initWithArray: _runs]; 74 | NSMutableArray *poppedRuns = [NSMutableArray array]; 75 | while ([_runs count] > 0) { 76 | YLRun *run = [_runs popLastObject]; 77 | [poppedRuns addObjectToFront: run]; 78 | 79 | if ([_runs count] > 0 && ![[_runs lastObject] shouldBeAvoidAtEndOfLine] && ![run shouldBeAvoidAtBeginOfLine]) { 80 | [originRuns release]; 81 | return poppedRuns; 82 | } 83 | } 84 | 85 | _runs = originRuns; 86 | return nil; 87 | } 88 | 89 | - (NSString *) description 90 | { 91 | NSMutableString *result = [NSMutableString string]; 92 | 93 | NSUInteger length = 0; 94 | for (YLRun *run in _runs) { 95 | if (length >= _width && run.type == YLRunTypeSpace) continue; 96 | 97 | if (run.type == YLRunTypeTab) { 98 | int numberOfSpaces = (TAB_SIZE - (length % TAB_SIZE)); 99 | while (numberOfSpaces > 0) { 100 | if (length >= _width) break; 101 | [result appendString: @" "]; 102 | numberOfSpaces--; 103 | length++; 104 | } 105 | continue; 106 | } 107 | 108 | [result appendString: run.string]; 109 | length += [run length]; 110 | } 111 | return result; 112 | } 113 | 114 | - (void) dealloc 115 | { 116 | [_runs release], _runs = nil; 117 | [super dealloc]; 118 | } 119 | @end 120 | 121 | 122 | -------------------------------------------------------------------------------- /Code/YLMarkedTextView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLMarkedTextView.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 9/29/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface YLMarkedTextView : NSView { 13 | NSAttributedString *_string; 14 | NSRange _markedRange; 15 | NSRange _selectedRange; 16 | NSFont *_defaultFont; 17 | CGFloat _lineHeight; 18 | NSPoint _destination; 19 | } 20 | 21 | @property (copy) NSAttributedString *string; 22 | @property NSRange markedRange; 23 | @property NSRange selectedRange; 24 | @property (retain) NSFont *defaultFont; 25 | @property NSPoint destination; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Code/YLMarkedTextView.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLMarkedTextView.m 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 9/29/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLMarkedTextView.h" 10 | 11 | 12 | @implementation YLMarkedTextView 13 | 14 | - (id) initWithFrame: (NSRect)frame 15 | { 16 | self = [super initWithFrame: frame]; 17 | if (self) { 18 | [self setDefaultFont: [NSFont fontWithName: @"Lucida Grande" size: 20]]; 19 | } 20 | return self; 21 | } 22 | 23 | - (void) drawRect: (NSRect)rect 24 | { 25 | CGContextRef context = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort]; 26 | CGContextSaveGState(context); 27 | 28 | CGFloat half = ([self frame].size.height / 2.0); 29 | BOOL fromTop = _destination.y > half; 30 | 31 | CGContextTranslateCTM(context, 1.0, 1.0); 32 | if (!fromTop) 33 | CGContextTranslateCTM(context, 0.0, 5.0); 34 | 35 | CGPoint dest = NSPointToCGPoint(_destination); 36 | dest.x -= 1.0; 37 | dest.y -= 1.0; 38 | if (!fromTop) 39 | dest.y -= 5.0; 40 | 41 | CGContextSaveGState(context); 42 | CGFloat ovalSize = 6.0; 43 | CGContextTranslateCTM(context, 1.0, 1.0); 44 | 45 | CGFloat fw = ([self bounds].size.width - 3); 46 | CGFloat fh = ([self bounds].size.height - 3 - 5); 47 | 48 | CGContextBeginPath(context); 49 | CGContextMoveToPoint(context, 0, fh - ovalSize); 50 | CGContextAddArcToPoint(context, 0, fh, ovalSize, fh, ovalSize); 51 | if (fromTop) { 52 | CGFloat left, right; 53 | left = dest.x - 2.5; 54 | right = left + 5.0; 55 | if (left < ovalSize) { 56 | left = ovalSize; 57 | right = left + 5.0; 58 | } else if (right > fw - ovalSize) { 59 | right = fw - ovalSize; 60 | left = right - 5.0; 61 | } 62 | CGContextAddLineToPoint(context, left, fh); 63 | CGContextAddLineToPoint(context, dest.x, dest.y); 64 | CGContextAddLineToPoint(context, right, fh); 65 | } 66 | // CGContextMoveToPoint(context, fw - ovalSize, fh); 67 | CGContextAddArcToPoint(context, fw, fh, fw, fh - ovalSize, ovalSize); 68 | 69 | // CGContextMoveToPoint(context, fw, ovalSize); 70 | CGContextAddArcToPoint(context, fw, 0, fw - ovalSize, 0, ovalSize); 71 | if (!fromTop) { 72 | CGFloat left, right; 73 | left = dest.x - 2.5; 74 | right = left + 5.0; 75 | if (left < ovalSize) { 76 | left = ovalSize; 77 | right = left + 5.0; 78 | } else if (right > fw - ovalSize) { 79 | right = fw - ovalSize; 80 | left = right - 5.0; 81 | } 82 | CGContextAddLineToPoint(context, right, 0); 83 | CGContextAddLineToPoint(context, dest.x, dest.y); 84 | CGContextAddLineToPoint(context, left, 0); 85 | } 86 | // CGContextMoveToPoint(context, ovalSize, 0); 87 | CGContextAddArcToPoint(context, 0, 0, 0, ovalSize, ovalSize); 88 | CGContextClosePath(context); 89 | 90 | CGContextSetRGBFillColor(context, 0.15, 0.15, 0.15, 1.0); 91 | CGContextSetLineWidth(context, 2.0); 92 | CGContextSetRGBStrokeColor(context, 1.0, 1.0, 1.0, 1.0); 93 | 94 | CGContextDrawPath(context, kCGPathFillStroke); 95 | 96 | CGContextRestoreGState(context); 97 | 98 | CGContextTranslateCTM(context, 4.0, 3.0); 99 | [_string drawAtPoint: NSZeroPoint]; 100 | 101 | CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef) _string); 102 | CGFloat offset = CTLineGetOffsetForStringIndex(line, _selectedRange.location, NULL); 103 | [[NSColor whiteColor] set]; 104 | [NSBezierPath strokeLineFromPoint: NSMakePoint(offset, 0) toPoint: NSMakePoint(offset, _lineHeight)]; 105 | CGContextRestoreGState(context); 106 | 107 | CFRelease(line); 108 | } 109 | 110 | 111 | 112 | - (NSAttributedString *) string 113 | { 114 | return [[_string retain] autorelease]; 115 | } 116 | 117 | - (void) setString: (NSAttributedString *)value 118 | { 119 | NSMutableAttributedString *as = [[NSMutableAttributedString alloc] initWithAttributedString: value]; 120 | [as addAttribute: NSFontAttributeName 121 | value: _defaultFont 122 | range: NSMakeRange(0, [value length])]; 123 | [as addAttribute: NSForegroundColorAttributeName 124 | value: [NSColor whiteColor] 125 | range: NSMakeRange(0, [value length])]; 126 | [_string release]; 127 | _string = as; 128 | [self setNeedsDisplay: YES]; 129 | 130 | CTLineRef line = CTLineCreateWithAttributedString((CFAttributedStringRef) _string); 131 | double w = CTLineGetTypographicBounds(line, NULL, NULL, NULL) ; 132 | NSSize size = [self frame].size; 133 | size.width = w + 12; 134 | size.height = _lineHeight + 8 + 5; 135 | [self setFrameSize: size]; 136 | CFRelease(line); 137 | } 138 | 139 | - (NSRange) markedRange 140 | { 141 | return _markedRange; 142 | } 143 | 144 | - (void) setMarkedRange: (NSRange)value 145 | { 146 | _markedRange = value; 147 | [self setNeedsDisplay: YES]; 148 | } 149 | 150 | - (NSRange) selectedRange 151 | { 152 | return _selectedRange; 153 | } 154 | 155 | - (void) setSelectedRange: (NSRange)value 156 | { 157 | _selectedRange = value; 158 | [self setNeedsDisplay: YES]; 159 | } 160 | 161 | - (NSFont *) defaultFont 162 | { 163 | return [[_defaultFont retain] autorelease]; 164 | } 165 | 166 | - (void) setDefaultFont: (NSFont *)value 167 | { 168 | if (_defaultFont != value) { 169 | [_defaultFont release]; 170 | _defaultFont = [value copy]; 171 | _lineHeight = [[[NSLayoutManager new] autorelease] defaultLineHeightForFont: _defaultFont]; 172 | } 173 | [self setNeedsDisplay: YES]; 174 | } 175 | 176 | - (NSPoint) destination 177 | { 178 | return _destination; 179 | } 180 | 181 | - (void) setDestination: (NSPoint)value 182 | { 183 | _destination = value; 184 | } 185 | 186 | 187 | - (BOOL) isOpaque 188 | { 189 | return NO; 190 | } 191 | 192 | @end 193 | -------------------------------------------------------------------------------- /Code/YLPluginLoader.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLPluginLoader.h 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 8/17/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLBundle.h" 11 | 12 | @interface YLPluginLoader : NSObject { 13 | NSMutableArray *bundleInstanceList; 14 | } 15 | 16 | - (void) startSearch: (id)idObject; 17 | - (Class) loadBundleAtPath: (NSString *)path; 18 | - (void) feedData: (NSData *)data; 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /Code/YLPluginLoader.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLPluginLoader.m 3 | // Nally 4 | // 5 | // Created by Jjgod Jiang on 8/17/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import "YLPluginLoader.h" 10 | 11 | @implementation YLPluginLoader 12 | 13 | NSString * const kPrefixBundleIDStr = @"org.yllan.Nally.Plugin"; 14 | 15 | - (id) init 16 | { 17 | self = [super init]; 18 | if (self) 19 | { 20 | bundleInstanceList = [[NSMutableArray alloc] init]; 21 | [NSThread detachNewThreadSelector: @selector(startSearch:) 22 | toTarget: self 23 | withObject: nil]; 24 | } 25 | 26 | return self; 27 | } 28 | 29 | - (void) startSearch: (id)idObject 30 | { 31 | NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 32 | NSString *currPath; 33 | NSEnumerator *pathEnum; 34 | 35 | // our built bundles are found inside the app's "PlugIns" folder - 36 | NSMutableArray *bundleSearchPaths = [NSMutableArray array]; 37 | [bundleSearchPaths addObject: [[NSBundle mainBundle] builtInPlugInsPath]]; 38 | 39 | // Search other locations for bundles 40 | // (i.e. $(HOME)/Library/Application Support/BundleLoader) 41 | NSArray *librarySearchPaths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, 42 | NSUserDomainMask, YES); 43 | pathEnum = [librarySearchPaths objectEnumerator]; 44 | while (currPath = [pathEnum nextObject]) 45 | [bundleSearchPaths addObject: [NSString stringWithFormat: @"%@/%@/PlugIns", 46 | currPath, 47 | [[NSProcessInfo processInfo] processName]]]; 48 | 49 | pathEnum = [bundleSearchPaths objectEnumerator]; 50 | while (currPath = [pathEnum nextObject]) 51 | { 52 | NSDirectoryEnumerator *bundleEnum = [[NSFileManager defaultManager] enumeratorAtPath: currPath]; 53 | NSString *currBundlePath; 54 | 55 | if (bundleEnum) 56 | while (currBundlePath = [bundleEnum nextObject]) 57 | if ([[currBundlePath pathExtension] isEqualToString: @"bundle"]) 58 | { 59 | Class bundleInstance = [self loadBundleAtPath: 60 | [currPath stringByAppendingPathComponent: currBundlePath]]; 61 | 62 | if (bundleInstance) 63 | [bundleInstanceList addObject: bundleInstance]; 64 | } 65 | } 66 | 67 | [pool release]; 68 | } 69 | 70 | - (Class) loadBundleAtPath: (NSString *)path 71 | { 72 | NSBundle *currBundle = [NSBundle bundleWithPath: path]; 73 | NSRange searchRange = NSMakeRange(0, [kPrefixBundleIDStr length]); 74 | 75 | if (! currBundle) 76 | return nil; 77 | 78 | // Check the bundle ID to see if it starts with our know prefix string 79 | // (kPrefixBundleIDStr). We want to only load the bundles we care about. 80 | if ([[currBundle bundleIdentifier] compare: kPrefixBundleIDStr 81 | options: NSLiteralSearch 82 | range: searchRange] == NSOrderedSame) 83 | { 84 | // load and startup our bundle 85 | // 86 | // note: principleClass method actually loads the bundle for us, 87 | // or we can call [currBundle load] directly. 88 | Class currPrincipalClass = [currBundle principalClass]; 89 | if (currPrincipalClass) 90 | { 91 | id currInstance = [[currPrincipalClass alloc] init]; 92 | if (currInstance) 93 | return [currInstance autorelease]; 94 | } 95 | } 96 | 97 | return nil; 98 | } 99 | 100 | - (void) feedData: (NSData *)data 101 | { 102 | } 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Code/YLRun.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLRun.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/4/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CommonType.h" 11 | 12 | typedef enum { 13 | YLRunTypeString = 0, 14 | YLRunTypeSpace, 15 | YLRunTypeTab, 16 | YLRunTypeNewLine 17 | } YLRunType; 18 | 19 | @interface YLRun : NSObject { 20 | NSString *_string; 21 | YLRunType _type; 22 | YLEncoding _encoding; 23 | } 24 | 25 | + (id) runWithString: (NSString *)string type: (YLRunType)type encoding: (YLEncoding)encoding; 26 | - (id) initWithString: (NSString *)string type: (YLRunType)type encoding: (YLEncoding)encoding; 27 | 28 | @property (nonatomic, assign) YLEncoding encoding; 29 | @property (nonatomic, assign) YLRunType type; 30 | @property (nonatomic, copy) NSString *string; 31 | @property (readonly) NSUInteger length; 32 | 33 | - (void) appendString: (NSString *)string; 34 | - (NSArray *) forceSplitToMaxLength: (int)maxLength; 35 | 36 | - (BOOL) shouldBeAvoidAtBeginOfLine; 37 | - (BOOL) shouldBeAvoidAtEndOfLine; 38 | @end 39 | 40 | 41 | -------------------------------------------------------------------------------- /Code/YLRun.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLRun.m 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/4/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLRun.h" 10 | #import "encoding.h" 11 | 12 | @implementation YLRun 13 | 14 | @synthesize encoding = _encoding; 15 | @synthesize type = _type; 16 | @synthesize string = _string; 17 | 18 | + (id) runWithString: (NSString *)string type: (YLRunType)type encoding: (YLEncoding)encoding 19 | { 20 | return [[[YLRun alloc] initWithString: string type: type encoding: encoding] autorelease]; 21 | } 22 | 23 | - (id) initWithString: (NSString *)string type: (YLRunType)type encoding: (YLEncoding)encoding 24 | { 25 | if ((self = [super init])) { 26 | self.string = string; 27 | self.type = type; 28 | self.encoding = encoding; 29 | } 30 | return self; 31 | } 32 | 33 | - (NSUInteger) length 34 | { 35 | if (_type == YLRunTypeSpace) return 1; 36 | if (_type == YLRunTypeTab) return 1; // not correct! 37 | 38 | NSUInteger length = 0; 39 | int i; 40 | for (i = 0; i < [_string length]; i++) { 41 | unichar c = [_string characterAtIndex: i]; 42 | if (c > 0x0020 && c < 0x0080) length++; 43 | if (c >= 0x0080 && (_encoding == YLBig5Encoding ? U2B[c] : U2G[c]) != 0x0000) length += 2; 44 | } 45 | return length; 46 | } 47 | 48 | - (void) appendString: (NSString *)string 49 | { 50 | NSAssert(self.type == YLRunTypeString, @"You can only append run to a string."); 51 | self.string = [_string stringByAppendingString: string]; 52 | } 53 | 54 | - (NSArray *) forceSplitToMaxLength: (int)maxLength 55 | { 56 | NSAssert(self.type == YLRunTypeString, @"You can only split a string."); 57 | NSUInteger length = 0; 58 | NSMutableString *firstString = [NSMutableString string]; 59 | NSMutableString *secondString = [NSMutableString string]; 60 | 61 | int i; 62 | for (i = 0; i < [_string length]; i++) { 63 | unichar c = [_string characterAtIndex: i]; 64 | NSString *s = [NSString stringWithCharacters: &c length: 1]; 65 | if (c > 0x0020 && c < 0x0080) length++; 66 | if (c >= 0x0080 && (_encoding == YLBig5Encoding ? U2B[c] : U2G[c]) != 0x0000) length += 2; 67 | 68 | [((length <= maxLength) ? firstString : secondString) appendString: s]; 69 | } 70 | 71 | if ([firstString length] == 0 || [secondString length] == 0) 72 | return [NSArray arrayWithObject: self]; 73 | 74 | return [NSArray arrayWithObjects: [YLRun runWithString: firstString type: YLRunTypeString encoding: _encoding], [YLRun runWithString: secondString type: YLRunTypeString encoding: _encoding], nil]; 75 | } 76 | 77 | - (BOOL) shouldBeAvoidAtBeginOfLine 78 | { 79 | if (_type == YLRunTypeSpace || _type == YLRunTypeTab) return YES; 80 | if (_type != YLRunTypeString) return NO; 81 | 82 | NSArray *forbiddenTokens = [NSArray arrayWithObjects: @",", @"。", @"、", @":", @";", @"?", @"!", @"」", @"』", @"》", @"〉", @"】", @"〕", @")", @",", @".", @":", @";", @"!", @")", @"]", @"}", @"-", @"–", nil]; 83 | for (NSString *forbiddenToken in forbiddenTokens) 84 | if ([_string hasPrefix: forbiddenToken]) 85 | return YES; 86 | return NO; 87 | } 88 | 89 | - (BOOL) shouldBeAvoidAtEndOfLine 90 | { 91 | NSArray *forbiddenTokens = [NSArray arrayWithObjects: @"「", @"『", @"《", @"〈", @"【", @"〔", @"(", @"(", @"[", @"{", @"'", @"\"", nil]; 92 | for (NSString *forbiddenToken in forbiddenTokens) 93 | if ([_string hasSuffix: forbiddenToken]) 94 | return YES; 95 | return NO; 96 | } 97 | 98 | 99 | - (void) dealloc 100 | { 101 | [_string release], _string = nil; 102 | [super dealloc]; 103 | } 104 | 105 | @end 106 | 107 | -------------------------------------------------------------------------------- /Code/YLSSH.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLSSH.h 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 12/7/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLConnection.h" 11 | 12 | @interface YLSSH : YLConnection { 13 | pid_t _pid; 14 | int _fileDescriptor; 15 | BOOL _loginAsBBS; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Code/YLSimpleDataSource.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLSimpleDataSource.h 3 | // MacBlueTelnet 4 | // 5 | // Created by Yung-Luen Lan on 9/1/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLDataSourceProtocol.h" 11 | 12 | @interface YLSimpleDataSource : NSObject { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Code/YLSimpleDataSource.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLSimpleDataSource.m 3 | // MacBlueTelnet 4 | // 5 | // Created by Yung-Luen Lan on 9/1/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLSimpleDataSource.h" 10 | #import "YLLGlobalConfig.h" 11 | 12 | static char *templateString = "我達達的馬蹄是美麗的錯誤。我不是歸人,是個澳客。"; 13 | 14 | @implementation YLSimpleDataSource 15 | - (int) row { 16 | return 24; 17 | } 18 | - (int) column { 19 | return 80; 20 | } 21 | 22 | - (NSColor *) fgColorAtRow: (int) r column: (int) c { 23 | return [[YLLGlobalConfig sharedInstance] colorAtIndex: [self fgColorIndexAtRow: r column: c] hilite: NO];} 24 | 25 | - (NSColor *) bgColorAtRow: (int) r column: (int) c { 26 | return [[YLLGlobalConfig sharedInstance] colorAtIndex: [self bgColorIndexAtRow: r column: c] hilite: NO]; 27 | } 28 | 29 | - (int) fgColorIndexAtRow: (int) r column: (int) c { 30 | if (r == 5) { 31 | if (c == 2 || c== 3) 32 | return 3; 33 | } 34 | 35 | if (r == 3) { 36 | if (c == 2 || c== 4 || c == 7 || c == 10) 37 | return 4; 38 | if (c == 3) 39 | return 6; 40 | } 41 | return 7; 42 | } 43 | 44 | - (int) bgColorIndexAtRow: (int) r column: (int) c { 45 | if (r == 6) { 46 | if (c >= 2 && c <= 10) 47 | return 1; 48 | } 49 | return 9; 50 | } 51 | 52 | - (BOOL) isDirtyAtRow: (int) r column:(int) c { 53 | return YES; 54 | } 55 | 56 | - (unichar) charAtRow: (int) r column: (int) c { 57 | NSString *s = [NSString stringWithUTF8String: templateString]; 58 | if (c/2 >= [s length]) return 0; 59 | 60 | if (c & 1) return 0; 61 | return [s characterAtIndex: (c / 2)]; 62 | } 63 | 64 | - (int) isDoubleByteAtRow: (int) r column:(int) c { 65 | NSString *s = [NSString stringWithUTF8String: templateString]; 66 | if (c/2 >= [s length]) return 0; 67 | if (c & 1) return 2; 68 | return 1; 69 | } 70 | 71 | @end 72 | -------------------------------------------------------------------------------- /Code/YLSite.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLSite.h 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 11/20/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CommonType.h" 11 | 12 | @interface YLSite : NSObject { 13 | NSString *_name; 14 | NSString *_address; 15 | NSString *_account; 16 | NSString *_password; 17 | 18 | YLEncoding _encoding; 19 | YLANSIColorKey _ansiColorKey; 20 | BOOL _detectDoubleByte; 21 | } 22 | 23 | + (YLSite *) site; 24 | + (YLSite *) siteWithDictionary: (NSDictionary *)d; 25 | - (NSDictionary *) dictionaryOfSite; 26 | 27 | @property (copy) NSString *name; 28 | @property (copy) NSString *address; 29 | @property (copy) NSString *account; 30 | @property (copy) NSString *password; 31 | @property YLEncoding encoding; 32 | @property YLANSIColorKey ansiColorKey; 33 | @property BOOL detectDoubleByte; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Code/YLSite.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLSite.m 3 | // Nally 4 | // 5 | // Created by Lan Yung-Luen on 11/20/07. 6 | // Copyright 2007 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLSite.h" 10 | 11 | @implementation YLSite 12 | 13 | - (id) init 14 | { 15 | self = [super init]; 16 | if (self) { 17 | [self setName: @"Site Name"]; 18 | [self setAddress: @"(your.site.org)"]; 19 | [self setEncoding: YLBig5Encoding]; 20 | } 21 | return self; 22 | } 23 | 24 | + (YLSite *) site 25 | { 26 | return [[YLSite new] autorelease]; 27 | } 28 | 29 | 30 | + (YLSite *) siteWithDictionary: (NSDictionary *)dict 31 | { 32 | YLSite *s = [[[YLSite alloc] init] autorelease]; 33 | [s setName: [dict valueForKey: @"name"] ?: @""]; 34 | [s setAddress: [dict valueForKey: @"address"] ?: @""]; 35 | [s setAccount: [dict valueForKey: @"account"] ?: @""]; 36 | [s setPassword: [dict valueForKey: @"password"] ?: @""]; 37 | 38 | 39 | [s setEncoding: (YLEncoding)[[dict valueForKey: @"encoding"] unsignedShortValue]]; 40 | [s setAnsiColorKey: (YLANSIColorKey)[[dict valueForKey: @"ansicolorkey"] unsignedShortValue]]; 41 | [s setDetectDoubleByte: [[dict valueForKey: @"detectdoublebyte"] boolValue]]; 42 | return s; 43 | } 44 | 45 | - (NSDictionary *) dictionaryOfSite 46 | { 47 | return [NSDictionary dictionaryWithObjectsAndKeys: [self name] ?: @"", @"name", [self address], @"address", 48 | [NSNumber numberWithUnsignedShort: [self encoding]], @"encoding", 49 | [NSNumber numberWithUnsignedShort: [self ansiColorKey]], @"ansicolorkey", 50 | [NSNumber numberWithBool: [self detectDoubleByte]], @"detectdoublebyte", nil]; 51 | } 52 | @synthesize name = _name; 53 | @synthesize address = _address; 54 | @synthesize encoding = _encoding; 55 | @synthesize ansiColorKey = _ansiColorKey; 56 | @synthesize detectDoubleByte = _detectDoubleByte; 57 | 58 | - (NSString *) description { 59 | return [NSString stringWithFormat: @"%@:%@", [self name], [self address]]; 60 | } 61 | 62 | - (id) copyWithZone: (NSZone *)zone 63 | { 64 | YLSite *s = [[YLSite allocWithZone: zone] init]; 65 | [s setName: [self name]]; 66 | [s setAddress: [self address]]; 67 | [s setEncoding: [self encoding]]; 68 | [s setAnsiColorKey: [self ansiColorKey]]; 69 | [s setDetectDoubleByte: [self detectDoubleByte]]; 70 | [s setAccount:[self account]]; 71 | [s setPassword:[self password]]; 72 | return s; 73 | } 74 | 75 | @end -------------------------------------------------------------------------------- /Code/YLTextSuite.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLTextTransformer.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/4/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "CommonType.h" 11 | 12 | @interface YLTextSuite : NSObject { 13 | 14 | } 15 | 16 | - (NSString *) wrapText: (NSString *)text withLength: (int)length encoding: (YLEncoding)encoding; 17 | - (NSString *) paddingText: (NSString *)text withLeftPadding: (int)leftPadding; 18 | @end 19 | -------------------------------------------------------------------------------- /Code/YLTextSuite.m: -------------------------------------------------------------------------------- 1 | // 2 | // YLTextTransformer.m 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/4/10. 6 | // Copyright 2010 yllan.org. All rights reserved. 7 | // 8 | 9 | #import "YLTextSuite.h" 10 | #import "YLLine.h" 11 | #import "YLRun.h" 12 | #import "YLApplicationKitAddition.h" 13 | 14 | #define SPACE 0x0020 15 | #define TAB 0x0009 16 | #define LF 0x000a 17 | #define CR 0x000d 18 | 19 | 20 | static BOOL isGluingCharacter(unichar c) 21 | { 22 | if (c >= 'A' && c <= 'Z') return YES; 23 | if (c >= 'a' && c <= 'z') return YES; 24 | if (c >= '0' && c <= '9') return YES; 25 | NSString *punctuation = @"'\".,;:*&^#@~`="; 26 | int i; 27 | for (i = 0; i < [punctuation length]; i++) 28 | if (c == [punctuation characterAtIndex: i]) return YES; 29 | return NO; 30 | } 31 | 32 | @implementation YLTextSuite 33 | 34 | - (NSString *) wrapText: (NSString *)text withLength: (int)length encoding: (YLEncoding)encoding 35 | { 36 | YLRun *spaceRun = [YLRun runWithString: @" " type: YLRunTypeSpace encoding: encoding]; 37 | YLRun *tabRun = [YLRun runWithString: @"\t" type: YLRunTypeTab encoding: encoding]; 38 | YLRun *lineRun = [YLRun runWithString: @"\n" type: YLRunTypeNewLine encoding: encoding]; 39 | 40 | YLRun *bufferRun = [[YLRun alloc] initWithString: @"" type: YLRunTypeString encoding: encoding]; 41 | 42 | NSMutableArray *runs = [NSMutableArray new]; 43 | 44 | #define COMMIT_BUFFER_RUN() if ([bufferRun.string length] > 0) {\ 45 | [runs addObject: bufferRun];\ 46 | [bufferRun release];\ 47 | bufferRun = [[YLRun alloc] initWithString: @"" type: YLRunTypeString encoding: encoding];\ 48 | } 49 | 50 | /* Create runs from the text */ 51 | int i; 52 | for (i = 0; i < [text length]; i++) { 53 | unichar c = [text characterAtIndex: i]; 54 | if (c == SPACE) { 55 | COMMIT_BUFFER_RUN(); 56 | [runs addObject: spaceRun]; 57 | continue; 58 | } 59 | if (c == TAB) { 60 | COMMIT_BUFFER_RUN(); 61 | [runs addObject: tabRun]; 62 | continue; 63 | } 64 | if (c == CR || c == LF) { 65 | COMMIT_BUFFER_RUN(); 66 | [runs addObject: lineRun]; 67 | continue; 68 | } 69 | NSString *s = [NSString stringWithCharacters: &c length: 1]; 70 | 71 | if (!isGluingCharacter(c)) { 72 | COMMIT_BUFFER_RUN(); 73 | [runs addObject: [YLRun runWithString: s type: YLRunTypeString encoding: encoding]]; 74 | } else { 75 | [bufferRun appendString: s]; 76 | } 77 | } 78 | COMMIT_BUFFER_RUN(); 79 | [bufferRun release]; 80 | 81 | NSMutableArray *result = [NSMutableArray array]; 82 | YLLine *line = [[YLLine alloc] initWithWidth: length]; 83 | 84 | /* Layout the run */ 85 | while ([runs count] > 0) { 86 | YLRun *run = [runs popFirstObject]; 87 | 88 | if (run.type == YLRunTypeNewLine) { 89 | [result addObject: [line description]]; 90 | [line release]; 91 | line = [[YLLine alloc] initWithWidth: length]; 92 | continue; 93 | } 94 | 95 | if ([line hasRoomForRun: run]) { 96 | [line addRun: run]; 97 | continue; 98 | } 99 | 100 | // if the line is empty, split the run 101 | if ([line.runs count] == 0) { 102 | NSArray *splittedRuns = [run forceSplitToMaxLength: length]; 103 | if ([splittedRuns count] > 1) 104 | [runs addObjectsToFront: splittedRuns]; 105 | else 106 | [line addRun: run]; 107 | continue; 108 | } 109 | 110 | // create a new line 111 | [runs addObjectToFront: run]; 112 | if ([run shouldBeAvoidAtBeginOfLine] || [[line lastStringRun] shouldBeAvoidAtEndOfLine]) { 113 | NSArray *poppedRuns = [line popRunsToWrapLine]; 114 | if ([poppedRuns count] > 0) { 115 | [runs addObjectsToFront: poppedRuns]; 116 | } else if (line.length < line.width) { // can't pop. force split 117 | run = [runs popFirstObject]; 118 | [runs addObjectsToFront: [run forceSplitToMaxLength: line.width - line.length]]; 119 | continue; 120 | } 121 | } 122 | 123 | [result addObject: [line description]]; 124 | [line release]; 125 | line = [[YLLine alloc] initWithWidth: length]; 126 | } 127 | if ([line.runs count] > 0) 128 | [result addObject: [line description]]; 129 | [line release]; 130 | [runs release]; 131 | return [result componentsJoinedByString: @"\n"]; 132 | } 133 | 134 | - (NSString *) paddingText: (NSString *)text withLeftPadding: (int)leftPadding 135 | { 136 | int i; 137 | NSMutableString *paddingString = [NSMutableString new]; 138 | for (i = 0; i < leftPadding; i++) 139 | [paddingString appendString: @" "]; 140 | 141 | NSMutableString *result = [NSMutableString string]; 142 | 143 | for (i = 0; i < [text length]; i++) { 144 | unichar c = [text characterAtIndex: i]; 145 | if (c == LF) { 146 | [result appendString: [NSString stringWithCharacters: &c length: 1]]; 147 | [result appendString: paddingString]; 148 | } else if (i == 0) { 149 | [result appendString: paddingString]; 150 | [result appendString: [NSString stringWithCharacters: &c length: 1]]; 151 | } else { 152 | [result appendString: [NSString stringWithCharacters: &c length: 1]]; 153 | } 154 | } 155 | 156 | [paddingString release]; 157 | return result; 158 | } 159 | @end 160 | -------------------------------------------------------------------------------- /Code/YLView.h: -------------------------------------------------------------------------------- 1 | // 2 | // YLView.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 2006/6/9. 6 | // Copyright 2006 yllan.org. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | #import "CommonType.h" 15 | #ifdef __cplusplus 16 | } 17 | #endif 18 | 19 | @class YLTerminal; 20 | @class YLConnection; 21 | @class YLMarkedTextView; 22 | 23 | @interface YLView : NSTabView { 24 | CGFloat _fontWidth; 25 | CGFloat _fontHeight; 26 | 27 | NSImage *_backedImage; 28 | 29 | NSTimer *_timer; 30 | int _x; 31 | int _y; 32 | 33 | id _markedText; 34 | NSRange _selectedRange; 35 | NSRange _markedRange; 36 | 37 | IBOutlet YLMarkedTextView *_textField; 38 | 39 | int _selectionLocation; 40 | int _selectionLength; 41 | 42 | BOOL _shouldOpenUrlInBackground; 43 | BOOL _shouldUseImagePreviewer; 44 | } 45 | 46 | - (void) configure; 47 | 48 | - (IBAction) pasteWrap: (id)sender; 49 | - (IBAction) paste: (id)sender; 50 | - (IBAction) pasteColor: (id)sender; 51 | 52 | - (void) displayCellAtRow: (int)r column: (int)c; 53 | - (void) updateBackedImage; 54 | - (void) drawSpecialSymbol: (unichar)ch forRow: (int)r column: (int)c leftAttribute: (attribute)attr1 rightAttribute: (attribute)attr2; 55 | - (void) drawSelection; 56 | - (void) drawBlink; 57 | - (void) refreshHiddenRegion; 58 | 59 | - (void) clearSelection; 60 | 61 | - (YLTerminal *) frontMostTerminal; 62 | - (YLConnection *) frontMostConnection; 63 | - (BOOL) connected; 64 | 65 | - (void) extendBottomFrom: (int)start to: (int)end; 66 | - (void) extendTopFrom: (int)start to: (int)end; 67 | 68 | - (void) drawStringForRow: (int)r context: (CGContextRef)myCGContext; 69 | - (void) updateBackgroundForRow: (int)r from: (int)start to: (int)end; 70 | 71 | @property int x; 72 | @property int y; 73 | 74 | - (NSString *) selectedPlainString; 75 | - (BOOL) hasBlinkCell; 76 | 77 | - (void) insertText: (id)aString withDelay: (int)microsecond; 78 | 79 | - (void) loadUrlOfString: (NSString *)url; 80 | @end 81 | -------------------------------------------------------------------------------- /Code/encoding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * encoding.h 3 | * Nally 4 | * 5 | * Created by Yung-Luen Lan on 9/11/07. 6 | * Copyright 2007 yllan.org. All rights reserved. 7 | * 8 | */ 9 | 10 | extern unsigned short G2U[32768]; 11 | extern unsigned short B2U[32768]; 12 | extern unsigned short U2B[65536]; 13 | extern unsigned short U2G[65536]; 14 | 15 | extern void init_table(); 16 | -------------------------------------------------------------------------------- /Code/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 2006/6/9. 6 | // Copyright yllan.org 2006. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "encoding.h" 12 | 13 | int main(int argc, char *argv[]) 14 | { 15 | init_table(); 16 | return NSApplicationMain(argc, (const char **) argv); 17 | } 18 | -------------------------------------------------------------------------------- /Dependencies/DBPrefsWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // DBPrefsWindowController.h 3 | // 4 | // Created by Dave Batton 5 | // http://www.Mere-Mortal-Software.com/blog/ 6 | // 7 | // Documentation for this class is available here: 8 | // http://www.mere-mortal-software.com/blog/details.php?d=2007-03-11 9 | // 10 | // Copyright 2007. Some rights reserved. 11 | // This work is licensed under a Creative Commons license: 12 | // http://creativecommons.org/licenses/by/3.0/ 13 | // 14 | // 11 March 2007 : Initial 1.0 release 15 | // 15 March 2007 : Version 1.1 16 | // Resizing is now handled along with the cross-fade by 17 | // the NSViewAnimation routine. 18 | // Cut the fade time in half to speed up the window resize. 19 | // -setupToolbar is now called each time the window opens so 20 | // you can configure it differently each time if you want. 21 | // Holding down the shift key will now slow down the animation. 22 | // This can be disabled by using the new -setShiftSlowsAnimation: 23 | // method. 24 | // 23 March 2007 : Version 1.1.1 25 | // The initial first responder now gets set when the view is 26 | // swapped so that the user can tab to the objects displayed 27 | // in the window. 28 | // Also added a work-around to Cocoa's insistance on drawing 29 | // a focus ring around the first toolbar icon when going from 30 | // a view with a focusable item to a view without a focusable item. 31 | // 32 | // 31 May 2007 : Version 1.1.2 33 | // The window's title bar and toolbar heights are now calculated at 34 | // runtime, rather than being hard-coded. 35 | // Fixed a redraw problem and a window placement problem associated 36 | // with large preference windows. 37 | // Added some code to supress compiler warnings from unused parameters. 38 | // Fixed a couple of objects that weren't being properly released. 39 | // 40 | 41 | 42 | #import 43 | 44 | 45 | @interface DBPrefsWindowController : NSWindowController { 46 | NSMutableArray *toolbarIdentifiers; 47 | NSMutableDictionary *toolbarViews; 48 | NSMutableDictionary *toolbarItems; 49 | 50 | BOOL _crossFade; 51 | BOOL _shiftSlowsAnimation; 52 | 53 | IBOutlet NSPopUpButton *_telnetPopUpButton; 54 | IBOutlet NSPopUpButton *_sshPopUpButton; 55 | 56 | IBOutlet NSView *_generalPrefView; 57 | IBOutlet NSView *_connectionPrefView; 58 | IBOutlet NSView *_fontsPrefView; 59 | IBOutlet NSView *_colorsPrefView; 60 | 61 | NSView *contentSubview; 62 | NSViewAnimation *viewAnimation; 63 | } 64 | 65 | - (IBAction) setChineseFont: (id) sender; 66 | - (IBAction) setEnglishFont: (id) sender; 67 | 68 | - (IBAction) setDefaultTelnetClient: (id) sender; 69 | - (IBAction) setDefaultSSHClient: (id) sender; 70 | 71 | + (DBPrefsWindowController *)sharedPrefsWindowController; 72 | + (NSString *)nibName; 73 | 74 | - (void)setupToolbar; 75 | - (void)addView:(NSView *)view label:(NSString *)label; 76 | - (void)addView:(NSView *)view label:(NSString *)label image:(NSImage *)image; 77 | 78 | - (BOOL)crossFade; 79 | - (void)setCrossFade:(BOOL)fade; 80 | - (BOOL)shiftSlowsAnimation; 81 | - (void)setShiftSlowsAnimation:(BOOL)slows; 82 | 83 | - (void)displayViewForIdentifier:(NSString *)identifier animate:(BOOL)animate; 84 | - (void)crossFadeView:(NSView *)oldView withView:(NSView *)newView; 85 | - (NSRect)frameForView:(NSView *)view; 86 | 87 | 88 | @end 89 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/NSBezierPath_AMShading.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSBezierPath_AMShading.h 3 | // ------------------------ 4 | // 5 | // Created by Andreas on 2005-06-01. 6 | // Copyright 2005 Andreas Mayer. All rights reserved. 7 | // 8 | // based on http://www.cocoadev.com/index.pl?GradientFill 9 | 10 | 11 | #import 12 | 13 | @interface NSBezierPath (AMShading) 14 | 15 | - (void)customHorizontalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor; 16 | - (void)customVerticalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor; 17 | 18 | - (void)linearGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor; 19 | - (void)linearVerticalGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor; 20 | 21 | - (void)bilinearGradientFillWithOuterColor:(NSColor *)outerColor innerColor:(NSColor *)innerColor; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/NSBezierPath_AMShading.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSBezierPath_AMShading.m 3 | // ------------------------ 4 | // 5 | // Created by Andreas on 2005-06-01. 6 | // Copyright 2005 Andreas Mayer. All rights reserved. 7 | // 8 | 9 | #import "NSBezierPath_AMShading.h" 10 | 11 | 12 | @implementation NSBezierPath (AMShading) 13 | 14 | static void linearShadedColor(void *info, const CGFloat *in, CGFloat *out) 15 | { 16 | CGFloat *colors = (CGFloat *)info; 17 | *out++ = colors[0] + *in * colors[8]; 18 | *out++ = colors[1] + *in * colors[9]; 19 | *out++ = colors[2] + *in * colors[10]; 20 | *out++ = colors[3] + *in * colors[11]; 21 | } 22 | 23 | static void bilinearShadedColor(void *info, const CGFloat *in, CGFloat *out) 24 | { 25 | CGFloat *colors = (CGFloat *)info; 26 | CGFloat factor = (*in)*2.0; 27 | if (*in > 0.5) { 28 | factor = 2-factor; 29 | } 30 | *out++ = colors[0] + factor * colors[8]; 31 | *out++ = colors[1] + factor * colors[9]; 32 | *out++ = colors[2] + factor * colors[10]; 33 | *out++ = colors[3] + factor * colors[11]; 34 | } 35 | 36 | - (void)linearGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor 37 | { 38 | static const CGFunctionCallbacks callbacks = {0, &linearShadedColor, NULL}; 39 | 40 | [self customHorizontalFillWithCallbacks:callbacks firstColor:startColor secondColor:endColor]; 41 | } 42 | 43 | - (void)linearVerticalGradientFillWithStartColor:(NSColor *)startColor endColor:(NSColor *)endColor 44 | { 45 | static const CGFunctionCallbacks callbacks = {0, &linearShadedColor, NULL}; 46 | 47 | [self customVerticalFillWithCallbacks:callbacks firstColor:startColor secondColor:endColor]; 48 | } 49 | 50 | - (void)bilinearGradientFillWithOuterColor:(NSColor *)outerColor innerColor:(NSColor *)innerColor 51 | { 52 | static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL}; 53 | 54 | [self customHorizontalFillWithCallbacks:callbacks firstColor:innerColor secondColor:outerColor]; 55 | } 56 | 57 | - (void)customFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor startPoint:(CGPoint)startPoint endPoint:(CGPoint)endPoint 58 | { 59 | CGColorSpaceRef colorspace; 60 | CGShadingRef shading; 61 | CGFunctionRef function; 62 | CGFloat colors[12]; // pointer to color values 63 | 64 | // get my context 65 | CGContextRef currentContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; 66 | 67 | NSColor *deviceDependentFirstColor = [firstColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; 68 | NSColor *deviceDependentSecondColor = [secondColor colorUsingColorSpaceName:NSDeviceRGBColorSpace]; 69 | 70 | // set up colors for gradient 71 | colors[0] = [deviceDependentFirstColor redComponent]; 72 | colors[1] = [deviceDependentFirstColor greenComponent]; 73 | colors[2] = [deviceDependentFirstColor blueComponent]; 74 | colors[3] = [deviceDependentFirstColor alphaComponent]; 75 | 76 | colors[4] = [deviceDependentSecondColor redComponent]; 77 | colors[5] = [deviceDependentSecondColor greenComponent]; 78 | colors[6] = [deviceDependentSecondColor blueComponent]; 79 | colors[7] = [deviceDependentSecondColor alphaComponent]; 80 | 81 | // difference between start and end color for each color components 82 | colors[8] = (colors[4]-colors[0]); 83 | colors[9] = (colors[5]-colors[1]); 84 | colors[10] = (colors[6]-colors[2]); 85 | colors[11] = (colors[7]-colors[3]); 86 | 87 | // draw gradient 88 | colorspace = CGColorSpaceCreateDeviceRGB(); 89 | size_t components = 1 + CGColorSpaceGetNumberOfComponents(colorspace); 90 | static const CGFloat domain[2] = {0.0, 1.0}; 91 | static const CGFloat range[10] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1}; 92 | //static const CGFunctionCallbacks callbacks = {0, &bilinearShadedColor, NULL}; 93 | 94 | // Create a CGFunctionRef that describes a function taking 1 input and kChannelsPerColor outputs. 95 | function = CGFunctionCreate(colors, 1, domain, components, range, &functionCallbacks); 96 | 97 | shading = CGShadingCreateAxial(colorspace, startPoint, endPoint, function, NO, NO); 98 | 99 | CGContextSaveGState(currentContext); 100 | [self addClip]; 101 | CGContextDrawShading(currentContext, shading); 102 | CGContextRestoreGState(currentContext); 103 | 104 | CGShadingRelease(shading); 105 | CGFunctionRelease(function); 106 | CGColorSpaceRelease(colorspace); 107 | } 108 | 109 | - (void)customHorizontalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor 110 | { 111 | [self customFillWithCallbacks:functionCallbacks 112 | firstColor:firstColor 113 | secondColor:secondColor 114 | startPoint:CGPointMake(0, NSMinY([self bounds])) 115 | endPoint:CGPointMake(0, NSMaxY([self bounds]))]; 116 | } 117 | 118 | - (void)customVerticalFillWithCallbacks:(CGFunctionCallbacks)functionCallbacks firstColor:(NSColor *)firstColor secondColor:(NSColor *)secondColor 119 | { 120 | [self customFillWithCallbacks:functionCallbacks 121 | firstColor:firstColor 122 | secondColor:secondColor 123 | startPoint:CGPointMake(NSMinX([self bounds]), 0) 124 | endPoint:CGPointMake(NSMaxX([self bounds]), 0)]; 125 | } 126 | 127 | @end 128 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/NSString_AITruncation.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString_AITruncation.h 3 | // PSMTabBarControl 4 | // 5 | // Created by Evan Schoenberg on 7/14/07. 6 | // 7 | 8 | #import 9 | 10 | @interface NSString (AITruncation) 11 | - (NSString *)stringWithEllipsisByTruncatingToLength:(NSUInteger)length; 12 | @end 13 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/NSString_AITruncation.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString_AITruncation.m 3 | // PSMTabBarControl 4 | // 5 | // Created by Evan Schoenberg on 7/14/07. 6 | // From Adium, which is licensed under the GPL. Used in PSMTabBarControl with permission. 7 | // The contents of this remain licensed under the GPL. 8 | // 9 | 10 | #import "NSString_AITruncation.h" 11 | 12 | @implementation NSString (AITruncation) 13 | 14 | + (id)ellipsis 15 | { 16 | return [NSString stringWithUTF8String:"\xE2\x80\xA6"]; 17 | } 18 | 19 | - (NSString *)stringWithEllipsisByTruncatingToLength:(NSUInteger)length 20 | { 21 | NSString *returnString; 22 | 23 | if (length < [self length]) { 24 | //Truncate and append the ellipsis 25 | returnString = [[self substringToIndex:length-1] stringByAppendingString:[NSString ellipsis]]; 26 | } else { 27 | //We don't need to truncate, so don't append an ellipsis 28 | returnString = [self copy]; 29 | } 30 | 31 | return returnString; 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMMetalTabStyle.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMMetalTabStyle.h 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 2/17/06. 6 | // Copyright 2006 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PSMTabStyle.h" 11 | 12 | @interface PSMMetalTabStyle : NSObject { 13 | NSImage *metalCloseButton; 14 | NSImage *metalCloseButtonDown; 15 | NSImage *metalCloseButtonOver; 16 | NSImage *metalCloseDirtyButton; 17 | NSImage *metalCloseDirtyButtonDown; 18 | NSImage *metalCloseDirtyButtonOver; 19 | NSImage *_addTabButtonImage; 20 | NSImage *_addTabButtonPressedImage; 21 | NSImage *_addTabButtonRolloverImage; 22 | 23 | NSDictionary *_objectCountStringAttributes; 24 | 25 | PSMTabBarOrientation orientation; 26 | PSMTabBarControl *tabBar; 27 | } 28 | 29 | - (void)drawInteriorWithTabCell:(PSMTabBarCell *)cell inView:(NSView*)controlView; 30 | 31 | - (void)encodeWithCoder:(NSCoder *)aCoder; 32 | - (id)initWithCoder:(NSCoder *)aDecoder; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMOverflowPopUpButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMOverflowPopUpButton.h 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 11/4/05. 6 | // Copyright 2005 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface PSMOverflowPopUpButton : NSPopUpButton { 13 | NSImage *_PSMTabBarOverflowPopUpImage; 14 | NSImage *_PSMTabBarOverflowDownPopUpImage; 15 | BOOL _down; 16 | BOOL _animatingAlternateImage; 17 | NSTimer *_animationTimer; 18 | CGFloat _animationValue; 19 | } 20 | 21 | //alternate image display 22 | - (BOOL)animatingAlternateImage; 23 | - (void)setAnimatingAlternateImage:(BOOL)flag; 24 | 25 | // archiving 26 | - (void)encodeWithCoder:(NSCoder *)aCoder; 27 | - (id)initWithCoder:(NSCoder *)aDecoder; 28 | @end 29 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMOverflowPopUpButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSMOverflowPopUpButton.m 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 11/4/05. 6 | // Copyright 2005 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import "PSMOverflowPopUpButton.h" 10 | #import "PSMTabBarControl.h" 11 | 12 | #define TIMER_INTERVAL 1.0 / 15.0 13 | #define ANIMATION_STEP 0.033f 14 | 15 | @implementation PSMOverflowPopUpButton 16 | 17 | - (id)initWithFrame:(NSRect)frameRect pullsDown:(BOOL)flag 18 | { 19 | if (self = [super initWithFrame:frameRect pullsDown:YES]) { 20 | [self setBezelStyle:NSRegularSquareBezelStyle]; 21 | [self setBordered:NO]; 22 | [self setTitle:@""]; 23 | [self setPreferredEdge:NSMaxXEdge]; 24 | _PSMTabBarOverflowPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForResource:@"PSMTabBarControl.bundle/btn_overflow" ofType:@"png"]]; 25 | _PSMTabBarOverflowDownPopUpImage = [[NSImage alloc] initByReferencingFile:[[PSMTabBarControl bundle] pathForResource:@"PSMTabBarControl.bundle/btn_overflow_pressed" ofType:@"png"]]; 26 | _animatingAlternateImage = NO; 27 | } 28 | return self; 29 | } 30 | 31 | 32 | - (void)drawRect:(NSRect)rect 33 | { 34 | if(_PSMTabBarOverflowPopUpImage == nil){ 35 | [super drawRect:rect]; 36 | return; 37 | } 38 | 39 | NSImage *image = (_down) ? _PSMTabBarOverflowDownPopUpImage : _PSMTabBarOverflowPopUpImage; 40 | NSSize imageSize = [image size]; 41 | NSRect bounds = [self bounds]; 42 | 43 | NSPoint drawPoint = NSMakePoint(NSMidX(bounds) - (imageSize.width * 0.5f), NSMidY(bounds) - (imageSize.height * 0.5f)); 44 | 45 | if ([self isFlipped]) { 46 | drawPoint.y += imageSize.height; 47 | } 48 | 49 | [image compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:(_animatingAlternateImage ? 0.7f : 1.0f)]; 50 | 51 | if (_animatingAlternateImage) { 52 | NSImage *alternateImage = [self alternateImage]; 53 | NSSize altImageSize = [alternateImage size]; 54 | drawPoint = NSMakePoint(NSMidX(bounds) - (altImageSize.width * 0.5f), NSMidY(bounds) - (altImageSize.height * 0.5f)); 55 | 56 | if ([self isFlipped]) { 57 | drawPoint.y += altImageSize.height; 58 | } 59 | 60 | [[self alternateImage] compositeToPoint:drawPoint operation:NSCompositeSourceOver fraction:sin(_animationValue * M_PI)]; 61 | } 62 | } 63 | 64 | - (void)mouseDown:(NSEvent *)event 65 | { 66 | _down = YES; 67 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(notificationReceived:) name:NSMenuDidEndTrackingNotification object:[self menu]]; 68 | [self setNeedsDisplay:YES]; 69 | [super mouseDown:event]; 70 | } 71 | 72 | - (void)setHidden:(BOOL)value 73 | { 74 | if ([self isHidden] != value) { 75 | if (value) { 76 | // Stop any animating alternate image if we hide 77 | [_animationTimer invalidate], _animationTimer = nil; 78 | } else if (_animatingAlternateImage) { 79 | // Restart any animating alternate image if we unhide 80 | _animationValue = ANIMATION_STEP; 81 | _animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES]; 82 | [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode]; 83 | } 84 | } 85 | 86 | [super setHidden:value]; 87 | } 88 | 89 | - (void)notificationReceived:(NSNotification *)notification 90 | { 91 | _down = NO; 92 | [self setNeedsDisplay:YES]; 93 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 94 | } 95 | 96 | - (void)setAnimatingAlternateImage:(BOOL)flag 97 | { 98 | if (_animatingAlternateImage != flag) { 99 | _animatingAlternateImage = flag; 100 | 101 | if (![self isHidden]) { 102 | if (flag) { 103 | _animationValue = ANIMATION_STEP; 104 | _animationTimer = [NSTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(animateStep:) userInfo:nil repeats:YES]; 105 | [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode]; 106 | 107 | } else { 108 | [_animationTimer invalidate], _animationTimer = nil; 109 | } 110 | 111 | [self setNeedsDisplay:YES]; 112 | } 113 | } 114 | } 115 | 116 | - (BOOL)animatingAlternateImage; 117 | { 118 | return _animatingAlternateImage; 119 | } 120 | 121 | - (void)animateStep:(NSTimer *)timer 122 | { 123 | _animationValue += ANIMATION_STEP; 124 | 125 | if (_animationValue >= 1) { 126 | _animationValue = ANIMATION_STEP; 127 | } 128 | 129 | [self setNeedsDisplay:YES]; 130 | } 131 | 132 | #pragma mark - 133 | #pragma mark Archiving 134 | 135 | - (void)encodeWithCoder:(NSCoder *)aCoder { 136 | [super encodeWithCoder:aCoder]; 137 | if ([aCoder allowsKeyedCoding]) { 138 | [aCoder encodeObject:_PSMTabBarOverflowPopUpImage forKey:@"PSMTabBarOverflowPopUpImage"]; 139 | [aCoder encodeObject:_PSMTabBarOverflowDownPopUpImage forKey:@"PSMTabBarOverflowDownPopUpImage"]; 140 | [aCoder encodeBool:_animatingAlternateImage forKey:@"PSMTabBarOverflowAnimatingAlternateImage"]; 141 | } 142 | } 143 | 144 | - (id)initWithCoder:(NSCoder *)aDecoder { 145 | if ( (self = [super initWithCoder:aDecoder]) ) { 146 | if ([aDecoder allowsKeyedCoding]) { 147 | _PSMTabBarOverflowPopUpImage = [aDecoder decodeObjectForKey:@"PSMTabBarOverflowPopUpImage"]; 148 | _PSMTabBarOverflowDownPopUpImage = [aDecoder decodeObjectForKey:@"PSMTabBarOverflowDownPopUpImage"]; 149 | [self setAnimatingAlternateImage:[aDecoder decodeBoolForKey:@"PSMTabBarOverflowAnimatingAlternateImage"]]; 150 | } 151 | } 152 | return self; 153 | } 154 | 155 | @end 156 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMProgressIndicator.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMProgressIndicator.h 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 2/23/06. 6 | // Copyright 2006 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PSMTabBarControl.h" 11 | 12 | 13 | @interface PSMProgressIndicator : NSProgressIndicator { 14 | 15 | } 16 | 17 | @end 18 | 19 | @interface PSMTabBarControl (LayoutPlease) 20 | 21 | - (void)update; 22 | 23 | @end -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMProgressIndicator.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSMProgressIndicator.m 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 2/23/06. 6 | // Copyright 2006 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import "PSMProgressIndicator.h" 10 | 11 | @implementation PSMProgressIndicator 12 | 13 | // overrides to make tab bar control re-layout things if status changes 14 | - (void)setHidden:(BOOL)flag 15 | { 16 | [super setHidden:flag]; 17 | [(PSMTabBarControl *)[self superview] update]; 18 | } 19 | 20 | - (void)stopAnimation:(id)sender 21 | { 22 | [NSObject cancelPreviousPerformRequestsWithTarget:self 23 | selector:@selector(startAnimation:) 24 | object:nil]; 25 | [super stopAnimation:sender]; 26 | } 27 | @end 28 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMRolloverButton.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMOverflowPopUpButton.h 3 | // NetScrape 4 | // 5 | // Created by John Pannell on 8/4/04. 6 | // Copyright 2004 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PSMRolloverButton : NSButton 12 | { 13 | NSImage *_rolloverImage; 14 | NSImage *_usualImage; 15 | NSTrackingRectTag _myTrackingRectTag; 16 | } 17 | 18 | // the regular image 19 | - (void)setUsualImage:(NSImage *)newImage; 20 | - (NSImage *)usualImage; 21 | 22 | // the rollover image 23 | - (void)setRolloverImage:(NSImage *)newImage; 24 | - (NSImage *)rolloverImage; 25 | 26 | // tracking rect for mouse events 27 | - (void)addTrackingRect; 28 | - (void)removeTrackingRect; 29 | @end -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMRolloverButton.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSMOverflowPopUpButton.m 3 | // NetScrape 4 | // 5 | // Created by John Pannell on 8/4/04. 6 | // Copyright 2004 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import "PSMRolloverButton.h" 10 | 11 | @implementation PSMRolloverButton 12 | 13 | - (void)awakeFromNib 14 | { 15 | if ([[self superclass] instancesRespondToSelector:@selector(awakeFromNib)]) { 16 | [super awakeFromNib]; 17 | } 18 | 19 | [[NSNotificationCenter defaultCenter] addObserver:self 20 | selector:@selector(rolloverFrameDidChange:) 21 | name:NSViewFrameDidChangeNotification 22 | object:self]; 23 | [self setPostsFrameChangedNotifications:YES]; 24 | [self resetCursorRects]; 25 | 26 | _myTrackingRectTag = -1; 27 | } 28 | 29 | - (void)dealloc 30 | { 31 | [[NSNotificationCenter defaultCenter] removeObserver:self]; 32 | 33 | [self removeTrackingRect]; 34 | 35 | } 36 | 37 | // the regular image 38 | - (void)setUsualImage:(NSImage *)newImage 39 | { 40 | _usualImage = newImage; 41 | 42 | [self setImage:_usualImage]; 43 | } 44 | 45 | - (NSImage *)usualImage 46 | { 47 | return _usualImage; 48 | } 49 | 50 | - (void)setRolloverImage:(NSImage *)newImage 51 | { 52 | _rolloverImage = newImage; 53 | } 54 | 55 | - (NSImage *)rolloverImage 56 | { 57 | return _rolloverImage; 58 | } 59 | 60 | //Remove old tracking rects when we change superviews 61 | - (void)viewWillMoveToSuperview:(NSView *)newSuperview 62 | { 63 | [self removeTrackingRect]; 64 | 65 | [super viewWillMoveToSuperview:newSuperview]; 66 | } 67 | 68 | - (void)viewDidMoveToSuperview 69 | { 70 | [super viewDidMoveToSuperview]; 71 | 72 | [self resetCursorRects]; 73 | } 74 | 75 | - (void)viewWillMoveToWindow:(NSWindow *)newWindow 76 | { 77 | [self removeTrackingRect]; 78 | 79 | [super viewWillMoveToWindow:newWindow]; 80 | } 81 | 82 | - (void)viewDidMoveToWindow 83 | { 84 | [super viewDidMoveToWindow]; 85 | 86 | [self resetCursorRects]; 87 | } 88 | 89 | - (void)rolloverFrameDidChange:(NSNotification *)inNotification 90 | { 91 | [self resetCursorRects]; 92 | } 93 | 94 | - (void)addTrackingRect 95 | { 96 | // assign a tracking rect to watch for mouse enter/exit 97 | NSRect trackRect = [self bounds]; 98 | NSPoint localPoint = [self convertPoint:[[self window] convertScreenToBase:[NSEvent mouseLocation]] 99 | fromView:nil]; 100 | BOOL mouseInside = NSPointInRect(localPoint, trackRect); 101 | 102 | _myTrackingRectTag = [self addTrackingRect:trackRect owner:self userData:nil assumeInside:mouseInside]; 103 | if (mouseInside) 104 | [self mouseEntered:nil]; 105 | else 106 | [self mouseExited:nil]; 107 | } 108 | 109 | - (void)removeTrackingRect 110 | { 111 | if (_myTrackingRectTag != -1) { 112 | [self removeTrackingRect:_myTrackingRectTag]; 113 | } 114 | _myTrackingRectTag = -1; 115 | } 116 | 117 | // override for rollover effect 118 | - (void)mouseEntered:(NSEvent *)theEvent; 119 | { 120 | // set rollover image 121 | [self setImage:_rolloverImage]; 122 | 123 | [super mouseEntered:theEvent]; 124 | } 125 | 126 | - (void)mouseExited:(NSEvent *)theEvent; 127 | { 128 | // restore usual image 129 | [self setImage:_usualImage]; 130 | 131 | [super mouseExited:theEvent]; 132 | } 133 | 134 | - (void)resetCursorRects 135 | { 136 | // called when the button rect has been changed 137 | [self removeTrackingRect]; 138 | [self addTrackingRect]; 139 | } 140 | 141 | - (void)setFrame:(NSRect)rect 142 | { 143 | [super setFrame:rect]; 144 | [self resetCursorRects]; 145 | } 146 | 147 | - (void)setBounds:(NSRect)rect 148 | { 149 | [super setBounds:rect]; 150 | [self resetCursorRects]; 151 | } 152 | 153 | #pragma mark - 154 | #pragma mark Archiving 155 | 156 | - (void)encodeWithCoder:(NSCoder *)aCoder { 157 | [super encodeWithCoder:aCoder]; 158 | if ([aCoder allowsKeyedCoding]) { 159 | [aCoder encodeObject:_rolloverImage forKey:@"rolloverImage"]; 160 | [aCoder encodeObject:_usualImage forKey:@"usualImage"]; 161 | [aCoder encodeInteger:_myTrackingRectTag forKey:@"myTrackingRectTag"]; 162 | } 163 | } 164 | 165 | - (id)initWithCoder:(NSCoder *)aDecoder { 166 | self = [super initWithCoder:aDecoder]; 167 | if (self) { 168 | if ([aDecoder allowsKeyedCoding]) { 169 | _rolloverImage = [aDecoder decodeObjectForKey:@"rolloverImage"]; 170 | _usualImage = [aDecoder decodeObjectForKey:@"usualImage"]; 171 | _myTrackingRectTag = [aDecoder decodeIntegerForKey:@"myTrackingRectTag"]; 172 | } 173 | } 174 | return self; 175 | } 176 | 177 | 178 | @end 179 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabBarCell.h 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 10/13/05. 6 | // Copyright 2005 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PSMTabBarControl.h" 11 | 12 | @class PSMTabBarControl; 13 | @class PSMProgressIndicator; 14 | 15 | @interface PSMTabBarCell : NSActionCell { 16 | // sizing 17 | NSRect _frame; 18 | NSSize _stringSize; 19 | NSInteger _currentStep; 20 | BOOL _isPlaceholder; 21 | 22 | // state 23 | NSInteger _tabState; 24 | NSTrackingRectTag _closeButtonTrackingTag; // left side tracking, if dragging 25 | NSTrackingRectTag _cellTrackingTag; // right side tracking, if dragging 26 | BOOL _closeButtonOver; 27 | BOOL _closeButtonPressed; 28 | PSMProgressIndicator *_indicator; 29 | BOOL _isInOverflowMenu; 30 | BOOL _hasCloseButton; 31 | BOOL _isCloseButtonSuppressed; 32 | BOOL _hasIcon; 33 | BOOL _hasLargeImage; 34 | NSInteger _count; 35 | NSColor *_countColor; 36 | BOOL _isEdited; 37 | } 38 | 39 | // creation/destruction 40 | - (id)initWithControlView:(PSMTabBarControl *)controlView; 41 | - (id)initPlaceholderWithFrame:(NSRect)frame expanded:(BOOL)value inControlView:(PSMTabBarControl *)controlView; 42 | - (void)dealloc; 43 | 44 | // accessors 45 | - (NSTrackingRectTag)closeButtonTrackingTag; 46 | - (void)setCloseButtonTrackingTag:(NSTrackingRectTag)tag; 47 | - (NSTrackingRectTag)cellTrackingTag; 48 | - (void)setCellTrackingTag:(NSTrackingRectTag)tag; 49 | - (CGFloat)width; 50 | - (NSRect)frame; 51 | - (void)setFrame:(NSRect)rect; 52 | - (void)setStringValue:(NSString *)aString; 53 | - (NSSize)stringSize; 54 | - (NSAttributedString *)attributedStringValue; 55 | - (NSInteger)tabState; 56 | - (void)setTabState:(NSInteger)state; 57 | - (NSProgressIndicator *)indicator; 58 | - (BOOL)isInOverflowMenu; 59 | - (void)setIsInOverflowMenu:(BOOL)value; 60 | - (BOOL)closeButtonPressed; 61 | - (void)setCloseButtonPressed:(BOOL)value; 62 | - (BOOL)closeButtonOver; 63 | - (void)setCloseButtonOver:(BOOL)value; 64 | - (BOOL)hasCloseButton; 65 | - (void)setHasCloseButton:(BOOL)set; 66 | - (void)setCloseButtonSuppressed:(BOOL)suppress; 67 | - (BOOL)isCloseButtonSuppressed; 68 | - (BOOL)hasIcon; 69 | - (void)setHasIcon:(BOOL)value; 70 | - (BOOL)hasLargeImage; 71 | - (void)setHasLargeImage:(BOOL)value; 72 | - (NSInteger)count; 73 | - (void)setCount:(NSInteger)value; 74 | - (NSColor *)countColor; 75 | - (void)setCountColor:(NSColor *)value; 76 | - (BOOL)isPlaceholder; 77 | - (void)setIsPlaceholder:(BOOL)value; 78 | - (NSInteger)currentStep; 79 | - (void)setCurrentStep:(NSInteger)value; 80 | - (BOOL)isEdited; 81 | - (void)setIsEdited:(BOOL)value; 82 | 83 | // component attributes 84 | - (NSRect)indicatorRectForFrame:(NSRect)cellFrame; 85 | - (NSRect)closeButtonRectForFrame:(NSRect)cellFrame; 86 | - (CGFloat)minimumWidthOfCell; 87 | - (CGFloat)desiredWidthOfCell; 88 | 89 | // drawing 90 | - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; 91 | 92 | // tracking the mouse 93 | - (void)mouseEntered:(NSEvent *)theEvent; 94 | - (void)mouseExited:(NSEvent *)theEvent; 95 | 96 | // drag support 97 | - (NSImage *)dragImage; 98 | 99 | // archiving 100 | - (void)encodeWithCoder:(NSCoder *)aCoder; 101 | - (id)initWithCoder:(NSCoder *)aDecoder; 102 | 103 | @end 104 | 105 | @interface PSMTabBarControl (CellAccessors) 106 | 107 | - (id)style; 108 | 109 | @end 110 | 111 | @interface NSObject (IdentifierAccesors) 112 | 113 | - (NSImage *)largeImage; 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_add_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_add_tab.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_add_tab_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_add_tab_hover.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_add_tab_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_add_tab_pressed.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_dirty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_dirty.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_dirty_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_dirty_hover.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_dirty_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_dirty_pressed.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_hover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_hover.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_close_pressed.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_overflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_overflow.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_overflow_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/btn_overflow_pressed.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/pi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/PSMTabBarControl/PSMTabBarControl.bundle/pi.png -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabBarController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabBarController.h 3 | // PSMTabBarControl 4 | // 5 | // Created by Kent Sutherland on 11/24/06. 6 | // Copyright 2006 Kent Sutherland. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class PSMTabBarControl, PSMTabBarCell; 12 | 13 | @interface PSMTabBarController : NSObject { 14 | PSMTabBarControl *_control; 15 | NSMutableArray *_cellTrackingRects, *_closeButtonTrackingRects; 16 | NSMutableArray *_cellFrames; 17 | NSRect _addButtonRect; 18 | NSMenu *_overflowMenu; 19 | } 20 | 21 | - (id)initWithTabBarControl:(PSMTabBarControl *)control; 22 | 23 | - (NSRect)addButtonRect; 24 | - (NSMenu *)overflowMenu; 25 | - (NSRect)cellTrackingRectAtIndex:(NSInteger)index; 26 | - (NSRect)closeButtonTrackingRectAtIndex:(NSInteger)index; 27 | - (NSRect)cellFrameAtIndex:(NSInteger)index; 28 | 29 | - (void)setSelectedCell:(PSMTabBarCell *)cell; 30 | 31 | - (void)layoutCells; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabContentViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabContentViewController.h 3 | // PSMTabBarControl 4 | // 5 | // Created by Jean-Philippe Couture on 2012-08-01. 6 | // Copyright 2012 Jean-Philippe Couture. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PSMTabContentViewController : NSViewController 12 | 13 | @property (strong) NSTabViewItem *tabViewItem; 14 | 15 | @property (nonatomic, assign) BOOL isProcessing; 16 | @property (nonatomic, strong) NSImage *icon; 17 | @property (nonatomic, strong) NSString *iconName; 18 | @property (nonatomic, assign) NSInteger objectCount; 19 | @property (nonatomic, assign) BOOL isEdited; 20 | 21 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil tabViewItem:(NSTabViewItem *)tabViewItem; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabContentViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabContentViewController.m 3 | // PSMTabBarControl 4 | // 5 | // Created by Jean-Philippe Couture on 2012-08-01. 6 | // Copyright 2012 Jean-Philippe Couture. All rights reserved. 7 | // 8 | 9 | #import "PSMTabContentViewController.h" 10 | 11 | @implementation PSMTabContentViewController 12 | 13 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil tabViewItem:(NSTabViewItem *)tabViewItem { 14 | self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 15 | if (self) { 16 | self.tabViewItem = tabViewItem; 17 | } 18 | return self; 19 | } 20 | 21 | @end -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabDragAssistant.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabDragAssistant.h 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 4/10/06. 6 | // Copyright 2006 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | /* 10 | This class is a sigleton that manages the details of a tab drag and drop. The details were beginning to overwhelm me when keeping all of this in the control and cells :-) 11 | */ 12 | 13 | #import 14 | #import "PSMTabBarControl.h" 15 | 16 | #define kPSMTabDragAnimationSteps 8 17 | 18 | @class PSMTabBarCell, PSMTabDragWindowController; 19 | 20 | @interface PSMTabDragAssistant : NSObject { 21 | PSMTabBarControl *_sourceTabBar; 22 | PSMTabBarControl *_destinationTabBar; 23 | NSMutableSet *_participatingTabBars; 24 | PSMTabBarCell *_draggedCell; 25 | NSInteger _draggedCellIndex; // for snap back 26 | BOOL _isDragging; 27 | 28 | // Support for dragging into new windows 29 | PSMTabDragWindowController *_draggedTab, *_draggedView; 30 | NSSize _dragWindowOffset; 31 | NSTimer *_fadeTimer; 32 | BOOL _centersDragWindows; 33 | PSMTabBarTearOffStyle _currentTearOffStyle; 34 | 35 | // Animation 36 | NSTimer *_animationTimer; 37 | NSMutableArray *_sineCurveWidths; 38 | NSPoint _currentMouseLoc; 39 | PSMTabBarCell *_targetCell; 40 | } 41 | 42 | // Creation/destruction 43 | + (PSMTabDragAssistant *)sharedDragAssistant; 44 | 45 | // Accessors 46 | - (PSMTabBarControl *)sourceTabBar; 47 | - (void)setSourceTabBar:(PSMTabBarControl *)tabBar; 48 | - (PSMTabBarControl *)destinationTabBar; 49 | - (void)setDestinationTabBar:(PSMTabBarControl *)tabBar; 50 | - (PSMTabBarCell *)draggedCell; 51 | - (void)setDraggedCell:(PSMTabBarCell *)cell; 52 | - (NSInteger)draggedCellIndex; 53 | - (void)setDraggedCellIndex:(NSInteger)value; 54 | - (BOOL)isDragging; 55 | - (void)setIsDragging:(BOOL)value; 56 | - (NSPoint)currentMouseLoc; 57 | - (void)setCurrentMouseLoc:(NSPoint)point; 58 | - (PSMTabBarCell *)targetCell; 59 | - (void)setTargetCell:(PSMTabBarCell *)cell; 60 | 61 | // Functionality 62 | - (void)startDraggingCell:(PSMTabBarCell *)cell fromTabBar:(PSMTabBarControl *)control withMouseDownEvent:(NSEvent *)event; 63 | - (void)draggingEnteredTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc; 64 | - (void)draggingUpdatedInTabBar:(PSMTabBarControl *)control atPoint:(NSPoint)mouseLoc; 65 | - (void)draggingExitedTabBar:(PSMTabBarControl *)control; 66 | - (void)performDragOperation; 67 | - (void)draggedImageEndedAt:(NSPoint)aPoint operation:(NSDragOperation)operation; 68 | - (void)finishDrag; 69 | 70 | - (void)draggingBeganAt:(NSPoint)aPoint; 71 | - (void)draggingMovedTo:(NSPoint)aPoint; 72 | 73 | // Animation 74 | - (void)animateDrag:(NSTimer *)timer; 75 | - (void)calculateDragAnimationForTabBar:(PSMTabBarControl *)control; 76 | 77 | // Placeholder 78 | - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control withDraggedCell:(PSMTabBarCell *)cell; 79 | - (void)distributePlaceholdersInTabBar:(PSMTabBarControl *)control; 80 | - (void)removeAllPlaceholdersFromTabBar:(PSMTabBarControl *)control; 81 | 82 | @end 83 | 84 | @interface PSMTabBarControl (DragAccessors) 85 | 86 | - (id)style; 87 | - (NSMutableArray *)cells; 88 | - (void)setControlView:(id)view; 89 | - (id)cellForPoint:(NSPoint)point cellFrame:(NSRectPointer)outFrame; 90 | - (PSMTabBarCell *)lastVisibleTab; 91 | - (NSInteger)numberOfVisibleTabs; 92 | 93 | @end 94 | 95 | void CGContextCopyWindowCaptureContentsToRect(void *grafport, CGRect rect, NSInteger cid, NSInteger wid, NSInteger zero); 96 | OSStatus CGSSetWindowTransform(NSInteger cid, NSInteger wid, CGAffineTransform transform); 97 | 98 | @interface NSApplication (CoreGraphicsUndocumented) 99 | - (NSInteger)contextID; 100 | @end 101 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabDragView.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabDragView.h 3 | // PSMTabBarControl 4 | // 5 | // Created by Kent Sutherland on 6/17/07. 6 | // Copyright 2007 Kent Sutherland. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface PSMTabDragView : NSView { 12 | NSImage *_image, *_alternateImage; 13 | CGFloat _alpha; 14 | } 15 | - (void)setFadeValue:(CGFloat)value; 16 | - (NSImage *)image; 17 | - (void)setImage:(NSImage *)image; 18 | - (NSImage *)alternateImage; 19 | - (void)setAlternateImage:(NSImage *)image; 20 | @end 21 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabDragView.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabDragView.m 3 | // PSMTabBarControl 4 | // 5 | // Created by Kent Sutherland on 6/17/07. 6 | // Copyright 2007 Kent Sutherland. All rights reserved. 7 | // 8 | 9 | #import "PSMTabDragView.h" 10 | 11 | 12 | @implementation PSMTabDragView 13 | 14 | - (id)initWithFrame:(NSRect)frame { 15 | if ( (self = [super initWithFrame:frame]) ) { 16 | _alpha = 1.0; 17 | } 18 | return self; 19 | } 20 | 21 | 22 | - (void)drawRect:(NSRect)rect { 23 | //1.0 fade means show the primary image 24 | //0.0 fade means show the secondary image 25 | CGFloat primaryAlpha = _alpha + 0.001f, alternateAlpha = 1.001f - _alpha; 26 | NSRect srcRect; 27 | srcRect.origin = NSZeroPoint; 28 | srcRect.size = [_image size]; 29 | 30 | [_image drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:primaryAlpha]; 31 | srcRect.size = [_alternateImage size]; 32 | [_alternateImage drawInRect:[self bounds] fromRect:srcRect operation:NSCompositeSourceOver fraction:alternateAlpha]; 33 | } 34 | 35 | - (void)setFadeValue:(CGFloat)value 36 | { 37 | _alpha = value; 38 | } 39 | 40 | - (NSImage *)image 41 | { 42 | return _image; 43 | } 44 | 45 | - (void)setImage:(NSImage *)image 46 | { 47 | _image = image; 48 | } 49 | 50 | - (NSImage *)alternateImage 51 | { 52 | return _alternateImage; 53 | } 54 | 55 | - (void)setAlternateImage:(NSImage *)image 56 | { 57 | _alternateImage = image; 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabDragWindow.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabDragWindow.h 3 | // PSMTabBarControl 4 | // 5 | // Created by Kent Sutherland on 6/1/06. 6 | // Copyright 2006 Kent Sutherland. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @class PSMTabDragView; 12 | 13 | @interface PSMTabDragWindow : NSWindow { 14 | PSMTabDragView *_dragView; 15 | } 16 | + (PSMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; 17 | 18 | - (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask; 19 | - (PSMTabDragView *)dragView; 20 | @end 21 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabDragWindow.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabDragWindow.m 3 | // PSMTabBarControl 4 | // 5 | // Created by Kent Sutherland on 6/1/06. 6 | // Copyright 2006 Kent Sutherland. All rights reserved. 7 | // 8 | 9 | #import "PSMTabDragWindow.h" 10 | #import "PSMTabDragView.h" 11 | 12 | @implementation PSMTabDragWindow 13 | 14 | + (PSMTabDragWindow *)dragWindowWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask 15 | { 16 | return [[PSMTabDragWindow alloc] initWithImage:image styleMask:styleMask]; 17 | } 18 | 19 | - (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask 20 | { 21 | NSSize size = [image size]; 22 | 23 | if ( (self = [super initWithContentRect:NSMakeRect(0, 0, size.width, size.height) styleMask:styleMask backing:NSBackingStoreBuffered defer:NO]) ) { 24 | _dragView = [[PSMTabDragView alloc] initWithFrame:NSMakeRect(0, 0, size.width, size.height)]; 25 | [self setContentView:_dragView]; 26 | [self setLevel:NSStatusWindowLevel]; 27 | [self setIgnoresMouseEvents:YES]; 28 | [self setOpaque:NO]; 29 | 30 | [_dragView setImage:image]; 31 | 32 | //Set the size of the window to be the exact size of the drag image 33 | NSRect windowFrame = [self frame]; 34 | windowFrame.origin.y += windowFrame.size.height - size.height; 35 | windowFrame.size = size; 36 | 37 | if (styleMask | NSBorderlessWindowMask) { 38 | windowFrame.size.height += 22; 39 | } 40 | 41 | [self setFrame:windowFrame display:YES]; 42 | } 43 | return self; 44 | } 45 | 46 | - (PSMTabDragView *)dragView 47 | { 48 | return _dragView; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabDragWindowController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabDragWindowController.h 3 | // PSMTabBarControl 4 | // 5 | // Created by Kent Sutherland on 6/18/07. 6 | // Copyright 2007 Kent Sutherland. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "PSMTabBarControl.h" 11 | 12 | #define kPSMTabDragWindowAlpha 0.75 13 | #define kPSMTabDragAlphaInterval 0.15 14 | 15 | @class PSMTabDragView; 16 | 17 | @interface PSMTabDragWindowController : NSWindowController { 18 | PSMTabBarTearOffStyle _tearOffStyle; 19 | PSMTabDragView *_view; 20 | NSAnimation *_animation; 21 | NSTimer *_timer; 22 | 23 | BOOL _showingAlternate; 24 | NSRect _originalWindowFrame; 25 | } 26 | - (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask tearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle; 27 | 28 | - (NSImage *)image; 29 | - (NSImage *)alternateImage; 30 | - (void)setAlternateImage:(NSImage *)image; 31 | - (BOOL)isAnimating; 32 | - (void)switchImages; 33 | @end 34 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabDragWindowController.m: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabDragWindowController.m 3 | // PSMTabBarControl 4 | // 5 | // Created by Kent Sutherland on 6/18/07. 6 | // Copyright 2007 Kent Sutherland. All rights reserved. 7 | // 8 | 9 | #import "PSMTabDragWindowController.h" 10 | #import "PSMTabDragWindow.h" 11 | #import "PSMTabDragView.h" 12 | 13 | @implementation PSMTabDragWindowController 14 | 15 | - (id)initWithImage:(NSImage *)image styleMask:(NSUInteger)styleMask tearOffStyle:(PSMTabBarTearOffStyle)tearOffStyle 16 | { 17 | PSMTabDragWindow *window = [PSMTabDragWindow dragWindowWithImage:image styleMask:styleMask]; 18 | if ( (self = [super initWithWindow:window]) ) { 19 | _view = [window dragView]; 20 | _tearOffStyle = tearOffStyle; 21 | 22 | if (tearOffStyle == PSMTabBarTearOffMiniwindow) { 23 | [window setBackgroundColor:[NSColor clearColor]]; 24 | [window setHasShadow:YES]; 25 | } 26 | 27 | [window setAlphaValue:kPSMTabDragWindowAlpha]; 28 | } 29 | return self; 30 | } 31 | 32 | - (void)dealloc 33 | { 34 | if (_timer) { 35 | [_timer invalidate]; 36 | } 37 | 38 | 39 | } 40 | 41 | - (NSImage *)image 42 | { 43 | return [_view image]; 44 | } 45 | 46 | - (NSImage *)alternateImage 47 | { 48 | return [_view alternateImage]; 49 | } 50 | 51 | - (void)setAlternateImage:(NSImage *)image 52 | { 53 | [_view setAlternateImage:image]; 54 | } 55 | 56 | - (BOOL)isAnimating 57 | { 58 | return _animation != nil; 59 | } 60 | 61 | - (void)switchImages 62 | { 63 | if (_tearOffStyle != PSMTabBarTearOffMiniwindow || ![_view alternateImage]) { 64 | return; 65 | } 66 | 67 | CGFloat progress = 0; 68 | _showingAlternate = !_showingAlternate; 69 | 70 | if (_animation) { 71 | //An animation already exists, get the current progress 72 | progress = 1.0f - [_animation currentProgress]; 73 | [_animation stopAnimation]; 74 | } 75 | 76 | //begin animating 77 | _animation = [[NSAnimation alloc] initWithDuration:0.25 animationCurve:NSAnimationEaseInOut]; 78 | [_animation setAnimationBlockingMode:NSAnimationNonblocking]; 79 | [_animation setCurrentProgress:progress]; 80 | [_animation startAnimation]; 81 | 82 | _originalWindowFrame = [[self window] frame]; 83 | 84 | if (_timer) { 85 | [_timer invalidate]; 86 | } 87 | _timer = [NSTimer scheduledTimerWithTimeInterval:1.0f / 30.0f target:self selector:@selector(animateTimer:) userInfo:nil repeats:YES]; 88 | } 89 | 90 | - (void)animateTimer:(NSTimer *)timer 91 | { 92 | NSRect frame = _originalWindowFrame; 93 | NSImage *currentImage = _showingAlternate ? [_view alternateImage] : [_view image]; 94 | NSSize size = [currentImage size]; 95 | NSPoint mousePoint = [NSEvent mouseLocation]; 96 | CGFloat animationValue = [_animation currentValue]; 97 | 98 | frame.size.width = _originalWindowFrame.size.width + (size.width - _originalWindowFrame.size.width) * animationValue; 99 | frame.size.height = _originalWindowFrame.size.height + (size.height - _originalWindowFrame.size.height) * animationValue; 100 | frame.origin.x = mousePoint.x - (frame.size.width / 2); 101 | frame.origin.y = mousePoint.y - (frame.size.height / 2); 102 | 103 | [_view setFadeValue:_showingAlternate ? 1.0f - animationValue : animationValue]; 104 | [[self window] setFrame:frame display:YES]; 105 | 106 | if (![_animation isAnimating]) { 107 | _animation = nil; 108 | [timer invalidate]; 109 | _timer = nil; 110 | } 111 | } 112 | 113 | @end 114 | -------------------------------------------------------------------------------- /Dependencies/PSMTabBarControl/PSMTabStyle.h: -------------------------------------------------------------------------------- 1 | // 2 | // PSMTabStyle.h 3 | // PSMTabBarControl 4 | // 5 | // Created by John Pannell on 2/17/06. 6 | // Copyright 2006 Positive Spin Media. All rights reserved. 7 | // 8 | 9 | /* 10 | Protocol to be observed by all style delegate objects. These objects handle the drawing responsibilities for PSMTabBarCell; once the control has been assigned a style, the background and cells draw consistent with that style. Design pattern and implementation by David Smith, Seth Willits, and Chris Forsythe, all touch up and errors by John P. :-) 11 | */ 12 | 13 | #import "PSMTabBarCell.h" 14 | #import "PSMTabBarControl.h" 15 | 16 | @protocol PSMTabStyle 17 | 18 | // identity 19 | - (NSString *)name; 20 | 21 | // control specific parameters 22 | - (CGFloat)leftMarginForTabBarControl; 23 | - (CGFloat)rightMarginForTabBarControl; 24 | - (CGFloat)topMarginForTabBarControl; 25 | - (void)setOrientation:(PSMTabBarOrientation)value; 26 | 27 | // add tab button 28 | - (NSImage *)addTabButtonImage; 29 | - (NSImage *)addTabButtonPressedImage; 30 | - (NSImage *)addTabButtonRolloverImage; 31 | 32 | // cell specific parameters 33 | - (NSRect)dragRectForTabCell:(PSMTabBarCell *)cell orientation:(PSMTabBarOrientation)orientation; 34 | - (NSRect)closeButtonRectForTabCell:(PSMTabBarCell *)cell withFrame:(NSRect)cellFrame; 35 | - (NSRect)iconRectForTabCell:(PSMTabBarCell *)cell; 36 | - (NSRect)indicatorRectForTabCell:(PSMTabBarCell *)cell; 37 | - (NSRect)objectCounterRectForTabCell:(PSMTabBarCell *)cell; 38 | - (CGFloat)minimumWidthOfTabCell:(PSMTabBarCell *)cell; 39 | - (CGFloat)desiredWidthOfTabCell:(PSMTabBarCell *)cell; 40 | - (CGFloat)tabCellHeight; 41 | 42 | // cell values 43 | - (NSAttributedString *)attributedObjectCountValueForTabCell:(PSMTabBarCell *)cell; 44 | - (NSAttributedString *)attributedStringValueForTabCell:(PSMTabBarCell *)cell; 45 | 46 | // drawing 47 | - (void)drawTabCell:(PSMTabBarCell *)cell; 48 | - (void)drawBackgroundInRect:(NSRect)rect; 49 | - (void)drawTabBar:(PSMTabBarControl *)bar inRect:(NSRect)rect; 50 | 51 | @end 52 | 53 | @interface PSMTabBarControl (StyleAccessors) 54 | 55 | - (NSMutableArray *)cells; 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /Dependencies/SSKeychain/SSKeychain.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSKeychain.h 3 | // SSKeychain 4 | // 5 | // Created by Sam Soffes on 5/19/10. 6 | // Copyright (c) 2010-2013 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSKeychainQuery.h" 10 | 11 | /** 12 | Error code specific to SSKeychain that can be returned in NSError objects. 13 | For codes returned by the operating system, refer to SecBase.h for your 14 | platform. 15 | */ 16 | typedef enum { 17 | 18 | /** Some of the arguments were invalid. */ 19 | SSKeychainErrorBadArguments = -1001, 20 | 21 | } SSKeychainErrorCode; 22 | 23 | /** SSKeychain error domain */ 24 | extern NSString *const kSSKeychainErrorDomain; 25 | 26 | /** Account name. */ 27 | extern NSString *const kSSKeychainAccountKey; 28 | 29 | /** 30 | Time the item was created. 31 | 32 | The value will be a string. 33 | */ 34 | extern NSString *const kSSKeychainCreatedAtKey; 35 | 36 | /** Item class. */ 37 | extern NSString *const kSSKeychainClassKey; 38 | 39 | /** Item description. */ 40 | extern NSString *const kSSKeychainDescriptionKey; 41 | 42 | /** Item label. */ 43 | extern NSString *const kSSKeychainLabelKey; 44 | 45 | /** Time the item was last modified. 46 | 47 | The value will be a string. 48 | */ 49 | extern NSString *const kSSKeychainLastModifiedKey; 50 | 51 | /** Where the item was created. */ 52 | extern NSString *const kSSKeychainWhereKey; 53 | 54 | /** 55 | Simple wrapper for accessing accounts, getting passwords, setting passwords, and deleting passwords using the system 56 | Keychain on Mac OS X and iOS. 57 | 58 | This was originally inspired by EMKeychain and SDKeychain (both of which are now gone). Thanks to the authors. 59 | SSKeychain has since switched to a simpler implementation that was abstracted from [SSToolkit](http://sstoolk.it). 60 | */ 61 | @interface SSKeychain : NSObject 62 | 63 | #pragma mark - Classic methods 64 | 65 | /** 66 | Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't have a 67 | password for the given parameters. 68 | 69 | @param serviceName The service for which to return the corresponding password. 70 | 71 | @param account The account for which to return the corresponding password. 72 | 73 | @return Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't 74 | have a password for the given parameters. 75 | */ 76 | + (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account; 77 | + (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error; 78 | 79 | 80 | /** 81 | Deletes a password from the Keychain. 82 | 83 | @param serviceName The service for which to delete the corresponding password. 84 | 85 | @param account The account for which to delete the corresponding password. 86 | 87 | @return Returns `YES` on success, or `NO` on failure. 88 | */ 89 | + (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account; 90 | + (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error; 91 | 92 | 93 | /** 94 | Sets a password in the Keychain. 95 | 96 | @param password The password to store in the Keychain. 97 | 98 | @param serviceName The service for which to set the corresponding password. 99 | 100 | @param account The account for which to set the corresponding password. 101 | 102 | @return Returns `YES` on success, or `NO` on failure. 103 | */ 104 | + (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account; 105 | + (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error; 106 | 107 | 108 | /** 109 | Returns an array containing the Keychain's accounts, or `nil` if the Keychain has no accounts. 110 | 111 | See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the 112 | dictionaries returned by this method. 113 | 114 | @return An array of dictionaries containing the Keychain's accounts, or `nil` if the Keychain doesn't have any 115 | accounts. The order of the objects in the array isn't defined. 116 | */ 117 | + (NSArray *)allAccounts; 118 | 119 | 120 | /** 121 | Returns an array containing the Keychain's accounts for a given service, or `nil` if the Keychain doesn't have any 122 | accounts for the given service. 123 | 124 | See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the 125 | dictionaries returned by this method. 126 | 127 | @param serviceName The service for which to return the corresponding accounts. 128 | 129 | @return An array of dictionaries containing the Keychain's accountsfor a given `serviceName`, or `nil` if the Keychain 130 | doesn't have any accounts for the given `serviceName`. The order of the objects in the array isn't defined. 131 | */ 132 | + (NSArray *)accountsForService:(NSString *)serviceName; 133 | 134 | 135 | #pragma mark - Configuration 136 | 137 | #if __IPHONE_4_0 && TARGET_OS_IPHONE 138 | /** 139 | Returns the accessibility type for all future passwords saved to the Keychain. 140 | 141 | @return Returns the accessibility type. 142 | 143 | The return value will be `NULL` or one of the "Keychain Item Accessibility 144 | Constants" used for determining when a keychain item should be readable. 145 | 146 | @see setAccessibilityType 147 | */ 148 | + (CFTypeRef)accessibilityType; 149 | 150 | /** 151 | Sets the accessibility type for all future passwords saved to the Keychain. 152 | 153 | @param accessibilityType One of the "Keychain Item Accessibility Constants" 154 | used for determining when a keychain item should be readable. 155 | 156 | If the value is `NULL` (the default), the Keychain default will be used. 157 | 158 | @see accessibilityType 159 | */ 160 | + (void)setAccessibilityType:(CFTypeRef)accessibilityType; 161 | #endif 162 | 163 | @end 164 | -------------------------------------------------------------------------------- /Dependencies/SSKeychain/SSKeychain.m: -------------------------------------------------------------------------------- 1 | // 2 | // SSKeychain.m 3 | // SSKeychain 4 | // 5 | // Created by Sam Soffes on 5/19/10. 6 | // Copyright (c) 2010-2013 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import "SSKeychain.h" 10 | 11 | NSString *const kSSKeychainErrorDomain = @"com.samsoffes.sskeychain"; 12 | NSString *const kSSKeychainAccountKey = @"acct"; 13 | NSString *const kSSKeychainCreatedAtKey = @"cdat"; 14 | NSString *const kSSKeychainClassKey = @"labl"; 15 | NSString *const kSSKeychainDescriptionKey = @"desc"; 16 | NSString *const kSSKeychainLabelKey = @"labl"; 17 | NSString *const kSSKeychainLastModifiedKey = @"mdat"; 18 | NSString *const kSSKeychainWhereKey = @"svce"; 19 | 20 | #if __IPHONE_4_0 && TARGET_OS_IPHONE 21 | static CFTypeRef SSKeychainAccessibilityType = NULL; 22 | #endif 23 | 24 | @implementation SSKeychain 25 | 26 | + (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account { 27 | return [self passwordForService:serviceName account:account error:nil]; 28 | } 29 | 30 | 31 | + (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account error:(NSError *__autoreleasing *)error { 32 | SSKeychainQuery *query = [[SSKeychainQuery alloc] init]; 33 | query.service = serviceName; 34 | query.account = account; 35 | [query fetch:error]; 36 | return query.password; 37 | } 38 | 39 | 40 | + (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account { 41 | return [self deletePasswordForService:serviceName account:account error:nil]; 42 | } 43 | 44 | 45 | + (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account error:(NSError *__autoreleasing *)error { 46 | SSKeychainQuery *query = [[SSKeychainQuery alloc] init]; 47 | query.service = serviceName; 48 | query.account = account; 49 | return [query deleteItem:error]; 50 | } 51 | 52 | 53 | + (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account { 54 | return [self setPassword:password forService:serviceName account:account error:nil]; 55 | } 56 | 57 | 58 | + (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError *__autoreleasing *)error { 59 | SSKeychainQuery *query = [[SSKeychainQuery alloc] init]; 60 | query.service = serviceName; 61 | query.account = account; 62 | query.password = password; 63 | return [query save:error]; 64 | } 65 | 66 | 67 | + (NSArray *)allAccounts { 68 | return [self accountsForService:nil]; 69 | } 70 | 71 | 72 | + (NSArray *)accountsForService:(NSString *)serviceName { 73 | SSKeychainQuery *query = [[SSKeychainQuery alloc] init]; 74 | query.service = serviceName; 75 | return [query fetchAll:nil]; 76 | } 77 | 78 | 79 | #if __IPHONE_4_0 && TARGET_OS_IPHONE 80 | + (CFTypeRef)accessibilityType { 81 | return SSKeychainAccessibilityType; 82 | } 83 | 84 | 85 | + (void)setAccessibilityType:(CFTypeRef)accessibilityType { 86 | CFRetain(accessibilityType); 87 | if (SSKeychainAccessibilityType) { 88 | CFRelease(SSKeychainAccessibilityType); 89 | } 90 | SSKeychainAccessibilityType = accessibilityType; 91 | } 92 | #endif 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /Dependencies/SSKeychain/SSKeychainQuery.h: -------------------------------------------------------------------------------- 1 | // 2 | // SSKeychainQuery.h 3 | // SSKeychain 4 | // 5 | // Created by Caleb Davenport on 3/19/13. 6 | // Copyright (c) 2013 Sam Soffes. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | #ifdef __IPHONE_7_0 13 | #define SSKEYCHAIN_SYNCHRONIZABLE_AVAILABLE 1 14 | #endif 15 | 16 | #ifdef __MAC_10_9 17 | #define SSKEYCHAIN_SYNCHRONIZABLE_AVAILABLE 1 18 | #endif 19 | 20 | /** 21 | Simple interface for querying or modifying keychain items. 22 | */ 23 | @interface SSKeychainQuery : NSObject 24 | 25 | /** kSecAttrAccount */ 26 | @property (nonatomic, copy) NSString *account; 27 | 28 | /** kSecAttrService */ 29 | @property (nonatomic, copy) NSString *service; 30 | 31 | /** kSecAttrLabel */ 32 | @property (nonatomic, copy) NSString *label; 33 | 34 | #if __IPHONE_3_0 && TARGET_OS_IPHONE 35 | /** kSecAttrAccessGroup (only used on iOS) */ 36 | @property (nonatomic, copy) NSString *accessGroup; 37 | #endif 38 | 39 | #ifdef SSKEYCHAIN_SYNCHRONIZABLE_AVAILABLE 40 | /** kSecAttrSynchronizable */ 41 | @property (nonatomic, getter = isSynchronizable) BOOL synchronizable; 42 | #endif 43 | 44 | /** Root storage for password information */ 45 | @property (nonatomic, copy) NSData *passwordData; 46 | 47 | /** 48 | This property automatically transitions between an object and the value of 49 | `passwordData` using NSKeyedArchiver and NSKeyedUnarchiver. 50 | */ 51 | @property (nonatomic, copy) id passwordObject; 52 | 53 | /** 54 | Convenience accessor for setting and getting a password string. Passes through 55 | to `passwordData` using UTF-8 string encoding. 56 | */ 57 | @property (nonatomic, copy) NSString *password; 58 | 59 | /** 60 | Save the receiver's attributes as a keychain item. Existing items with the 61 | given account, service, and access group will first be deleted. 62 | 63 | @param error Populated should an error occur. 64 | 65 | @return `YES` if saving was successful, `NO` otherwise. 66 | */ 67 | - (BOOL)save:(NSError **)error; 68 | 69 | /** 70 | Dete keychain items that match the given account, service, and access group. 71 | 72 | @param error Populated should an error occur. 73 | 74 | @return `YES` if saving was successful, `NO` otherwise. 75 | */ 76 | - (BOOL)deleteItem:(NSError **)error; 77 | 78 | /** 79 | Fetch all keychain items that match the given account, service, and access 80 | group. The values of `password` and `passwordData` are ignored when fetching. 81 | 82 | @param error Populated should an error occur. 83 | 84 | @return An array of dictionaries that represent all matching keychain items or 85 | `nil` should an error occur. 86 | The order of the items is not determined. 87 | */ 88 | - (NSArray *)fetchAll:(NSError **)error; 89 | 90 | /** 91 | Fetch the keychain item that matches the given account, service, and access 92 | group. The `password` and `passwordData` properties will be populated unless 93 | an error occurs. The values of `password` and `passwordData` are ignored when 94 | fetching. 95 | 96 | @param error Populated should an error occur. 97 | 98 | @return `YES` if fetching was successful, `NO` otherwise. 99 | */ 100 | - (BOOL)fetch:(NSError **)error; 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /Dependencies/SSKeychain/en.lproj/SSKeychain.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Dependencies/SSKeychain/en.lproj/SSKeychain.strings -------------------------------------------------------------------------------- /Deploy/Changelog.markdown: -------------------------------------------------------------------------------- 1 | ## Nally 1.4.5 2 | 2009/09/07 3 | 4 | * Fix file name issue on image preview. (jjgod) 5 | 6 | ## Nally 1.4.4 7 | 2009/09/04 8 | 9 | * Fix ssh connection issue. (jjgod) 10 | * Fix icon disappear issue on Tab items. (jjgod) 11 | * Fix attachment file name decoding in newsmth. (jjgod) 12 | * Launch as 32-bit by default in Leopard. (jjgod) 13 | 14 | ## Nally 1.4.3 (2009/08/28) 15 | 16 | * Support 64-bit and Snow Leopard. (jjgod) 17 | 18 | -------------------------------------------------------------------------------- /Deploy/Changelog.zh_CN.markdown: -------------------------------------------------------------------------------- 1 | ## Nally 1.4.5 (2009/09/07) 2 | 3 | * 修正预览图片时获取文件名的问题。(jjgod) 4 | 5 | ## Nally 1.4.4 (2009/09/04) 6 | 7 | * 修正 ssh 无法连接的问题。(jjgod) 8 | * 修正 Tab 栏无法出现图标的问题。(jjgod) 9 | * 修正 newsmth 附件文件名解码问题。(jjgod) 10 | * 在 Leopard 下默认以 32-bit 模式执行。(jjgod) 11 | 12 | ## Nally 1.4.3 (2009/08/28) 13 | 14 | * 支持 64-bit 和 Snow Leopard。(jjgod) 15 | 16 | ## Nally 1.4.2 17 | 18 | * SSH 到 BBS 时关闭 X11 Forwarding。(mjhsieh) 19 | * 修正半型处理中引发的重绘问题。(mjhsieh) 20 | * 正确处理地址栏输入的地址。(mjhsieh) 21 | * 其他终端相关的相容性改进。(mjhsieh) 22 | 23 | ## Nally 1.4.1 24 | 25 | * (新增) 加入对保存预览图片的试验性支持。 26 | * 修正 GBK 特定高字节 (0x9B) 处理问题。 27 | * 将 GBK 中原映射到 PUA 的字符根据 Unicode 5.0 改为映射到 CJK Ext-A 区。 28 | * 修正对光标处于窗口边界时的检查。(fayewong 报告) 29 | * 修正预览图片时部分内容被窗口标题栏覆盖的问题。(fayewong 报告) 30 | 31 | ## Nally 1.4.0 32 | 33 | * 修正 GBK 特定低字节处理问题。 34 | * 加入对属于 GBK 但不属于 CP936 的 80 个汉字的支持。 35 | * 修正背景色不能延伸到行末的问题。(Evan 报告) 36 | * 修正一些半透明背景绘制的问题。(fishy 报告) 37 | * 修正输入到窗口边沿光标判断的问题。(fayewong) 38 | 39 | -------------------------------------------------------------------------------- /Deploy/Changelog.zh_TW.markdown: -------------------------------------------------------------------------------- 1 | ## Nally 1.4.5 (2009/09/07) 2 | 3 | * 修正預覽圖片時取得檔案名稱的問題。(jjgod) 4 | 5 | ## Nally 1.4.4 (2009/09/04) 6 | 7 | * 修正 ssh 無法連接的問題。(jjgod) 8 | * 修正 Tab 欄無法出現圖示的問題。(jjgod) 9 | * 修正 newsmth 附件檔案名解讀問題。(jjgod) 10 | * 在 Leopard 下預設以 32-bit 模式執行。(jjgod) 11 | 12 | ## Nally 1.4.3 (2009/08/28) 13 | 14 | * 支援 64-bit 和 Snow Leopard。(jjgod) 15 | 16 | ## 1.4.2 的修改 17 | 18 | * SSH 到 BBS 時關閉 X11 Forwarding。(mjhsieh) 19 | * 修正半型處理中引發的重繪問題。(mjhsieh) 20 | * 正確處理地址欄輸入的地址。(mjhsieh) 21 | * 其他終端相關的相容性改進。(mjhsieh) 22 | 23 | ## 1.4.1 的修改 24 | 25 | * (新增) 加入對預覽圖片存檔的試驗性支援。 26 | * 修正 GBK 特定高位元 (0x9B) 處理問題。 27 | * 將 GBK 中原來對應到 PUA 的字元根據 Unicode 5.0 改為對應到 CJK Ext-A 區。 28 | * 修正對游標處於窗口邊界時的檢查。(fayewong 報告) 29 | * 修正預覽圖片時部分內容被窗口標題欄覆蓋的問題。(fayewong 報告) 30 | 31 | ## 1.4.0 的修改 32 | 33 | * 修正 GBK 特定低位元處理問題。 34 | * 加入對屬於 GBK 但不屬於 CP936 的 80 個漢字的支援。 35 | * 修正背景色不能延伸到行末的問題。(Evan 報告) 36 | * 修正一些半透明背景繪製的問題。(fishy 報告) 37 | * 修正輸入到窗口邊緣游標判斷的問題。(fayewong) 38 | 39 | -------------------------------------------------------------------------------- /Deploy/Nally.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Nally Changelog 6 | http://nally.googlecode.com/svn/trunk/Nally.xml 7 | Most recent changes with links to Nally updates. 8 | en 9 | 10 | Version 1.4.5 11 | Nally 1.4.5 13 | 2009/09/07 14 | 15 |
    16 |
  • 修正预览图片时获取文件名的问题。(jjgod)
  • 17 |
18 | 19 |

Nally 1.4.4

20 | 2009/09/04 21 | 22 |
    23 |
  • 修正 ssh 无法连接的问题。(jjgod)
  • 24 |
  • 修正 Tab 栏无法出现图标的问题。(jjgod)
  • 25 |
  • 修正 newsmth 附件文件名解码问题。(jjgod)
  • 26 |
  • 在 Leopard 下默认以 32-bit 模式执行。(jjgod)
  • 27 |
28 | 29 |

Nally 1.4.3

30 | 2009/08/28 31 | 32 |
    33 |
  • 支持 64-bit 和 Snow Leopard。(jjgod)
  • 34 |
35 | 36 |

Nally 1.4.2

37 | 38 |
    39 |
  • SSH 到 BBS 時關閉 X11 Forwarding。(mjhsieh)
  • 40 |
  • 修正半型處理中引發的重繪問題。(mjhsieh)
  • 41 |
  • 正確處理地址欄輸入的地址。(mjhsieh)
  • 42 |
  • 其他終端相關的相容性改進。(mjhsieh)
  • 43 |
44 | 45 |

Nally 1.4.1

46 | 47 |
    48 |
  • (新增) 加入对保存预览图片的试验性支持。
  • 49 |
  • 修正 GBK 特定高字节 (0x9B) 处理问题。
  • 50 |
  • 将 GBK 中原映射到 PUA 的字符根据 Unicode 5.0 改为映射到 CJK Ext-A 区。
  • 51 |
  • 修正对光标处于窗口边界时的检查。(fayewong 报告)
  • 52 |
  • 修正预览图片时部分内容被窗口标题栏覆盖的问题。(fayewong 报告)
  • 53 |
54 | 55 |

Nally 1.4.0

56 | 57 |
    58 |
  • 修正 GBK 特定低字节处理问题。
  • 59 |
  • 加入对属于 GBK 但不属于 CP936 的 80 个汉字的支持。
  • 60 |
  • 修正背景色不能延伸到行末的问题。(Evan 报告)
  • 61 |
  • 修正一些半透明背景绘制的问题。(fishy 报告)
  • 62 |
  • 修正输入到窗口边沿光标判断的问题。(fayewong)
  • 63 |
64 | ]]>
65 | Mon, 07 Sep 2009 09:41:01 +0900 66 | 71 |
72 |
73 | 74 |
75 | -------------------------------------------------------------------------------- /Deploy/Nally.zh_CN.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Nally Changelog 6 | http://nally.googlecode.com/svn/trunk/Nally.xml 7 | Most recent changes with links to Nally updates. 8 | zh 9 | 10 | Version 1.4.5 11 | Nally 1.4.5 13 | 2009/09/07 14 | 15 |
    16 |
  • 修正预览图片时获取文件名的问题。(jjgod)
  • 17 |
18 | 19 |

Nally 1.4.4

20 | 2009/09/04 21 | 22 |
    23 |
  • 修正 ssh 无法连接的问题。(jjgod)
  • 24 |
  • 修正 Tab 栏无法出现图标的问题。(jjgod)
  • 25 |
  • 修正 newsmth 附件文件名解码问题。(jjgod)
  • 26 |
  • 在 Leopard 下默认以 32-bit 模式执行。(jjgod)
  • 27 |
28 | 29 |

Nally 1.4.3

30 | 2009/08/28 31 | 32 |
    33 |
  • 支持 64-bit 和 Snow Leopard。(jjgod)
  • 34 |
35 | 36 |

1.4.2 的修改

37 | 38 |
    39 |
  • SSH 到 BBS 时禁用 X11 Forwarding。(mjhsieh)
  • 40 |
  • 修正半字处理中引发的重绘问题。(mjhsieh)
  • 41 |
  • 正确处理地址栏输入的地址。(mjhsieh)
  • 42 |
  • 其他终端相关的兼容性改进。(mjhsieh)
  • 43 |
44 | 45 |

1.4.1 的修改

46 | 47 |
    48 |
  • (新增) 加入对保存预览图片的试验性支持。
  • 49 |
  • 修正 GBK 特定高字节 (0x9B) 处理问题。
  • 50 |
  • 将 GBK 中原映射到 PUA 的字符根据 Unicode 5.0 改为映射到 CJK Ext-A 区。
  • 51 |
  • 修正对光标处于窗口边界时的检查。(fayewong 报告)
  • 52 |
  • 修正预览图片时部分内容被窗口标题栏覆盖的问题。(fayewong 报告)
  • 53 |
54 | 55 |

1.4.0 的修改

56 | 57 |
    58 |
  • 修正 GBK 特定低字节处理问题。
  • 59 |
  • 加入对属于 GBK 但不属于 CP936 的 80 个汉字的支持。
  • 60 |
  • 修正背景色不能延伸到行末的问题。(Evan 报告)
  • 61 |
  • 修正一些半透明背景绘制的问题。(fishy 报告)
  • 62 |
  • 修正输入到窗口边沿光标判断的问题。(fayewong)
  • 63 |
64 | ]]>
65 | Mon, 07 Sep 2009 09:41:01 +0900 66 | 71 |
72 |
73 |
74 | -------------------------------------------------------------------------------- /Deploy/Nally.zh_TW.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Nally Changelog 6 | http://nally.googlecode.com/svn/trunk/Nally.xml 7 | Most recent changes with links to Nally updates. 8 | zh-Hant 9 | 10 | Version 1.4.5 11 | Nally 1.4.5 13 | 2009/09/07 14 | 15 |
    16 |
  • 修正預覽圖片時取得檔案名稱的問題。(jjgod)
  • 17 |
18 | 19 |

Nally 1.4.4

20 | 2009/09/04 21 | 22 |
    23 |
  • 修正 ssh 無法連接的問題。(jjgod)
  • 24 |
  • 修正 Tab 欄無法出現圖示的問題。(jjgod)
  • 25 |
  • 修正 newsmth 附件檔案名解讀問題。(jjgod)
  • 26 |
  • 在 Leopard 下預設以 32-bit 模式執行。(jjgod)
  • 27 |
28 | 29 |

Nally 1.4.3

30 | 2009/08/28 31 | 32 |
    33 |
  • 支援 64-bit 和 Snow Leopard。(jjgod)
  • 34 |
35 | 36 |

1.4.2 的修改

37 | 38 |
    39 |
  • SSH 到 BBS 時關閉 X11 Forwarding。(mjhsieh)
  • 40 |
  • 修正半型處理中引發的重繪問題。(mjhsieh)
  • 41 |
  • 正確處理地址欄輸入的地址。(mjhsieh)
  • 42 |
  • 其他終端相關的相容性改進。(mjhsieh)
  • 43 |
44 | 45 |

1.4.1 的修改

46 | 47 |
    48 |
  • (新增) 加入對預覽圖片存檔的試驗性支援。
  • 49 |
  • 修正 GBK 特定高位元 (0x9B) 處理問題。
  • 50 |
  • 將 GBK 中原來對應到 PUA 的字元根據 Unicode 5.0 改為對應到 CJK Ext-A 區。
  • 51 |
  • 修正對游標處於窗口邊界時的檢查。(fayewong 報告)
  • 52 |
  • 修正預覽圖片時部分內容被窗口標題欄覆蓋的問題。(fayewong 報告)
  • 53 |
54 | 55 |

1.4.0 的修改

56 | 57 |
    58 |
  • 修正 GBK 特定低位元處理問題。
  • 59 |
  • 加入對屬於 GBK 但不屬於 CP936 的 80 個漢字的支援。
  • 60 |
  • 修正背景色不能延伸到行末的問題。(Evan 報告)
  • 61 |
  • 修正一些半透明背景繪製的問題。(fishy 報告)
  • 62 |
  • 修正輸入到窗口邊緣游標判斷的問題。(fayewong)
  • 63 |
64 | ]]>
65 | Mon, 07 Sep 2009 09:41:01 +0900 66 | 71 |
72 |
73 | 74 |
75 | -------------------------------------------------------------------------------- /Deploy/Release.html: -------------------------------------------------------------------------------- 1 |

Nally 1.4.5

2 | 2009/09/07 3 | 4 |
    5 |
  • 修正预览图片时获取文件名的问题。(jjgod)
  • 6 |
7 | 8 |

Nally 1.4.4

9 | 2009/09/04 10 | 11 |
    12 |
  • 修正 ssh 无法连接的问题。(jjgod)
  • 13 |
  • 修正 Tab 栏无法出现图标的问题。(jjgod)
  • 14 |
  • 修正 newsmth 附件文件名解码问题。(jjgod)
  • 15 |
  • 在 Leopard 下默认以 32-bit 模式执行。(jjgod)
  • 16 |
17 | 18 |

Nally 1.4.3

19 | 2009/08/28 20 | 21 |
    22 |
  • 支持 64-bit 和 Snow Leopard。(jjgod)
  • 23 |
24 | 25 |

Nally 1.4.2

26 | 27 |
    28 |
  • SSH 到 BBS 時關閉 X11 Forwarding。(mjhsieh)
  • 29 |
  • 修正半型處理中引發的重繪問題。(mjhsieh)
  • 30 |
  • 正確處理地址欄輸入的地址。(mjhsieh)
  • 31 |
  • 其他終端相關的相容性改進。(mjhsieh)
  • 32 |
33 | 34 |

Nally 1.4.1

35 | 36 |
    37 |
  • (新增) 加入对保存预览图片的试验性支持。
  • 38 |
  • 修正 GBK 特定高字节 (0x9B) 处理问题。
  • 39 |
  • 将 GBK 中原映射到 PUA 的字符根据 Unicode 5.0 改为映射到 CJK Ext-A 区。
  • 40 |
  • 修正对光标处于窗口边界时的检查。(fayewong 报告)
  • 41 |
  • 修正预览图片时部分内容被窗口标题栏覆盖的问题。(fayewong 报告)
  • 42 |
43 | 44 |

Nally 1.4.0

45 | 46 |
    47 |
  • 修正 GBK 特定低字节处理问题。
  • 48 |
  • 加入对属于 GBK 但不属于 CP936 的 80 个汉字的支持。
  • 49 |
  • 修正背景色不能延伸到行末的问题。(Evan 报告)
  • 50 |
  • 修正一些半透明背景绘制的问题。(fishy 报告)
  • 51 |
  • 修正输入到窗口边沿光标判断的问题。(fayewong)
  • 52 |
53 | -------------------------------------------------------------------------------- /Deploy/appcast.template.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ appName }} Changelog 6 | {{ link }} 7 | Most recent changes with links to {{ appName }} updates. 8 | en 9 | 10 | Version {{ version }} 11 | 14 | {{ date }} 15 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Deploy/global.css: -------------------------------------------------------------------------------- 1 | /* Global */ 2 | 3 | body 4 | { 5 | background-color: #F5F5F5; 6 | margin: 2px 20px; 7 | font-family: "Lucida Grande", "Verdana"; 8 | font-size: 12px; 9 | color: #3F4245; 10 | line-height: 1.4em; 11 | text-shadow: #ffffff 0px 1px 0px; 12 | -webkit-text-shadow: #ffffff 0px 1px 0px; 13 | -moz-text-shadow: #ffffff 0px 1px 0px; 14 | } 15 | 16 | /* Tag Overrides */ 17 | 18 | img 19 | { 20 | border: none; 21 | } 22 | 23 | h1 24 | { 25 | margin-bottom: 5px; 26 | } 27 | 28 | a, a:link, a:visited 29 | { 30 | color: #3F4245; 31 | } 32 | 33 | p 34 | { 35 | margin-top: 0px; 36 | } 37 | 38 | sup 39 | { 40 | font-size: 8px; 41 | } 42 | 43 | table, tr, td 44 | { 45 | font-size: 1em; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Deploy/nally.public.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIIDOzCCAi0GByqGSM44BAEwggIgAoIBAQC4RZqHmwSThmTMiE2pfN6muW1GnvlL 3 | h5TaPs7lHIxEV1io/TEIIpnblz0Q5YL28490Ai2DV9sZXD9V817oYEULRwVVe+kW 4 | 3bEECx/RLOFFaNhidjdMwBLUjUM/JGOf+UzuxfU9+Ra11QZqpEsVcf6pr2fhdY5d 5 | B65tKpJSGSsg1z1vnkguM9qULl22ianGddYPg+jf6wzkOJC+k4/cQwnqj9ZylDOJ 6 | Td582WD1rgxCnHbxbyRWTNwHcIhMcwRqPKhH/D+lnOcvD4tGI/LD3v00guexulIN 7 | ZUwCNbpOq+PLVCRJ+wwJ86eg5NwT5rzNvyihq33/gV09o4X8Qa4m2sZ5AhUAxra7 8 | VY7PA4j/K+m1Z7wwi2C/ZeUCggEAexpIRMg6GwZblnEsUk9riPrZFRLqRvCEpD4g 9 | AF7T0xvAGGwMmxivgzDcyuKN98oeif6bxGzU0x3LNIdbQsJqSimiTyaRXcbJjFg9 10 | ImQQISKuuUFnDbtop2bkkaJ+RQiXjYo0Tkd9HdEdpBOegHk5QSdr6BHLQxEvV7NI 11 | Bqt7GejAmhq6CvhQnWOCISwcom0/ONX+V+dufr009u/zJ47tHzDgeqWVtFrXHo4K 12 | 45u9fXxb+bC0R3ZWVE9B1dud/r/BqtcL6VWXs8wY1qvs3f+VZPG5D7AAu/Gykj42 13 | hv4QXVPUje00Hr44VVNwJ1+3Pt/iHo+U/qMmr2apjsjOcCFY/wOCAQYAAoIBAQCV 14 | ZOV0W7JPILwbg8eMgSZ0UFn2Q6W+htQQDOpVdtcKArPR6FYBUvX5H2MHicIDvZ0C 15 | MWI187Q0dA4rs+rQ4k925K0hPYr0UgxmzMxEnI4GOqC9Uto6n6Qt2S5BBMZdRAhU 16 | 3Aw5wEUjyLrbTVxEALkK+12aWLwefPTof7qFI/Ze/Hh6UkjQE5oPWW6BJh2zsKY6 17 | YPl4reZKJD35iMZERxXxsXL6K2/SbJy8kv5Pm6BUW4MUqApxryI2nBcXqWH0QmI3 18 | nRQwN7riiK6HVmKT4ukr+gZ0xIa2AAwQSTxklzBKSynJStNJ7wqJKiPxli4688z+ 19 | GIlflBLMkRaHFH4ofRTz 20 | -----END PUBLIC KEY----- 21 | -------------------------------------------------------------------------------- /Documents/graphics.graffle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Documents/graphics.graffle -------------------------------------------------------------------------------- /Documents/vtscore.txt: -------------------------------------------------------------------------------- 1 | VTTEST VT100/VT102 Compatibility Test Score Sheet 2 | 3 | Program and version: _____________________________________ Date: _________ 4 | 5 | Score: ____________ + Extra credit: ___________ = Final score: ___________ 6 | 7 | Check box if test passed. Score 1 point per check mark. 8 | Perfect score = 100 points. Extra credit at end. 9 | 10 | 1. Test of cursor movements 11 | 12 | [*] 1. Text inside frame of E's inside frame of *'s and +'s, 80 columns 13 | [ ] 2. Text inside frame of E's inside frame of *'s and +'s, 132 columns 14 | [*] 3. Cursor-control chars inside ESC sequences 15 | [*] 4. Leading 0's in ESC sequences 16 | 17 | 2. Test of screen features 18 | 19 | [*] 5. Three identical lines of *'s (test of wrap mode) 20 | [ ] 6. Test of tab setting/resetting 21 | [ ] 7. 132-column mode, light background 22 | [*] 8. 80-column mode, light background 23 | [ ] 9. 132-column mode, dark background 24 | [*] 10. 80-column mode, dark background 25 | [*] 11. Soft scroll down 26 | [*] 12. Soft scroll up / down 27 | [*] 13. Jump scroll down 28 | [*] 14. Jump scroll up / down 29 | [*] 15. Origin mode test (2 parts) 30 | 31 | Graphic Rendition test pattern, dark background 32 | 33 | [*] 16. Normal ("vanilla") 34 | [*] 17. Normal underlined distinct from normal 35 | [*] 18. Normal blink distinct from all above 36 | [*] 19. Normal underline blink distinct from all above 37 | [*] 20. Normal reverse ("negative") distinct from all above 38 | [*] 21. Normal underline reverse distinct from all above 39 | [*] 22. Normal blink reverse distinct from all above 40 | [*] 23. Normal underline blink reverse distinct from all above 41 | [*] 24. Bold distinct from all above 42 | [*] 25. Bold underlined distinct from all above 43 | [*] 26. Bold blink distinct from all above 44 | [*] 27. Bold underline blink distinct from all above 45 | [*] 28. Bold reverse ("negative") distinct from all above 46 | [*] 29. Bold underline reverse distinct from all above 47 | [*] 30. Bold blink reverse distinct from all above 48 | [*] 31. Bold underline blink reverse distinct from all above 49 | 50 | Graphic Rendition test pattern, light background 51 | 52 | [*] 32. Normal ("vanilla") 53 | [*] 33. Normal underlined distinct from normal 54 | [*] 34. Normal blink distinct from all above 55 | [*] 35. Normal underline blink distinct from all above 56 | [*] 36. Normal reverse ("negative") distinct from all above 57 | [*] 37. Normal underline reverse distinct from all above 58 | [*] 38. Normal blink reverse distinct from all above 59 | [*] 39. Normal underline blink reverse distinct from all above 60 | [*] 40. Bold distinct from all above 61 | [*] 41. Bold underlined distinct from all above 62 | [*] 42. Bold blink distinct from all above 63 | [*] 43. Bold underline blink distinct from all above 64 | [*] 44. Bold reverse ("negative") distinct from all above 65 | [*] 45. Bold underline reverse distinct from all above 66 | [*] 46. Bold blink reverse distinct from all above 67 | [*] 47. Bold underline blink reverse distinct from all above 68 | 69 | Save/Restore Cursor 70 | 71 | [*] 48. AAAA's correctly placed 72 | [ ] 49. Lines correctly rendered (middle of character cell) 73 | [ ] 50. Diamonds correctly rendered 74 | 75 | 3. Test of character sets 76 | 77 | [ ] 51. UK/National shows Pound Sterling sign in 3rd position 78 | [ ] 52. US ASCII shows number sign in 3rd position 79 | [ ] 53. SO/SI works (right columns identical with left columns) 80 | [ ] 54. True special graphics & line drawing chars, not simulated by ASCII 81 | 82 | 4. Test of double-sized chars 83 | 84 | Test 1 in 80-column mode: 85 | 86 | [ ] 55. Left margin correct 87 | [ ] 56. Width correct 88 | 89 | Test 2 in 80-column mode: 90 | 91 | [ ] 57. Left margin correct 92 | [ ] 58. Width correct 93 | 94 | Test 1 in 132-column mode: 95 | 96 | [ ] 59. Left margin correct 97 | [ ] 60. Width correct 98 | 99 | Test 2 in 132-column mode: 100 | 101 | [ ] 61. Left margin correct 102 | [ ] 62. Width correct 103 | 104 | [ ] 63. "The man programmer strikes again" test pattern 105 | [ ] 64. "Exactly half the box should remain" 106 | 107 | 5. Test of keyboard 108 | 109 | [ ] 65. LEDs. 110 | [ ] 66. Autorepeat 111 | [ ] 67. "Press each key" (ability to send each ASCII graphic char) 112 | [ ] 68. Arrow keys (ANSI/Cursor key mode reset) 113 | [ ] 69. Arrow keys (ANSI/Cursor key mode set) 114 | [ ] 70. Arrow keys VT52 mode 115 | [ ] 71. PF keys numeric mode 116 | [ ] 72. PF keys application mode 117 | [ ] 73. PF keys VT52 numeric mode 118 | [ ] 74. PF keys VT52 application mode 119 | [ ] 75. Send answerback message from keyboard 120 | [ ] 76. Ability to send every control character 121 | 122 | 6. Test of Terminal Reports 123 | 124 | [ ] 77. Respond to ENQ with answerback 125 | [ ] 78. Newline mode set 126 | [ ] 79. Newline mode reset 127 | [*] 80. Device status report 5 128 | [*] 81. Device status report 6 129 | [*] 82. Device attributes report 130 | [ ] 83. Request terminal parameters 0 131 | [ ] 84. Request terminal parameters 1 132 | 133 | 7. Test of VT52 submode 134 | 135 | [ ] 85. Centered rectangle 136 | [ ] 86. Normal character set 137 | [ ] 87. Graphics character set 138 | [ ] 88. Identify query 139 | 140 | 8. VT102 Features 141 | 142 | [*] 89. Insert/delete line, 80 columns 143 | [*] 90. Insert (character) mode, 80 columns 144 | [*] 91. Delete character, 80 columns 145 | [*] 92. Right column staggered by 1 (normal chars), 80 columns 146 | [ ] 93. Right column staggered by 1 (double-wide chars), 80 columns 147 | [*] 94. ANSI insert character, 80 columns 148 | [ ] 95. Insert/delete line, 132 columns 149 | [ ] 96. Insert (character) mode, 132 columns 150 | [ ] 97. Delete character, 132 columns 151 | [ ] 98. Right column staggered by 1 (normal chars), 132 columns 152 | [ ] 99. Right column staggered by 1 (double-wide chars), 132 columns 153 | [ ] 100. ANSI insert character, 132 columns 154 | 155 | 9. Extra credit 156 | 157 | [ ] 101. True soft (smooth) scroll 158 | [ ] 102. True underline 159 | [ ] 103. True blink 160 | [ ] 104. True double-high/wide lines, not simulated 161 | [ ] 105. Reset terminal (*) 162 | [ ] 106. Interpret controls (debug mode) (*) 163 | [ ] 107. Send BREAK (250 msec) (*) 164 | [ ] 108. Send Long BREAK (1.5 sec) (*) 165 | [ ] 109. Host-controlled transparent / controller print (*) 166 | [ ] 110. Host-controlled autoprint (*) 167 | 168 | (*) Features of VT100 not tested by vttest. 169 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Mengjuei Hsieh, University of California Irvine 2 | 3 | all: 4 | xcodebuild 5 | 6 | clean: 7 | xcodebuild clean; \ 8 | rm -fr build; \ 9 | rm -f Nally.xcodeproj/${USER}.* 10 | 11 | install: all 12 | rm -r /Applications/Nally.app; mv build/Release/Nally.app /Applications/ 13 | 14 | test: all 15 | build/Release/Nally.app/Contents/MacOS/Nally 16 | 17 | release: all 18 | python Scripts/package.py build/Release/Nally.app http://nally.googlecode.com/files 19 | -------------------------------------------------------------------------------- /Nally.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.network.client 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Nally.xcodeproj/xcshareddata/xcschemes/Nally-Force_zhTW.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 55 | 57 | 63 | 64 | 65 | 66 | 67 | 68 | 74 | 76 | 82 | 83 | 84 | 85 | 87 | 88 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /Nally.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Nally.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Nally.xcworkspace/xcshareddata/xcschemes/Nally-Release.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /Nally.xcworkspace/xcshareddata/xcschemes/Nally.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 14 | 20 | 21 | 22 | 23 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 44 | 46 | 52 | 53 | 54 | 55 | 56 | 59 | 60 | 61 | 67 | 68 | 70 | 71 | 74 | 75 | 76 | -------------------------------------------------------------------------------- /Nally.xcworkspace/xcuserdata/rayer.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Nally-Release.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 5 11 | 12 | Nally.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Nally/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "scale" : "1x", 6 | "size" : "16x16" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "scale" : "2x", 11 | "size" : "16x16" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "scale" : "1x", 16 | "size" : "32x32" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "scale" : "2x", 21 | "size" : "32x32" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "scale" : "1x", 26 | "size" : "128x128" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "scale" : "2x", 31 | "size" : "128x128" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "scale" : "1x", 36 | "size" : "256x256" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "scale" : "2x", 41 | "size" : "256x256" 42 | }, 43 | { 44 | "size" : "512x512", 45 | "idiom" : "mac", 46 | "filename" : "icon512x512.png", 47 | "scale" : "1x" 48 | }, 49 | { 50 | "size" : "512x512", 51 | "idiom" : "mac", 52 | "filename" : "icon512x512@2x.png", 53 | "scale" : "2x" 54 | } 55 | ], 56 | "info" : { 57 | "version" : 1, 58 | "author" : "xcode" 59 | } 60 | } -------------------------------------------------------------------------------- /Nally/Images.xcassets/AppIcon.appiconset/icon512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Nally/Images.xcassets/AppIcon.appiconset/icon512x512.png -------------------------------------------------------------------------------- /Nally/Images.xcassets/AppIcon.appiconset/icon512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Nally/Images.xcassets/AppIcon.appiconset/icon512x512@2x.png -------------------------------------------------------------------------------- /Plugins/HelloNally/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Plugins/HelloNally/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Plugins/HelloNally/English.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Plugins/HelloNally/English.lproj/Localizable.strings -------------------------------------------------------------------------------- /Plugins/HelloNally/HelloNally.h: -------------------------------------------------------------------------------- 1 | // 2 | // HelloNally.h 3 | // HelloNally 4 | // 5 | // Created by Jjgod Jiang on 8/17/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLBundle.h" 11 | 12 | @interface HelloNally : YLBundle { 13 | 14 | } 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /Plugins/HelloNally/HelloNally.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Plugins/HelloNally/HelloNally.icns -------------------------------------------------------------------------------- /Plugins/HelloNally/HelloNally.m: -------------------------------------------------------------------------------- 1 | // 2 | // HelloNally.m 3 | // HelloNally 4 | // 5 | // Created by Jjgod Jiang on 8/17/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import "HelloNally.h" 10 | 11 | @implementation HelloNally 12 | 13 | - (id) init 14 | { 15 | if (self = [super init]) 16 | { 17 | // note: we can't use - NSLocalizedString(@"BundleDescription", ""); 18 | // because the main bundle is always the app, so we need to target our 19 | // own bundle this way ... and since these are localized to this bundle/class 20 | description = [[NSBundle bundleForClass: [self class]] localizedStringForKey: @"BundleDescription" 21 | value: @"" 22 | table: nil]; 23 | title = [[NSBundle bundleForClass: [self class]] localizedStringForKey: @"BundleTitle" 24 | value: @"" 25 | table: nil]; 26 | NSLog(@"Loading Bundle HelloNally."); 27 | [self addMenuItemWithTitle: @"Hey" 28 | action: nil 29 | keyEquivalent: @""]; 30 | } 31 | 32 | return self; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /Plugins/HelloNally/HelloNally.xcodeproj/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Plugins/HelloNally/HelloNally.xcodeproj/TemplateIcon.icns -------------------------------------------------------------------------------- /Plugins/HelloNally/HelloNally_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'HelloNally' target in the 'HelloNally' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Plugins/HelloNally/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleName 10 | ${PRODUCT_NAME} 11 | CFBundleIconFile 12 | HelloNally.icns 13 | CFBundleIdentifier 14 | org.yllan.Nally.Plugin.${PRODUCT_NAME:identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSPrincipalClass 24 | HelloNally 25 | 26 | 27 | -------------------------------------------------------------------------------- /Plugins/ImagePreviewer/English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Plugins/ImagePreviewer/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Plugins/ImagePreviewer/English.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Plugins/ImagePreviewer/English.lproj/Localizable.strings -------------------------------------------------------------------------------- /Plugins/ImagePreviewer/ImagePreviewer.h: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePreviewer.h 3 | // ImagePreviewer 4 | // 5 | // Created by Jjgod Jiang on 8/18/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "YLBundle.h" 11 | 12 | @interface ImagePreviewer : YLBundle { 13 | BOOL enabled; 14 | } 15 | 16 | - (IBAction) flipEnabled: (id) sender; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /Plugins/ImagePreviewer/ImagePreviewer.m: -------------------------------------------------------------------------------- 1 | // 2 | // ImagePreviewer.m 3 | // ImagePreviewer 4 | // 5 | // Created by Jjgod Jiang on 8/18/08. 6 | // Copyright 2008 Jjgod Jiang. All rights reserved. 7 | // 8 | 9 | #import "ImagePreviewer.h" 10 | 11 | @implementation ImagePreviewer 12 | 13 | - (id) init 14 | { 15 | if (self = [super init]) 16 | { 17 | // note: we can't use - NSLocalizedString(@"BundleDescription", ""); 18 | // because the main bundle is always the app, so we need to target our 19 | // own bundle this way ... and since these are localized to this bundle/class 20 | description = [self localizedStringForKey: @"BundleDescription"]; 21 | title = [self localizedStringForKey: @"BundleTitle"]; 22 | enabled = YES; 23 | 24 | NSLog(@"Loading Bundle ImagePreviewer."); 25 | 26 | NSMenuItem *item = [[NSMenuItem alloc] initWithTitle: [self localizedStringForKey: @"EnableImagePreview"] 27 | action: @selector(flipEnabled:) 28 | keyEquivalent: @""]; 29 | [item setState: NSOnState]; 30 | [self addMenuItem: item]; 31 | [item release]; 32 | } 33 | 34 | return self; 35 | } 36 | 37 | - (IBAction) flipEnabled: (id) sender 38 | { 39 | enabled = !enabled; 40 | [(NSMenuItem *) sender setState: enabled ? NSOnState : NSOffState]; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /Plugins/ImagePreviewer/ImagePreviewer.xcodeproj/TemplateIcon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Plugins/ImagePreviewer/ImagePreviewer.xcodeproj/TemplateIcon.icns -------------------------------------------------------------------------------- /Plugins/ImagePreviewer/ImagePreviewer_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'ImagePreviewer' target in the 'ImagePreviewer' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /Plugins/ImagePreviewer/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleName 10 | ${PRODUCT_NAME} 11 | CFBundleIconFile 12 | 13 | CFBundleIdentifier 14 | org.yllan.Nally.Plugin.${PRODUCT_NAME:identifier} 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundlePackageType 18 | BNDL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSPrincipalClass 24 | ImagePreviewer 25 | 26 | 27 | -------------------------------------------------------------------------------- /Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment the next line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | target 'Nally' do 5 | # Comment the next line if you don't want to use dynamic frameworks 6 | use_frameworks! 7 | platform :osx, '10.12' 8 | # Pods for Nally 9 | pod 'ImgurAnonymousAPIClient', :git => 'https://github.com/nolanw/ImgurAnonymousAPIClient.git', :tag => 'v0.3.2' 10 | 11 | end 12 | 13 | target 'TextSuiteTests' do 14 | # Comment the next line if you don't want to use dynamic frameworks 15 | use_frameworks! 16 | platform :osx, '10.12' 17 | 18 | # Pods for TextSuiteTests 19 | 20 | end 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nally 2 | 3 | Open-Source telnet/ssh BBS client. 4 | 5 | Build status : 6 | 7 | - ![](https://travis-ci.com/Rayer/nally.svg?branch=develop) Develop Branch 8 | 9 | - ![](https://travis-ci.com/Rayer/nally.svg?branch=master) Master Branch 10 | 11 | ## Announcement 12 | 13 | 支援ssh連線,以ptt為例`ssh://bbs@ptt.cc`即可。 注意,要有**bbs@**。 14 | 15 | ## Issue Tracking 16 | 17 | [YouTrack追蹤頁面](https://irisnode.myjetbrains.com/youtrack/)顯示了所有的開發中項目,如果有issue回報或者新功能request,請在GitHub的issue發出,或者也可以直接發在YouTrack。 18 | 19 | ## History 20 | 21 | ### 2.0.1 22 | 23 | Release Date : 2019.03.28 24 | 25 | 這個release以bug fix為主,詳細請參考YouTrack追蹤頁面 26 | 27 | - [Nally-8](https://irisnode.myjetbrains.com/youtrack/issue/NALLY-8) 修正了Travis CI的問題,現在可以正常顯示build status了 28 | - [Nally-13](https://irisnode.myjetbrains.com/youtrack/issue/NALLY-13) 修正Preference選單中,頁籤切換會鬼影幢幢的問題。 29 | - [Nally-15](https://irisnode.myjetbrains.com/youtrack/issue/NALLY-15) 用一個workaround修正了當視窗焦點切換來切換去的時候,Smart Paste產生的Alert Panel無法正確消失而卡在螢幕上的問題。這個沒有太好的解法,目前是讓這個alert panel在10秒內要是沒消失的話,會有一個Dismiss按鈕讓你把它按掉。 30 | - [Nally-18](https://irisnode.myjetbrains.com/youtrack/issue/NALLY-18) 修正一個當站台列表內有儲存帳號密碼時會造成整個死當的問題。 31 | 32 | 33 | ### 2.0.0 34 | 35 | Release Date : 2019.03.18 36 | 37 | 這個版本暫時來說是最後一個版本了,已經把所有本來想要增加的功能都增加上去了。 38 | 39 | * Smart Paste(智慧拼貼) : 按下功能列右上角的"S"按鈕啟動。Smart Paste在剪貼簿裡面的資料合乎如下條件時,貼上(⌘+V)時會替使用者做如下的轉換: 40 | - 當剪貼簿裡面是一個URL時,如果URL的長度大於40個字元,會自動幫使用者貼上TinyURL縮址過的網址。 41 | - 當剪貼簿裡面是圖形資料時(通常是來自於使用者使用Mac風格的畫面擷取: `⌘+shift+ctrl+3` 或者 `⌘+shift+ctrl+4`),會幫使用者自動上傳上Imgur並且貼上Imgur網址。 42 | - 當剪貼簿裡面是圖像檔案時(通常來自於對圖形檔案`⌘+C`,或者對Photos App的照片`⌘+C`等等),同樣會自動上傳上Imgur並且貼上Imgur網址。 43 | - 其他情況下,本來行為是什麼就是什麼。 44 | 45 | ### 1.5.2 46 | 47 | Release date : 2019.03.17 48 | 49 | - 當貼上imgur或者試圖產生tinyurl時,會有一個視窗告訴你現在正在做甚麼以及防止在這動作完成以前繼續貼圖或者貼網址。 50 | - 現在可以直接cmd-c任何圖案以後直接貼上imgur了,同樣的按下右鍵選擇「貼上imgur」即可 51 | 52 | 53 | ### 1.5.1 54 | 55 | Release date : 2019.03.13 56 | 57 | #### 對使用者來說 58 | 59 | * 增加了更多的Search image by Google的格式,現在`.tiff`, `.png`以及`.gif`都可以被image search了。 60 | * 現在支援了paste to imgur,只要使用傳統的Mac剪貼螢幕到剪貼簿的快速鍵(`shift-ctrl-cmd-3`跟`shift-ctrl-cmd-4`)剪貼下來的圖案,現在可以從右鍵選單直接送上imgur並且回傳網址。 61 | * 不過`cmd+c`直接拷貝照片目前無法送上imgur,這會在下個版本推出。 62 | * 按下Post to Imgur以後需要一點時間網址才會傳回來,大概一兩秒,這段時間bbs view仍然可以操作...會造成貼到意料之外的地方。 63 | * 但是我覺得直接block讓他轉圈圈也不是好主意,沒辦法。 64 | 65 | #### 對開發者來說 66 | 67 | * 增加了CocoaPods的支援。 68 | * 增加了TravisCI的支援,但是由於CocoaPods加入以後組態搞不定,所以目前還是壞掉的狀態。 69 | * 現在應該可以在XCode10底下編譯了。SDK10.12~10.14都測過,應該沒啥問題。 70 | 71 | ### 1.5.0 (修改版自Rayer) 72 | 73 | * Release date : 2019.03.10 74 | * 增加了Google image search的功能。當選擇了一個以.jpg或者.jpeg為結尾的網址的時候,右鍵選單將會增加Search by Google Image. 75 | * 增加了貼上Tinyurl的功能。當拷貝一個網址時,且Telnet視窗內沒有選擇任何文字時,將會有Paste by TinyURL的選項。 76 | * 由於現在的XCode已經不支援10.6的Deployment Target,很遺憾的目前Deployment Target必須要至少macOS 10.12以上才能執行 77 | * 同樣原因,重新編譯後原因不明有一個小Bug : 當打開了複數個BBS,滑鼠游標無法點選上面的BBS Tag,包含關閉視窗的X。請用快速鍵cmd + <- / cmd + -> / cmd + w來執行選擇左邊分頁/右邊分頁/關閉分頁的動作。 78 | 79 | 感謝前人的contribution,也希望這個open source的BBS Client能一直傳承下去。 80 | 81 | ### 1.4.9 82 | 83 | * 修正短網址打不開的 regression 84 | * 加入自動短網址服務選擇,例如 85 | 86 | nxMg => ppt.cc 87 | YFIIB => 0rz.tw 88 | cbt6wym => tinyurl.com 89 | mid=1726264 => pixiv_member 90 | id=28497387 => pixiv_illust 91 | sm1885034 => niconico 92 | 93 | * 修正 opt-click URL 不能在背景打開 browser 的 bug。現在可以了。 94 | * 很遺憾,因為用了 block 所以把 deployment target 升高到 10.6。 95 | 96 | ### 1.4.8 97 | 98 | * 修正 10.8 下藍色框的問題。 99 | * 加入 uranusjr 貢獻的 Cmd+上下鍵對應到 PageUp/PageDown。 100 | * 打開 URL 的一些修正。 101 | 102 | ### 1.4.7 103 | 104 | * 修正 crash。 105 | * 使用 uranusjr 開發的功能,可以設定要不要用 image previewer。 106 | * 可同時開啓多個 URL。 107 | 108 | ### 1.4.6 109 | 110 | * 修正 Paste wrap 遇到過長英文會 hang 的 bug。 111 | * Paste wrap 加上避頭尾點的功能。 112 | -------------------------------------------------------------------------------- /Resources/Credits.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1671\cocoasubrtf200 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica-Bold;\f1\fswiss\fcharset0 Helvetica;\f2\fswiss\fcharset0 Helvetica-Oblique; 3 | } 4 | {\colortbl;\red255\green255\blue255;} 5 | {\*\expandedcolortbl;;} 6 | \paperw12240\paperh15840\vieww10920\viewh13360\viewkind0 7 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 8 | 9 | \f0\b\fs36 \cf0 Contributors\ 10 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li560\pardirnatural\partightenfactor0 11 | 12 | \f1\b0\fs24 \cf0 \ 13 | yllan - Maintainer\ 14 | Rayer - Maintainer\ 15 | jjgod - GBK encoding\ 16 | chrisliu - zh-TW Localization\ 17 | chumsdock - Interface suggestion\ 18 | evansfu - Icon\ 19 | mjhsieh - Terminal emulator, HCI, misc.\ 20 | \ 21 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 22 | 23 | \f0\b\fs36 \cf0 Thanks To 24 | \f1\b0\fs24 \ 25 | \ 26 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li560\pardirnatural\partightenfactor0 27 | 28 | \f2\i \cf0 lukhnos\ 29 | Chao-Yi Wang\ 30 | Yu-Chu Chang\ 31 | ericsk\ 32 | digdog\ 33 | sffish\ 34 | zonble 35 | \f1\i0 \ 36 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 37 | \cf0 \ 38 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 39 | 40 | \f0\b\fs36 \cf0 Used Frameworks 41 | \f1\b0\fs24 \ 42 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural\partightenfactor0 43 | 44 | \f0\b \cf0 \ 45 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li580\pardirnatural\partightenfactor0 46 | \cf0 Sparkle 47 | \f1\b0 by 48 | \f2\i Andy Matuschak, 49 | \f1\i0 \ 50 | {\field{\*\fldinst{HYPERLINK "http://sparkle.andymatuschak.org/"}}{\fldrslt http://sparkle.andymatuschak.org/}}\ 51 | \ 52 | 53 | \f0\b PSMTabBarControl 54 | \f1\b0 by 55 | \f2\i John Pannell, 56 | \f1\i0 \ 57 | {\field{\*\fldinst{HYPERLINK "http://www.positivespinmedia.com/dev/PSMTabBarControl.html"}}{\fldrslt http://www.positivespinmedia.com/dev/PSMTabBarControl.html}}\ 58 | \ 59 | 60 | \f0\b DBPrefsWindowController 61 | \f1\b0 by 62 | \f2\i Dave Batton 63 | \f1\i0 \ 64 | {\field{\*\fldinst{HYPERLINK "http://www.mere-mortal-software.com/blog/sourcecode.php"}}{\fldrslt http://www.mere-mortal-software.com/blog/sourcecode.php}}\ 65 | \ 66 | \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0 67 | \cf0 68 | \f0\b HMBlkAppKit 69 | \f1\b0 by Shiira Project\ 70 | 71 | \f2\i This software uses source codes and image resources copyrighted by Shiira Project. 72 | \f1\i0 \ 73 | {\field{\*\fldinst{HYPERLINK "http://shiira.jp/"}}{\fldrslt http://shiira.jp/}}\ 74 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li580\pardirnatural\partightenfactor0 75 | \cf0 \ 76 | PTY code from 77 | \f0\b iTerm 78 | \f1\b0 by 79 | \f2\i Fabian 80 | \f1\i0 and 81 | \f2\i Ujwal S. Setlur\ 82 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li580\pardirnatural\partightenfactor0 83 | {\field{\*\fldinst{HYPERLINK "http://iterm.sourceforge.net/"}}{\fldrslt 84 | \f1\i0 \cf0 http://iterm.sourceforge.net/}} 85 | \f1\i0 \ 86 | \ 87 | Some code from 88 | \f0\b Putty 89 | \f1\b0 by 90 | \f2\i Simon Tatham 91 | \f1\i0 \ 92 | {\field{\*\fldinst{HYPERLINK "http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html"}}{\fldrslt http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html}}\ 93 | \ 94 | Imgur Anonymous API Client by nolanw\ 95 | \pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\li580\pardirnatural\partightenfactor0 96 | {\field{\*\fldinst{HYPERLINK "https://github.com/nolanw/ImgurAnonymousAPIClient"}}{\fldrslt \cf0 https://github.com/nolanw/ImgurAnonymousAPIClient}}} -------------------------------------------------------------------------------- /Resources/DragonBall.v1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/DragonBall.v1.png -------------------------------------------------------------------------------- /Resources/English.lproj/Localizable.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/English.lproj/Localizable.strings -------------------------------------------------------------------------------- /Resources/English.lproj/MainMenu.English.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/English.lproj/MainMenu.English.strings -------------------------------------------------------------------------------- /Resources/English.lproj/Preferences.English.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/English.lproj/Preferences.English.strings -------------------------------------------------------------------------------- /Resources/HUDSave.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/HUDSave.tiff -------------------------------------------------------------------------------- /Resources/HUDSaveActive.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/HUDSaveActive.tiff -------------------------------------------------------------------------------- /Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | Nally 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleGetInfoString 12 | 2.0.4 13 | CFBundleIdentifier 14 | $(PRODUCT_BUNDLE_IDENTIFIER) 15 | CFBundleInfoDictionaryVersion 16 | 6.0 17 | CFBundleName 18 | ${PRODUCT_NAME} 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 2.0.4 23 | CFBundleSignature 24 | naly 25 | CFBundleURLTypes 26 | 27 | 28 | CFBundleURLName 29 | Telnet URL 30 | CFBundleURLSchemes 31 | 32 | telnet 33 | bbs 34 | 35 | 36 | 37 | CFBundleURLName 38 | SSH URL 39 | CFBundleURLSchemes 40 | 41 | ssh 42 | 43 | 44 | 45 | CFBundleVersion 46 | 2.0.4 47 | ImgurAnonymousAPIClientID 48 | e4b9b7346da763f 49 | LSApplicationCategoryType 50 | public.app-category.social-networking 51 | LSMinimumSystemVersion 52 | 10.12.0 53 | LSMinimumSystemVersionByArchitecture 54 | 55 | i386 56 | 10.12.0 57 | ppc 58 | 10.12.0 59 | ppc64 60 | 10.12.0 61 | x86_64 62 | 10.12.0 63 | 64 | NSAppTransportSecurity 65 | 66 | NSAllowsArbitraryLoads 67 | 68 | 69 | NSHumanReadableCopyright 70 | © 2010, yllan.org (and © 2019, Rayer) 71 | NSMainNibFile 72 | MainMenu 73 | NSPrincipalClass 74 | YLApplication 75 | 76 | 77 | -------------------------------------------------------------------------------- /Resources/Whit.aiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/Whit.aiff -------------------------------------------------------------------------------- /Resources/bookmark.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/bookmark.pdf -------------------------------------------------------------------------------- /Resources/connect.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/connect.pdf -------------------------------------------------------------------------------- /Resources/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/icon.icns -------------------------------------------------------------------------------- /Resources/message.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/message.pdf -------------------------------------------------------------------------------- /Resources/offline.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/offline.pdf -------------------------------------------------------------------------------- /Resources/reload.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/reload.pdf -------------------------------------------------------------------------------- /Resources/sleep.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/sleep.pdf -------------------------------------------------------------------------------- /Resources/zh_CN.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Sheet Title */ 2 | "Are you sure you want to quit Nally?" = "您确定要退出 Nally 吗?"; 3 | 4 | /* Sheet Title */ 5 | "Are you sure you want to close this tab?" = "您确定要关闭这个标签吗?"; 6 | 7 | /* Default Button */ 8 | "Close" = "关闭"; 9 | 10 | /* Cancel Button */ 11 | "Cancel" = "取消"; 12 | 13 | /* Menu */ 14 | "Lookup in Dictionary" = "查字典"; 15 | "Copy" = "复制"; 16 | "Open mutiple URLs" = "打开多个链结"; 17 | 18 | /* Default Button */ 19 | "Quit" = "退出"; 20 | 21 | /* Sheet Message */ 22 | "There are %d tabs open in Nally. Do you want to quit anyway?" = "还有 %d 个标签正在连接中,您确定要退出 Welly?"; 23 | 24 | /* Sheet Message */ 25 | "The connection is still alive. If you close this tab, the connection will be lost. Do you want to close this tab anyway?" = "此连接未断开。若您关闭这个标签会强制断开连接。您确定要关闭这个标签吗?"; 26 | 27 | /* Preferences */ 28 | "General" = "一般"; 29 | 30 | /* Preferences */ 31 | "Colors" = "颜色"; 32 | 33 | /* Preferences */ 34 | "Fonts" = "字体"; 35 | 36 | /* Preferences */ 37 | "Connection" = "连接"; 38 | "Paste TinyURL" = "轉換成TinyURL"; 39 | "It may take several seconds, please wait" = "這可能會需要幾秒,請稍待"; 40 | "Pasting to imgur..." = "貼上imgur.com"; 41 | "Unable to paste now..." = "目前無法貼上,其他動作進行中"; 42 | "Converting URL to TinyURL..." = "正在轉換網址成TinyURL..."; 43 | "Paste image to Imgur" = "將這張圖案貼上Imgur"; 44 | 45 | "About SmartPaste" = "Smart Paste(拼貼小幫手)"; 46 | "SmartPasteInformation" = "拼貼小幫手已經啟動。\n\n拼貼小幫手將會幫你把你系統剪貼簿的內容(通常來講當你按下⌘+c來拷貝某些文字圖案,以及當你用Mac Style的screenshot(⌘+shift+ctrl+3(or4)將截圖貼入剪貼簿)時,拼貼小幫手會在你貼上Nally的時候(⌘+v)幫你自動轉換資料 : \n\n1. 如果你剪下的是一串網址,而且這網址大於40個字元,拼貼小幫手將幫你TinyURL縮網址。\n2. 如果剪貼了圖片(通常就是Mac風格的screenshot),會自動幫你轉換成Imgur.\n3. 如果剪貼了一個圖形檔案,比方說對著photo或者圖片檔案下⌘+c,也會自動幫你轉換成Imgur.\n4. 其他情況下,你剪下什麼就會按原樣貼上什麼。"; 47 | 48 | "Dismiss" = "關閉"; -------------------------------------------------------------------------------- /Resources/zh_CN.lproj/MainMenu.zh_CN.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/zh_CN.lproj/MainMenu.zh_CN.strings -------------------------------------------------------------------------------- /Resources/zh_CN.lproj/Preferences.zh_CN.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/zh_CN.lproj/Preferences.zh_CN.strings -------------------------------------------------------------------------------- /Resources/zh_TW.lproj/Localizable.strings: -------------------------------------------------------------------------------- 1 | /* Sheet Title */ 2 | "Are you sure you want to quit Nally?" = "確定要結束 Nally?"; 3 | 4 | /* Sheet Title */ 5 | "Are you sure you want to close this tab?" = "確定要關閉標籤頁?"; 6 | 7 | /* Default Button */ 8 | "Close" = "關閉"; 9 | 10 | /* Cancel Button */ 11 | "Cancel" = "取消"; 12 | 13 | /* Menu */ 14 | "Lookup in Dictionary" = "查詢字典"; 15 | "Copy" = "拷貝"; 16 | "Open mutiple URLs" = "開啓多個網址"; 17 | 18 | /* Default Button */ 19 | "Quit" = "結束"; 20 | 21 | /* Sheet Message */ 22 | "There are %d tabs open in Nally. Do you want to quit anyway?" = "還有 %d 個標籤頁正在連線中,您確定要結束 Nally?"; 23 | 24 | /* Sheet Message */ 25 | "The connection is still alive. If you close this tab, the connection will be lost. Do you want to close this tab anyway?" = "此連線未結束。若您關閉這個標籤頁會強迫斷線。您確定要關閉這個標籤頁嗎?"; 26 | 27 | /* Preferences */ 28 | "General" = "一般"; 29 | 30 | /* Preferences */ 31 | "Colors" = "顏色"; 32 | 33 | /* Preferences */ 34 | "Fonts" = "字形"; 35 | 36 | /* Preferences */ 37 | "Connection" = "連線"; 38 | 39 | "Paste TinyURL" = "轉換成TinyURL"; 40 | "It may take several seconds, please wait" = "這可能會需要幾秒,請稍待"; 41 | "Pasting to imgur..." = "貼上imgur.com"; 42 | "Unable to paste now..." = "目前無法貼上,其他動作進行中"; 43 | "Converting URL to TinyURL..." = "正在轉換網址成TinyURL..."; 44 | "Paste image to Imgur" = "將這張圖案貼上Imgur"; 45 | 46 | "About SmartPaste" = "Smart Paste(拼貼小幫手)"; 47 | "SmartPasteInformation" = "拼貼小幫手已經啟動。\n\n拼貼小幫手將會幫你把你系統剪貼簿的內容(通常來講當你按下⌘+c來拷貝某些文字圖案,以及當你用Mac Style的screenshot(⌘+shift+ctrl+3(or4)將截圖貼入剪貼簿)時,拼貼小幫手會在你貼上Nally的時候(⌘+v)幫你自動轉換資料 : \n\n1. 如果你剪下的是一串網址,而且這網址大於40個字元,拼貼小幫手將幫你TinyURL縮網址。\n2. 如果剪貼了圖片(通常就是Mac風格的screenshot),會自動幫你轉換成Imgur.\n3. 如果剪貼了一個圖形檔案,比方說對著photo或者圖片檔案下⌘+c,也會自動幫你轉換成Imgur.\n4. 其他情況下,你剪下什麼就會按原樣貼上什麼。"; 48 | 49 | "Dismiss" = "關閉"; -------------------------------------------------------------------------------- /Resources/zh_TW.lproj/MainMenu.zh_TW.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/zh_TW.lproj/MainMenu.zh_TW.strings -------------------------------------------------------------------------------- /Resources/zh_TW.lproj/Preferences.zh_TW.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Rayer/nally/cf51932a0adc9eb8c680237e028ff28173c7ec47/Resources/zh_TW.lproj/Preferences.zh_TW.strings -------------------------------------------------------------------------------- /Scripts/package.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Package a bundle and generate Sparkle appcasts for release 3 | 4 | import sys, os, commands, time, plistlib, markdown2 5 | 6 | try: 7 | from jinja2 import Environment, FileSystemLoader 8 | except: 9 | print "Install jinja2 first." 10 | sys.exit(1) 11 | 12 | def parent_url(url): 13 | return url[:url.rfind("/")]; 14 | 15 | def remove_if_exists(file): 16 | if os.path.isfile(file): 17 | os.remove(file) 18 | 19 | def package_bundle(bundle_path, zip_parent): 20 | """Package a bundle and create the appcast, input: 21 | 22 | * A built bundle with Contents/Info.plist, must have SUFeedURL 23 | for Sparkle. 24 | * ~/.ssh/.private.pem to sign the zip""" 25 | 26 | plist = plistlib.readPlist("%s/Contents/Info.plist" % bundle_path) 27 | bundle_name = plist["CFBundleName"] 28 | appcast_url = plist["SUFeedURL"] 29 | bundle_version = plist["CFBundleVersion"] 30 | zip = "%s-%s.zip" % (bundle_name, bundle_version) 31 | zip_url = "%s/%s" % (zip_parent, zip) 32 | priv_key = os.path.expanduser("~/.ssh/%s.private.pem" % bundle_name.lower()) 33 | date = time.strftime("%a, %d %b %Y %H:%M:%S %z") 34 | 35 | print "[PACK] Building %s..." % zip 36 | 37 | cwd = os.getcwd(); 38 | os.chdir(os.path.dirname(bundle_path)) 39 | os.system("zip -qry %s/%s %s" % (cwd, zip, os.path.basename(bundle_path))) 40 | os.chdir(cwd) 41 | 42 | print "[PACK] Signing %s..." % zip 43 | signed = commands.getoutput('openssl dgst -sha1 -binary < "%s" | '\ 44 | 'openssl dgst -dss1 -sign "%s" | '\ 45 | 'openssl enc -base64' % (zip, priv_key)) 46 | 47 | env = Environment(loader=FileSystemLoader(sys.path[0])) 48 | template = env.get_template("appcast.template.xml") 49 | 50 | for lang in [ "en", "zh_CN", "zh_TW" ]: 51 | if lang == "en": 52 | suffix = "" 53 | else: 54 | suffix = ".%s" % lang 55 | relnotes = markdown2.markdown_path("Changelog%s.markdown" % suffix) 56 | appcast = "%s%s.xml" % (bundle_name, suffix) 57 | print "[PACK] Generating %s..." % appcast 58 | output = open(appcast, "w") 59 | 60 | output.write(template.render(appName = bundle_name, 61 | link = appcast_url, 62 | relNotes= relnotes, 63 | url = zip_url, 64 | date = date, 65 | version = bundle_version, 66 | length = os.path.getsize(zip), 67 | signed = signed).encode("utf-8")) 68 | 69 | output.close() 70 | 71 | print "Done! Please publish %s to %s." % (zip, zip_url) 72 | 73 | if __name__ == '__main__': 74 | if len(sys.argv) < 3: 75 | print("usage: %s " % sys.argv[0]) 76 | sys.exit(1) 77 | 78 | package_bundle(sys.argv[1], sys.argv[2]) 79 | 80 | -------------------------------------------------------------------------------- /Tests/TextSuiteTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // TestTextSuite.h 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/5/10. 6 | // Copyright 2010 HTC. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface TextSuiteTests : SenTestCase { 12 | 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Tests/TextSuiteTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // TestTextSuite.m 3 | // Nally 4 | // 5 | // Created by Yung-Luen Lan on 12/5/10. 6 | // Copyright 2010 HTC. All rights reserved. 7 | // 8 | 9 | #import "TextSuiteTests.h" 10 | #import "YLTextSuite.h" 11 | #import "encoding.h" 12 | #import "YLApplicationKitAddition.h" 13 | 14 | @implementation TextSuiteTests 15 | - (void) setUp 16 | { 17 | init_table(); 18 | } 19 | 20 | - (void) tearDown 21 | { 22 | 23 | } 24 | 25 | - (void) testWrapLine 26 | { 27 | YLTextSuite *t = [YLTextSuite new]; 28 | 29 | STAssertEqualObjects([t wrapText: @"aaaaa" withLength: 5 encoding: YLBig5Encoding], @"aaaaa", @"No Wrap"); 30 | STAssertEqualObjects([t wrapText: @"aaaaaa" withLength: 5 encoding: YLBig5Encoding], @"aaaaa\na", @"Force Wrap"); 31 | STAssertEqualObjects([t wrapText: @"aaa aaa" withLength: 5 encoding: YLBig5Encoding], @"aaa \naaa", @"Simple Wrap"); 32 | STAssertEqualObjects([t wrapText: @"中文字" withLength: 5 encoding: YLBig5Encoding], @"中文\n字", @"Chinese Wrap"); 33 | STAssertEqualObjects([t wrapText: @"中文字" withLength: 4 encoding: YLBig5Encoding], @"中文\n字", @"Chinese Wrap"); 34 | STAssertEqualObjects([t wrapText: @"中a文字" withLength: 3 encoding: YLBig5Encoding], @"中a\n文\n字", @"Chinese Wrap"); 35 | STAssertEqualObjects([t wrapText: @"aa aa ,aa" withLength: 6 encoding: YLBig5Encoding], @"aa \naa ,aa", @"Prohibit Head"); 36 | STAssertEqualObjects([t wrapText: @"aa ,aa" withLength: 5 encoding: YLBig5Encoding], @"aa ,a\na", @"Prohibit Head Pull All Line"); 37 | 38 | STAssertEqualObjects([t wrapText: @"aaa(aa" withLength: 5 encoding: YLBig5Encoding], @"aaa\n(aa", @"Prohibit Tail"); 39 | STAssertEqualObjects([t wrapText: @"aaa)aa" withLength: 5 encoding: YLBig5Encoding], @"aaa)\naa", @"Prohibit Head"); 40 | 41 | STAssertEqualObjects([t wrapText: @"你好不好。" withLength: 8 encoding: YLBig5Encoding], @"你好不\n好。", @"Prohibit Head"); 42 | STAssertEqualObjects([t wrapText: @"中文" withLength: 1 encoding: YLBig5Encoding], @"中\n文", @"Force Add"); 43 | 44 | [t release]; 45 | } 46 | @end 47 | -------------------------------------------------------------------------------- /TextSuiteTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | --------------------------------------------------------------------------------