pcsxr-1.9.92
[pcsx_rearmed.git] / macosx / PcsxPluginDocument.m
CommitLineData
ef79bbde
P
1//
2// PcsxPluginDocument.m
3// Pcsx
4//
5// Created by Gil Pedersen on Thu Jul 01 2004.
6// Copyright (c) 2004 __MyCompanyName__. All rights reserved.
7//
8
9#import "PcsxPluginDocument.h"
10
11
12@implementation PcsxPluginDocument
13
14- (BOOL)showAddPluginSheet:(NSWindow *)window forName:(NSString *)name
15// User has asked to see the custom display. Display it.
16{
17 if (!addPluginSheet)
18 [NSBundle loadNibNamed:@"AddPluginSheet" owner:self];
19
20 [pluginName setObjectValue:name];
21
22 [NSApp beginSheet:addPluginSheet
23 modalForWindow:window
24 modalDelegate:nil
25 didEndSelector:nil
26 contextInfo:nil];
27 [NSApp runModalForWindow:addPluginSheet];
28 // Sheet is up here.
29 [NSApp endSheet:addPluginSheet];
30 [addPluginSheet orderOut:self];
31
32 return moveOK;
33}
34
35- (IBAction)closeAddPluginSheet:(id)sender
36{
37 if ([[sender keyEquivalent] isEqualToString:@"\r"]) {
38 moveOK = YES;
39 } else {
40 moveOK = NO;
41 }
42 [NSApp stopModal];
43}
44
45- (BOOL)loadDataRepresentation:(NSData *)docData ofType:(NSString *)docType
46{
47 //NSLog(@"loadDataRepresentation");
48 return NO;
49}
50
51- (BOOL)loadFileWrapperRepresentation:(NSFileWrapper *)wrapper ofType:(NSString *)docType
52{
53 if ([self showAddPluginSheet:nil forName:[wrapper filename]]) {
54 NSString *dst = [NSString stringWithFormat:@"%@/%@",
55 [[NSBundle mainBundle] builtInPlugInsPath],
56 [wrapper filename]];
57
58 if ([wrapper writeToFile:dst atomically:NO updateFilenames:NO]) {
59 [[NSWorkspace sharedWorkspace] noteFileSystemChanged:[[NSBundle mainBundle] builtInPlugInsPath]];
60 NSRunInformationalAlertPanel(NSLocalizedString(@"Installation Succesfull", nil),
61 NSLocalizedString(@"The installation of the specified plugin was succesfull. In order to use it, please restart the application.", nil),
62 nil, nil, nil);
63 } else {
64 NSRunAlertPanel(NSLocalizedString(@"Installation Failed!", nil),
65 NSLocalizedString(@"The installation of the specified plugin failed. Please try again, or make a manual install.", nil),
66 nil, nil, nil);
67 }
68 }
69
70 // Tell the NSDocument that we can't handle the file, since we are already done with it
71 return NO;
72}
73
74- (id)openDocumentWithContentsOfFile:(NSString *)fileName display:(BOOL)flag
75{
76
77 return nil;
78}
79
80- (NSString *)windowNibName {
81 // Implement this to return a nib to load OR implement -makeWindowControllers to manually create your controllers.
82 return @"PcsxPluginDocument";
83}
84
85- (NSData *)dataRepresentationOfType:(NSString *)type {
86 // Implement to provide a persistent data representation of your document OR remove this and implement the file-wrapper or file path based save methods.
87 return nil;
88}
89/*
90- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)type {
91 // Implement to load a persistent data representation of your document OR remove this and implement the file-wrapper or file path based load methods.
92 return YES;
93}*/
94
95@end