| @@ -1751,7 +1751,7 @@ private: | |||
| for (RectangleList::Iterator i (regionsNeedingRepaint); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| image->blitToWindow (peer->windowH, | |||
| r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| @@ -37,7 +37,7 @@ | |||
| // As well as being for the mac, this file is included by the linux build. | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| #include <Carbon/Carbon.h> | |||
| #else | |||
| #include <sys/wait.h> | |||
| @@ -865,7 +865,7 @@ public: | |||
| // stuff away | |||
| for (RectangleList::Iterator i (regionsNeedingRepaint); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| peer->repaint (r.getX(), r.getY(), r.getWidth(), r.getHeight()); | |||
| } | |||
| } | |||
| @@ -916,7 +916,7 @@ public: | |||
| { | |||
| for (RectangleList::Iterator i (*context.getRawClipRegion()); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| image->clear (r.getX(), r.getY(), r.getWidth(), r.getHeight()); | |||
| } | |||
| } | |||
| @@ -940,7 +940,7 @@ public: | |||
| for (RectangleList::Iterator i (total); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| rects[n].origin.x = (int) r.getX(); | |||
| rects[n].origin.y = (int) r.getY(); | |||
| rects[n].size.width = roundFloatToInt (r.getWidth()); | |||
| @@ -1541,17 +1541,17 @@ static int FindCDDevices (CDDeviceInfo* const list, | |||
| { | |||
| for (BYTE lun = 0; lun < 8; ++lun) | |||
| { | |||
| SRB_GDEVBlock s; | |||
| zerostruct (s); | |||
| SRB_GDEVBlock sb; | |||
| zerostruct (sb); | |||
| s.SRB_Cmd = SC_GET_DEV_TYPE; | |||
| s.SRB_HaID = ha; | |||
| s.SRB_Target = tgt; | |||
| s.SRB_Lun = lun; | |||
| fSendASPI32Command ((LPSRB)&s); | |||
| sb.SRB_Cmd = SC_GET_DEV_TYPE; | |||
| sb.SRB_HaID = ha; | |||
| sb.SRB_Target = tgt; | |||
| sb.SRB_Lun = lun; | |||
| fSendASPI32Command ((LPSRB) &sb); | |||
| if (s.SRB_Status == SS_COMP | |||
| && s.SRB_DeviceType == DTYPE_CROM) | |||
| if (sb.SRB_Status == SS_COMP | |||
| && sb.SRB_DeviceType == DTYPE_CROM) | |||
| { | |||
| zeromem (&list[count], sizeof (CDDeviceInfo)); | |||
| @@ -355,7 +355,7 @@ static int64 fileTimeToTime (const FILETIME* const ft) throw() | |||
| // tell me if this fails! | |||
| static_jassert (sizeof (ULARGE_INTEGER) == sizeof (FILETIME)); | |||
| #ifdef JUCE_GCC | |||
| #if JUCE_GCC | |||
| return (((const ULARGE_INTEGER*) ft)->QuadPart - 116444736000000000LL) / 10000; | |||
| #else | |||
| return (((const ULARGE_INTEGER*) ft)->QuadPart - 116444736000000000) / 10000; | |||
| @@ -364,7 +364,7 @@ static int64 fileTimeToTime (const FILETIME* const ft) throw() | |||
| static void timeToFileTime (const int64 time, FILETIME* const ft) throw() | |||
| { | |||
| #ifdef JUCE_GCC | |||
| #if JUCE_GCC | |||
| ((ULARGE_INTEGER*) ft)->QuadPart = time * 10000 + 116444736000000000LL; | |||
| #else | |||
| ((ULARGE_INTEGER*) ft)->QuadPart = time * 10000 + 116444736000000000; | |||
| @@ -454,8 +454,6 @@ juce_ImplementSingleton_SingleThreaded (FontDCHolder); | |||
| //============================================================================== | |||
| static MAT2 identityMatrix; | |||
| static void addGlyphToTypeface (HDC dc, | |||
| juce_wchar character, | |||
| Typeface& dest, | |||
| @@ -497,6 +495,7 @@ static void addGlyphToTypeface (HDC dc, | |||
| const float scaleX = 1.0f / height; | |||
| const float scaleY = -1.0f / height; | |||
| static const MAT2 identityMatrix = { { 0, 1 }, { 0, 0 }, { 0, 0 }, { 0, 1 } }; | |||
| int bufSize; | |||
| @@ -672,10 +671,6 @@ void Typeface::initialiseTypefaceCharacteristics (const String& fontName, | |||
| bool italic, | |||
| bool addAllGlyphsToFont) throw() | |||
| { | |||
| zerostruct (identityMatrix); | |||
| identityMatrix.eM11.value = 1; | |||
| identityMatrix.eM22.value = 1; | |||
| clear(); | |||
| HDC dc = FontDCHolder::getInstance()->loadFont (fontName, bold, italic, 0); | |||
| @@ -40,7 +40,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../../../src/juce_core/threads/juce_Thread.h" | |||
| #include "../../../src/juce_core/containers/juce_MemoryBlock.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (disable: 4312) | |||
| #endif | |||
| @@ -64,7 +64,7 @@ void PlatformUtilities::beep() | |||
| //============================================================================== | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (disable : 4127) // "Conditional expression is constant" warning | |||
| #endif | |||
| @@ -319,7 +319,7 @@ void PlatformUtilities::setCurrentModuleInstanceHandle (void* newHandle) | |||
| void PlatformUtilities::fpuReset() | |||
| { | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| _clearfp(); | |||
| #endif | |||
| } | |||
| @@ -142,7 +142,7 @@ static juce_noinline unsigned int getCPUIDWord (int* familyModel = 0, int* extFe | |||
| unsigned int ext = 0; | |||
| unsigned int family = 0; | |||
| #ifdef JUCE_GCC | |||
| #if JUCE_GCC | |||
| unsigned int dummy = 0; | |||
| #endif | |||
| @@ -150,7 +150,7 @@ static juce_noinline unsigned int getCPUIDWord (int* familyModel = 0, int* extFe | |||
| __try | |||
| #endif | |||
| { | |||
| #ifdef JUCE_GCC | |||
| #if JUCE_GCC | |||
| __asm__ ("cpuid" : "=a" (family), "=b" (ext), "=c" (dummy),"=d" (cpu) : "a" (1)); | |||
| #else | |||
| __asm | |||
| @@ -191,7 +191,7 @@ static void juce_getCpuVendor (char* const v) | |||
| __try | |||
| #endif | |||
| { | |||
| #ifdef JUCE_GCC | |||
| #if JUCE_GCC | |||
| unsigned int dummy = 0; | |||
| __asm__ ("cpuid" : "=a" (dummy), "=b" (vendor[0]), "=c" (vendor[2]),"=d" (vendor[1]) : "a" (0)); | |||
| #else | |||
| @@ -371,7 +371,7 @@ void SystemStats::initialiseStats() throw() | |||
| timeBeginPeriod (1); | |||
| #endif | |||
| #if JUCE_DEBUG && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| _CrtSetDbgFlag (_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF); | |||
| #endif | |||
| } | |||
| @@ -152,7 +152,7 @@ void juce_killThread (void* handle) throw() | |||
| void juce_setCurrentThreadName (const String& name) throw() | |||
| { | |||
| #if JUCE_DEBUG && JUCE_MSVC | |||
| #if defined (JUCE_DEBUG) && JUCE_MSVC | |||
| struct | |||
| { | |||
| DWORD dwType; | |||
| @@ -302,7 +302,7 @@ void Process::lowerPrivilege() | |||
| void Process::terminate() | |||
| { | |||
| #if JUCE_DEBUG && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| _CrtDumpMemoryLeaks(); | |||
| #endif | |||
| @@ -282,17 +282,7 @@ public: | |||
| SelectObject (hdc, hBitmap); | |||
| static uint8 needsClearing = 0; | |||
| if (needsClearing == 0) | |||
| { | |||
| if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0) | |||
| needsClearing = 2; | |||
| else | |||
| needsClearing = 1; | |||
| } | |||
| if (format_ == ARGB && needsClearing == 2 && clearImage) | |||
| if (format_ == ARGB && clearImage) | |||
| zeromem (bitmapData, abs (h * lineStride)); | |||
| imageData = bitmapData - (lineStride * (h - 1)); | |||
| @@ -303,11 +293,11 @@ public: | |||
| DeleteDC (hdc); | |||
| DeleteObject (hBitmap); | |||
| imageData = 0; // to stop the base class freeing this | |||
| } | |||
| void blitToWindow (HWND hwnd, HDC dc, const bool transparent, | |||
| int x, int y, const RectangleList& maskedRegion) throw() | |||
| const int x, const int y, | |||
| const RectangleList& maskedRegion) throw() | |||
| { | |||
| static HDRAWDIB hdd = 0; | |||
| static bool needToCreateDrawDib = true; | |||
| @@ -371,7 +361,7 @@ public: | |||
| { | |||
| for (RectangleList::Iterator i (maskedRegion); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| ExcludeClipRect (hdc, r.getX(), r.getY(), r.getRight(), r.getBottom()); | |||
| } | |||
| } | |||
| @@ -388,7 +378,7 @@ public: | |||
| for (RectangleList::Iterator i (maskedRegion); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| ExcludeClipRect (dc, r.getX(), r.getY(), r.getRight(), r.getBottom()); | |||
| } | |||
| } | |||
| @@ -1355,7 +1345,7 @@ private: | |||
| while (i.next()) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| offscreenImage->clear (r.getX(), r.getY(), r.getWidth(), r.getHeight()); | |||
| } | |||
| } | |||
| @@ -2057,8 +2047,8 @@ private: | |||
| } | |||
| else | |||
| { | |||
| MouseEvent e (0, 0, ModifierKeys::getCurrentModifiersRealtime(), component, | |||
| getMouseEventTime(), 0, 0, getMouseEventTime(), 1, false); | |||
| const MouseEvent e (0, 0, ModifierKeys::getCurrentModifiersRealtime(), component, | |||
| getMouseEventTime(), 0, 0, getMouseEventTime(), 1, false); | |||
| if (lParam == WM_LBUTTONDOWN || lParam == WM_RBUTTONDOWN) | |||
| { | |||
| @@ -2176,6 +2166,9 @@ private: | |||
| //case WM_IME_STARTCOMPOSITION; | |||
| // return 0; | |||
| case WM_GETDLGCODE: | |||
| return DLGC_WANTALLKEYS; | |||
| default: | |||
| break; | |||
| } | |||
| @@ -2261,7 +2254,7 @@ void Desktop::setMousePosition (int x, int y) | |||
| } | |||
| //============================================================================== | |||
| BOOL CALLBACK enumMonitorsProc (HMONITOR, HDC, LPRECT r, LPARAM userInfo) | |||
| static BOOL CALLBACK enumMonitorsProc (HMONITOR, HDC, LPRECT r, LPARAM userInfo) | |||
| { | |||
| Array <Rectangle>* const monitorCoords = (Array <Rectangle>*) userInfo; | |||
| @@ -2272,12 +2265,14 @@ BOOL CALLBACK enumMonitorsProc (HMONITOR, HDC, LPRECT r, LPARAM userInfo) | |||
| void juce_updateMultiMonitorInfo (Array <Rectangle>& monitorCoords, const bool clipToWorkArea) throw() | |||
| { | |||
| DynamicLibraryLoader user32Dll ("user32.dll"); | |||
| /*DynamicLibraryLoader user32Dll ("user32.dll"); | |||
| DynamicLibraryImport (EnumDisplayMonitors, enumDisplayMonitors, BOOL, user32Dll, | |||
| (HDC hdc, LPCRECT lprcClip, MONITORENUMPROC, LPARAM)) | |||
| if (enumDisplayMonitors != 0) | |||
| enumDisplayMonitors (0, 0, &enumMonitorsProc, (LPARAM) &monitorCoords); | |||
| enumDisplayMonitors (0, 0, &enumMonitorsProc, (LPARAM) &monitorCoords);*/ | |||
| EnumDisplayMonitors (0, 0, &enumMonitorsProc, (LPARAM) &monitorCoords); | |||
| // make sure the first in the list is the main monitor | |||
| for (int i = 1; i < monitorCoords.size(); ++i) | |||
| @@ -2899,6 +2894,7 @@ static HDROP createHDrop (const StringArray& fileNames) throw() | |||
| LPDROPFILES pDropFiles = (LPDROPFILES) GlobalLock (hDrop); | |||
| pDropFiles->pFiles = sizeof (DROPFILES); | |||
| #if JUCE_ENABLE_WIN98_COMPATIBILITY | |||
| pDropFiles->fWide = (SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0; | |||
| if (pDropFiles->fWide) | |||
| @@ -2925,6 +2921,19 @@ static HDROP createHDrop (const StringArray& fileNames) throw() | |||
| *fname = 0; | |||
| } | |||
| #else | |||
| pDropFiles->fWide = true; | |||
| 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; | |||
| #endif | |||
| GlobalUnlock (hDrop); | |||
| } | |||
| @@ -2967,6 +2976,7 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text) | |||
| medium.hGlobal = GlobalAlloc (GMEM_MOVEABLE | GMEM_ZEROINIT, (numChars + 2) * sizeof (WCHAR)); | |||
| char* d = (char*) GlobalLock (medium.hGlobal); | |||
| #if JUCE_ENABLE_WIN98_COMPATIBILITY | |||
| if ((SystemStats::getOperatingSystemType() & SystemStats::WindowsNT) != 0) | |||
| { | |||
| text.copyToBuffer ((WCHAR*) d, numChars + 1); | |||
| @@ -2976,6 +2986,10 @@ bool DragAndDropContainer::performExternalDragDropOfText (const String& text) | |||
| { | |||
| text.copyToBuffer (d, numChars + 1); | |||
| } | |||
| #else | |||
| text.copyToBuffer ((WCHAR*) d, numChars + 1); | |||
| format.cfFormat = CF_UNICODETEXT; | |||
| #endif | |||
| GlobalUnlock (medium.hGlobal); | |||
| @@ -12,6 +12,7 @@ Changelist for version 1.44 | |||
| - added the JUCE_LOG_ASSERTIONS flag, which can automatically log assertion failures, even in release builds. | |||
| - new classes DirectoryContentsDisplayComponent and FileTreeComponent, allow a view of a directory as either a list or treeview. I've added a demo of the FileTreeComponent to the treeviews section of the Juce Demo. There's also now an option in the FileBrowserComponent constructor to use a treeview. | |||
| - small change to the strictness of the way TreeViews handle their root items. Be careful now to never delete a tree's root item until either the treeview has been deleted, or until you've removed the root from the tree using setRootItem (0). Not doing this can now cause a crash in the tree's destructor, where it expects the root to still be valid. | |||
| - added some virtual methods to TextEditor to allow customisation of its popup menu. | |||
| ============================================================================== | |||
| @@ -105,10 +105,11 @@ BEGIN_JUCE_NAMESPACE | |||
| extern void juce_macDoPendingRepaintsNow(); | |||
| #elif JUCE_LINUX | |||
| extern Display* display; | |||
| extern bool juce_dispatchNextMessageOnSystemQueue (bool); | |||
| extern bool juce_postMessageToSystemQueue (void* message); | |||
| #endif | |||
| END_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| #if JUCE_WIN32 | |||
| @@ -173,7 +174,7 @@ public: | |||
| const int quitMessageId = 0xfffff321; | |||
| Message* const m = new Message (quitMessageId, 1, 0, 0); | |||
| if (! juce_postMessageToSystemQueue (m, true)) | |||
| if (! juce_postMessageToSystemQueue (m)) | |||
| delete m; | |||
| clearSingletonInstance(); | |||
| @@ -325,6 +326,7 @@ public: | |||
| cEffect.flags |= effFlagsHasEditor; | |||
| setUniqueID ((int) (JucePlugin_VSTUniqueID)); | |||
| getAeffect()->version = (long) (JucePlugin_VersionCode); | |||
| #if JucePlugin_WantsMidiInput && ! JUCE_USE_VSTSDK_2_4 | |||
| wantEvents(); | |||
| @@ -541,7 +543,7 @@ public: | |||
| if (! isProcessing) | |||
| resume(); | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| const int numMidiEventsComingIn = midiEvents.getNumEvents(); | |||
| #endif | |||
| @@ -432,7 +432,7 @@ public: | |||
| break; | |||
| case showOpenGL: | |||
| #ifdef JUCE_OPENGL | |||
| #if JUCE_OPENGL | |||
| showDemo (createOpenGLDemo(), BinaryData::opengldemo_cpp); | |||
| currentDemoId = showOpenGL; | |||
| #endif | |||
| @@ -120,7 +120,7 @@ END_JUCE_NAMESPACE | |||
| Note that this can be disabled by defining DONT_AUTOLINK_TO_JUCE_LIBRARY before | |||
| including this header file. | |||
| */ | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #ifndef DONT_AUTOLINK_TO_JUCE_LIBRARY | |||
| @@ -51,7 +51,7 @@ | |||
| // on the Mac, these symbols are defined in the Mac libraries, so | |||
| // these macros make it easier to reference them without writing out | |||
| // the namespace every time. | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| #define Component JUCE_NAMESPACE::Component | |||
| #define MemoryBlock JUCE_NAMESPACE::MemoryBlock | |||
| #define Point JUCE_NAMESPACE::Point | |||
| @@ -31,7 +31,7 @@ | |||
| #include "../../juce_core/basics/juce_StandardHeader.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4245 4514 4100) | |||
| #include <crtdbg.h> | |||
| @@ -250,7 +250,7 @@ const File PropertiesFile::getDefaultAppSettingsFile (const String& applicationN | |||
| // mustn't have illegal characters in this name.. | |||
| jassert (applicationName == File::createLegalFileName (applicationName)); | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| File dir (commonToAllUsers ? "/Library/Preferences" | |||
| : "~/Library/Preferences"); | |||
| @@ -200,8 +200,8 @@ public: | |||
| right += startOffsetInDestBuffer; | |||
| // (keep this a multiple of 3) | |||
| const int tempBufSize = 1440 * 16; | |||
| char tempBuffer[tempBufSize]; | |||
| const int tempBufSize = 1440 * 4; | |||
| char tempBuffer [tempBufSize]; | |||
| while (num > 0) | |||
| { | |||
| @@ -215,7 +215,7 @@ public: | |||
| { | |||
| if (littleEndian) | |||
| { | |||
| const short* src = (const short*)tempBuffer; | |||
| const short* src = (const short*) tempBuffer; | |||
| if (numChannels > 1) | |||
| { | |||
| @@ -223,7 +223,7 @@ public: | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *right++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *right++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| ++src; | |||
| } | |||
| } | |||
| @@ -232,15 +232,15 @@ public: | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| ++src; | |||
| *left++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *left++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| } | |||
| } | |||
| else | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *right++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *left++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| *right++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| } | |||
| } | |||
| } | |||
| @@ -248,13 +248,13 @@ public: | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *left++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| } | |||
| } | |||
| } | |||
| else | |||
| { | |||
| const char* src = (const char*)tempBuffer; | |||
| const char* src = (const char*) tempBuffer; | |||
| if (numChannels > 1) | |||
| { | |||
| @@ -385,9 +385,9 @@ public: | |||
| } | |||
| else if (bitsPerSample == 32) | |||
| { | |||
| const unsigned int* src = (const unsigned int*)tempBuffer; | |||
| unsigned int* l = (unsigned int*)left; | |||
| unsigned int* r = (unsigned int*)right; | |||
| const unsigned int* src = (const unsigned int*) tempBuffer; | |||
| unsigned int* l = (unsigned int*) left; | |||
| unsigned int* r = (unsigned int*) right; | |||
| if (littleEndian) | |||
| { | |||
| @@ -464,12 +464,12 @@ public: | |||
| } | |||
| } | |||
| left = (int*)l; | |||
| right = (int*)r; | |||
| left = (int*) l; | |||
| right = (int*) r; | |||
| } | |||
| else if (bitsPerSample == 8) | |||
| { | |||
| const char* src = (const char*)tempBuffer; | |||
| const char* src = (const char*) tempBuffer; | |||
| if (numChannels > 1) | |||
| { | |||
| @@ -477,7 +477,7 @@ public: | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *right++ = ((int)*src++) << 24; | |||
| *right++ = ((int) *src++) << 24; | |||
| ++src; | |||
| } | |||
| } | |||
| @@ -486,15 +486,15 @@ public: | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| ++src; | |||
| *left++ = ((int)*src++) << 24; | |||
| *left++ = ((int) *src++) << 24; | |||
| } | |||
| } | |||
| else | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = ((int)*src++) << 24; | |||
| *right++ = ((int)*src++) << 24; | |||
| *left++ = ((int) *src++) << 24; | |||
| *right++ = ((int) *src++) << 24; | |||
| } | |||
| } | |||
| } | |||
| @@ -502,7 +502,7 @@ public: | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = ((int)*src++) << 24; | |||
| *left++ = ((int) *src++) << 24; | |||
| } | |||
| } | |||
| } | |||
| @@ -797,7 +797,7 @@ bool AiffAudioFormat::canDoMono() | |||
| return true; | |||
| } | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| bool AiffAudioFormat::canHandleFile (const File& f) | |||
| { | |||
| if (AudioFormat::canHandleFile (f)) | |||
| @@ -56,7 +56,7 @@ public: | |||
| const Array <int> getPossibleBitDepths(); | |||
| bool canDoStereo(); | |||
| bool canDoMono(); | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| bool canHandleFile (const File& fileToTest); | |||
| #endif | |||
| @@ -33,7 +33,7 @@ | |||
| BEGIN_JUCE_NAMESPACE | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| //============================================================================== | |||
| // Mac version doesn't need any native code because it's all done with files.. | |||
| @@ -34,7 +34,7 @@ | |||
| #include "juce_AudioFormatReader.h" | |||
| #include "../../../juce_core/text/juce_StringArray.h" | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| #include "../../../juce_core/io/files/juce_File.h" | |||
| #endif | |||
| @@ -154,7 +154,7 @@ public: | |||
| private: | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| File volumeDir; | |||
| OwnedArray<File> tracks; | |||
| Array <int> trackStartSamples; | |||
| @@ -430,9 +430,9 @@ bool AudioFormatWriter::writeFromAudioSource (AudioSource& source, | |||
| int* b = *bufferChan++; | |||
| // float -> int | |||
| for (int i = 0; i < numToDo; ++i) | |||
| for (int j = numToDo; --j >= 0;) | |||
| { | |||
| const double samp = *(const float*)b; | |||
| const double samp = *(const float*) b; | |||
| if (samp <= -1.0) | |||
| *b++ = INT_MIN; | |||
| @@ -84,7 +84,7 @@ void AudioFormatManager::registerFormat (AudioFormat* newFormat, | |||
| void AudioFormatManager::registerBasicFormats() | |||
| { | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| registerFormat (new AiffAudioFormat(), true); | |||
| registerFormat (new WavAudioFormat(), false); | |||
| #else | |||
| @@ -406,7 +406,7 @@ public: | |||
| buffer[10] = (uint8) ((info.sample_rate >> 12) & 0xff); | |||
| buffer[11] = (uint8) ((info.sample_rate >> 4) & 0xff); | |||
| buffer[12] = (uint8) (((info.sample_rate & 0x0f) << 4) | (channelsMinus1 << 1) | (bitsMinus1 >> 4)); | |||
| buffer[13] = (FLAC__byte) (((bitsMinus1 & 0x0f) << 4) | ((info.total_samples >> 32) & 0x0f)); | |||
| buffer[13] = (FLAC__byte) (((bitsMinus1 & 0x0f) << 4) | (unsigned int) ((info.total_samples >> 32) & 0x0f)); | |||
| packUint32 ((FLAC__uint32) info.total_samples, buffer + 14, 4); | |||
| memcpy (buffer + 18, info.md5sum, 16); | |||
| @@ -35,7 +35,7 @@ | |||
| #include "../../../juce_core/basics/juce_StandardHeader.h" | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| #define __MACOSX__ 1 | |||
| #endif | |||
| @@ -74,7 +74,7 @@ const StringPairArray WavAudioFormat::createBWAVMetadata (const String& descript | |||
| //============================================================================== | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma pack (push, 1) | |||
| #define PACKED | |||
| #elif defined (JUCE_GCC) | |||
| @@ -150,7 +150,7 @@ struct BWAVChunk | |||
| } PACKED; | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma pack (pop) | |||
| #endif | |||
| @@ -221,9 +221,13 @@ public: | |||
| { | |||
| // Broadcast-wav extension chunk.. | |||
| BWAVChunk* const bwav = (BWAVChunk*) juce_calloc (jmax (length + 1, (int) sizeof (BWAVChunk))); | |||
| input->read (bwav, length); | |||
| bwav->copyTo (metadataValues); | |||
| juce_free (bwav); | |||
| if (bwav != 0) | |||
| { | |||
| input->read (bwav, length); | |||
| bwav->copyTo (metadataValues); | |||
| juce_free (bwav); | |||
| } | |||
| } | |||
| else if ((hasGotType && hasGotData) || chunkEnd <= input->getPosition()) | |||
| { | |||
| @@ -268,7 +272,7 @@ public: | |||
| start = 0; | |||
| } | |||
| int numToDo = (int) jlimit ((int64) 0, (int64) numSamples, lengthInSamples - start); | |||
| const int numToDo = (int) jlimit ((int64) 0, (int64) numSamples, lengthInSamples - start); | |||
| if (numToDo > 0) | |||
| { | |||
| @@ -284,8 +288,8 @@ public: | |||
| right += startOffsetInDestBuffer; | |||
| // (keep this a multiple of 3) | |||
| const int tempBufSize = 1440 * 16; | |||
| char tempBuffer[tempBufSize]; | |||
| const int tempBufSize = 1440 * 4; | |||
| char tempBuffer [tempBufSize]; | |||
| while (num > 0) | |||
| { | |||
| @@ -297,7 +301,7 @@ public: | |||
| if (bitsPerSample == 16) | |||
| { | |||
| const short* src = (const short*)tempBuffer; | |||
| const short* src = (const short*) tempBuffer; | |||
| if (numChannels > 1) | |||
| { | |||
| @@ -306,14 +310,14 @@ public: | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| ++src; | |||
| *right++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *right++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| } | |||
| } | |||
| else if (right == 0) | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *left++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| ++src; | |||
| } | |||
| } | |||
| @@ -321,8 +325,8 @@ public: | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *right++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *left++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| *right++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| } | |||
| } | |||
| } | |||
| @@ -330,13 +334,13 @@ public: | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = (int) swapIfBigEndian ((unsigned short)*src++) << 16; | |||
| *left++ = (int) swapIfBigEndian ((unsigned short) *src++) << 16; | |||
| } | |||
| } | |||
| } | |||
| else if (bitsPerSample == 24) | |||
| { | |||
| const char* src = (const char*)tempBuffer; | |||
| const char* src = (const char*) tempBuffer; | |||
| if (numChannels > 1) | |||
| { | |||
| @@ -378,9 +382,9 @@ public: | |||
| } | |||
| else if (bitsPerSample == 32) | |||
| { | |||
| const unsigned int* src = (const unsigned int*)tempBuffer; | |||
| unsigned int* l = (unsigned int*)left; | |||
| unsigned int* r = (unsigned int*)right; | |||
| const unsigned int* src = (const unsigned int*) tempBuffer; | |||
| unsigned int* l = (unsigned int*) left; | |||
| unsigned int* r = (unsigned int*) right; | |||
| if (numChannels > 1) | |||
| { | |||
| @@ -422,7 +426,7 @@ public: | |||
| } | |||
| else if (bitsPerSample == 8) | |||
| { | |||
| const unsigned char* src = (const unsigned char*)tempBuffer; | |||
| const unsigned char* src = (const unsigned char*) tempBuffer; | |||
| if (numChannels > 1) | |||
| { | |||
| @@ -431,14 +435,14 @@ public: | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| ++src; | |||
| *right++ = ((int)*src++ - 128) << 24; | |||
| *right++ = ((int) *src++ - 128) << 24; | |||
| } | |||
| } | |||
| else if (right == 0) | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = ((int)*src++ - 128) << 24; | |||
| *left++ = ((int) *src++ - 128) << 24; | |||
| ++src; | |||
| } | |||
| } | |||
| @@ -446,8 +450,8 @@ public: | |||
| { | |||
| for (int i = numThisTime; --i >= 0;) | |||
| { | |||
| *left++ = ((int)*src++ - 128) << 24; | |||
| *right++ = ((int)*src++ - 128) << 24; | |||
| *left++ = ((int) *src++ - 128) << 24; | |||
| *right++ = ((int) *src++ - 128) << 24; | |||
| } | |||
| } | |||
| } | |||
| @@ -229,7 +229,7 @@ void ResamplingAudioSource::applyFilter (float* samples, int num, FilterState& f | |||
| - coefficients[4] * fs.y1 | |||
| - coefficients[5] * fs.y2; | |||
| #ifdef JUCE_INTEL | |||
| #if JUCE_INTEL | |||
| if (! (out < -1.0e-8 || out > 1.0e-8)) | |||
| out = 0; | |||
| #endif | |||
| @@ -102,7 +102,7 @@ void AudioDataConverters::convertFloatToFloat32LE (const float* source, void* de | |||
| if (source != (const float*) dest) | |||
| memcpy (dest, source, numSamples * sizeof (float)); | |||
| #ifdef JUCE_BIG_ENDIAN | |||
| #if JUCE_BIG_ENDIAN | |||
| uint32* const data = (uint32*) dest; | |||
| for (int i = 0; i < numSamples; ++i) | |||
| @@ -115,7 +115,7 @@ void AudioDataConverters::convertFloatToFloat32BE (const float* source, void* de | |||
| if (source != (const float*) dest) | |||
| memcpy (dest, source, numSamples * sizeof (float)); | |||
| #ifdef JUCE_LITTLE_ENDIAN | |||
| #if JUCE_LITTLE_ENDIAN | |||
| uint32* const data = (uint32*) dest; | |||
| for (int i = 0; i < numSamples; ++i) | |||
| @@ -502,9 +502,9 @@ void AudioSampleBuffer::readFromAudioReader (AudioFormatReader* reader, | |||
| if (! reader->usesFloatingPointData) | |||
| { | |||
| for (int i = 0; i < 2; ++i) | |||
| for (int j = 0; j < 2; ++j) | |||
| { | |||
| float* const d = (float*)(chans[i]); | |||
| float* const d = (float*) (chans[j]); | |||
| if (d != 0) | |||
| { | |||
| @@ -550,7 +550,6 @@ void AudioSampleBuffer::writeToAudioWriter (AudioFormatWriter* writer, | |||
| } | |||
| else | |||
| { | |||
| int* chans [3]; | |||
| chans[0] = (int*) juce_malloc (sizeof (int) * numSamples * 2); | |||
| if (numChannels > 1) | |||
| @@ -560,13 +559,13 @@ void AudioSampleBuffer::writeToAudioWriter (AudioFormatWriter* writer, | |||
| chans[2] = 0; | |||
| for (int i = 0; i < 2; ++i) | |||
| for (int j = 0; j < 2; ++j) | |||
| { | |||
| int* const dest = chans[i]; | |||
| int* const dest = chans[j]; | |||
| if (dest != 0) | |||
| { | |||
| const float* const src = channels [i] + startSample; | |||
| const float* const src = channels [j] + startSample; | |||
| for (int i = 0; i < numSamples; ++i) | |||
| { | |||
| @@ -315,7 +315,7 @@ void juce_callAnyTimersSynchronously() | |||
| } | |||
| //============================================================================== | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| static SortedSet <Timer*> activeTimers; | |||
| #endif | |||
| @@ -325,7 +325,7 @@ Timer::Timer() throw() | |||
| previous (0), | |||
| next (0) | |||
| { | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| activeTimers.add (this); | |||
| #endif | |||
| } | |||
| @@ -336,7 +336,7 @@ Timer::Timer (const Timer&) throw() | |||
| previous (0), | |||
| next (0) | |||
| { | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| activeTimers.add (this); | |||
| #endif | |||
| } | |||
| @@ -345,7 +345,7 @@ Timer::~Timer() | |||
| { | |||
| stopTimer(); | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| activeTimers.removeValue (this); | |||
| #endif | |||
| } | |||
| @@ -354,7 +354,7 @@ void Timer::startTimer (const int interval) throw() | |||
| { | |||
| const ScopedLock sl (InternalTimerThread::lock); | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| // this isn't a valid object! Your timer might be a dangling pointer or something.. | |||
| jassert (activeTimers.contains (this)); | |||
| #endif | |||
| @@ -375,7 +375,7 @@ void Timer::stopTimer() throw() | |||
| { | |||
| const ScopedLock sl (InternalTimerThread::lock); | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| // this isn't a valid object! Your timer might be a dangling pointer or something.. | |||
| jassert (activeTimers.contains (this)); | |||
| #endif | |||
| @@ -34,7 +34,6 @@ | |||
| BEGIN_JUCE_NAMESPACE | |||
| #include "juce_TextEditor.h" | |||
| #include "../menus/juce_PopupMenu.h" | |||
| #include "../../graphics/fonts/juce_GlyphArrangement.h" | |||
| #include "../../../application/juce_SystemClipboard.h" | |||
| #include "../../../../juce_core/basics/juce_Time.h" | |||
| @@ -874,7 +873,6 @@ TextEditor::TextEditor (const String& name, | |||
| popupMenuEnabled (true), | |||
| selectAllTextWhenFocused (false), | |||
| scrollbarVisible (true), | |||
| menuVisible (false), | |||
| wasFocused (false), | |||
| caretFlashState (true), | |||
| keepCursorOnScreen (true), | |||
| @@ -913,7 +911,7 @@ TextEditor::~TextEditor() | |||
| } | |||
| //============================================================================== | |||
| void TextEditor::newTransaction() | |||
| void TextEditor::newTransaction() throw() | |||
| { | |||
| lastTransactionTime = Time::getApproximateMillisecondCounter(); | |||
| undoManager.beginNewTransaction(); | |||
| @@ -1109,7 +1107,7 @@ void TextEditor::setText (const String& newText, | |||
| } | |||
| //============================================================================== | |||
| void TextEditor::textChanged() | |||
| void TextEditor::textChanged() throw() | |||
| { | |||
| updateTextHolderSize(); | |||
| postCommandMessage (textChangeMessageId); | |||
| @@ -1198,7 +1196,7 @@ void TextEditor::repaintText (int textStartIndex, int textEndIndex) | |||
| } | |||
| //============================================================================== | |||
| void TextEditor::moveCaret (int newCaretPos) | |||
| void TextEditor::moveCaret (int newCaretPos) throw() | |||
| { | |||
| if (newCaretPos < 0) | |||
| newCaretPos = 0; | |||
| @@ -1216,12 +1214,12 @@ void TextEditor::moveCaret (int newCaretPos) | |||
| } | |||
| } | |||
| void TextEditor::setCaretPosition (const int newIndex) | |||
| void TextEditor::setCaretPosition (const int newIndex) throw() | |||
| { | |||
| moveCursorTo (newIndex, false); | |||
| } | |||
| int TextEditor::getCaretPosition() const | |||
| int TextEditor::getCaretPosition() const throw() | |||
| { | |||
| return caretPosition; | |||
| } | |||
| @@ -1233,7 +1231,7 @@ float TextEditor::getWordWrapWidth() const throw() | |||
| : 1.0e10f; | |||
| } | |||
| void TextEditor::updateTextHolderSize() | |||
| void TextEditor::updateTextHolderSize() throw() | |||
| { | |||
| const float wordWrapWidth = getWordWrapWidth(); | |||
| @@ -1254,24 +1252,24 @@ void TextEditor::updateTextHolderSize() | |||
| } | |||
| } | |||
| int TextEditor::getTextWidth() const | |||
| int TextEditor::getTextWidth() const throw() | |||
| { | |||
| return textHolder->getWidth(); | |||
| } | |||
| int TextEditor::getTextHeight() const | |||
| int TextEditor::getTextHeight() const throw() | |||
| { | |||
| return textHolder->getHeight(); | |||
| } | |||
| void TextEditor::setIndents (const int newLeftIndent, | |||
| const int newTopIndent) | |||
| const int newTopIndent) throw() | |||
| { | |||
| leftIndent = newLeftIndent; | |||
| topIndent = newTopIndent; | |||
| } | |||
| void TextEditor::setBorder (const BorderSize& border) | |||
| void TextEditor::setBorder (const BorderSize& border) throw() | |||
| { | |||
| borderSize = border; | |||
| resized(); | |||
| @@ -1287,7 +1285,7 @@ void TextEditor::setScrollToShowCursor (const bool shouldScrollToShowCursor) thr | |||
| keepCursorOnScreen = shouldScrollToShowCursor; | |||
| } | |||
| void TextEditor::scrollToMakeSureCursorIsVisible() | |||
| void TextEditor::scrollToMakeSureCursorIsVisible() throw() | |||
| { | |||
| cursorHeight = currentFont.getHeight(); // (in case the text is empty and the call below doesn't set this value) | |||
| @@ -1337,7 +1335,7 @@ void TextEditor::scrollToMakeSureCursorIsVisible() | |||
| } | |||
| void TextEditor::moveCursorTo (const int newPosition, | |||
| const bool isSelecting) | |||
| const bool isSelecting) throw() | |||
| { | |||
| if (isSelecting) | |||
| { | |||
| @@ -1389,7 +1387,7 @@ void TextEditor::moveCursorTo (const int newPosition, | |||
| } | |||
| int TextEditor::getTextIndexAt (const int x, | |||
| const int y) | |||
| const int y) throw() | |||
| { | |||
| return indexAtPosition ((float) (x + viewport->getViewPositionX() - leftIndent), | |||
| (float) (y + viewport->getViewPositionY() - topIndent)); | |||
| @@ -1424,7 +1422,7 @@ void TextEditor::insertTextAtCursor (String newText) | |||
| textChanged(); | |||
| } | |||
| void TextEditor::setHighlightedRegion (int startPos, int numChars) | |||
| void TextEditor::setHighlightedRegion (int startPos, int numChars) throw() | |||
| { | |||
| moveCursorTo (startPos, false); | |||
| moveCursorTo (startPos + numChars, true); | |||
| @@ -1578,55 +1576,13 @@ void TextEditor::mouseDown (const MouseEvent& e) | |||
| } | |||
| else | |||
| { | |||
| const bool writable = ! isReadOnly(); | |||
| PopupMenu m; | |||
| m.addItem (1, TRANS("cut"), writable); | |||
| m.addItem (2, TRANS("copy"), selectionStart < selectionEnd); | |||
| m.addItem (3, TRANS("paste"), writable); | |||
| m.addItem (4, TRANS("delete"), writable); | |||
| m.addSeparator(); | |||
| m.addItem (5, TRANS("select all")); | |||
| m.addSeparator(); | |||
| m.addItem (6, TRANS("undo"), undoManager.canUndo()); | |||
| m.addItem (7, TRANS("redo"), undoManager.canRedo()); | |||
| menuVisible = true; | |||
| switch (m.show()) | |||
| { | |||
| case 1: | |||
| copy(); | |||
| cut(); | |||
| break; | |||
| case 2: | |||
| copy(); | |||
| break; | |||
| case 3: | |||
| paste(); | |||
| break; | |||
| case 4: | |||
| cut(); | |||
| break; | |||
| addPopupMenuItems (m); | |||
| case 5: | |||
| moveCursorTo (getTotalNumChars(), false); | |||
| moveCursorTo (0, true); | |||
| break; | |||
| case 6: | |||
| doUndoRedo (false); | |||
| break; | |||
| const int result = m.show(); | |||
| case 7: | |||
| doUndoRedo (true); | |||
| break; | |||
| } | |||
| menuVisible = false; | |||
| if (result != 0) | |||
| performPopupMenuAction (result); | |||
| } | |||
| } | |||
| } | |||
| @@ -1872,13 +1828,9 @@ void TextEditor::keyPressed (const KeyPress& key) | |||
| newTransaction(); | |||
| if (returnKeyStartsNewLine) | |||
| { | |||
| insertTextAtCursor (T("\n")); | |||
| } | |||
| else | |||
| { | |||
| returnPressed(); | |||
| } | |||
| } | |||
| } | |||
| else if (key.isKeyCode (KeyPress::escapeKey)) | |||
| @@ -1907,6 +1859,63 @@ void TextEditor::keyStateChanged() | |||
| // (overridden to avoid forwarding key events to the parent) | |||
| } | |||
| //============================================================================== | |||
| const int baseMenuItemID = 0x7fff0000; | |||
| void TextEditor::addPopupMenuItems (PopupMenu& m) | |||
| { | |||
| const bool writable = ! isReadOnly(); | |||
| m.addItem (baseMenuItemID + 1, TRANS("cut"), writable); | |||
| m.addItem (baseMenuItemID + 2, TRANS("copy"), selectionStart < selectionEnd); | |||
| m.addItem (baseMenuItemID + 3, TRANS("paste"), writable); | |||
| m.addItem (baseMenuItemID + 4, TRANS("delete"), writable); | |||
| m.addSeparator(); | |||
| m.addItem (baseMenuItemID + 5, TRANS("select all")); | |||
| m.addSeparator(); | |||
| m.addItem (baseMenuItemID + 6, TRANS("undo"), undoManager.canUndo()); | |||
| m.addItem (baseMenuItemID + 7, TRANS("redo"), undoManager.canRedo()); | |||
| } | |||
| void TextEditor::performPopupMenuAction (const int menuItemID) | |||
| { | |||
| switch (menuItemID) | |||
| { | |||
| case baseMenuItemID + 1: | |||
| copy(); | |||
| cut(); | |||
| break; | |||
| case baseMenuItemID + 2: | |||
| copy(); | |||
| break; | |||
| case baseMenuItemID + 3: | |||
| paste(); | |||
| break; | |||
| case baseMenuItemID + 4: | |||
| cut(); | |||
| break; | |||
| case baseMenuItemID + 5: | |||
| moveCursorTo (getTotalNumChars(), false); | |||
| moveCursorTo (0, true); | |||
| break; | |||
| case baseMenuItemID + 6: | |||
| doUndoRedo (false); | |||
| break; | |||
| case baseMenuItemID + 7: | |||
| doUndoRedo (true); | |||
| break; | |||
| default: | |||
| break; | |||
| } | |||
| } | |||
| //============================================================================== | |||
| void TextEditor::focusGained (FocusChangeType) | |||
| { | |||
| @@ -1960,7 +1969,7 @@ void TextEditor::resized() | |||
| } | |||
| } | |||
| void TextEditor::handleCommandMessage (int commandId) | |||
| void TextEditor::handleCommandMessage (const int commandId) | |||
| { | |||
| const ComponentDeletionWatcher deletionChecker (this); | |||
| @@ -2007,7 +2016,7 @@ void TextEditor::enablementChanged() | |||
| } | |||
| //============================================================================== | |||
| void TextEditor::clearInternal (UndoManager* const um) | |||
| void TextEditor::clearInternal (UndoManager* const um) throw() | |||
| { | |||
| remove (0, getTotalNumChars(), um, caretPosition); | |||
| } | |||
| @@ -2017,7 +2026,7 @@ void TextEditor::insert (const String& text, | |||
| const Font& font, | |||
| const Colour& colour, | |||
| UndoManager* const um, | |||
| const int caretPositionToMoveTo) | |||
| const int caretPositionToMoveTo) throw() | |||
| { | |||
| if (text.isNotEmpty()) | |||
| { | |||
| @@ -2075,7 +2084,7 @@ void TextEditor::insert (const String& text, | |||
| } | |||
| void TextEditor::reinsert (const int insertIndex, | |||
| const VoidArray sectionsToInsert) | |||
| const VoidArray& sectionsToInsert) throw() | |||
| { | |||
| int index = 0; | |||
| int nextIndex = 0; | |||
| @@ -2114,10 +2123,10 @@ void TextEditor::reinsert (const int insertIndex, | |||
| totalNumChars = -1; | |||
| } | |||
| void TextEditor::remove (int startIndex, | |||
| void TextEditor::remove (const int startIndex, | |||
| int endIndex, | |||
| UndoManager* const um, | |||
| const int caretPositionToMoveTo) | |||
| const int caretPositionToMoveTo) throw() | |||
| { | |||
| if (endIndex > startIndex) | |||
| { | |||
| @@ -2210,7 +2219,7 @@ void TextEditor::remove (int startIndex, | |||
| } | |||
| //============================================================================== | |||
| const String TextEditor::getText() const | |||
| const String TextEditor::getText() const throw() | |||
| { | |||
| String t; | |||
| @@ -2220,7 +2229,7 @@ const String TextEditor::getText() const | |||
| return t; | |||
| } | |||
| const String TextEditor::getTextSubstring (const int startCharacter, const int endCharacter) const | |||
| const String TextEditor::getTextSubstring (const int startCharacter, const int endCharacter) const throw() | |||
| { | |||
| String t; | |||
| int index = 0; | |||
| @@ -2251,7 +2260,7 @@ const String TextEditor::getHighlightedText() const throw() | |||
| getHighlightedRegionStart() + getHighlightedRegionLength()); | |||
| } | |||
| int TextEditor::getTotalNumChars() | |||
| int TextEditor::getTotalNumChars() throw() | |||
| { | |||
| if (totalNumChars < 0) | |||
| { | |||
| @@ -2264,7 +2273,7 @@ int TextEditor::getTotalNumChars() | |||
| return totalNumChars; | |||
| } | |||
| bool TextEditor::isEmpty() const | |||
| bool TextEditor::isEmpty() const throw() | |||
| { | |||
| if (totalNumChars != 0) | |||
| { | |||
| @@ -2276,7 +2285,7 @@ bool TextEditor::isEmpty() const | |||
| return true; | |||
| } | |||
| void TextEditor::getCharPosition (const int index, float& cx, float& cy, float& lineHeight) | |||
| void TextEditor::getCharPosition (const int index, float& cx, float& cy, float& lineHeight) const throw() | |||
| { | |||
| const float wordWrapWidth = getWordWrapWidth(); | |||
| @@ -2308,7 +2317,7 @@ void TextEditor::getCharPosition (const int index, float& cx, float& cy, float& | |||
| lineHeight = currentFont.getHeight(); | |||
| } | |||
| int TextEditor::indexAtPosition (const float x, const float y) | |||
| int TextEditor::indexAtPosition (const float x, const float y) throw() | |||
| { | |||
| const float wordWrapWidth = getWordWrapWidth(); | |||
| @@ -2341,10 +2350,11 @@ int TextEditor::indexAtPosition (const float x, const float y) | |||
| //============================================================================== | |||
| static int getCharacterCategory (const tchar character) throw() | |||
| { | |||
| return CharacterFunctions::isLetterOrDigit (character) ? 2 : (CharacterFunctions::isWhitespace (character) ? 0 : 1); | |||
| return CharacterFunctions::isLetterOrDigit (character) | |||
| ? 2 : (CharacterFunctions::isWhitespace (character) ? 0 : 1); | |||
| } | |||
| int TextEditor::findWordBreakAfter (int position) const | |||
| int TextEditor::findWordBreakAfter (int position) const throw() | |||
| { | |||
| const String t (getTextSubstring (position, position + 512)); | |||
| const int totalLength = t.length(); | |||
| @@ -2375,7 +2385,7 @@ int TextEditor::findWordBreakAfter (int position) const | |||
| return position; | |||
| } | |||
| int TextEditor::findWordBreakBefore (int position) const | |||
| int TextEditor::findWordBreakBefore (int position) const throw() | |||
| { | |||
| if (position > 0) | |||
| { | |||
| @@ -2408,7 +2418,7 @@ int TextEditor::findWordBreakBefore (int position) const | |||
| //============================================================================== | |||
| void TextEditor::splitSection (const int sectionIndex, | |||
| const int charToSplitAt) | |||
| const int charToSplitAt) throw() | |||
| { | |||
| jassert (sections[sectionIndex] != 0); | |||
| @@ -2417,7 +2427,7 @@ void TextEditor::splitSection (const int sectionIndex, | |||
| ->split (charToSplitAt, passwordCharacter)); | |||
| } | |||
| void TextEditor::coalesceSimilarSections() | |||
| void TextEditor::coalesceSimilarSections() throw() | |||
| { | |||
| for (int i = 0; i < sections.size() - 1; ++i) | |||
| { | |||
| @@ -36,6 +36,7 @@ | |||
| #include "../../../events/juce_Timer.h" | |||
| #include "../../../documents/juce_UndoManager.h" | |||
| #include "../layout/juce_Viewport.h" | |||
| #include "../menus/juce_PopupMenu.h" | |||
| class TextEditor; | |||
| class TextHolderComponent; | |||
| @@ -327,16 +328,16 @@ l */ | |||
| //============================================================================== | |||
| /** Returns the entire contents of the editor. */ | |||
| const String getText() const; | |||
| const String getText() const throw(); | |||
| /** Returns a section of the contents of the editor. */ | |||
| const String getTextSubstring (const int startCharacter, const int endCharacter) const; | |||
| const String getTextSubstring (const int startCharacter, const int endCharacter) const throw(); | |||
| /** Returns true if there are no characters in the editor. | |||
| This is more efficient than calling getText().isEmpty(). | |||
| */ | |||
| bool isEmpty() const; | |||
| bool isEmpty() const throw(); | |||
| /** Sets the entire content of the editor. | |||
| @@ -391,18 +392,18 @@ l */ | |||
| @see getCaretPosition | |||
| */ | |||
| void setCaretPosition (const int newIndex); | |||
| void setCaretPosition (const int newIndex) throw(); | |||
| /** Returns the current index of the caret. | |||
| @see setCaretPosition | |||
| */ | |||
| int getCaretPosition() const; | |||
| int getCaretPosition() const throw(); | |||
| /** Selects a section of the text. | |||
| */ | |||
| void setHighlightedRegion (int startIndex, | |||
| int numberOfCharactersToHighlight); | |||
| int numberOfCharactersToHighlight) throw(); | |||
| /** Returns the first character that is selected. | |||
| @@ -426,33 +427,33 @@ l */ | |||
| The co-ordinates are relative to the component's top-left. | |||
| */ | |||
| int getTextIndexAt (const int x, const int y); | |||
| int getTextIndexAt (const int x, const int y) throw(); | |||
| /** Returns the total width of the text, as it is currently laid-out. | |||
| This may be larger than the size of the TextEditor, and can change when | |||
| the TextEditor is resized or the text changes. | |||
| */ | |||
| int getTextWidth() const; | |||
| int getTextWidth() const throw(); | |||
| /** Returns the maximum height of the text, as it is currently laid-out. | |||
| This may be larger than the size of the TextEditor, and can change when | |||
| the TextEditor is resized or the text changes. | |||
| */ | |||
| int getTextHeight() const; | |||
| int getTextHeight() const throw(); | |||
| /** Changes the size of the gap at the top and left-edge of the editor. | |||
| By default there's a gap of 4 pixels. | |||
| */ | |||
| void setIndents (const int newLeftIndent, const int newTopIndent); | |||
| void setIndents (const int newLeftIndent, const int newTopIndent) throw(); | |||
| /** Changes the size of border left around the edge of the component. | |||
| @see getBorder | |||
| */ | |||
| void setBorder (const BorderSize& border); | |||
| void setBorder (const BorderSize& border) throw(); | |||
| /** Returns the size of border around the edge of the component. | |||
| @@ -500,10 +501,65 @@ l */ | |||
| juce_UseDebuggingNewOperator | |||
| protected: | |||
| void scrollToMakeSureCursorIsVisible(); | |||
| void moveCaret (int newCaretPos); | |||
| void moveCursorTo (const int newPosition, const bool isSelecting); | |||
| void textChanged(); | |||
| /** This adds the items to the popup menu. | |||
| By default it adds the cut/copy/paste items, but you can override this if | |||
| you need to replace these with your own items. | |||
| If you want to add your own items to the existing ones, you can override this, | |||
| call the base class's addPopupMenuItems() method, then append your own items. | |||
| When the menu has been shown, performPopupMenuAction() will be called to | |||
| perform the item that the user has chosen. | |||
| The default menu items will be added using item IDs in the range | |||
| 0x7fff0000 - 0x7fff1000, so you should avoid those values for your own | |||
| menu IDs. | |||
| @see performPopupMenuAction, setPopupMenuEnabled, isPopupMenuEnabled | |||
| */ | |||
| virtual void addPopupMenuItems (PopupMenu& menuToAddTo); | |||
| /** This is called to perform one of the items that was shown on the popup menu. | |||
| If you've overridden addPopupMenuItems(), you should also override this | |||
| to perform the actions that you've added. | |||
| If you've overridden addPopupMenuItems() but have still left the default items | |||
| on the menu, remember to call the superclass's performPopupMenuAction() | |||
| so that it can perform the default actions if that's what the user clicked on. | |||
| @see addPopupMenuItems, setPopupMenuEnabled, isPopupMenuEnabled | |||
| */ | |||
| virtual void performPopupMenuAction (const int menuItemID); | |||
| /** Scrolls the minimum distance needed to get the caret into view. */ | |||
| void scrollToMakeSureCursorIsVisible() throw(); | |||
| /** @internal */ | |||
| void moveCaret (int newCaretPos) throw(); | |||
| /** @internal */ | |||
| void moveCursorTo (const int newPosition, const bool isSelecting) throw(); | |||
| /** Used internally to dispatch a text-change message. */ | |||
| void textChanged() throw(); | |||
| /** Counts the number of characters in the text. | |||
| This is quicker than getting the text as a string if you just need to know | |||
| the length. | |||
| */ | |||
| int getTotalNumChars() throw(); | |||
| /** Begins a new transaction in the UndoManager. | |||
| */ | |||
| void newTransaction() throw(); | |||
| /** Used internally to trigger an undo or redo. */ | |||
| void doUndoRedo (const bool isRedo); | |||
| /** @internal */ | |||
| void handleCommandMessage (int commandId); | |||
| virtual void returnPressed(); | |||
| @@ -522,7 +578,6 @@ private: | |||
| bool popupMenuEnabled : 1; | |||
| bool selectAllTextWhenFocused : 1; | |||
| bool scrollbarVisible : 1; | |||
| bool menuVisible : 1; | |||
| bool wasFocused : 1; | |||
| bool caretFlashState : 1; | |||
| bool keepCursorOnScreen : 1; | |||
| @@ -554,45 +609,40 @@ private: | |||
| friend class TextEditorInsertAction; | |||
| friend class TextEditorRemoveAction; | |||
| void coalesceSimilarSections(); | |||
| void splitSection (const int sectionIndex, const int charToSplitAt); | |||
| void coalesceSimilarSections() throw(); | |||
| void splitSection (const int sectionIndex, const int charToSplitAt) throw(); | |||
| void clearInternal (UndoManager* const um); | |||
| void clearInternal (UndoManager* const um) throw(); | |||
| void insert (const String& text, | |||
| const int insertIndex, | |||
| const Font& font, | |||
| const Colour& colour, | |||
| UndoManager* const um, | |||
| const int caretPositionToMoveTo); | |||
| const int caretPositionToMoveTo) throw(); | |||
| void reinsert (const int insertIndex, | |||
| const VoidArray sections); | |||
| const VoidArray& sections) throw(); | |||
| void remove (int startIndex, | |||
| void remove (const int startIndex, | |||
| int endIndex, | |||
| UndoManager* const um, | |||
| const int caretPositionToMoveTo); | |||
| int getTotalNumChars(); | |||
| const int caretPositionToMoveTo) throw(); | |||
| void getCharPosition (const int index, | |||
| float& x, float& y, | |||
| float& lineHeight); | |||
| float& lineHeight) const throw(); | |||
| int indexAtPosition (const float x, | |||
| const float y); | |||
| int findWordBreakAfter (int position) const; | |||
| int findWordBreakBefore (int position) const; | |||
| const float y) throw(); | |||
| void newTransaction(); | |||
| void doUndoRedo (const bool isRedo); | |||
| int findWordBreakAfter (int position) const throw(); | |||
| int findWordBreakBefore (int position) const throw(); | |||
| friend class TextHolderComponent; | |||
| friend class TextEditorViewport; | |||
| void drawContent (Graphics& g); | |||
| void updateTextHolderSize(); | |||
| void updateTextHolderSize() throw(); | |||
| float getWordWrapWidth() const throw(); | |||
| void timerCallbackInt(); | |||
| void repaintCaret(); | |||
| @@ -485,7 +485,7 @@ const BitArray FileBrowserComponent::getRoots (StringArray& rootNames, StringArr | |||
| rootNames.add ("Desktop"); | |||
| #endif | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| rootPaths.add (File::getSpecialLocation (File::userHomeDirectory).getFullPathName()); | |||
| rootNames.add ("Home folder"); | |||
| rootPaths.add (File::getSpecialLocation (File::userDocumentsDirectory).getFullPathName()); | |||
| @@ -511,7 +511,7 @@ const BitArray FileBrowserComponent::getRoots (StringArray& rootNames, StringArr | |||
| } | |||
| #endif | |||
| #ifdef JUCE_LINUX | |||
| #if JUCE_LINUX | |||
| rootPaths.add ("/"); | |||
| rootNames.add ("/"); | |||
| rootPaths.add (File::getSpecialLocation (File::userHomeDirectory).getFullPathName()); | |||
| @@ -50,7 +50,7 @@ FileChooser::FileChooser (const String& chooserBoxTitle, | |||
| startingFile (currentFileOrDirectory), | |||
| useNativeDialogBox (useNativeDialogBox_) | |||
| { | |||
| #ifdef JUCE_LINUX | |||
| #if JUCE_LINUX | |||
| useNativeDialogBox = false; | |||
| #endif | |||
| @@ -462,7 +462,7 @@ void Component::addToDesktop (int desktopWindowStyleFlags, void* nativeWindowToA | |||
| { | |||
| const ComponentDeletionWatcher deletionChecker (this); | |||
| #ifdef JUCE_LINUX | |||
| #if JUCE_LINUX | |||
| // it's wise to give the component a non-zero size before | |||
| // putting it on the desktop, as X windows get confused by this, and | |||
| // a (1, 1) minimum size is enforced here. | |||
| @@ -2666,23 +2666,25 @@ void Component::internalMouseUp (const int oldModifiers, int x, int y, const int | |||
| } | |||
| } | |||
| const Component* p = parentComponent_; | |||
| while (p != 0) | |||
| { | |||
| const ComponentDeletionWatcher parentDeletionChecker (p); | |||
| const Component* p = parentComponent_; | |||
| for (int i = p->numDeepMouseListeners; --i >= 0;) | |||
| while (p != 0) | |||
| { | |||
| ((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseUp (me); | |||
| const ComponentDeletionWatcher parentDeletionChecker (p); | |||
| if (deletionChecker.hasBeenDeleted() || parentDeletionChecker.hasBeenDeleted()) | |||
| return; | |||
| for (int i = p->numDeepMouseListeners; --i >= 0;) | |||
| { | |||
| ((MouseListener*) (p->mouseListeners_->getUnchecked (i)))->mouseUp (me); | |||
| i = jmin (i, p->numDeepMouseListeners); | |||
| } | |||
| if (deletionChecker.hasBeenDeleted() || parentDeletionChecker.hasBeenDeleted()) | |||
| return; | |||
| p = p->parentComponent_; | |||
| i = jmin (i, p->numDeepMouseListeners); | |||
| } | |||
| p = p->parentComponent_; | |||
| } | |||
| } | |||
| // check for double-click | |||
| @@ -234,7 +234,7 @@ const String KeyPress::getTextDescription() const | |||
| if (mods.isShiftDown()) | |||
| desc << "shift + "; | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| // only do this on the mac, because on Windows ctrl and command are the same, | |||
| // and this would get confusing | |||
| if (mods.isCommandDown()) | |||
| @@ -44,7 +44,7 @@ const int ModifierKeys::leftButtonModifier = 16; | |||
| const int ModifierKeys::rightButtonModifier = 32; | |||
| const int ModifierKeys::middleButtonModifier = 64; | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| const int ModifierKeys::commandModifier = 8; | |||
| const int ModifierKeys::popupMenuClickModifier = ModifierKeys::rightButtonModifier | |||
| | ModifierKeys::ctrlModifier; | |||
| @@ -281,7 +281,7 @@ void QuickTimeMovieComponent::paint (Graphics& g) | |||
| #endif | |||
| //============================================================================== | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| #include "../../../../juce_core/misc/juce_PlatformUtilities.h" | |||
| #include "../../../events/juce_MessageManager.h" | |||
| @@ -172,7 +172,7 @@ public: | |||
| void parentHierarchyChanged(); | |||
| /** @internal */ | |||
| void visibilityChanged(); | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| /** @internal */ | |||
| void handleMCEvent (void*); | |||
| /** @internal */ | |||
| @@ -193,7 +193,7 @@ private: | |||
| void* internal; | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| void* associatedWindow; | |||
| Rectangle lastPositionApplied; | |||
| bool controllerAssignedToWindow, reentrant, looping; | |||
| @@ -48,7 +48,7 @@ DocumentWindow::DocumentWindow (const String& title, | |||
| titleBarHeight (26), | |||
| menuBarHeight (24), | |||
| requiredButtons (requiredButtons_), | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| positionTitleBarButtonsOnLeft (true), | |||
| #else | |||
| positionTitleBarButtonsOnLeft (false), | |||
| @@ -296,7 +296,7 @@ void DocumentWindow::lookAndFeelChanged() | |||
| if (getCloseButton() != 0) | |||
| { | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| getCloseButton()->addShortcut (KeyPress (T('w'), ModifierKeys::commandModifier, 0)); | |||
| #else | |||
| getCloseButton()->addShortcut (KeyPress (KeyPress::F4Key, ModifierKeys::altModifier, 0)); | |||
| @@ -40,16 +40,16 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| Brush::Brush() | |||
| Brush::Brush() throw() | |||
| { | |||
| } | |||
| Brush::~Brush() | |||
| Brush::~Brush() throw() | |||
| { | |||
| } | |||
| void Brush::paintVerticalLine (LowLevelGraphicsContext& context, | |||
| int x, float y1, float y2) | |||
| int x, float y1, float y2) throw() | |||
| { | |||
| Path p; | |||
| p.addRectangle ((float) x, y1, 1.0f, y2 - y1); | |||
| @@ -57,7 +57,7 @@ void Brush::paintVerticalLine (LowLevelGraphicsContext& context, | |||
| } | |||
| void Brush::paintHorizontalLine (LowLevelGraphicsContext& context, | |||
| int y, float x1, float x2) | |||
| int y, float x1, float x2) throw() | |||
| { | |||
| Path p; | |||
| p.addRectangle (x1, (float) y, x2 - x1, 1.0f); | |||
| @@ -65,7 +65,7 @@ void Brush::paintHorizontalLine (LowLevelGraphicsContext& context, | |||
| } | |||
| void Brush::paintLine (LowLevelGraphicsContext& context, | |||
| float x1, float y1, float x2, float y2) | |||
| float x1, float y1, float x2, float y2) throw() | |||
| { | |||
| Path p; | |||
| p.addLineSegment (x1, y1, x2, y2, 1.0f); | |||
| @@ -59,43 +59,43 @@ protected: | |||
| (Nothing much happens in the base class). | |||
| */ | |||
| Brush(); | |||
| Brush() throw(); | |||
| public: | |||
| /** Destructor. */ | |||
| virtual ~Brush(); | |||
| virtual ~Brush() throw(); | |||
| /** Creates a copy of whatever class of Brush this is. */ | |||
| virtual Brush* createCopy() const = 0; | |||
| virtual Brush* createCopy() const throw() = 0; | |||
| /** Does whatever is relevent to transform the geometry of this brush. */ | |||
| virtual void applyTransform (const AffineTransform& transform) = 0; | |||
| virtual void applyTransform (const AffineTransform& transform) throw() = 0; | |||
| /** Does whatever is relevent to change the opacity of this brush. */ | |||
| virtual void multiplyOpacity (const float multiple) = 0; | |||
| virtual void multiplyOpacity (const float multiple) throw() = 0; | |||
| /** Must return true if this brush won't draw any pixels. */ | |||
| virtual bool isInvisible() const = 0; | |||
| virtual bool isInvisible() const throw() = 0; | |||
| //============================================================================== | |||
| virtual void paintPath (LowLevelGraphicsContext& context, | |||
| const Path& path, const AffineTransform& transform) = 0; | |||
| const Path& path, const AffineTransform& transform) throw() = 0; | |||
| virtual void paintRectangle (LowLevelGraphicsContext& context, | |||
| int x, int y, int w, int h) = 0; | |||
| int x, int y, int w, int h) throw() = 0; | |||
| virtual void paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| const Image& alphaChannelImage, int imageX, int imageY, | |||
| int x, int y, int w, int h) = 0; | |||
| int x, int y, int w, int h) throw() = 0; | |||
| virtual void paintVerticalLine (LowLevelGraphicsContext& context, | |||
| int x, float y1, float y2); | |||
| int x, float y1, float y2) throw(); | |||
| virtual void paintHorizontalLine (LowLevelGraphicsContext& context, | |||
| int y, float x1, float x2); | |||
| int y, float x1, float x2) throw(); | |||
| virtual void paintLine (LowLevelGraphicsContext& context, | |||
| float x1, float y1, float x2, float y2); | |||
| float x1, float y1, float x2, float y2) throw(); | |||
| private: | |||
| //============================================================================== | |||
| @@ -45,58 +45,58 @@ GradientBrush::GradientBrush (const Colour& colour1, | |||
| const Colour& colour2, | |||
| const float x2, | |||
| const float y2, | |||
| const bool isRadial) | |||
| const bool isRadial) throw() | |||
| : gradient (colour1, x1, y1, | |||
| colour2, x2, y2, | |||
| isRadial) | |||
| { | |||
| } | |||
| GradientBrush::GradientBrush (const ColourGradient& gradient_) | |||
| GradientBrush::GradientBrush (const ColourGradient& gradient_) throw() | |||
| : gradient (gradient_) | |||
| { | |||
| } | |||
| GradientBrush::~GradientBrush() | |||
| GradientBrush::~GradientBrush() throw() | |||
| { | |||
| } | |||
| Brush* GradientBrush::createCopy() const | |||
| Brush* GradientBrush::createCopy() const throw() | |||
| { | |||
| return new GradientBrush (gradient); | |||
| } | |||
| void GradientBrush::applyTransform (const AffineTransform& transform) | |||
| void GradientBrush::applyTransform (const AffineTransform& transform) throw() | |||
| { | |||
| gradient.transform = gradient.transform.followedBy (transform); | |||
| } | |||
| void GradientBrush::multiplyOpacity (const float multiple) | |||
| void GradientBrush::multiplyOpacity (const float multiple) throw() | |||
| { | |||
| gradient.multiplyOpacity (multiple); | |||
| } | |||
| bool GradientBrush::isInvisible() const | |||
| bool GradientBrush::isInvisible() const throw() | |||
| { | |||
| return gradient.isInvisible(); | |||
| } | |||
| //============================================================================== | |||
| void GradientBrush::paintPath (LowLevelGraphicsContext& context, | |||
| const Path& path, const AffineTransform& transform) | |||
| const Path& path, const AffineTransform& transform) throw() | |||
| { | |||
| context.fillPathWithGradient (path, transform, gradient, EdgeTable::Oversampling_4times); | |||
| } | |||
| void GradientBrush::paintRectangle (LowLevelGraphicsContext& context, | |||
| int x, int y, int w, int h) | |||
| int x, int y, int w, int h) throw() | |||
| { | |||
| context.fillRectWithGradient (x, y, w, h, gradient); | |||
| } | |||
| void GradientBrush::paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| const Image& alphaChannelImage, int imageX, int imageY, | |||
| int x, int y, int w, int h) | |||
| int x, int y, int w, int h) throw() | |||
| { | |||
| context.saveState(); | |||
| @@ -72,33 +72,33 @@ public: | |||
| const Colour& colour2, | |||
| const float x2, | |||
| const float y2, | |||
| const bool isRadial); | |||
| const bool isRadial) throw(); | |||
| /** Creates a gradient brush from a ColourGradient object. | |||
| */ | |||
| GradientBrush (const ColourGradient& gradient); | |||
| GradientBrush (const ColourGradient& gradient) throw(); | |||
| /** Destructor. */ | |||
| ~GradientBrush(); | |||
| ~GradientBrush() throw(); | |||
| //============================================================================== | |||
| Brush* createCopy() const; | |||
| Brush* createCopy() const throw(); | |||
| void applyTransform (const AffineTransform& transform); | |||
| void applyTransform (const AffineTransform& transform) throw(); | |||
| void multiplyOpacity (const float multiple); | |||
| void multiplyOpacity (const float multiple) throw(); | |||
| bool isInvisible() const; | |||
| bool isInvisible() const throw(); | |||
| void paintPath (LowLevelGraphicsContext& context, | |||
| const Path& path, const AffineTransform& transform); | |||
| const Path& path, const AffineTransform& transform) throw(); | |||
| void paintRectangle (LowLevelGraphicsContext& context, | |||
| int x, int y, int w, int h); | |||
| int x, int y, int w, int h) throw(); | |||
| void paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| const Image& alphaChannelImage, int imageX, int imageY, | |||
| int x, int y, int w, int h); | |||
| int x, int y, int w, int h) throw(); | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| @@ -42,7 +42,7 @@ BEGIN_JUCE_NAMESPACE | |||
| ImageBrush::ImageBrush (Image* const image_, | |||
| const int anchorX_, | |||
| const int anchorY_, | |||
| const float opacity_) | |||
| const float opacity_) throw() | |||
| : image (image_), | |||
| anchorX (anchorX_), | |||
| anchorY (anchorY_), | |||
| @@ -60,31 +60,31 @@ ImageBrush::ImageBrush (Image* const image_, | |||
| } | |||
| } | |||
| ImageBrush::~ImageBrush() | |||
| ImageBrush::~ImageBrush() throw() | |||
| { | |||
| } | |||
| Brush* ImageBrush::createCopy() const | |||
| Brush* ImageBrush::createCopy() const throw() | |||
| { | |||
| return new ImageBrush (image, anchorX, anchorY, opacity); | |||
| } | |||
| void ImageBrush::multiplyOpacity (const float multiple) | |||
| void ImageBrush::multiplyOpacity (const float multiple) throw() | |||
| { | |||
| opacity *= multiple; | |||
| } | |||
| bool ImageBrush::isInvisible() const | |||
| bool ImageBrush::isInvisible() const throw() | |||
| { | |||
| return opacity == 0.0f; | |||
| } | |||
| void ImageBrush::applyTransform (const AffineTransform& /*transform*/) | |||
| void ImageBrush::applyTransform (const AffineTransform& /*transform*/) throw() | |||
| { | |||
| //xxx should probably be smarter and warp the image | |||
| } | |||
| void ImageBrush::getStartXY (int& x, int& y) const | |||
| void ImageBrush::getStartXY (int& x, int& y) const throw() | |||
| { | |||
| x -= anchorX; | |||
| y -= anchorY; | |||
| @@ -109,7 +109,7 @@ void ImageBrush::getStartXY (int& x, int& y) const | |||
| //============================================================================== | |||
| void ImageBrush::paintRectangle (LowLevelGraphicsContext& context, | |||
| int x, int y, int w, int h) | |||
| int x, int y, int w, int h) throw() | |||
| { | |||
| context.saveState(); | |||
| @@ -142,7 +142,7 @@ void ImageBrush::paintRectangle (LowLevelGraphicsContext& context, | |||
| } | |||
| void ImageBrush::paintPath (LowLevelGraphicsContext& context, | |||
| const Path& path, const AffineTransform& transform) | |||
| const Path& path, const AffineTransform& transform) throw() | |||
| { | |||
| if (image != 0) | |||
| { | |||
| @@ -186,15 +186,15 @@ void ImageBrush::paintPath (LowLevelGraphicsContext& context, | |||
| void ImageBrush::paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| const Image& alphaChannelImage, int imageX, int imageY, | |||
| int x, int y, int w, int h) | |||
| int x, int y, int w, int h) throw() | |||
| { | |||
| context.saveState(); | |||
| if (image != 0 && context.reduceClipRegion (x, y, w, h)) | |||
| { | |||
| const Rectangle clip (context.getClipBounds()); | |||
| int x = clip.getX(); | |||
| int y = clip.getY(); | |||
| x = clip.getX(); | |||
| y = clip.getY(); | |||
| const int right = clip.getRight(); | |||
| const int bottom = clip.getBottom(); | |||
| @@ -55,30 +55,30 @@ public: | |||
| ImageBrush (Image* const image, | |||
| const int anchorX, | |||
| const int anchorY, | |||
| const float opacity); | |||
| const float opacity) throw(); | |||
| /** Destructor. */ | |||
| ~ImageBrush(); | |||
| ~ImageBrush() throw(); | |||
| //============================================================================== | |||
| Brush* createCopy() const; | |||
| Brush* createCopy() const throw(); | |||
| void applyTransform (const AffineTransform& transform); | |||
| void applyTransform (const AffineTransform& transform) throw(); | |||
| void multiplyOpacity (const float multiple); | |||
| void multiplyOpacity (const float multiple) throw(); | |||
| bool isInvisible() const; | |||
| bool isInvisible() const throw(); | |||
| void paintPath (LowLevelGraphicsContext& context, | |||
| const Path& path, const AffineTransform& transform); | |||
| const Path& path, const AffineTransform& transform) throw(); | |||
| void paintRectangle (LowLevelGraphicsContext& context, | |||
| int x, int y, int w, int h); | |||
| int x, int y, int w, int h) throw(); | |||
| void paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| const Image& alphaChannelImage, int imageX, int imageY, | |||
| int x, int y, int w, int h); | |||
| int x, int y, int w, int h) throw(); | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| @@ -92,7 +92,7 @@ private: | |||
| ImageBrush (const ImageBrush&); | |||
| const ImageBrush& operator= (const ImageBrush&); | |||
| void getStartXY (int& x, int& y) const; | |||
| void getStartXY (int& x, int& y) const throw(); | |||
| }; | |||
| #endif // __JUCE_IMAGEBRUSH_JUCEHEADER__ | |||
| @@ -39,48 +39,48 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| SolidColourBrush::SolidColourBrush() | |||
| SolidColourBrush::SolidColourBrush() throw() | |||
| : colour (0xff000000) | |||
| { | |||
| } | |||
| SolidColourBrush::SolidColourBrush (const Colour& colour_) | |||
| SolidColourBrush::SolidColourBrush (const Colour& colour_) throw() | |||
| : colour (colour_) | |||
| { | |||
| } | |||
| SolidColourBrush::~SolidColourBrush() | |||
| SolidColourBrush::~SolidColourBrush() throw() | |||
| { | |||
| } | |||
| Brush* SolidColourBrush::createCopy() const | |||
| Brush* SolidColourBrush::createCopy() const throw() | |||
| { | |||
| return new SolidColourBrush (colour); | |||
| } | |||
| void SolidColourBrush::applyTransform (const AffineTransform& /*transform*/) | |||
| void SolidColourBrush::applyTransform (const AffineTransform& /*transform*/) throw() | |||
| { | |||
| } | |||
| void SolidColourBrush::multiplyOpacity (const float multiple) | |||
| void SolidColourBrush::multiplyOpacity (const float multiple) throw() | |||
| { | |||
| colour = colour.withMultipliedAlpha (multiple); | |||
| } | |||
| bool SolidColourBrush::isInvisible() const | |||
| bool SolidColourBrush::isInvisible() const throw() | |||
| { | |||
| return colour.isTransparent(); | |||
| } | |||
| void SolidColourBrush::paintPath (LowLevelGraphicsContext& context, | |||
| const Path& path, const AffineTransform& transform) | |||
| const Path& path, const AffineTransform& transform) throw() | |||
| { | |||
| if (! colour.isTransparent()) | |||
| context.fillPathWithColour (path, transform, colour, EdgeTable::Oversampling_4times); | |||
| } | |||
| void SolidColourBrush::paintRectangle (LowLevelGraphicsContext& context, | |||
| int x, int y, int w, int h) | |||
| int x, int y, int w, int h) throw() | |||
| { | |||
| if (! colour.isTransparent()) | |||
| context.fillRectWithColour (x, y, w, h, colour, false); | |||
| @@ -88,7 +88,7 @@ void SolidColourBrush::paintRectangle (LowLevelGraphicsContext& context, | |||
| void SolidColourBrush::paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| const Image& alphaChannelImage, int imageX, int imageY, | |||
| int x, int y, int w, int h) | |||
| int x, int y, int w, int h) throw() | |||
| { | |||
| if (! colour.isTransparent()) | |||
| { | |||
| @@ -102,19 +102,19 @@ void SolidColourBrush::paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| } | |||
| void SolidColourBrush::paintVerticalLine (LowLevelGraphicsContext& context, | |||
| int x, float y1, float y2) | |||
| int x, float y1, float y2) throw() | |||
| { | |||
| context.drawVerticalLine (x, y1, y2, colour); | |||
| } | |||
| void SolidColourBrush::paintHorizontalLine (LowLevelGraphicsContext& context, | |||
| int y, float x1, float x2) | |||
| int y, float x1, float x2) throw() | |||
| { | |||
| context.drawHorizontalLine (y, x1, x2, colour); | |||
| } | |||
| void SolidColourBrush::paintLine (LowLevelGraphicsContext& context, | |||
| float x1, float y1, float x2, float y2) | |||
| float x1, float y1, float x2, float y2) throw() | |||
| { | |||
| context.drawLine (x1, y1, x2, y2, colour); | |||
| } | |||
| @@ -55,16 +55,16 @@ public: | |||
| The colour can be changed later with the setColour() method. | |||
| */ | |||
| SolidColourBrush (const Colour& colour); | |||
| SolidColourBrush (const Colour& colour) throw(); | |||
| /** Creates a SolidColourBrush set to black. | |||
| The colour can be changed later with the setColour() method. | |||
| */ | |||
| SolidColourBrush(); | |||
| SolidColourBrush() throw(); | |||
| /** Destructor. */ | |||
| ~SolidColourBrush(); | |||
| ~SolidColourBrush() throw(); | |||
| //============================================================================== | |||
| /** Returns the colour currently being used. */ | |||
| @@ -74,32 +74,32 @@ public: | |||
| void setColour (const Colour& newColour) throw() { colour = newColour; } | |||
| //============================================================================== | |||
| Brush* createCopy() const; | |||
| Brush* createCopy() const throw(); | |||
| void applyTransform (const AffineTransform& transform); | |||
| void applyTransform (const AffineTransform& transform) throw(); | |||
| bool isInvisible() const; | |||
| bool isInvisible() const throw(); | |||
| void multiplyOpacity (const float multiple); | |||
| void multiplyOpacity (const float multiple) throw(); | |||
| void paintPath (LowLevelGraphicsContext& context, | |||
| const Path& path, const AffineTransform& transform); | |||
| const Path& path, const AffineTransform& transform) throw(); | |||
| void paintRectangle (LowLevelGraphicsContext& context, | |||
| int x, int y, int w, int h); | |||
| int x, int y, int w, int h) throw(); | |||
| void paintAlphaChannel (LowLevelGraphicsContext& context, | |||
| const Image& alphaChannelImage, int imageX, int imageY, | |||
| int x, int y, int w, int h); | |||
| int x, int y, int w, int h) throw(); | |||
| void paintVerticalLine (LowLevelGraphicsContext& context, | |||
| int x, float y1, float y2); | |||
| int x, float y1, float y2) throw(); | |||
| void paintHorizontalLine (LowLevelGraphicsContext& context, | |||
| int y, float x1, float x2); | |||
| int y, float x1, float x2) throw(); | |||
| void paintLine (LowLevelGraphicsContext& context, | |||
| float x1, float y1, float x2, float y2); | |||
| float x1, float y1, float x2, float y2) throw(); | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| @@ -148,10 +148,10 @@ PixelARGB* ColourGradient::createLookupTable (int& numEntries) const throw() | |||
| PixelARGB pix1 (colours.getUnchecked (1)); | |||
| int index = 0; | |||
| for (int i = 2; i < colours.size(); i += 2) | |||
| for (int j = 2; j < colours.size(); j += 2) | |||
| { | |||
| const int numToDo = ((colours.getUnchecked (i) * numEntries) >> 16) - index; | |||
| const PixelARGB pix2 (colours.getUnchecked (i + 1)); | |||
| const int numToDo = ((colours.getUnchecked (j) * numEntries) >> 16) - index; | |||
| const PixelARGB pix2 (colours.getUnchecked (j + 1)); | |||
| for (int i = 0; i < numToDo; ++i) | |||
| { | |||
| @@ -388,7 +388,7 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| uint8 r, g, b; | |||
| #else | |||
| uint8 b, g, r; | |||
| @@ -397,7 +397,7 @@ private: | |||
| } PACKED; | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma pack (pop) | |||
| #endif | |||
| @@ -91,10 +91,10 @@ void EdgeTable::remapTableForNumEdges (const int newNumEdgesPerLine) throw() | |||
| maxEdgesPerLine = newNumEdgesPerLine; | |||
| const int newLineStrideElements = maxEdgesPerLine * 2 + 1; | |||
| int* const newTable = (int*) juce_malloc ((height << (int)oversampling) | |||
| int* const newTable = (int*) juce_malloc ((height << (int) oversampling) | |||
| * newLineStrideElements * sizeof (int)); | |||
| for (int i = 0; i < (height << (int)oversampling); ++i) | |||
| for (int i = 0; i < (height << (int) oversampling); ++i) | |||
| { | |||
| const int* srcLine = table + lineStrideElements * i; | |||
| int* dstLine = newTable + newLineStrideElements * i; | |||
| @@ -41,7 +41,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../geometry/juce_Rectangle.h" | |||
| #include "../../../../juce_core/containers/juce_SparseSet.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (disable: 4996) // deprecated sprintf warning | |||
| #endif | |||
| @@ -52,7 +52,7 @@ BEGIN_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| #if JUCE_DEBUG && WARN_ABOUT_NON_POSTSCRIPT_OPERATIONS | |||
| #if defined (JUCE_DEBUG) && WARN_ABOUT_NON_POSTSCRIPT_OPERATIONS | |||
| #define notPossibleInPostscriptAssert jassertfalse | |||
| #else | |||
| #define notPossibleInPostscriptAssert | |||
| @@ -218,7 +218,7 @@ void LowLevelGraphicsPostScriptRenderer::writeClip() | |||
| out << '\n'; | |||
| } | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| out << r.getX() << ' ' << -r.getY() << ' ' | |||
| << r.getWidth() << ' ' << -r.getHeight() << " pr "; | |||
| @@ -541,10 +541,10 @@ void LowLevelGraphicsPostScriptRenderer::writeImage (const Image& im, | |||
| pixel = Colours::transparentWhite; | |||
| } | |||
| char data [16]; | |||
| sprintf (data, "%x%x%x", pixel.getRed(), pixel.getGreen(), pixel.getBlue()); | |||
| char colourString [16]; | |||
| sprintf (colourString, "%x%x%x", pixel.getRed(), pixel.getGreen(), pixel.getBlue()); | |||
| out << (const char*) data; | |||
| out << (const char*) colourString; | |||
| charsOnLine += 3; | |||
| if (charsOnLine > 100) | |||
| @@ -591,7 +591,7 @@ void LowLevelGraphicsPostScriptRenderer::blendImageWarping (const Image& sourceI | |||
| itemsOnLine = 0; | |||
| } | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| out << r.getX() << ' ' << r.getY() << ' ' << r.getWidth() << ' ' << r.getHeight() << " pr "; | |||
| } | |||
| @@ -45,7 +45,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #define JUCE_USE_SSE_INSTRUCTIONS 1 | |||
| #endif | |||
| #if JUCE_DEBUG && JUCE_MSVC | |||
| #if defined (JUCE_DEBUG) && JUCE_MSVC | |||
| #pragma warning (disable: 4714) | |||
| #endif | |||
| @@ -158,9 +158,9 @@ static void blendRectRGB (uint8* pixels, const int w, int h, const int stride, c | |||
| #if defined (JUCE_USE_SSE_INSTRUCTIONS) && ! JUCE_64BIT | |||
| if (SystemStats::hasSSE()) | |||
| { | |||
| int64 rgb0 = ((int64) blendColour.getRed() << 32) | |||
| | (blendColour.getGreen() << 16) | |||
| | blendColour.getBlue(); | |||
| int64 rgb0 = (((int64) blendColour.getRed()) << 32) | |||
| | (int64) ((blendColour.getGreen() << 16) | |||
| | blendColour.getBlue()); | |||
| const int invAlpha = 0xff - alpha; | |||
| int64 aaaa = (invAlpha << 16) | invAlpha; | |||
| @@ -1122,7 +1122,7 @@ void LowLevelGraphicsSoftwareRenderer::fillRectWithColour (int x, int y, int w, | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| clippedFillRectWithColour (i.getRectangle(), x, y, w, h, colour, replaceExistingContents); | |||
| clippedFillRectWithColour (*i.getRectangle(), x, y, w, h, colour, replaceExistingContents); | |||
| } | |||
| } | |||
| @@ -1185,7 +1185,7 @@ void LowLevelGraphicsSoftwareRenderer::fillPathWithColour (const Path& path, con | |||
| { | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedFillPathWithColour (r.getX(), r.getY(), r.getWidth(), r.getHeight(), path, t, colour, quality); | |||
| } | |||
| @@ -1233,7 +1233,7 @@ void LowLevelGraphicsSoftwareRenderer::fillPathWithGradient (const Path& path, c | |||
| { | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedFillPathWithGradient (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| path, t, gradient, quality); | |||
| @@ -1339,7 +1339,7 @@ void LowLevelGraphicsSoftwareRenderer::fillPathWithImage (const Path& path, cons | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedFillPathWithImage (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| path, transform, sourceImage, imageX, imageY, opacity, quality); | |||
| @@ -1422,7 +1422,7 @@ void LowLevelGraphicsSoftwareRenderer::fillAlphaChannelWithColour (const Image& | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedFillAlphaChannelWithColour (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| clipImage, x, y, colour); | |||
| @@ -1464,7 +1464,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedFillAlphaChannelWithColour (int cl | |||
| const uint8* const alphaValues | |||
| = clipImage.lockPixelDataReadOnly (sx, sy, w, h, alphaStride, pixelStride); | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| const uint8* const alphas = alphaValues; | |||
| #else | |||
| const uint8* const alphas = alphaValues + (clipImage.getFormat() == Image::ARGB ? 3 : 0); | |||
| @@ -1501,7 +1501,7 @@ void LowLevelGraphicsSoftwareRenderer::fillAlphaChannelWithGradient (const Image | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedFillAlphaChannelWithGradient (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| alphaChannelImage, imageX, imageY, gradient); | |||
| @@ -1541,7 +1541,7 @@ void LowLevelGraphicsSoftwareRenderer::fillAlphaChannelWithImage (const Image& a | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedFillAlphaChannelWithImage (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| alphaImage, alphaImageX, alphaImageY, | |||
| @@ -1565,7 +1565,7 @@ void LowLevelGraphicsSoftwareRenderer::clippedFillAlphaChannelWithImage (int x, | |||
| const uint8* const alpha | |||
| = alphaImage.lockPixelDataReadOnly (x - alphaImageX, y - alphaImageY, w, h, maskStride, maskPixStride); | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| const uint8* const alphaValues = alpha; | |||
| #else | |||
| const uint8* const alphaValues = alpha + (alphaImage.getFormat() == Image::ARGB ? 3 : 0); | |||
| @@ -1622,7 +1622,7 @@ void LowLevelGraphicsSoftwareRenderer::blendImage (const Image& sourceImage, int | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedBlendImage (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| sourceImage, dx, dy, dw, dh, sx, sy, opacity); | |||
| @@ -1755,7 +1755,7 @@ void LowLevelGraphicsSoftwareRenderer::blendImageWarping (const Image& sourceIma | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedBlendImageWarping (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| sourceImage, srcClipX, srcClipY, srcClipW, srcClipH, | |||
| @@ -1878,7 +1878,7 @@ void LowLevelGraphicsSoftwareRenderer::drawLine (double x1, double y1, double x2 | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedDrawLine (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| x1, y1, x2, y2, colour); | |||
| @@ -1949,7 +1949,7 @@ void LowLevelGraphicsSoftwareRenderer::drawVerticalLine (const int x, double top | |||
| { | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedDrawVerticalLine (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| x + xOffset, top + yOffset, bottom + yOffset, col); | |||
| @@ -1982,7 +1982,7 @@ void LowLevelGraphicsSoftwareRenderer::drawHorizontalLine (const int y, double l | |||
| { | |||
| for (RectangleList::Iterator i (*clip); i.next();) | |||
| { | |||
| const Rectangle& r = i.getRectangle(); | |||
| const Rectangle& r = *i.getRectangle(); | |||
| clippedDrawHorizontalLine (r.getX(), r.getY(), r.getWidth(), r.getHeight(), | |||
| y + yOffset, left + xOffset, right + xOffset, col); | |||
| @@ -94,14 +94,16 @@ void DrawablePath::draw (Graphics& g, const AffineTransform& transform) const | |||
| const Colour oldColour (g.getCurrentColour()); // save this so we can restore it later | |||
| const float currentOpacity = oldColour.getFloatAlpha(); | |||
| Brush* const tempBrush = fillBrush->createCopy(); | |||
| tempBrush->applyTransform (transform); | |||
| tempBrush->multiplyOpacity (currentOpacity); | |||
| { | |||
| Brush* const tempBrush = fillBrush->createCopy(); | |||
| tempBrush->applyTransform (transform); | |||
| tempBrush->multiplyOpacity (currentOpacity); | |||
| g.setBrush (tempBrush); | |||
| g.fillPath (path, transform); | |||
| g.setBrush (tempBrush); | |||
| g.fillPath (path, transform); | |||
| delete tempBrush; | |||
| delete tempBrush; | |||
| } | |||
| if (strokeBrush != 0 && strokeType.getStrokeThickness() > 0.0f) | |||
| { | |||
| @@ -37,7 +37,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "../imaging/juce_Image.h" | |||
| #include "../colour/juce_PixelFormats.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma optimize ("t", on) // try to avoid slowing everything down in debug builds | |||
| #endif | |||
| @@ -1079,19 +1079,19 @@ void GlyphArrangement::justifyGlyphs (const int startIndex, | |||
| if (justification.testFlags (Justification::horizontallyJustified)) | |||
| { | |||
| int lineStart = 0; | |||
| float y = glyphs [startIndex].getBaselineY(); | |||
| float baseY = glyphs [startIndex].getBaselineY(); | |||
| int i; | |||
| for (i = 0; i < num; ++i) | |||
| { | |||
| const float glyphY = glyphs [startIndex + i].getBaselineY(); | |||
| if (glyphY != y) | |||
| if (glyphY != baseY) | |||
| { | |||
| spreadOutLine (startIndex + lineStart, i - lineStart, width); | |||
| lineStart = i; | |||
| y = glyphY; | |||
| baseY = glyphY; | |||
| } | |||
| } | |||
| @@ -36,7 +36,7 @@ BEGIN_JUCE_NAMESPACE | |||
| #include "juce_PathIterator.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma optimize ("t", on) | |||
| #endif | |||
| @@ -86,7 +86,8 @@ bool RectangleList::isEmpty() const throw() | |||
| //============================================================================== | |||
| RectangleList::Iterator::Iterator (const RectangleList& list) throw() | |||
| : owner (list), | |||
| : current (0), | |||
| owner (list), | |||
| index (list.rects.size()) | |||
| { | |||
| } | |||
| @@ -99,7 +100,7 @@ bool RectangleList::Iterator::next() throw() | |||
| { | |||
| if (--index >= 0) | |||
| { | |||
| current = owner.rects.getReference (index); | |||
| current = & (owner.rects.getReference (index)); | |||
| return true; | |||
| } | |||
| @@ -494,12 +495,12 @@ const Rectangle RectangleList::getBounds() const throw() | |||
| for (int i = rects.size(); --i > 0;) | |||
| { | |||
| const Rectangle& r = rects.getReference (i); | |||
| const Rectangle& r2 = rects.getReference (i); | |||
| minX = jmin (minX, r.x); | |||
| minY = jmin (minY, r.y); | |||
| maxX = jmax (maxX, r.getRight()); | |||
| maxY = jmax (maxY, r.getBottom()); | |||
| minX = jmin (minX, r2.x); | |||
| minY = jmin (minY, r2.y); | |||
| maxX = jmax (maxX, r2.getRight()); | |||
| maxY = jmax (maxY, r2.getBottom()); | |||
| } | |||
| return Rectangle (minX, minY, maxX - minX, maxY - minY); | |||
| @@ -234,14 +234,14 @@ public: | |||
| bool next() throw(); | |||
| /** Returns the current rectangle. */ | |||
| const Rectangle& getRectangle() const throw() { return current; } | |||
| const Rectangle* getRectangle() const throw() { return current; } | |||
| //============================================================================== | |||
| juce_UseDebuggingNewOperator | |||
| private: | |||
| Rectangle current; | |||
| const Rectangle* current; | |||
| const RectangleList& owner; | |||
| int index; | |||
| @@ -31,7 +31,7 @@ | |||
| #include "../../../../../juce_core/basics/juce_StandardHeader.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #endif | |||
| @@ -40,7 +40,7 @@ extern "C" | |||
| #include "jpglib/jpeglib.h" | |||
| } | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| @@ -147,8 +147,10 @@ public: | |||
| Image* decodeImage (InputStream& in) | |||
| { | |||
| GIFLoader loader (in); | |||
| return loader.getImage(); | |||
| GIFLoader* const loader = new GIFLoader (in); | |||
| Image* const im = loader->getImage(); | |||
| delete loader; | |||
| return im; | |||
| } | |||
| bool writeImageToStream (const Image& /*sourceImage*/, OutputStream& /*destStream*/) | |||
| @@ -44,7 +44,7 @@ | |||
| /** Swaps the byte-order in an integer from little to big-endianness or vice-versa. */ | |||
| forcedinline uint32 swapByteOrder (uint32 n) throw() | |||
| { | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| // Mac version | |||
| return CFSwapInt32 (n); | |||
| #elif JUCE_GCC | |||
| @@ -73,7 +73,7 @@ inline uint16 swapByteOrder (const uint16 n) throw() | |||
| inline uint64 swapByteOrder (const uint64 value) throw() | |||
| { | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| return CFSwapInt64 (value); | |||
| #else | |||
| return (((int64) swapByteOrder ((uint32) value)) << 32) | |||
| @@ -81,7 +81,7 @@ inline uint64 swapByteOrder (const uint64 value) throw() | |||
| #endif | |||
| } | |||
| #ifdef JUCE_LITTLE_ENDIAN | |||
| #if JUCE_LITTLE_ENDIAN | |||
| /** Swaps the byte order of a 16-bit int if the CPU is big-endian */ | |||
| inline uint16 swapIfBigEndian (const uint16 v) throw() { return v; } | |||
| /** Swaps the byte order of a 32-bit int if the CPU is big-endian */ | |||
| @@ -119,7 +119,7 @@ FileLogger* FileLogger::createDefaultAppLogger (const String& logFileSubDirector | |||
| const String& welcomeMessage, | |||
| const int maxInitialFileSizeBytes) | |||
| { | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| File logFile ("~/Library/Logs"); | |||
| logFile = logFile.getChildFile (logFileName); | |||
| @@ -263,7 +263,7 @@ const float float_Pi = 3.14159265358979323846f; | |||
| /** The isfinite() method seems to vary greatly between platforms, so this is a | |||
| platform-independent macro for it. | |||
| */ | |||
| #ifdef JUCE_LINUX | |||
| #if JUCE_LINUX | |||
| #define juce_isfinite(v) std::isfinite(v) | |||
| #elif JUCE_MAC | |||
| #if MACOS_10_2_OR_EARLIER | |||
| @@ -38,7 +38,7 @@ | |||
| preference to the standard calls. | |||
| */ | |||
| #if JUCE_DEBUG && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| #ifndef JUCE_DLL | |||
| //============================================================================== | |||
| // Win32 debug non-DLL versions.. | |||
| @@ -83,7 +83,7 @@ | |||
| #endif | |||
| //============================================================================== | |||
| #ifdef JUCE_MAC | |||
| #if JUCE_MAC | |||
| #include <CoreServices/CoreServices.h> | |||
| @@ -119,7 +119,7 @@ | |||
| #endif | |||
| //============================================================================== | |||
| #ifdef JUCE_LINUX | |||
| #if JUCE_LINUX | |||
| #ifdef _DEBUG | |||
| #define JUCE_DEBUG 1 | |||
| @@ -301,7 +301,7 @@ | |||
| forcedinline void myfunction (int x) | |||
| @endcode | |||
| */ | |||
| #if JUCE_DEBUG | |||
| #ifdef JUCE_DEBUG | |||
| #define forcedinline __forceinline | |||
| #else | |||
| #define forcedinline inline | |||
| @@ -117,7 +117,7 @@ void juce_Free (void* const block) | |||
| free (block); | |||
| } | |||
| #if JUCE_DEBUG && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| #if defined (JUCE_DEBUG) && JUCE_MSVC && JUCE_CHECK_MEMORY_LEAKS | |||
| void* juce_DebugMalloc (const int size, const char* file, const int line) | |||
| { | |||
| @@ -35,7 +35,7 @@ | |||
| #include "juce_ArrayAllocationBase.h" | |||
| #include "../threads/juce_CriticalSection.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (push) | |||
| #pragma warning (disable: 4512) | |||
| #endif | |||
| @@ -639,7 +639,7 @@ private: | |||
| } | |||
| }; | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #pragma warning (pop) | |||
| #endif | |||
| @@ -220,7 +220,7 @@ const File& File::operator= (const File& other) throw() | |||
| } | |||
| //============================================================================== | |||
| #ifdef JUCE_LINUX | |||
| #if JUCE_LINUX | |||
| #define NAMES_ARE_CASE_SENSITIVE 1 | |||
| #endif | |||
| @@ -56,7 +56,7 @@ int CharacterFunctions::length (const char* const s) throw() | |||
| int CharacterFunctions::length (const juce_wchar* const s) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| int n = 0; | |||
| while (s[n] != 0) | |||
| ++n; | |||
| @@ -74,7 +74,7 @@ void CharacterFunctions::copy (char* dest, const char* src, const int maxChars) | |||
| void CharacterFunctions::copy (juce_wchar* dest, const juce_wchar* src, int maxChars) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| while (--maxChars >= 0 && *src != 0) | |||
| *dest++ = *src++; | |||
| @@ -101,7 +101,7 @@ void CharacterFunctions::append (char* dest, const char* src) throw() | |||
| void CharacterFunctions::append (juce_wchar* dest, const juce_wchar* src) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| while (*dest != 0) | |||
| ++dest; | |||
| @@ -123,7 +123,7 @@ int CharacterFunctions::compare (const juce_wchar* s1, const juce_wchar* s2) thr | |||
| { | |||
| jassert (s1 != 0 && s2 != 0); | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| for (;;) | |||
| { | |||
| if (*s1 != *s2) | |||
| @@ -157,7 +157,7 @@ int CharacterFunctions::compare (const juce_wchar* s1, const juce_wchar* s2, int | |||
| { | |||
| jassert (s1 != 0 && s2 != 0); | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| while (--maxChars >= 0) | |||
| { | |||
| if (*s1 != *s2) | |||
| @@ -258,7 +258,7 @@ const char* CharacterFunctions::find (const char* const haystack, const char* co | |||
| const juce_wchar* CharacterFunctions::find (const juce_wchar* haystack, const juce_wchar* const needle) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| while (*haystack != 0) | |||
| { | |||
| const juce_wchar* s1 = haystack; | |||
| @@ -425,7 +425,7 @@ int CharacterFunctions::ftime (char* const dest, const int maxChars, const char* | |||
| int CharacterFunctions::ftime (juce_wchar* const dest, const int maxChars, const juce_wchar* const format, const struct tm* const tm) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| const String formatTemp (format); | |||
| size_t num = strftime ((char*) dest, maxChars, (const char*) formatTemp, tm); | |||
| String temp ((char*) dest); | |||
| @@ -472,7 +472,7 @@ int CharacterFunctions::getIntValue (const juce_wchar* s) throw() | |||
| int64 CharacterFunctions::getInt64Value (const char* s) throw() | |||
| { | |||
| #ifdef JUCE_LINUX | |||
| #if JUCE_LINUX | |||
| return atoll (s); | |||
| #elif defined (JUCE_WIN32) | |||
| return _atoi64 (s); | |||
| @@ -535,7 +535,7 @@ double CharacterFunctions::getDoubleValue (const char* const s) throw() | |||
| double CharacterFunctions::getDoubleValue (const juce_wchar* const s) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| String temp (s); | |||
| return atof ((const char*) temp); | |||
| #else | |||
| @@ -552,7 +552,7 @@ char CharacterFunctions::toUpperCase (const char character) throw() | |||
| juce_wchar CharacterFunctions::toUpperCase (const juce_wchar character) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| return toupper ((char) character); | |||
| #else | |||
| return towupper (character); | |||
| @@ -607,7 +607,7 @@ char CharacterFunctions::toLowerCase (const char character) throw() | |||
| juce_wchar CharacterFunctions::toLowerCase (const juce_wchar character) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| return tolower ((char) character); | |||
| #else | |||
| return towlower (character); | |||
| @@ -662,7 +662,7 @@ bool CharacterFunctions::isWhitespace (const char character) throw() | |||
| bool CharacterFunctions::isWhitespace (const juce_wchar character) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| return isWhitespace ((char) character); | |||
| #else | |||
| return iswspace (character) != 0; | |||
| @@ -687,7 +687,7 @@ bool CharacterFunctions::isLetter (const char character) throw() | |||
| bool CharacterFunctions::isLetter (const juce_wchar character) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| return isLetter ((char) character); | |||
| #else | |||
| return iswalpha (character) != 0; | |||
| @@ -703,7 +703,7 @@ bool CharacterFunctions::isLetterOrDigit (const char character) throw() | |||
| bool CharacterFunctions::isLetterOrDigit (const juce_wchar character) throw() | |||
| { | |||
| #ifdef MACOS_10_2_OR_EARLIER | |||
| #if MACOS_10_2_OR_EARLIER | |||
| return isLetterOrDigit ((char) character); | |||
| #else | |||
| return iswalnum (character) != 0; | |||
| @@ -748,7 +748,7 @@ int CharacterFunctions::vprintf (char* const dest, const int maxLength, const ch | |||
| int CharacterFunctions::vprintf (juce_wchar* const dest, const int maxLength, const juce_wchar* const format, va_list& args) throw() | |||
| { | |||
| #ifdef MACOS_10_3_OR_EARLIER | |||
| #if MACOS_10_3_OR_EARLIER | |||
| const String formatTemp (format); | |||
| size_t num = vprintf ((char*) dest, maxLength, formatTemp, args); | |||
| String temp ((char*) dest); | |||
| @@ -36,7 +36,7 @@ | |||
| #include "../basics/juce_StandardHeader.h" | |||
| #ifdef JUCE_MSVC | |||
| #if JUCE_MSVC | |||
| #include <float.h> | |||
| #endif | |||
| @@ -96,7 +96,7 @@ public: | |||
| private: | |||
| //============================================================================== | |||
| #if JUCE_WIN32 | |||
| #ifdef JUCE_64BIT | |||
| #if JUCE_64BIT | |||
| // To avoid including windows.h in the public Juce includes, we'll just allocate a | |||
| // block of memory here that's big enough to be used internally as a windows critical | |||
| // section object. | |||