mirror of
https://github.com/ksherlock/ProFUSE-Image-Opener.git
synced 2024-12-22 07:30:27 +00:00
Add NSDocumentController for Open Recent... support.
This commit is contained in:
parent
5edc2cee6c
commit
63cd46eeaa
@ -10,7 +10,8 @@
|
||||
|
||||
@interface Image_OpenerAppDelegate : NSObject <NSApplicationDelegate> {
|
||||
@private
|
||||
NSWindow *window;
|
||||
NSWindow *_window;
|
||||
NSDocumentController *_controller;
|
||||
}
|
||||
|
||||
@property (assign) IBOutlet NSWindow *window;
|
||||
|
@ -11,13 +11,21 @@
|
||||
|
||||
@implementation Image_OpenerAppDelegate
|
||||
|
||||
@synthesize window;
|
||||
@synthesize window = _window;
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
_controller = [[NSDocumentController sharedDocumentController] retain];
|
||||
// Insert code here to initialize your application
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
|
||||
{
|
||||
WindowController *controller;
|
||||
controller = [WindowController controllerWithFilePath: filename];
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(IBAction)openDocument:(id)sender
|
||||
{
|
||||
NSOpenPanel *panel;
|
||||
@ -35,7 +43,6 @@
|
||||
|
||||
if (result == 1)
|
||||
{
|
||||
WindowController *controller;
|
||||
NSURL *url = [[panel URLs] lastObject];
|
||||
NSString *path = [url isFileURL] ? [url path] : nil;
|
||||
|
||||
@ -43,7 +50,9 @@
|
||||
|
||||
if (path)
|
||||
{
|
||||
controller = [WindowController controllerWithFilePath: path];
|
||||
[self application: nil openFile: path];
|
||||
|
||||
[_controller noteNewRecentDocumentURL: url];
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user