diff --git a/src/core/juce_SystemStats.cpp b/src/core/juce_SystemStats.cpp index 977977a0e6..8ea19910a4 100644 --- a/src/core/juce_SystemStats.cpp +++ b/src/core/juce_SystemStats.cpp @@ -38,9 +38,15 @@ SystemStats::CPUFlags SystemStats::cpuFlags; 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 } //============================================================================== diff --git a/src/core/juce_SystemStats.h b/src/core/juce_SystemStats.h index d927a6a7cd..9397c09c9d 100644 --- a/src/core/juce_SystemStats.h +++ b/src/core/juce_SystemStats.h @@ -39,8 +39,6 @@ public: //============================================================================== /** 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. */ static const String getJUCEVersion(); diff --git a/src/core/juce_Time.cpp b/src/core/juce_Time.cpp index 274ee2b696..1c700dd112 100644 --- a/src/core/juce_Time.cpp +++ b/src/core/juce_Time.cpp @@ -128,7 +128,7 @@ namespace TimeHelpers #elif JUCE_WINDOWS HeapBlock tempDest; 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) dest.writeAll (CharPointer_UTF16 (tempDest.getData())); return result; diff --git a/src/gui/components/mouse/juce_DragAndDropContainer.cpp b/src/gui/components/mouse/juce_DragAndDropContainer.cpp index ae0f77b263..aa039c4ed7 100644 --- a/src/gui/components/mouse/juce_DragAndDropContainer.cpp +++ b/src/gui/components/mouse/juce_DragAndDropContainer.cpp @@ -240,15 +240,13 @@ public: if (owner->shouldDropFilesWhenDraggedExternally (dragDescLocal, source, files, canMoveFiles) && files.size() > 0) { - WeakReference cdw (this); + WeakReference thisWeakRef (this); setVisible (false); if (ModifierKeys::getCurrentModifiersRealtime().isAnyMouseButtonDown()) DragAndDropContainer::performExternalDragDropOfFiles (files, canMoveFiles); - if (cdw != 0) - delete this; - + delete thisWeakRef.get(); return; } } diff --git a/src/native/windows/juce_win32_ASIO.cpp b/src/native/windows/juce_win32_ASIO.cpp index b24d650c59..719e03d431 100644 --- a/src/native/windows/juce_win32_ASIO.cpp +++ b/src/native/windows/juce_win32_ASIO.cpp @@ -808,7 +808,7 @@ private: // doing a direct load of the COM object (only available via the juce_createASIOAudioIODeviceForGUID function). if (optionalDllForDirectLoading.isNotEmpty()) { - HMODULE h = LoadLibrary (optionalDllForDirectLoading.toUTF16()); + HMODULE h = LoadLibrary (optionalDllForDirectLoading.toWideCharPointer()); if (h != 0) { @@ -1799,7 +1799,7 @@ private: { 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 }; DWORD dtype = REG_SZ; diff --git a/src/native/windows/juce_win32_ActiveXComponent.cpp b/src/native/windows/juce_win32_ActiveXComponent.cpp index 2e536c31bb..d39c77d4bc 100644 --- a/src/native/windows/juce_win32_ActiveXComponent.cpp +++ b/src/native/windows/juce_win32_ActiveXComponent.cpp @@ -34,7 +34,6 @@ namespace ActiveXHelpers { public: JuceIStorage() {} - ~JuceIStorage() {} HRESULT __stdcall CreateStream (const WCHAR*, DWORD, 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: JuceOleInPlaceFrame (HWND window_) : window (window_) {} - ~JuceOleInPlaceFrame() {} HRESULT __stdcall GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; } HRESULT __stdcall ContextSensitiveHelp (BOOL) { return E_NOTIMPL; } diff --git a/src/native/windows/juce_win32_CameraDevice.cpp b/src/native/windows/juce_win32_CameraDevice.cpp index 64e081e7da..1e50e56a87 100644 --- a/src/native/windows/juce_win32_CameraDevice.cpp +++ b/src/native/windows/juce_win32_CameraDevice.cpp @@ -272,7 +272,7 @@ public: if (SUCCEEDED (hr)) { - hr = fileSink->SetFileName (file.getFullPathName().toUTF16(), 0); + hr = fileSink->SetFileName (file.getFullPathName().toWideCharPointer(), 0); if (SUCCEEDED (hr)) { @@ -316,7 +316,7 @@ public: .replace ("$AVGTIMEPERFRAME", String (10000000 / maxFramesPerSecond)); ComSmartPtr currentProfile; - hr = profileManager->LoadProfileByData (prof.toUTF16(), currentProfile.resetAndGetPointerAddress()); + hr = profileManager->LoadProfileByData (prof.toWideCharPointer(), currentProfile.resetAndGetPointerAddress()); hr = asfConfig->ConfigureFilterUsingProfile (currentProfile); if (SUCCEEDED (hr)) diff --git a/src/native/windows/juce_win32_DynamicLibraryLoader.cpp b/src/native/windows/juce_win32_DynamicLibraryLoader.cpp index 1267de0ef1..d017190967 100644 --- a/src/native/windows/juce_win32_DynamicLibraryLoader.cpp +++ b/src/native/windows/juce_win32_DynamicLibraryLoader.cpp @@ -44,7 +44,7 @@ DynamicLibraryLoader::~DynamicLibraryLoader() bool DynamicLibraryLoader::load (const String& name) { FreeLibrary ((HMODULE) libHandle); - libHandle = name.isNotEmpty() ? LoadLibrary (name.toUTF16()) : 0; + libHandle = name.isNotEmpty() ? LoadLibrary (name.toWideCharPointer()) : 0; return libHandle != 0; } diff --git a/src/native/windows/juce_win32_FileChooser.cpp b/src/native/windows/juce_win32_FileChooser.cpp index 7d1f9d076b..f35fbc4d99 100644 --- a/src/native/windows/juce_win32_FileChooser.cpp +++ b/src/native/windows/juce_win32_FileChooser.cpp @@ -186,7 +186,7 @@ void FileChooser::showPlatformDialog (Array& results, const String& title_ bi.hwndOwner = (HWND) parentWindow.getWindowHandle(); bi.pszDisplayName = files; - bi.lpszTitle = title.toUTF16(); + bi.lpszTitle = title.toWideCharPointer(); bi.lParam = (LPARAM) &info; bi.lpfn = browseCallbackProc; #ifdef BIF_USENEWUI @@ -253,8 +253,8 @@ void FileChooser::showPlatformDialog (Array& results, const String& title_ of.nFilterIndex = 1; of.lpstrFile = files; of.nMaxFile = charsAvailableForResult; - of.lpstrInitialDir = localPath.toUTF16(); - of.lpstrTitle = title.toUTF16(); + of.lpstrInitialDir = localPath.toWideCharPointer(); + of.lpstrTitle = title.toWideCharPointer(); of.Flags = flags; of.lCustData = (LPARAM) &info; diff --git a/src/native/windows/juce_win32_Files.cpp b/src/native/windows/juce_win32_Files.cpp index e988aa5333..1374ff229d 100644 --- a/src/native/windows/juce_win32_Files.cpp +++ b/src/native/windows/juce_win32_Files.cpp @@ -72,7 +72,7 @@ namespace WindowsFileHelpers { 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 : (int64) spc.QuadPart; @@ -81,7 +81,7 @@ namespace WindowsFileHelpers unsigned int getWindowsDriveType (const String& path) { - return GetDriveType (getDriveFromPath (path).toUTF16()); + return GetDriveType (getDriveFromPath (path).toWideCharPointer()); } const File getSpecialFolderPath (int type) @@ -104,25 +104,25 @@ const String File::separatorString ("\\"); bool File::exists() const { return fullPath.isNotEmpty() - && GetFileAttributes (fullPath.toUTF16()) != INVALID_FILE_ATTRIBUTES; + && GetFileAttributes (fullPath.toWideCharPointer()) != INVALID_FILE_ATTRIBUTES; } bool File::existsAsFile() const { return fullPath.isNotEmpty() - && (GetFileAttributes (fullPath.toUTF16()) & FILE_ATTRIBUTE_DIRECTORY) == 0; + && (GetFileAttributes (fullPath.toWideCharPointer()) & FILE_ATTRIBUTE_DIRECTORY) == 0; } 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); } bool File::hasWriteAccess() const { 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, // 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 { - DWORD attr = GetFileAttributes (fullPath.toUTF16()); + DWORD attr = GetFileAttributes (fullPath.toWideCharPointer()); if (attr == INVALID_FILE_ATTRIBUTES) return false; @@ -144,12 +144,12 @@ bool File::setFileReadOnlyInternal (const bool shouldBeReadOnly) const else attr &= ~FILE_ATTRIBUTE_READONLY; - return SetFileAttributes (fullPath.toUTF16(), attr) != FALSE; + return SetFileAttributes (fullPath.toWideCharPointer(), attr) != FALSE; } 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()) 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 @@ -186,17 +185,17 @@ bool File::moveToTrash() 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 { - return MoveFile (fullPath.toUTF16(), dest.getFullPathName().toUTF16()) != 0; + return MoveFile (fullPath.toWideCharPointer(), dest.getFullPathName().toWideCharPointer()) != 0; } 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(); - 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); if (h != INVALID_HANDLE_VALUE) @@ -239,7 +238,7 @@ size_t FileInputStream::readInternal (void* buffer, size_t numBytes) //============================================================================== 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); if (h != INVALID_HANDLE_VALUE) @@ -284,7 +283,7 @@ int64 File::getSize() const { 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 0; @@ -295,7 +294,7 @@ void File::getFileTimesInternal (int64& modificationTime, int64& accessTime, int using namespace WindowsFileHelpers; WIN32_FILE_ATTRIBUTE_DATA attributes; - if (GetFileAttributesEx (fullPath.toUTF16(), GetFileExInfoStandard, &attributes)) + if (GetFileAttributesEx (fullPath.toWideCharPointer(), GetFileExInfoStandard, &attributes)) { modificationTime = fileTimeToTime (&attributes.ftLastWriteTime); creationTime = fileTimeToTime (&attributes.ftCreationTime); @@ -312,7 +311,7 @@ bool File::setFileTimesInternal (int64 modificationTime, int64 accessTime, int64 using namespace WindowsFileHelpers; 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); if (h != INVALID_HANDLE_VALUE) @@ -362,7 +361,7 @@ void File::findFileSystemRoots (Array& destArray) const String File::getVolumeLabel() const { TCHAR dest[64]; - if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toUTF16(), dest, + if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, numElementsInArray (dest), 0, 0, 0, 0, 0)) dest[0] = 0; @@ -374,7 +373,7 @@ int File::getVolumeSerialNumber() const TCHAR dest[64]; DWORD serialNum; - if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toUTF16(), dest, + if (! GetVolumeInformation (WindowsFileHelpers::getDriveFromPath (getFullPathName()).toWideCharPointer(), dest, numElementsInArray (dest), &serialNum, 0, 0, 0, 0)) return 0; @@ -486,7 +485,7 @@ const File File::getCurrentWorkingDirectory() 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; DWORD handle = 0; - DWORD bufferSize = GetFileVersionInfoSize (getFullPathName().toUTF16(), &handle); + DWORD bufferSize = GetFileVersionInfoSize (getFullPathName().toWideCharPointer(), &handle); HeapBlock buffer; buffer.calloc (bufferSize); - if (GetFileVersionInfo (getFullPathName().toUTF16(), 0, bufferSize, buffer)) + if (GetFileVersionInfo (getFullPathName().toWideCharPointer(), 0, bufferSize, buffer)) { VS_FIXEDFILEINFO* vffi; UINT len = 0; @@ -533,7 +532,7 @@ const File File::getLinkedTarget() const ComSmartPtr 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))) { WIN32_FIND_DATA winFindData; @@ -574,7 +573,7 @@ public: if (handle == INVALID_HANDLE_VALUE) { - handle = FindFirstFile (directoryWithWildCard.toUTF16(), &findData); + handle = FindFirstFile (directoryWithWildCard.toWideCharPointer(), &findData); if (handle == INVALID_HANDLE_VALUE) return false; @@ -628,7 +627,7 @@ bool PlatformUtilities::openDocument (const String& fileName, const String& para 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 @@ -655,9 +654,9 @@ public: { 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) - : CreateFile (file.toUTF16(), GENERIC_READ | GENERIC_WRITE, 0, 0, + : CreateFile (file.toWideCharPointer(), GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, 0); } diff --git a/src/native/windows/juce_win32_Messaging.cpp b/src/native/windows/juce_win32_Messaging.cpp index cf5a447ee1..4a84125755 100644 --- a/src/native/windows/juce_win32_Messaging.cpp +++ b/src/native/windows/juce_win32_Messaging.cpp @@ -285,7 +285,7 @@ void MessageManager::doPlatformSpecificInitialisation() wc.lpfnWndProc = (WNDPROC) juce_MessageWndProc; wc.cbWndExtra = 4; wc.hInstance = hmod; - wc.lpszClassName = className.toUTF16(); + wc.lpszClassName = className.toWideCharPointer(); RegisterClassEx (&wc); @@ -298,7 +298,7 @@ void MessageManager::doPlatformSpecificInitialisation() void MessageManager::doPlatformSpecificShutdown() { DestroyWindow (juce_messageWindowHandle); - UnregisterClass (getMessageWindowClassName().toUTF16(), 0); + UnregisterClass (getMessageWindowClassName().toWideCharPointer(), 0); OleUninitialize(); } diff --git a/src/native/windows/juce_win32_Network.cpp b/src/native/windows/juce_win32_Network.cpp index b83798e161..fd140b5c19 100644 --- a/src/native/windows/juce_win32_Network.cpp +++ b/src/native/windows/juce_win32_Network.cpp @@ -235,7 +235,7 @@ private: uc.lpszUrlPath = file; uc.lpszHostName = server; - if (InternetCrackUrl (address.toUTF16(), 0, 0, &uc)) + if (InternetCrackUrl (address.toWideCharPointer(), 0, 0, &uc)) { int disable = 1; InternetSetOption (sessionHandle, INTERNET_OPTION_DISABLE_AUTODIAL, &disable, sizeof (disable)); @@ -295,7 +295,7 @@ private: INTERNET_BUFFERS buffers; zerostruct (buffers); buffers.dwStructSize = sizeof (INTERNET_BUFFERS); - buffers.lpcszHeader = headers.toUTF16(); + buffers.lpcszHeader = headers.toWideCharPointer(); buffers.dwHeadersLength = headers.length(); buffers.dwBufferTotal = (DWORD) postData.getSize(); diff --git a/src/native/windows/juce_win32_PlatformUtils.cpp b/src/native/windows/juce_win32_PlatformUtils.cpp index 275c18ba48..0e52a44dc0 100644 --- a/src/native/windows/juce_win32_PlatformUtils.cpp +++ b/src/native/windows/juce_win32_PlatformUtils.cpp @@ -55,13 +55,13 @@ namespace 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) return key; } 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; } } @@ -82,7 +82,7 @@ const String PlatformUtilities::getRegistryValue (const String& regValuePath, unsigned long bufferSize = sizeof (buffer); 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) result = buffer; @@ -104,7 +104,7 @@ void PlatformUtilities::setRegistryValue (const String& regValuePath, if (k != 0) { - RegSetValueEx (k, valueName.toUTF16(), 0, REG_SZ, + RegSetValueEx (k, valueName.toWideCharPointer(), 0, REG_SZ, (const BYTE*) value.toWideCharPointer(), CharPointer_UTF16::getBytesRequiredFor (value.getCharPointer())); @@ -124,7 +124,7 @@ bool PlatformUtilities::registryValueExists (const String& regValuePath) unsigned long bufferSize = sizeof (buffer); 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; RegCloseKey (k); @@ -140,7 +140,7 @@ void PlatformUtilities::deleteRegistryValue (const String& regValuePath) if (k != 0) { - RegDeleteValue (k, valueName.toUTF16()); + RegDeleteValue (k, valueName.toWideCharPointer()); RegCloseKey (k); } } @@ -152,7 +152,7 @@ void PlatformUtilities::deleteRegistryKey (const String& regKeyPath) if (k != 0) { - RegDeleteKey (k, valueName.toUTF16()); + RegDeleteKey (k, valueName.toWideCharPointer()); RegCloseKey (k); } } @@ -220,9 +220,9 @@ void PlatformUtilities::setCurrentModuleInstanceHandle (void* const newHandle) t void PlatformUtilities::fpuReset() { -#if JUCE_MSVC + #if JUCE_MSVC _clearfp(); -#endif + #endif } //============================================================================== diff --git a/src/native/windows/juce_win32_SystemStats.cpp b/src/native/windows/juce_win32_SystemStats.cpp index f27cc60215..b9be9772b4 100644 --- a/src/native/windows/juce_win32_SystemStats.cpp +++ b/src/native/windows/juce_win32_SystemStats.cpp @@ -31,7 +31,7 @@ //============================================================================== void Logger::outputDebugString (const String& text) { - OutputDebugString ((text + "\n").toUTF16()); + OutputDebugString ((text + "\n").toWideCharPointer()); } //============================================================================== diff --git a/src/native/windows/juce_win32_Threads.cpp b/src/native/windows/juce_win32_Threads.cpp index d3c79a4390..e81decb0d9 100644 --- a/src/native/windows/juce_win32_Threads.cpp +++ b/src/native/windows/juce_win32_Threads.cpp @@ -303,9 +303,9 @@ void Process::lowerPrivilege() void Process::terminate() { - #if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS + #if JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS _CrtDumpMemoryLeaks(); - #endif + #endif // bullet in the head in case there's a problem shutting down.. ExitProcess (0); @@ -318,7 +318,7 @@ void* PlatformUtilities::loadDynamicLibrary (const String& name) JUCE_TRY { - result = LoadLibrary (name.toUTF16()); + result = LoadLibrary (name.toWideCharPointer()); } JUCE_CATCH_ALL diff --git a/src/native/windows/juce_win32_Windowing.cpp b/src/native/windows/juce_win32_Windowing.cpp index f6f18c4cd9..46730ba414 100644 --- a/src/native/windows/juce_win32_Windowing.cpp +++ b/src/native/windows/juce_win32_Windowing.cpp @@ -58,8 +58,6 @@ static bool shouldDeactivateTitleBar = true; #define WM_TRAYNOTIFY WM_USER + 100 -using ::abs; - //============================================================================== typedef BOOL (WINAPI* UpdateLayeredWinFunc) (HWND, HDC, POINT*, SIZE*, HDC, POINT*, COLORREF, BLENDFUNCTION*, DWORD); static UpdateLayeredWinFunc updateLayeredWindow = 0; @@ -188,7 +186,7 @@ public: previousBitmap = SelectObject (hdc, hBitmap); if (format_ == Image::ARGB && clearImage) - zeromem (bitmapData, abs (h * lineStride)); + zeromem (bitmapData, std::abs (h * lineStride)); imageData = bitmapData - (lineStride * (h - 1)); } @@ -470,11 +468,7 @@ public: HWND parentToAddTo_) : ComponentPeer (component, windowStyleFlags), dontRepaint (false), - #if JUCE_DIRECT2D - currentRenderingEngine (direct2DRenderingEngine), - #else currentRenderingEngine (softwareRenderingEngine), - #endif fullScreen (false), isDragging (false), isMouseOver (false), @@ -542,7 +536,7 @@ public: void setTitle (const String& title) { - SetWindowText (hwnd, title.toUTF16()); + SetWindowText (hwnd, title.toWideCharPointer()); } void setPosition (int x, int y) @@ -1082,7 +1076,7 @@ private: wcex.cbSize = sizeof (wcex); wcex.style = CS_OWNDC; wcex.lpfnWndProc = (WNDPROC) windowProc; - wcex.lpszClassName = windowClassName.toUTF16(); + wcex.lpszClassName = windowClassName.toWideCharPointer(); wcex.cbClsExtra = 0; wcex.cbWndExtra = 32; wcex.hInstance = moduleHandle; @@ -1099,7 +1093,7 @@ private: ~WindowClassHolder() { if (ComponentPeer::getNumPeers() == 0) - UnregisterClass (windowClassName.toUTF16(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); + UnregisterClass (windowClassName.toWideCharPointer(), (HINSTANCE) PlatformUtilities::getCurrentModuleInstanceHandle()); clearSingletonInstance(); } @@ -1165,12 +1159,12 @@ private: && Desktop::canUseSemiTransparentWindows()) 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); - #if JUCE_DIRECT2D - updateDirect2DContext(); - #endif + #if JUCE_DIRECT2D + setCurrentRenderingEngine (1); + #endif if (hwnd != 0) { @@ -1272,7 +1266,7 @@ private: //============================================================================== void handlePaintMessage() { -#if JUCE_DIRECT2D + #if JUCE_DIRECT2D if (direct2DContext != 0) { RECT r; @@ -1286,7 +1280,8 @@ private: } } else -#endif + #endif + { HRGN rgn = CreateRectRgn (0, 0, 0, 0); const int regionType = GetUpdateRgn (hwnd, rgn, false); @@ -1411,9 +1406,9 @@ private: 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 -#endif + #endif lastPaintTime = Time::getMillisecondCounter(); } @@ -1428,15 +1423,11 @@ private: { 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"); -#endif + #endif + return s; } @@ -1445,7 +1436,7 @@ private: return currentRenderingEngine; } -#if JUCE_DIRECT2D + #if JUCE_DIRECT2D void updateDirect2DContext() { if (currentRenderingEngine != direct2DRenderingEngine) @@ -1453,17 +1444,20 @@ private: else if (direct2DContext == 0) direct2DContext = new Direct2DLowLevelGraphicsContext (hwnd); } -#endif + #endif void setCurrentRenderingEngine (int 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& position) @@ -2442,7 +2436,7 @@ bool AlertWindow::showNativeDialogBox (const String& title, const String& bodyText, bool isOkCancel) { - return MessageBox (0, bodyText.toUTF16(), title.toUTF16(), + return MessageBox (0, bodyText.toWideCharPointer(), title.toWideCharPointer(), MB_SETFOREGROUND | (isOkCancel ? MB_OKCANCEL : MB_OK)) == IDOK; } @@ -2720,7 +2714,6 @@ class JuceDropSource : public ComBaseClassHelper { public: JuceDropSource() {} - ~JuceDropSource() {} HRESULT __stdcall QueryContinueDrag (BOOL escapePressed, DWORD keys) { @@ -2749,8 +2742,6 @@ public: { } - ~JuceEnumFormatEtc() {} - HRESULT __stdcall Clone (IEnumFORMATETC** result) { if (result == 0)