Browse Source

Tweaked OS file drag-and-drop to ignore unwanted file types. Minor structural fixes. Changes to avoid cancellation of ThreadWithAlertWindow and for Linux openGL rendering.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
3871c8d6d1
25 changed files with 461 additions and 509 deletions
  1. +1
    -2
      extras/Introjucer/Source/Project/jucer_Project.cpp
  2. +219
    -179
      juce_amalgamated.cpp
  3. +19
    -4
      juce_amalgamated.h
  4. +1
    -1
      src/audio/plugin_host/juce_PluginDirectoryScanner.cpp
  5. +0
    -138
      src/core/juce_Initialisation.cpp
  6. +1
    -1
      src/core/juce_StandardHeader.h
  7. +13
    -1
      src/gui/components/special/juce_OpenGLComponent.cpp
  8. +10
    -7
      src/gui/components/windows/juce_AlertWindow.cpp
  9. +9
    -0
      src/gui/components/windows/juce_AlertWindow.h
  10. +15
    -11
      src/gui/components/windows/juce_ComponentPeer.cpp
  11. +3
    -3
      src/gui/components/windows/juce_ComponentPeer.h
  12. +3
    -0
      src/gui/components/windows/juce_ThreadWithProgressWindow.cpp
  13. +5
    -0
      src/io/files/juce_File.cpp
  14. +5
    -0
      src/io/files/juce_File.h
  15. +1
    -1
      src/native/linux/juce_linux_SystemStats.cpp
  16. +23
    -0
      src/native/mac/juce_mac_CoreGraphicsContext.mm
  17. +3
    -5
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  18. +0
    -19
      src/native/mac/juce_osx_ObjCHelpers.h
  19. +46
    -46
      src/native/windows/juce_win32_ActiveXComponent.cpp
  20. +9
    -9
      src/native/windows/juce_win32_AudioCDReader.cpp
  21. +9
    -6
      src/native/windows/juce_win32_ComSmartPtr.h
  22. +8
    -8
      src/native/windows/juce_win32_WASAPI.cpp
  23. +5
    -5
      src/native/windows/juce_win32_WebBrowserComponent.cpp
  24. +52
    -63
      src/native/windows/juce_win32_Windowing.cpp
  25. +1
    -0
      src/utilities/juce_WindowsRegistry.h

+ 1
- 2
extras/Introjucer/Source/Project/jucer_Project.cpp View File

@@ -833,9 +833,8 @@ void Project::getJuceConfigFlags (OwnedArray <JuceConfigFlag>& flags)
{
ValueTree configNode (getJuceConfigNode());
File juceConfigH (getLocalJuceFolder().getChildFile ("juce_Config.h"));
StringArray lines;
lines.addLines (juceConfigH.loadFileAsString());
getLocalJuceFolder().getChildFile ("juce_Config.h").readLines (lines);
for (int i = 0; i < lines.size(); ++i)
{


+ 219
- 179
juce_amalgamated.cpp View File

@@ -716,11 +716,11 @@ public:

HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER)
{
#ifndef __MINGW32__
#ifndef __MINGW32__
return ::CoCreateInstance (classUUID, 0, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress());
#else
#else
return E_NOTIMPL;
#endif
#endif
}

template <class OtherComClass>
@@ -746,6 +746,8 @@ private:
ComClass** operator&() throw(); // private to avoid it being used accidentally
};

#define JUCE_COMRESULT HRESULT __stdcall

/** Handy base class for writing COM objects, providing ref-counting and a basic QueryInterface method.
*/
template <class ComClass>
@@ -755,11 +757,11 @@ public:
ComBaseClassHelper() : refCount (1) {}
virtual ~ComBaseClassHelper() {}

HRESULT __stdcall QueryInterface (REFIID refId, void** result)
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
#ifndef __MINGW32__
#ifndef __MINGW32__
if (refId == __uuidof (ComClass)) { AddRef(); *result = dynamic_cast <ComClass*> (this); return S_OK; }
#endif
#endif

if (refId == IID_IUnknown) { AddRef(); *result = dynamic_cast <IUnknown*> (this); return S_OK; }

@@ -8007,6 +8009,11 @@ String File::loadFileAsString() const
return in.readEntireStreamAsString();
}

void File::readLines (StringArray& destLines) const
{
destLines.addLines (loadFileAsString());
}

int File::findChildFiles (Array<File>& results,
const int whatToLookFor,
const bool searchRecursively,
@@ -32243,7 +32250,7 @@ StringArray PluginDirectoryScanner::getDeadMansPedalFile()

if (deadMansPedalFile != File::nonexistent)
{
lines.addLines (deadMansPedalFile.loadFileAsString());
deadMansPedalFile.readLines (lines);
lines.removeEmptyStrings();
}

@@ -78072,6 +78079,18 @@ public:

void run()
{
#if JUCE_LINUX
{
MessageManagerLock mml (this);

if (! mml.lockWasGained())
return;

owner.updateContext();
owner.updateContextPosition();
}
#endif

while (! threadShouldExit())
{
const uint32 startOfRendering = Time::getMillisecondCounter();
@@ -78529,7 +78548,8 @@ AlertWindow::AlertWindow (const String& title,
Component* associatedComponent_)
: TopLevelWindow (title, true),
alertIconType (iconType),
associatedComponent (associatedComponent_)
associatedComponent (associatedComponent_),
escapeKeyCancels (true)
{
if (message.isEmpty())
text = " "; // to force an update if the message is empty
@@ -78562,7 +78582,8 @@ AlertWindow::~AlertWindow()

void AlertWindow::userTriedToCloseWindow()
{
exitModalState (0);
if (escapeKeyCancels || buttons.size() > 0)
exitModalState (0);
}

void AlertWindow::setMessage (const String& message)
@@ -78631,6 +78652,11 @@ void AlertWindow::triggerButtonClick (const String& buttonName)
}
}

void AlertWindow::setEscapeKeyCancels (bool shouldEscapeKeyCancel)
{
escapeKeyCancels = shouldEscapeKeyCancel;
}

void AlertWindow::addTextEditor (const String& name,
const String& initialContents,
const String& onScreenLabel,
@@ -78715,10 +78741,6 @@ public:
setColour (TextEditor::shadowColourId, Colours::transparentBlack);
}

~AlertTextComp()
{
}

int getPreferredWidth() const noexcept { return bestWidth; }

void updateLayout (const int width)
@@ -79013,7 +79035,7 @@ bool AlertWindow::keyPressed (const KeyPress& key)
}
}

if (key.isKeyCode (KeyPress::escapeKey) && buttons.size() == 0)
if (key.isKeyCode (KeyPress::escapeKey) && escapeKeyCancels && buttons.size() == 0)
{
exitModalState (0);
return true;
@@ -79832,7 +79854,7 @@ namespace ComponentPeerHelpers
}
}

void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<int>& position)
bool ComponentPeer::handleFileDragMove (const StringArray& files, const Point<int>& position)
{
updateCurrentModifiers();

@@ -79868,21 +79890,22 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<in
newTarget = lastTarget;
}

if (newTarget != nullptr)
{
Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (targetComp->getLocalPoint (component, position));
if (newTarget == nullptr)
return false;

newTarget->fileDragMove (files, pos.getX(), pos.getY());
}
Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (targetComp->getLocalPoint (component, position));
newTarget->fileDragMove (files, pos.getX(), pos.getY());
return true;
}

void ComponentPeer::handleFileDragExit (const StringArray& files)
bool ComponentPeer::handleFileDragExit (const StringArray& files)
{
handleFileDragMove (files, Point<int> (-1, -1));
const bool used = handleFileDragMove (files, Point<int> (-1, -1));

jassert (dragAndDropTargetComponent == nullptr);
lastDragAndDropCompUnderMouse = nullptr;
return used;
}

// We'll use an async message to deliver the drop, because if the target decides
@@ -79911,7 +79934,7 @@ private:
JUCE_DECLARE_NON_COPYABLE (AsyncFileDropMessage);
};

void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position)
bool ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position)
{
handleFileDragMove (files, position);

@@ -79932,12 +79955,15 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
targetComp->internalModalInputAttempt();

if (targetComp->isCurrentlyBlockedByAnotherModalComponent())
return;
return true;
}

(new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post();
return true;
}
}

return false;
}

void ComponentPeer::handleUserClosingWindow()
@@ -81123,6 +81149,9 @@ ThreadWithProgressWindow::ThreadWithProgressWindow (const String& title,
String::empty, String::empty,
AlertWindow::NoIcon, hasCancelButton ? 1 : 0, 0);

// if there are no buttons, we won't allow the user to interrupt the thread.
alertWindow->setEscapeKeyCancels (false);

if (hasProgressBar)
alertWindow->addProgressBarComponent (progress);
}
@@ -250308,39 +250337,58 @@ private:
{
}

HRESULT __stdcall DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
JUCE_COMRESULT DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
updateFileList (pDataObject);
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
const bool wasWanted = owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = wasWanted ? DROPEFFECT_COPY : DROPEFFECT_NONE;
return wasWanted ? S_OK : S_FALSE;
}

HRESULT __stdcall DragLeave()
JUCE_COMRESULT DragLeave()
{
owner->handleFileDragExit (files);
return S_OK;
}

HRESULT __stdcall DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
JUCE_COMRESULT DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
const bool wasWanted = owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = wasWanted ? DROPEFFECT_COPY : DROPEFFECT_NONE;
return wasWanted ? S_OK : S_FALSE;
}

HRESULT __stdcall Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
JUCE_COMRESULT Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
updateFileList (pDataObject);
owner->handleFileDragDrop (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
const bool wasWanted = owner->handleFileDragDrop (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = wasWanted ? DROPEFFECT_COPY : DROPEFFECT_NONE;
return wasWanted ? S_OK : S_FALSE;
}

private:
Win32ComponentPeer* const owner;
StringArray files;

template <typename CharType>
void parseFileList (const CharType* names, const SIZE_T totalLen)
{
unsigned int i = 0;

for (;;)
{
unsigned int len = 0;
while (i + len < totalLen && names [i + len] != 0)
++len;

if (len == 0)
break;

files.add (String (names + i, len));
i += len + 1;
}
}

void updateFileList (IDataObject* const pDataObject)
{
files.clear();
@@ -250351,43 +250399,13 @@ private:
if (pDataObject->GetData (&format, &medium) == S_OK)
{
const SIZE_T totalLen = GlobalSize (medium.hGlobal);
const LPDROPFILES pDropFiles = (const LPDROPFILES) GlobalLock (medium.hGlobal);
unsigned int i = 0;

if (pDropFiles->fWide)
{
const WCHAR* const fname = (WCHAR*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));

for (;;)
{
unsigned int len = 0;
while (i + len < totalLen && fname [i + len] != 0)
++len;

if (len == 0)
break;
const LPDROPFILES dropFiles = (const LPDROPFILES) GlobalLock (medium.hGlobal);
const void* const names = addBytesToPointer (dropFiles, sizeof (DROPFILES));

files.add (String (fname + i, len));
i += len + 1;
}
}
if (dropFiles->fWide)
parseFileList (static_cast <const WCHAR*> (names), totalLen);
else
{
const char* const fname = (const char*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));

for (;;)
{
unsigned int len = 0;
while (i + len < totalLen && fname [i + len] != 0)
++len;

if (len == 0)
break;

files.add (String (fname + i, len));
i += len + 1;
}
}
parseFileList (static_cast <const char*> (names), totalLen);

GlobalUnlock (medium.hGlobal);
}
@@ -251547,7 +251565,7 @@ class JuceDropSource : public ComBaseClassHelper <IDropSource>
public:
JuceDropSource() {}

HRESULT __stdcall QueryContinueDrag (BOOL escapePressed, DWORD keys)
JUCE_COMRESULT QueryContinueDrag (BOOL escapePressed, DWORD keys)
{
if (escapePressed)
return DRAGDROP_S_CANCEL;
@@ -251558,7 +251576,7 @@ public:
return S_OK;
}

HRESULT __stdcall GiveFeedback (DWORD)
JUCE_COMRESULT GiveFeedback (DWORD)
{
return DRAGDROP_S_USEDEFAULTCURSORS;
}
@@ -251573,7 +251591,7 @@ public:
{
}

HRESULT __stdcall Clone (IEnumFORMATETC** result)
JUCE_COMRESULT Clone (IEnumFORMATETC** result)
{
if (result == 0)
return E_POINTER;
@@ -251585,7 +251603,7 @@ public:
return S_OK;
}

HRESULT __stdcall Next (ULONG celt, LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
JUCE_COMRESULT Next (ULONG celt, LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
{
if (pceltFetched != nullptr)
*pceltFetched = 0;
@@ -251606,7 +251624,7 @@ public:
return S_FALSE;
}

HRESULT __stdcall Skip (ULONG celt)
JUCE_COMRESULT Skip (ULONG celt)
{
if (index + (int) celt >= 1)
return S_FALSE;
@@ -251615,7 +251633,7 @@ public:
return S_OK;
}

HRESULT __stdcall Reset()
JUCE_COMRESULT Reset()
{
index = 0;
return S_OK;
@@ -251656,7 +251674,7 @@ public:
jassert (refCount == 0);
}

HRESULT __stdcall GetData (FORMATETC* pFormatEtc, STGMEDIUM* pMedium)
JUCE_COMRESULT GetData (FORMATETC* pFormatEtc, STGMEDIUM* pMedium)
{
if ((pFormatEtc->tymed & format->tymed) != 0
&& pFormatEtc->cfFormat == format->cfFormat
@@ -251683,7 +251701,7 @@ public:
return DV_E_FORMATETC;
}

HRESULT __stdcall QueryGetData (FORMATETC* f)
JUCE_COMRESULT QueryGetData (FORMATETC* f)
{
if (f == 0)
return E_INVALIDARG;
@@ -251696,13 +251714,13 @@ public:
return DV_E_FORMATETC;
}

HRESULT __stdcall GetCanonicalFormatEtc (FORMATETC*, FORMATETC* pFormatEtcOut)
JUCE_COMRESULT GetCanonicalFormatEtc (FORMATETC*, FORMATETC* pFormatEtcOut)
{
pFormatEtcOut->ptd = 0;
return E_NOTIMPL;
}

HRESULT __stdcall EnumFormatEtc (DWORD direction, IEnumFORMATETC** result)
JUCE_COMRESULT EnumFormatEtc (DWORD direction, IEnumFORMATETC** result)
{
if (result == 0)
return E_POINTER;
@@ -251717,11 +251735,11 @@ public:
return E_NOTIMPL;
}

HRESULT __stdcall GetDataHere (FORMATETC*, STGMEDIUM*) { return DATA_E_FORMATETC; }
HRESULT __stdcall SetData (FORMATETC*, STGMEDIUM*, BOOL) { return E_NOTIMPL; }
HRESULT __stdcall DAdvise (FORMATETC*, DWORD, IAdviseSink*, DWORD*) { return OLE_E_ADVISENOTSUPPORTED; }
HRESULT __stdcall DUnadvise (DWORD) { return E_NOTIMPL; }
HRESULT __stdcall EnumDAdvise (IEnumSTATDATA**) { return OLE_E_ADVISENOTSUPPORTED; }
JUCE_COMRESULT GetDataHere (FORMATETC*, STGMEDIUM*) { return DATA_E_FORMATETC; }
JUCE_COMRESULT SetData (FORMATETC*, STGMEDIUM*, BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT DAdvise (FORMATETC*, DWORD, IAdviseSink*, DWORD*) { return OLE_E_ADVISENOTSUPPORTED; }
JUCE_COMRESULT DUnadvise (DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT EnumDAdvise (IEnumSTATDATA**) { return OLE_E_ADVISENOTSUPPORTED; }

private:
JuceDropSource* const dropSource;
@@ -252120,21 +252138,21 @@ namespace ActiveXHelpers
public:
JuceIStorage() {}

HRESULT __stdcall CreateStream (const WCHAR*, DWORD, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
HRESULT __stdcall OpenStream (const WCHAR*, void*, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
HRESULT __stdcall CreateStorage (const WCHAR*, DWORD, DWORD, DWORD, IStorage**) { return E_NOTIMPL; }
HRESULT __stdcall OpenStorage (const WCHAR*, IStorage*, DWORD, SNB, DWORD, IStorage**) { return E_NOTIMPL; }
HRESULT __stdcall CopyTo (DWORD, IID const*, SNB, IStorage*) { return E_NOTIMPL; }
HRESULT __stdcall MoveElementTo (const OLECHAR*,IStorage*, const OLECHAR*, DWORD) { return E_NOTIMPL; }
HRESULT __stdcall Commit (DWORD) { return E_NOTIMPL; }
HRESULT __stdcall Revert() { return E_NOTIMPL; }
HRESULT __stdcall EnumElements (DWORD, void*, DWORD, IEnumSTATSTG**) { return E_NOTIMPL; }
HRESULT __stdcall DestroyElement (const OLECHAR*) { return E_NOTIMPL; }
HRESULT __stdcall RenameElement (const WCHAR*, const WCHAR*) { return E_NOTIMPL; }
HRESULT __stdcall SetElementTimes (const WCHAR*, FILETIME const*, FILETIME const*, FILETIME const*) { return E_NOTIMPL; }
HRESULT __stdcall SetClass (REFCLSID) { return S_OK; }
HRESULT __stdcall SetStateBits (DWORD, DWORD) { return E_NOTIMPL; }
HRESULT __stdcall Stat (STATSTG*, DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT CreateStream (const WCHAR*, DWORD, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
JUCE_COMRESULT OpenStream (const WCHAR*, void*, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
JUCE_COMRESULT CreateStorage (const WCHAR*, DWORD, DWORD, DWORD, IStorage**) { return E_NOTIMPL; }
JUCE_COMRESULT OpenStorage (const WCHAR*, IStorage*, DWORD, SNB, DWORD, IStorage**) { return E_NOTIMPL; }
JUCE_COMRESULT CopyTo (DWORD, IID const*, SNB, IStorage*) { return E_NOTIMPL; }
JUCE_COMRESULT MoveElementTo (const OLECHAR*,IStorage*, const OLECHAR*, DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT Commit (DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT Revert() { return E_NOTIMPL; }
JUCE_COMRESULT EnumElements (DWORD, void*, DWORD, IEnumSTATSTG**) { return E_NOTIMPL; }
JUCE_COMRESULT DestroyElement (const OLECHAR*) { return E_NOTIMPL; }
JUCE_COMRESULT RenameElement (const WCHAR*, const WCHAR*) { return E_NOTIMPL; }
JUCE_COMRESULT SetElementTimes (const WCHAR*, FILETIME const*, FILETIME const*, FILETIME const*) { return E_NOTIMPL; }
JUCE_COMRESULT SetClass (REFCLSID) { return S_OK; }
JUCE_COMRESULT SetStateBits (DWORD, DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT Stat (STATSTG*, DWORD) { return E_NOTIMPL; }
};

class JuceOleInPlaceFrame : public ComBaseClassHelper <IOleInPlaceFrame>
@@ -252142,18 +252160,18 @@ namespace ActiveXHelpers
public:
JuceOleInPlaceFrame (HWND window_) : window (window_) {}

HRESULT __stdcall GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
HRESULT __stdcall ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
HRESULT __stdcall GetBorder (LPRECT) { return E_NOTIMPL; }
HRESULT __stdcall RequestBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
HRESULT __stdcall SetBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
HRESULT __stdcall SetActiveObject (IOleInPlaceActiveObject*, LPCOLESTR) { return S_OK; }
HRESULT __stdcall InsertMenus (HMENU, LPOLEMENUGROUPWIDTHS) { return E_NOTIMPL; }
HRESULT __stdcall SetMenu (HMENU, HOLEMENU, HWND) { return S_OK; }
HRESULT __stdcall RemoveMenus (HMENU) { return E_NOTIMPL; }
HRESULT __stdcall SetStatusText (LPCOLESTR) { return S_OK; }
HRESULT __stdcall EnableModeless (BOOL) { return S_OK; }
HRESULT __stdcall TranslateAccelerator (LPMSG, WORD) { return E_NOTIMPL; }
JUCE_COMRESULT GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
JUCE_COMRESULT ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT GetBorder (LPRECT) { return E_NOTIMPL; }
JUCE_COMRESULT RequestBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
JUCE_COMRESULT SetBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
JUCE_COMRESULT SetActiveObject (IOleInPlaceActiveObject*, LPCOLESTR) { return S_OK; }
JUCE_COMRESULT InsertMenus (HMENU, LPOLEMENUGROUPWIDTHS) { return E_NOTIMPL; }
JUCE_COMRESULT SetMenu (HMENU, HOLEMENU, HWND) { return S_OK; }
JUCE_COMRESULT RemoveMenus (HMENU) { return E_NOTIMPL; }
JUCE_COMRESULT SetStatusText (LPCOLESTR) { return S_OK; }
JUCE_COMRESULT EnableModeless (BOOL) { return S_OK; }
JUCE_COMRESULT TranslateAccelerator (LPMSG, WORD) { return E_NOTIMPL; }

private:
HWND window;
@@ -252172,13 +252190,13 @@ namespace ActiveXHelpers
frame->Release();
}

HRESULT __stdcall GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
HRESULT __stdcall ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
HRESULT __stdcall CanInPlaceActivate() { return S_OK; }
HRESULT __stdcall OnInPlaceActivate() { return S_OK; }
HRESULT __stdcall OnUIActivate() { return S_OK; }
JUCE_COMRESULT GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
JUCE_COMRESULT ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT CanInPlaceActivate() { return S_OK; }
JUCE_COMRESULT OnInPlaceActivate() { return S_OK; }
JUCE_COMRESULT OnUIActivate() { return S_OK; }

HRESULT __stdcall GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
JUCE_COMRESULT GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
/* Note: if you call AddRef on the frame here, then some types of object (e.g. web browser control) cause leaks..
If you don't call AddRef then others crash (e.g. QuickTime).. Bit of a catch-22, so letting it leak is probably preferable.
@@ -252192,12 +252210,12 @@ namespace ActiveXHelpers
return S_OK;
}

HRESULT __stdcall Scroll (SIZE) { return E_NOTIMPL; }
HRESULT __stdcall OnUIDeactivate (BOOL) { return S_OK; }
HRESULT __stdcall OnInPlaceDeactivate() { return S_OK; }
HRESULT __stdcall DiscardUndoState() { return E_NOTIMPL; }
HRESULT __stdcall DeactivateAndUndo() { return E_NOTIMPL; }
HRESULT __stdcall OnPosRectChange (LPCRECT) { return S_OK; }
JUCE_COMRESULT Scroll (SIZE) { return E_NOTIMPL; }
JUCE_COMRESULT OnUIDeactivate (BOOL) { return S_OK; }
JUCE_COMRESULT OnInPlaceDeactivate() { return S_OK; }
JUCE_COMRESULT DiscardUndoState() { return E_NOTIMPL; }
JUCE_COMRESULT DeactivateAndUndo() { return E_NOTIMPL; }
JUCE_COMRESULT OnPosRectChange (LPCRECT) { return S_OK; }

private:
HWND window;
@@ -252216,7 +252234,7 @@ namespace ActiveXHelpers
inplaceSite->Release();
}

HRESULT __stdcall QueryInterface (REFIID type, void** result)
JUCE_COMRESULT QueryInterface (REFIID type, void** result)
{
if (type == IID_IOleInPlaceSite)
{
@@ -252228,12 +252246,12 @@ namespace ActiveXHelpers
return ComBaseClassHelper <IOleClientSite>::QueryInterface (type, result);
}

HRESULT __stdcall SaveObject() { return E_NOTIMPL; }
HRESULT __stdcall GetMoniker (DWORD, DWORD, IMoniker**) { return E_NOTIMPL; }
HRESULT __stdcall GetContainer (LPOLECONTAINER* ppContainer) { *ppContainer = 0; return E_NOINTERFACE; }
HRESULT __stdcall ShowObject() { return S_OK; }
HRESULT __stdcall OnShowWindow (BOOL) { return E_NOTIMPL; }
HRESULT __stdcall RequestNewObjectLayout() { return E_NOTIMPL; }
JUCE_COMRESULT SaveObject() { return E_NOTIMPL; }
JUCE_COMRESULT GetMoniker (DWORD, DWORD, IMoniker**) { return E_NOTIMPL; }
JUCE_COMRESULT GetContainer (LPOLECONTAINER* ppContainer) { *ppContainer = 0; return E_NOINTERFACE; }
JUCE_COMRESULT ShowObject() { return S_OK; }
JUCE_COMRESULT OnShowWindow (BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT RequestNewObjectLayout() { return E_NOTIMPL; }

private:
JuceIOleInPlaceSite* inplaceSite;
@@ -253970,12 +253988,12 @@ private:
{
}

HRESULT __stdcall GetTypeInfoCount (UINT*) { return E_NOTIMPL; }
HRESULT __stdcall GetTypeInfo (UINT, LCID, ITypeInfo**) { return E_NOTIMPL; }
HRESULT __stdcall GetIDsOfNames (REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }
JUCE_COMRESULT GetTypeInfoCount (UINT*) { return E_NOTIMPL; }
JUCE_COMRESULT GetTypeInfo (UINT, LCID, ITypeInfo**) { return E_NOTIMPL; }
JUCE_COMRESULT GetIDsOfNames (REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }

HRESULT __stdcall Invoke (DISPID dispIdMember, REFIID /*riid*/, LCID /*lcid*/, WORD /*wFlags*/, DISPPARAMS* pDispParams,
VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/)
JUCE_COMRESULT Invoke (DISPID dispIdMember, REFIID /*riid*/, LCID /*lcid*/, WORD /*wFlags*/, DISPPARAMS* pDispParams,
VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/)
{
if (dispIdMember == DISPID_BEFORENAVIGATE2)
{
@@ -256003,7 +256021,7 @@ public:
Release();
}

HRESULT __stdcall QueryCancel (boolean* pbCancel)
JUCE_COMRESULT QueryCancel (boolean* pbCancel)
{
if (listener != nullptr && ! shouldCancel)
shouldCancel = listener->audioCDBurnProgress (progress);
@@ -256013,7 +256031,7 @@ public:
return S_OK;
}

HRESULT __stdcall NotifyBlockProgress (long nCompleted, long nTotal)
JUCE_COMRESULT NotifyBlockProgress (long nCompleted, long nTotal)
{
progress = nCompleted / (float) nTotal;
shouldCancel = listener != nullptr && listener->audioCDBurnProgress (progress);
@@ -256021,13 +256039,13 @@ public:
return E_NOTIMPL;
}

HRESULT __stdcall NotifyPnPActivity (void) { return E_NOTIMPL; }
HRESULT __stdcall NotifyAddProgress (long /*nCompletedSteps*/, long /*nTotalSteps*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyTrackProgress (long /*nCurrentTrack*/, long /*nTotalTracks*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyPreparingBurn (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyClosingDisc (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyBurnComplete (HRESULT /*status*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyEraseComplete (HRESULT /*status*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyPnPActivity (void) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyAddProgress (long /*nCompletedSteps*/, long /*nTotalSteps*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyTrackProgress (long /*nCurrentTrack*/, long /*nTotalTracks*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyPreparingBurn (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyClosingDisc (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyBurnComplete (HRESULT /*status*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyEraseComplete (HRESULT /*status*/) { return E_NOTIMPL; }

class ScopedDiscOpener
{
@@ -260115,14 +260133,14 @@ private:
public:
SessionEventCallback (WASAPIDeviceBase& owner_) : owner (owner_) {}

HRESULT __stdcall OnDisplayNameChanged (LPCWSTR, LPCGUID) { return S_OK; }
HRESULT __stdcall OnIconPathChanged (LPCWSTR, LPCGUID) { return S_OK; }
HRESULT __stdcall OnSimpleVolumeChanged (float, BOOL, LPCGUID) { return S_OK; }
HRESULT __stdcall OnChannelVolumeChanged (DWORD, float*, DWORD, LPCGUID) { return S_OK; }
HRESULT __stdcall OnGroupingParamChanged (LPCGUID, LPCGUID) { return S_OK; }
HRESULT __stdcall OnStateChanged (AudioSessionState) { return S_OK; }
JUCE_COMRESULT OnDisplayNameChanged (LPCWSTR, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnIconPathChanged (LPCWSTR, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnSimpleVolumeChanged (float, BOOL, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnChannelVolumeChanged (DWORD, float*, DWORD, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnGroupingParamChanged (LPCGUID, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnStateChanged (AudioSessionState) { return S_OK; }

HRESULT __stdcall OnSessionDisconnected (AudioSessionDisconnectReason reason)
JUCE_COMRESULT OnSessionDisconnected (AudioSessionDisconnectReason reason)
{
if (reason == DisconnectReasonFormatChanged)
owner.deviceSampleRateChanged();
@@ -263785,7 +263803,7 @@ namespace LinuxStatsHelpers
String getCpuInfo (const char* const key)
{
StringArray lines;
lines.addLines (File ("/proc/cpuinfo").loadFileAsString());
File ("/proc/cpuinfo").readLines (lines);

for (int i = lines.size(); --i >= 0;) // (NB - it's important that this runs in reverse order)
if (lines[i].startsWithIgnoreCase (key))
@@ -270826,24 +270844,6 @@ namespace
{
return [NSString stringWithUTF8String: s.toUTF8()];
}

template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}

template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}

template <class RectType>
CGRect convertToCGRect (const RectType& r)
{
return CGRectMake ((CGFloat) r.getX(), (CGFloat) r.getY(), (CGFloat) r.getWidth(), (CGFloat) r.getHeight());
}
}

ScopedAutoReleasePool::ScopedAutoReleasePool()
@@ -274055,6 +274055,27 @@ void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSeri
// compiled on its own).
#if JUCE_INCLUDED_FILE

namespace
{
template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}

template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}

template <class RectType>
CGRect convertToCGRect (const RectType& r)
{
return CGRectMake ((CGFloat) r.getX(), (CGFloat) r.getY(), (CGFloat) r.getWidth(), (CGFloat) r.getHeight());
}
}

class CoreGraphicsImage : public Image::SharedImage
{
public:
@@ -279315,6 +279336,27 @@ void Font::getPlatformDefaultFontNames (String& defaultSans, String& defaultSeri
// compiled on its own).
#if JUCE_INCLUDED_FILE

namespace
{
template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}

template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}

template <class RectType>
CGRect convertToCGRect (const RectType& r)
{
return CGRectMake ((CGFloat) r.getX(), (CGFloat) r.getY(), (CGFloat) r.getWidth(), (CGFloat) r.getHeight());
}
}

class CoreGraphicsImage : public Image::SharedImage
{
public:
@@ -281628,13 +281670,11 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo>
{
switch (type)
{
case 0: handleFileDragMove (files, pos); break;
case 1: handleFileDragExit (files); break;
case 2: handleFileDragDrop (files, pos); break;
case 0: return handleFileDragMove (files, pos);
case 1: return handleFileDragExit (files);
case 2: return handleFileDragDrop (files, pos);
default: jassertfalse; break;
}

return true;
}

return false;


+ 19
- 4
juce_amalgamated.h View File

@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 12
#define JUCE_BUILDNUMBER 13

/** Current Juce version number.

@@ -12790,6 +12790,11 @@ public:
*/
String loadFileAsString() const;

/** Reads the contents of this file as text and splits it into lines, which are
appended to the given StringArray.
*/
void readLines (StringArray& destLines) const;

/** Appends a block of binary data to the end of the file.

This will try to write the given buffer to the end of the file.
@@ -58146,6 +58151,14 @@ public:
/** Invokes a click of one of the buttons. */
void triggerButtonClick (const String& buttonName);

/** If set to true and the window contains no buttons, then pressing the escape key will make
the alert cancel its modal state.
By default this setting is true - turn it off if you don't want the box to respond to
the escape key. Note that it is ignored if you have any buttons, and in that case you
should give the buttons appropriate keypresses to trigger cancelling if you want to.
*/
void setEscapeKeyCancels (bool shouldEscapeKeyCancel);

/** Adds a textbox to the window for entering strings.

@param name an internal name for the text-box. This is the name to pass to
@@ -58473,6 +58486,7 @@ private:
StringArray textboxNames, comboBoxNames;
Font font;
Component* associatedComponent;
bool escapeKeyCancels;

void updateLayout (bool onlyIncreaseSize);

@@ -66196,9 +66210,9 @@ public:

void handleUserClosingWindow();

void handleFileDragMove (const StringArray& files, const Point<int>& position);
void handleFileDragExit (const StringArray& files);
void handleFileDragDrop (const StringArray& files, const Point<int>& position);
bool handleFileDragMove (const StringArray& files, const Point<int>& position);
bool handleFileDragExit (const StringArray& files);
bool handleFileDragDrop (const StringArray& files, const Point<int>& position);

/** Resets the masking region.

@@ -69675,6 +69689,7 @@ private:
*/
class WindowsRegistry
{
public:

/** Returns a string from the registry.



+ 1
- 1
src/audio/plugin_host/juce_PluginDirectoryScanner.cpp View File

@@ -117,7 +117,7 @@ StringArray PluginDirectoryScanner::getDeadMansPedalFile()
if (deadMansPedalFile != File::nonexistent)
{
lines.addLines (deadMansPedalFile.loadFileAsString());
deadMansPedalFile.readLines (lines);
lines.removeEmptyStrings();
}


+ 0
- 138
src/core/juce_Initialisation.cpp View File

@@ -1,138 +0,0 @@
/*
==============================================================================
This file is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-11 by Raw Material Software Ltd.
------------------------------------------------------------------------------
JUCE can be redistributed and/or modified under the terms of the GNU General
Public License (Version 2), as published by the Free Software Foundation.
A copy of the license is included in the JUCE distribution, or can be found
online at www.gnu.org/licenses.
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
------------------------------------------------------------------------------
To release a closed-source product which uses JUCE, commercial licenses are
available: visit www.rawmaterialsoftware.com/juce for more information.
==============================================================================
*/
#include "juce_StandardHeader.h"
BEGIN_JUCE_NAMESPACE
//==============================================================================
#if JUCE_UNIT_TESTS
#include "../utilities/juce_UnitTest.h"
#include "../memory/juce_Atomic.h"
class AtomicTests : public UnitTest
{
public:
AtomicTests() : UnitTest ("Atomics") {}
void runTest()
{
beginTest ("Misc");
char a1[7];
expect (numElementsInArray(a1) == 7);
int a2[3];
expect (numElementsInArray(a2) == 3);
expect (ByteOrder::swap ((uint16) 0x1122) == 0x2211);
expect (ByteOrder::swap ((uint32) 0x11223344) == 0x44332211);
expect (ByteOrder::swap ((uint64) literal64bit (0x1122334455667788)) == literal64bit (0x8877665544332211));
beginTest ("Atomic int");
AtomicTester <int>::testInteger (*this);
beginTest ("Atomic unsigned int");
AtomicTester <unsigned int>::testInteger (*this);
beginTest ("Atomic int32");
AtomicTester <int32>::testInteger (*this);
beginTest ("Atomic uint32");
AtomicTester <uint32>::testInteger (*this);
beginTest ("Atomic long");
AtomicTester <long>::testInteger (*this);
beginTest ("Atomic void*");
AtomicTester <void*>::testInteger (*this);
beginTest ("Atomic int*");
AtomicTester <int*>::testInteger (*this);
beginTest ("Atomic float");
AtomicTester <float>::testFloat (*this);
#if ! JUCE_64BIT_ATOMICS_UNAVAILABLE // 64-bit intrinsics aren't available on some old platforms
beginTest ("Atomic int64");
AtomicTester <int64>::testInteger (*this);
beginTest ("Atomic uint64");
AtomicTester <uint64>::testInteger (*this);
beginTest ("Atomic double");
AtomicTester <double>::testFloat (*this);
#endif
}
template <typename Type>
class AtomicTester
{
public:
AtomicTester() {}
static void testInteger (UnitTest& test)
{
Atomic<Type> a, b;
a.set ((Type) 10);
test.expect (a.value == (Type) 10);
test.expect (a.get() == (Type) 10);
a += (Type) 15;
test.expect (a.get() == (Type) 25);
a.memoryBarrier();
a -= (Type) 5;
test.expect (a.get() == (Type) 20);
test.expect (++a == (Type) 21);
++a;
test.expect (--a == (Type) 21);
test.expect (a.get() == (Type) 21);
a.memoryBarrier();
testFloat (test);
}
static void testFloat (UnitTest& test)
{
Atomic<Type> a, b;
a = (Type) 21;
a.memoryBarrier();
/* These are some simple test cases to check the atomics - let me know
if any of these assertions fail on your system!
*/
test.expect (a.get() == (Type) 21);
test.expect (a.compareAndSetValue ((Type) 100, (Type) 50) == (Type) 21);
test.expect (a.get() == (Type) 21);
test.expect (a.compareAndSetValue ((Type) 101, a.get()) == (Type) 21);
test.expect (a.get() == (Type) 101);
test.expect (! a.compareAndSetBool ((Type) 300, (Type) 200));
test.expect (a.get() == (Type) 101);
test.expect (a.compareAndSetBool ((Type) 200, a.get()));
test.expect (a.get() == (Type) 200);
test.expect (a.exchange ((Type) 300) == (Type) 200);
test.expect (a.get() == (Type) 300);
b = a;
test.expect (b.get() == a.get());
}
};
};
static AtomicTests atomicUnitTests;
#endif
END_JUCE_NAMESPACE

+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 54
#define JUCE_BUILDNUMBER 12
#define JUCE_BUILDNUMBER 13
/** Current Juce version number.


+ 13
- 1
src/gui/components/special/juce_OpenGLComponent.cpp View File

@@ -33,7 +33,7 @@ BEGIN_JUCE_NAMESPACE
#include "../windows/juce_ComponentPeer.h"
#include "../layout/juce_ComponentMovementWatcher.h"
#include "../../../threads/juce_Thread.h"
#include "../../../events/juce_MessageManager.h"
//==============================================================================
extern void juce_glViewport (const int w, const int h);
@@ -177,6 +177,18 @@ public:
void run()
{
#if JUCE_LINUX
{
MessageManagerLock mml (this);
if (! mml.lockWasGained())
return;
owner.updateContext();
owner.updateContextPosition();
}
#endif
while (! threadShouldExit())
{
const uint32 startOfRendering = Time::getMillisecondCounter();


+ 10
- 7
src/gui/components/windows/juce_AlertWindow.cpp View File

@@ -81,7 +81,8 @@ AlertWindow::AlertWindow (const String& title,
Component* associatedComponent_)
: TopLevelWindow (title, true),
alertIconType (iconType),
associatedComponent (associatedComponent_)
associatedComponent (associatedComponent_),
escapeKeyCancels (true)
{
if (message.isEmpty())
text = " "; // to force an update if the message is empty
@@ -114,7 +115,8 @@ AlertWindow::~AlertWindow()
void AlertWindow::userTriedToCloseWindow()
{
exitModalState (0);
if (escapeKeyCancels || buttons.size() > 0)
exitModalState (0);
}
//==============================================================================
@@ -186,6 +188,11 @@ void AlertWindow::triggerButtonClick (const String& buttonName)
}
}
void AlertWindow::setEscapeKeyCancels (bool shouldEscapeKeyCancel)
{
escapeKeyCancels = shouldEscapeKeyCancel;
}
//==============================================================================
void AlertWindow::addTextEditor (const String& name,
const String& initialContents,
@@ -274,10 +281,6 @@ public:
setColour (TextEditor::shadowColourId, Colours::transparentBlack);
}
~AlertTextComp()
{
}
int getPreferredWidth() const noexcept { return bestWidth; }
void updateLayout (const int width)
@@ -576,7 +579,7 @@ bool AlertWindow::keyPressed (const KeyPress& key)
}
}
if (key.isKeyCode (KeyPress::escapeKey) && buttons.size() == 0)
if (key.isKeyCode (KeyPress::escapeKey) && escapeKeyCancels && buttons.size() == 0)
{
exitModalState (0);
return true;


+ 9
- 0
src/gui/components/windows/juce_AlertWindow.h View File

@@ -117,6 +117,14 @@ public:
/** Invokes a click of one of the buttons. */
void triggerButtonClick (const String& buttonName);
/** If set to true and the window contains no buttons, then pressing the escape key will make
the alert cancel its modal state.
By default this setting is true - turn it off if you don't want the box to respond to
the escape key. Note that it is ignored if you have any buttons, and in that case you
should give the buttons appropriate keypresses to trigger cancelling if you want to.
*/
void setEscapeKeyCancels (bool shouldEscapeKeyCancel);
//==============================================================================
/** Adds a textbox to the window for entering strings.
@@ -454,6 +462,7 @@ private:
StringArray textboxNames, comboBoxNames;
Font font;
Component* associatedComponent;
bool escapeKeyCancels;
void updateLayout (bool onlyIncreaseSize);


+ 15
- 11
src/gui/components/windows/juce_ComponentPeer.cpp View File

@@ -435,7 +435,7 @@ namespace ComponentPeerHelpers
}
}
void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<int>& position)
bool ComponentPeer::handleFileDragMove (const StringArray& files, const Point<int>& position)
{
updateCurrentModifiers();
@@ -471,21 +471,22 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<in
newTarget = lastTarget;
}
if (newTarget != nullptr)
{
Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (targetComp->getLocalPoint (component, position));
if (newTarget == nullptr)
return false;
newTarget->fileDragMove (files, pos.getX(), pos.getY());
}
Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (targetComp->getLocalPoint (component, position));
newTarget->fileDragMove (files, pos.getX(), pos.getY());
return true;
}
void ComponentPeer::handleFileDragExit (const StringArray& files)
bool ComponentPeer::handleFileDragExit (const StringArray& files)
{
handleFileDragMove (files, Point<int> (-1, -1));
const bool used = handleFileDragMove (files, Point<int> (-1, -1));
jassert (dragAndDropTargetComponent == nullptr);
lastDragAndDropCompUnderMouse = nullptr;
return used;
}
// We'll use an async message to deliver the drop, because if the target decides
@@ -514,7 +515,7 @@ private:
JUCE_DECLARE_NON_COPYABLE (AsyncFileDropMessage);
};
void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position)
bool ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<int>& position)
{
handleFileDragMove (files, position);
@@ -535,12 +536,15 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
targetComp->internalModalInputAttempt();
if (targetComp->isCurrentlyBlockedByAnotherModalComponent())
return;
return true;
}
(new AsyncFileDropMessage (targetComp, target, targetComp->getLocalPoint (component, position), files))->post();
return true;
}
}
return false;
}
//==============================================================================


+ 3
- 3
src/gui/components/windows/juce_ComponentPeer.h View File

@@ -313,9 +313,9 @@ public:
void handleUserClosingWindow();
void handleFileDragMove (const StringArray& files, const Point<int>& position);
void handleFileDragExit (const StringArray& files);
void handleFileDragDrop (const StringArray& files, const Point<int>& position);
bool handleFileDragMove (const StringArray& files, const Point<int>& position);
bool handleFileDragExit (const StringArray& files);
bool handleFileDragDrop (const StringArray& files, const Point<int>& position);
//==============================================================================
/** Resets the masking region.


+ 3
- 0
src/gui/components/windows/juce_ThreadWithProgressWindow.cpp View File

@@ -47,6 +47,9 @@ ThreadWithProgressWindow::ThreadWithProgressWindow (const String& title,
String::empty, String::empty,
AlertWindow::NoIcon, hasCancelButton ? 1 : 0, 0);
// if there are no buttons, we won't allow the user to interrupt the thread.
alertWindow->setEscapeKeyCancels (false);
if (hasProgressBar)
alertWindow->addProgressBarComponent (progress);
}


+ 5
- 0
src/io/files/juce_File.cpp View File

@@ -509,6 +509,11 @@ String File::loadFileAsString() const
return in.readEntireStreamAsString();
}
void File::readLines (StringArray& destLines) const
{
destLines.addLines (loadFileAsString());
}
//==============================================================================
int File::findChildFiles (Array<File>& results,
const int whatToLookFor,


+ 5
- 0
src/io/files/juce_File.h View File

@@ -607,6 +607,11 @@ public:
*/
String loadFileAsString() const;
/** Reads the contents of this file as text and splits it into lines, which are
appended to the given StringArray.
*/
void readLines (StringArray& destLines) const;
//==============================================================================
/** Appends a block of binary data to the end of the file.


+ 1
- 1
src/native/linux/juce_linux_SystemStats.cpp View File

@@ -61,7 +61,7 @@ namespace LinuxStatsHelpers
String getCpuInfo (const char* const key)
{
StringArray lines;
lines.addLines (File ("/proc/cpuinfo").loadFileAsString());
File ("/proc/cpuinfo").readLines (lines);
for (int i = lines.size(); --i >= 0;) // (NB - it's important that this runs in reverse order)
if (lines[i].startsWithIgnoreCase (key))


+ 23
- 0
src/native/mac/juce_mac_CoreGraphicsContext.mm View File

@@ -27,6 +27,29 @@
// compiled on its own).
#if JUCE_INCLUDED_FILE
//==============================================================================
namespace
{
template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}
template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}
template <class RectType>
CGRect convertToCGRect (const RectType& r)
{
return CGRectMake ((CGFloat) r.getX(), (CGFloat) r.getY(), (CGFloat) r.getWidth(), (CGFloat) r.getHeight());
}
}
//==============================================================================
class CoreGraphicsImage : public Image::SharedImage
{


+ 3
- 5
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -1491,13 +1491,11 @@ BOOL NSViewComponentPeer::sendDragCallback (const int type, id <NSDraggingInfo>
{
switch (type)
{
case 0: handleFileDragMove (files, pos); break;
case 1: handleFileDragExit (files); break;
case 2: handleFileDragDrop (files, pos); break;
case 0: return handleFileDragMove (files, pos);
case 1: return handleFileDragExit (files);
case 2: return handleFileDragDrop (files, pos);
default: jassertfalse; break;
}
return true;
}
return false;


+ 0
- 19
src/native/mac/juce_osx_ObjCHelpers.h View File

@@ -42,25 +42,6 @@ namespace
{
return [NSString stringWithUTF8String: s.toUTF8()];
}
//==============================================================================
template <class RectType>
const Rectangle<int> convertToRectInt (const RectType& r)
{
return Rectangle<int> ((int) r.origin.x, (int) r.origin.y, (int) r.size.width, (int) r.size.height);
}
template <class RectType>
const Rectangle<float> convertToRectFloat (const RectType& r)
{
return Rectangle<float> (r.origin.x, r.origin.y, r.size.width, r.size.height);
}
template <class RectType>
CGRect convertToCGRect (const RectType& r)
{
return CGRectMake ((CGFloat) r.getX(), (CGFloat) r.getY(), (CGFloat) r.getWidth(), (CGFloat) r.getHeight());
}
}
//==============================================================================


+ 46
- 46
src/native/windows/juce_win32_ActiveXComponent.cpp View File

@@ -35,21 +35,21 @@ namespace ActiveXHelpers
public:
JuceIStorage() {}
HRESULT __stdcall CreateStream (const WCHAR*, DWORD, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
HRESULT __stdcall OpenStream (const WCHAR*, void*, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
HRESULT __stdcall CreateStorage (const WCHAR*, DWORD, DWORD, DWORD, IStorage**) { return E_NOTIMPL; }
HRESULT __stdcall OpenStorage (const WCHAR*, IStorage*, DWORD, SNB, DWORD, IStorage**) { return E_NOTIMPL; }
HRESULT __stdcall CopyTo (DWORD, IID const*, SNB, IStorage*) { return E_NOTIMPL; }
HRESULT __stdcall MoveElementTo (const OLECHAR*,IStorage*, const OLECHAR*, DWORD) { return E_NOTIMPL; }
HRESULT __stdcall Commit (DWORD) { return E_NOTIMPL; }
HRESULT __stdcall Revert() { return E_NOTIMPL; }
HRESULT __stdcall EnumElements (DWORD, void*, DWORD, IEnumSTATSTG**) { return E_NOTIMPL; }
HRESULT __stdcall DestroyElement (const OLECHAR*) { return E_NOTIMPL; }
HRESULT __stdcall RenameElement (const WCHAR*, const WCHAR*) { return E_NOTIMPL; }
HRESULT __stdcall SetElementTimes (const WCHAR*, FILETIME const*, FILETIME const*, FILETIME const*) { return E_NOTIMPL; }
HRESULT __stdcall SetClass (REFCLSID) { return S_OK; }
HRESULT __stdcall SetStateBits (DWORD, DWORD) { return E_NOTIMPL; }
HRESULT __stdcall Stat (STATSTG*, DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT CreateStream (const WCHAR*, DWORD, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
JUCE_COMRESULT OpenStream (const WCHAR*, void*, DWORD, DWORD, IStream**) { return E_NOTIMPL; }
JUCE_COMRESULT CreateStorage (const WCHAR*, DWORD, DWORD, DWORD, IStorage**) { return E_NOTIMPL; }
JUCE_COMRESULT OpenStorage (const WCHAR*, IStorage*, DWORD, SNB, DWORD, IStorage**) { return E_NOTIMPL; }
JUCE_COMRESULT CopyTo (DWORD, IID const*, SNB, IStorage*) { return E_NOTIMPL; }
JUCE_COMRESULT MoveElementTo (const OLECHAR*,IStorage*, const OLECHAR*, DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT Commit (DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT Revert() { return E_NOTIMPL; }
JUCE_COMRESULT EnumElements (DWORD, void*, DWORD, IEnumSTATSTG**) { return E_NOTIMPL; }
JUCE_COMRESULT DestroyElement (const OLECHAR*) { return E_NOTIMPL; }
JUCE_COMRESULT RenameElement (const WCHAR*, const WCHAR*) { return E_NOTIMPL; }
JUCE_COMRESULT SetElementTimes (const WCHAR*, FILETIME const*, FILETIME const*, FILETIME const*) { return E_NOTIMPL; }
JUCE_COMRESULT SetClass (REFCLSID) { return S_OK; }
JUCE_COMRESULT SetStateBits (DWORD, DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT Stat (STATSTG*, DWORD) { return E_NOTIMPL; }
};
//==============================================================================
@@ -58,18 +58,18 @@ namespace ActiveXHelpers
public:
JuceOleInPlaceFrame (HWND window_) : window (window_) {}
HRESULT __stdcall GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
HRESULT __stdcall ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
HRESULT __stdcall GetBorder (LPRECT) { return E_NOTIMPL; }
HRESULT __stdcall RequestBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
HRESULT __stdcall SetBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
HRESULT __stdcall SetActiveObject (IOleInPlaceActiveObject*, LPCOLESTR) { return S_OK; }
HRESULT __stdcall InsertMenus (HMENU, LPOLEMENUGROUPWIDTHS) { return E_NOTIMPL; }
HRESULT __stdcall SetMenu (HMENU, HOLEMENU, HWND) { return S_OK; }
HRESULT __stdcall RemoveMenus (HMENU) { return E_NOTIMPL; }
HRESULT __stdcall SetStatusText (LPCOLESTR) { return S_OK; }
HRESULT __stdcall EnableModeless (BOOL) { return S_OK; }
HRESULT __stdcall TranslateAccelerator (LPMSG, WORD) { return E_NOTIMPL; }
JUCE_COMRESULT GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
JUCE_COMRESULT ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT GetBorder (LPRECT) { return E_NOTIMPL; }
JUCE_COMRESULT RequestBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
JUCE_COMRESULT SetBorderSpace (LPCBORDERWIDTHS) { return E_NOTIMPL; }
JUCE_COMRESULT SetActiveObject (IOleInPlaceActiveObject*, LPCOLESTR) { return S_OK; }
JUCE_COMRESULT InsertMenus (HMENU, LPOLEMENUGROUPWIDTHS) { return E_NOTIMPL; }
JUCE_COMRESULT SetMenu (HMENU, HOLEMENU, HWND) { return S_OK; }
JUCE_COMRESULT RemoveMenus (HMENU) { return E_NOTIMPL; }
JUCE_COMRESULT SetStatusText (LPCOLESTR) { return S_OK; }
JUCE_COMRESULT EnableModeless (BOOL) { return S_OK; }
JUCE_COMRESULT TranslateAccelerator (LPMSG, WORD) { return E_NOTIMPL; }
private:
HWND window;
@@ -89,13 +89,13 @@ namespace ActiveXHelpers
frame->Release();
}
HRESULT __stdcall GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
HRESULT __stdcall ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
HRESULT __stdcall CanInPlaceActivate() { return S_OK; }
HRESULT __stdcall OnInPlaceActivate() { return S_OK; }
HRESULT __stdcall OnUIActivate() { return S_OK; }
JUCE_COMRESULT GetWindow (HWND* lphwnd) { *lphwnd = window; return S_OK; }
JUCE_COMRESULT ContextSensitiveHelp (BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT CanInPlaceActivate() { return S_OK; }
JUCE_COMRESULT OnInPlaceActivate() { return S_OK; }
JUCE_COMRESULT OnUIActivate() { return S_OK; }
HRESULT __stdcall GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
JUCE_COMRESULT GetWindowContext (LPOLEINPLACEFRAME* lplpFrame, LPOLEINPLACEUIWINDOW* lplpDoc, LPRECT, LPRECT, LPOLEINPLACEFRAMEINFO lpFrameInfo)
{
/* Note: if you call AddRef on the frame here, then some types of object (e.g. web browser control) cause leaks..
If you don't call AddRef then others crash (e.g. QuickTime).. Bit of a catch-22, so letting it leak is probably preferable.
@@ -109,12 +109,12 @@ namespace ActiveXHelpers
return S_OK;
}
HRESULT __stdcall Scroll (SIZE) { return E_NOTIMPL; }
HRESULT __stdcall OnUIDeactivate (BOOL) { return S_OK; }
HRESULT __stdcall OnInPlaceDeactivate() { return S_OK; }
HRESULT __stdcall DiscardUndoState() { return E_NOTIMPL; }
HRESULT __stdcall DeactivateAndUndo() { return E_NOTIMPL; }
HRESULT __stdcall OnPosRectChange (LPCRECT) { return S_OK; }
JUCE_COMRESULT Scroll (SIZE) { return E_NOTIMPL; }
JUCE_COMRESULT OnUIDeactivate (BOOL) { return S_OK; }
JUCE_COMRESULT OnInPlaceDeactivate() { return S_OK; }
JUCE_COMRESULT DiscardUndoState() { return E_NOTIMPL; }
JUCE_COMRESULT DeactivateAndUndo() { return E_NOTIMPL; }
JUCE_COMRESULT OnPosRectChange (LPCRECT) { return S_OK; }
private:
HWND window;
@@ -134,7 +134,7 @@ namespace ActiveXHelpers
inplaceSite->Release();
}
HRESULT __stdcall QueryInterface (REFIID type, void** result)
JUCE_COMRESULT QueryInterface (REFIID type, void** result)
{
if (type == IID_IOleInPlaceSite)
{
@@ -146,12 +146,12 @@ namespace ActiveXHelpers
return ComBaseClassHelper <IOleClientSite>::QueryInterface (type, result);
}
HRESULT __stdcall SaveObject() { return E_NOTIMPL; }
HRESULT __stdcall GetMoniker (DWORD, DWORD, IMoniker**) { return E_NOTIMPL; }
HRESULT __stdcall GetContainer (LPOLECONTAINER* ppContainer) { *ppContainer = 0; return E_NOINTERFACE; }
HRESULT __stdcall ShowObject() { return S_OK; }
HRESULT __stdcall OnShowWindow (BOOL) { return E_NOTIMPL; }
HRESULT __stdcall RequestNewObjectLayout() { return E_NOTIMPL; }
JUCE_COMRESULT SaveObject() { return E_NOTIMPL; }
JUCE_COMRESULT GetMoniker (DWORD, DWORD, IMoniker**) { return E_NOTIMPL; }
JUCE_COMRESULT GetContainer (LPOLECONTAINER* ppContainer) { *ppContainer = 0; return E_NOINTERFACE; }
JUCE_COMRESULT ShowObject() { return S_OK; }
JUCE_COMRESULT OnShowWindow (BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT RequestNewObjectLayout() { return E_NOTIMPL; }
private:
JuceIOleInPlaceSite* inplaceSite;


+ 9
- 9
src/native/windows/juce_win32_AudioCDReader.cpp View File

@@ -1405,7 +1405,7 @@ public:
Release();
}
HRESULT __stdcall QueryCancel (boolean* pbCancel)
JUCE_COMRESULT QueryCancel (boolean* pbCancel)
{
if (listener != nullptr && ! shouldCancel)
shouldCancel = listener->audioCDBurnProgress (progress);
@@ -1415,7 +1415,7 @@ public:
return S_OK;
}
HRESULT __stdcall NotifyBlockProgress (long nCompleted, long nTotal)
JUCE_COMRESULT NotifyBlockProgress (long nCompleted, long nTotal)
{
progress = nCompleted / (float) nTotal;
shouldCancel = listener != nullptr && listener->audioCDBurnProgress (progress);
@@ -1423,13 +1423,13 @@ public:
return E_NOTIMPL;
}
HRESULT __stdcall NotifyPnPActivity (void) { return E_NOTIMPL; }
HRESULT __stdcall NotifyAddProgress (long /*nCompletedSteps*/, long /*nTotalSteps*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyTrackProgress (long /*nCurrentTrack*/, long /*nTotalTracks*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyPreparingBurn (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyClosingDisc (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyBurnComplete (HRESULT /*status*/) { return E_NOTIMPL; }
HRESULT __stdcall NotifyEraseComplete (HRESULT /*status*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyPnPActivity (void) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyAddProgress (long /*nCompletedSteps*/, long /*nTotalSteps*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyTrackProgress (long /*nCurrentTrack*/, long /*nTotalTracks*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyPreparingBurn (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyClosingDisc (long /*nEstimatedSeconds*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyBurnComplete (HRESULT /*status*/) { return E_NOTIMPL; }
JUCE_COMRESULT NotifyEraseComplete (HRESULT /*status*/) { return E_NOTIMPL; }
class ScopedDiscOpener
{


+ 9
- 6
src/native/windows/juce_win32_ComSmartPtr.h View File

@@ -63,11 +63,11 @@ public:
HRESULT CoCreateInstance (REFCLSID classUUID, DWORD dwClsContext = CLSCTX_INPROC_SERVER)
{
#ifndef __MINGW32__
#ifndef __MINGW32__
return ::CoCreateInstance (classUUID, 0, dwClsContext, __uuidof (ComClass), (void**) resetAndGetPointerAddress());
#else
#else
return E_NOTIMPL;
#endif
#endif
}
template <class OtherComClass>
@@ -93,6 +93,9 @@ private:
ComClass** operator&() throw(); // private to avoid it being used accidentally
};
//==============================================================================
#define JUCE_COMRESULT HRESULT __stdcall
//==============================================================================
/** Handy base class for writing COM objects, providing ref-counting and a basic QueryInterface method.
*/
@@ -103,11 +106,11 @@ public:
ComBaseClassHelper() : refCount (1) {}
virtual ~ComBaseClassHelper() {}
HRESULT __stdcall QueryInterface (REFIID refId, void** result)
JUCE_COMRESULT QueryInterface (REFIID refId, void** result)
{
#ifndef __MINGW32__
#ifndef __MINGW32__
if (refId == __uuidof (ComClass)) { AddRef(); *result = dynamic_cast <ComClass*> (this); return S_OK; }
#endif
#endif
if (refId == IID_IUnknown) { AddRef(); *result = dynamic_cast <IUnknown*> (this); return S_OK; }


+ 8
- 8
src/native/windows/juce_win32_WASAPI.cpp View File

@@ -267,14 +267,14 @@ private:
public:
SessionEventCallback (WASAPIDeviceBase& owner_) : owner (owner_) {}
HRESULT __stdcall OnDisplayNameChanged (LPCWSTR, LPCGUID) { return S_OK; }
HRESULT __stdcall OnIconPathChanged (LPCWSTR, LPCGUID) { return S_OK; }
HRESULT __stdcall OnSimpleVolumeChanged (float, BOOL, LPCGUID) { return S_OK; }
HRESULT __stdcall OnChannelVolumeChanged (DWORD, float*, DWORD, LPCGUID) { return S_OK; }
HRESULT __stdcall OnGroupingParamChanged (LPCGUID, LPCGUID) { return S_OK; }
HRESULT __stdcall OnStateChanged (AudioSessionState) { return S_OK; }
HRESULT __stdcall OnSessionDisconnected (AudioSessionDisconnectReason reason)
JUCE_COMRESULT OnDisplayNameChanged (LPCWSTR, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnIconPathChanged (LPCWSTR, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnSimpleVolumeChanged (float, BOOL, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnChannelVolumeChanged (DWORD, float*, DWORD, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnGroupingParamChanged (LPCGUID, LPCGUID) { return S_OK; }
JUCE_COMRESULT OnStateChanged (AudioSessionState) { return S_OK; }
JUCE_COMRESULT OnSessionDisconnected (AudioSessionDisconnectReason reason)
{
if (reason == DisconnectReasonFormatChanged)
owner.deviceSampleRateChanged();


+ 5
- 5
src/native/windows/juce_win32_WebBrowserComponent.cpp View File

@@ -151,12 +151,12 @@ private:
}
//==============================================================================
HRESULT __stdcall GetTypeInfoCount (UINT*) { return E_NOTIMPL; }
HRESULT __stdcall GetTypeInfo (UINT, LCID, ITypeInfo**) { return E_NOTIMPL; }
HRESULT __stdcall GetIDsOfNames (REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }
JUCE_COMRESULT GetTypeInfoCount (UINT*) { return E_NOTIMPL; }
JUCE_COMRESULT GetTypeInfo (UINT, LCID, ITypeInfo**) { return E_NOTIMPL; }
JUCE_COMRESULT GetIDsOfNames (REFIID, LPOLESTR*, UINT, LCID, DISPID*) { return E_NOTIMPL; }
HRESULT __stdcall Invoke (DISPID dispIdMember, REFIID /*riid*/, LCID /*lcid*/, WORD /*wFlags*/, DISPPARAMS* pDispParams,
VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/)
JUCE_COMRESULT Invoke (DISPID dispIdMember, REFIID /*riid*/, LCID /*lcid*/, WORD /*wFlags*/, DISPPARAMS* pDispParams,
VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/, UINT* /*puArgErr*/)
{
if (dispIdMember == DISPID_BEFORENAVIGATE2)
{


+ 52
- 63
src/native/windows/juce_win32_Windowing.cpp View File

@@ -1859,39 +1859,58 @@ private:
{
}
HRESULT __stdcall DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
JUCE_COMRESULT DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
updateFileList (pDataObject);
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
const bool wasWanted = owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = wasWanted ? DROPEFFECT_COPY : DROPEFFECT_NONE;
return wasWanted ? S_OK : S_FALSE;
}
HRESULT __stdcall DragLeave()
JUCE_COMRESULT DragLeave()
{
owner->handleFileDragExit (files);
return S_OK;
}
HRESULT __stdcall DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
JUCE_COMRESULT DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
const bool wasWanted = owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = wasWanted ? DROPEFFECT_COPY : DROPEFFECT_NONE;
return wasWanted ? S_OK : S_FALSE;
}
HRESULT __stdcall Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
JUCE_COMRESULT Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{
updateFileList (pDataObject);
owner->handleFileDragDrop (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY;
return S_OK;
const bool wasWanted = owner->handleFileDragDrop (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = wasWanted ? DROPEFFECT_COPY : DROPEFFECT_NONE;
return wasWanted ? S_OK : S_FALSE;
}
private:
Win32ComponentPeer* const owner;
StringArray files;
template <typename CharType>
void parseFileList (const CharType* names, const SIZE_T totalLen)
{
unsigned int i = 0;
for (;;)
{
unsigned int len = 0;
while (i + len < totalLen && names [i + len] != 0)
++len;
if (len == 0)
break;
files.add (String (names + i, len));
i += len + 1;
}
}
void updateFileList (IDataObject* const pDataObject)
{
files.clear();
@@ -1902,43 +1921,13 @@ private:
if (pDataObject->GetData (&format, &medium) == S_OK)
{
const SIZE_T totalLen = GlobalSize (medium.hGlobal);
const LPDROPFILES pDropFiles = (const LPDROPFILES) GlobalLock (medium.hGlobal);
unsigned int i = 0;
if (pDropFiles->fWide)
{
const WCHAR* const fname = (WCHAR*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));
const LPDROPFILES dropFiles = (const LPDROPFILES) GlobalLock (medium.hGlobal);
const void* const names = addBytesToPointer (dropFiles, sizeof (DROPFILES));
for (;;)
{
unsigned int len = 0;
while (i + len < totalLen && fname [i + len] != 0)
++len;
if (len == 0)
break;
files.add (String (fname + i, len));
i += len + 1;
}
}
if (dropFiles->fWide)
parseFileList (static_cast <const WCHAR*> (names), totalLen);
else
{
const char* const fname = (const char*) addBytesToPointer (pDropFiles, sizeof (DROPFILES));
for (;;)
{
unsigned int len = 0;
while (i + len < totalLen && fname [i + len] != 0)
++len;
if (len == 0)
break;
files.add (String (fname + i, len));
i += len + 1;
}
}
parseFileList (static_cast <const char*> (names), totalLen);
GlobalUnlock (medium.hGlobal);
}
@@ -3127,7 +3116,7 @@ class JuceDropSource : public ComBaseClassHelper <IDropSource>
public:
JuceDropSource() {}
HRESULT __stdcall QueryContinueDrag (BOOL escapePressed, DWORD keys)
JUCE_COMRESULT QueryContinueDrag (BOOL escapePressed, DWORD keys)
{
if (escapePressed)
return DRAGDROP_S_CANCEL;
@@ -3138,7 +3127,7 @@ public:
return S_OK;
}
HRESULT __stdcall GiveFeedback (DWORD)
JUCE_COMRESULT GiveFeedback (DWORD)
{
return DRAGDROP_S_USEDEFAULTCURSORS;
}
@@ -3154,7 +3143,7 @@ public:
{
}
HRESULT __stdcall Clone (IEnumFORMATETC** result)
JUCE_COMRESULT Clone (IEnumFORMATETC** result)
{
if (result == 0)
return E_POINTER;
@@ -3166,7 +3155,7 @@ public:
return S_OK;
}
HRESULT __stdcall Next (ULONG celt, LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
JUCE_COMRESULT Next (ULONG celt, LPFORMATETC lpFormatEtc, ULONG* pceltFetched)
{
if (pceltFetched != nullptr)
*pceltFetched = 0;
@@ -3187,7 +3176,7 @@ public:
return S_FALSE;
}
HRESULT __stdcall Skip (ULONG celt)
JUCE_COMRESULT Skip (ULONG celt)
{
if (index + (int) celt >= 1)
return S_FALSE;
@@ -3196,7 +3185,7 @@ public:
return S_OK;
}
HRESULT __stdcall Reset()
JUCE_COMRESULT Reset()
{
index = 0;
return S_OK;
@@ -3237,7 +3226,7 @@ public:
jassert (refCount == 0);
}
HRESULT __stdcall GetData (FORMATETC* pFormatEtc, STGMEDIUM* pMedium)
JUCE_COMRESULT GetData (FORMATETC* pFormatEtc, STGMEDIUM* pMedium)
{
if ((pFormatEtc->tymed & format->tymed) != 0
&& pFormatEtc->cfFormat == format->cfFormat
@@ -3264,7 +3253,7 @@ public:
return DV_E_FORMATETC;
}
HRESULT __stdcall QueryGetData (FORMATETC* f)
JUCE_COMRESULT QueryGetData (FORMATETC* f)
{
if (f == 0)
return E_INVALIDARG;
@@ -3277,13 +3266,13 @@ public:
return DV_E_FORMATETC;
}
HRESULT __stdcall GetCanonicalFormatEtc (FORMATETC*, FORMATETC* pFormatEtcOut)
JUCE_COMRESULT GetCanonicalFormatEtc (FORMATETC*, FORMATETC* pFormatEtcOut)
{
pFormatEtcOut->ptd = 0;
return E_NOTIMPL;
}
HRESULT __stdcall EnumFormatEtc (DWORD direction, IEnumFORMATETC** result)
JUCE_COMRESULT EnumFormatEtc (DWORD direction, IEnumFORMATETC** result)
{
if (result == 0)
return E_POINTER;
@@ -3298,11 +3287,11 @@ public:
return E_NOTIMPL;
}
HRESULT __stdcall GetDataHere (FORMATETC*, STGMEDIUM*) { return DATA_E_FORMATETC; }
HRESULT __stdcall SetData (FORMATETC*, STGMEDIUM*, BOOL) { return E_NOTIMPL; }
HRESULT __stdcall DAdvise (FORMATETC*, DWORD, IAdviseSink*, DWORD*) { return OLE_E_ADVISENOTSUPPORTED; }
HRESULT __stdcall DUnadvise (DWORD) { return E_NOTIMPL; }
HRESULT __stdcall EnumDAdvise (IEnumSTATDATA**) { return OLE_E_ADVISENOTSUPPORTED; }
JUCE_COMRESULT GetDataHere (FORMATETC*, STGMEDIUM*) { return DATA_E_FORMATETC; }
JUCE_COMRESULT SetData (FORMATETC*, STGMEDIUM*, BOOL) { return E_NOTIMPL; }
JUCE_COMRESULT DAdvise (FORMATETC*, DWORD, IAdviseSink*, DWORD*) { return OLE_E_ADVISENOTSUPPORTED; }
JUCE_COMRESULT DUnadvise (DWORD) { return E_NOTIMPL; }
JUCE_COMRESULT EnumDAdvise (IEnumSTATDATA**) { return OLE_E_ADVISENOTSUPPORTED; }
private:
JuceDropSource* const dropSource;


+ 1
- 0
src/utilities/juce_WindowsRegistry.h View File

@@ -34,6 +34,7 @@
*/
class WindowsRegistry
{
public:
//==============================================================================
/** Returns a string from the registry.


Loading…
Cancel
Save