forked from bartvdbraak/blender
Patch: [#22524] Update Windows Recent Documents on Open/Save
Slightly modified to better fit in architecture (moved to related GHOST SystemPaths) Thanks to Harley Acheson for the research and for providing the original patch. Note: I added empty function for X11(Linux) and Mac (Carbon and Cocoa) to be implemented still.
This commit is contained in:
parent
978bc0d8ac
commit
a45183125a
@ -85,6 +85,11 @@ public:
|
||||
*/
|
||||
virtual const GHOST_TUns8* getBinaryDir() const = 0;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
virtual void addToSystemRecentFiles(const char* filename) const = 0;
|
||||
|
||||
private:
|
||||
/** The one and only system paths*/
|
||||
static GHOST_ISystemPaths* m_systemPaths;
|
||||
|
@ -70,6 +70,11 @@ extern const GHOST_TUns8* GHOST_getUserDir(void);
|
||||
*/
|
||||
extern const GHOST_TUns8* GHOST_getBinaryDir(void);
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
extern void GHOST_addToSystemRecentFiles(const char* filename);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -59,3 +59,11 @@ const GHOST_TUns8* GHOST_getBinaryDir()
|
||||
GHOST_ISystemPaths* systemPaths = GHOST_ISystemPaths::get();
|
||||
return systemPaths ? systemPaths->getBinaryDir() : 0; /* shouldn't be NULL */
|
||||
}
|
||||
|
||||
void GHOST_addToSystemRecentFiles(const char* filename)
|
||||
{
|
||||
GHOST_ISystemPaths* systemPaths = GHOST_ISystemPaths::get();
|
||||
if (systemPaths) {
|
||||
systemPaths->addToSystemRecentFiles(filename);
|
||||
}
|
||||
}
|
@ -67,6 +67,11 @@ public:
|
||||
*/
|
||||
virtual const GHOST_TUns8* getBinaryDir() const = 0;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
virtual void addToSystemRecentFiles(const char* filename) const = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -76,3 +76,8 @@ const GHOST_TUns8* GHOST_SystemPathsCarbon::getBinaryDir() const
|
||||
return (GHOST_TUns8*)path;
|
||||
}
|
||||
|
||||
void GHOST_SystemPathsCarbon::addToSystemRecentFiles(const char* filename) const
|
||||
{
|
||||
/* XXXXX TODO: Implementation for Carbon if possible */
|
||||
|
||||
}
|
@ -75,6 +75,10 @@ public:
|
||||
*/
|
||||
virtual const GHOST_TUns8* getBinaryDir() const;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char* filename) const;
|
||||
};
|
||||
|
||||
#endif // _GHOST_SYSTEM_CARBON_H_
|
||||
|
@ -69,6 +69,10 @@ public:
|
||||
*/
|
||||
virtual const GHOST_TUns8* getBinaryDir() const;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char* filename) const;
|
||||
};
|
||||
|
||||
#endif // _GHOST_SYSTEM_COCOA_H_
|
||||
|
@ -114,3 +114,8 @@ const GHOST_TUns8* GHOST_SystemPathsCocoa::getBinaryDir() const
|
||||
[pool drain];
|
||||
return tempPath;
|
||||
}
|
||||
|
||||
void GHOST_SystemPathsCocoa::addToSystemRecentFiles(const char* filename) const
|
||||
{
|
||||
/* XXXXX TODO: Implementation for X11 if possible */
|
||||
}
|
||||
|
@ -79,3 +79,10 @@ const GHOST_TUns8* GHOST_SystemPathsWin32::getBinaryDir() const
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GHOST_SystemPathsWin32::addToSystemRecentFiles(const char* filename) const
|
||||
{
|
||||
/* SHARD_PATHA is for ansi strings, use SHARD_PATHW for wide */
|
||||
SHAddToRecentDocs(SHARD_PATHA,filename);
|
||||
|
||||
}
|
@ -76,6 +76,10 @@ public:
|
||||
*/
|
||||
const GHOST_TUns8* getBinaryDir() const;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char* filename) const;
|
||||
};
|
||||
|
||||
#endif // _GHOST_SYSTEM_PATHS_WIN32_H_
|
||||
|
@ -73,4 +73,8 @@ const GHOST_TUns8* GHOST_SystemPathsX11::getBinaryDir() const
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void GHOST_SystemPathsX11::addToSystemRecentFiles(const char* filename) const
|
||||
{
|
||||
/* XXXXX TODO: Implementation for X11 if possible */
|
||||
|
||||
}
|
||||
|
@ -67,6 +67,10 @@ public:
|
||||
*/
|
||||
const GHOST_TUns8* getBinaryDir() const;
|
||||
|
||||
/**
|
||||
* Add the file to the operating system most recently used files
|
||||
*/
|
||||
void addToSystemRecentFiles(const char* filename) const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -91,6 +91,7 @@
|
||||
#include "ED_util.h"
|
||||
|
||||
#include "GHOST_C-api.h"
|
||||
#include "GHOST_Path-api.h"
|
||||
|
||||
#include "UI_interface.h"
|
||||
|
||||
@ -511,6 +512,9 @@ static void write_history(void)
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
/* also update most recent files on System */
|
||||
GHOST_addToSystemRecentFiles(G.main->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user