forked from bartvdbraak/blender
macOS: Add open files to system recent files
Completes the TODO in GHOST_SystemPathsCocoa::addToSystemRecentFiles Also renames the filename parameter to the more appropriate filepath. The recently opened/saved file will now also show up in: - Blender Dock icon > Right click. - Three finger swipe down in Open Blender i.e., App Expose Based on a earlier contribution by @jenkm. Pull Request: https://projects.blender.org/blender/blender/pulls/107174
This commit is contained in:
parent
82ca3d3604
commit
f04a7a07e3
@ -72,7 +72,7 @@ class GHOST_ISystemPaths {
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
virtual void addToSystemRecentFiles(const char *filename) const = 0;
|
||||
virtual void addToSystemRecentFiles(const char *filepath) const = 0;
|
||||
|
||||
private:
|
||||
/** The one and only system paths. */
|
||||
|
@ -47,5 +47,5 @@ class GHOST_SystemPaths : public GHOST_ISystemPaths {
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
virtual void addToSystemRecentFiles(const char *filename) const = 0;
|
||||
virtual void addToSystemRecentFiles(const char *filepath) const = 0;
|
||||
};
|
||||
|
@ -54,5 +54,5 @@ class GHOST_SystemPathsCocoa : public GHOST_SystemPaths {
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char *filename) const;
|
||||
void addToSystemRecentFiles(const char *filepath) const;
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2010 Blender Foundation */
|
||||
|
||||
#import <AppKit/NSDocumentController.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#include "GHOST_Debug.hh"
|
||||
@ -112,7 +113,10 @@ const char *GHOST_SystemPathsCocoa::getBinaryDir() const
|
||||
return tempPath;
|
||||
}
|
||||
|
||||
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char *filename) const
|
||||
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char *filepath) const
|
||||
{
|
||||
/* TODO: implement for macOS */
|
||||
@autoreleasepool {
|
||||
NSURL *const file_url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:filepath]];
|
||||
[[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:file_url];
|
||||
}
|
||||
}
|
||||
|
@ -52,5 +52,5 @@ class GHOST_SystemPathsUnix : public GHOST_SystemPaths {
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char *filename) const;
|
||||
void addToSystemRecentFiles(const char *filepath) const;
|
||||
};
|
||||
|
@ -117,10 +117,10 @@ const char *GHOST_SystemPathsWin32::getBinaryDir() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filename) const
|
||||
void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char *filepath) const
|
||||
{
|
||||
/* SHARD_PATH resolves to SHARD_PATHA for non-UNICODE build */
|
||||
UTF16_ENCODE(filename);
|
||||
SHAddToRecentDocs(SHARD_PATHW, filename_16);
|
||||
UTF16_UN_ENCODE(filename);
|
||||
UTF16_ENCODE(filepath);
|
||||
SHAddToRecentDocs(SHARD_PATHW, filepath_16);
|
||||
UTF16_UN_ENCODE(filepath);
|
||||
}
|
||||
|
@ -61,5 +61,5 @@ class GHOST_SystemPathsWin32 : public GHOST_SystemPaths {
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char *filename) const;
|
||||
void addToSystemRecentFiles(const char *filepath) const;
|
||||
};
|
||||
|
@ -1584,7 +1584,7 @@ static void wm_history_file_update(void)
|
||||
/* Write current file to #BLENDER_HISTORY_FILE. */
|
||||
wm_history_file_write();
|
||||
|
||||
/* also update most recent files on System */
|
||||
/* Also update most recent files on system. */
|
||||
GHOST_addToSystemRecentFiles(blendfile_path);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user