| 1 |
// |
| 2 |
// SaveErrorPanelController.m |
| 3 |
// Alchemusica |
| 4 |
// |
| 5 |
// Created by Toshi Nagata on 2020/03/03. |
| 6 |
// Copyright 2020 Toshi Nagata. All rights reserved. |
| 7 |
// |
| 8 |
/* |
| 9 |
This program is free software; you can redistribute it and/or modify |
| 10 |
it under the terms of the GNU General Public License as published by |
| 11 |
the Free Software Foundation version 2 of the License. |
| 12 |
|
| 13 |
This program is distributed in the hope that it will be useful, |
| 14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
GNU General Public License for more details. |
| 17 |
*/ |
| 18 |
|
| 19 |
#import "SaveErrorPanelController.h" |
| 20 |
#import "NSWindowControllerAdditions.h" |
| 21 |
|
| 22 |
@implementation SaveErrorPanelController |
| 23 |
|
| 24 |
+ (BOOL)showSaveErrorPanelWithMessage:(NSString *)aMessage |
| 25 |
{ |
| 26 |
NSInteger res; |
| 27 |
id cont = [[SaveErrorPanelController alloc] initWithWindowNibName:@"SaveErrorPanel"]; |
| 28 |
[[cont window] center]; |
| 29 |
[cont setMessage:aMessage]; |
| 30 |
res = [NSApp runModalForWindow:[cont window]]; |
| 31 |
[[cont window] orderOut:nil]; |
| 32 |
[cont release]; |
| 33 |
return (res == 1); |
| 34 |
} |
| 35 |
|
| 36 |
- (void)windowDidLoad |
| 37 |
{ |
| 38 |
[errorMessage setFont:[NSFont userFixedPitchFontOfSize:10]]; |
| 39 |
} |
| 40 |
|
| 41 |
- (void)setMessage:(NSString *)aMessage |
| 42 |
{ |
| 43 |
[errorMessage insertText:aMessage replacementRange:NSMakeRange(-1, 0)]; |
| 44 |
} |
| 45 |
|
| 46 |
- (IBAction)cancelPressed:(id)sender |
| 47 |
{ |
| 48 |
[NSApp stopModalWithCode:0]; |
| 49 |
} |
| 50 |
|
| 51 |
- (IBAction)saveAnywayPressed:(id)sender |
| 52 |
{ |
| 53 |
[NSApp stopModalWithCode:1]; |
| 54 |
} |
| 55 |
|
| 56 |
@end |