1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-26 02:14:22 +00:00

Tidied up some win32 linkage declarations. Fixed some component size constraining problems on mac and win32.

This commit is contained in:
Julian Storer 2010-10-20 20:37:09 +01:00
parent ea16741b3d
commit 618d3fdf64
19 changed files with 192 additions and 158 deletions

View file

@ -66,7 +66,7 @@ void Process::terminate()
exit (0);
}
bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger()
JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger()
{
static char testResult = 0;
@ -84,7 +84,7 @@ bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger()
return testResult < 0;
}
bool JUCE_CALLTYPE Process::isRunningUnderDebugger()
JUCE_API bool JUCE_CALLTYPE Process::isRunningUnderDebugger()
{
return juce_isRunningUnderDebugger();
}

View file

@ -33,7 +33,7 @@ void Logger::outputDebugString (const String& text)
std::cerr << text << std::endl;
}
bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger()
JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger()
{
static char testResult = 0;
@ -49,7 +49,7 @@ bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger()
return testResult > 0;
}
bool JUCE_CALLTYPE Process::isRunningUnderDebugger()
JUCE_API bool JUCE_CALLTYPE Process::isRunningUnderDebugger()
{
return juce_isRunningUnderDebugger();
}

View file

@ -1069,12 +1069,21 @@ NSRect NSViewComponentPeer::constrainRect (NSRect r)
Rectangle<int> pos (convertToRectInt (r));
Rectangle<int> original (convertToRectInt (current));
constrainer->checkBounds (pos, original,
Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
pos.getY() != original.getY() && pos.getBottom() == original.getBottom(),
pos.getX() != original.getX() && pos.getRight() == original.getRight(),
pos.getY() == original.getY() && pos.getBottom() != original.getBottom(),
pos.getX() == original.getX() && pos.getRight() != original.getRight());
if ([window inLiveResize])
{
constrainer->checkBounds (pos, original,
Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
false, false, true, true);
}
else
{
constrainer->checkBounds (pos, original,
Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
pos.getY() != original.getY() && pos.getBottom() == original.getBottom(),
pos.getX() != original.getX() && pos.getRight() == original.getRight(),
pos.getY() == original.getY() && pos.getBottom() != original.getBottom(),
pos.getX() == original.getX() && pos.getRight() != original.getRight());
}
r.origin.x = pos.getX();
r.origin.y = [[[NSScreen screens] objectAtIndex: 0] frame].size.height - r.size.height - pos.getY();

View file

@ -38,6 +38,11 @@
#define log(a) {}
#endif
/* The ASIO SDK *should* declare its callback functions as being __cdecl, but different versions seem
to be pretty random about whether or not they do this. If you hit an error using these functions
it'll be because you're trying to build using __stdcall, in which case you'd need to either get hold of
an ASIO SDK which correctly specifies __cdecl, or add the __cdecl keyword to its functions yourself.
*/
#define JUCE_ASIOCALLBACK __cdecl
//==============================================================================

View file

@ -142,7 +142,7 @@ namespace ActiveXHelpers
inplaceSite->Release();
}
HRESULT __stdcall QueryInterface (REFIID type, void __RPC_FAR* __RPC_FAR* result)
HRESULT __stdcall QueryInterface (REFIID type, void** result)
{
if (type == IID_IOleInPlaceSite)
{

View file

@ -259,7 +259,7 @@ public:
ComBaseClassHelper() : refCount (1) {}
virtual ~ComBaseClassHelper() {}
HRESULT __stdcall QueryInterface (REFIID refId, void __RPC_FAR* __RPC_FAR* result)
HRESULT __stdcall QueryInterface (REFIID refId, void** result)
{
#ifndef __MINGW32__
if (refId == __uuidof (ComClass)) { AddRef(); *result = dynamic_cast <ComClass*> (this); return S_OK; }

View file

@ -273,7 +273,7 @@ void Process::setPriority (ProcessPriority prior)
}
}
bool JUCE_PUBLIC_FUNCTION juce_isRunningUnderDebugger()
JUCE_API bool JUCE_CALLTYPE juce_isRunningUnderDebugger()
{
return IsDebuggerPresent() != FALSE;
}

View file

@ -158,14 +158,14 @@ private:
}
//==============================================================================
HRESULT __stdcall GetTypeInfoCount (UINT __RPC_FAR*) { return E_NOTIMPL; }
HRESULT __stdcall GetTypeInfo (UINT, LCID, ITypeInfo __RPC_FAR *__RPC_FAR*) { return E_NOTIMPL; }
HRESULT __stdcall GetIDsOfNames (REFIID, LPOLESTR __RPC_FAR*, UINT, LCID, DISPID __RPC_FAR*) { return E_NOTIMPL; }
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; }
HRESULT __stdcall Invoke (DISPID dispIdMember, REFIID /*riid*/, LCID /*lcid*/,
WORD /*wFlags*/, DISPPARAMS __RPC_FAR* pDispParams,
VARIANT __RPC_FAR* /*pVarResult*/, EXCEPINFO __RPC_FAR* /*pExcepInfo*/,
UINT __RPC_FAR* /*puArgErr*/)
WORD /*wFlags*/, DISPPARAMS* pDispParams,
VARIANT* /*pVarResult*/, EXCEPINFO* /*pExcepInfo*/,
UINT* /*puArgErr*/)
{
switch (dispIdMember)
{

View file

@ -1833,36 +1833,48 @@ private:
return 0;
//==============================================================================
case WM_SIZING:
if (constrainer != 0 && (styleFlags & (windowHasTitleBar | windowIsResizable)) == (windowHasTitleBar | windowIsResizable))
{
RECT* const r = (RECT*) lParam;
Rectangle<int> pos (r->left, r->top, r->right - r->left, r->bottom - r->top);
constrainer->checkBounds (pos, windowBorder.addedTo (component->getBounds()),
Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
wParam == WMSZ_TOP || wParam == WMSZ_TOPLEFT || wParam == WMSZ_TOPRIGHT,
wParam == WMSZ_LEFT || wParam == WMSZ_TOPLEFT || wParam == WMSZ_BOTTOMLEFT,
wParam == WMSZ_BOTTOM || wParam == WMSZ_BOTTOMLEFT || wParam == WMSZ_BOTTOMRIGHT,
wParam == WMSZ_RIGHT || wParam == WMSZ_TOPRIGHT || wParam == WMSZ_BOTTOMRIGHT);
r->left = pos.getX();
r->top = pos.getY();
r->right = pos.getRight();
r->bottom = pos.getBottom();
}
return TRUE;
case WM_WINDOWPOSCHANGING:
if ((styleFlags & (windowHasTitleBar | windowIsResizable)) == (windowHasTitleBar | windowIsResizable))
if (constrainer != 0 && (styleFlags & (windowHasTitleBar | windowIsResizable)) == (windowHasTitleBar | windowIsResizable))
{
WINDOWPOS* const wp = (WINDOWPOS*) lParam;
if ((wp->flags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE))
if ((wp->flags & (SWP_NOMOVE | SWP_NOSIZE)) != (SWP_NOMOVE | SWP_NOSIZE)
&& ! Component::isMouseButtonDownAnywhere())
{
if (constrainer != 0)
{
const Rectangle<int> current (component->getX() - windowBorder.getLeft(),
component->getY() - windowBorder.getTop(),
component->getWidth() + windowBorder.getLeftAndRight(),
component->getHeight() + windowBorder.getTopAndBottom());
Rectangle<int> pos (wp->x, wp->y, wp->cx, wp->cy);
const Rectangle<int> current (windowBorder.addedTo (component->getBounds()));
Rectangle<int> pos (wp->x, wp->y, wp->cx, wp->cy);
constrainer->checkBounds (pos, current,
Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
pos.getY() != current.getY() && pos.getBottom() == current.getBottom(),
pos.getX() != current.getX() && pos.getRight() == current.getRight(),
pos.getY() == current.getY() && pos.getBottom() != current.getBottom(),
pos.getX() == current.getX() && pos.getRight() != current.getRight());
wp->x = pos.getX();
wp->y = pos.getY();
wp->cx = pos.getWidth();
wp->cy = pos.getHeight();
}
constrainer->checkBounds (pos, current,
Desktop::getInstance().getAllMonitorDisplayAreas().getBounds(),
pos.getY() != current.getY() && pos.getBottom() == current.getBottom(),
pos.getX() != current.getX() && pos.getRight() == current.getRight(),
pos.getY() == current.getY() && pos.getBottom() != current.getBottom(),
pos.getX() == current.getX() && pos.getRight() != current.getRight());
wp->x = pos.getX();
wp->y = pos.getY();
wp->cx = pos.getWidth();
wp->cy = pos.getHeight();
}
}
return 0;
case WM_WINDOWPOSCHANGED:
@ -2755,12 +2767,12 @@ public:
{
}
virtual ~JuceDataObject()
~JuceDataObject()
{
jassert (refCount == 0);
}
HRESULT __stdcall GetData (FORMATETC __RPC_FAR* pFormatEtc, STGMEDIUM __RPC_FAR* pMedium)
HRESULT __stdcall GetData (FORMATETC* pFormatEtc, STGMEDIUM* pMedium)
{
if ((pFormatEtc->tymed & format->tymed) != 0
&& pFormatEtc->cfFormat == format->cfFormat
@ -2787,7 +2799,7 @@ public:
return DV_E_FORMATETC;
}
HRESULT __stdcall QueryGetData (FORMATETC __RPC_FAR* f)
HRESULT __stdcall QueryGetData (FORMATETC* f)
{
if (f == 0)
return E_INVALIDARG;
@ -2800,13 +2812,13 @@ public:
return DV_E_FORMATETC;
}
HRESULT __stdcall GetCanonicalFormatEtc (FORMATETC __RPC_FAR*, FORMATETC __RPC_FAR* pFormatEtcOut)
HRESULT __stdcall GetCanonicalFormatEtc (FORMATETC*, FORMATETC* pFormatEtcOut)
{
pFormatEtcOut->ptd = 0;
return E_NOTIMPL;
}
HRESULT __stdcall EnumFormatEtc (DWORD direction, IEnumFORMATETC __RPC_FAR *__RPC_FAR *result)
HRESULT __stdcall EnumFormatEtc (DWORD direction, IEnumFORMATETC** result)
{
if (result == 0)
return E_POINTER;
@ -2821,11 +2833,11 @@ public:
return E_NOTIMPL;
}
HRESULT __stdcall GetDataHere (FORMATETC __RPC_FAR*, STGMEDIUM __RPC_FAR*) { return DATA_E_FORMATETC; }
HRESULT __stdcall SetData (FORMATETC __RPC_FAR*, STGMEDIUM __RPC_FAR*, BOOL) { return E_NOTIMPL; }
HRESULT __stdcall DAdvise (FORMATETC __RPC_FAR*, DWORD, IAdviseSink __RPC_FAR*, DWORD __RPC_FAR*) { return OLE_E_ADVISENOTSUPPORTED; }
HRESULT __stdcall DUnadvise (DWORD) { return E_NOTIMPL; }
HRESULT __stdcall EnumDAdvise (IEnumSTATDATA __RPC_FAR *__RPC_FAR *) { return OLE_E_ADVISENOTSUPPORTED; }
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; }
private:
JuceDropSource* const dropSource;