📄 easywindow.m
字号:
#import <AppKit/AppKit.h>#import "EasyWindow.h"#import "DRController.h"@implementation EasyWindow- (void)awakeFromNib{ [self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];}- (unsigned int) draggingEnteredOrUpdated:sender{ NSPasteboard *pboard = [sender draggingPasteboard]; id source = [sender draggingSource]; NSString *type = [pboard availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]]; if ([source respondsToSelector:@selector(window)] && [source window] == self) return NSDragOperationNone; if (type) { if ([type isEqualToString:NSFilenamesPboardType]) { NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType]; unsigned i = [filenames count]; NSFileManager *fm = [NSFileManager defaultManager]; BOOL isDir; if (i == 1) { NSString *filename = [filenames objectAtIndex:0]; if ([fm fileExistsAtPath:filename isDirectory:&isDir] && !isDir) return NSDragOperationCopy; } } } return NSDragOperationNone;}- (unsigned int) draggingEntered:sender{ return [self draggingEnteredOrUpdated:sender];}- (unsigned int) draggingUpdated:sender{ return [self draggingEnteredOrUpdated:sender];}- (BOOL) prepareForDragOperation:sender{ return YES;}- (BOOL) performDragOperation:(id <NSDraggingInfo>)sender{ return YES;}- (void)concludeDragOperation:(id <NSDraggingInfo>)sender{ NSPasteboard *pboard = [sender draggingPasteboard]; NSString *type = [pboard availableTypeFromArray:[NSArray arrayWithObject:NSFilenamesPboardType]]; if (type) { if ([type isEqualToString:NSFilenamesPboardType]) { NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType]; unsigned i = [filenames count]; NSFileManager *fm = [NSFileManager defaultManager]; BOOL isDir; if (i == 1) { NSString *filename = [filenames objectAtIndex:0]; if ([fm fileExistsAtPath:filename isDirectory:&isDir] && !isDir) [[self delegate] performSelector:@selector( convertAndOpenFile:) withObject:[filename retain] afterDelay:0.10]; } } }}@end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -