Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-01 20:56:52 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-02 13:50:50 +0300
commit593eab66b5caa02dcd632eab909cccc137bc2fcd (patch)
tree558b40c4150097eb63f1a5b5bc6a6ace21d23596 /intern/ghost
parente7e52f7cff3abf36f3a3a0b70c86db5c2ed86324 (diff)
Cleanup: remove use of deprecated macOS API
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm21
1 files changed, 13 insertions, 8 deletions
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index eb54ed20fe1..c80424b279b 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1341,7 +1341,7 @@ void GHOST_SystemCocoa::handleQuitRequest()
bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
{
NSString *filepath = (NSString *)filepathStr;
- int confirmOpen = NSAlertAlternateReturn;
+ bool confirmOpen = true;
NSArray *windowsList;
char *temp_buff;
size_t filenameTextSize;
@@ -1358,12 +1358,17 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
// Check open windows if some changes are not saved
if (m_windowManager->getAnyModifiedState()) {
- confirmOpen = NSRunAlertPanel(
- [NSString stringWithFormat:@"Opening %@", [filepath lastPathComponent]],
- @"Current document has not been saved.\nDo you really want to proceed?",
- @"Cancel",
- @"Open",
- nil);
+ @autoreleasepool {
+ NSAlert *alert = [[NSAlert alloc] init];
+ NSString *title = [NSString stringWithFormat:@"Opening %@", [filepath lastPathComponent]];
+ NSString *text = @"Current document has not been saved.\nDo you really want to proceed?";
+ [alert addButtonWithTitle:@"Open"];
+ [alert addButtonWithTitle:@"Cancel"];
+ [alert setMessageText:title];
+ [alert setInformativeText:text];
+ [alert setAlertStyle:NSAlertStyleInformational];
+ confirmOpen = [alert runModal] == NSAlertFirstButtonReturn;
+ }
}
// Give back focus to the blender window
@@ -1372,7 +1377,7 @@ bool GHOST_SystemCocoa::handleOpenDocumentRequest(void *filepathStr)
[[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil];
}
- if (confirmOpen == NSAlertAlternateReturn) {
+ if (confirmOpen) {
filenameTextSize = [filepath lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
temp_buff = (char *)malloc(filenameTextSize + 1);