mirror of
https://github.com/ksherlock/ProFUSE-Image-Opener.git
synced 2024-11-26 05:49:21 +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> {
|
@interface Image_OpenerAppDelegate : NSObject <NSApplicationDelegate> {
|
||||||
@private
|
@private
|
||||||
NSWindow *window;
|
NSWindow *_window;
|
||||||
|
NSDocumentController *_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
@property (assign) IBOutlet NSWindow *window;
|
@property (assign) IBOutlet NSWindow *window;
|
||||||
|
@ -11,13 +11,21 @@
|
|||||||
|
|
||||||
@implementation Image_OpenerAppDelegate
|
@implementation Image_OpenerAppDelegate
|
||||||
|
|
||||||
@synthesize window;
|
@synthesize window = _window;
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||||
{
|
{
|
||||||
|
_controller = [[NSDocumentController sharedDocumentController] retain];
|
||||||
// Insert code here to initialize your application
|
// 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
|
-(IBAction)openDocument:(id)sender
|
||||||
{
|
{
|
||||||
NSOpenPanel *panel;
|
NSOpenPanel *panel;
|
||||||
@ -35,7 +43,6 @@
|
|||||||
|
|
||||||
if (result == 1)
|
if (result == 1)
|
||||||
{
|
{
|
||||||
WindowController *controller;
|
|
||||||
NSURL *url = [[panel URLs] lastObject];
|
NSURL *url = [[panel URLs] lastObject];
|
||||||
NSString *path = [url isFileURL] ? [url path] : nil;
|
NSString *path = [url isFileURL] ? [url path] : nil;
|
||||||
|
|
||||||
@ -43,7 +50,9 @@
|
|||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
controller = [WindowController controllerWithFilePath: path];
|
[self application: nil openFile: path];
|
||||||
|
|
||||||
|
[_controller noteNewRecentDocumentURL: url];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user