mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
International text clipboard patch for Basilisk II and SheepShaver
This patch adds support for international text to Basilisk II / SheepShaver's clipboard support. Text copied on the host side is converted from Unicode to the format that the classic Mac OS Script Manager expects, with localized font variants used if they are available on the emulated system (unfortunately, if a localized font is not available, the text will render incorrectly due to the nature of the Script Manager). When text is copied on the emulated system, the script of the current font is used to determine the encoding of the text, and it is converted to Unicode to be pasted on the host side. This patch supports copying and pasting text containing multiple scripts; for example, "EnglishČeský日本語", where ranges (0, 7) and (8, 3) are Roman, (7, 1) and (11, 1) are Central European, and (12, 3) is Japanese, can be freely copied and pasted back and forth between the host and emulated platforms, provided that the emulated platform has localized Central European and Japanese fonts installed. In order to get this to work, I rewrote pretty much all of clip_macosx64.mm. The code now completely uses the Cocoa framework rather than CoreFoundation and Pasteboard Manager. Because this API now uses the Mac OS X 10.6+ version of the pasteboard API, the minimum version of OS X supported by clip_macosx64.mm is now 10.6. I think this shouldn't be a problem, since the 32-bit version still exists, but if this version needs to support older releases, let me know and I can add version-check code to do so. One of the benefits of using the modern API, however, is that our rich-text format is no longer hard-coded to the RTF format, which means we have automatic support for any other format used by the OS X pasteboard system, which as of Lion seems to include RTF, UTF-16 text, UTF-8 text, 'ut16'/'ustl', and others, and which may be supplemented by other formats in future releases of OS X. I hope you find this patch useful. Charles
This commit is contained in:
parent
01cc80df4e
commit
2b51d635a7
34
BasiliskII/src/MacOSX/autorelease.h
Normal file
34
BasiliskII/src/MacOSX/autorelease.h
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* autorelease.h - a macro wrapping autorelease pools for use with Objective-C++ source files.
|
||||
*
|
||||
* Expands to @autoreleasepool on clang, uses a little hack to emulate @autoreleasepool on gcc.
|
||||
*
|
||||
* (C) 2012 Charles Srstka
|
||||
*
|
||||
* Feel free to put this under whatever license you wish.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#ifndef __Autorelease_H__
|
||||
#define __Autorelease_H__
|
||||
|
||||
// just a little forward compatibility in case we ever support LLVM/clang
|
||||
#if __clang__
|
||||
#define AUTORELEASE_POOL @autoreleasepool
|
||||
#else
|
||||
class Autorelease_Pool_Wrapper {
|
||||
public:
|
||||
Autorelease_Pool_Wrapper() { m_pool = [[NSAutoreleasePool alloc] init]; }
|
||||
~Autorelease_Pool_Wrapper() { [m_pool drain]; }
|
||||
operator bool() const { return true; }
|
||||
private:
|
||||
NSAutoreleasePool *m_pool;
|
||||
};
|
||||
|
||||
#define POOL_NAME(x, y) x##_##y
|
||||
#define POOL_NAME2(x, y) POOL_NAME(x, y)
|
||||
#define AUTORELEASE_POOL if(Autorelease_Pool_Wrapper POOL_NAME2(pool, __LINE__) = Autorelease_Pool_Wrapper())
|
||||
#endif // !__clang__
|
||||
|
||||
#endif // __Autorelease_H__
|
File diff suppressed because it is too large
Load Diff
1
SheepShaver/src/MacOSX/autorelease.h
Symbolic link
1
SheepShaver/src/MacOSX/autorelease.h
Symbolic link
@ -0,0 +1 @@
|
||||
../../../BasiliskII/src/MacOSX/autorelease.h
|
Loading…
Reference in New Issue
Block a user