@@ -38,9 +38,15 @@ SystemStats::CPUFlags SystemStats::cpuFlags; | |||||
const String SystemStats::getJUCEVersion() | const String SystemStats::getJUCEVersion() | ||||
{ | { | ||||
return "JUCE v" + String (JUCE_MAJOR_VERSION) | |||||
+ "." + String (JUCE_MINOR_VERSION) | |||||
+ "." + String (JUCE_BUILDNUMBER); | |||||
#define JUCE_STRINGIFYVERSION2(a) #a | |||||
#define JUCE_STRINGIFYVERSION(a) JUCE_STRINGIFYVERSION2(a) | |||||
return "JUCE v" JUCE_STRINGIFYVERSION(JUCE_MAJOR_VERSION) | |||||
"." JUCE_STRINGIFYVERSION(JUCE_MINOR_VERSION) | |||||
"." JUCE_STRINGIFYVERSION(JUCE_BUILDNUMBER); | |||||
#undef JUCE_STRINGIFYVERSION | |||||
#undef JUCE_STRINGIFYVERSION2 | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -39,8 +39,6 @@ public: | |||||
//============================================================================== | //============================================================================== | ||||
/** Returns the current version of JUCE, | /** Returns the current version of JUCE, | ||||
(just in case you didn't already know at compile-time.) | |||||
See also the JUCE_VERSION, JUCE_MAJOR_VERSION and JUCE_MINOR_VERSION macros. | See also the JUCE_VERSION, JUCE_MAJOR_VERSION and JUCE_MINOR_VERSION macros. | ||||
*/ | */ | ||||
static const String getJUCEVersion(); | static const String getJUCEVersion(); | ||||
@@ -128,7 +128,7 @@ namespace TimeHelpers | |||||
#elif JUCE_WINDOWS | #elif JUCE_WINDOWS | ||||
HeapBlock <wchar_t> tempDest; | HeapBlock <wchar_t> tempDest; | ||||
tempDest.calloc (maxChars + 2); | tempDest.calloc (maxChars + 2); | ||||
const int result = (int) wcsftime (tempDest, maxChars, format.toUTF16(), tm); | |||||
const int result = (int) wcsftime (tempDest, maxChars, format.toWideCharPointer(), tm); | |||||
if (result > 0) | if (result > 0) | ||||
dest.writeAll (CharPointer_UTF16 (tempDest.getData())); | dest.writeAll (CharPointer_UTF16 (tempDest.getData())); | ||||
return result; | return result; | ||||
@@ -240,15 +240,13 @@ public: | |||||
if (owner->shouldDropFilesWhenDraggedExternally (dragDescLocal, source, files, canMoveFiles) | if (owner->shouldDropFilesWhenDraggedExternally (dragDescLocal, source, files, canMoveFiles) | ||||
&& files.size() > 0) | && files.size() > 0) | ||||
{ | { | ||||
WeakReference<Component> cdw (this); | |||||
WeakReference<Component> thisWeakRef (this); | |||||
setVisible (false); | setVisible (false); | ||||
if (ModifierKeys::getCurrentModifiersRealtime().isAnyMouseButtonDown()) | if (ModifierKeys::getCurrentModifiersRealtime().isAnyMouseButtonDown()) | ||||
DragAndDropContainer::performExternalDragDropOfFiles (files, canMoveFiles); | DragAndDropContainer::performExternalDragDropOfFiles (files, canMoveFiles); | ||||
if (cdw != 0) | |||||
delete this; | |||||
delete thisWeakRef.get(); | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
@@ -808,7 +808,7 @@ private: | |||||
// doing a direct load of the COM object (only available via the juce_createASIOAudioIODeviceForGUID function). | // doing a direct load of the COM object (only available via the juce_createASIOAudioIODeviceForGUID function). | ||||
if (optionalDllForDirectLoading.isNotEmpty()) | if (optionalDllForDirectLoading.isNotEmpty()) | ||||
{ | { | ||||
HMODULE h = LoadLibrary (optionalDllForDirectLoading.toUTF16()); | |||||
HMODULE h = LoadLibrary (optionalDllForDirectLoading.toWideCharPointer()); | |||||
if (h != 0) | if (h != 0) | ||||
{ | { | ||||
@@ -1799,7 +1799,7 @@ private: | |||||
{ | { | ||||
HKEY subKey; | HKEY subKey; | ||||
if (RegOpenKeyEx (hk, keyName.toUTF16(), 0, KEY_READ, &subKey) == ERROR_SUCCESS) | |||||
if (RegOpenKeyEx (hk, keyName.toWideCharPointer(), 0, KEY_READ, &subKey) == ERROR_SUCCESS) | |||||
{ | { | ||||
TCHAR buf [256] = { 0 }; | TCHAR buf [256] = { 0 }; | ||||
DWORD dtype = REG_SZ; | DWORD dtype = REG_SZ; | ||||
@@ -34,7 +34,6 @@ namespace ActiveXHelpers | |||||
{ | { | ||||
public: | public: | ||||
JuceIStorage() {} | JuceIStorage() {} | ||||
~JuceIStorage() {} | |||||
HRESULT __stdcall CreateStream (const WCHAR*, DWORD, DWORD, DWORD, IStream**) { return E_NOTIMPL; } | HRESULT __stdcall CreateStream (const WCHAR*, DWORD, DWORD, DWORD, IStream**) { return E_NOTIMPL; } | ||||
HRESULT __stdcall OpenStream (const WCHAR*, void*, DWORD, DWORD, IStream**) { return E_NOTIMPL; } | HRESULT __stdcall OpenStream (const WCHAR*, void*, DWORD, DWORD, IStream**) { return E_NOTIMPL; } | ||||
@@ -60,7 +59,6 @@ namespace ActiveXHelpers | |||||
public: | public: | ||||
JuceOleInPlaceFrame (HWND window_) : window (window_) {} | JuceOleInPlaceFrame (HWND window_) : window (window_) {} | ||||
~JuceOleInPlaceFrame() {} | |||||
HRESULT __stdcall GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; } | HRESULT __stdcall GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; } | ||||
HRESULT __stdcall ContextSensitiveHelp (BOOL) { return E_NOTIMPL; } | HRESULT __stdcall ContextSensitiveHelp (BOOL) { return E_NOTIMPL; } | ||||
@@ -272,7 +272,7 @@ public: | |||||
if (SUCCEEDED (hr)) | if (SUCCEEDED (hr)) | ||||
{ | { | ||||
hr = fileSink->SetFileName (file.getFullPathName().toUTF16(), 0); | |||||
hr = fileSink->SetFileName (file.getFullPathName().toWideCharPointer(), 0); | |||||
if (SUCCEEDED (hr)) | if (SUCCEEDED (hr)) | ||||
{ | { | ||||
@@ -316,7 +316,7 @@ public: | |||||
.replace ("$AVGTIMEPERFRAME", String (10000000 / maxFramesPerSecond)); | .replace ("$AVGTIMEPERFRAME", String (10000000 / maxFramesPerSecond)); | ||||
ComSmartPtr <IWMProfile> currentProfile; | ComSmartPtr <IWMProfile> currentProfile; | ||||
hr = profileManager->LoadProfileByData (prof.toUTF16(), currentProfile.resetAndGetPointerAddress()); | |||||
hr = profileManager->LoadProfileByData (prof.toWideCharPointer(), currentProfile.resetAndGetPointerAddress()); | |||||
hr = asfConfig->ConfigureFilterUsingProfile (currentProfile); | hr = asfConfig->ConfigureFilterUsingProfile (currentProfile); | ||||
if (SUCCEEDED (hr)) | if (SUCCEEDED (hr)) | ||||
@@ -44,7 +44,7 @@ DynamicLibraryLoader::~DynamicLibraryLoader() | |||||
bool DynamicLibraryLoader::load (const String& name) | bool DynamicLibraryLoader::load (const String& name) | ||||
{ | { | ||||
FreeLibrary ((HMODULE) libHandle); | FreeLibrary ((HMODULE) libHandle); | ||||
libHandle = name.isNotEmpty() ? LoadLibrary (name.toUTF16()) : 0; | |||||
libHandle = name.isNotEmpty() ? LoadLibrary (name.toWideCharPointer()) : 0; | |||||
return libHandle != 0; | return libHandle != 0; | ||||
} | } | ||||
@@ -186,7 +186,7 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title_ | |||||
bi.hwndOwner = (HWND) parentWindow.getWindowHandle(); | bi.hwndOwner = (HWND) parentWindow.getWindowHandle(); | ||||
bi.pszDisplayName = files; | bi.pszDisplayName = files; | ||||
bi.lpszTitle = title.toUTF16(); | |||||
bi.lpszTitle = title.toWideCharPointer(); | |||||
bi.lParam = (LPARAM) &info; | bi.lParam = (LPARAM) &info; | ||||
bi.lpfn = browseCallbackProc; | bi.lpfn = browseCallbackProc; | ||||
#ifdef BIF_USENEWUI | #ifdef BIF_USENEWUI | ||||
@@ -253,8 +253,8 @@ void FileChooser::showPlatformDialog (Array<File>& results, const String& title_ | |||||
of.nFilterIndex = 1; | of.nFilterIndex = 1; | ||||
of.lpstrFile = files; | of.lpstrFile = files; | ||||
of.nMaxFile = charsAvailableForResult; | of.nMaxFile = charsAvailableForResult; | ||||
of.lpstrInitialDir = localPath.toUTF16(); | |||||
of.lpstrTitle = title.toUTF16(); | |||||
of.lpstrInitialDir = localPath.toWideCharPointer(); | |||||
of.lpstrTitle = title.toWideCharPointer(); | |||||
of.Flags = flags; | of.Flags = flags; | ||||
of.lCustData = (LPARAM) &info; | of.lCustData = (LPARAM) &info; | ||||
@@ -72,7 +72,7 @@ namespace WindowsFileHelpers | |||||
{ | { | ||||
ULARGE_INTEGER spc, tot, totFree; | ULARGE_INTEGER spc, tot, totFree; | ||||
if (GetDiskFreeSpaceEx (getDriveFromPath (path).toUTF16(), &spc, &tot, &totFree)) | |||||
if (GetDiskFreeSpaceEx (getDriveFromPath (path).toWideCharPointer(), &spc, &tot, &totFree)) | |||||
return total ? (int64) tot.QuadPart | return total ? (int64) tot.QuadPart | ||||
: (int64) spc.QuadPart; | : (int64) spc.QuadPart; | ||||
@@ -81,7 +81,7 @@ namespace WindowsFileHelpers | |||||
unsigned int getWindowsDriveType (const String& path) | unsigned int getWindowsDriveType (const String& path) | ||||
{ | { | ||||
return GetDriveType (getDriveFromPath (path).toUTF16()); | |||||
return GetDriveType (getDriveFromPath (path).toWideCharPointer()); | |||||
} | } | ||||
const File getSpecialFolderPath (int type) | const File getSpecialFolderPath (int type) | ||||
@@ -104,25 +104,25 @@ const String File::separatorString ("\\"); | |||||
bool File::exists() const | bool File::exists() const | ||||
{ | { | ||||
return fullPath.isNotEmpty() | return fullPath.isNotEmpty() | ||||
&& GetFileAttributes (fullPath.toUTF16()) != INVALID_FILE_ATTRIBUTES; | |||||
&& GetFileAttributes (fullPath.toWideCharPointer()) != INVALID_FILE_ATTRIBUTES; | |||||
} | } | ||||
bool File::existsAsFile() const | bool File::existsAsFile() const | ||||
{ | { | ||||
return fullPath.isNotEmpty() | return fullPath.isNotEmpty() | ||||
&& (GetFileAttributes (fullPath.toUTF16()) & FILE_ATTRIBUTE_DIRECTORY) == 0; | |||||
&& (GetFileAttributes (fullPath.toWideCharPointer()) & FILE_ATTRIBUTE_DIRECTORY) == 0; | |||||
} | } | ||||
bool File::isDirectory() const | bool File::isDirectory() const | ||||
{ | { | ||||
const DWORD attr = GetFileAttributes (fullPath.toUTF16()); | |||||
const DWORD attr = GetFileAttributes (fullPath.toWideCharPointer()); | |||||
return ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) && (attr != INVALID_FILE_ATTRIBUTES); | return ((attr & FILE_ATTRIBUTE_DIRECTORY) != 0) && (attr != INVALID_FILE_ATTRIBUTES); | ||||
} | } | ||||
bool File::hasWriteAccess() const | bool File::hasWriteAccess() const | ||||
{ | { | ||||
if (exists()) | if (exists()) | ||||
return (GetFileAttributes (fullPath.toUTF16()) & FILE_ATTRIBUTE_READONLY) == 0; | |||||
return (GetFileAttributes (fullPath.toWideCharPointer()) & FILE_ATTRIBUTE_READONLY) == 0; | |||||
// on windows, it seems that even read-only directories can still be written into, | // on windows, it seems that even read-only directories can still be written into, | ||||
// so checking the parent directory's permissions would return the wrong result.. | // so checking the parent directory's permissions would return the wrong result.. | ||||
@@ -131,7 +131,7 @@ bool File::hasWriteAccess() const | |||||
bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const | bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const | ||||
{ | { | ||||
DWORD attr = GetFileAttributes (fullPath.toUTF16()); | |||||
DWORD attr = GetFileAttributes (fullPath.toWideCharPointer()); | |||||
if (attr == INVALID_FILE_ATTRIBUTES) | if (attr == INVALID_FILE_ATTRIBUTES) | ||||
return false; | return false; | ||||
@@ -144,12 +144,12 @@ bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const | |||||
else | else | ||||
attr &= ~FILE_ATTRIBUTE_READONLY; | attr &= ~FILE_ATTRIBUTE_READONLY; | ||||
return SetFileAttributes (fullPath.toUTF16(), attr) != FALSE; | |||||
return SetFileAttributes (fullPath.toWideCharPointer(), attr) != FALSE; | |||||
} | } | ||||
bool File::isHidden() const | bool File::isHidden() const | ||||
{ | { | ||||
return (GetFileAttributes (getFullPathName().toUTF16()) & FILE_ATTRIBUTE_HIDDEN) != 0; | |||||
return (GetFileAttributes (getFullPathName().toWideCharPointer()) & FILE_ATTRIBUTE_HIDDEN) != 0; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -157,10 +157,9 @@ bool File::deleteFile() const | |||||
{ | { | ||||
if (! exists()) | if (! exists()) | ||||
return true; | return true; | ||||
else if (isDirectory()) | |||||
return RemoveDirectory (fullPath.toUTF16()) != 0; | |||||
else | |||||
return DeleteFile (fullPath.toUTF16()) != 0; | |||||
return isDirectory() ? RemoveDirectory (fullPath.toWideCharPointer()) != 0 | |||||
: DeleteFile (fullPath.toWideCharPointer()) != 0; | |||||
} | } | ||||
bool File::moveToTrash() const | bool File::moveToTrash() const | ||||
@@ -186,17 +185,17 @@ bool File::moveToTrash() const | |||||
bool File::copyInternal (const File& dest) const | bool File::copyInternal (const File& dest) const | ||||
{ | { | ||||
return CopyFile (fullPath.toUTF16(), dest.getFullPathName().toUTF16(), false) != 0; | |||||
return CopyFile (fullPath.toWideCharPointer(), dest.getFullPathName().toWideCharPointer(), false) != 0; | |||||
} | } | ||||
bool File::moveInternal (const File& dest) const | bool File::moveInternal (const File& dest) const | ||||
{ | { | ||||
return MoveFile (fullPath.toUTF16(), dest.getFullPathName().toUTF16()) != 0; | |||||
return MoveFile (fullPath.toWideCharPointer(), dest.getFullPathName().toWideCharPointer()) != 0; | |||||
} | } | ||||
void File::createDirectoryInternal (const String& fileName) const | void File::createDirectoryInternal (const String& fileName) const | ||||
{ | { | ||||
CreateDirectory (fileName.toUTF16(), 0); | |||||
CreateDirectory (fileName.toWideCharPointer(), 0); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -212,7 +211,7 @@ void FileInputStream::openHandle() | |||||
{ | { | ||||
totalSize = file.getSize(); | totalSize = file.getSize(); | ||||
HANDLE h = CreateFile (file.getFullPathName().toUTF16(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, | |||||
HANDLE h = CreateFile (file.getFullPathName().toWideCharPointer(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, | |||||
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0); | OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, 0); | ||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
@@ -239,7 +238,7 @@ size_t FileInputStream::readInternal (void* buffer, size_t numBytes) | |||||
//============================================================================== | //============================================================================== | ||||
void FileOutputStream::openHandle() | void FileOutputStream::openHandle() | ||||
{ | { | ||||
HANDLE h = CreateFile (file.getFullPathName().toUTF16(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||||
HANDLE h = CreateFile (file.getFullPathName().toWideCharPointer(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||||
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | ||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
@@ -284,7 +283,7 @@ int64 File::getSize() const | |||||
{ | { | ||||
WIN32_FILE_ATTRIBUTE_DATA attributes; | WIN32_FILE_ATTRIBUTE_DATA attributes; | ||||
if (GetFileAttributesEx (fullPath.toUTF16(), GetFileExInfoStandard, &attributes)) | |||||
if (GetFileAttributesEx (fullPath.toWideCharPointer(), GetFileExInfoStandard, &attributes)) | |||||
return (((int64) attributes.nFileSizeHigh) << 32) | attributes.nFileSizeLow; | return (((int64) attributes.nFileSizeHigh) << 32) | attributes.nFileSizeLow; | ||||
return 0; | return 0; | ||||
@@ -295,7 +294,7 @@ void File::getFileTimesInternal (int64& modificationTime, int64& accessTime, int | |||||
using namespace WindowsFileHelpers; | using namespace WindowsFileHelpers; | ||||
WIN32_FILE_ATTRIBUTE_DATA attributes; | WIN32_FILE_ATTRIBUTE_DATA attributes; | ||||
if (GetFileAttributesEx (fullPath.toUTF16(), GetFileExInfoStandard, &attributes)) | |||||
if (GetFileAttributesEx (fullPath.toWideCharPointer(), GetFileExInfoStandard, &attributes)) | |||||
{ | { | ||||
modificationTime = fileTimeToTime (&attributes.ftLastWriteTime); | modificationTime = fileTimeToTime (&attributes.ftLastWriteTime); | ||||
creationTime = fileTimeToTime (&attributes.ftCreationTime); | creationTime = fileTimeToTime (&attributes.ftCreationTime); | ||||
@@ -312,7 +311,7 @@ bool File::setFileTimesInternal (int64 modificationTime, int64 accessTime, int64 | |||||
using namespace WindowsFileHelpers; | using namespace WindowsFileHelpers; | ||||
bool ok = false; | bool ok = false; | ||||
HANDLE h = CreateFile (fullPath.toUTF16(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||||
HANDLE h = CreateFile (fullPath.toWideCharPointer(), GENERIC_WRITE, FILE_SHARE_READ, 0, | |||||
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); | ||||
if (h != INVALID_HANDLE_VALUE) | if (h != INVALID_HANDLE_VALUE) | ||||
@@ -362,7 +361,7 @@ void File::findFileSystemRoots (Array<File>& destArray) | |||||
const String File::getVolumeLabel() const | const String File::getVolumeLabel() const | ||||
{ | { | ||||
TCHAR dest[64]; | TCHAR dest[64]; | ||||
if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toUTF16(), dest, | |||||
if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, | |||||
numElementsInArray (dest), 0, 0, 0, 0, 0)) | numElementsInArray (dest), 0, 0, 0, 0, 0)) | ||||
dest[0] = 0; | dest[0] = 0; | ||||
@@ -374,7 +373,7 @@ int File::getVolumeSerialNumber() const | |||||
TCHAR dest[64]; | TCHAR dest[64]; | ||||
DWORD serialNum; | DWORD serialNum; | ||||
if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toUTF16(), dest, | |||||
if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, | |||||
numElementsInArray (dest), &serialNum, 0, 0, 0, 0)) | numElementsInArray (dest), &serialNum, 0, 0, 0, 0)) | ||||
return 0; | return 0; | ||||
@@ -486,7 +485,7 @@ const File File::getCurrentWorkingDirectory() | |||||
bool File::setAsCurrentWorkingDirectory() const | bool File::setAsCurrentWorkingDirectory() const | ||||
{ | { | ||||
return SetCurrentDirectory (getFullPathName().toUTF16()) != FALSE; | |||||
return SetCurrentDirectory (getFullPathName().toWideCharPointer()) != FALSE; | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -495,11 +494,11 @@ const String File::getVersion() const | |||||
String result; | String result; | ||||
DWORD handle = 0; | DWORD handle = 0; | ||||
DWORD bufferSize = GetFileVersionInfoSize (getFullPathName().toUTF16(), &handle); | |||||
DWORD bufferSize = GetFileVersionInfoSize (getFullPathName().toWideCharPointer(), &handle); | |||||
HeapBlock<char> buffer; | HeapBlock<char> buffer; | ||||
buffer.calloc (bufferSize); | buffer.calloc (bufferSize); | ||||
if (GetFileVersionInfo (getFullPathName().toUTF16(), 0, bufferSize, buffer)) | |||||
if (GetFileVersionInfo (getFullPathName().toWideCharPointer(), 0, bufferSize, buffer)) | |||||
{ | { | ||||
VS_FIXEDFILEINFO* vffi; | VS_FIXEDFILEINFO* vffi; | ||||
UINT len = 0; | UINT len = 0; | ||||
@@ -533,7 +532,7 @@ const File File::getLinkedTarget() const | |||||
ComSmartPtr <IPersistFile> persistFile; | ComSmartPtr <IPersistFile> persistFile; | ||||
if (SUCCEEDED (shellLink.QueryInterface (IID_IPersistFile, persistFile))) | if (SUCCEEDED (shellLink.QueryInterface (IID_IPersistFile, persistFile))) | ||||
{ | { | ||||
if (SUCCEEDED (persistFile->Load (p.toUTF16(), STGM_READ)) | |||||
if (SUCCEEDED (persistFile->Load (p.toWideCharPointer(), STGM_READ)) | |||||
&& SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI))) | && SUCCEEDED (shellLink->Resolve (0, SLR_ANY_MATCH | SLR_NO_UI))) | ||||
{ | { | ||||
WIN32_FIND_DATA winFindData; | WIN32_FIND_DATA winFindData; | ||||
@@ -574,7 +573,7 @@ public: | |||||
if (handle == INVALID_HANDLE_VALUE) | if (handle == INVALID_HANDLE_VALUE) | ||||
{ | { | ||||
handle = FindFirstFile (directoryWithWildCard.toUTF16(), &findData); | |||||
handle = FindFirstFile (directoryWithWildCard.toWideCharPointer(), &findData); | |||||
if (handle == INVALID_HANDLE_VALUE) | if (handle == INVALID_HANDLE_VALUE) | ||||
return false; | return false; | ||||
@@ -628,7 +627,7 @@ bool PlatformUtilities::openDocument (const String& fileName, const String& para | |||||
JUCE_TRY | JUCE_TRY | ||||
{ | { | ||||
hInstance = ShellExecute (0, 0, fileName.toUTF16(), parameters.toUTF16(), 0, SW_SHOWDEFAULT); | |||||
hInstance = ShellExecute (0, 0, fileName.toWideCharPointer(), parameters.toWideCharPointer(), 0, SW_SHOWDEFAULT); | |||||
} | } | ||||
JUCE_CATCH_ALL | JUCE_CATCH_ALL | ||||
@@ -655,9 +654,9 @@ public: | |||||
{ | { | ||||
cancelEvent = CreateEvent (0, FALSE, FALSE, 0); | cancelEvent = CreateEvent (0, FALSE, FALSE, 0); | ||||
pipeH = isPipe ? CreateNamedPipe (file.toUTF16(), PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, | |||||
pipeH = isPipe ? CreateNamedPipe (file.toWideCharPointer(), PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, 0, | |||||
PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, 0) | PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, 0) | ||||
: CreateFile (file.toUTF16(), GENERIC_READ | GENERIC_WRITE, 0, 0, | |||||
: CreateFile (file.toWideCharPointer(), GENERIC_READ | GENERIC_WRITE, 0, 0, | |||||
OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); | OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); | ||||
} | } | ||||
@@ -285,7 +285,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||||
wc.lpfnWndProc = (WNDPROC) juce_MessageWndProc; | wc.lpfnWndProc = (WNDPROC) juce_MessageWndProc; | ||||
wc.cbWndExtra = 4; | wc.cbWndExtra = 4; | ||||
wc.hInstance = hmod; | wc.hInstance = hmod; | ||||
wc.lpszClassName = className.toUTF16(); | |||||
wc.lpszClassName = className.toWideCharPointer(); | |||||
RegisterClassEx (&wc); | RegisterClassEx (&wc); | ||||
@@ -298,7 +298,7 @@ void MessageManager::doPlatformSpecificInitialisation() | |||||
void MessageManager::doPlatformSpecificShutdown() | void MessageManager::doPlatformSpecificShutdown() | ||||
{ | { | ||||
DestroyWindow (juce_messageWindowHandle); | DestroyWindow (juce_messageWindowHandle); | ||||
UnregisterClass (getMessageWindowClassName().toUTF16(), 0); | |||||
UnregisterClass (getMessageWindowClassName().toWideCharPointer(), 0); | |||||
OleUninitialize(); | OleUninitialize(); | ||||
} | } | ||||
@@ -235,7 +235,7 @@ private: | |||||
uc.lpszUrlPath = file; | uc.lpszUrlPath = file; | ||||
uc.lpszHostName = server; | uc.lpszHostName = server; | ||||
if (InternetCrackUrl (address.toUTF16(), 0, 0, &uc)) | |||||
if (InternetCrackUrl (address.toWideCharPointer(), 0, 0, &uc)) | |||||
{ | { | ||||
int disable = 1; | int disable = 1; | ||||
InternetSetOption (sessionHandle, INTERNET_OPTION_DISABLE_AUTODIAL, &disable, sizeof (disable)); | InternetSetOption (sessionHandle, INTERNET_OPTION_DISABLE_AUTODIAL, &disable, sizeof (disable)); | ||||
@@ -295,7 +295,7 @@ private: | |||||
INTERNET_BUFFERS buffers; | INTERNET_BUFFERS buffers; | ||||
zerostruct (buffers); | zerostruct (buffers); | ||||
buffers.dwStructSize = sizeof (INTERNET_BUFFERS); | buffers.dwStructSize = sizeof (INTERNET_BUFFERS); | ||||
buffers.lpcszHeader = headers.toUTF16(); | |||||
buffers.lpcszHeader = headers.toWideCharPointer(); | |||||
buffers.dwHeadersLength = headers.length(); | buffers.dwHeadersLength = headers.length(); | ||||
buffers.dwBufferTotal = (DWORD) postData.getSize(); | buffers.dwBufferTotal = (DWORD) postData.getSize(); | ||||
@@ -55,13 +55,13 @@ namespace | |||||
if (createForWriting) | if (createForWriting) | ||||
{ | { | ||||
if (RegCreateKeyEx (rootKey, name.toUTF16(), 0, 0, REG_OPTION_NON_VOLATILE, | |||||
if (RegCreateKeyEx (rootKey, name.toWideCharPointer(), 0, 0, REG_OPTION_NON_VOLATILE, | |||||
(KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS) | (KEY_WRITE | KEY_QUERY_VALUE), 0, &key, &result) == ERROR_SUCCESS) | ||||
return key; | return key; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
if (RegOpenKeyEx (rootKey, name.toUTF16(), 0, KEY_READ, &key) == ERROR_SUCCESS) | |||||
if (RegOpenKeyEx (rootKey, name.toWideCharPointer(), 0, KEY_READ, &key) == ERROR_SUCCESS) | |||||
return key; | return key; | ||||
} | } | ||||
} | } | ||||
@@ -82,7 +82,7 @@ const String PlatformUtilities::getRegistryValue (const String& regValuePath, | |||||
unsigned long bufferSize = sizeof (buffer); | unsigned long bufferSize = sizeof (buffer); | ||||
DWORD type = REG_SZ; | DWORD type = REG_SZ; | ||||
if (RegQueryValueEx (k, valueName.toUTF16(), 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS) | |||||
if (RegQueryValueEx (k, valueName.toWideCharPointer(), 0, &type, (LPBYTE) buffer, &bufferSize) == ERROR_SUCCESS) | |||||
{ | { | ||||
if (type == REG_SZ) | if (type == REG_SZ) | ||||
result = buffer; | result = buffer; | ||||
@@ -104,7 +104,7 @@ void PlatformUtilities::setRegistryValue (const String& regValuePath, | |||||
if (k != 0) | if (k != 0) | ||||
{ | { | ||||
RegSetValueEx (k, valueName.toUTF16(), 0, REG_SZ, | |||||
RegSetValueEx (k, valueName.toWideCharPointer(), 0, REG_SZ, | |||||
(const BYTE*) value.toWideCharPointer(), | (const BYTE*) value.toWideCharPointer(), | ||||
CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer())); | CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer())); | ||||
@@ -124,7 +124,7 @@ bool PlatformUtilities::registryValueExists (const String& regValuePath) | |||||
unsigned long bufferSize = sizeof (buffer); | unsigned long bufferSize = sizeof (buffer); | ||||
DWORD type = 0; | DWORD type = 0; | ||||
if (RegQueryValueEx (k, valueName.toUTF16(), 0, &type, buffer, &bufferSize) == ERROR_SUCCESS) | |||||
if (RegQueryValueEx (k, valueName.toWideCharPointer(), 0, &type, buffer, &bufferSize) == ERROR_SUCCESS) | |||||
exists = true; | exists = true; | ||||
RegCloseKey (k); | RegCloseKey (k); | ||||
@@ -140,7 +140,7 @@ void PlatformUtilities::deleteRegistryValue (const String& regValuePath) | |||||
if (k != 0) | if (k != 0) | ||||
{ | { | ||||
RegDeleteValue (k, valueName.toUTF16()); | |||||
RegDeleteValue (k, valueName.toWideCharPointer()); | |||||
RegCloseKey (k); | RegCloseKey (k); | ||||
} | } | ||||
} | } | ||||
@@ -152,7 +152,7 @@ void PlatformUtilities::deleteRegistryKey (const String& regKeyPath) | |||||
if (k != 0) | if (k != 0) | ||||
{ | { | ||||
RegDeleteKey (k, valueName.toUTF16()); | |||||
RegDeleteKey (k, valueName.toWideCharPointer()); | |||||
RegCloseKey (k); | RegCloseKey (k); | ||||
} | } | ||||
} | } | ||||
@@ -220,9 +220,9 @@ void PlatformUtilities::setCurrentModuleInstanceHandle (void* const newHandle) t | |||||
void PlatformUtilities::fpuReset() | void PlatformUtilities::fpuReset() | ||||
{ | { | ||||
#if JUCE_MSVC | |||||
#if JUCE_MSVC | |||||
_clearfp(); | _clearfp(); | ||||
#endif | |||||
#endif | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -31,7 +31,7 @@ | |||||
//============================================================================== | //============================================================================== | ||||
void Logger::outputDebugString (const String& text) | void Logger::outputDebugString (const String& text) | ||||
{ | { | ||||
OutputDebugString ((text + "\n").toUTF16()); | |||||
OutputDebugString ((text + "\n").toWideCharPointer()); | |||||
} | } | ||||
//============================================================================== | //============================================================================== | ||||
@@ -303,9 +303,9 @@ void Process::lowerPrivilege() | |||||
void Process::terminate() | void Process::terminate() | ||||
{ | { | ||||
#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||||
#if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||||
_CrtDumpMemoryLeaks(); | _CrtDumpMemoryLeaks(); | ||||
#endif | |||||
#endif | |||||
// bullet in the head in case there's a problem shutting down.. | // bullet in the head in case there's a problem shutting down.. | ||||
ExitProcess (0); | ExitProcess (0); | ||||
@@ -318,7 +318,7 @@ void* PlatformUtilities::loadDynamicLibrary (const String& name) | |||||
JUCE_TRY | JUCE_TRY | ||||
{ | { | ||||
result = LoadLibrary (name.toUTF16()); | |||||
result = LoadLibrary (name.toWideCharPointer()); | |||||
} | } | ||||
JUCE_CATCH_ALL | JUCE_CATCH_ALL | ||||
@@ -58,8 +58,6 @@ static bool shouldDeactivateTitleBar = true; | |||||
#define WM_TRAYNOTIFY WM_USER + 100 | #define WM_TRAYNOTIFY WM_USER + 100 | ||||
using ::abs; | |||||
//============================================================================== | //============================================================================== | ||||
typedef BOOL (WINAPI* UpdateLayeredWinFunc) (HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD); | typedef BOOL (WINAPI* UpdateLayeredWinFunc) (HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD); | ||||
static UpdateLayeredWinFunc updateLayeredWindow = 0; | static UpdateLayeredWinFunc updateLayeredWindow = 0; | ||||
@@ -188,7 +186,7 @@ public: | |||||
previousBitmap = SelectObject (hdc, hBitmap); | previousBitmap = SelectObject (hdc, hBitmap); | ||||
if (format_ == Image::ARGB && clearImage) | if (format_ == Image::ARGB && clearImage) | ||||
zeromem (bitmapData, abs (h * lineStride)); | |||||
zeromem (bitmapData, std::abs (h * lineStride)); | |||||
imageData = bitmapData - (lineStride * (h - 1)); | imageData = bitmapData - (lineStride * (h - 1)); | ||||
} | } | ||||
@@ -470,11 +468,7 @@ public: | |||||
HWND parentToAddTo_) | HWND parentToAddTo_) | ||||
: ComponentPeer (component, windowStyleFlags), | : ComponentPeer (component, windowStyleFlags), | ||||
dontRepaint (false), | dontRepaint (false), | ||||
#if JUCE_DIRECT2D | |||||
currentRenderingEngine (direct2DRenderingEngine), | |||||
#else | |||||
currentRenderingEngine (softwareRenderingEngine), | currentRenderingEngine (softwareRenderingEngine), | ||||
#endif | |||||
fullScreen (false), | fullScreen (false), | ||||
isDragging (false), | isDragging (false), | ||||
isMouseOver (false), | isMouseOver (false), | ||||
@@ -542,7 +536,7 @@ public: | |||||
void setTitle (const String& title) | void setTitle (const String& title) | ||||
{ | { | ||||
SetWindowText (hwnd, title.toUTF16()); | |||||
SetWindowText (hwnd, title.toWideCharPointer()); | |||||
} | } | ||||
void setPosition (int x, int y) | void setPosition (int x, int y) | ||||
@@ -1082,7 +1076,7 @@ private: | |||||
wcex.cbSize = sizeof (wcex); | wcex.cbSize = sizeof (wcex); | ||||
wcex.style = CS_OWNDC; | wcex.style = CS_OWNDC; | ||||
wcex.lpfnWndProc = (WNDPROC) windowProc; | wcex.lpfnWndProc = (WNDPROC) windowProc; | ||||
wcex.lpszClassName = windowClassName.toUTF16(); | |||||
wcex.lpszClassName = windowClassName.toWideCharPointer(); | |||||
wcex.cbClsExtra = 0; | wcex.cbClsExtra = 0; | ||||
wcex.cbWndExtra = 32; | wcex.cbWndExtra = 32; | ||||
wcex.hInstance = moduleHandle; | wcex.hInstance = moduleHandle; | ||||
@@ -1099,7 +1093,7 @@ private: | |||||
~WindowClassHolder() | ~WindowClassHolder() | ||||
{ | { | ||||
if (ComponentPeer::getNumPeers() == 0) | if (ComponentPeer::getNumPeers() == 0) | ||||
UnregisterClass (windowClassName.toUTF16(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); | |||||
UnregisterClass (windowClassName.toWideCharPointer(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); | |||||
clearSingletonInstance(); | clearSingletonInstance(); | ||||
} | } | ||||
@@ -1165,12 +1159,12 @@ private: | |||||
&& Desktop::canUseSemiTransparentWindows()) | && Desktop::canUseSemiTransparentWindows()) | ||||
exstyle |= WS_EX_LAYERED; | exstyle |= WS_EX_LAYERED; | ||||
hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->windowClassName.toUTF16(), L"", type, 0, 0, 0, 0, | |||||
hwnd = CreateWindowEx (exstyle, WindowClassHolder::getInstance()->windowClassName.toWideCharPointer(), L"", type, 0, 0, 0, 0, | |||||
parentToAddTo, 0, (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0); | parentToAddTo, 0, (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle(), 0); | ||||
#if JUCE_DIRECT2D | |||||
updateDirect2DContext(); | |||||
#endif | |||||
#if JUCE_DIRECT2D | |||||
setCurrentRenderingEngine (1); | |||||
#endif | |||||
if (hwnd != 0) | if (hwnd != 0) | ||||
{ | { | ||||
@@ -1272,7 +1266,7 @@ private: | |||||
//============================================================================== | //============================================================================== | ||||
void handlePaintMessage() | void handlePaintMessage() | ||||
{ | { | ||||
#if JUCE_DIRECT2D | |||||
#if JUCE_DIRECT2D | |||||
if (direct2DContext != 0) | if (direct2DContext != 0) | ||||
{ | { | ||||
RECT r; | RECT r; | ||||
@@ -1286,7 +1280,8 @@ private: | |||||
} | } | ||||
} | } | ||||
else | else | ||||
#endif | |||||
#endif | |||||
{ | { | ||||
HRGN rgn = CreateRectRgn (0, 0, 0, 0); | HRGN rgn = CreateRectRgn (0, 0, 0, 0); | ||||
const int regionType = GetUpdateRgn (hwnd, rgn, false); | const int regionType = GetUpdateRgn (hwnd, rgn, false); | ||||
@@ -1411,9 +1406,9 @@ private: | |||||
EndPaint (hwnd, &paintStruct); | EndPaint (hwnd, &paintStruct); | ||||
} | } | ||||
#ifndef JUCE_GCC //xxx should add this fn for gcc.. | |||||
#ifndef JUCE_GCC | |||||
_fpreset(); // because some graphics cards can unmask FP exceptions | _fpreset(); // because some graphics cards can unmask FP exceptions | ||||
#endif | |||||
#endif | |||||
lastPaintTime = Time::getMillisecondCounter(); | lastPaintTime = Time::getMillisecondCounter(); | ||||
} | } | ||||
@@ -1428,15 +1423,11 @@ private: | |||||
{ | { | ||||
StringArray s (ComponentPeer::getAvailableRenderingEngines()); | StringArray s (ComponentPeer::getAvailableRenderingEngines()); | ||||
#if JUCE_DIRECT2D | |||||
// xxx is this correct? Seems to enable it on Vista too?? | |||||
OSVERSIONINFO info; | |||||
zerostruct (info); | |||||
info.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); | |||||
GetVersionEx (&info); | |||||
if (info.dwMajorVersion >= 6) | |||||
#if JUCE_DIRECT2D | |||||
if (SystemStats::getOperatingSystemType() >= SystemStats::Windows7) | |||||
s.add ("Direct2D"); | s.add ("Direct2D"); | ||||
#endif | |||||
#endif | |||||
return s; | return s; | ||||
} | } | ||||
@@ -1445,7 +1436,7 @@ private: | |||||
return currentRenderingEngine; | return currentRenderingEngine; | ||||
} | } | ||||
#if JUCE_DIRECT2D | |||||
#if JUCE_DIRECT2D | |||||
void updateDirect2DContext() | void updateDirect2DContext() | ||||
{ | { | ||||
if (currentRenderingEngine != direct2DRenderingEngine) | if (currentRenderingEngine != direct2DRenderingEngine) | ||||
@@ -1453,17 +1444,20 @@ private: | |||||
else if (direct2DContext == 0) | else if (direct2DContext == 0) | ||||
direct2DContext = new Direct2DLowLevelGraphicsContext (hwnd); | direct2DContext = new Direct2DLowLevelGraphicsContext (hwnd); | ||||
} | } | ||||
#endif | |||||
#endif | |||||
void setCurrentRenderingEngine (int index) | void setCurrentRenderingEngine (int index) | ||||
{ | { | ||||
(void) index; | (void) index; | ||||
#if JUCE_DIRECT2D | |||||
currentRenderingEngine = index == 1 ? direct2DRenderingEngine : softwareRenderingEngine; | |||||
updateDirect2DContext(); | |||||
repaint (component->getLocalBounds()); | |||||
#endif | |||||
#if JUCE_DIRECT2D | |||||
if (getAvailableRenderingEngines().size() > 1) | |||||
{ | |||||
currentRenderingEngine = index == 1 ? direct2DRenderingEngine : softwareRenderingEngine; | |||||
updateDirect2DContext(); | |||||
repaint (component->getLocalBounds()); | |||||
} | |||||
#endif | |||||
} | } | ||||
void doMouseMove (const Point<int>& position) | void doMouseMove (const Point<int>& position) | ||||
@@ -2442,7 +2436,7 @@ bool AlertWindow::showNativeDialogBox (const String& title, | |||||
const String& bodyText, | const String& bodyText, | ||||
bool isOkCancel) | bool isOkCancel) | ||||
{ | { | ||||
return MessageBox (0, bodyText.toUTF16(), title.toUTF16(), | |||||
return MessageBox (0, bodyText.toWideCharPointer(), title.toWideCharPointer(), | |||||
MB_SETFOREGROUND | (isOkCancel ? MB_OKCANCEL | MB_SETFOREGROUND | (isOkCancel ? MB_OKCANCEL | ||||
: MB_OK)) == IDOK; | : MB_OK)) == IDOK; | ||||
} | } | ||||
@@ -2720,7 +2714,6 @@ class JuceDropSource : public ComBaseClassHelper <IDropSource> | |||||
{ | { | ||||
public: | public: | ||||
JuceDropSource() {} | JuceDropSource() {} | ||||
~JuceDropSource() {} | |||||
HRESULT __stdcall QueryContinueDrag (BOOL escapePressed, DWORD keys) | HRESULT __stdcall QueryContinueDrag (BOOL escapePressed, DWORD keys) | ||||
{ | { | ||||
@@ -2749,8 +2742,6 @@ public: | |||||
{ | { | ||||
} | } | ||||
~JuceEnumFormatEtc() {} | |||||
HRESULT __stdcall Clone (IEnumFORMATETC** result) | HRESULT __stdcall Clone (IEnumFORMATETC** result) | ||||
{ | { | ||||
if (result == 0) | if (result == 0) | ||||