| @@ -492,7 +492,7 @@ const String ProjectTreeViewBase::getTooltip() | |||||
| return String::empty; | return String::empty; | ||||
| } | } | ||||
| const String ProjectTreeViewBase::getDragSourceDescription() | |||||
| const var ProjectTreeViewBase::getDragSourceDescription() | |||||
| { | { | ||||
| delayedSelectionTimer = nullptr; | delayedSelectionTimer = nullptr; | ||||
| return projectItemDragType; | return projectItemDragType; | ||||
| @@ -86,7 +86,7 @@ public: | |||||
| void itemDoubleClicked (const MouseEvent& e); | void itemDoubleClicked (const MouseEvent& e); | ||||
| void itemSelectionChanged (bool isNowSelected); | void itemSelectionChanged (bool isNowSelected); | ||||
| const String getTooltip(); | const String getTooltip(); | ||||
| const String getDragSourceDescription(); | |||||
| const var getDragSourceDescription(); | |||||
| //============================================================================== | //============================================================================== | ||||
| // Drag-and-drop stuff.. | // Drag-and-drop stuff.. | ||||
| @@ -70,7 +70,7 @@ public: | |||||
| Justification::centredLeft, true); | Justification::centredLeft, true); | ||||
| } | } | ||||
| const String getDragSourceDescription (const SparseSet<int>& selectedRows) | |||||
| const var getDragSourceDescription (const SparseSet<int>& selectedRows) | |||||
| { | { | ||||
| // for our drag desctription, we'll just make a list of the selected | // for our drag desctription, we'll just make a list of the selected | ||||
| // row numbers - this will be picked up by the drag target and displayed in | // row numbers - this will be picked up by the drag target and displayed in | ||||
| @@ -159,7 +159,7 @@ public: | |||||
| void itemDropped (const SourceDetails& dragSourceDetails) | void itemDropped (const SourceDetails& dragSourceDetails) | ||||
| { | { | ||||
| message = "last rows dropped: " + dragSourceDetails.description; | |||||
| message = "last rows dropped: " + dragSourceDetails.description.toString(); | |||||
| somethingIsBeingDraggedOver = false; | somethingIsBeingDraggedOver = false; | ||||
| repaint(); | repaint(); | ||||
| @@ -98,7 +98,7 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| const String getDragSourceDescription() | |||||
| const var getDragSourceDescription() | |||||
| { | { | ||||
| return "TreeView Items"; | return "TreeView Items"; | ||||
| } | } | ||||
| @@ -93,15 +93,17 @@ public: | |||||
| { | { | ||||
| const Identifier memberId (getStringFromDISPID (dispIdMember)); | const Identifier memberId (getStringFromDISPID (dispIdMember)); | ||||
| if (memberId.toString().isEmpty() || v.getObject() == 0) | |||||
| DynamicObject* const object = v.getDynamicObject(); | |||||
| if (memberId.toString().isEmpty() || object == nullptr) | |||||
| return DISP_E_MEMBERNOTFOUND; | return DISP_E_MEMBERNOTFOUND; | ||||
| if ((wFlags & DISPATCH_METHOD) != 0) | if ((wFlags & DISPATCH_METHOD) != 0) | ||||
| { | { | ||||
| if (! v.getObject()->hasMethod (memberId)) | |||||
| if (! object->hasMethod (memberId)) | |||||
| return DISP_E_MEMBERNOTFOUND; | return DISP_E_MEMBERNOTFOUND; | ||||
| const int numArgs = pDispParams == 0 ? 0 : pDispParams->cArgs; | |||||
| const int numArgs = pDispParams == nullptr ? 0 : pDispParams->cArgs; | |||||
| var result; | var result; | ||||
| if (numArgs == 0) | if (numArgs == 0) | ||||
| @@ -117,27 +119,27 @@ public: | |||||
| result = v.invoke (memberId, numArgs == 0 ? 0 : args.getRawDataPointer(), numArgs); | result = v.invoke (memberId, numArgs == 0 ? 0 : args.getRawDataPointer(), numArgs); | ||||
| } | } | ||||
| if (pVarResult != 0) | |||||
| if (pVarResult != nullptr) | |||||
| juceVarToVariant (result, *pVarResult); | juceVarToVariant (result, *pVarResult); | ||||
| return S_OK; | return S_OK; | ||||
| } | } | ||||
| else if ((wFlags & DISPATCH_PROPERTYGET) != 0) | else if ((wFlags & DISPATCH_PROPERTYGET) != 0) | ||||
| { | { | ||||
| if (! v.getObject()->hasProperty (memberId)) | |||||
| if (! object->hasProperty (memberId)) | |||||
| return DISP_E_MEMBERNOTFOUND; | return DISP_E_MEMBERNOTFOUND; | ||||
| if (pVarResult != 0) | |||||
| if (pVarResult != nullptr) | |||||
| { | { | ||||
| juceVarToVariant (v.getObject()->getProperty (memberId), *pVarResult); | |||||
| juceVarToVariant (object->getProperty (memberId), *pVarResult); | |||||
| return S_OK; | return S_OK; | ||||
| } | } | ||||
| } | } | ||||
| else if ((wFlags & DISPATCH_PROPERTYPUT) != 0) | else if ((wFlags & DISPATCH_PROPERTYPUT) != 0) | ||||
| { | { | ||||
| if (pDispParams != 0 && pDispParams->cArgs > 0) | |||||
| if (pDispParams != nullptr && pDispParams->cArgs > 0) | |||||
| { | { | ||||
| v.getObject()->setProperty (memberId, variantTojuceVar (pDispParams->rgvarg[0])); | |||||
| object->setProperty (memberId, variantTojuceVar (pDispParams->rgvarg[0])); | |||||
| return S_OK; | return S_OK; | ||||
| } | } | ||||
| } | } | ||||
| @@ -376,7 +378,7 @@ void juceVarToVariant (const var& v, VARIANT& dest) | |||||
| dest.vt = VT_BSTR; | dest.vt = VT_BSTR; | ||||
| dest.bstrVal = SysAllocString (v.toString().toUTF16()); | dest.bstrVal = SysAllocString (v.toString().toUTF16()); | ||||
| } | } | ||||
| else if (v.isObject()) | |||||
| else if (v.getDynamicObject() != nullptr) | |||||
| { | { | ||||
| dest.vt = VT_DISPATCH; | dest.vt = VT_DISPATCH; | ||||
| dest.pdispVal = new IDispatchWrappingDynamicObject (v); | dest.pdispVal = new IDispatchWrappingDynamicObject (v); | ||||
| @@ -397,25 +399,25 @@ const var variantTojuceVar (const VARIANT& v) | |||||
| { | { | ||||
| switch (v.vt & ~VT_BYREF) | switch (v.vt & ~VT_BYREF) | ||||
| { | { | ||||
| case VT_VOID: | |||||
| case VT_EMPTY: return var::null; | |||||
| case VT_I1: return var ((int) v.cVal); | |||||
| case VT_I2: return var ((int) v.iVal); | |||||
| case VT_I4: return var ((int) v.lVal); | |||||
| case VT_I8: return var (String (v.llVal)); | |||||
| case VT_UI1: return var ((int) v.bVal); | |||||
| case VT_UI2: return var ((int) v.uiVal); | |||||
| case VT_UI4: return var ((int) v.ulVal); | |||||
| case VT_UI8: return var (String (v.ullVal)); | |||||
| case VT_INT: return var ((int) v.intVal); | |||||
| case VT_UINT: return var ((int) v.uintVal); | |||||
| case VT_R4: return var ((double) v.fltVal); | |||||
| case VT_R8: return var ((double) v.dblVal); | |||||
| case VT_BSTR: return var (String (v.bstrVal)); | |||||
| case VT_BOOL: return var (v.boolVal ? true : false); | |||||
| case VT_DISPATCH: return var (new DynamicObjectWrappingIDispatch (v.pdispVal)); | |||||
| default: | |||||
| break; | |||||
| case VT_VOID: | |||||
| case VT_EMPTY: return var::null; | |||||
| case VT_I1: return var ((int) v.cVal); | |||||
| case VT_I2: return var ((int) v.iVal); | |||||
| case VT_I4: return var ((int) v.lVal); | |||||
| case VT_I8: return var (String (v.llVal)); | |||||
| case VT_UI1: return var ((int) v.bVal); | |||||
| case VT_UI2: return var ((int) v.uiVal); | |||||
| case VT_UI4: return var ((int) v.ulVal); | |||||
| case VT_UI8: return var (String (v.ullVal)); | |||||
| case VT_INT: return var ((int) v.intVal); | |||||
| case VT_UINT: return var ((int) v.uintVal); | |||||
| case VT_R4: return var ((double) v.fltVal); | |||||
| case VT_R8: return var ((double) v.dblVal); | |||||
| case VT_BSTR: return var (String (v.bstrVal)); | |||||
| case VT_BOOL: return var (v.boolVal ? true : false); | |||||
| case VT_DISPATCH: return var (new DynamicObjectWrappingIDispatch (v.pdispVal)); | |||||
| default: | |||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| @@ -430,31 +432,31 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| AXBrowserPluginHolderComponent() | AXBrowserPluginHolderComponent() | ||||
| : parentHWND (0), | : parentHWND (0), | ||||
| browser (0) | |||||
| browser (nullptr) | |||||
| { | { | ||||
| setOpaque (true); | setOpaque (true); | ||||
| setWantsKeyboardFocus (false); | setWantsKeyboardFocus (false); | ||||
| addAndMakeVisible (child = createBrowserPlugin()); | addAndMakeVisible (child = createBrowserPlugin()); | ||||
| jassert (child != 0); // You have to create one of these! | |||||
| jassert (child != nullptr); // You have to create one of these! | |||||
| } | } | ||||
| ~AXBrowserPluginHolderComponent() | ~AXBrowserPluginHolderComponent() | ||||
| { | { | ||||
| setWindow (0); | |||||
| child = 0; | |||||
| setWindow (nullptr); | |||||
| child = nullptr; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void paint (Graphics& g) | void paint (Graphics& g) | ||||
| { | { | ||||
| if (child == 0 || ! child->isOpaque()) | |||||
| if (child == nullptr || ! child->isOpaque()) | |||||
| g.fillAll (Colours::white); | g.fillAll (Colours::white); | ||||
| } | } | ||||
| void resized() | void resized() | ||||
| { | { | ||||
| if (child != 0) | |||||
| if (child != nullptr) | |||||
| child->setBounds (0, 0, getWidth(), getHeight()); | child->setBounds (0, 0, getWidth(), getHeight()); | ||||
| } | } | ||||
| @@ -462,22 +464,22 @@ public: | |||||
| void setWindow (IOleInPlaceSite* site) | void setWindow (IOleInPlaceSite* site) | ||||
| { | { | ||||
| if (browser != 0) | |||||
| if (browser != nullptr) | |||||
| { | { | ||||
| browser->Release(); | browser->Release(); | ||||
| browser = 0; | |||||
| browser = nullptr; | |||||
| } | } | ||||
| HWND newHWND = 0; | HWND newHWND = 0; | ||||
| if (site != 0) | |||||
| if (site != nullptr) | |||||
| { | { | ||||
| site->GetWindow (&newHWND); | site->GetWindow (&newHWND); | ||||
| IServiceProvider* sp = 0; | |||||
| IServiceProvider* sp = nullptr; | |||||
| site->QueryInterface (IID_IServiceProvider, (void**) &sp); | site->QueryInterface (IID_IServiceProvider, (void**) &sp); | ||||
| if (sp != 0) | |||||
| if (sp != nullptr) | |||||
| { | { | ||||
| sp->QueryService (IID_IWebBrowserApp, IID_IWebBrowser2, (void**) &browser); | sp->QueryService (IID_IWebBrowserApp, IID_IWebBrowser2, (void**) &browser); | ||||
| sp->Release(); | sp->Release(); | ||||
| @@ -505,16 +507,16 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| if (site != 0) | |||||
| if (site != nullptr) | |||||
| site->OnInPlaceActivate(); | site->OnInPlaceActivate(); | ||||
| } | } | ||||
| const String getBrowserURL() const | const String getBrowserURL() const | ||||
| { | { | ||||
| if (browser == 0) | |||||
| if (browser == nullptr) | |||||
| return String::empty; | return String::empty; | ||||
| BSTR url = 0; | |||||
| BSTR url = nullptr; | |||||
| browser->get_LocationURL (&url); | browser->get_LocationURL (&url); | ||||
| return URL::removeEscapeChars (url); | return URL::removeEscapeChars (url); | ||||
| } | } | ||||
| @@ -531,8 +533,7 @@ extern String browserVersionDesc; | |||||
| static const String getExePath() | static const String getExePath() | ||||
| { | { | ||||
| TCHAR moduleFile [2048]; | |||||
| moduleFile[0] = 0; | |||||
| TCHAR moduleFile [2048] = { 0 }; | |||||
| GetModuleFileName (0, moduleFile, 2048); | GetModuleFileName (0, moduleFile, 2048); | ||||
| return moduleFile; | return moduleFile; | ||||
| } | } | ||||
| @@ -550,7 +551,7 @@ static const String getExeVersion (const String& exeFileName, const String& fiel | |||||
| if (GetFileVersionInfo (exeFileName.toUTF16(), 0, size, exeInfo)) | if (GetFileVersionInfo (exeFileName.toUTF16(), 0, size, exeInfo)) | ||||
| { | { | ||||
| TCHAR* result = 0; | |||||
| TCHAR* result = nullptr; | |||||
| unsigned int resultLen = 0; | unsigned int resultLen = 0; | ||||
| // try the 1200 codepage (Unicode) | // try the 1200 codepage (Unicode) | ||||
| @@ -580,7 +581,7 @@ class JuceActiveXObject : public IUnknown, | |||||
| { | { | ||||
| public: | public: | ||||
| JuceActiveXObject() | JuceActiveXObject() | ||||
| : site (0), refCount (0) | |||||
| : site (nullptr), refCount (0) | |||||
| { | { | ||||
| log ("JuceActiveXObject"); | log ("JuceActiveXObject"); | ||||
| } | } | ||||
| @@ -588,7 +589,7 @@ public: | |||||
| ~JuceActiveXObject() | ~JuceActiveXObject() | ||||
| { | { | ||||
| log ("~JuceActiveXObject"); | log ("~JuceActiveXObject"); | ||||
| holderComp = 0; | |||||
| holderComp = nullptr; | |||||
| } | } | ||||
| HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result) | HRESULT __stdcall QueryInterface (REFIID id, void __RPC_FAR* __RPC_FAR* result) | ||||
| @@ -620,7 +621,7 @@ public: | |||||
| DISPPARAMS* pDispParams, VARIANT* pVarResult, | DISPPARAMS* pDispParams, VARIANT* pVarResult, | ||||
| EXCEPINFO* pExcepInfo, UINT* puArgErr) | EXCEPINFO* pExcepInfo, UINT* puArgErr) | ||||
| { | { | ||||
| if (holderComp == 0) | |||||
| if (holderComp == nullptr) | |||||
| return DISP_E_MEMBERNOTFOUND; | return DISP_E_MEMBERNOTFOUND; | ||||
| return iDispatchHelper.doInvoke (holderComp->getObject(), | return iDispatchHelper.doInvoke (holderComp->getObject(), | ||||
| @@ -632,19 +633,19 @@ public: | |||||
| { | { | ||||
| if (newSite != site) | if (newSite != site) | ||||
| { | { | ||||
| if (site != 0) | |||||
| if (site != nullptr) | |||||
| site->Release(); | site->Release(); | ||||
| site = newSite; | site = newSite; | ||||
| if (site != 0) | |||||
| if (site != nullptr) | |||||
| { | { | ||||
| site->AddRef(); | site->AddRef(); | ||||
| IOleInPlaceSite* inPlaceSite = 0; | |||||
| IOleInPlaceSite* inPlaceSite = nullptr; | |||||
| site->QueryInterface (IID_IOleInPlaceSite, (void**) &inPlaceSite); | site->QueryInterface (IID_IOleInPlaceSite, (void**) &inPlaceSite); | ||||
| if (inPlaceSite != 0) | |||||
| if (inPlaceSite != nullptr) | |||||
| { | { | ||||
| createHolderComp(); | createHolderComp(); | ||||
| @@ -667,7 +668,7 @@ public: | |||||
| void createHolderComp() | void createHolderComp() | ||||
| { | { | ||||
| if (holderComp == 0) | |||||
| if (holderComp == nullptr) | |||||
| { | { | ||||
| if (numActivePlugins++ == 0) | if (numActivePlugins++ == 0) | ||||
| { | { | ||||
| @@ -683,9 +684,9 @@ public: | |||||
| void deleteHolderComp() | void deleteHolderComp() | ||||
| { | { | ||||
| if (holderComp != 0) | |||||
| if (holderComp != nullptr) | |||||
| { | { | ||||
| holderComp = 0; | |||||
| holderComp = nullptr; | |||||
| if (--numActivePlugins == 0) | if (--numActivePlugins == 0) | ||||
| { | { | ||||
| @@ -704,7 +705,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| HRESULT __stdcall SetObjectRects (LPCRECT r, LPCRECT c) | HRESULT __stdcall SetObjectRects (LPCRECT r, LPCRECT c) | ||||
| { | { | ||||
| if (holderComp != 0) | |||||
| if (holderComp != nullptr) | |||||
| holderComp->setBounds (r->left, r->top, r->right - r->left, r->bottom - r->top); | holderComp->setBounds (r->left, r->top, r->right - r->left, r->bottom - r->top); | ||||
| return S_OK; | return S_OK; | ||||
| @@ -712,7 +713,7 @@ public: | |||||
| HRESULT __stdcall GetWindow (HWND* phwnd) | HRESULT __stdcall GetWindow (HWND* phwnd) | ||||
| { | { | ||||
| if (holderComp == 0) | |||||
| if (holderComp == nullptr) | |||||
| return E_NOTIMPL; | return E_NOTIMPL; | ||||
| *phwnd = (HWND) holderComp->getWindowHandle(); | *phwnd = (HWND) holderComp->getWindowHandle(); | ||||
| @@ -766,9 +767,9 @@ public: | |||||
| HRESULT __stdcall CreateInstance (IUnknown* pUnkOuter, REFIID riid, void** ppvObject) | HRESULT __stdcall CreateInstance (IUnknown* pUnkOuter, REFIID riid, void** ppvObject) | ||||
| { | { | ||||
| *ppvObject = 0; | |||||
| *ppvObject = nullptr; | |||||
| if (pUnkOuter != 0 && riid != IID_IUnknown) | |||||
| if (pUnkOuter != nullptr && riid != IID_IUnknown) | |||||
| return CLASS_E_NOAGGREGATION; | return CLASS_E_NOAGGREGATION; | ||||
| JuceActiveXObject* ax = new JuceActiveXObject(); | JuceActiveXObject* ax = new JuceActiveXObject(); | ||||
| @@ -788,7 +789,7 @@ private: | |||||
| const String getActiveXBrowserURL (const BrowserPluginComponent* comp) | const String getActiveXBrowserURL (const BrowserPluginComponent* comp) | ||||
| { | { | ||||
| AXBrowserPluginHolderComponent* const ax = dynamic_cast <AXBrowserPluginHolderComponent*> (comp->getParentComponent()); | AXBrowserPluginHolderComponent* const ax = dynamic_cast <AXBrowserPluginHolderComponent*> (comp->getParentComponent()); | ||||
| return ax != 0 ? ax->getBrowserURL() : String::empty; | |||||
| return ax != nullptr ? ax->getBrowserURL() : String::empty; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -822,16 +823,16 @@ extern "C" BOOL WINAPI DllMain (HANDLE instance, DWORD reason, LPVOID) | |||||
| static const String CLSIDToJuceString (REFCLSID clsid) | static const String CLSIDToJuceString (REFCLSID clsid) | ||||
| { | { | ||||
| LPWSTR s = 0; | |||||
| LPWSTR s = nullptr; | |||||
| StringFromIID (clsid, &s); | StringFromIID (clsid, &s); | ||||
| if (s == 0) | |||||
| if (s == nullptr) | |||||
| return String::empty; | return String::empty; | ||||
| const String result (s); | const String result (s); | ||||
| LPMALLOC malloc; | LPMALLOC malloc; | ||||
| CoGetMalloc (1, &malloc); | CoGetMalloc (1, &malloc); | ||||
| if (malloc != 0) | |||||
| if (malloc != nullptr) | |||||
| { | { | ||||
| malloc->Free (s); | malloc->Free (s); | ||||
| malloc->Release(); | malloc->Release(); | ||||
| @@ -844,7 +845,7 @@ STDAPI DllGetClassObject (REFCLSID rclsid, REFIID riid, LPVOID* ppv) | |||||
| { | { | ||||
| #pragma EXPORTED_FUNCTION | #pragma EXPORTED_FUNCTION | ||||
| *ppv = 0; | |||||
| *ppv = nullptr; | |||||
| if (CLSIDToJuceString (rclsid).equalsIgnoreCase (String (JuceBrowserPlugin_ActiveXCLSID))) | if (CLSIDToJuceString (rclsid).equalsIgnoreCase (String (JuceBrowserPlugin_ActiveXCLSID))) | ||||
| { | { | ||||
| @@ -121,9 +121,9 @@ NPError NP_GetValue (void* future, NPPVariable variable, void* value) | |||||
| #if JUCE_WINDOWS || JUCE_MAC | #if JUCE_WINDOWS || JUCE_MAC | ||||
| NPError OSCALL NP_GetEntryPoints (NPPluginFuncs* funcs) | NPError OSCALL NP_GetEntryPoints (NPPluginFuncs* funcs) | ||||
| { | { | ||||
| #if JUCE_WINDOWS | |||||
| #if JUCE_WINDOWS | |||||
| #pragma EXPORTED_FUNCTION | #pragma EXPORTED_FUNCTION | ||||
| #endif | |||||
| #endif | |||||
| log ("NP_GetEntryPoints"); | log ("NP_GetEntryPoints"); | ||||
| if (funcs == 0 || (funcs->size > 0 && funcs->size < sizeof (NPPluginFuncs))) | if (funcs == 0 || (funcs->size > 0 && funcs->size < sizeof (NPPluginFuncs))) | ||||
| @@ -138,17 +138,17 @@ NPError OSCALL NP_GetEntryPoints (NPPluginFuncs* funcs) | |||||
| funcs->destroystream = NPP_DestroyStream; | funcs->destroystream = NPP_DestroyStream; | ||||
| funcs->asfile = NPP_StreamAsFile; | funcs->asfile = NPP_StreamAsFile; | ||||
| funcs->writeready = NPP_WriteReady; | funcs->writeready = NPP_WriteReady; | ||||
| #if JUCE_MAC | |||||
| #if JUCE_MAC | |||||
| funcs->write = (NPP_WriteProcPtr) NPP_Write; | funcs->write = (NPP_WriteProcPtr) NPP_Write; | ||||
| #else | |||||
| #else | |||||
| funcs->write = NPP_Write; | funcs->write = NPP_Write; | ||||
| #endif | |||||
| #endif | |||||
| funcs->print = NPP_Print; | funcs->print = NPP_Print; | ||||
| funcs->event = NPP_HandleEvent; | funcs->event = NPP_HandleEvent; | ||||
| funcs->urlnotify = NPP_URLNotify; | funcs->urlnotify = NPP_URLNotify; | ||||
| funcs->getvalue = NPP_GetValue; | funcs->getvalue = NPP_GetValue; | ||||
| funcs->setvalue = NPP_SetValue; | funcs->setvalue = NPP_SetValue; | ||||
| funcs->javaClass = 0; | |||||
| funcs->javaClass = nullptr; | |||||
| return NPERR_NO_ERROR; | return NPERR_NO_ERROR; | ||||
| } | } | ||||
| @@ -160,9 +160,9 @@ NPError OSCALL NP_Initialize (NPNetscapeFuncs* funcs | |||||
| #endif | #endif | ||||
| ) | ) | ||||
| { | { | ||||
| #if JUCE_WINDOWS | |||||
| #if JUCE_WINDOWS | |||||
| #pragma EXPORTED_FUNCTION | #pragma EXPORTED_FUNCTION | ||||
| #endif | |||||
| #endif | |||||
| log ("NP_Initialize"); | log ("NP_Initialize"); | ||||
| if (funcs == 0) | if (funcs == 0) | ||||
| @@ -174,7 +174,7 @@ NPError OSCALL NP_Initialize (NPNetscapeFuncs* funcs | |||||
| zerostruct (browser); | zerostruct (browser); | ||||
| memcpy (&browser, funcs, jmin ((size_t) funcs->size, sizeof (browser))); | memcpy (&browser, funcs, jmin ((size_t) funcs->size, sizeof (browser))); | ||||
| #ifdef XP_UNIX | |||||
| #ifdef XP_UNIX | |||||
| pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; | pluginFuncs->version = (NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR; | ||||
| pluginFuncs->size = sizeof (NPPluginFuncs); | pluginFuncs->size = sizeof (NPPluginFuncs); | ||||
| pluginFuncs->newp = NewNPP_NewProc (NPP_New); | pluginFuncs->newp = NewNPP_NewProc (NPP_New); | ||||
| @@ -192,16 +192,16 @@ NPError OSCALL NP_Initialize (NPNetscapeFuncs* funcs | |||||
| #ifdef OJI | #ifdef OJI | ||||
| pluginFuncs->javaClass = NPP_GetJavaClass(); | pluginFuncs->javaClass = NPP_GetJavaClass(); | ||||
| #endif | #endif | ||||
| #endif | |||||
| #endif | |||||
| return NPERR_NO_ERROR; | return NPERR_NO_ERROR; | ||||
| } | } | ||||
| NPError OSCALL NP_Shutdown() | NPError OSCALL NP_Shutdown() | ||||
| { | { | ||||
| #if JUCE_WINDOWS | |||||
| #if JUCE_WINDOWS | |||||
| #pragma EXPORTED_FUNCTION | #pragma EXPORTED_FUNCTION | ||||
| #endif | |||||
| #endif | |||||
| log ("NP_Shutdown"); | log ("NP_Shutdown"); | ||||
| return NPERR_NO_ERROR; | return NPERR_NO_ERROR; | ||||
| @@ -266,36 +266,37 @@ public: | |||||
| : npp (npp_) | : npp (npp_) | ||||
| { | { | ||||
| log ("BrowserPluginHolderComponent created"); | log ("BrowserPluginHolderComponent created"); | ||||
| #if JUCE_WINDOWS | |||||
| #if JUCE_WINDOWS | |||||
| parentHWND = 0; | parentHWND = 0; | ||||
| oldWinProc = 0; | oldWinProc = 0; | ||||
| #else | |||||
| #else | |||||
| currentParentView = 0; | currentParentView = 0; | ||||
| #endif | |||||
| #endif | |||||
| setOpaque (true); | setOpaque (true); | ||||
| setWantsKeyboardFocus (false); | setWantsKeyboardFocus (false); | ||||
| addAndMakeVisible (child = createBrowserPlugin()); | addAndMakeVisible (child = createBrowserPlugin()); | ||||
| jassert (child != 0); // You have to create one of these! | |||||
| jassert (child != nullptr); // You have to create one of these! | |||||
| } | } | ||||
| ~BrowserPluginHolderComponent() | ~BrowserPluginHolderComponent() | ||||
| { | { | ||||
| log ("BrowserPluginHolderComponent deleted"); | log ("BrowserPluginHolderComponent deleted"); | ||||
| setWindow (0); | |||||
| child = 0; | |||||
| setWindow (nullptr); | |||||
| child = nullptr; | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void paint (Graphics& g) | void paint (Graphics& g) | ||||
| { | { | ||||
| if (child == 0 || ! child->isOpaque()) | |||||
| if (child == nullptr || ! child->isOpaque()) | |||||
| g.fillAll (Colours::white); | g.fillAll (Colours::white); | ||||
| } | } | ||||
| void resized() | void resized() | ||||
| { | { | ||||
| if (child != 0) | |||||
| if (child != nullptr) | |||||
| child->setBounds (getLocalBounds()); | child->setBounds (getLocalBounds()); | ||||
| } | } | ||||
| @@ -370,7 +371,7 @@ private: | |||||
| public: | public: | ||||
| void setWindow (NPWindow* window) | void setWindow (NPWindow* window) | ||||
| { | { | ||||
| HWND newHWND = (window != 0 ? ((HWND) window->window) : 0); | |||||
| HWND newHWND = (window != nullptr ? ((HWND) window->window) : 0); | |||||
| if (parentHWND != newHWND) | if (parentHWND != newHWND) | ||||
| { | { | ||||
| @@ -428,7 +429,7 @@ public: | |||||
| { | { | ||||
| NSView* found = findViewAt (v, x, y); | NSView* found = findViewAt (v, x, y); | ||||
| if (found != 0) | |||||
| if (found != nil) | |||||
| return found; | return found; | ||||
| } | } | ||||
| } | } | ||||
| @@ -437,7 +438,7 @@ public: | |||||
| return parent; | return parent; | ||||
| } | } | ||||
| return 0; | |||||
| return nil; | |||||
| } | } | ||||
| public: | public: | ||||
| @@ -454,22 +455,22 @@ public: | |||||
| log ("setWindow"); | log ("setWindow"); | ||||
| NSView* parentView = 0; | |||||
| NP_CGContext* const cgContext = (window != 0) ? (NP_CGContext*) window->window : 0; | |||||
| NSView* parentView = nil; | |||||
| NP_CGContext* const cgContext = (window != nullptr) ? (NP_CGContext*) window->window : nullptr; | |||||
| log ("NP_CGContext: " + String::toHexString ((pointer_sized_int) cgContext)); | log ("NP_CGContext: " + String::toHexString ((pointer_sized_int) cgContext)); | ||||
| #ifndef __LP64__ | |||||
| WindowRef windowRef = cgContext != 0 ? (WindowRef) cgContext->window : 0; | |||||
| #ifndef __LP64__ | |||||
| WindowRef windowRef = cgContext != nullptr ? (WindowRef) cgContext->window : 0; | |||||
| if (windowRef != 0) | if (windowRef != 0) | ||||
| { | { | ||||
| NSWindow* win = [[[NSWindow alloc] initWithWindowRef: windowRef] autorelease]; | NSWindow* win = [[[NSWindow alloc] initWithWindowRef: windowRef] autorelease]; | ||||
| #else | |||||
| NSWindow* win = cgContext != 0 ? (NSWindow*) cgContext->window : 0; | |||||
| #else | |||||
| NSWindow* win = cgContext != nullptr ? (NSWindow*) cgContext->window : nil; | |||||
| if (win != 0) | |||||
| if (win != nil) | |||||
| { | { | ||||
| #endif | |||||
| #endif | |||||
| log ("window: " + nsStringToJuce ([win description])); | log ("window: " + nsStringToJuce ([win description])); | ||||
| const Rectangle<int> clip (window->clipRect.left, window->clipRect.top, | const Rectangle<int> clip (window->clipRect.left, window->clipRect.top, | ||||
| @@ -505,7 +506,7 @@ public: | |||||
| if (! isBrowserContentView (parentView)) | if (! isBrowserContentView (parentView)) | ||||
| parentView = currentParentView; | parentView = currentParentView; | ||||
| } | } | ||||
| else if (currentParentView != 0 && ! target.isEmpty()) | |||||
| else if (currentParentView != nil && ! target.isEmpty()) | |||||
| { | { | ||||
| // Firefox can send lots of spurious resize messages when updating its pages, so this is a | // Firefox can send lots of spurious resize messages when updating its pages, so this is a | ||||
| // bodge to avoid flickering caused by repeatedly removing and re-adding the view.. | // bodge to avoid flickering caused by repeatedly removing and re-adding the view.. | ||||
| @@ -524,7 +525,7 @@ public: | |||||
| currentParentView = parentView; | currentParentView = parentView; | ||||
| if (parentView != 0) | |||||
| if (parentView != nil) | |||||
| { | { | ||||
| setSize (window->width, window->height); | setSize (window->width, window->height); | ||||
| addToDesktop (0, parentView); | addToDesktop (0, parentView); | ||||
| @@ -532,7 +533,7 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| if (window != 0) | |||||
| if (window != nullptr) | |||||
| setSize (window->width, window->height); | setSize (window->width, window->height); | ||||
| } | } | ||||
| #endif | #endif | ||||
| @@ -673,16 +674,16 @@ private: | |||||
| bool hasMethod (NPIdentifier name) | bool hasMethod (NPIdentifier name) | ||||
| { | { | ||||
| DynamicObject* const o = object.getObject(); | |||||
| return o != 0 && o->hasMethod (identifierToString (name)); | |||||
| DynamicObject* const o = object.getDynamicObject(); | |||||
| return o != nullptr && o->hasMethod (identifierToString (name)); | |||||
| } | } | ||||
| bool invoke (NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* out) | bool invoke (NPIdentifier name, const NPVariant* args, uint32_t argCount, NPVariant* out) | ||||
| { | { | ||||
| DynamicObject* const o = object.getObject(); | |||||
| DynamicObject* const o = object.getDynamicObject(); | |||||
| const var::identifier methodName (identifierToString (name)); | const var::identifier methodName (identifierToString (name)); | ||||
| if (o == 0 || ! o->hasMethod (methodName)) | |||||
| if (o == nullptr || ! o->hasMethod (methodName)) | |||||
| return false; | return false; | ||||
| struct ParamHolder | struct ParamHolder | ||||
| @@ -700,7 +701,7 @@ private: | |||||
| const var result (o->invokeMethod (methodName, params.params, argCount)); | const var result (o->invokeMethod (methodName, params.params, argCount)); | ||||
| if (out != 0) | |||||
| if (out != nullptr) | |||||
| createNPVariantFromValue (npp, *out, result); | createNPVariantFromValue (npp, *out, result); | ||||
| return true; | return true; | ||||
| @@ -713,21 +714,21 @@ private: | |||||
| bool hasProperty (NPIdentifier name) | bool hasProperty (NPIdentifier name) | ||||
| { | { | ||||
| DynamicObject* const o = object.getObject(); | |||||
| return o != 0 && o->hasProperty (identifierToString (name)); | |||||
| DynamicObject* const o = object.getDynamicObject(); | |||||
| return o != nullptr && o->hasProperty (identifierToString (name)); | |||||
| } | } | ||||
| bool getProperty (NPIdentifier name, NPVariant* out) | bool getProperty (NPIdentifier name, NPVariant* out) | ||||
| { | { | ||||
| DynamicObject* const o = object.getObject(); | |||||
| DynamicObject* const o = object.getDynamicObject(); | |||||
| const var::identifier propName (identifierToString (name)); | const var::identifier propName (identifierToString (name)); | ||||
| if (o == 0 || ! o->hasProperty (propName)) | |||||
| if (o == nullptr || ! o->hasProperty (propName)) | |||||
| return false; | return false; | ||||
| const var result (o->getProperty (propName)); | const var result (o->getProperty (propName)); | ||||
| if (out != 0) | |||||
| if (out != nullptr) | |||||
| createNPVariantFromValue (npp, *out, result); | createNPVariantFromValue (npp, *out, result); | ||||
| return true; | return true; | ||||
| @@ -735,9 +736,9 @@ private: | |||||
| bool setProperty (NPIdentifier name, const NPVariant* value) | bool setProperty (NPIdentifier name, const NPVariant* value) | ||||
| { | { | ||||
| DynamicObject* const o = object.getObject(); | |||||
| DynamicObject* const o = object.getDynamicObject(); | |||||
| if (value == 0 || o == 0) | |||||
| if (value == nullptr || o == nullptr) | |||||
| return false; | return false; | ||||
| o->setProperty (identifierToString (name), createValueFromNPVariant (npp, *value)); | o->setProperty (identifierToString (name), createValueFromNPVariant (npp, *value)); | ||||
| @@ -746,10 +747,10 @@ private: | |||||
| bool removeProperty (NPIdentifier name) | bool removeProperty (NPIdentifier name) | ||||
| { | { | ||||
| DynamicObject* const o = object.getObject(); | |||||
| DynamicObject* const o = object.getDynamicObject(); | |||||
| const var::identifier propName (identifierToString (name)); | const var::identifier propName (identifierToString (name)); | ||||
| if (o == 0 || ! o->hasProperty (propName)) | |||||
| if (o == nullptr || ! o->hasProperty (propName)) | |||||
| return false; | return false; | ||||
| o->removeProperty (propName); | o->removeProperty (propName); | ||||
| @@ -789,33 +790,30 @@ public: | |||||
| static bool class_construct (NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) { return ((NPObjectWrappingDynamicObject*) npobj)->construct (args, argCount, result); } | static bool class_construct (NPObject* npobj, const NPVariant* args, uint32_t argCount, NPVariant* result) { return ((NPObjectWrappingDynamicObject*) npobj)->construct (args, argCount, result); } | ||||
| }; | }; | ||||
| #ifndef NP_CLASS_STRUCT_VERSION_ENUM | |||||
| static NPClass sNPObjectWrappingDynamicObject_NPClass = | static NPClass sNPObjectWrappingDynamicObject_NPClass = | ||||
| { | { | ||||
| #ifndef NP_CLASS_STRUCT_VERSION_ENUM | |||||
| NP_CLASS_STRUCT_VERSION, NPObjectWrappingDynamicObject::createInstance, | NP_CLASS_STRUCT_VERSION, NPObjectWrappingDynamicObject::createInstance, | ||||
| NPObjectWrappingDynamicObject::class_deallocate, NPObjectWrappingDynamicObject::class_invalidate, | NPObjectWrappingDynamicObject::class_deallocate, NPObjectWrappingDynamicObject::class_invalidate, | ||||
| NPObjectWrappingDynamicObject::class_hasMethod, NPObjectWrappingDynamicObject::class_invoke, | NPObjectWrappingDynamicObject::class_hasMethod, NPObjectWrappingDynamicObject::class_invoke, | ||||
| NPObjectWrappingDynamicObject::class_invokeDefault, NPObjectWrappingDynamicObject::class_hasProperty, | NPObjectWrappingDynamicObject::class_invokeDefault, NPObjectWrappingDynamicObject::class_hasProperty, | ||||
| NPObjectWrappingDynamicObject::class_getProperty, NPObjectWrappingDynamicObject::class_setProperty, | NPObjectWrappingDynamicObject::class_getProperty, NPObjectWrappingDynamicObject::class_setProperty, | ||||
| NPObjectWrappingDynamicObject::class_removeProperty | NPObjectWrappingDynamicObject::class_removeProperty | ||||
| }; | |||||
| #else | |||||
| static NPClass sNPObjectWrappingDynamicObject_NPClass = | |||||
| { | |||||
| #else | |||||
| NP_CLASS_STRUCT_VERSION_ENUM, NPObjectWrappingDynamicObject::createInstance, | NP_CLASS_STRUCT_VERSION_ENUM, NPObjectWrappingDynamicObject::createInstance, | ||||
| NPObjectWrappingDynamicObject::class_deallocate, NPObjectWrappingDynamicObject::class_invalidate, | NPObjectWrappingDynamicObject::class_deallocate, NPObjectWrappingDynamicObject::class_invalidate, | ||||
| NPObjectWrappingDynamicObject::class_hasMethod, NPObjectWrappingDynamicObject::class_invoke, | NPObjectWrappingDynamicObject::class_hasMethod, NPObjectWrappingDynamicObject::class_invoke, | ||||
| NPObjectWrappingDynamicObject::class_invokeDefault, NPObjectWrappingDynamicObject::class_hasProperty, | NPObjectWrappingDynamicObject::class_invokeDefault, NPObjectWrappingDynamicObject::class_hasProperty, | ||||
| NPObjectWrappingDynamicObject::class_getProperty, NPObjectWrappingDynamicObject::class_setProperty, | NPObjectWrappingDynamicObject::class_getProperty, NPObjectWrappingDynamicObject::class_setProperty, | ||||
| NPObjectWrappingDynamicObject::class_removeProperty, NPObjectWrappingDynamicObject::class_enumerate | NPObjectWrappingDynamicObject::class_removeProperty, NPObjectWrappingDynamicObject::class_enumerate | ||||
| #endif | |||||
| }; | }; | ||||
| #endif | |||||
| bool NPObjectWrappingDynamicObject::construct (const NPVariant* args, uint32_t argCount, NPVariant* result) | bool NPObjectWrappingDynamicObject::construct (const NPVariant* args, uint32_t argCount, NPVariant* result) | ||||
| { | { | ||||
| NPObject* const newObj = browser.createobject (npp, &sNPObjectWrappingDynamicObject_NPClass); | NPObject* const newObj = browser.createobject (npp, &sNPObjectWrappingDynamicObject_NPClass); | ||||
| if (newObj == 0) | |||||
| if (newObj == nullptr) | |||||
| return false; | return false; | ||||
| OBJECT_TO_NPVARIANT (newObj, *result); | OBJECT_TO_NPVARIANT (newObj, *result); | ||||
| @@ -824,11 +822,11 @@ bool NPObjectWrappingDynamicObject::construct (const NPVariant* args, uint32_t a | |||||
| NPObject* NPObjectWrappingDynamicObject::create (NPP npp, const var& objectToWrap) | NPObject* NPObjectWrappingDynamicObject::create (NPP npp, const var& objectToWrap) | ||||
| { | { | ||||
| jassert (objectToWrap.getObject() != 0); | |||||
| jassert (objectToWrap.getDynamicObject() != nullptr); | |||||
| NPObject* const nppObject = browser.createobject (npp, &sNPObjectWrappingDynamicObject_NPClass); | NPObject* const nppObject = browser.createobject (npp, &sNPObjectWrappingDynamicObject_NPClass); | ||||
| if (nppObject != 0) | |||||
| if (nppObject != nullptr) | |||||
| ((NPObjectWrappingDynamicObject*) nppObject)->object = objectToWrap; | ((NPObjectWrappingDynamicObject*) nppObject)->object = objectToWrap; | ||||
| return nppObject; | return nppObject; | ||||
| @@ -845,17 +843,18 @@ static const var createValueFromNPVariant (NPP npp, const NPVariant& v) | |||||
| else if (NPVARIANT_IS_DOUBLE (v)) | else if (NPVARIANT_IS_DOUBLE (v)) | ||||
| return var (NPVARIANT_TO_DOUBLE (v)); | return var (NPVARIANT_TO_DOUBLE (v)); | ||||
| else if (NPVARIANT_IS_STRING (v)) | else if (NPVARIANT_IS_STRING (v)) | ||||
| #if JUCE_MAC | |||||
| return var (String::fromUTF8 ((const char*) (NPVARIANT_TO_STRING (v).UTF8Characters), | |||||
| (int) NPVARIANT_TO_STRING (v).UTF8Length)); | |||||
| #else | |||||
| return var (String::fromUTF8 ((const char*) (NPVARIANT_TO_STRING (v).utf8characters), | |||||
| (int) NPVARIANT_TO_STRING (v).utf8length)); | |||||
| #endif | |||||
| else if (NPVARIANT_IS_OBJECT (v) && npp != 0) | |||||
| { | |||||
| return var (String::fromUTF8 ((const char*) | |||||
| #if JUCE_MAC | |||||
| (NPVARIANT_TO_STRING (v).UTF8Characters), (int) NPVARIANT_TO_STRING (v).UTF8Length)); | |||||
| #else | |||||
| (NPVARIANT_TO_STRING (v).utf8characters), (int) NPVARIANT_TO_STRING (v).utf8length)); | |||||
| #endif | |||||
| } | |||||
| else if (NPVARIANT_IS_OBJECT (v) && npp != nullptr) | |||||
| return var (new DynamicObjectWrappingNPObject (npp, NPVARIANT_TO_OBJECT (v))); | return var (new DynamicObjectWrappingNPObject (npp, NPVARIANT_TO_OBJECT (v))); | ||||
| return var(); | |||||
| return var::null; | |||||
| } | } | ||||
| static void createNPVariantFromValue (NPP npp, NPVariant& out, const var& v) | static void createNPVariantFromValue (NPP npp, NPVariant& out, const var& v) | ||||
| @@ -875,7 +874,7 @@ static void createNPVariantFromValue (NPP npp, NPVariant& out, const var& v) | |||||
| memcpy (stringCopy, utf8, utf8Len); | memcpy (stringCopy, utf8, utf8Len); | ||||
| STRINGZ_TO_NPVARIANT (stringCopy, out); | STRINGZ_TO_NPVARIANT (stringCopy, out); | ||||
| } | } | ||||
| else if (v.isObject() && npp != 0) | |||||
| else if (v.getDynamicObject() != nullptr && npp != nullptr) | |||||
| OBJECT_TO_NPVARIANT (NPObjectWrappingDynamicObject::create (npp, v), out); | OBJECT_TO_NPVARIANT (NPObjectWrappingDynamicObject::create (npp, v), out); | ||||
| else | else | ||||
| VOID_TO_NPVARIANT (out); | VOID_TO_NPVARIANT (out); | ||||
| @@ -888,21 +887,21 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| JucePluginInstance (NPP npp_) | JucePluginInstance (NPP npp_) | ||||
| : npp (npp_), | : npp (npp_), | ||||
| holderComp (0), | |||||
| scriptObject (0) | |||||
| holderComp (nullptr), | |||||
| scriptObject (nullptr) | |||||
| { | { | ||||
| } | } | ||||
| ~JucePluginInstance() | ~JucePluginInstance() | ||||
| { | { | ||||
| setWindow (0); | |||||
| setWindow (nullptr); | |||||
| } | } | ||||
| bool setWindow (NPWindow* window) | bool setWindow (NPWindow* window) | ||||
| { | { | ||||
| if (window != 0) | |||||
| if (window != nullptr) | |||||
| { | { | ||||
| if (holderComp == 0) | |||||
| if (holderComp == nullptr) | |||||
| holderComp = new BrowserPluginHolderComponent (npp); | holderComp = new BrowserPluginHolderComponent (npp); | ||||
| holderComp->setWindow (window); | holderComp->setWindow (window); | ||||
| @@ -910,7 +909,7 @@ public: | |||||
| else | else | ||||
| { | { | ||||
| deleteAndZero (holderComp); | deleteAndZero (holderComp); | ||||
| scriptObject = 0; | |||||
| scriptObject = nullptr; | |||||
| } | } | ||||
| return true; | return true; | ||||
| @@ -918,10 +917,10 @@ public: | |||||
| NPObject* getScriptableObject() | NPObject* getScriptableObject() | ||||
| { | { | ||||
| if (scriptObject == 0) | |||||
| if (scriptObject == nullptr) | |||||
| scriptObject = NPObjectWrappingDynamicObject::create (npp, holderComp->getObject()); | scriptObject = NPObjectWrappingDynamicObject::create (npp, holderComp->getObject()); | ||||
| if (scriptObject != 0 && shouldRetainBrowserObject()) | |||||
| if (scriptObject != nullptr && shouldRetainBrowserObject()) | |||||
| browser.retainobject (scriptObject); | browser.retainobject (scriptObject); | ||||
| return scriptObject; | return scriptObject; | ||||
| @@ -947,24 +946,24 @@ private: | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| static NPP currentlyInitialisingNPP = 0; | |||||
| static NPP currentlyInitialisingNPP = nullptr; | |||||
| static int numPluginInstances = 0; | static int numPluginInstances = 0; | ||||
| NPError NPP_New (NPMIMEType pluginType, NPP npp, ::uint16 mode, ::int16 argc, char* argn[], char* argv[], NPSavedData* saved) | NPError NPP_New (NPMIMEType pluginType, NPP npp, ::uint16 mode, ::int16 argc, char* argn[], char* argv[], NPSavedData* saved) | ||||
| { | { | ||||
| log ("NPP_New"); | log ("NPP_New"); | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| #if JUCE_MAC | |||||
| #if JUCE_MAC | |||||
| browser.setvalue (npp, (NPPVariable) NPNVpluginDrawingModel, (void*) NPDrawingModelCoreGraphics); | browser.setvalue (npp, (NPPVariable) NPNVpluginDrawingModel, (void*) NPDrawingModelCoreGraphics); | ||||
| #ifdef __LP64__ | |||||
| #ifdef __LP64__ | |||||
| browser.setvalue (npp, (NPPVariable) 1001 /*NPPVpluginEventModel*/, (void*) 1 /*NPEventModelCocoa*/); | browser.setvalue (npp, (NPPVariable) 1001 /*NPPVpluginEventModel*/, (void*) 1 /*NPEventModelCocoa*/); | ||||
| #else | |||||
| #else | |||||
| browser.setvalue (npp, (NPPVariable) 1001 /*NPPVpluginEventModel*/, 0 /*NPEventModelCarbon*/); | browser.setvalue (npp, (NPPVariable) 1001 /*NPPVpluginEventModel*/, 0 /*NPEventModelCarbon*/); | ||||
| #endif | |||||
| #endif | |||||
| #endif | |||||
| #endif | |||||
| if (numPluginInstances++ == 0) | if (numPluginInstances++ == 0) | ||||
| { | { | ||||
| @@ -974,7 +973,7 @@ NPError NPP_New (NPMIMEType pluginType, NPP npp, ::uint16 mode, ::int16 argc, ch | |||||
| currentlyInitialisingNPP = npp; | currentlyInitialisingNPP = npp; | ||||
| JucePluginInstance* p = new JucePluginInstance (npp); | JucePluginInstance* p = new JucePluginInstance (npp); | ||||
| currentlyInitialisingNPP = 0; | |||||
| currentlyInitialisingNPP = nullptr; | |||||
| npp->pdata = (void*) p; | npp->pdata = (void*) p; | ||||
| return NPERR_NO_ERROR; | return NPERR_NO_ERROR; | ||||
| @@ -983,12 +982,12 @@ NPError NPP_New (NPMIMEType pluginType, NPP npp, ::uint16 mode, ::int16 argc, ch | |||||
| NPError NPP_Destroy (NPP npp, NPSavedData** save) | NPError NPP_Destroy (NPP npp, NPSavedData** save) | ||||
| { | { | ||||
| log ("NPP_Destroy"); | log ("NPP_Destroy"); | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | ||||
| if (p != 0) | |||||
| if (p != nullptr) | |||||
| { | { | ||||
| delete p; | delete p; | ||||
| @@ -1005,33 +1004,33 @@ NPError NPP_Destroy (NPP npp, NPSavedData** save) | |||||
| NPError NPP_SetWindow (NPP npp, NPWindow* pNPWindow) | NPError NPP_SetWindow (NPP npp, NPWindow* pNPWindow) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| if (pNPWindow == 0) | |||||
| if (pNPWindow == nullptr) | |||||
| return NPERR_GENERIC_ERROR; | return NPERR_GENERIC_ERROR; | ||||
| JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | ||||
| if (p == 0) | |||||
| if (p == nullptr) | |||||
| return NPERR_GENERIC_ERROR; | return NPERR_GENERIC_ERROR; | ||||
| currentlyInitialisingNPP = npp; | currentlyInitialisingNPP = npp; | ||||
| NPError result = p->setWindow (pNPWindow) ? NPERR_NO_ERROR | NPError result = p->setWindow (pNPWindow) ? NPERR_NO_ERROR | ||||
| : NPERR_MODULE_LOAD_FAILED_ERROR; | : NPERR_MODULE_LOAD_FAILED_ERROR; | ||||
| currentlyInitialisingNPP = 0; | |||||
| currentlyInitialisingNPP = nullptr; | |||||
| return result; | return result; | ||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| NPError NPP_GetValue (NPP npp, NPPVariable variable, void* value) | NPError NPP_GetValue (NPP npp, NPPVariable variable, void* value) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | ||||
| if (p == 0) | |||||
| if (p == nullptr) | |||||
| return NPERR_GENERIC_ERROR; | return NPERR_GENERIC_ERROR; | ||||
| switch (variable) | switch (variable) | ||||
| @@ -1047,7 +1046,7 @@ NPError NPP_GetValue (NPP npp, NPPVariable variable, void* value) | |||||
| NPError NPP_NewStream (NPP npp, NPMIMEType type, NPStream* stream, NPBool seekable, ::uint16* stype) | NPError NPP_NewStream (NPP npp, NPMIMEType type, NPStream* stream, NPBool seekable, ::uint16* stype) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| return NPERR_NO_ERROR; | return NPERR_NO_ERROR; | ||||
| @@ -1055,7 +1054,7 @@ NPError NPP_NewStream (NPP npp, NPMIMEType type, NPStream* stream, NPBool seekab | |||||
| ::int32 NPP_WriteReady (NPP npp, NPStream *stream) | ::int32 NPP_WriteReady (NPP npp, NPStream *stream) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| return 0x0fffffff; | return 0x0fffffff; | ||||
| @@ -1063,7 +1062,7 @@ NPError NPP_NewStream (NPP npp, NPMIMEType type, NPStream* stream, NPBool seekab | |||||
| ::int32 NPP_Write (NPP npp, NPStream *stream, ::int32 offset, ::int32 len, void *buffer) | ::int32 NPP_Write (NPP npp, NPStream *stream, ::int32 offset, ::int32 len, void *buffer) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| return len; | return len; | ||||
| @@ -1071,7 +1070,7 @@ NPError NPP_NewStream (NPP npp, NPMIMEType type, NPStream* stream, NPBool seekab | |||||
| NPError NPP_DestroyStream (NPP npp, NPStream *stream, NPError reason) | NPError NPP_DestroyStream (NPP npp, NPStream *stream, NPError reason) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| return NPERR_NO_ERROR; | return NPERR_NO_ERROR; | ||||
| @@ -1079,25 +1078,25 @@ NPError NPP_DestroyStream (NPP npp, NPStream *stream, NPError reason) | |||||
| void NPP_StreamAsFile (NPP npp, NPStream* stream, const char* fname) | void NPP_StreamAsFile (NPP npp, NPStream* stream, const char* fname) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return; | return; | ||||
| } | } | ||||
| void NPP_Print (NPP npp, NPPrint* printInfo) | void NPP_Print (NPP npp, NPPrint* printInfo) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return; | return; | ||||
| } | } | ||||
| void NPP_URLNotify (NPP npp, const char* url, NPReason reason, void* notifyData) | void NPP_URLNotify (NPP npp, const char* url, NPReason reason, void* notifyData) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return; | return; | ||||
| } | } | ||||
| NPError NPP_SetValue (NPP npp, NPNVariable variable, void* value) | NPError NPP_SetValue (NPP npp, NPNVariable variable, void* value) | ||||
| { | { | ||||
| if (npp == 0) | |||||
| if (npp == nullptr) | |||||
| return NPERR_INVALID_INSTANCE_ERROR; | return NPERR_INVALID_INSTANCE_ERROR; | ||||
| return NPERR_NO_ERROR; | return NPERR_NO_ERROR; | ||||
| @@ -1105,7 +1104,7 @@ NPError NPP_SetValue (NPP npp, NPNVariable variable, void* value) | |||||
| ::int16 NPP_HandleEvent (NPP npp, void* ev) | ::int16 NPP_HandleEvent (NPP npp, void* ev) | ||||
| { | { | ||||
| if (npp != 0) | |||||
| if (npp != nullptr) | |||||
| { | { | ||||
| //JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | //JucePluginInstance* const p = (JucePluginInstance*) npp->pdata; | ||||
| } | } | ||||
| @@ -1119,7 +1118,7 @@ static NPP getInstance (const BrowserPluginComponent* bpc) | |||||
| { | { | ||||
| BrowserPluginHolderComponent* holder = dynamic_cast <BrowserPluginHolderComponent*> (bpc->getParentComponent()); | BrowserPluginHolderComponent* holder = dynamic_cast <BrowserPluginHolderComponent*> (bpc->getParentComponent()); | ||||
| if (holder != 0) | |||||
| if (holder != nullptr) | |||||
| return holder->npp; | return holder->npp; | ||||
| return currentlyInitialisingNPP; | return currentlyInitialisingNPP; | ||||
| @@ -1138,7 +1137,7 @@ const String BrowserPluginComponent::getBrowserVersion() const | |||||
| { | { | ||||
| if (browserVersionDesc.isEmpty()) | if (browserVersionDesc.isEmpty()) | ||||
| { | { | ||||
| if (getInstance (this) != 0) | |||||
| if (getInstance (this) != nullptr) | |||||
| browserVersionDesc << browser.uagent (getInstance (this)); | browserVersionDesc << browser.uagent (getInstance (this)); | ||||
| else | else | ||||
| browserVersionDesc << "Netscape Plugin V" << (int) ((browser.version >> 8) & 0xff) | browserVersionDesc << "Netscape Plugin V" << (int) ((browser.version >> 8) & 0xff) | ||||
| @@ -1157,23 +1156,23 @@ const String BrowserPluginComponent::getBrowserURL() const | |||||
| { | { | ||||
| String result; | String result; | ||||
| #if JUCE_WINDOWS | |||||
| #if JUCE_WINDOWS | |||||
| result = getActiveXBrowserURL (this); | result = getActiveXBrowserURL (this); | ||||
| if (result.isNotEmpty()) | if (result.isNotEmpty()) | ||||
| return result; | return result; | ||||
| #endif | |||||
| #endif | |||||
| // (FireFox doesn't seem happy if you call this from a background thread..) | // (FireFox doesn't seem happy if you call this from a background thread..) | ||||
| jassert (MessageManager::getInstance()->isThisTheMessageThread()); | jassert (MessageManager::getInstance()->isThisTheMessageThread()); | ||||
| NPP npp = getInstance (this); | NPP npp = getInstance (this); | ||||
| if (npp != 0) | |||||
| if (npp != nullptr) | |||||
| { | { | ||||
| NPObject* windowObj = 0; | |||||
| NPObject* windowObj = nullptr; | |||||
| browser.getvalue (npp, NPNVWindowNPObject, &windowObj); | browser.getvalue (npp, NPNVWindowNPObject, &windowObj); | ||||
| if (windowObj != 0) | |||||
| if (windowObj != nullptr) | |||||
| { | { | ||||
| NPVariant location; | NPVariant location; | ||||
| bool ok = browser.getproperty (npp, windowObj, | bool ok = browser.getproperty (npp, windowObj, | ||||
| @@ -4173,15 +4173,15 @@ enum VariantStreamMarkers | |||||
| class var::VariantType | class var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType() {} | |||||
| virtual ~VariantType() {} | |||||
| VariantType() noexcept {} | |||||
| virtual ~VariantType() noexcept {} | |||||
| virtual int toInt (const ValueUnion&) const { return 0; } | |||||
| virtual int64 toInt64 (const ValueUnion&) const { return 0; } | |||||
| virtual double toDouble (const ValueUnion&) const { return 0; } | |||||
| virtual const String toString (const ValueUnion&) const { return String::empty; } | |||||
| virtual bool toBool (const ValueUnion&) const { return false; } | |||||
| virtual DynamicObject* toObject (const ValueUnion&) const { return nullptr; } | |||||
| virtual int toInt (const ValueUnion&) const noexcept { return 0; } | |||||
| virtual int64 toInt64 (const ValueUnion&) const noexcept { return 0; } | |||||
| virtual double toDouble (const ValueUnion&) const noexcept { return 0; } | |||||
| virtual const String toString (const ValueUnion&) const { return String::empty; } | |||||
| virtual bool toBool (const ValueUnion&) const noexcept { return false; } | |||||
| virtual ReferenceCountedObject* toObject (const ValueUnion&) const noexcept { return nullptr; } | |||||
| virtual bool isVoid() const noexcept { return false; } | virtual bool isVoid() const noexcept { return false; } | ||||
| virtual bool isInt() const noexcept { return false; } | virtual bool isInt() const noexcept { return false; } | ||||
| @@ -4201,7 +4201,7 @@ public: | |||||
| class var::VariantType_Void : public var::VariantType | class var::VariantType_Void : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Void() {} | |||||
| VariantType_Void() noexcept {} | |||||
| static const VariantType_Void instance; | static const VariantType_Void instance; | ||||
| bool isVoid() const noexcept { return true; } | bool isVoid() const noexcept { return true; } | ||||
| @@ -4212,14 +4212,14 @@ public: | |||||
| class var::VariantType_Int : public var::VariantType | class var::VariantType_Int : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Int() {} | |||||
| VariantType_Int() noexcept {} | |||||
| static const VariantType_Int instance; | static const VariantType_Int instance; | ||||
| int toInt (const ValueUnion& data) const { return data.intValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return (int64) data.intValue; }; | |||||
| double toDouble (const ValueUnion& data) const { return (double) data.intValue; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return data.intValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return (int64) data.intValue; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return (double) data.intValue; } | |||||
| const String toString (const ValueUnion& data) const { return String (data.intValue); } | const String toString (const ValueUnion& data) const { return String (data.intValue); } | ||||
| bool toBool (const ValueUnion& data) const { return data.intValue != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.intValue != 0; } | |||||
| bool isInt() const noexcept { return true; } | bool isInt() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -4238,14 +4238,14 @@ public: | |||||
| class var::VariantType_Int64 : public var::VariantType | class var::VariantType_Int64 : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Int64() {} | |||||
| VariantType_Int64() noexcept {} | |||||
| static const VariantType_Int64 instance; | static const VariantType_Int64 instance; | ||||
| int toInt (const ValueUnion& data) const { return (int) data.int64Value; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return data.int64Value; }; | |||||
| double toDouble (const ValueUnion& data) const { return (double) data.int64Value; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return (int) data.int64Value; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return data.int64Value; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return (double) data.int64Value; } | |||||
| const String toString (const ValueUnion& data) const { return String (data.int64Value); } | const String toString (const ValueUnion& data) const { return String (data.int64Value); } | ||||
| bool toBool (const ValueUnion& data) const { return data.int64Value != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.int64Value != 0; } | |||||
| bool isInt64() const noexcept { return true; } | bool isInt64() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -4264,14 +4264,14 @@ public: | |||||
| class var::VariantType_Double : public var::VariantType | class var::VariantType_Double : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Double() {} | |||||
| VariantType_Double() noexcept {} | |||||
| static const VariantType_Double instance; | static const VariantType_Double instance; | ||||
| int toInt (const ValueUnion& data) const { return (int) data.doubleValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return (int64) data.doubleValue; }; | |||||
| double toDouble (const ValueUnion& data) const { return data.doubleValue; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return (int) data.doubleValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return (int64) data.doubleValue; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return data.doubleValue; } | |||||
| const String toString (const ValueUnion& data) const { return String (data.doubleValue); } | const String toString (const ValueUnion& data) const { return String (data.doubleValue); } | ||||
| bool toBool (const ValueUnion& data) const { return data.doubleValue != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.doubleValue != 0; } | |||||
| bool isDouble() const noexcept { return true; } | bool isDouble() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -4290,14 +4290,14 @@ public: | |||||
| class var::VariantType_Bool : public var::VariantType | class var::VariantType_Bool : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Bool() {} | |||||
| VariantType_Bool() noexcept {} | |||||
| static const VariantType_Bool instance; | static const VariantType_Bool instance; | ||||
| int toInt (const ValueUnion& data) const { return data.boolValue ? 1 : 0; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return data.boolValue ? 1 : 0; }; | |||||
| double toDouble (const ValueUnion& data) const { return data.boolValue ? 1.0 : 0.0; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return data.boolValue ? 1 : 0; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return data.boolValue ? 1 : 0; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return data.boolValue ? 1.0 : 0.0; } | |||||
| const String toString (const ValueUnion& data) const { return String::charToString (data.boolValue ? '1' : '0'); } | const String toString (const ValueUnion& data) const { return String::charToString (data.boolValue ? '1' : '0'); } | ||||
| bool toBool (const ValueUnion& data) const { return data.boolValue; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.boolValue; } | |||||
| bool isBool() const noexcept { return true; } | bool isBool() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -4315,17 +4315,17 @@ public: | |||||
| class var::VariantType_String : public var::VariantType | class var::VariantType_String : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_String() {} | |||||
| VariantType_String() noexcept {} | |||||
| static const VariantType_String instance; | static const VariantType_String instance; | ||||
| void cleanUp (ValueUnion& data) const noexcept { delete data.stringValue; } | void cleanUp (ValueUnion& data) const noexcept { delete data.stringValue; } | ||||
| void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.stringValue = new String (*source.stringValue); } | void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.stringValue = new String (*source.stringValue); } | ||||
| int toInt (const ValueUnion& data) const { return data.stringValue->getIntValue(); }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return data.stringValue->getLargeIntValue(); }; | |||||
| double toDouble (const ValueUnion& data) const { return data.stringValue->getDoubleValue(); } | |||||
| int toInt (const ValueUnion& data) const noexcept { return data.stringValue->getIntValue(); }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return data.stringValue->getLargeIntValue(); }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return data.stringValue->getDoubleValue(); } | |||||
| const String toString (const ValueUnion& data) const { return *data.stringValue; } | const String toString (const ValueUnion& data) const { return *data.stringValue; } | ||||
| bool toBool (const ValueUnion& data) const { return data.stringValue->getIntValue() != 0 | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.stringValue->getIntValue() != 0 | |||||
| || data.stringValue->trim().equalsIgnoreCase ("true") | || data.stringValue->trim().equalsIgnoreCase ("true") | ||||
| || data.stringValue->trim().equalsIgnoreCase ("yes"); } | || data.stringValue->trim().equalsIgnoreCase ("yes"); } | ||||
| bool isString() const noexcept { return true; } | bool isString() const noexcept { return true; } | ||||
| @@ -4349,16 +4349,16 @@ public: | |||||
| class var::VariantType_Object : public var::VariantType | class var::VariantType_Object : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Object() {} | |||||
| VariantType_Object() noexcept {} | |||||
| static const VariantType_Object instance; | static const VariantType_Object instance; | ||||
| void cleanUp (ValueUnion& data) const noexcept { if (data.objectValue != nullptr) data.objectValue->decReferenceCount(); } | |||||
| void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.objectValue = source.objectValue; if (dest.objectValue != nullptr) dest.objectValue->incReferenceCount(); } | |||||
| void cleanUp (ValueUnion& data) const noexcept { if (data.objectValue != nullptr) data.objectValue->decReferenceCount(); } | |||||
| void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.objectValue = source.objectValue; if (dest.objectValue != nullptr) dest.objectValue->incReferenceCount(); } | |||||
| const String toString (const ValueUnion& data) const { return "Object 0x" + String::toHexString ((int) (pointer_sized_int) data.objectValue); } | |||||
| bool toBool (const ValueUnion& data) const { return data.objectValue != 0; } | |||||
| DynamicObject* toObject (const ValueUnion& data) const { return data.objectValue; } | |||||
| bool isObject() const noexcept { return true; } | |||||
| const String toString (const ValueUnion& data) const { return "Object 0x" + String::toHexString ((int) (pointer_sized_int) data.objectValue); } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.objectValue != 0; } | |||||
| ReferenceCountedObject* toObject (const ValueUnion& data) const noexcept { return data.objectValue; } | |||||
| bool isObject() const noexcept { return true; } | |||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| { | { | ||||
| @@ -4375,11 +4375,11 @@ public: | |||||
| class var::VariantType_Method : public var::VariantType | class var::VariantType_Method : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Method() {} | |||||
| VariantType_Method() noexcept {} | |||||
| static const VariantType_Method instance; | static const VariantType_Method instance; | ||||
| const String toString (const ValueUnion&) const { return "Method"; } | const String toString (const ValueUnion&) const { return "Method"; } | ||||
| bool toBool (const ValueUnion& data) const { return data.methodValue != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.methodValue != 0; } | |||||
| bool isMethod() const noexcept { return true; } | bool isMethod() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -4454,7 +4454,7 @@ var::var (const wchar_t* const value_) : type (&VariantType_String::instance) | |||||
| value.stringValue = new String (value_); | value.stringValue = new String (value_); | ||||
| } | } | ||||
| var::var (DynamicObject* const object) : type (&VariantType_Object::instance) | |||||
| var::var (ReferenceCountedObject* const object) : type (&VariantType_Object::instance) | |||||
| { | { | ||||
| value.objectValue = object; | value.objectValue = object; | ||||
| @@ -4476,14 +4476,15 @@ bool var::isString() const noexcept { return type->isString(); } | |||||
| bool var::isObject() const noexcept { return type->isObject(); } | bool var::isObject() const noexcept { return type->isObject(); } | ||||
| bool var::isMethod() const noexcept { return type->isMethod(); } | bool var::isMethod() const noexcept { return type->isMethod(); } | ||||
| var::operator int() const { return type->toInt (value); } | |||||
| var::operator int64() const { return type->toInt64 (value); } | |||||
| var::operator bool() const { return type->toBool (value); } | |||||
| var::operator float() const { return (float) type->toDouble (value); } | |||||
| var::operator double() const { return type->toDouble (value); } | |||||
| const String var::toString() const { return type->toString (value); } | |||||
| var::operator const String() const { return type->toString (value); } | |||||
| DynamicObject* var::getObject() const { return type->toObject (value); } | |||||
| var::operator int() const noexcept { return type->toInt (value); } | |||||
| var::operator int64() const noexcept { return type->toInt64 (value); } | |||||
| var::operator bool() const noexcept { return type->toBool (value); } | |||||
| var::operator float() const noexcept { return (float) type->toDouble (value); } | |||||
| var::operator double() const noexcept { return type->toDouble (value); } | |||||
| const String var::toString() const { return type->toString (value); } | |||||
| var::operator const String() const { return type->toString (value); } | |||||
| ReferenceCountedObject* var::getObject() const noexcept { return type->toObject (value); } | |||||
| DynamicObject* var::getDynamicObject() const noexcept { return dynamic_cast <DynamicObject*> (getObject()); } | |||||
| void var::swapWith (var& other) noexcept | void var::swapWith (var& other) noexcept | ||||
| { | { | ||||
| @@ -4491,16 +4492,16 @@ void var::swapWith (var& other) noexcept | |||||
| std::swap (value, other.value); | std::swap (value, other.value); | ||||
| } | } | ||||
| var& var::operator= (const var& newValue) { type->cleanUp (value); type = newValue.type; type->createCopy (value, newValue.value); return *this; } | |||||
| var& var::operator= (int newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (int64 newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (bool newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (double newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const char* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const wchar_t* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const String& newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (DynamicObject* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (MethodFunction newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const var& newValue) { type->cleanUp (value); type = newValue.type; type->createCopy (value, newValue.value); return *this; } | |||||
| var& var::operator= (const int newValue) { type->cleanUp (value); type = &VariantType_Int::instance; value.intValue = newValue; return *this; } | |||||
| var& var::operator= (const int64 newValue) { type->cleanUp (value); type = &VariantType_Int64::instance; value.int64Value = newValue; return *this; } | |||||
| var& var::operator= (const bool newValue) { type->cleanUp (value); type = &VariantType_Bool::instance; value.boolValue = newValue; return *this; } | |||||
| var& var::operator= (const double newValue) { type->cleanUp (value); type = &VariantType_Double::instance; value.doubleValue = newValue; return *this; } | |||||
| var& var::operator= (const char* const newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const wchar_t* const newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const String& newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (ReferenceCountedObject* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (MethodFunction newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| bool var::equals (const var& other) const noexcept | bool var::equals (const var& other) const noexcept | ||||
| { | { | ||||
| @@ -4514,8 +4515,10 @@ bool var::equalsWithSameType (const var& other) const noexcept | |||||
| bool operator== (const var& v1, const var& v2) noexcept { return v1.equals (v2); } | bool operator== (const var& v1, const var& v2) noexcept { return v1.equals (v2); } | ||||
| bool operator!= (const var& v1, const var& v2) noexcept { return ! v1.equals (v2); } | bool operator!= (const var& v1, const var& v2) noexcept { return ! v1.equals (v2); } | ||||
| bool operator== (const var& v1, const String& v2) noexcept { return v1.toString() == v2; } | |||||
| bool operator!= (const var& v1, const String& v2) noexcept { return v1.toString() != v2; } | |||||
| bool operator== (const var& v1, const String& v2) { return v1.toString() == v2; } | |||||
| bool operator!= (const var& v1, const String& v2) { return v1.toString() != v2; } | |||||
| bool operator== (const var& v1, const char* const v2) { return v1.toString() == v2; } | |||||
| bool operator!= (const var& v1, const char* const v2) { return v1.toString() != v2; } | |||||
| void var::writeToStream (OutputStream& output) const | void var::writeToStream (OutputStream& output) const | ||||
| { | { | ||||
| @@ -4551,13 +4554,13 @@ const var var::readFromStream (InputStream& input) | |||||
| const var var::operator[] (const Identifier& propertyName) const | const var var::operator[] (const Identifier& propertyName) const | ||||
| { | { | ||||
| DynamicObject* const o = getObject(); | |||||
| DynamicObject* const o = getDynamicObject(); | |||||
| return o != nullptr ? o->getProperty (propertyName) : var::null; | return o != nullptr ? o->getProperty (propertyName) : var::null; | ||||
| } | } | ||||
| const var var::invoke (const Identifier& method, const var* arguments, int numArguments) const | const var var::invoke (const Identifier& method, const var* arguments, int numArguments) const | ||||
| { | { | ||||
| DynamicObject* const o = getObject(); | |||||
| DynamicObject* const o = getDynamicObject(); | |||||
| return o != nullptr ? o->invokeMethod (method, arguments, numArguments) : var::null; | return o != nullptr ? o->invokeMethod (method, arguments, numArguments) : var::null; | ||||
| } | } | ||||
| @@ -4565,7 +4568,7 @@ const var var::invoke (const var& targetObject, const var* arguments, int numArg | |||||
| { | { | ||||
| if (isMethod()) | if (isMethod()) | ||||
| { | { | ||||
| DynamicObject* const target = targetObject.getObject(); | |||||
| DynamicObject* const target = targetObject.getDynamicObject(); | |||||
| if (target != nullptr) | if (target != nullptr) | ||||
| return (target->*(value.methodValue)) (arguments, numArguments); | return (target->*(value.methodValue)) (arguments, numArguments); | ||||
| @@ -49066,9 +49069,9 @@ public: | |||||
| if (selectedRows.size() > 0) | if (selectedRows.size() > 0) | ||||
| { | { | ||||
| const String dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| const var dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| if (dragDescription.isNotEmpty()) | |||||
| if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) | |||||
| { | { | ||||
| isDragging = true; | isDragging = true; | ||||
| owner.startDragAndDrop (e, dragDescription); | owner.startDragAndDrop (e, dragDescription); | ||||
| @@ -49854,7 +49857,7 @@ const Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY) | |||||
| return snapshot; | return snapshot; | ||||
| } | } | ||||
| void ListBox::startDragAndDrop (const MouseEvent& e, const String& dragDescription) | |||||
| void ListBox::startDragAndDrop (const MouseEvent& e, const var& dragDescription) | |||||
| { | { | ||||
| DragAndDropContainer* const dragContainer | DragAndDropContainer* const dragContainer | ||||
| = DragAndDropContainer::findParentDragContainerFor (this); | = DragAndDropContainer::findParentDragContainerFor (this); | ||||
| @@ -49890,8 +49893,8 @@ void ListBoxModel::selectedRowsChanged (int) {} | |||||
| void ListBoxModel::deleteKeyPressed (int) {} | void ListBoxModel::deleteKeyPressed (int) {} | ||||
| void ListBoxModel::returnKeyPressed (int) {} | void ListBoxModel::returnKeyPressed (int) {} | ||||
| void ListBoxModel::listWasScrolled() {} | void ListBoxModel::listWasScrolled() {} | ||||
| const String ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return String::empty; } | |||||
| const String ListBoxModel::getTooltipForRow (int) { return String::empty; } | |||||
| const var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; } | |||||
| const String ListBoxModel::getTooltipForRow (int) { return String::empty; } | |||||
| END_JUCE_NAMESPACE | END_JUCE_NAMESPACE | ||||
| /*** End of inlined file: juce_ListBox.cpp ***/ | /*** End of inlined file: juce_ListBox.cpp ***/ | ||||
| @@ -52432,9 +52435,9 @@ public: | |||||
| if (selectedRows.size() > 0) | if (selectedRows.size() > 0) | ||||
| { | { | ||||
| const String dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| const var dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| if (dragDescription.isNotEmpty()) | |||||
| if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) | |||||
| { | { | ||||
| isDragging = true; | isDragging = true; | ||||
| owner.startDragAndDrop (e, dragDescription); | owner.startDragAndDrop (e, dragDescription); | ||||
| @@ -52749,7 +52752,7 @@ void TableListBoxModel::returnKeyPressed (int) {} | |||||
| void TableListBoxModel::listWasScrolled() {} | void TableListBoxModel::listWasScrolled() {} | ||||
| const String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; } | const String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; } | ||||
| const String TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return String::empty; } | |||||
| const var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; } | |||||
| Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate) | Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate) | ||||
| { | { | ||||
| @@ -56523,9 +56526,9 @@ public: | |||||
| if (item != nullptr && e.getMouseDownX() >= pos.getX()) | if (item != nullptr && e.getMouseDownX() >= pos.getX()) | ||||
| { | { | ||||
| const String dragDescription (item->getDragSourceDescription()); | |||||
| const var dragDescription (item->getDragSourceDescription()); | |||||
| if (dragDescription.isNotEmpty()) | |||||
| if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) | |||||
| { | { | ||||
| DragAndDropContainer* const dragContainer | DragAndDropContainer* const dragContainer | ||||
| = DragAndDropContainer::findParentDragContainerFor (this); | = DragAndDropContainer::findParentDragContainerFor (this); | ||||
| @@ -57679,9 +57682,9 @@ const String TreeViewItem::getTooltip() | |||||
| return String::empty; | return String::empty; | ||||
| } | } | ||||
| const String TreeViewItem::getDragSourceDescription() | |||||
| const var TreeViewItem::getDragSourceDescription() | |||||
| { | { | ||||
| return String::empty; | |||||
| return var::null; | |||||
| } | } | ||||
| bool TreeViewItem::isInterestedInFileDrag (const StringArray&) | bool TreeViewItem::isInterestedInFileDrag (const StringArray&) | ||||
| @@ -60179,7 +60182,7 @@ public: | |||||
| const String getUniqueName() const { return file.getFullPathName(); } | const String getUniqueName() const { return file.getFullPathName(); } | ||||
| int getItemHeight() const { return 22; } | int getItemHeight() const { return 22; } | ||||
| const String getDragSourceDescription() { return owner.getDragAndDropDescription(); } | |||||
| const var getDragSourceDescription() { return owner.getDragAndDropDescription(); } | |||||
| void itemOpennessChanged (bool isNowOpen) | void itemOpennessChanged (bool isNowOpen) | ||||
| { | { | ||||
| @@ -70483,14 +70486,16 @@ private: | |||||
| { | { | ||||
| const Rectangle<int> mon (Desktop::getInstance() | const Rectangle<int> mon (Desktop::getInstance() | ||||
| .getMonitorAreaContaining (target.getCentre(), | .getMonitorAreaContaining (target.getCentre(), | ||||
| #if JUCE_MAC | |||||
| #if JUCE_MAC | |||||
| true)); | true)); | ||||
| #else | |||||
| #else | |||||
| false)); // on windows, don't stop the menu overlapping the taskbar | false)); // on windows, don't stop the menu overlapping the taskbar | ||||
| #endif | |||||
| #endif | |||||
| const int maxMenuHeight = mon.getHeight() - 24; | |||||
| int x, y, widthToUse, heightToUse; | int x, y, widthToUse, heightToUse; | ||||
| layoutMenuItems (mon.getWidth() - 24, widthToUse, heightToUse); | |||||
| layoutMenuItems (mon.getWidth() - 24, maxMenuHeight, widthToUse, heightToUse); | |||||
| if (alignToRectangle) | if (alignToRectangle) | ||||
| { | { | ||||
| @@ -70531,10 +70536,10 @@ private: | |||||
| if (biggestSpace < widthToUse) | if (biggestSpace < widthToUse) | ||||
| { | { | ||||
| layoutMenuItems (biggestSpace + target.getWidth() / 3, widthToUse, heightToUse); | |||||
| layoutMenuItems (biggestSpace + target.getWidth() / 3, maxMenuHeight, widthToUse, heightToUse); | |||||
| if (numColumns > 1) | if (numColumns > 1) | ||||
| layoutMenuItems (biggestSpace - 4, widthToUse, heightToUse); | |||||
| layoutMenuItems (biggestSpace - 4, maxMenuHeight, widthToUse, heightToUse); | |||||
| tendTowardsRight = (mon.getRight() - target.getRight()) >= (target.getX() - mon.getX()); | tendTowardsRight = (mon.getRight() - target.getRight()) >= (target.getX() - mon.getX()); | ||||
| } | } | ||||
| @@ -70559,11 +70564,10 @@ private: | |||||
| && owner->windowPos.intersects (windowPos.expanded (-4, -4)); | && owner->windowPos.intersects (windowPos.expanded (-4, -4)); | ||||
| } | } | ||||
| void layoutMenuItems (const int maxMenuW, int& width, int& height) | |||||
| void layoutMenuItems (const int maxMenuW, const int maxMenuH, int& width, int& height) | |||||
| { | { | ||||
| numColumns = 0; | numColumns = 0; | ||||
| contentHeight = 0; | contentHeight = 0; | ||||
| const int maxMenuH = getParentHeight() - 24; | |||||
| int totalW; | int totalW; | ||||
| do | do | ||||
| @@ -71539,13 +71543,12 @@ class DragImageComponent : public Component, | |||||
| { | { | ||||
| public: | public: | ||||
| DragImageComponent (const Image& im, | DragImageComponent (const Image& im, | ||||
| const String& desc, | |||||
| const var& desc, | |||||
| Component* const sourceComponent, | Component* const sourceComponent, | ||||
| Component* const mouseDragSource_, | Component* const mouseDragSource_, | ||||
| DragAndDropContainer* const o, | DragAndDropContainer* const o, | ||||
| const Point<int>& imageOffset_, | |||||
| ReferenceCountedObject* const customDataObject) | |||||
| : sourceDetails (desc, sourceComponent, Point<int>(), customDataObject), | |||||
| const Point<int>& imageOffset_) | |||||
| : sourceDetails (desc, sourceComponent, Point<int>()), | |||||
| image (im), | image (im), | ||||
| mouseDragSource (mouseDragSource_), | mouseDragSource (mouseDragSource_), | ||||
| owner (o), | owner (o), | ||||
| @@ -71809,12 +71812,11 @@ DragAndDropContainer::~DragAndDropContainer() | |||||
| dragImageComponent = nullptr; | dragImageComponent = nullptr; | ||||
| } | } | ||||
| void DragAndDropContainer::startDragging (const String& sourceDescription, | |||||
| void DragAndDropContainer::startDragging (const var& sourceDescription, | |||||
| Component* sourceComponent, | Component* sourceComponent, | ||||
| const Image& dragImage_, | const Image& dragImage_, | ||||
| const bool allowDraggingToExternalWindows, | const bool allowDraggingToExternalWindows, | ||||
| const Point<int>* imageOffsetFromMouse, | |||||
| ReferenceCountedObject* customDataObject) | |||||
| const Point<int>* imageOffsetFromMouse) | |||||
| { | { | ||||
| Image dragImage (dragImage_); | Image dragImage (dragImage_); | ||||
| @@ -71883,8 +71885,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription, | |||||
| } | } | ||||
| dragImageComponent = new DragImageComponent (dragImage, sourceDescription, sourceComponent, | dragImageComponent = new DragImageComponent (dragImage, sourceDescription, sourceComponent, | ||||
| draggingSource->getComponentUnderMouse(), this, | |||||
| imageOffset, customDataObject); | |||||
| draggingSource->getComponentUnderMouse(), this, imageOffset); | |||||
| currentDragDesc = sourceDescription; | currentDragDesc = sourceDescription; | ||||
| @@ -71934,12 +71935,10 @@ bool DragAndDropContainer::shouldDropFilesWhenDraggedExternally (const DragAndDr | |||||
| return false; | return false; | ||||
| } | } | ||||
| DragAndDropTarget::SourceDetails::SourceDetails (const String& description_, Component* sourceComponent_, | |||||
| const Point<int>& localPosition_, ReferenceCountedObject* const customDataObject_) noexcept | |||||
| DragAndDropTarget::SourceDetails::SourceDetails (const var& description_, Component* sourceComponent_, const Point<int>& localPosition_) noexcept | |||||
| : description (description_), | : description (description_), | ||||
| sourceComponent (sourceComponent_), | sourceComponent (sourceComponent_), | ||||
| localPosition (localPosition_), | |||||
| customDataObject (customDataObject_) | |||||
| localPosition (localPosition_) | |||||
| { | { | ||||
| } | } | ||||
| @@ -73,7 +73,7 @@ namespace JuceDummyNamespace {} | |||||
| */ | */ | ||||
| #define JUCE_MAJOR_VERSION 1 | #define JUCE_MAJOR_VERSION 1 | ||||
| #define JUCE_MINOR_VERSION 53 | #define JUCE_MINOR_VERSION 53 | ||||
| #define JUCE_BUILDNUMBER 74 | |||||
| #define JUCE_BUILDNUMBER 75 | |||||
| /** Current Juce version number. | /** Current Juce version number. | ||||
| @@ -8724,6 +8724,7 @@ OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const NewLine&); | |||||
| /*** End of inlined file: juce_OutputStream.h ***/ | /*** End of inlined file: juce_OutputStream.h ***/ | ||||
| #ifndef DOXYGEN | #ifndef DOXYGEN | ||||
| class ReferenceCountedObject; | |||||
| class DynamicObject; | class DynamicObject; | ||||
| #endif | #endif | ||||
| @@ -8731,8 +8732,8 @@ OutputStream& JUCE_CALLTYPE operator<< (OutputStream& stream, const NewLine&); | |||||
| A variant class, that can be used to hold a range of primitive values. | A variant class, that can be used to hold a range of primitive values. | ||||
| A var object can hold a range of simple primitive values, strings, or | A var object can hold a range of simple primitive values, strings, or | ||||
| a reference-counted pointer to a DynamicObject. The var class is intended | |||||
| to act like the values used in dynamic scripting languages. | |||||
| any kind of ReferenceCountedObject. The var class is intended to act like | |||||
| the kind of values used in dynamic scripting languages. | |||||
| @see DynamicObject | @see DynamicObject | ||||
| */ | */ | ||||
| @@ -8760,7 +8761,7 @@ public: | |||||
| var (const char* value); | var (const char* value); | ||||
| var (const wchar_t* value); | var (const wchar_t* value); | ||||
| var (const String& value); | var (const String& value); | ||||
| var (DynamicObject* object); | |||||
| var (ReferenceCountedObject* object); | |||||
| var (MethodFunction method) noexcept; | var (MethodFunction method) noexcept; | ||||
| var& operator= (const var& valueToCopy); | var& operator= (const var& valueToCopy); | ||||
| @@ -8771,19 +8772,20 @@ public: | |||||
| var& operator= (const char* value); | var& operator= (const char* value); | ||||
| var& operator= (const wchar_t* value); | var& operator= (const wchar_t* value); | ||||
| var& operator= (const String& value); | var& operator= (const String& value); | ||||
| var& operator= (DynamicObject* object); | |||||
| var& operator= (ReferenceCountedObject* object); | |||||
| var& operator= (MethodFunction method); | var& operator= (MethodFunction method); | ||||
| void swapWith (var& other) noexcept; | void swapWith (var& other) noexcept; | ||||
| operator int() const; | |||||
| operator int64() const; | |||||
| operator bool() const; | |||||
| operator float() const; | |||||
| operator double() const; | |||||
| operator int() const noexcept; | |||||
| operator int64() const noexcept; | |||||
| operator bool() const noexcept; | |||||
| operator float() const noexcept; | |||||
| operator double() const noexcept; | |||||
| operator const String() const; | operator const String() const; | ||||
| const String toString() const; | const String toString() const; | ||||
| DynamicObject* getObject() const; | |||||
| ReferenceCountedObject* getObject() const noexcept; | |||||
| DynamicObject* getDynamicObject() const noexcept; | |||||
| bool isVoid() const noexcept; | bool isVoid() const noexcept; | ||||
| bool isInt() const noexcept; | bool isInt() const noexcept; | ||||
| @@ -8864,7 +8866,7 @@ private: | |||||
| bool boolValue; | bool boolValue; | ||||
| double doubleValue; | double doubleValue; | ||||
| String* stringValue; | String* stringValue; | ||||
| DynamicObject* objectValue; | |||||
| ReferenceCountedObject* objectValue; | |||||
| MethodFunction methodValue; | MethodFunction methodValue; | ||||
| }; | }; | ||||
| @@ -8874,8 +8876,10 @@ private: | |||||
| bool operator== (const var& v1, const var& v2) noexcept; | bool operator== (const var& v1, const var& v2) noexcept; | ||||
| bool operator!= (const var& v1, const var& v2) noexcept; | bool operator!= (const var& v1, const var& v2) noexcept; | ||||
| bool operator== (const var& v1, const String& v2) noexcept; | |||||
| bool operator!= (const var& v1, const String& v2) noexcept; | |||||
| bool operator== (const var& v1, const String& v2); | |||||
| bool operator!= (const var& v1, const String& v2); | |||||
| bool operator== (const var& v1, const char* v2); | |||||
| bool operator!= (const var& v1, const char* v2); | |||||
| #endif // __JUCE_VARIANT_JUCEHEADER__ | #endif // __JUCE_VARIANT_JUCEHEADER__ | ||||
| /*** End of inlined file: juce_Variant.h ***/ | /*** End of inlined file: juce_Variant.h ***/ | ||||
| @@ -46472,14 +46476,14 @@ public: | |||||
| /** To allow rows from your list to be dragged-and-dropped, implement this method. | /** To allow rows from your list to be dragged-and-dropped, implement this method. | ||||
| If this returns a non-empty name then when the user drags a row, the listbox will | |||||
| If this returns a non-null variant then when the user drags a row, the listbox will | |||||
| try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | ||||
| a drag-and-drop operation, using this string as the source description, with the listbox | a drag-and-drop operation, using this string as the source description, with the listbox | ||||
| itself as the source component. | itself as the source component. | ||||
| @see DragAndDropContainer::startDragging | @see DragAndDropContainer::startDragging | ||||
| */ | */ | ||||
| virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| virtual const var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| /** You can override this to provide tool tips for specific rows. | /** You can override this to provide tool tips for specific rows. | ||||
| @see TooltipClient | @see TooltipClient | ||||
| @@ -46880,7 +46884,7 @@ public: | |||||
| /** @internal */ | /** @internal */ | ||||
| void colourChanged(); | void colourChanged(); | ||||
| /** @internal */ | /** @internal */ | ||||
| void startDragAndDrop (const MouseEvent& e, const String& dragDescription); | |||||
| void startDragAndDrop (const MouseEvent& e, const var& dragDescription); | |||||
| private: | private: | ||||
| @@ -50626,11 +50630,10 @@ public: | |||||
| { | { | ||||
| public: | public: | ||||
| /** Creates a SourceDetails object from its various settings. */ | /** Creates a SourceDetails object from its various settings. */ | ||||
| SourceDetails (const String& description, Component* sourceComponent, | |||||
| const Point<int>& localPosition, ReferenceCountedObject* customDataObject = nullptr) noexcept; | |||||
| SourceDetails (const var& description, Component* sourceComponent, const Point<int>& localPosition) noexcept; | |||||
| /** A descriptor string - this is set DragAndDropContainer::startDragging(). */ | |||||
| String description; | |||||
| /** A descriptor for the drag - this is set DragAndDropContainer::startDragging(). */ | |||||
| var description; | |||||
| /** The component from the drag operation was started. */ | /** The component from the drag operation was started. */ | ||||
| WeakReference<Component> sourceComponent; | WeakReference<Component> sourceComponent; | ||||
| @@ -50639,12 +50642,6 @@ public: | |||||
| Note that for calls such as isInterestedInDragSource(), this may be a null position. | Note that for calls such as isInterestedInDragSource(), this may be a null position. | ||||
| */ | */ | ||||
| Point<int> localPosition; | Point<int> localPosition; | ||||
| /** A pointer to a user-supplied object which contains some kind of data which is relevant to | |||||
| the specific classes which are being used. Make sure that you check the type of this object, | |||||
| and safely dynamic_cast it to your required type. | |||||
| */ | |||||
| ReferenceCountedObjectPtr<ReferenceCountedObject> customDataObject; | |||||
| }; | }; | ||||
| /** Callback to check whether this target is interested in the type of object being | /** Callback to check whether this target is interested in the type of object being | ||||
| @@ -50768,8 +50765,8 @@ public: | |||||
| findParentDragContainerFor() is a handy method to call to find the | findParentDragContainerFor() is a handy method to call to find the | ||||
| drag container to use for a component. | drag container to use for a component. | ||||
| @param sourceDescription a string to use as the description of the thing being dragged - this | |||||
| will be passed to the objects that might be dropped-onto so they can | |||||
| @param sourceDescription a string or value to use as the description of the thing being dragged - | |||||
| this will be passed to the objects that might be dropped-onto so they can | |||||
| decide whether they want to handle it | decide whether they want to handle it | ||||
| @param sourceComponent the component that is being dragged | @param sourceComponent the component that is being dragged | ||||
| @param dragImage the image to drag around underneath the mouse. If this is a null image, | @param dragImage the image to drag around underneath the mouse. If this is a null image, | ||||
| @@ -50781,16 +50778,12 @@ public: | |||||
| at which the image should be drawn from the mouse. If it isn't | at which the image should be drawn from the mouse. If it isn't | ||||
| specified, then the image will be centred around the mouse. If | specified, then the image will be centred around the mouse. If | ||||
| an image hasn't been passed-in, this will be ignored. | an image hasn't been passed-in, this will be ignored. | ||||
| @param customDataObject Any kind of reference-counted object which you want to have passed to | |||||
| the target component. A pointer to this object will be made available | |||||
| to the targets in the DragAndDropTarget::SourceDetails class. | |||||
| */ | */ | ||||
| void startDragging (const String& sourceDescription, | |||||
| void startDragging (const var& sourceDescription, | |||||
| Component* sourceComponent, | Component* sourceComponent, | ||||
| const Image& dragImage = Image::null, | const Image& dragImage = Image::null, | ||||
| bool allowDraggingToOtherJuceWindows = false, | bool allowDraggingToOtherJuceWindows = false, | ||||
| const Point<int>* imageOffsetFromMouse = nullptr, | |||||
| ReferenceCountedObject* customDataObject = nullptr); | |||||
| const Point<int>* imageOffsetFromMouse = nullptr); | |||||
| /** Returns true if something is currently being dragged. */ | /** Returns true if something is currently being dragged. */ | ||||
| bool isDragAndDropActive() const; | bool isDragAndDropActive() const; | ||||
| @@ -50856,17 +50849,14 @@ protected: | |||||
| and if you want it to then perform a file drag-and-drop, add the filenames you want | and if you want it to then perform a file drag-and-drop, add the filenames you want | ||||
| to the array passed in, and return true. | to the array passed in, and return true. | ||||
| @param dragSourceDescription the description passed into the startDrag() call when the drag began | |||||
| @param dragSourceComponent the component passed into the startDrag() call when the drag began | |||||
| @param files on return, the filenames you want to drag | |||||
| @param canMoveFiles on return, true if it's ok for the receiver to move the files; false if | |||||
| it must make a copy of them (see the performExternalDragDropOfFiles() | |||||
| method) | |||||
| @param sourceDetails information about the source of the drag operation | |||||
| @param files on return, the filenames you want to drag | |||||
| @param canMoveFiles on return, true if it's ok for the receiver to move the files; false if | |||||
| it must make a copy of them (see the performExternalDragDropOfFiles() method) | |||||
| @see performExternalDragDropOfFiles | @see performExternalDragDropOfFiles | ||||
| */ | */ | ||||
| virtual bool shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails, | virtual bool shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails, | ||||
| StringArray& files, | |||||
| bool& canMoveFiles); | |||||
| StringArray& files, bool& canMoveFiles); | |||||
| private: | private: | ||||
| @@ -53674,14 +53664,14 @@ public: | |||||
| /** To allow rows from your table to be dragged-and-dropped, implement this method. | /** To allow rows from your table to be dragged-and-dropped, implement this method. | ||||
| If this returns a non-empty name then when the user drags a row, the table will try to | |||||
| If this returns a non-null variant then when the user drags a row, the table will try to | |||||
| find a DragAndDropContainer in its parent hierarchy, and will use it to trigger a | find a DragAndDropContainer in its parent hierarchy, and will use it to trigger a | ||||
| drag-and-drop operation, using this string as the source description, and the listbox | drag-and-drop operation, using this string as the source description, and the listbox | ||||
| itself as the source component. | itself as the source component. | ||||
| @see DragAndDropContainer::startDragging | |||||
| @see getDragSourceCustomData, DragAndDropContainer::startDragging | |||||
| */ | */ | ||||
| virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| virtual const var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| }; | }; | ||||
| /** | /** | ||||
| @@ -54367,7 +54357,7 @@ public: | |||||
| /** To allow items from your treeview to be dragged-and-dropped, implement this method. | /** To allow items from your treeview to be dragged-and-dropped, implement this method. | ||||
| If this returns a non-empty name then when the user drags an item, the treeview will | |||||
| If this returns a non-null variant then when the user drags an item, the treeview will | |||||
| try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | ||||
| a drag-and-drop operation, using this string as the source description, with the treeview | a drag-and-drop operation, using this string as the source description, with the treeview | ||||
| itself as the source component. | itself as the source component. | ||||
| @@ -54380,7 +54370,7 @@ public: | |||||
| @see DragAndDropContainer::startDragging | @see DragAndDropContainer::startDragging | ||||
| */ | */ | ||||
| virtual const String getDragSourceDescription(); | |||||
| virtual const var getDragSourceDescription(); | |||||
| /** If you want your item to be able to have files drag-and-dropped onto it, implement this | /** If you want your item to be able to have files drag-and-dropped onto it, implement this | ||||
| method and return true. | method and return true. | ||||
| @@ -59232,7 +59222,7 @@ public: | |||||
| virtual void menuItemSelected (int menuItemID, | virtual void menuItemSelected (int menuItemID, | ||||
| int topLevelMenuIndex) = 0; | int topLevelMenuIndex) = 0; | ||||
| #if JUCE_MAC || DOXYGEN | |||||
| #if JUCE_MAC || DOXYGEN | |||||
| /** MAC ONLY - Sets the model that is currently being shown as the main | /** MAC ONLY - Sets the model that is currently being shown as the main | ||||
| menu bar at the top of the screen on the Mac. | menu bar at the top of the screen on the Mac. | ||||
| @@ -59254,8 +59244,7 @@ public: | |||||
| the main menu bar. | the main menu bar. | ||||
| */ | */ | ||||
| static MenuBarModel* getMacMainMenu(); | static MenuBarModel* getMacMainMenu(); | ||||
| #endif | |||||
| #endif | |||||
| /** @internal */ | /** @internal */ | ||||
| void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info); | void applicationCommandInvoked (const ApplicationCommandTarget::InvocationInfo& info); | ||||
| @@ -45,15 +45,15 @@ enum VariantStreamMarkers | |||||
| class var::VariantType | class var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType() {} | |||||
| virtual ~VariantType() {} | |||||
| VariantType() noexcept {} | |||||
| virtual ~VariantType() noexcept {} | |||||
| virtual int toInt (const ValueUnion&) const { return 0; } | |||||
| virtual int64 toInt64 (const ValueUnion&) const { return 0; } | |||||
| virtual double toDouble (const ValueUnion&) const { return 0; } | |||||
| virtual const String toString (const ValueUnion&) const { return String::empty; } | |||||
| virtual bool toBool (const ValueUnion&) const { return false; } | |||||
| virtual DynamicObject* toObject (const ValueUnion&) const { return nullptr; } | |||||
| virtual int toInt (const ValueUnion&) const noexcept { return 0; } | |||||
| virtual int64 toInt64 (const ValueUnion&) const noexcept { return 0; } | |||||
| virtual double toDouble (const ValueUnion&) const noexcept { return 0; } | |||||
| virtual const String toString (const ValueUnion&) const { return String::empty; } | |||||
| virtual bool toBool (const ValueUnion&) const noexcept { return false; } | |||||
| virtual ReferenceCountedObject* toObject (const ValueUnion&) const noexcept { return nullptr; } | |||||
| virtual bool isVoid() const noexcept { return false; } | virtual bool isVoid() const noexcept { return false; } | ||||
| virtual bool isInt() const noexcept { return false; } | virtual bool isInt() const noexcept { return false; } | ||||
| @@ -74,7 +74,7 @@ public: | |||||
| class var::VariantType_Void : public var::VariantType | class var::VariantType_Void : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Void() {} | |||||
| VariantType_Void() noexcept {} | |||||
| static const VariantType_Void instance; | static const VariantType_Void instance; | ||||
| bool isVoid() const noexcept { return true; } | bool isVoid() const noexcept { return true; } | ||||
| @@ -86,14 +86,14 @@ public: | |||||
| class var::VariantType_Int : public var::VariantType | class var::VariantType_Int : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Int() {} | |||||
| VariantType_Int() noexcept {} | |||||
| static const VariantType_Int instance; | static const VariantType_Int instance; | ||||
| int toInt (const ValueUnion& data) const { return data.intValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return (int64) data.intValue; }; | |||||
| double toDouble (const ValueUnion& data) const { return (double) data.intValue; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return data.intValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return (int64) data.intValue; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return (double) data.intValue; } | |||||
| const String toString (const ValueUnion& data) const { return String (data.intValue); } | const String toString (const ValueUnion& data) const { return String (data.intValue); } | ||||
| bool toBool (const ValueUnion& data) const { return data.intValue != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.intValue != 0; } | |||||
| bool isInt() const noexcept { return true; } | bool isInt() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -113,14 +113,14 @@ public: | |||||
| class var::VariantType_Int64 : public var::VariantType | class var::VariantType_Int64 : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Int64() {} | |||||
| VariantType_Int64() noexcept {} | |||||
| static const VariantType_Int64 instance; | static const VariantType_Int64 instance; | ||||
| int toInt (const ValueUnion& data) const { return (int) data.int64Value; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return data.int64Value; }; | |||||
| double toDouble (const ValueUnion& data) const { return (double) data.int64Value; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return (int) data.int64Value; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return data.int64Value; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return (double) data.int64Value; } | |||||
| const String toString (const ValueUnion& data) const { return String (data.int64Value); } | const String toString (const ValueUnion& data) const { return String (data.int64Value); } | ||||
| bool toBool (const ValueUnion& data) const { return data.int64Value != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.int64Value != 0; } | |||||
| bool isInt64() const noexcept { return true; } | bool isInt64() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -140,14 +140,14 @@ public: | |||||
| class var::VariantType_Double : public var::VariantType | class var::VariantType_Double : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Double() {} | |||||
| VariantType_Double() noexcept {} | |||||
| static const VariantType_Double instance; | static const VariantType_Double instance; | ||||
| int toInt (const ValueUnion& data) const { return (int) data.doubleValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return (int64) data.doubleValue; }; | |||||
| double toDouble (const ValueUnion& data) const { return data.doubleValue; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return (int) data.doubleValue; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return (int64) data.doubleValue; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return data.doubleValue; } | |||||
| const String toString (const ValueUnion& data) const { return String (data.doubleValue); } | const String toString (const ValueUnion& data) const { return String (data.doubleValue); } | ||||
| bool toBool (const ValueUnion& data) const { return data.doubleValue != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.doubleValue != 0; } | |||||
| bool isDouble() const noexcept { return true; } | bool isDouble() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -167,14 +167,14 @@ public: | |||||
| class var::VariantType_Bool : public var::VariantType | class var::VariantType_Bool : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Bool() {} | |||||
| VariantType_Bool() noexcept {} | |||||
| static const VariantType_Bool instance; | static const VariantType_Bool instance; | ||||
| int toInt (const ValueUnion& data) const { return data.boolValue ? 1 : 0; }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return data.boolValue ? 1 : 0; }; | |||||
| double toDouble (const ValueUnion& data) const { return data.boolValue ? 1.0 : 0.0; } | |||||
| int toInt (const ValueUnion& data) const noexcept { return data.boolValue ? 1 : 0; }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return data.boolValue ? 1 : 0; }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return data.boolValue ? 1.0 : 0.0; } | |||||
| const String toString (const ValueUnion& data) const { return String::charToString (data.boolValue ? '1' : '0'); } | const String toString (const ValueUnion& data) const { return String::charToString (data.boolValue ? '1' : '0'); } | ||||
| bool toBool (const ValueUnion& data) const { return data.boolValue; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.boolValue; } | |||||
| bool isBool() const noexcept { return true; } | bool isBool() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -193,17 +193,17 @@ public: | |||||
| class var::VariantType_String : public var::VariantType | class var::VariantType_String : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_String() {} | |||||
| VariantType_String() noexcept {} | |||||
| static const VariantType_String instance; | static const VariantType_String instance; | ||||
| void cleanUp (ValueUnion& data) const noexcept { delete data.stringValue; } | void cleanUp (ValueUnion& data) const noexcept { delete data.stringValue; } | ||||
| void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.stringValue = new String (*source.stringValue); } | void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.stringValue = new String (*source.stringValue); } | ||||
| int toInt (const ValueUnion& data) const { return data.stringValue->getIntValue(); }; | |||||
| int64 toInt64 (const ValueUnion& data) const { return data.stringValue->getLargeIntValue(); }; | |||||
| double toDouble (const ValueUnion& data) const { return data.stringValue->getDoubleValue(); } | |||||
| int toInt (const ValueUnion& data) const noexcept { return data.stringValue->getIntValue(); }; | |||||
| int64 toInt64 (const ValueUnion& data) const noexcept { return data.stringValue->getLargeIntValue(); }; | |||||
| double toDouble (const ValueUnion& data) const noexcept { return data.stringValue->getDoubleValue(); } | |||||
| const String toString (const ValueUnion& data) const { return *data.stringValue; } | const String toString (const ValueUnion& data) const { return *data.stringValue; } | ||||
| bool toBool (const ValueUnion& data) const { return data.stringValue->getIntValue() != 0 | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.stringValue->getIntValue() != 0 | |||||
| || data.stringValue->trim().equalsIgnoreCase ("true") | || data.stringValue->trim().equalsIgnoreCase ("true") | ||||
| || data.stringValue->trim().equalsIgnoreCase ("yes"); } | || data.stringValue->trim().equalsIgnoreCase ("yes"); } | ||||
| bool isString() const noexcept { return true; } | bool isString() const noexcept { return true; } | ||||
| @@ -228,16 +228,16 @@ public: | |||||
| class var::VariantType_Object : public var::VariantType | class var::VariantType_Object : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Object() {} | |||||
| VariantType_Object() noexcept {} | |||||
| static const VariantType_Object instance; | static const VariantType_Object instance; | ||||
| void cleanUp (ValueUnion& data) const noexcept { if (data.objectValue != nullptr) data.objectValue->decReferenceCount(); } | |||||
| void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.objectValue = source.objectValue; if (dest.objectValue != nullptr) dest.objectValue->incReferenceCount(); } | |||||
| void cleanUp (ValueUnion& data) const noexcept { if (data.objectValue != nullptr) data.objectValue->decReferenceCount(); } | |||||
| void createCopy (ValueUnion& dest, const ValueUnion& source) const { dest.objectValue = source.objectValue; if (dest.objectValue != nullptr) dest.objectValue->incReferenceCount(); } | |||||
| const String toString (const ValueUnion& data) const { return "Object 0x" + String::toHexString ((int) (pointer_sized_int) data.objectValue); } | |||||
| bool toBool (const ValueUnion& data) const { return data.objectValue != 0; } | |||||
| DynamicObject* toObject (const ValueUnion& data) const { return data.objectValue; } | |||||
| bool isObject() const noexcept { return true; } | |||||
| const String toString (const ValueUnion& data) const { return "Object 0x" + String::toHexString ((int) (pointer_sized_int) data.objectValue); } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.objectValue != 0; } | |||||
| ReferenceCountedObject* toObject (const ValueUnion& data) const noexcept { return data.objectValue; } | |||||
| bool isObject() const noexcept { return true; } | |||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| { | { | ||||
| @@ -255,11 +255,11 @@ public: | |||||
| class var::VariantType_Method : public var::VariantType | class var::VariantType_Method : public var::VariantType | ||||
| { | { | ||||
| public: | public: | ||||
| VariantType_Method() {} | |||||
| VariantType_Method() noexcept {} | |||||
| static const VariantType_Method instance; | static const VariantType_Method instance; | ||||
| const String toString (const ValueUnion&) const { return "Method"; } | const String toString (const ValueUnion&) const { return "Method"; } | ||||
| bool toBool (const ValueUnion& data) const { return data.methodValue != 0; } | |||||
| bool toBool (const ValueUnion& data) const noexcept { return data.methodValue != 0; } | |||||
| bool isMethod() const noexcept { return true; } | bool isMethod() const noexcept { return true; } | ||||
| bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | bool equals (const ValueUnion& data, const ValueUnion& otherData, const VariantType& otherType) const noexcept | ||||
| @@ -338,7 +338,7 @@ var::var (const wchar_t* const value_) : type (&VariantType_String::instance) | |||||
| value.stringValue = new String (value_); | value.stringValue = new String (value_); | ||||
| } | } | ||||
| var::var (DynamicObject* const object) : type (&VariantType_Object::instance) | |||||
| var::var (ReferenceCountedObject* const object) : type (&VariantType_Object::instance) | |||||
| { | { | ||||
| value.objectValue = object; | value.objectValue = object; | ||||
| @@ -361,14 +361,15 @@ bool var::isString() const noexcept { return type->isString(); } | |||||
| bool var::isObject() const noexcept { return type->isObject(); } | bool var::isObject() const noexcept { return type->isObject(); } | ||||
| bool var::isMethod() const noexcept { return type->isMethod(); } | bool var::isMethod() const noexcept { return type->isMethod(); } | ||||
| var::operator int() const { return type->toInt (value); } | |||||
| var::operator int64() const { return type->toInt64 (value); } | |||||
| var::operator bool() const { return type->toBool (value); } | |||||
| var::operator float() const { return (float) type->toDouble (value); } | |||||
| var::operator double() const { return type->toDouble (value); } | |||||
| const String var::toString() const { return type->toString (value); } | |||||
| var::operator const String() const { return type->toString (value); } | |||||
| DynamicObject* var::getObject() const { return type->toObject (value); } | |||||
| var::operator int() const noexcept { return type->toInt (value); } | |||||
| var::operator int64() const noexcept { return type->toInt64 (value); } | |||||
| var::operator bool() const noexcept { return type->toBool (value); } | |||||
| var::operator float() const noexcept { return (float) type->toDouble (value); } | |||||
| var::operator double() const noexcept { return type->toDouble (value); } | |||||
| const String var::toString() const { return type->toString (value); } | |||||
| var::operator const String() const { return type->toString (value); } | |||||
| ReferenceCountedObject* var::getObject() const noexcept { return type->toObject (value); } | |||||
| DynamicObject* var::getDynamicObject() const noexcept { return dynamic_cast <DynamicObject*> (getObject()); } | |||||
| //============================================================================== | //============================================================================== | ||||
| void var::swapWith (var& other) noexcept | void var::swapWith (var& other) noexcept | ||||
| @@ -377,16 +378,16 @@ void var::swapWith (var& other) noexcept | |||||
| std::swap (value, other.value); | std::swap (value, other.value); | ||||
| } | } | ||||
| var& var::operator= (const var& newValue) { type->cleanUp (value); type = newValue.type; type->createCopy (value, newValue.value); return *this; } | |||||
| var& var::operator= (int newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (int64 newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (bool newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (double newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const char* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const wchar_t* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const String& newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (DynamicObject* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (MethodFunction newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const var& newValue) { type->cleanUp (value); type = newValue.type; type->createCopy (value, newValue.value); return *this; } | |||||
| var& var::operator= (const int newValue) { type->cleanUp (value); type = &VariantType_Int::instance; value.intValue = newValue; return *this; } | |||||
| var& var::operator= (const int64 newValue) { type->cleanUp (value); type = &VariantType_Int64::instance; value.int64Value = newValue; return *this; } | |||||
| var& var::operator= (const bool newValue) { type->cleanUp (value); type = &VariantType_Bool::instance; value.boolValue = newValue; return *this; } | |||||
| var& var::operator= (const double newValue) { type->cleanUp (value); type = &VariantType_Double::instance; value.doubleValue = newValue; return *this; } | |||||
| var& var::operator= (const char* const newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const wchar_t* const newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (const String& newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (ReferenceCountedObject* newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| var& var::operator= (MethodFunction newValue) { var v (newValue); swapWith (v); return *this; } | |||||
| //============================================================================== | //============================================================================== | ||||
| bool var::equals (const var& other) const noexcept | bool var::equals (const var& other) const noexcept | ||||
| @@ -401,8 +402,11 @@ bool var::equalsWithSameType (const var& other) const noexcept | |||||
| bool operator== (const var& v1, const var& v2) noexcept { return v1.equals (v2); } | bool operator== (const var& v1, const var& v2) noexcept { return v1.equals (v2); } | ||||
| bool operator!= (const var& v1, const var& v2) noexcept { return ! v1.equals (v2); } | bool operator!= (const var& v1, const var& v2) noexcept { return ! v1.equals (v2); } | ||||
| bool operator== (const var& v1, const String& v2) noexcept { return v1.toString() == v2; } | |||||
| bool operator!= (const var& v1, const String& v2) noexcept { return v1.toString() != v2; } | |||||
| bool operator== (const var& v1, const String& v2) { return v1.toString() == v2; } | |||||
| bool operator!= (const var& v1, const String& v2) { return v1.toString() != v2; } | |||||
| bool operator== (const var& v1, const char* const v2) { return v1.toString() == v2; } | |||||
| bool operator!= (const var& v1, const char* const v2) { return v1.toString() != v2; } | |||||
| //============================================================================== | //============================================================================== | ||||
| void var::writeToStream (OutputStream& output) const | void var::writeToStream (OutputStream& output) const | ||||
| @@ -439,13 +443,13 @@ const var var::readFromStream (InputStream& input) | |||||
| const var var::operator[] (const Identifier& propertyName) const | const var var::operator[] (const Identifier& propertyName) const | ||||
| { | { | ||||
| DynamicObject* const o = getObject(); | |||||
| DynamicObject* const o = getDynamicObject(); | |||||
| return o != nullptr ? o->getProperty (propertyName) : var::null; | return o != nullptr ? o->getProperty (propertyName) : var::null; | ||||
| } | } | ||||
| const var var::invoke (const Identifier& method, const var* arguments, int numArguments) const | const var var::invoke (const Identifier& method, const var* arguments, int numArguments) const | ||||
| { | { | ||||
| DynamicObject* const o = getObject(); | |||||
| DynamicObject* const o = getDynamicObject(); | |||||
| return o != nullptr ? o->invokeMethod (method, arguments, numArguments) : var::null; | return o != nullptr ? o->invokeMethod (method, arguments, numArguments) : var::null; | ||||
| } | } | ||||
| @@ -453,7 +457,7 @@ const var var::invoke (const var& targetObject, const var* arguments, int numArg | |||||
| { | { | ||||
| if (isMethod()) | if (isMethod()) | ||||
| { | { | ||||
| DynamicObject* const target = targetObject.getObject(); | |||||
| DynamicObject* const target = targetObject.getDynamicObject(); | |||||
| if (target != nullptr) | if (target != nullptr) | ||||
| return (target->*(value.methodValue)) (arguments, numArguments); | return (target->*(value.methodValue)) (arguments, numArguments); | ||||
| @@ -31,6 +31,7 @@ | |||||
| #include "../io/streams/juce_InputStream.h" | #include "../io/streams/juce_InputStream.h" | ||||
| #ifndef DOXYGEN | #ifndef DOXYGEN | ||||
| class ReferenceCountedObject; | |||||
| class DynamicObject; | class DynamicObject; | ||||
| #endif | #endif | ||||
| @@ -39,8 +40,8 @@ | |||||
| A variant class, that can be used to hold a range of primitive values. | A variant class, that can be used to hold a range of primitive values. | ||||
| A var object can hold a range of simple primitive values, strings, or | A var object can hold a range of simple primitive values, strings, or | ||||
| a reference-counted pointer to a DynamicObject. The var class is intended | |||||
| to act like the values used in dynamic scripting languages. | |||||
| any kind of ReferenceCountedObject. The var class is intended to act like | |||||
| the kind of values used in dynamic scripting languages. | |||||
| @see DynamicObject | @see DynamicObject | ||||
| */ | */ | ||||
| @@ -69,7 +70,7 @@ public: | |||||
| var (const char* value); | var (const char* value); | ||||
| var (const wchar_t* value); | var (const wchar_t* value); | ||||
| var (const String& value); | var (const String& value); | ||||
| var (DynamicObject* object); | |||||
| var (ReferenceCountedObject* object); | |||||
| var (MethodFunction method) noexcept; | var (MethodFunction method) noexcept; | ||||
| var& operator= (const var& valueToCopy); | var& operator= (const var& valueToCopy); | ||||
| @@ -80,19 +81,20 @@ public: | |||||
| var& operator= (const char* value); | var& operator= (const char* value); | ||||
| var& operator= (const wchar_t* value); | var& operator= (const wchar_t* value); | ||||
| var& operator= (const String& value); | var& operator= (const String& value); | ||||
| var& operator= (DynamicObject* object); | |||||
| var& operator= (ReferenceCountedObject* object); | |||||
| var& operator= (MethodFunction method); | var& operator= (MethodFunction method); | ||||
| void swapWith (var& other) noexcept; | void swapWith (var& other) noexcept; | ||||
| operator int() const; | |||||
| operator int64() const; | |||||
| operator bool() const; | |||||
| operator float() const; | |||||
| operator double() const; | |||||
| operator int() const noexcept; | |||||
| operator int64() const noexcept; | |||||
| operator bool() const noexcept; | |||||
| operator float() const noexcept; | |||||
| operator double() const noexcept; | |||||
| operator const String() const; | operator const String() const; | ||||
| const String toString() const; | const String toString() const; | ||||
| DynamicObject* getObject() const; | |||||
| ReferenceCountedObject* getObject() const noexcept; | |||||
| DynamicObject* getDynamicObject() const noexcept; | |||||
| bool isVoid() const noexcept; | bool isVoid() const noexcept; | ||||
| bool isInt() const noexcept; | bool isInt() const noexcept; | ||||
| @@ -178,7 +180,7 @@ private: | |||||
| bool boolValue; | bool boolValue; | ||||
| double doubleValue; | double doubleValue; | ||||
| String* stringValue; | String* stringValue; | ||||
| DynamicObject* objectValue; | |||||
| ReferenceCountedObject* objectValue; | |||||
| MethodFunction methodValue; | MethodFunction methodValue; | ||||
| }; | }; | ||||
| @@ -188,8 +190,10 @@ private: | |||||
| bool operator== (const var& v1, const var& v2) noexcept; | bool operator== (const var& v1, const var& v2) noexcept; | ||||
| bool operator!= (const var& v1, const var& v2) noexcept; | bool operator!= (const var& v1, const var& v2) noexcept; | ||||
| bool operator== (const var& v1, const String& v2) noexcept; | |||||
| bool operator!= (const var& v1, const String& v2) noexcept; | |||||
| bool operator== (const var& v1, const String& v2); | |||||
| bool operator!= (const var& v1, const String& v2); | |||||
| bool operator== (const var& v1, const char* v2); | |||||
| bool operator!= (const var& v1, const char* v2); | |||||
| #endif // __JUCE_VARIANT_JUCEHEADER__ | #endif // __JUCE_VARIANT_JUCEHEADER__ | ||||
| @@ -33,7 +33,7 @@ | |||||
| */ | */ | ||||
| #define JUCE_MAJOR_VERSION 1 | #define JUCE_MAJOR_VERSION 1 | ||||
| #define JUCE_MINOR_VERSION 53 | #define JUCE_MINOR_VERSION 53 | ||||
| #define JUCE_BUILDNUMBER 74 | |||||
| #define JUCE_BUILDNUMBER 75 | |||||
| /** Current Juce version number. | /** Current Juce version number. | ||||
| @@ -117,9 +117,9 @@ public: | |||||
| if (selectedRows.size() > 0) | if (selectedRows.size() > 0) | ||||
| { | { | ||||
| const String dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| const var dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| if (dragDescription.isNotEmpty()) | |||||
| if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) | |||||
| { | { | ||||
| isDragging = true; | isDragging = true; | ||||
| owner.startDragAndDrop (e, dragDescription); | owner.startDragAndDrop (e, dragDescription); | ||||
| @@ -915,7 +915,7 @@ const Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY) | |||||
| return snapshot; | return snapshot; | ||||
| } | } | ||||
| void ListBox::startDragAndDrop (const MouseEvent& e, const String& dragDescription) | |||||
| void ListBox::startDragAndDrop (const MouseEvent& e, const var& dragDescription) | |||||
| { | { | ||||
| DragAndDropContainer* const dragContainer | DragAndDropContainer* const dragContainer | ||||
| = DragAndDropContainer::findParentDragContainerFor (this); | = DragAndDropContainer::findParentDragContainerFor (this); | ||||
| @@ -952,8 +952,8 @@ void ListBoxModel::selectedRowsChanged (int) {} | |||||
| void ListBoxModel::deleteKeyPressed (int) {} | void ListBoxModel::deleteKeyPressed (int) {} | ||||
| void ListBoxModel::returnKeyPressed (int) {} | void ListBoxModel::returnKeyPressed (int) {} | ||||
| void ListBoxModel::listWasScrolled() {} | void ListBoxModel::listWasScrolled() {} | ||||
| const String ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return String::empty; } | |||||
| const String ListBoxModel::getTooltipForRow (int) { return String::empty; } | |||||
| const var ListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; } | |||||
| const String ListBoxModel::getTooltipForRow (int) { return String::empty; } | |||||
| END_JUCE_NAMESPACE | END_JUCE_NAMESPACE | ||||
| @@ -139,14 +139,14 @@ public: | |||||
| /** To allow rows from your list to be dragged-and-dropped, implement this method. | /** To allow rows from your list to be dragged-and-dropped, implement this method. | ||||
| If this returns a non-empty name then when the user drags a row, the listbox will | |||||
| If this returns a non-null variant then when the user drags a row, the listbox will | |||||
| try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | ||||
| a drag-and-drop operation, using this string as the source description, with the listbox | a drag-and-drop operation, using this string as the source description, with the listbox | ||||
| itself as the source component. | itself as the source component. | ||||
| @see DragAndDropContainer::startDragging | @see DragAndDropContainer::startDragging | ||||
| */ | */ | ||||
| virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| virtual const var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| /** You can override this to provide tool tips for specific rows. | /** You can override this to provide tool tips for specific rows. | ||||
| @see TooltipClient | @see TooltipClient | ||||
| @@ -560,7 +560,7 @@ public: | |||||
| /** @internal */ | /** @internal */ | ||||
| void colourChanged(); | void colourChanged(); | ||||
| /** @internal */ | /** @internal */ | ||||
| void startDragAndDrop (const MouseEvent& e, const String& dragDescription); | |||||
| void startDragAndDrop (const MouseEvent& e, const var& dragDescription); | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -168,9 +168,9 @@ public: | |||||
| if (selectedRows.size() > 0) | if (selectedRows.size() > 0) | ||||
| { | { | ||||
| const String dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| const var dragDescription (owner.getModel()->getDragSourceDescription (selectedRows)); | |||||
| if (dragDescription.isNotEmpty()) | |||||
| if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) | |||||
| { | { | ||||
| isDragging = true; | isDragging = true; | ||||
| owner.startDragAndDrop (e, dragDescription); | owner.startDragAndDrop (e, dragDescription); | ||||
| @@ -490,7 +490,7 @@ void TableListBoxModel::returnKeyPressed (int) {} | |||||
| void TableListBoxModel::listWasScrolled() {} | void TableListBoxModel::listWasScrolled() {} | ||||
| const String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; } | const String TableListBoxModel::getCellTooltip (int /*rowNumber*/, int /*columnId*/) { return String::empty; } | ||||
| const String TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return String::empty; } | |||||
| const var TableListBoxModel::getDragSourceDescription (const SparseSet<int>&) { return var::null; } | |||||
| Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate) | Component* TableListBoxModel::refreshComponentForCell (int, int, bool, Component* existingComponentToUpdate) | ||||
| { | { | ||||
| @@ -176,14 +176,14 @@ public: | |||||
| /** To allow rows from your table to be dragged-and-dropped, implement this method. | /** To allow rows from your table to be dragged-and-dropped, implement this method. | ||||
| If this returns a non-empty name then when the user drags a row, the table will try to | |||||
| If this returns a non-null variant then when the user drags a row, the table will try to | |||||
| find a DragAndDropContainer in its parent hierarchy, and will use it to trigger a | find a DragAndDropContainer in its parent hierarchy, and will use it to trigger a | ||||
| drag-and-drop operation, using this string as the source description, and the listbox | drag-and-drop operation, using this string as the source description, and the listbox | ||||
| itself as the source component. | itself as the source component. | ||||
| @see DragAndDropContainer::startDragging | |||||
| @see getDragSourceCustomData, DragAndDropContainer::startDragging | |||||
| */ | */ | ||||
| virtual const String getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| virtual const var getDragSourceDescription (const SparseSet<int>& currentlySelectedRows); | |||||
| }; | }; | ||||
| @@ -124,9 +124,9 @@ public: | |||||
| if (item != nullptr && e.getMouseDownX() >= pos.getX()) | if (item != nullptr && e.getMouseDownX() >= pos.getX()) | ||||
| { | { | ||||
| const String dragDescription (item->getDragSourceDescription()); | |||||
| const var dragDescription (item->getDragSourceDescription()); | |||||
| if (dragDescription.isNotEmpty()) | |||||
| if (! (dragDescription.isVoid() || (dragDescription.isString() && dragDescription.toString().isEmpty()))) | |||||
| { | { | ||||
| DragAndDropContainer* const dragContainer | DragAndDropContainer* const dragContainer | ||||
| = DragAndDropContainer::findParentDragContainerFor (this); | = DragAndDropContainer::findParentDragContainerFor (this); | ||||
| @@ -1291,9 +1291,9 @@ const String TreeViewItem::getTooltip() | |||||
| return String::empty; | return String::empty; | ||||
| } | } | ||||
| const String TreeViewItem::getDragSourceDescription() | |||||
| const var TreeViewItem::getDragSourceDescription() | |||||
| { | { | ||||
| return String::empty; | |||||
| return var::null; | |||||
| } | } | ||||
| bool TreeViewItem::isInterestedInFileDrag (const StringArray&) | bool TreeViewItem::isInterestedInFileDrag (const StringArray&) | ||||
| @@ -340,7 +340,7 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| /** To allow items from your treeview to be dragged-and-dropped, implement this method. | /** To allow items from your treeview to be dragged-and-dropped, implement this method. | ||||
| If this returns a non-empty name then when the user drags an item, the treeview will | |||||
| If this returns a non-null variant then when the user drags an item, the treeview will | |||||
| try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger | ||||
| a drag-and-drop operation, using this string as the source description, with the treeview | a drag-and-drop operation, using this string as the source description, with the treeview | ||||
| itself as the source component. | itself as the source component. | ||||
| @@ -353,7 +353,7 @@ public: | |||||
| @see DragAndDropContainer::startDragging | @see DragAndDropContainer::startDragging | ||||
| */ | */ | ||||
| virtual const String getDragSourceDescription(); | |||||
| virtual const var getDragSourceDescription(); | |||||
| /** If you want your item to be able to have files drag-and-dropped onto it, implement this | /** If you want your item to be able to have files drag-and-dropped onto it, implement this | ||||
| method and return true. | method and return true. | ||||
| @@ -86,7 +86,7 @@ public: | |||||
| const String getUniqueName() const { return file.getFullPathName(); } | const String getUniqueName() const { return file.getFullPathName(); } | ||||
| int getItemHeight() const { return 22; } | int getItemHeight() const { return 22; } | ||||
| const String getDragSourceDescription() { return owner.getDragAndDropDescription(); } | |||||
| const var getDragSourceDescription() { return owner.getDragAndDropDescription(); } | |||||
| void itemOpennessChanged (bool isNowOpen) | void itemOpennessChanged (bool isNowOpen) | ||||
| { | { | ||||
| @@ -132,7 +132,7 @@ public: | |||||
| int topLevelMenuIndex) = 0; | int topLevelMenuIndex) = 0; | ||||
| //============================================================================== | //============================================================================== | ||||
| #if JUCE_MAC || DOXYGEN | |||||
| #if JUCE_MAC || DOXYGEN | |||||
| /** MAC ONLY - Sets the model that is currently being shown as the main | /** MAC ONLY - Sets the model that is currently being shown as the main | ||||
| menu bar at the top of the screen on the Mac. | menu bar at the top of the screen on the Mac. | ||||
| @@ -154,8 +154,7 @@ public: | |||||
| the main menu bar. | the main menu bar. | ||||
| */ | */ | ||||
| static MenuBarModel* getMacMainMenu(); | static MenuBarModel* getMacMainMenu(); | ||||
| #endif | |||||
| #endif | |||||
| //============================================================================== | //============================================================================== | ||||
| /** @internal */ | /** @internal */ | ||||
| @@ -731,14 +731,16 @@ private: | |||||
| { | { | ||||
| const Rectangle<int> mon (Desktop::getInstance() | const Rectangle<int> mon (Desktop::getInstance() | ||||
| .getMonitorAreaContaining (target.getCentre(), | .getMonitorAreaContaining (target.getCentre(), | ||||
| #if JUCE_MAC | |||||
| #if JUCE_MAC | |||||
| true)); | true)); | ||||
| #else | |||||
| #else | |||||
| false)); // on windows, don't stop the menu overlapping the taskbar | false)); // on windows, don't stop the menu overlapping the taskbar | ||||
| #endif | |||||
| #endif | |||||
| const int maxMenuHeight = mon.getHeight() - 24; | |||||
| int x, y, widthToUse, heightToUse; | int x, y, widthToUse, heightToUse; | ||||
| layoutMenuItems (mon.getWidth() - 24, widthToUse, heightToUse); | |||||
| layoutMenuItems (mon.getWidth() - 24, maxMenuHeight, widthToUse, heightToUse); | |||||
| if (alignToRectangle) | if (alignToRectangle) | ||||
| { | { | ||||
| @@ -779,10 +781,10 @@ private: | |||||
| if (biggestSpace < widthToUse) | if (biggestSpace < widthToUse) | ||||
| { | { | ||||
| layoutMenuItems (biggestSpace + target.getWidth() / 3, widthToUse, heightToUse); | |||||
| layoutMenuItems (biggestSpace + target.getWidth() / 3, maxMenuHeight, widthToUse, heightToUse); | |||||
| if (numColumns > 1) | if (numColumns > 1) | ||||
| layoutMenuItems (biggestSpace - 4, widthToUse, heightToUse); | |||||
| layoutMenuItems (biggestSpace - 4, maxMenuHeight, widthToUse, heightToUse); | |||||
| tendTowardsRight = (mon.getRight() - target.getRight()) >= (target.getX() - mon.getX()); | tendTowardsRight = (mon.getRight() - target.getRight()) >= (target.getX() - mon.getX()); | ||||
| } | } | ||||
| @@ -807,11 +809,10 @@ private: | |||||
| && owner->windowPos.intersects (windowPos.expanded (-4, -4)); | && owner->windowPos.intersects (windowPos.expanded (-4, -4)); | ||||
| } | } | ||||
| void layoutMenuItems (const int maxMenuW, int& width, int& height) | |||||
| void layoutMenuItems (const int maxMenuW, const int maxMenuH, int& width, int& height) | |||||
| { | { | ||||
| numColumns = 0; | numColumns = 0; | ||||
| contentHeight = 0; | contentHeight = 0; | ||||
| const int maxMenuH = getParentHeight() - 24; | |||||
| int totalW; | int totalW; | ||||
| do | do | ||||
| @@ -47,13 +47,12 @@ class DragImageComponent : public Component, | |||||
| { | { | ||||
| public: | public: | ||||
| DragImageComponent (const Image& im, | DragImageComponent (const Image& im, | ||||
| const String& desc, | |||||
| const var& desc, | |||||
| Component* const sourceComponent, | Component* const sourceComponent, | ||||
| Component* const mouseDragSource_, | Component* const mouseDragSource_, | ||||
| DragAndDropContainer* const o, | DragAndDropContainer* const o, | ||||
| const Point<int>& imageOffset_, | |||||
| ReferenceCountedObject* const customDataObject) | |||||
| : sourceDetails (desc, sourceComponent, Point<int>(), customDataObject), | |||||
| const Point<int>& imageOffset_) | |||||
| : sourceDetails (desc, sourceComponent, Point<int>()), | |||||
| image (im), | image (im), | ||||
| mouseDragSource (mouseDragSource_), | mouseDragSource (mouseDragSource_), | ||||
| owner (o), | owner (o), | ||||
| @@ -319,12 +318,11 @@ DragAndDropContainer::~DragAndDropContainer() | |||||
| dragImageComponent = nullptr; | dragImageComponent = nullptr; | ||||
| } | } | ||||
| void DragAndDropContainer::startDragging (const String& sourceDescription, | |||||
| void DragAndDropContainer::startDragging (const var& sourceDescription, | |||||
| Component* sourceComponent, | Component* sourceComponent, | ||||
| const Image& dragImage_, | const Image& dragImage_, | ||||
| const bool allowDraggingToExternalWindows, | const bool allowDraggingToExternalWindows, | ||||
| const Point<int>* imageOffsetFromMouse, | |||||
| ReferenceCountedObject* customDataObject) | |||||
| const Point<int>* imageOffsetFromMouse) | |||||
| { | { | ||||
| Image dragImage (dragImage_); | Image dragImage (dragImage_); | ||||
| @@ -393,8 +391,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription, | |||||
| } | } | ||||
| dragImageComponent = new DragImageComponent (dragImage, sourceDescription, sourceComponent, | dragImageComponent = new DragImageComponent (dragImage, sourceDescription, sourceComponent, | ||||
| draggingSource->getComponentUnderMouse(), this, | |||||
| imageOffset, customDataObject); | |||||
| draggingSource->getComponentUnderMouse(), this, imageOffset); | |||||
| currentDragDesc = sourceDescription; | currentDragDesc = sourceDescription; | ||||
| @@ -445,12 +442,10 @@ bool DragAndDropContainer::shouldDropFilesWhenDraggedExternally (const DragAndDr | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| DragAndDropTarget::SourceDetails::SourceDetails (const String& description_, Component* sourceComponent_, | |||||
| const Point<int>& localPosition_, ReferenceCountedObject* const customDataObject_) noexcept | |||||
| DragAndDropTarget::SourceDetails::SourceDetails (const var& description_, Component* sourceComponent_, const Point<int>& localPosition_) noexcept | |||||
| : description (description_), | : description (description_), | ||||
| sourceComponent (sourceComponent_), | sourceComponent (sourceComponent_), | ||||
| localPosition (localPosition_), | |||||
| customDataObject (customDataObject_) | |||||
| localPosition (localPosition_) | |||||
| { | { | ||||
| } | } | ||||
| @@ -73,8 +73,8 @@ public: | |||||
| findParentDragContainerFor() is a handy method to call to find the | findParentDragContainerFor() is a handy method to call to find the | ||||
| drag container to use for a component. | drag container to use for a component. | ||||
| @param sourceDescription a string to use as the description of the thing being dragged - this | |||||
| will be passed to the objects that might be dropped-onto so they can | |||||
| @param sourceDescription a string or value to use as the description of the thing being dragged - | |||||
| this will be passed to the objects that might be dropped-onto so they can | |||||
| decide whether they want to handle it | decide whether they want to handle it | ||||
| @param sourceComponent the component that is being dragged | @param sourceComponent the component that is being dragged | ||||
| @param dragImage the image to drag around underneath the mouse. If this is a null image, | @param dragImage the image to drag around underneath the mouse. If this is a null image, | ||||
| @@ -86,16 +86,12 @@ public: | |||||
| at which the image should be drawn from the mouse. If it isn't | at which the image should be drawn from the mouse. If it isn't | ||||
| specified, then the image will be centred around the mouse. If | specified, then the image will be centred around the mouse. If | ||||
| an image hasn't been passed-in, this will be ignored. | an image hasn't been passed-in, this will be ignored. | ||||
| @param customDataObject Any kind of reference-counted object which you want to have passed to | |||||
| the target component. A pointer to this object will be made available | |||||
| to the targets in the DragAndDropTarget::SourceDetails class. | |||||
| */ | */ | ||||
| void startDragging (const String& sourceDescription, | |||||
| void startDragging (const var& sourceDescription, | |||||
| Component* sourceComponent, | Component* sourceComponent, | ||||
| const Image& dragImage = Image::null, | const Image& dragImage = Image::null, | ||||
| bool allowDraggingToOtherJuceWindows = false, | bool allowDraggingToOtherJuceWindows = false, | ||||
| const Point<int>* imageOffsetFromMouse = nullptr, | |||||
| ReferenceCountedObject* customDataObject = nullptr); | |||||
| const Point<int>* imageOffsetFromMouse = nullptr); | |||||
| /** Returns true if something is currently being dragged. */ | /** Returns true if something is currently being dragged. */ | ||||
| bool isDragAndDropActive() const; | bool isDragAndDropActive() const; | ||||
| @@ -163,17 +159,14 @@ protected: | |||||
| and if you want it to then perform a file drag-and-drop, add the filenames you want | and if you want it to then perform a file drag-and-drop, add the filenames you want | ||||
| to the array passed in, and return true. | to the array passed in, and return true. | ||||
| @param dragSourceDescription the description passed into the startDrag() call when the drag began | |||||
| @param dragSourceComponent the component passed into the startDrag() call when the drag began | |||||
| @param files on return, the filenames you want to drag | |||||
| @param canMoveFiles on return, true if it's ok for the receiver to move the files; false if | |||||
| it must make a copy of them (see the performExternalDragDropOfFiles() | |||||
| method) | |||||
| @param sourceDetails information about the source of the drag operation | |||||
| @param files on return, the filenames you want to drag | |||||
| @param canMoveFiles on return, true if it's ok for the receiver to move the files; false if | |||||
| it must make a copy of them (see the performExternalDragDropOfFiles() method) | |||||
| @see performExternalDragDropOfFiles | @see performExternalDragDropOfFiles | ||||
| */ | */ | ||||
| virtual bool shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails, | virtual bool shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails, | ||||
| StringArray& files, | |||||
| bool& canMoveFiles); | |||||
| StringArray& files, bool& canMoveFiles); | |||||
| private: | private: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -57,11 +57,10 @@ public: | |||||
| { | { | ||||
| public: | public: | ||||
| /** Creates a SourceDetails object from its various settings. */ | /** Creates a SourceDetails object from its various settings. */ | ||||
| SourceDetails (const String& description, Component* sourceComponent, | |||||
| const Point<int>& localPosition, ReferenceCountedObject* customDataObject = nullptr) noexcept; | |||||
| SourceDetails (const var& description, Component* sourceComponent, const Point<int>& localPosition) noexcept; | |||||
| /** A descriptor string - this is set DragAndDropContainer::startDragging(). */ | |||||
| String description; | |||||
| /** A descriptor for the drag - this is set DragAndDropContainer::startDragging(). */ | |||||
| var description; | |||||
| /** The component from the drag operation was started. */ | /** The component from the drag operation was started. */ | ||||
| WeakReference<Component> sourceComponent; | WeakReference<Component> sourceComponent; | ||||
| @@ -70,12 +69,6 @@ public: | |||||
| Note that for calls such as isInterestedInDragSource(), this may be a null position. | Note that for calls such as isInterestedInDragSource(), this may be a null position. | ||||
| */ | */ | ||||
| Point<int> localPosition; | Point<int> localPosition; | ||||
| /** A pointer to a user-supplied object which contains some kind of data which is relevant to | |||||
| the specific classes which are being used. Make sure that you check the type of this object, | |||||
| and safely dynamic_cast it to your required type. | |||||
| */ | |||||
| ReferenceCountedObjectPtr<ReferenceCountedObject> customDataObject; | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||