1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00
This commit is contained in:
jules 2008-04-09 16:27:57 +00:00
parent 5ec41226c6
commit 22fefe2c57
16 changed files with 1203 additions and 2316 deletions

View file

@ -255,11 +255,6 @@ DSOUND_FUNCTION (DirectSoundCaptureCreate, (const GUID*, IDirectSoundCapture**,
DSOUND_FUNCTION (DirectSoundEnumerateW, (LPDSENUMCALLBACKW, LPVOID)) DSOUND_FUNCTION (DirectSoundEnumerateW, (LPDSENUMCALLBACKW, LPVOID))
DSOUND_FUNCTION (DirectSoundCaptureEnumerateW, (LPDSENUMCALLBACKW, LPVOID)) DSOUND_FUNCTION (DirectSoundCaptureEnumerateW, (LPDSENUMCALLBACKW, LPVOID))
#if JUCE_ENABLE_WIN98_COMPATIBILITY
DSOUND_FUNCTION (DirectSoundEnumerateA, (LPDSENUMCALLBACKA, LPVOID))
DSOUND_FUNCTION (DirectSoundCaptureEnumerateA, (LPDSENUMCALLBACKA, LPVOID))
#endif
static void initialiseDSoundFunctions() static void initialiseDSoundFunctions()
{ {
if (dsDirectSoundCreate == 0) if (dsDirectSoundCreate == 0)
@ -270,11 +265,6 @@ static void initialiseDSoundFunctions()
DSOUND_FUNCTION_LOAD (DirectSoundCaptureCreate) DSOUND_FUNCTION_LOAD (DirectSoundCaptureCreate)
DSOUND_FUNCTION_LOAD (DirectSoundEnumerateW) DSOUND_FUNCTION_LOAD (DirectSoundEnumerateW)
DSOUND_FUNCTION_LOAD (DirectSoundCaptureEnumerateW) DSOUND_FUNCTION_LOAD (DirectSoundCaptureEnumerateW)
#if JUCE_ENABLE_WIN98_COMPATIBILITY
DSOUND_FUNCTION_LOAD (DirectSoundEnumerateA)
DSOUND_FUNCTION_LOAD (DirectSoundCaptureEnumerateA)
#endif
} }
} }
@ -1460,13 +1450,6 @@ public:
dsDirectSoundEnumerateW (outputEnumProcW, this); dsDirectSoundEnumerateW (outputEnumProcW, this);
dsDirectSoundCaptureEnumerateW (inputEnumProcW, this); dsDirectSoundCaptureEnumerateW (inputEnumProcW, this);
} }
#if JUCE_ENABLE_WIN98_COMPATIBILITY
else if (dsDirectSoundEnumerateA != 0)
{
dsDirectSoundEnumerateA (outputEnumProcA, this);
dsDirectSoundCaptureEnumerateA (inputEnumProcA, this);
}
#endif
} }
const StringArray getDeviceNames (const bool preferInputNames) const const StringArray getDeviceNames (const bool preferInputNames) const

View file

@ -49,33 +49,6 @@ BEGIN_JUCE_NAMESPACE
#pragma warning (pop) #pragma warning (pop)
#endif #endif
//==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (SHBrowseForFolderW, LPITEMIDLIST, (LPBROWSEINFOW))
UNICODE_FUNCTION (SHGetPathFromIDListW, BOOL, (LPCITEMIDLIST, LPWSTR))
UNICODE_FUNCTION (GetSaveFileNameW, BOOL, (LPOPENFILENAMEW))
UNICODE_FUNCTION (GetOpenFileNameW, BOOL, (LPOPENFILENAMEW))
static void juce_initialiseUnicodeFileBrowserFunctions()
{
static bool initialised = false;
if (! initialised)
{
initialised = true;
HMODULE h = LoadLibraryA ("shell32.dll");
UNICODE_FUNCTION_LOAD (SHBrowseForFolderW)
UNICODE_FUNCTION_LOAD (SHGetPathFromIDListW)
h = LoadLibraryA ("comdlg32.dll");
UNICODE_FUNCTION_LOAD (GetSaveFileNameW)
UNICODE_FUNCTION_LOAD (GetOpenFileNameW)
}
}
#endif
//============================================================================== //==============================================================================
static const void* defaultDirPath = 0; static const void* defaultDirPath = 0;
static String returnedString; // need this to get non-existent pathnames from the directory chooser static String returnedString; // need this to get non-existent pathnames from the directory chooser
@ -98,13 +71,7 @@ static int CALLBACK browseCallbackProc (HWND hWnd, UINT msg, LPARAM lParam, LPAR
{ {
if (msg == BFFM_INITIALIZED) if (msg == BFFM_INITIALIZED)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
SendMessage (hWnd, (wSHBrowseForFolderW != 0) ? BFFM_SETSELECTIONW
: BFFM_SETSELECTIONA,
TRUE, (LPARAM) defaultDirPath);
#else
SendMessage (hWnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) defaultDirPath); SendMessage (hWnd, BFFM_SETSELECTIONW, TRUE, (LPARAM) defaultDirPath);
#endif
} }
else if (msg == BFFM_VALIDATEFAILEDW) else if (msg == BFFM_VALIDATEFAILEDW)
{ {
@ -162,16 +129,7 @@ static UINT_PTR CALLBACK openCallback (HWND hdlg, UINT uiMsg, WPARAM /*wParam*/,
path[0] = 0; path[0] = 0;
CommDlg_OpenSave_GetFilePath (GetParent (hdlg), (LPARAM) &path, MAX_PATH); CommDlg_OpenSave_GetFilePath (GetParent (hdlg), (LPARAM) &path, MAX_PATH);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
String fn;
if (wGetOpenFileNameW != 0)
fn = (const WCHAR*) path;
else
fn = path;
#else
const String fn ((const WCHAR*) path); const String fn ((const WCHAR*) path);
#endif
comp->selectedFileChanged (File (fn)); comp->selectedFileChanged (File (fn));
} }
@ -216,10 +174,6 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
bool selectMultipleFiles, bool selectMultipleFiles,
FilePreviewComponent* extraInfoComponent) FilePreviewComponent* extraInfoComponent)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeFileBrowserFunctions();
#endif
const int numCharsAvailable = 32768; const int numCharsAvailable = 32768;
MemoryBlock filenameSpace ((numCharsAvailable + 1) * sizeof (WCHAR), true); MemoryBlock filenameSpace ((numCharsAvailable + 1) * sizeof (WCHAR), true);
WCHAR* const fname = (WCHAR*) filenameSpace.getData(); WCHAR* const fname = (WCHAR*) filenameSpace.getData();
@ -250,14 +204,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
} }
else else
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSHBrowseForFolderW != 0)
currentFileOrDirectory.getFileName().copyToBuffer (fname, numCharsAvailable);
else
currentFileOrDirectory.getFileName().copyToBuffer ((char*) fname, numCharsAvailable);
#else
currentFileOrDirectory.getFileName().copyToBuffer (fname, numCharsAvailable); currentFileOrDirectory.getFileName().copyToBuffer (fname, numCharsAvailable);
#endif
initialDir = currentFileOrDirectory.getParentDirectory().getFullPathName(); initialDir = currentFileOrDirectory.getParentDirectory().getFullPathName();
} }
@ -273,60 +220,10 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
LPITEMIDLIST list = 0; LPITEMIDLIST list = 0;
filenameSpace.fillWith (0); filenameSpace.fillWith (0);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSHBrowseForFolderW != 0)
{
BROWSEINFOW bi;
zerostruct (bi);
bi.hwndOwner = (HWND) w.getWindowHandle();
bi.pszDisplayName = fname;
bi.lpszTitle = title;
bi.lpfn = browseCallbackProc;
#ifdef BIF_USENEWUI
bi.ulFlags = BIF_USENEWUI | BIF_VALIDATE;
#else
bi.ulFlags = 0x50;
#endif
defaultDirPath = (const WCHAR*) initialDir;
list = wSHBrowseForFolderW (&bi);
if (! wSHGetPathFromIDListW (list, fname))
{
fname[0] = 0;
returnedString = String::empty;
}
}
else
{ {
BROWSEINFO bi; BROWSEINFO bi;
zerostruct (bi); zerostruct (bi);
bi.hwndOwner = (HWND) w.getWindowHandle();
bi.pszDisplayName = (TCHAR*) fname;
bi.lpszTitle = title;
bi.lpfn = browseCallbackProc;
#ifdef BIF_USENEWUI
bi.ulFlags = BIF_USENEWUI | BIF_VALIDATE;
#else
bi.ulFlags = 0x50;
#endif
defaultDirPath = (const char*) initialDir;
list = SHBrowseForFolder (&bi);
if (! SHGetPathFromIDList (list, (char*) fname))
{
fname[0] = 0;
returnedString = String::empty;
}
}
#else
{
BROWSEINFOW bi;
zerostruct (bi);
bi.hwndOwner = (HWND) w.getWindowHandle(); bi.hwndOwner = (HWND) w.getWindowHandle();
bi.pszDisplayName = fname; bi.pszDisplayName = fname;
bi.lpszTitle = title; bi.lpszTitle = title;
@ -338,7 +235,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
#endif #endif
defaultDirPath = (const WCHAR*) initialDir; defaultDirPath = (const WCHAR*) initialDir;
list = SHBrowseForFolderW (&bi); list = SHBrowseForFolder (&bi);
if (! SHGetPathFromIDListW (list, fname)) if (! SHGetPathFromIDListW (list, fname))
{ {
@ -346,7 +243,6 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
returnedString = String::empty; returnedString = String::empty;
} }
} }
#endif
LPMALLOC al; LPMALLOC al;
if (list != 0 && SUCCEEDED (SHGetMalloc (&al))) if (list != 0 && SUCCEEDED (SHGetMalloc (&al)))
@ -356,16 +252,7 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
if (returnedString.isNotEmpty()) if (returnedString.isNotEmpty())
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
String stringFName;
if (wSHBrowseForFolderW != 0)
stringFName = fname;
else
stringFName = (char*) fname;
#else
const String stringFName (fname); const String stringFName (fname);
#endif
results.add (new File (File (stringFName).getSiblingFile (returnedString))); results.add (new File (File (stringFName).getSiblingFile (returnedString)));
returnedString = String::empty; returnedString = String::empty;
@ -396,8 +283,6 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
currentExtraFileWin->enterModalState(); currentExtraFileWin->enterModalState();
} }
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetSaveFileNameW != 0)
{ {
WCHAR filters [1024]; WCHAR filters [1024];
zeromem (filters, sizeof (filters)); zeromem (filters, sizeof (filters));
@ -422,49 +307,6 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
of.lpstrTitle = title; of.lpstrTitle = title;
of.Flags = flags; of.Flags = flags;
if (extraInfoComponent != 0)
of.lpfnHook = &openCallback;
if (isSaveDialogue)
{
if (! wGetSaveFileNameW (&of))
fname[0] = 0;
else
fnameIdx = of.nFileOffset;
}
else
{
if (! wGetOpenFileNameW (&of))
fname[0] = 0;
else
fnameIdx = of.nFileOffset;
}
}
else
{
TCHAR filters [1024];
zeromem (filters, sizeof (filters));
filter.copyToBuffer (filters, 1024);
filter.copyToBuffer (filters + filter.length() + 1,
1022 - filter.length());
OPENFILENAME of;
zerostruct (of);
#ifdef OPENFILENAME_SIZE_VERSION_400
of.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else
of.lStructSize = sizeof (of);
#endif
of.hwndOwner = (HWND) w.getWindowHandle();
of.lpstrFilter = filters;
of.nFilterIndex = 1;
of.lpstrFile = (TCHAR*) fname;
of.nMaxFile = numCharsAvailable;
of.lpstrInitialDir = initialDir;
of.lpstrTitle = title;
of.Flags = flags;
if (extraInfoComponent != 0) if (extraInfoComponent != 0)
of.lpfnHook = &openCallback; of.lpfnHook = &openCallback;
@ -483,50 +325,6 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
fnameIdx = of.nFileOffset; fnameIdx = of.nFileOffset;
} }
} }
#else
{
WCHAR filters [1024];
zeromem (filters, sizeof (filters));
filter.copyToBuffer (filters, 1024);
filter.copyToBuffer (filters + filter.length() + 1,
1022 - filter.length());
OPENFILENAMEW of;
zerostruct (of);
#ifdef OPENFILENAME_SIZE_VERSION_400W
of.lStructSize = OPENFILENAME_SIZE_VERSION_400W;
#else
of.lStructSize = sizeof (of);
#endif
of.hwndOwner = (HWND) w.getWindowHandle();
of.lpstrFilter = filters;
of.nFilterIndex = 1;
of.lpstrFile = fname;
of.nMaxFile = numCharsAvailable;
of.lpstrInitialDir = initialDir;
of.lpstrTitle = title;
of.Flags = flags;
if (extraInfoComponent != 0)
of.lpfnHook = &openCallback;
if (isSaveDialogue)
{
if (! GetSaveFileNameW (&of))
fname[0] = 0;
else
fnameIdx = of.nFileOffset;
}
else
{
if (! GetOpenFileNameW (&of))
fname[0] = 0;
else
fnameIdx = of.nFileOffset;
}
}
#endif
} }
} }
#if JUCE_CATCH_UNHANDLED_EXCEPTIONS #if JUCE_CATCH_UNHANDLED_EXCEPTIONS
@ -538,51 +336,23 @@ void FileChooser::showPlatformDialog (OwnedArray<File>& results,
deleteAndZero (currentExtraFileWin); deleteAndZero (currentExtraFileWin);
#if JUCE_ENABLE_WIN98_COMPATIBILITY const WCHAR* const files = fname;
if (wGetSaveFileNameW != 0)
if (selectMultipleFiles && fnameIdx > 0 && files [fnameIdx - 1] == 0)
{ {
#endif const WCHAR* filename = files + fnameIdx;
const WCHAR* const files = fname;
if (selectMultipleFiles && fnameIdx > 0 && files [fnameIdx - 1] == 0) while (*filename != 0)
{ {
const WCHAR* filename = files + fnameIdx; const String filepath (String (files) + T("\\") + String (filename));
results.add (new File (filepath));
while (*filename != 0) filename += CharacterFunctions::length (filename) + 1;
{
const String filepath (String (files) + T("\\") + String (filename));
results.add (new File (filepath));
filename += CharacterFunctions::length (filename) + 1;
}
}
else if (files[0] != 0)
{
results.add (new File (files));
}
#if JUCE_ENABLE_WIN98_COMPATIBILITY
}
else
{
const char* const files = (const char*) fname;
if (selectMultipleFiles && fnameIdx > 0 && files [fnameIdx - 1] == 0)
{
const char* filename = files + fnameIdx;
while (*filename != 0)
{
const String filepath (String (files) + T("\\") + String (filename));
results.add (new File (filepath));
filename += CharacterFunctions::length (filename) + 1;
}
}
else if (files[0] != 0)
{
results.add (new File (files));
} }
} }
#endif else if (files[0] != 0)
{
results.add (new File (files));
}
} }
END_JUCE_NAMESPACE END_JUCE_NAMESPACE

View file

@ -69,57 +69,6 @@ BEGIN_JUCE_NAMESPACE
const tchar File::separator = T('\\'); const tchar File::separator = T('\\');
const tchar* File::separatorString = T("\\"); const tchar* File::separatorString = T("\\");
//==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (GetFileAttributesW, DWORD, (LPCWSTR))
UNICODE_FUNCTION (GetFileAttributesExW, BOOL, (LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID))
UNICODE_FUNCTION (SetFileAttributesW, BOOL, (LPCWSTR, DWORD))
UNICODE_FUNCTION (RemoveDirectoryW, BOOL, (LPCWSTR))
UNICODE_FUNCTION (DeleteFileW, BOOL, (LPCWSTR))
UNICODE_FUNCTION (MoveFileW, BOOL, (LPCWSTR, LPCWSTR))
UNICODE_FUNCTION (CopyFileW, BOOL, (LPCWSTR, LPCWSTR, BOOL))
UNICODE_FUNCTION (CreateDirectoryW, BOOL, (LPCWSTR, LPSECURITY_ATTRIBUTES))
UNICODE_FUNCTION (CreateFileW, HANDLE, (LPCWSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES, DWORD, DWORD, HANDLE))
UNICODE_FUNCTION (CreateNamedPipeW, HANDLE, (LPCWSTR, DWORD, DWORD, DWORD, DWORD, DWORD, DWORD, LPSECURITY_ATTRIBUTES))
UNICODE_FUNCTION (GetTempPathW, DWORD, (DWORD, LPCWSTR))
UNICODE_FUNCTION (SHGetSpecialFolderPathW, BOOL, (HWND, LPCWSTR, int, BOOL))
UNICODE_FUNCTION (GetModuleFileNameW, DWORD, (HMODULE, LPCWSTR, DWORD))
UNICODE_FUNCTION (GetCurrentDirectoryW, DWORD, (DWORD, LPCWSTR))
UNICODE_FUNCTION (SetCurrentDirectoryW, BOOL, (LPCWSTR))
UNICODE_FUNCTION (FindFirstFileW, HANDLE, (LPCWSTR, LPWIN32_FIND_DATAW))
UNICODE_FUNCTION (FindNextFileW, BOOL, (HANDLE, LPWIN32_FIND_DATAW))
void juce_initialiseUnicodeFileFunctions() throw()
{
static_jassert (CSIDL_MYMUSIC == 0x000d);
static_jassert (CSIDL_MYVIDEO == 0x000e);
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
HMODULE h = GetModuleHandleA ("kernel32.dll");
UNICODE_FUNCTION_LOAD (GetFileAttributesW)
UNICODE_FUNCTION_LOAD (GetFileAttributesExW)
UNICODE_FUNCTION_LOAD (SetFileAttributesW)
UNICODE_FUNCTION_LOAD (RemoveDirectoryW)
UNICODE_FUNCTION_LOAD (DeleteFileW)
UNICODE_FUNCTION_LOAD (MoveFileW)
UNICODE_FUNCTION_LOAD (CopyFileW)
UNICODE_FUNCTION_LOAD (CreateDirectoryW)
UNICODE_FUNCTION_LOAD (CreateFileW)
UNICODE_FUNCTION_LOAD (CreateNamedPipeW)
UNICODE_FUNCTION_LOAD (GetTempPathW)
UNICODE_FUNCTION_LOAD (GetModuleFileNameW)
UNICODE_FUNCTION_LOAD (GetCurrentDirectoryW)
UNICODE_FUNCTION_LOAD (SetCurrentDirectoryW)
UNICODE_FUNCTION_LOAD (FindFirstFileW)
UNICODE_FUNCTION_LOAD (FindNextFileW)
h = LoadLibraryA ("shell32.dll");
UNICODE_FUNCTION_LOAD (SHGetSpecialFolderPathW)
}
}
#endif
//============================================================================== //==============================================================================
bool juce_fileExists (const String& fileName, bool juce_fileExists (const String& fileName,
@ -128,12 +77,7 @@ bool juce_fileExists (const String& fileName,
if (fileName.isEmpty()) if (fileName.isEmpty())
return false; return false;
#if JUCE_ENABLE_WIN98_COMPATIBILITY const DWORD attr = GetFileAttributes (fileName);
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
const DWORD attr = GetFileAttributesW (fileName);
#endif
return dontCountDirectories ? ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0) return dontCountDirectories ? ((attr & FILE_ATTRIBUTE_DIRECTORY) == 0)
: (attr != 0xffffffff); : (attr != 0xffffffff);
@ -141,12 +85,7 @@ bool juce_fileExists (const String& fileName,
bool juce_isDirectory (const String& fileName) throw() bool juce_isDirectory (const String& fileName) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY const DWORD attr = GetFileAttributes (fileName);
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
const DWORD attr = GetFileAttributesW (fileName);
#endif
return (attr != 0xffffffff) return (attr != 0xffffffff)
&& ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0); && ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0);
@ -154,12 +93,7 @@ bool juce_isDirectory (const String& fileName) throw()
bool juce_canWriteToFile (const String& fileName) throw() bool juce_canWriteToFile (const String& fileName) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY const DWORD attr = GetFileAttributes (fileName);
const DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
const DWORD attr = GetFileAttributesW (fileName);
#endif
return ((attr & FILE_ATTRIBUTE_READONLY) == 0); return ((attr & FILE_ATTRIBUTE_READONLY) == 0);
} }
@ -167,12 +101,7 @@ bool juce_canWriteToFile (const String& fileName) throw()
bool juce_setFileReadOnly (const String& fileName, bool juce_setFileReadOnly (const String& fileName,
bool isReadOnly) bool isReadOnly)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY DWORD attr = GetFileAttributes (fileName);
DWORD attr = (wGetFileAttributesW != 0) ? wGetFileAttributesW (fileName)
: GetFileAttributes (fileName);
#else
DWORD attr = GetFileAttributesW (fileName);
#endif
if (attr == 0xffffffff) if (attr == 0xffffffff)
return false; return false;
@ -185,66 +114,33 @@ bool juce_setFileReadOnly (const String& fileName,
else else
attr &= ~FILE_ATTRIBUTE_READONLY; attr &= ~FILE_ATTRIBUTE_READONLY;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSetFileAttributesW != 0)
return wSetFileAttributesW (fileName, attr) != FALSE;
return SetFileAttributes (fileName, attr) != FALSE; return SetFileAttributes (fileName, attr) != FALSE;
#else
return SetFileAttributesW (fileName, attr) != FALSE;
#endif
} }
//============================================================================== //==============================================================================
bool juce_deleteFile (const String& fileName) throw() bool juce_deleteFile (const String& fileName) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (juce_isDirectory (fileName)) if (juce_isDirectory (fileName))
return (wRemoveDirectoryW != 0) ? wRemoveDirectoryW (fileName) != 0 return RemoveDirectory (fileName) != 0;
: RemoveDirectory (fileName) != 0;
else
return (wDeleteFileW != 0) ? wDeleteFileW (fileName) != 0
: DeleteFile (fileName) != 0;
#else
if (juce_isDirectory (fileName))
return RemoveDirectoryW (fileName) != 0;
return DeleteFileW (fileName) != 0; return DeleteFile (fileName) != 0;
#endif
} }
bool juce_moveFile (const String& source, const String& dest) throw() bool juce_moveFile (const String& source, const String& dest) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY return MoveFile (source, dest) != 0;
return (wMoveFileW != 0) ? wMoveFileW (source, dest) != 0
: MoveFile (source, dest) != 0;
#else
return MoveFileW (source, dest) != 0;
#endif
} }
bool juce_copyFile (const String& source, const String& dest) throw() bool juce_copyFile (const String& source, const String& dest) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY return CopyFile (source, dest, false) != 0;
return (wCopyFileW != 0) ? wCopyFileW (source, dest, false) != 0
: CopyFile (source, dest, false) != 0;
#else
return CopyFileW (source, dest, false) != 0;
#endif
} }
void juce_createDirectory (const String& fileName) throw() void juce_createDirectory (const String& fileName) throw()
{ {
if (! juce_fileExists (fileName, true)) if (! juce_fileExists (fileName, true))
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY CreateDirectory (fileName, 0);
if (wCreateDirectoryW != 0)
wCreateDirectoryW (fileName, 0);
else
CreateDirectory (fileName, 0);
#else
CreateDirectoryW (fileName, 0);
#endif
} }
} }
@ -256,17 +152,8 @@ void* juce_fileOpen (const String& fileName, bool forWriting) throw()
if (forWriting) if (forWriting)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY h = CreateFile (fileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
if (wCreateFileW != 0) OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
h = wCreateFileW (fileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
else
h = CreateFile (fileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
#else
h = CreateFileW (fileName, GENERIC_WRITE, FILE_SHARE_READ, 0,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
#endif
if (h != INVALID_HANDLE_VALUE) if (h != INVALID_HANDLE_VALUE)
SetFilePointer (h, 0, 0, FILE_END); SetFilePointer (h, 0, 0, FILE_END);
@ -275,17 +162,8 @@ void* juce_fileOpen (const String& fileName, bool forWriting) throw()
} }
else else
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY h = CreateFile (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
if (wCreateFileW != 0) OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
h = wCreateFileW (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
else
h = CreateFile (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
#else
h = CreateFileW (fileName, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0);
#endif
if (h == INVALID_HANDLE_VALUE) if (h == INVALID_HANDLE_VALUE)
h = 0; h = 0;
@ -350,12 +228,7 @@ int64 juce_getFileSize (const String& fileName) throw()
{ {
WIN32_FILE_ATTRIBUTE_DATA attributes; WIN32_FILE_ATTRIBUTE_DATA attributes;
#if JUCE_ENABLE_WIN98_COMPATIBILITY if (GetFileAttributesEx (fileName, GetFileExInfoStandard, &attributes))
if (wGetFileAttributesExW != 0 ? wGetFileAttributesExW (fileName, GetFileExInfoStandard, &attributes)
: GetFileAttributesEx (fileName, GetFileExInfoStandard, &attributes))
#else
if (GetFileAttributesExW (fileName, GetFileExInfoStandard, &attributes))
#endif
{ {
return (((int64) attributes.nFileSizeHigh) << 32) return (((int64) attributes.nFileSizeHigh) << 32)
| attributes.nFileSizeLow; | attributes.nFileSizeLow;
@ -394,12 +267,7 @@ void juce_getFileTimes (const String& fileName,
WIN32_FILE_ATTRIBUTE_DATA attributes; WIN32_FILE_ATTRIBUTE_DATA attributes;
#if JUCE_ENABLE_WIN98_COMPATIBILITY if (GetFileAttributesEx (fileName, GetFileExInfoStandard, &attributes))
if (wGetFileAttributesExW != 0 ? wGetFileAttributesExW (fileName, GetFileExInfoStandard, &attributes)
: GetFileAttributesEx (fileName, GetFileExInfoStandard, &attributes))
#else
if (GetFileAttributesExW (fileName, GetFileExInfoStandard, &attributes))
#endif
{ {
modificationTime = fileTimeToTime (&attributes.ftLastWriteTime); modificationTime = fileTimeToTime (&attributes.ftLastWriteTime);
creationTime = fileTimeToTime (&attributes.ftCreationTime); creationTime = fileTimeToTime (&attributes.ftCreationTime);
@ -559,27 +427,10 @@ bool File::isOnRemovableDrive() const throw()
static const File juce_getSpecialFolderPath (int type) throw() static const File juce_getSpecialFolderPath (int type) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wSHGetSpecialFolderPathW != 0)
{
WCHAR path [MAX_PATH_CHARS];
if (wSHGetSpecialFolderPathW (0, path, type, 0))
return File (String (path));
}
else
{
TCHAR path [MAX_PATH_CHARS];
if (SHGetSpecialFolderPath (0, path, type, 0))
return File (String (path));
}
#else
WCHAR path [MAX_PATH_CHARS]; WCHAR path [MAX_PATH_CHARS];
if (SHGetSpecialFolderPathW (0, path, type, 0)) if (SHGetSpecialFolderPath (0, path, type, 0))
return File (String (path)); return File (String (path));
#endif
return File::nonexistent; return File::nonexistent;
} }
@ -620,56 +471,22 @@ const File JUCE_CALLTYPE File::getSpecialLocation (const SpecialLocationType typ
break; break;
case tempDirectory: case tempDirectory:
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetTempPathW != 0)
{ {
WCHAR dest [2048]; WCHAR dest [2048];
dest[0] = 0; dest[0] = 0;
wGetTempPathW (2048, dest);
return File (String (dest));
}
else
{
TCHAR dest [2048];
dest[0] = 0;
GetTempPath (2048, dest); GetTempPath (2048, dest);
return File (String (dest)); return File (String (dest));
} }
#else
{
WCHAR dest [2048];
dest[0] = 0;
GetTempPathW (2048, dest);
return File (String (dest));
}
#endif
case currentExecutableFile: case currentExecutableFile:
case currentApplicationFile: case currentApplicationFile:
{ {
HINSTANCE moduleHandle = (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(); HINSTANCE moduleHandle = (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle();
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetModuleFileNameW != 0)
{
WCHAR dest [MAX_PATH_CHARS];
dest[0] = 0;
wGetModuleFileNameW (moduleHandle, dest, MAX_PATH_CHARS);
return File (String (dest));
}
else
{
TCHAR dest [MAX_PATH_CHARS];
dest[0] = 0;
GetModuleFileName (moduleHandle, dest, MAX_PATH_CHARS);
return File (String (dest));
}
#else
WCHAR dest [MAX_PATH_CHARS]; WCHAR dest [MAX_PATH_CHARS];
dest[0] = 0; dest[0] = 0;
GetModuleFileNameW (moduleHandle, dest, MAX_PATH_CHARS); GetModuleFileName (moduleHandle, dest, MAX_PATH_CHARS);
return File (String (dest)); return File (String (dest));
#endif
} }
break; break;
@ -690,37 +507,15 @@ void juce_setCurrentExecutableFileName (const String&) throw()
//============================================================================== //==============================================================================
const File File::getCurrentWorkingDirectory() throw() const File File::getCurrentWorkingDirectory() throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetCurrentDirectoryW != 0)
{
WCHAR dest [MAX_PATH_CHARS];
dest[0] = 0;
wGetCurrentDirectoryW (MAX_PATH_CHARS, dest);
return File (String (dest));
}
else
{
TCHAR dest [MAX_PATH_CHARS];
dest[0] = 0;
GetCurrentDirectory (MAX_PATH_CHARS, dest);
return File (String (dest));
}
#else
WCHAR dest [MAX_PATH_CHARS]; WCHAR dest [MAX_PATH_CHARS];
dest[0] = 0; dest[0] = 0;
GetCurrentDirectoryW (MAX_PATH_CHARS, dest); GetCurrentDirectory (MAX_PATH_CHARS, dest);
return File (String (dest)); return File (String (dest));
#endif
} }
bool File::setAsCurrentWorkingDirectory() const throw() bool File::setAsCurrentWorkingDirectory() const throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY return SetCurrentDirectory (getFullPathName()) != FALSE;
return (wSetCurrentDirectoryW != 0) ? wSetCurrentDirectoryW (getFullPathName()) != FALSE
: SetCurrentDirectory (getFullPathName()) != FALSE;
#else
return SetCurrentDirectoryW (getFullPathName()) != FALSE;
#endif
} }
//============================================================================== //==============================================================================
@ -763,39 +558,15 @@ void* juce_findFileStart (const String& directory, const String& wildCard, Strin
wc += wildCard; wc += wildCard;
#if JUCE_ENABLE_WIN98_COMPATIBILITY WIN32_FIND_DATA findData;
if (wFindFirstFileW != 0) HANDLE h = FindFirstFile (wc, &findData);
{
WIN32_FIND_DATAW findData;
HANDLE h = wFindFirstFileW (wc, &findData);
if (h != INVALID_HANDLE_VALUE)
{
getFindFileInfo (findData, firstResult, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
return h;
}
}
else
{
WIN32_FIND_DATA findData;
HANDLE h = FindFirstFile (wc, &findData);
if (h != INVALID_HANDLE_VALUE)
{
getFindFileInfo (findData, firstResult, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
return h;
}
}
#else
WIN32_FIND_DATAW findData;
HANDLE h = FindFirstFileW (wc, &findData);
if (h != INVALID_HANDLE_VALUE) if (h != INVALID_HANDLE_VALUE)
{ {
getFindFileInfo (findData, firstResult, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly); getFindFileInfo (findData, firstResult, isDir, isHidden, fileSize,
modTime, creationTime, isReadOnly);
return h; return h;
} }
#endif
firstResult = String::empty; firstResult = String::empty;
return 0; return 0;
@ -805,36 +576,14 @@ bool juce_findFileNext (void* handle, String& resultFile,
bool* isDir, bool* isHidden, int64* fileSize, bool* isDir, bool* isHidden, int64* fileSize,
Time* modTime, Time* creationTime, bool* isReadOnly) throw() Time* modTime, Time* creationTime, bool* isReadOnly) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY WIN32_FIND_DATA findData;
if (wFindNextFileW != 0)
{
WIN32_FIND_DATAW findData;
if (handle != 0 && wFindNextFileW ((HANDLE) handle, &findData) != 0) if (handle != 0 && FindNextFile ((HANDLE) handle, &findData) != 0)
{
getFindFileInfo (findData, resultFile, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
return true;
}
}
else
{ {
WIN32_FIND_DATA findData; getFindFileInfo (findData, resultFile, isDir, isHidden, fileSize,
modTime, creationTime, isReadOnly);
if (handle != 0 && FindNextFile ((HANDLE) handle, &findData) != 0)
{
getFindFileInfo (findData, resultFile, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
return true;
}
}
#else
WIN32_FIND_DATAW findData;
if (handle != 0 && FindNextFileW ((HANDLE) handle, &findData) != 0)
{
getFindFileInfo (findData, resultFile, isDir, isHidden, fileSize, modTime, creationTime, isReadOnly);
return true; return true;
} }
#endif
resultFile = String::empty; resultFile = String::empty;
return false; return false;
@ -956,31 +705,13 @@ bool NamedPipe::openInternal (const String& pipeName, const bool createPipe)
if (createPipe) if (createPipe)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY intern->pipeH = CreateNamedPipe (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0,
if (wCreateNamedPipeW != 0) 1, 64, 64, 0, NULL);
intern->pipeH = wCreateNamedPipeW (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0,
1, 64, 64, 0, NULL);
else
intern->pipeH = CreateNamedPipe (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0,
1, 64, 64, 0, NULL);
#else
intern->pipeH = CreateNamedPipeW (file, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0,
1, 64, 64, 0, NULL);
#endif
} }
else else
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY intern->pipeH = CreateFile (file, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
if (wCreateFileW != 0) FILE_FLAG_OVERLAPPED, 0);
intern->pipeH = wCreateFileW (file, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
else
intern->pipeH = CreateFile (file, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
#else
intern->pipeH = CreateFileW (file, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
#endif
} }
if (intern->pipeH != INVALID_HANDLE_VALUE) if (intern->pipeH != INVALID_HANDLE_VALUE)

View file

@ -42,55 +42,6 @@ BEGIN_JUCE_NAMESPACE
//============================================================================== //==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (GetGlyphOutlineW, DWORD, (HDC, UINT, UINT, LPGLYPHMETRICS, DWORD, LPVOID, CONST MAT2*))
UNICODE_FUNCTION (GetTextMetricsW, BOOL, (HDC, LPTEXTMETRICW))
UNICODE_FUNCTION (GetKerningPairsW, DWORD, (HDC, DWORD, LPKERNINGPAIR))
UNICODE_FUNCTION (EnumFontFamiliesExW, int, (HDC, LPLOGFONTW, FONTENUMPROCW, LPARAM, DWORD))
UNICODE_FUNCTION (CreateFontIndirectW, HFONT, (CONST LOGFONTW *));
UNICODE_FUNCTION (GetGlyphIndicesW, DWORD, (HDC, LPCWSTR, int, LPWORD, DWORD));
static void juce_initialiseUnicodeFileFontFunctions()
{
static bool initialised = false;
if (! initialised)
{
initialised = true;
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
HMODULE h = LoadLibraryA ("gdi32.dll");
UNICODE_FUNCTION_LOAD (GetGlyphOutlineW)
UNICODE_FUNCTION_LOAD (GetTextMetricsW)
UNICODE_FUNCTION_LOAD (GetKerningPairsW)
UNICODE_FUNCTION_LOAD (EnumFontFamiliesExW)
UNICODE_FUNCTION_LOAD (CreateFontIndirectW)
UNICODE_FUNCTION_LOAD (GetGlyphIndicesW)
}
}
}
#endif
//==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
static int CALLBACK fontEnum2 (ENUMLOGFONTEX* lpelfe,
NEWTEXTMETRICEX*,
int type,
LPARAM lParam)
{
if (lpelfe != 0 && type == TRUETYPE_FONTTYPE)
{
const String fontName (lpelfe->elfLogFont.lfFaceName);
((StringArray*) lParam)->addIfNotAlreadyThere (fontName.removeCharacters (T("@")));
}
return 1;
}
#endif
static int CALLBACK wfontEnum2 (ENUMLOGFONTEXW* lpelfe, static int CALLBACK wfontEnum2 (ENUMLOGFONTEXW* lpelfe,
NEWTEXTMETRICEXW*, NEWTEXTMETRICEXW*,
int type, int type,
@ -106,39 +57,6 @@ static int CALLBACK wfontEnum2 (ENUMLOGFONTEXW* lpelfe,
return 1; return 1;
} }
#if JUCE_ENABLE_WIN98_COMPATIBILITY
static int CALLBACK fontEnum1 (ENUMLOGFONTEX* lpelfe,
NEWTEXTMETRICEX*,
int type,
LPARAM lParam)
{
if (lpelfe != 0
&& ((type & (DEVICE_FONTTYPE | RASTER_FONTTYPE)) == 0))
{
LOGFONT lf;
zerostruct (lf);
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_TT_ONLY_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfPitchAndFamily = FF_DONTCARE;
const String fontName (lpelfe->elfLogFont.lfFaceName);
fontName.copyToBuffer (lf.lfFaceName, LF_FACESIZE - 1);
HDC dc = CreateCompatibleDC (0);
EnumFontFamiliesEx (dc, &lf,
(FONTENUMPROC) &fontEnum2,
lParam, 0);
DeleteDC (dc);
}
return 1;
}
#endif
static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe, static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe,
NEWTEXTMETRICEXW*, NEWTEXTMETRICEXW*,
int type, int type,
@ -161,15 +79,9 @@ static int CALLBACK wfontEnum1 (ENUMLOGFONTEXW* lpelfe,
fontName.copyToBuffer (lf.lfFaceName, LF_FACESIZE - 1); fontName.copyToBuffer (lf.lfFaceName, LF_FACESIZE - 1);
HDC dc = CreateCompatibleDC (0); HDC dc = CreateCompatibleDC (0);
#if JUCE_ENABLE_WIN98_COMPATIBILITY EnumFontFamiliesEx (dc, &lf,
wEnumFontFamiliesExW (dc, &lf, (FONTENUMPROCW) &wfontEnum2,
(FONTENUMPROCW) &wfontEnum2, lParam, 0);
lParam, 0);
#else
EnumFontFamiliesExW (dc, &lf,
(FONTENUMPROCW) &wfontEnum2,
lParam, 0);
#endif
DeleteDC (dc); DeleteDC (dc);
} }
@ -181,8 +93,6 @@ const StringArray Font::findAllTypefaceNames() throw()
StringArray results; StringArray results;
HDC dc = CreateCompatibleDC (0); HDC dc = CreateCompatibleDC (0);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wEnumFontFamiliesExW != 0)
{ {
LOGFONTW lf; LOGFONTW lf;
zerostruct (lf); zerostruct (lf);
@ -195,45 +105,10 @@ const StringArray Font::findAllTypefaceNames() throw()
lf.lfPitchAndFamily = FF_DONTCARE; lf.lfPitchAndFamily = FF_DONTCARE;
lf.lfFaceName[0] = 0; lf.lfFaceName[0] = 0;
wEnumFontFamiliesExW (dc, &lf,
(FONTENUMPROCW) &wfontEnum1,
(LPARAM) &results, 0);
}
else
{
LOGFONT lf;
zerostruct (lf);
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_TT_ONLY_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfPitchAndFamily = FF_DONTCARE;
lf.lfFaceName[0] = 0;
EnumFontFamiliesEx (dc, &lf, EnumFontFamiliesEx (dc, &lf,
(FONTENUMPROC) &fontEnum1, (FONTENUMPROCW) &wfontEnum1,
(LPARAM) &results, 0); (LPARAM) &results, 0);
} }
#else
{
LOGFONTW lf;
zerostruct (lf);
lf.lfWeight = FW_DONTCARE;
lf.lfOutPrecision = OUT_TT_ONLY_PRECIS;
lf.lfQuality = DEFAULT_QUALITY;
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfPitchAndFamily = FF_DONTCARE;
lf.lfFaceName[0] = 0;
EnumFontFamiliesExW (dc, &lf,
(FONTENUMPROCW) &wfontEnum1,
(LPARAM) &results, 0);
}
#endif
DeleteDC (dc); DeleteDC (dc);
@ -287,9 +162,6 @@ public:
italic (false), italic (false),
size (0) size (0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeFileFontFunctions();
#endif
} }
~FontDCHolder() throw() ~FontDCHolder() throw()
@ -334,44 +206,6 @@ public:
SetMapperFlags (dc, 0); SetMapperFlags (dc, 0);
SetMapMode (dc, MM_TEXT); SetMapMode (dc, MM_TEXT);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
LOGFONT lf;
LOGFONTW lfw;
HFONT standardSizedFont = 0;
if (wCreateFontIndirectW != 0)
{
zerostruct (lfw);
lfw.lfCharSet = DEFAULT_CHARSET;
lfw.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lfw.lfOutPrecision = OUT_OUTLINE_PRECIS;
lfw.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
lfw.lfQuality = PROOF_QUALITY;
lfw.lfItalic = (BYTE) (italic ? TRUE : FALSE);
lfw.lfWeight = bold ? FW_BOLD : FW_NORMAL;
fontName.copyToBuffer (lfw.lfFaceName, LF_FACESIZE - 1);
lfw.lfHeight = size > 0 ? size : -256;
standardSizedFont = wCreateFontIndirectW (&lfw);
}
else
{
zerostruct (lf);
lf.lfCharSet = DEFAULT_CHARSET;
lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
lf.lfOutPrecision = OUT_OUTLINE_PRECIS;
lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
lf.lfQuality = PROOF_QUALITY;
lf.lfItalic = (BYTE) (italic ? TRUE : FALSE);
lf.lfWeight = bold ? FW_BOLD : FW_NORMAL;
fontName.copyToBuffer (lf.lfFaceName, LF_FACESIZE - 1);
lf.lfHeight = size > 0 ? size : -256;
standardSizedFont = CreateFontIndirect (&lf);
}
#else
LOGFONTW lfw; LOGFONTW lfw;
zerostruct (lfw); zerostruct (lfw);
@ -385,8 +219,7 @@ public:
fontName.copyToBuffer (lfw.lfFaceName, LF_FACESIZE - 1); fontName.copyToBuffer (lfw.lfFaceName, LF_FACESIZE - 1);
lfw.lfHeight = size > 0 ? size : -256; lfw.lfHeight = size > 0 ? size : -256;
HFONT standardSizedFont = CreateFontIndirectW (&lfw); HFONT standardSizedFont = CreateFontIndirect (&lfw);
#endif
if (standardSizedFont != 0) if (standardSizedFont != 0)
{ {
@ -399,21 +232,8 @@ public:
OUTLINETEXTMETRIC otm; OUTLINETEXTMETRIC otm;
if (GetOutlineTextMetrics (dc, sizeof (otm), &otm) != 0) if (GetOutlineTextMetrics (dc, sizeof (otm), &otm) != 0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wCreateFontIndirectW != 0)
{
lfw.lfHeight = -(int) otm.otmEMSquare;
fontH = wCreateFontIndirectW (&lfw);
}
else
{
lf.lfHeight = -(int) otm.otmEMSquare;
fontH = CreateFontIndirect (&lf);
}
#else
lfw.lfHeight = -(int) otm.otmEMSquare; lfw.lfHeight = -(int) otm.otmEMSquare;
fontH = CreateFontIndirectW (&lfw); fontH = CreateFontIndirect (&lfw);
#endif
SelectObject (dc, fontH); SelectObject (dc, fontH);
DeleteObject (standardSizedFont); DeleteObject (standardSizedFont);
@ -439,24 +259,9 @@ public:
{ {
if (kps == 0) if (kps == 0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY numKPs = GetKerningPairs (dc, 0, 0);
if (wGetKerningPairsW != 0)
{
numKPs = wGetKerningPairsW (dc, 0, 0);
kps = (KERNINGPAIR*) juce_calloc (sizeof (KERNINGPAIR) * numKPs);
wGetKerningPairsW (dc, numKPs, kps);
}
else
{
numKPs = GetKerningPairs (dc, 0, 0);
kps = (KERNINGPAIR*) juce_calloc (sizeof (KERNINGPAIR) * numKPs);
GetKerningPairs (dc, numKPs, kps);
}
#else
numKPs = GetKerningPairsW (dc, 0, 0);
kps = (KERNINGPAIR*) juce_calloc (sizeof (KERNINGPAIR) * numKPs); kps = (KERNINGPAIR*) juce_calloc (sizeof (KERNINGPAIR) * numKPs);
GetKerningPairsW (dc, numKPs, kps); GetKerningPairs (dc, numKPs, kps);
#endif
} }
numKPs_ = numKPs; numKPs_ = numKPs;
@ -479,50 +284,21 @@ static bool addGlyphToTypeface (HDC dc,
float height; float height;
BOOL ok = false; BOOL ok = false;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetGlyphIndicesW != 0)
{ {
const WCHAR charToTest[] = { (WCHAR)character, 0 }; const WCHAR charToTest[] = { (WCHAR) character, 0 };
WORD index = 0; WORD index = 0;
if (wGetGlyphIndicesW (dc, charToTest, 1, &index, GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR if (GetGlyphIndices (dc, charToTest, 1, &index, GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR
&& index == 0xffff) && index == 0xffff)
{ {
return false; return false;
} }
} }
if (wGetTextMetricsW != 0) TEXTMETRIC tm;
{ ok = GetTextMetrics (dc, &tm);
TEXTMETRICW tm;
ok = wGetTextMetricsW (dc, &tm);
height = (float) tm.tmHeight;
}
else
{
TEXTMETRIC tm;
ok = GetTextMetrics (dc, &tm);
height = (float) tm.tmHeight;
}
#else
{
const WCHAR charToTest[] = { (WCHAR)character, 0 };
WORD index = 0;
if (GetGlyphIndicesW (dc, charToTest, 1, &index, GGI_MARK_NONEXISTING_GLYPHS) != GDI_ERROR
&& index == 0xffff)
{
return false;
}
}
TEXTMETRICW tm;
ok = GetTextMetricsW (dc, &tm);
height = (float) tm.tmHeight; height = (float) tm.tmHeight;
#endif
if (! ok) if (! ok)
{ {
@ -534,35 +310,15 @@ static bool addGlyphToTypeface (HDC dc,
const float scaleY = -1.0f / height; const float scaleY = -1.0f / height;
static const MAT2 identityMatrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } }; static const MAT2 identityMatrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } };
int bufSize; const int bufSize = GetGlyphOutline (dc, character, GGO_NATIVE,
&gm, 0, 0, &identityMatrix);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetGlyphOutlineW != 0)
bufSize = wGetGlyphOutlineW (dc, character, GGO_NATIVE,
&gm, 0, 0, &identityMatrix);
else
bufSize = GetGlyphOutline (dc, character, GGO_NATIVE,
&gm, 0, 0, &identityMatrix);
#else
bufSize = GetGlyphOutlineW (dc, character, GGO_NATIVE,
&gm, 0, 0, &identityMatrix);
#endif
if (bufSize > 0) if (bufSize > 0)
{ {
char* const data = (char*) juce_malloc (bufSize); char* const data = (char*) juce_malloc (bufSize);
#if JUCE_ENABLE_WIN98_COMPATIBILITY GetGlyphOutline (dc, character, GGO_NATIVE, &gm,
if (wGetGlyphOutlineW != 0) bufSize, data, &identityMatrix);
wGetGlyphOutlineW (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix);
else
GetGlyphOutline (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix);
#else
GetGlyphOutlineW (dc, character, GGO_NATIVE, &gm,
bufSize, data, &identityMatrix);
#endif
const TTPOLYGONHEADER* pheader = (TTPOLYGONHEADER*) data; const TTPOLYGONHEADER* pheader = (TTPOLYGONHEADER*) data;
@ -717,20 +473,6 @@ void Typeface::initialiseTypefaceCharacteristics (const String& fontName,
float height; float height;
int firstChar, lastChar; int firstChar, lastChar;
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wGetTextMetricsW != 0)
{
TEXTMETRICW tm;
wGetTextMetricsW (dc, &tm);
height = (float) tm.tmHeight;
firstChar = tm.tmFirstChar;
lastChar = tm.tmLastChar;
setAscent (tm.tmAscent / height);
setDefaultCharacter (tm.tmDefaultChar);
}
else
{ {
TEXTMETRIC tm; TEXTMETRIC tm;
GetTextMetrics (dc, &tm); GetTextMetrics (dc, &tm);
@ -742,19 +484,6 @@ void Typeface::initialiseTypefaceCharacteristics (const String& fontName,
setAscent (tm.tmAscent / height); setAscent (tm.tmAscent / height);
setDefaultCharacter (tm.tmDefaultChar); setDefaultCharacter (tm.tmDefaultChar);
} }
#else
{
TEXTMETRICW tm;
GetTextMetricsW (dc, &tm);
height = (float) tm.tmHeight;
firstChar = tm.tmFirstChar;
lastChar = tm.tmLastChar;
setAscent (tm.tmAscent / height);
setDefaultCharacter (tm.tmDefaultChar);
}
#endif
setName (fontName); setName (fontName);
setBold (bold); setBold (bold);

View file

@ -331,10 +331,10 @@ const StringArray MidiInput::getDevices()
for (int i = 0; i < num; ++i) for (int i = 0; i < num; ++i)
{ {
MIDIINCAPSW mc; MIDIINCAPS mc;
zerostruct (mc); zerostruct (mc);
if (midiInGetDevCapsW (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) if (midiInGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR)
s.add (String (mc.szPname, sizeof (mc.szPname))); s.add (String (mc.szPname, sizeof (mc.szPname)));
} }
@ -359,10 +359,10 @@ MidiInput* MidiInput::openDevice (const int index, MidiInputCallback* const call
for (int i = 0; i < num; ++i) for (int i = 0; i < num; ++i)
{ {
MIDIINCAPSW mc; MIDIINCAPS mc;
zerostruct (mc); zerostruct (mc);
if (midiInGetDevCapsW (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) if (midiInGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR)
{ {
if (index == n) if (index == n)
{ {
@ -444,10 +444,10 @@ const StringArray MidiOutput::getDevices()
for (int i = 0; i < num; ++i) for (int i = 0; i < num; ++i)
{ {
MIDIOUTCAPSW mc; MIDIOUTCAPS mc;
zerostruct (mc); zerostruct (mc);
if (midiOutGetDevCapsW (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR)
s.add (String (mc.szPname, sizeof (mc.szPname))); s.add (String (mc.szPname, sizeof (mc.szPname)));
} }
@ -461,10 +461,10 @@ int MidiOutput::getDefaultDeviceIndex()
for (int i = 0; i < num; ++i) for (int i = 0; i < num; ++i)
{ {
MIDIOUTCAPSW mc; MIDIOUTCAPS mc;
zerostruct (mc); zerostruct (mc);
if (midiOutGetDevCapsW (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR)
{ {
if ((mc.wTechnology & MOD_MAPPER) != 0) if ((mc.wTechnology & MOD_MAPPER) != 0)
return n; return n;
@ -484,10 +484,10 @@ MidiOutput* MidiOutput::openDevice (int index)
for (i = 0; i < num; ++i) for (i = 0; i < num; ++i)
{ {
MIDIOUTCAPSW mc; MIDIOUTCAPS mc;
zerostruct (mc); zerostruct (mc);
if (midiOutGetDevCapsW (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR) if (midiOutGetDevCaps (i, &mc, sizeof (mc)) == MMSYSERR_NOERROR)
{ {
// use the microsoft sw synth as a default - best not to allow deviceId // use the microsoft sw synth as a default - best not to allow deviceId
// to be MIDI_MAPPER, or else device sharing breaks // to be MIDI_MAPPER, or else device sharing breaks

View file

@ -45,15 +45,9 @@ bool AlertWindow::showNativeDialogBox (const String& title,
const String& bodyText, const String& bodyText,
bool isOkCancel) bool isOkCancel)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
return MessageBox (0, bodyText, title, return MessageBox (0, bodyText, title,
(isOkCancel) ? MB_OKCANCEL (isOkCancel) ? MB_OKCANCEL
: MB_OK) == IDOK; : MB_OK) == IDOK;
#else
return MessageBoxW (0, bodyText, title,
(isOkCancel) ? MB_OKCANCEL
: MB_OK) == IDOK;
#endif
} }
//============================================================================== //==============================================================================

View file

@ -47,46 +47,12 @@ BEGIN_JUCE_NAMESPACE
#pragma warning (pop) #pragma warning (pop)
#endif #endif
//==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY
UNICODE_FUNCTION (RegCreateKeyExW, LONG, (HKEY, LPCWSTR, DWORD, LPWSTR, DWORD, REGSAM, LPSECURITY_ATTRIBUTES, PHKEY, LPDWORD))
UNICODE_FUNCTION (RegOpenKeyExW, LONG, (HKEY, LPCWSTR, DWORD, REGSAM, PHKEY))
UNICODE_FUNCTION (RegQueryValueExW, LONG, (HKEY, LPCWSTR, LPDWORD, LPDWORD, LPBYTE, LPDWORD))
UNICODE_FUNCTION (RegSetValueExW, LONG, (HKEY, LPCWSTR, DWORD, DWORD, const BYTE*, DWORD))
UNICODE_FUNCTION (RegDeleteValueW, LONG, (HKEY, LPCWSTR))
UNICODE_FUNCTION (RegDeleteKeyW, LONG, (HKEY, LPCWSTR))
static void juce_initialiseUnicodeRegistryFunctions() throw()
{
static bool initialised = false;
if (! initialised)
{
initialised = true;
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
HMODULE h = LoadLibraryA ("Advapi32.dll");
UNICODE_FUNCTION_LOAD (RegCreateKeyExW)
UNICODE_FUNCTION_LOAD (RegOpenKeyExW)
UNICODE_FUNCTION_LOAD (RegQueryValueExW)
UNICODE_FUNCTION_LOAD (RegSetValueExW)
UNICODE_FUNCTION_LOAD (RegDeleteValueW)
UNICODE_FUNCTION_LOAD (RegDeleteKeyW)
}
}
}
#endif
//============================================================================== //==============================================================================
static HKEY findKeyForPath (String name, static HKEY findKeyForPath (String name,
const bool createForWriting, const bool createForWriting,
String& valueName) throw() String& valueName) throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeRegistryFunctions();
#endif
HKEY rootKey = 0; HKEY rootKey = 0;
if (name.startsWithIgnoreCase (T("HKEY_CURRENT_USER\\"))) if (name.startsWithIgnoreCase (T("HKEY_CURRENT_USER\\")))
@ -109,42 +75,14 @@ static HKEY findKeyForPath (String name,
if (createForWriting) if (createForWriting)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY if (RegCreateKeyEx (rootKey, name, 0, L"", REG_OPTION_NON_VOLATILE,
if (wRegCreateKeyExW != 0) (KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS)
{
if (wRegCreateKeyExW (rootKey, name, 0, L"", REG_OPTION_NON_VOLATILE,
(KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS)
return key;
}
else
{
if (RegCreateKeyEx (rootKey, name, 0, _T(""), REG_OPTION_NON_VOLATILE,
(KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS)
return key;
}
#else
if (RegCreateKeyExW (rootKey, name, 0, L"", REG_OPTION_NON_VOLATILE,
(KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS)
return key; return key;
#endif
} }
else else
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY if (RegOpenKeyEx (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS)
if (wRegOpenKeyExW != 0)
{
if (wRegOpenKeyExW (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS)
return key;
}
else
{
if (RegOpenKeyEx (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS)
return key;
}
#else
if (RegOpenKeyExW (rootKey, name, 0, KEY_READ, &key) == ERROR_SUCCESS)
return key; return key;
#endif
} }
} }
@ -159,39 +97,14 @@ const String PlatformUtilities::getRegistryValue (const String& regValuePath,
if (k != 0) if (k != 0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if (wRegQueryValueExW != 0)
{
WCHAR buffer [2048];
unsigned long bufferSize = sizeof (buffer);
DWORD type = REG_SZ;
if (wRegQueryValueExW (k, valueName, 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS)
s = buffer;
else
s = defaultValue;
}
else
{
TCHAR buffer [2048];
unsigned long bufferSize = sizeof (buffer);
DWORD type = REG_SZ;
if (RegQueryValueEx (k, valueName, 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS)
s = buffer;
else
s = defaultValue;
}
#else
WCHAR buffer [2048]; WCHAR buffer [2048];
unsigned long bufferSize = sizeof (buffer); unsigned long bufferSize = sizeof (buffer);
DWORD type = REG_SZ; DWORD type = REG_SZ;
if (RegQueryValueExW (k, valueName, 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS) if (RegQueryValueEx (k, valueName, 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS)
s = buffer; s = buffer;
else else
s = defaultValue; s = defaultValue;
#endif
RegCloseKey (k); RegCloseKey (k);
} }
@ -207,20 +120,9 @@ void PlatformUtilities::setRegistryValue (const String& regValuePath,
if (k != 0) if (k != 0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY RegSetValueEx (k, valueName, 0, REG_SZ,
if (wRegSetValueExW != 0) (const BYTE*) (const WCHAR*) value,
wRegSetValueExW (k, valueName, 0, REG_SZ, sizeof (WCHAR) * (value.length() + 1));
(const BYTE*) (const WCHAR*) value,
sizeof (WCHAR) * (value.length() + 1));
else
RegSetValueEx (k, valueName, 0, REG_SZ,
(const BYTE*) (const TCHAR*) value,
sizeof (TCHAR) * (value.length() + 1));
#else
RegSetValueExW (k, valueName, 0, REG_SZ,
(const BYTE*) (const WCHAR*) value,
sizeof (WCHAR) * (value.length() + 1));
#endif
RegCloseKey (k); RegCloseKey (k);
} }
@ -238,21 +140,8 @@ bool PlatformUtilities::registryValueExists (const String& regValuePath)
unsigned long bufferSize = sizeof (buffer); unsigned long bufferSize = sizeof (buffer);
DWORD type = 0; DWORD type = 0;
#if JUCE_ENABLE_WIN98_COMPATIBILITY if (RegQueryValueEx (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS)
if (wRegQueryValueExW != 0)
{
if (wRegQueryValueExW (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS)
exists = true;
}
else
{
if (RegQueryValueEx (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS)
exists = true;
}
#else
if (RegQueryValueExW (k, valueName, 0, &type, buffer, &bufferSize) == ERROR_SUCCESS)
exists = true; exists = true;
#endif
RegCloseKey (k); RegCloseKey (k);
} }
@ -267,15 +156,7 @@ void PlatformUtilities::deleteRegistryValue (const String& regValuePath)
if (k != 0) if (k != 0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY RegDeleteValue (k, valueName);
if (wRegDeleteValueW != 0)
wRegDeleteValueW (k, valueName);
else
RegDeleteValue (k, valueName);
#else
RegDeleteValueW (k, valueName);
#endif
RegCloseKey (k); RegCloseKey (k);
} }
} }
@ -287,15 +168,7 @@ void PlatformUtilities::deleteRegistryKey (const String& regKeyPath)
if (k != 0) if (k != 0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY RegDeleteKey (k, valueName);
if (wRegDeleteKeyW != 0)
wRegDeleteKeyW (k, valueName);
else
RegDeleteKey (k, valueName);
#else
RegDeleteKeyW (k, valueName);
#endif
RegCloseKey (k); RegCloseKey (k);
} }
} }

View file

@ -69,10 +69,6 @@ BEGIN_JUCE_NAMESPACE
extern void juce_updateMultiMonitorInfo() throw(); extern void juce_updateMultiMonitorInfo() throw();
extern void juce_initialiseThreadEvents() throw(); extern void juce_initialiseThreadEvents() throw();
#if JUCE_ENABLE_WIN98_COMPATIBILITY
extern void juce_initialiseUnicodeFileFunctions() throw();
#endif
//============================================================================== //==============================================================================
void Logger::outputDebugString (const String& text) throw() void Logger::outputDebugString (const String& text) throw()
@ -256,10 +252,6 @@ bool SystemStats::has3DNow() throw()
void SystemStats::initialiseStats() throw() void SystemStats::initialiseStats() throw()
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeFileFunctions();
#endif
juce_initialiseThreadEvents(); juce_initialiseThreadEvents();
cpuFlags.hasMMX = IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE) != 0; cpuFlags.hasMMX = IsProcessorFeaturePresent (PF_MMX_INSTRUCTIONS_AVAILABLE) != 0;
@ -359,7 +351,7 @@ bool SystemStats::isOperatingSystem64Bit() throw()
#else #else
typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL);
LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle ("kernel32"), "IsWow64Process"); LPFN_ISWOW64PROCESS fnIsWow64Process = (LPFN_ISWOW64PROCESS) GetProcAddress (GetModuleHandle (L"kernel32"), "IsWow64Process");
BOOL isWow64 = FALSE; BOOL isWow64 = FALSE;

View file

@ -134,48 +134,8 @@ bool Desktop::canUseSemiTransparentWindows() throw()
} }
//============================================================================== //==============================================================================
#if JUCE_ENABLE_WIN98_COMPATIBILITY #undef DefWindowProc
UNICODE_FUNCTION (SetWindowTextW, BOOL, (HWND, LPCWSTR)) #define DefWindowProc DefWindowProcW
UNICODE_FUNCTION (DragQueryFileW, UINT, (HDROP, UINT, LPWSTR, UINT))
UNICODE_FUNCTION (MapVirtualKeyW, UINT, (UINT, UINT))
UNICODE_FUNCTION (ToUnicode, int, (UINT, UINT, const PBYTE, LPWSTR, int, UINT))
UNICODE_FUNCTION (RegisterClassExW, ATOM, (CONST WNDCLASSEXW*))
UNICODE_FUNCTION (CreateWindowExW, HWND, (DWORD, LPCWSTR, LPCWSTR, DWORD, int, int, int, int, HWND, HMENU, HINSTANCE, LPVOID))
UNICODE_FUNCTION (DefWindowProcW, LRESULT, (HWND, UINT, WPARAM, LPARAM))
void juce_initialiseUnicodeWindowFunctions()
{
static bool initialised = false;
if (! initialised)
{
initialised = true;
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
HMODULE h = LoadLibraryA ("user32.dll");
UNICODE_FUNCTION_LOAD (SetWindowTextW)
UNICODE_FUNCTION_LOAD (MapVirtualKeyW)
UNICODE_FUNCTION_LOAD (ToUnicode)
UNICODE_FUNCTION_LOAD (RegisterClassExW)
UNICODE_FUNCTION_LOAD (CreateWindowExW)
UNICODE_FUNCTION_LOAD (DefWindowProcW)
if (wDefWindowProcW == 0)
wDefWindowProcW = & DefWindowProcA;
h = LoadLibraryA ("shell32.dll");
UNICODE_FUNCTION_LOAD (DragQueryFileW)
}
}
}
#undef DefWindowProc
#define DefWindowProc wDefWindowProcW
#else
#undef DefWindowProc
#define DefWindowProc DefWindowProcW
#endif
//============================================================================== //==============================================================================
const int extendedKeyModifier = 0x10000; const int extendedKeyModifier = 0x10000;
@ -529,10 +489,6 @@ public:
taskBarIcon (0), taskBarIcon (0),
dropTarget (0) dropTarget (0)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY
juce_initialiseUnicodeWindowFunctions();
#endif
MessageManager::getInstance() MessageManager::getInstance()
->callFunctionOnMessageThread (&createWindowCallback, (void*) this); ->callFunctionOnMessageThread (&createWindowCallback, (void*) this);
@ -592,14 +548,7 @@ public:
void setTitle (const String& title) void setTitle (const String& title)
{ {
#if JUCE_ENABLE_WIN98_COMPATIBILITY SetWindowText (hwnd, title);
if (wSetWindowTextW != 0)
wSetWindowTextW (hwnd, title);
else
SetWindowText (hwnd, title);
#else
SetWindowTextW (hwnd, title);
#endif
} }
void setPosition (int x, int y) void setPosition (int x, int y)
@ -762,7 +711,7 @@ public:
if (hasTitleBar()) if (hasTitleBar())
ShowWindow (hwnd, SW_SHOWMAXIMIZED); ShowWindow (hwnd, SW_SHOWMAXIMIZED);
else else
SendMessage (hwnd, WM_SETTINGCHANGE, 0, 0); SendMessageW (hwnd, WM_SETTINGCHANGE, 0, 0);
} }
if (! deletionChecker.hasBeenDeleted()) if (! deletionChecker.hasBeenDeleted())
@ -1024,47 +973,7 @@ private:
GetModuleFileName (moduleHandle, moduleFile, 1024); GetModuleFileName (moduleHandle, moduleFile, 1024);
WORD iconNum = 0; WORD iconNum = 0;
#if JUCE_ENABLE_WIN98_COMPATIBILITY WNDCLASSEX wcex;
if (wRegisterClassExW != 0)
{
WNDCLASSEXW wcex;
wcex.cbSize = sizeof (wcex);
wcex.style = CS_OWNDC;
wcex.lpfnWndProc = (WNDPROC) windowProc;
wcex.lpszClassName = windowClassName;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 32;
wcex.hInstance = moduleHandle;
wcex.hIcon = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum);
iconNum = 1;
wcex.hIconSm = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum);
wcex.hCursor = 0;
wcex.hbrBackground = 0;
wcex.lpszMenuName = 0;
wRegisterClassExW (&wcex);
}
else
{
WNDCLASSEX wcex;
wcex.cbSize = sizeof (wcex);
wcex.style = CS_OWNDC;
wcex.lpfnWndProc = (WNDPROC) windowProc;
wcex.lpszClassName = windowClassName;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 32;
wcex.hInstance = moduleHandle;
wcex.hIcon = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum);
iconNum = 1;
wcex.hIconSm = ExtractAssociatedIcon (moduleHandle, moduleFile, &iconNum);
wcex.hCursor = 0;
wcex.hbrBackground = 0;
wcex.lpszMenuName = 0;
RegisterClassEx (&wcex);
}
#else
WNDCLASSEXW wcex;
wcex.cbSize = sizeof (wcex); wcex.cbSize = sizeof (wcex);
wcex.style = CS_OWNDC; wcex.style = CS_OWNDC;
wcex.lpfnWndProc = (WNDPROC) windowProc; wcex.lpfnWndProc = (WNDPROC) windowProc;
@ -1079,8 +988,7 @@ private:
wcex.hbrBackground = 0; wcex.hbrBackground = 0;
wcex.lpszMenuName = 0; wcex.lpszMenuName = 0;
RegisterClassExW (&wcex); RegisterClassEx (&wcex);
#endif
} }
~WindowClassHolder() ~WindowClassHolder()
@ -1149,16 +1057,7 @@ private:
&& Desktop::canUseSemiTransparentWindows()) && Desktop::canUseSemiTransparentWindows())
exstyle |= WS_EX_LAYERED; exstyle |= WS_EX_LAYERED;
#if JUCE_ENABLE_WIN98_COMPATIBILITY hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->windowClassName, L"", type, 0, 0, 0, 0, 0, 0, 0, 0);
const WindowClassHolder* const windowClassHolder = WindowClassHolder::getInstance();
if (wCreateWindowExW != 0)
hwnd = wCreateWindowExW (exstyle, windowClassHolder->windowClassName, L"", type, 0, 0, 0, 0, 0, 0, 0, 0);
else
hwnd = CreateWindowEx (exstyle, windowClassHolder->windowClassName, _T(""), type, 0, 0, 0, 0, 0, 0, 0, 0);
#else
hwnd = CreateWindowExW (exstyle, WindowClassHolder::getInstance()->windowClassName, L"", type, 0, 0, 0, 0, 0, 0, 0, 0);
#endif
if (hwnd != 0) if (hwnd != 0)
{ {
@ -1684,13 +1583,7 @@ private:
// if there isn't a WM_CHAR or WM_DEADCHAR message pending, we need to // if there isn't a WM_CHAR or WM_DEADCHAR message pending, we need to
// manually generate the key-press event that matches this key-down. // manually generate the key-press event that matches this key-down.
#if JUCE_ENABLE_WIN98_COMPATIBILITY const UINT keyChar = MapVirtualKey (key, 2);
const UINT keyChar = wMapVirtualKeyW != 0 ? wMapVirtualKeyW (key, 2)
: MapVirtualKey (key, 2);
#else
const UINT keyChar = MapVirtualKeyW (key, 2);
#endif
used = handleKeyPress ((int) LOWORD (keyChar), 0) || used; used = handleKeyPress ((int) LOWORD (keyChar), 0) || used;
} }
} }
@ -1732,49 +1625,8 @@ private:
else else
{ {
// convert the scan code to an unmodified character code.. // convert the scan code to an unmodified character code..
#if JUCE_ENABLE_WIN98_COMPATIBILITY const UINT virtualKey = MapVirtualKey (virtualScanCode, 1);
const UINT virtualKey = wMapVirtualKeyW != 0 ? wMapVirtualKeyW (virtualScanCode, 1) UINT keyChar = MapVirtualKey (virtualKey, 2);
: MapVirtualKey (virtualScanCode, 1);
UINT keyChar = wMapVirtualKeyW != 0 ? wMapVirtualKeyW (virtualKey, 2)
: MapVirtualKey (virtualKey, 2);
if (wToUnicode != 0)
{
BYTE keyState[256];
GetKeyboardState (keyState);
WCHAR unicodeChar[32];
const DWORD converted = wToUnicode (virtualKey, virtualScanCode, keyState,
unicodeChar, 32, 0);
if (converted > 0)
{
// ahem.. can't actually remember why this section of code was originall here,
// so if you see this assertion, please let me know what you were doing at
// the time!
jassert (textChar == unicodeChar[0]);
// textChar = unicodeChar[0];
}
}
#else
const UINT virtualKey = MapVirtualKeyW (virtualScanCode, 1);
UINT keyChar = MapVirtualKeyW (virtualKey, 2);
{
BYTE keyState[256];
GetKeyboardState (keyState);
WCHAR unicodeChar[32];
const DWORD converted = ToUnicode (virtualKey, virtualScanCode, keyState,
unicodeChar, 32, 0);
if (converted > 0)
{
// ahem.. can't actually remember why this section of code was originall here,
// so if you see this assertion, please let me know what you were doing at
// the time!
jassert (textChar == unicodeChar[0]);
// textChar = unicodeChar[0];
}
}
#endif
keyChar = LOWORD (keyChar); keyChar = LOWORD (keyChar);
@ -3067,34 +2919,6 @@ static HDROP createHDrop (const StringArray& fileNames) throw()
LPDROPFILES pDropFiles = (LPDROPFILES) GlobalLock (hDrop); LPDROPFILES pDropFiles = (LPDROPFILES) GlobalLock (hDrop);
pDropFiles->pFiles = sizeof (DROPFILES); pDropFiles->pFiles = sizeof (DROPFILES);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
pDropFiles->fWide = (SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0;
if (pDropFiles->fWide)
{
WCHAR* fname = (WCHAR*) (((char*) pDropFiles) + sizeof (DROPFILES));
for (int i = 0; i < fileNames.size(); ++i)
{
fileNames[i].copyToBuffer (fname, 2048);
fname += fileNames[i].length() + 1;
}
*fname = 0;
}
else
{
char* fname = ((char*) pDropFiles) + sizeof (DROPFILES);
for (int i = 0; i < fileNames.size(); ++i)
{
fileNames[i].copyToBuffer (fname, 2048);
fname += fileNames[i].length() + 1;
}
*fname = 0;
}
#else
pDropFiles->fWide = true; pDropFiles->fWide = true;
WCHAR* fname = (WCHAR*) (((char*) pDropFiles) + sizeof (DROPFILES)); WCHAR* fname = (WCHAR*) (((char*) pDropFiles) + sizeof (DROPFILES));
@ -3106,7 +2930,6 @@ static HDROP createHDrop (const StringArray& fileNames) throw()
} }
*fname = 0; *fname = 0;
#endif
GlobalUnlock (hDrop); GlobalUnlock (hDrop);
} }
@ -3149,20 +2972,8 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text)
medium.hGlobal = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, (numChars + 2) * sizeof (WCHAR)); medium.hGlobal = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, (numChars + 2) * sizeof (WCHAR));
char* d = (char*) GlobalLock (medium.hGlobal); char* d = (char*) GlobalLock (medium.hGlobal);
#if JUCE_ENABLE_WIN98_COMPATIBILITY
if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0)
{
text.copyToBuffer ((WCHAR*) d, numChars + 1);
format.cfFormat = CF_UNICODETEXT;
}
else
{
text.copyToBuffer (d, numChars + 1);
}
#else
text.copyToBuffer ((WCHAR*) d, numChars + 1); text.copyToBuffer ((WCHAR*) d, numChars + 1);
format.cfFormat = CF_UNICODETEXT; format.cfFormat = CF_UNICODETEXT;
#endif
GlobalUnlock (medium.hGlobal); GlobalUnlock (medium.hGlobal);
@ -4033,12 +3844,20 @@ static LRESULT CALLBACK activeXHookWndProc (HWND hwnd, UINT message, WPARAM wPar
case WM_LBUTTONUP: case WM_LBUTTONUP:
case WM_MBUTTONUP: case WM_MBUTTONUP:
case WM_RBUTTONUP: case WM_RBUTTONUP:
case WM_LBUTTONDBLCLK:
case WM_MBUTTONDBLCLK:
case WM_RBUTTONDBLCLK:
if (ax->isShowing()) if (ax->isShowing())
{ {
ComponentPeer* const peer = ax->getPeer(); ComponentPeer* const peer = ax->getPeer();
if (peer != 0) if (peer != 0)
{
offerActiveXMouseEventToPeer (peer, hwnd, message, lParam); offerActiveXMouseEventToPeer (peer, hwnd, message, lParam);
if (! ax->areMouseEventsAllowed())
return 0;
}
} }
break; break;
@ -4055,7 +3874,8 @@ static LRESULT CALLBACK activeXHookWndProc (HWND hwnd, UINT message, WPARAM wPar
ActiveXControlComponent::ActiveXControlComponent() ActiveXControlComponent::ActiveXControlComponent()
: originalWndProc (0), : originalWndProc (0),
control (0) control (0),
mouseEventsAllowed (true)
{ {
activeXComps.add (this); activeXComps.add (this);
} }
@ -4169,5 +3989,10 @@ void ActiveXControlComponent::setControlVisible (const bool shouldBeVisible) con
ShowWindow (hwnd, shouldBeVisible ? SW_SHOWNA : SW_HIDE); ShowWindow (hwnd, shouldBeVisible ? SW_SHOWNA : SW_HIDE);
} }
void ActiveXControlComponent::setMouseEventsAllowed (const bool eventsCanReachControl)
{
mouseEventsAllowed = eventsCanReachControl;
}
END_JUCE_NAMESPACE END_JUCE_NAMESPACE

View file

@ -48,6 +48,9 @@
#define _WIN32_WINNT 0x0500 #define _WIN32_WINNT 0x0500
#endif #endif
#define _UNICODE 1
#define UNICODE 1
#include <windows.h> #include <windows.h>
#include <commdlg.h> #include <commdlg.h>
#include <shellapi.h> #include <shellapi.h>
@ -61,22 +64,4 @@
#pragma warning (pop) #pragma warning (pop)
#endif #endif
//==============================================================================
#ifndef JUCE_ENABLE_WIN98_COMPATIBILITY
#define JUCE_ENABLE_WIN98_COMPATIBILITY 1
#endif
// helpers for dynamically loading unicode functions..
#if JUCE_ENABLE_WIN98_COMPATIBILITY
#define UNICODE_FUNCTION(functionName, returnType, params) \
typedef returnType (WINAPI *type##functionName) params; \
static type##functionName w##functionName = 0;
#define UNICODE_FUNCTION_LOAD(functionName) \
w##functionName = (type##functionName) GetProcAddress (h, #functionName); \
jassert (w##functionName != 0);
#endif
#endif // __WIN32_HEADERS_JUCEHEADER__ #endif // __WIN32_HEADERS_JUCEHEADER__

View file

@ -28,6 +28,7 @@ Changelist for version 1.46
- fixed InterprocessLock on mac/linux so that it can't get stuck when an app quits unexpectedly - fixed InterprocessLock on mac/linux so that it can't get stuck when an app quits unexpectedly
- added an option to splash screens to close themselves when the mouse is clicked - added an option to splash screens to close themselves when the mouse is clicked
- change to ProgressBar to allow custom text and bars that are just spinning without a known progress position. This also meant a change to the params for LookAndFeel::drawProgressBar - change to ProgressBar to allow custom text and bars that are just spinning without a known progress position. This also meant a change to the params for LookAndFeel::drawProgressBar
- ditched win98 non-unicode support (presumably nobody will miss that!)
============================================================================== ==============================================================================
Changelist for version 1.45 Changelist for version 1.45

View file

@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>English</string> <string>English</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string></string> <string>DemoJuceAudioUnit</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string></string> <string></string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>

View file

@ -32,7 +32,6 @@
84581F990D917FC700AE1A4C /* AUScopeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 84581F8C0D917FC700AE1A4C /* AUScopeElement.h */; }; 84581F990D917FC700AE1A4C /* AUScopeElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 84581F8C0D917FC700AE1A4C /* AUScopeElement.h */; };
84581F9A0D917FC700AE1A4C /* ComponentBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84581F8D0D917FC700AE1A4C /* ComponentBase.cpp */; }; 84581F9A0D917FC700AE1A4C /* ComponentBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84581F8D0D917FC700AE1A4C /* ComponentBase.cpp */; };
84581F9B0D917FC700AE1A4C /* ComponentBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 84581F8E0D917FC700AE1A4C /* ComponentBase.h */; }; 84581F9B0D917FC700AE1A4C /* ComponentBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 84581F8E0D917FC700AE1A4C /* ComponentBase.h */; };
845FAE5F0A5C0A6A008C94D8 /* juce.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 845FAE5E0A5C0A6A008C94D8 /* juce.xcconfig */; };
845FAEE10A5C2696008C94D8 /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 845FAEE00A5C2696008C94D8 /* QuickTime.framework */; }; 845FAEE10A5C2696008C94D8 /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 845FAEE00A5C2696008C94D8 /* QuickTime.framework */; };
84B4CDD10C7DD23B0083122F /* MusicDeviceBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84B4CDCF0C7DD23B0083122F /* MusicDeviceBase.cpp */; }; 84B4CDD10C7DD23B0083122F /* MusicDeviceBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84B4CDCF0C7DD23B0083122F /* MusicDeviceBase.cpp */; };
84B4CDD20C7DD23B0083122F /* MusicDeviceBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B4CDD00C7DD23B0083122F /* MusicDeviceBase.h */; }; 84B4CDD20C7DD23B0083122F /* MusicDeviceBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 84B4CDD00C7DD23B0083122F /* MusicDeviceBase.h */; };
@ -48,7 +47,6 @@
84EB400C090A4A2C008FAC1B /* juce_AudioUnitWrapper.r in Rez */ = {isa = PBXBuildFile; fileRef = 84EB400A090A4A2C008FAC1B /* juce_AudioUnitWrapper.r */; }; 84EB400C090A4A2C008FAC1B /* juce_AudioUnitWrapper.r in Rez */ = {isa = PBXBuildFile; fileRef = 84EB400A090A4A2C008FAC1B /* juce_AudioUnitWrapper.r */; };
84EB4042090A4F5A008FAC1B /* CAVectorUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4E5DC280898301D00589A5A /* CAVectorUnit.cpp */; }; 84EB4042090A4F5A008FAC1B /* CAVectorUnit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4E5DC280898301D00589A5A /* CAVectorUnit.cpp */; };
84EB404E090A5116008FAC1B /* JucePluginCharacteristics.h in Headers */ = {isa = PBXBuildFile; fileRef = 84EB404D090A5116008FAC1B /* JucePluginCharacteristics.h */; }; 84EB404E090A5116008FAC1B /* JucePluginCharacteristics.h in Headers */ = {isa = PBXBuildFile; fileRef = 84EB404D090A5116008FAC1B /* JucePluginCharacteristics.h */; };
84F0521E090674BB00AEC8DB /* Info-JuceAU.plist in Resources */ = {isa = PBXBuildFile; fileRef = 84F05215090674BB00AEC8DB /* Info-JuceAU.plist */; };
84F0548F090687F600AEC8DB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84F0548E090687F600AEC8DB /* CoreAudio.framework */; }; 84F0548F090687F600AEC8DB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 84F0548E090687F600AEC8DB /* CoreAudio.framework */; };
84F054E80906C8DD00AEC8DB /* AUMIDIBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F054E40906C8DD00AEC8DB /* AUMIDIBase.cpp */; }; 84F054E80906C8DD00AEC8DB /* AUMIDIBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 84F054E40906C8DD00AEC8DB /* AUMIDIBase.cpp */; };
84F054E90906C8DD00AEC8DB /* AUMIDIBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F054E50906C8DD00AEC8DB /* AUMIDIBase.h */; }; 84F054E90906C8DD00AEC8DB /* AUMIDIBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 84F054E50906C8DD00AEC8DB /* AUMIDIBase.h */; };
@ -454,8 +452,6 @@
isa = PBXResourcesBuildPhase; isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
84F0521E090674BB00AEC8DB /* Info-JuceAU.plist in Resources */,
845FAE5F0A5C0A6A008C94D8 /* juce.xcconfig in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };

View file

@ -105,6 +105,13 @@ public:
*/ */
void* queryInterface (const void* iid) const; void* queryInterface (const void* iid) const;
/** Set this to false to stop mouse events being allowed through to the control.
*/
void setMouseEventsAllowed (const bool eventsCanReachControl);
/** Returns true if mouse events are allowed to get through to the control.
*/
bool areMouseEventsAllowed() const throw() { return mouseEventsAllowed; }
//============================================================================== //==============================================================================
/** @internal */ /** @internal */
@ -117,6 +124,7 @@ public:
private: private:
friend class ActiveXControlData; friend class ActiveXControlData;
void* control; void* control;
bool mouseEventsAllowed;
ActiveXControlComponent (const ActiveXControlComponent&); ActiveXControlComponent (const ActiveXControlComponent&);
const ActiveXControlComponent& operator= (const ActiveXControlComponent&); const ActiveXControlComponent& operator= (const ActiveXControlComponent&);

View file

@ -134,6 +134,7 @@ QuickTimeMovieComponent::QuickTimeMovieComponent()
controllerVisible (true) controllerVisible (true)
{ {
internal = new QTMovieCompInternal(); internal = new QTMovieCompInternal();
setMouseEventsAllowed (false);
} }
QuickTimeMovieComponent::~QuickTimeMovieComponent() QuickTimeMovieComponent::~QuickTimeMovieComponent()
@ -232,7 +233,6 @@ void QuickTimeMovieComponent::closeMovie()
if (qtControl != 0) if (qtControl != 0)
qtControl->Put_MovieHandle (0); qtControl->Put_MovieHandle (0);
//qtControl->PutURL (L"");
((QTMovieCompInternal*) internal)->clearHandle(); ((QTMovieCompInternal*) internal)->clearHandle();
} }

View file

@ -38,7 +38,7 @@
See also SystemStats::getJUCEVersion() for a string version. See also SystemStats::getJUCEVersion() for a string version.
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 45 #define JUCE_MINOR_VERSION 46
/** Current Juce version number. /** Current Juce version number.