Browse Source

Fix for mouse event click counts. Fix for webkit mouse-moves. Cleaned up some Component coordinate conversion methods, adding some new ones for rectangle conversion.

tags/2021-05-28
Julian Storer 15 years ago
parent
commit
79899f87e0
38 changed files with 1268 additions and 957 deletions
  1. +10
    -10
      extras/Jucer (experimental)/Source/Application/jucer_Application.h
  2. +2
    -2
      extras/juce demo/Source/demos/AudioDemoPlaybackPage.cpp
  3. +1
    -1
      extras/juce demo/Source/demos/AudioDemoRecordPage.cpp
  4. +232
    -137
      juce_amalgamated.cpp
  5. +112
    -49
      juce_amalgamated.h
  6. +1
    -1
      src/audio/plugins/formats/juce_VSTPluginFormat.cpp
  7. +1
    -2
      src/audio/processors/juce_AudioProcessor.h
  8. +43
    -12
      src/containers/juce_ReferenceCountedObject.h
  9. +1
    -1
      src/core/juce_StandardHeader.h
  10. +19
    -15
      src/events/juce_ListenerList.h
  11. +2
    -2
      src/gui/components/controls/juce_ListBox.cpp
  12. +2
    -2
      src/gui/components/controls/juce_Slider.cpp
  13. +1
    -1
      src/gui/components/controls/juce_TreeView.cpp
  14. +113
    -49
      src/gui/components/juce_Component.cpp
  15. +42
    -17
      src/gui/components/juce_Component.h
  16. +2
    -2
      src/gui/components/juce_Desktop.cpp
  17. +1
    -1
      src/gui/components/layout/juce_ComponentMovementWatcher.cpp
  18. +12
    -6
      src/gui/components/lookandfeel/juce_LookAndFeel.cpp
  19. +2
    -2
      src/gui/components/menus/juce_PopupMenu.cpp
  20. +2
    -2
      src/gui/components/mouse/juce_ComponentDragger.cpp
  21. +6
    -6
      src/gui/components/mouse/juce_DragAndDropContainer.cpp
  22. +4
    -4
      src/gui/components/mouse/juce_MouseEvent.cpp
  23. +23
    -19
      src/gui/components/mouse/juce_MouseInputSource.cpp
  24. +2
    -2
      src/gui/components/special/juce_BubbleComponent.cpp
  25. +5
    -5
      src/gui/components/special/juce_MagnifierComponent.cpp
  26. +1
    -2
      src/gui/components/windows/juce_CallOutBox.cpp
  27. +13
    -3
      src/gui/components/windows/juce_ComponentPeer.cpp
  28. +8
    -2
      src/gui/components/windows/juce_ComponentPeer.h
  29. +1
    -1
      src/gui/components/windows/juce_TooltipWindow.cpp
  30. +5
    -7
      src/gui/components/windows/juce_TopLevelWindow.cpp
  31. +572
    -572
      src/native/linux/juce_linux_Fonts.cpp
  32. +2
    -2
      src/native/linux/juce_linux_Windowing.cpp
  33. +5
    -5
      src/native/mac/juce_iphone_UIViewComponentPeer.mm
  34. +1
    -1
      src/native/mac/juce_mac_NSViewComponent.mm
  35. +4
    -4
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  36. +8
    -0
      src/native/mac/juce_mac_WebBrowserComponent.mm
  37. +2
    -3
      src/native/windows/juce_win32_ActiveXComponent.cpp
  38. +5
    -5
      src/native/windows/juce_win32_Windowing.cpp

+ 10
- 10
extras/Jucer (experimental)/Source/Application/jucer_Application.h View File

@@ -33,7 +33,7 @@
//============================================================================== //==============================================================================
class JucerApplication : public JUCEApplication
class JucerApplication : public JUCEApplication
{ {
public: public:
//============================================================================== //==============================================================================
@@ -76,18 +76,18 @@ public:
openFile (projects.getReference(i)); openFile (projects.getReference(i));
} }
#if JUCE_MAC
#if JUCE_MAC
MenuBarModel::setMacMainMenu (menuModel); MenuBarModel::setMacMainMenu (menuModel);
#endif
#endif
main->setVisible (true); main->setVisible (true);
} }
void shutdown() void shutdown()
{ {
#if JUCE_MAC
#if JUCE_MAC
MenuBarModel::setMacMainMenu (0); MenuBarModel::setMacMainMenu (0);
#endif
#endif
menuModel = 0; menuModel = 0;
StoredSettings::deleteInstance(); StoredSettings::deleteInstance();
@@ -116,10 +116,10 @@ public:
jassert (mainWindows.contains (w)); jassert (mainWindows.contains (w));
mainWindows.removeObject (w); mainWindows.removeObject (w);
#if ! JUCE_MAC
#if ! JUCE_MAC
if (mainWindows.size() == 0) if (mainWindows.size() == 0)
systemRequestedQuit(); systemRequestedQuit();
#endif
#endif
updateRecentProjectList(); updateRecentProjectList();
} }
@@ -137,11 +137,11 @@ public:
bool moreThanOneInstanceAllowed() bool moreThanOneInstanceAllowed()
{ {
#ifndef JUCE_LINUX
#ifndef JUCE_LINUX
return false; return false;
#else
#else
return true; //xxx should be false but doesn't work on linux.. return true; //xxx should be false but doesn't work on linux..
#endif
#endif
} }
void anotherInstanceStarted (const String& commandLine) void anotherInstanceStarted (const String& commandLine)


+ 2
- 2
extras/juce demo/Source/demos/AudioDemoPlaybackPage.cpp View File

@@ -105,12 +105,12 @@ public:
repaint(); repaint();
} }
bool isInterestedInFileDrag (const StringArray& files)
bool isInterestedInFileDrag (const StringArray& /*files*/)
{ {
return true; return true;
} }
void filesDropped (const StringArray& files, int x, int y)
void filesDropped (const StringArray& files, int /*x*/, int /*y*/)
{ {
AudioDemoPlaybackPage* demoPage = findParentComponentOfClass ((AudioDemoPlaybackPage*) 0); AudioDemoPlaybackPage* demoPage = findParentComponentOfClass ((AudioDemoPlaybackPage*) 0);


+ 1
- 1
extras/juce demo/Source/demos/AudioDemoRecordPage.cpp View File

@@ -110,7 +110,7 @@ public:
sampleRate = 0; sampleRate = 0;
} }
void audioDeviceIOCallback (const float** inputChannelData, int numInputChannels,
void audioDeviceIOCallback (const float** inputChannelData, int /*numInputChannels*/,
float** outputChannelData, int numOutputChannels, float** outputChannelData, int numOutputChannels,
int numSamples) int numSamples)
{ {


+ 232
- 137
juce_amalgamated.cpp View File

@@ -34077,7 +34077,7 @@ public:


if (topComp->getPeer() != 0) if (topComp->getPeer() != 0)
{ {
const Point<int> pos (relativePositionToOtherComponent (topComp, Point<int>()));
const Point<int> pos (topComp->getLocalPoint (this, Point<int>()));


recursiveResize = true; recursiveResize = true;


@@ -40045,8 +40045,7 @@ Component::~Component()
{ {
parentComponent_->removeChildComponent (this); parentComponent_->removeChildComponent (this);
} }
else if ((currentlyFocusedComponent == this)
|| isParentOf (currentlyFocusedComponent))
else if (currentlyFocusedComponent == this || isParentOf (currentlyFocusedComponent))
{ {
giveAwayFocus(); giveAwayFocus();
} }
@@ -40216,7 +40215,7 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo)
jmax (1, getHeight())); jmax (1, getHeight()));
#endif #endif


const Point<int> topLeft (relativePositionToGlobal (Point<int> (0, 0)));
const Point<int> topLeft (getScreenPosition());


bool wasFullscreen = false; bool wasFullscreen = false;
bool wasMinimised = false; bool wasMinimised = false;
@@ -40555,7 +40554,7 @@ int Component::getScreenY() const


const Point<int> Component::getScreenPosition() const const Point<int> Component::getScreenPosition() const
{ {
return relativePositionToGlobal (Point<int>());
return localPointToGlobal (Point<int>());
} }


const Rectangle<int> Component::getScreenBounds() const const Rectangle<int> Component::getScreenBounds() const
@@ -40563,51 +40562,116 @@ const Rectangle<int> Component::getScreenBounds() const
return bounds_.withPosition (getScreenPosition()); return bounds_.withPosition (getScreenPosition());
} }


const Point<int> Component::relativePositionToGlobal (const Point<int>& relativePosition) const
{
return relativePositionToOtherComponent (0, relativePosition);
}

const Point<int> Component::globalPositionToRelative (const Point<int>& screenPosition) const
namespace CoordinateHelpers
{ {
if (flags.hasHeavyweightPeerFlag)
const Point<int> convertFromParentSpace (const Component* comp, const Point<int>& pointInParentSpace)
{ {
return getPeer()->globalPositionToRelative (screenPosition);
return pointInParentSpace - comp->getPosition();
} }
else

const Rectangle<int> convertFromParentSpace (const Component* comp, const Rectangle<int>& areaInParentSpace)
{ {
if (parentComponent_ != 0)
return parentComponent_->globalPositionToRelative (screenPosition) - getPosition();
return areaInParentSpace - comp->getPosition();
}


return screenPosition - getPosition();
const Point<int> convertToParentSpace (const Component* comp, const Point<int>& pointInLocalSpace)
{
return pointInLocalSpace + comp->getPosition();
} }
}


const Point<int> Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point<int>& positionRelativeToThis) const
{
Point<int> p (positionRelativeToThis);
const Component* c = this;
const Rectangle<int> convertToParentSpace (const Component* comp, const Rectangle<int>& areaInLocalSpace)
{
return areaInLocalSpace + comp->getPosition();
}


do
template <typename Type>
const Type convertFromDistantParentSpace (const Component* parent, const Component* target, Type coordInParent)
{ {
if (c == targetComponent)
return p;
const Component* const directParent = target->getParentComponent();
jassert (directParent != 0);

if (directParent == parent)
return convertFromParentSpace (target, coordInParent);

return convertFromParentSpace (target, convertFromDistantParentSpace (parent, directParent, coordInParent));
}


if (c->flags.hasHeavyweightPeerFlag)
template <typename Type>
const Type convertCoordinate (const Component* target, const Component* source, Type p)
{
while (source != 0)
{ {
p = c->getPeer()->relativePositionToGlobal (p);
break;
if (source == target)
return p;

if (source->isParentOf (target))
return convertFromDistantParentSpace (source, target, p);

if (source->isOnDesktop())
{
p = source->getPeer()->localToGlobal (p);
source = 0;
}
else
{
p = convertToParentSpace (source, p);
source = source->getParentComponent();
}
} }


p += c->getPosition();
c = c->parentComponent_;
jassert (source == 0);
if (target == 0)
return p;

const Component* const topLevelComp = target->getTopLevelComponent();

if (topLevelComp->isOnDesktop())
p = topLevelComp->getPeer()->globalToLocal (p);
else
p = convertFromParentSpace (topLevelComp, p);

if (topLevelComp == target)
return p;

return convertFromDistantParentSpace (topLevelComp, target, p);
} }
while (c != 0);
}


if (targetComponent != 0)
p = targetComponent->globalPositionToRelative (p);
const Point<int> Component::getLocalPoint (const Component* source, const Point<int>& point) const
{
return CoordinateHelpers::convertCoordinate (this, source, point);
}


return p;
const Rectangle<int> Component::getLocalArea (const Component* source, const Rectangle<int>& area) const
{
return CoordinateHelpers::convertCoordinate (this, source, area);
}

const Point<int> Component::localPointToGlobal (const Point<int>& point) const
{
return CoordinateHelpers::convertCoordinate (0, this, point);
}

const Rectangle<int> Component::localAreaToGlobal (const Rectangle<int>& area) const
{
return CoordinateHelpers::convertCoordinate (0, this, area);
}

/* Deprecated methods... */
const Point<int> Component::relativePositionToGlobal (const Point<int>& relativePosition) const
{
return localPointToGlobal (relativePosition);
}

const Point<int> Component::globalPositionToRelative (const Point<int>& screenPosition) const
{
return getLocalPoint (0, screenPosition);
}

const Point<int> Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point<int>& positionRelativeToThis) const
{
return targetComponent == 0 ? localPointToGlobal (positionRelativeToThis)
: targetComponent->getLocalPoint (this, positionRelativeToThis);
} }


void Component::setBounds (const int x, const int y, int w, int h) void Component::setBounds (const int x, const int y, int w, int h)
@@ -41685,7 +41749,7 @@ void Component::getVisibleArea (RectangleList& result, const bool includeSibling
{ {
const Component* const c = getTopLevelComponent(); const Component* const c = getTopLevelComponent();


c->subtractObscuredRegions (result, c->relativePositionToOtherComponent (this, Point<int>()),
c->subtractObscuredRegions (result, getLocalPoint (c, Point<int>()),
c->getLocalBounds(), this); c->getLocalBounds(), this);
} }


@@ -41896,7 +41960,7 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
{ {
flags.mouseInsideFlag = true; flags.mouseInsideFlag = true;
flags.mouseOverFlag = true; flags.mouseOverFlag = true;
flags.draggingFlag = false;
flags.mouseDownFlag = false;


BailOutChecker checker (this); BailOutChecker checker (this);


@@ -41921,7 +41985,7 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
{ {
BailOutChecker checker (this); BailOutChecker checker (this);


if (flags.draggingFlag)
if (flags.mouseDownFlag)
{ {
internalMouseUp (source, relativePos, time, source.getCurrentModifiers().getRawFlags()); internalMouseUp (source, relativePos, time, source.getCurrentModifiers().getRawFlags());


@@ -41933,7 +41997,7 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
{ {
flags.mouseInsideFlag = false; flags.mouseInsideFlag = false;
flags.mouseOverFlag = false; flags.mouseOverFlag = false;
flags.draggingFlag = false;
flags.mouseDownFlag = false;


if (flags.repaintOnMouseActivityFlag) if (flags.repaintOnMouseActivityFlag)
repaint(); repaint();
@@ -42059,7 +42123,7 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
return; return;
} }


flags.draggingFlag = true;
flags.mouseDownFlag = true;
flags.mouseOverFlag = true; flags.mouseOverFlag = true;


if (flags.repaintOnMouseActivityFlag) if (flags.repaintOnMouseActivityFlag)
@@ -42081,11 +42145,11 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r


void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers) void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers)
{ {
if (flags.draggingFlag)
if (flags.mouseDownFlag)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();


flags.draggingFlag = false;
flags.mouseDownFlag = false;


BailOutChecker checker (this); BailOutChecker checker (this);


@@ -42094,7 +42158,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel


const MouseEvent me (source, relativePos, const MouseEvent me (source, relativePos,
oldModifiers, this, this, time, oldModifiers, this, this, time,
globalPositionToRelative (source.getLastMouseDownPosition()),
getLocalPoint (0, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(), source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(), source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed()); source.hasMouseMovedSignificantlySincePressed());
@@ -42128,7 +42192,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel


void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time) void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{ {
if (flags.draggingFlag)
if (flags.mouseDownFlag)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();


@@ -42138,7 +42202,7 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& r


const MouseEvent me (source, relativePos, const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time, source.getCurrentModifiers(), this, this, time,
globalPositionToRelative (source.getLastMouseDownPosition()),
getLocalPoint (0, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(), source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(), source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed()); source.hasMouseMovedSignificantlySincePressed());
@@ -42161,8 +42225,7 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
BailOutChecker checker (this); BailOutChecker checker (this);


const MouseEvent me (source, relativePos, source.getCurrentModifiers(), const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos,
time, 0, false);
this, this, time, relativePos, time, 0, false);


if (isCurrentlyBlockedByAnotherModalComponent()) if (isCurrentlyBlockedByAnotherModalComponent())
{ {
@@ -42572,12 +42635,12 @@ bool Component::isMouseOver() const throw()


bool Component::isMouseButtonDown() const throw() bool Component::isMouseButtonDown() const throw()
{ {
return flags.draggingFlag;
return flags.mouseDownFlag;
} }


bool Component::isMouseOverOrDragging() const throw() bool Component::isMouseOverOrDragging() const throw()
{ {
return flags.mouseOverFlag || flags.draggingFlag;
return flags.mouseOverFlag || flags.mouseDownFlag;
} }


bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw() bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw()
@@ -42587,13 +42650,13 @@ bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw()


const Point<int> Component::getMouseXYRelative() const const Point<int> Component::getMouseXYRelative() const
{ {
return globalPositionToRelative (Desktop::getMousePosition());
return getLocalPoint (0, Desktop::getMousePosition());
} }


const Rectangle<int> Component::getParentMonitorArea() const const Rectangle<int> Component::getParentMonitorArea() const
{ {
return Desktop::getInstance() return Desktop::getInstance()
.getMonitorAreaContaining (relativePositionToGlobal (getLocalBounds().getCentre()));
.getMonitorAreaContaining (localPointToGlobal (getLocalBounds().getCentre()));
} }


void Component::addKeyListener (KeyListener* const newListener) void Component::addKeyListener (KeyListener* const newListener)
@@ -42800,7 +42863,7 @@ Component* Desktop::findComponentAt (const Point<int>& screenPosition) const


if (c->isVisible()) if (c->isVisible())
{ {
const Point<int> relative (c->globalPositionToRelative (screenPosition));
const Point<int> relative (c->getLocalPoint (0, screenPosition));


if (c->contains (relative.getX(), relative.getY())) if (c->contains (relative.getX(), relative.getY()))
return c->getComponentAt (relative.getX(), relative.getY()); return c->getComponentAt (relative.getX(), relative.getY());
@@ -42941,7 +43004,7 @@ void Desktop::sendMouseMove()
if (target != 0) if (target != 0)
{ {
Component::BailOutChecker checker (target); Component::BailOutChecker checker (target);
const Point<int> pos (target->globalPositionToRelative (lastFakeMouseMove));
const Point<int> pos (target->getLocalPoint (0, lastFakeMouseMove));
const Time now (Time::getCurrentTime()); const Time now (Time::getCurrentTime());


const MouseEvent me (getMainMouseSource(), pos, ModifierKeys::getCurrentModifiers(), const MouseEvent me (getMainMouseSource(), pos, ModifierKeys::getCurrentModifiers(),
@@ -49341,7 +49404,7 @@ const Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY)


if (rowComp != 0 && isRowSelected (firstRow + i)) if (rowComp != 0 && isRowSelected (firstRow + i))
{ {
const Point<int> pos (rowComp->relativePositionToOtherComponent (this, Point<int>()));
const Point<int> pos (getLocalPoint (rowComp, Point<int>()));
const Rectangle<int> rowRect (pos.getX(), pos.getY(), rowComp->getWidth(), rowComp->getHeight()); const Rectangle<int> rowRect (pos.getX(), pos.getY(), rowComp->getWidth(), rowComp->getHeight());
imageArea = imageArea.getUnion (rowRect); imageArea = imageArea.getUnion (rowRect);
} }
@@ -49358,7 +49421,7 @@ const Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY)


if (rowComp != 0 && isRowSelected (firstRow + i)) if (rowComp != 0 && isRowSelected (firstRow + i))
{ {
const Point<int> pos (rowComp->relativePositionToOtherComponent (this, Point<int>()));
const Point<int> pos (getLocalPoint (rowComp, Point<int>()));


Graphics g (snapshot); Graphics g (snapshot);
g.setOrigin (pos.getX() - imageX, pos.getY() - imageY); g.setOrigin (pos.getX() - imageX, pos.getY() - imageY);
@@ -50634,8 +50697,8 @@ void Slider::restoreMouseIfHidden()
{ {
const int pixelPos = (int) getLinearSliderPos (pos); const int pixelPos = (int) getLinearSliderPos (pos);


mousePos = relativePositionToGlobal (Point<int> (isHorizontal() ? pixelPos : (getWidth() / 2),
isVertical() ? pixelPos : (getHeight() / 2)));
mousePos = localPointToGlobal (Point<int> (isHorizontal() ? pixelPos : (getWidth() / 2),
isVertical() ? pixelPos : (getHeight() / 2)));
} }


Desktop::setMousePosition (mousePos); Desktop::setMousePosition (mousePos);
@@ -56676,7 +56739,7 @@ TreeViewItem* TreeView::getItemAt (int y) const throw()
{ {
TreeViewContentComponent* const tc = static_cast <TreeViewContentComponent*> (viewport->getViewedComponent()); TreeViewContentComponent* const tc = static_cast <TreeViewContentComponent*> (viewport->getViewedComponent());
Rectangle<int> pos; Rectangle<int> pos;
return tc->findItemAt (relativePositionToOtherComponent (tc, Point<int> (0, y)).getY(), pos);
return tc->findItemAt (tc->getLocalPoint (this, Point<int> (0, y)).getY(), pos);
} }


TreeViewItem* TreeView::findItemFromIdentifierString (const String& identifierString) const TreeViewItem* TreeView::findItemFromIdentifierString (const String& identifierString) const
@@ -62028,7 +62091,7 @@ void ComponentMovementWatcher::componentMovedOrResized (Component&, bool wasMove


if (wasMoved) if (wasMoved)
{ {
const Point<int> pos (component->relativePositionToOtherComponent (component->getTopLevelComponent(), Point<int>()));
const Point<int> pos (component->getTopLevelComponent()->getLocalPoint (component, Point<int>()));


wasMoved = lastBounds.getPosition() != pos; wasMoved = lastBounds.getPosition() != pos;
lastBounds.setPosition (pos); lastBounds.setPosition (pos);
@@ -65059,6 +65122,9 @@ namespace LookAndFeelHelpers


return tl; return tl;
} }

LookAndFeel* defaultLF = 0;
LookAndFeel* currentDefaultLF = 0;
} }


LookAndFeel::LookAndFeel() LookAndFeel::LookAndFeel()
@@ -65212,6 +65278,8 @@ LookAndFeel::LookAndFeel()


LookAndFeel::~LookAndFeel() LookAndFeel::~LookAndFeel()
{ {
if (this == LookAndFeelHelpers::currentDefaultLF)
setDefaultLookAndFeel (0);
} }


const Colour LookAndFeel::findColour (const int colourId) const throw() const Colour LookAndFeel::findColour (const int colourId) const throw()
@@ -65245,21 +65313,20 @@ bool LookAndFeel::isColourSpecified (const int colourId) const throw()
return colourIds.contains (colourId); return colourIds.contains (colourId);
} }


static LookAndFeel* defaultLF = 0;
static LookAndFeel* currentDefaultLF = 0;

LookAndFeel& LookAndFeel::getDefaultLookAndFeel() throw() LookAndFeel& LookAndFeel::getDefaultLookAndFeel() throw()
{ {
// if this happens, your app hasn't initialised itself properly.. if you're // if this happens, your app hasn't initialised itself properly.. if you're
// trying to hack your own main() function, have a look at // trying to hack your own main() function, have a look at
// JUCEApplication::initialiseForGUI() // JUCEApplication::initialiseForGUI()
jassert (currentDefaultLF != 0);
jassert (LookAndFeelHelpers::currentDefaultLF != 0);


return *currentDefaultLF;
return *LookAndFeelHelpers::currentDefaultLF;
} }


void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw() void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw()
{ {
using namespace LookAndFeelHelpers;

if (newDefaultLookAndFeel == 0) if (newDefaultLookAndFeel == 0)
{ {
if (defaultLF == 0) if (defaultLF == 0)
@@ -65268,7 +65335,7 @@ void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) thr
newDefaultLookAndFeel = defaultLF; newDefaultLookAndFeel = defaultLF;
} }


currentDefaultLF = newDefaultLookAndFeel;
LookAndFeelHelpers::currentDefaultLF = newDefaultLookAndFeel;


for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;) for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
{ {
@@ -65281,6 +65348,8 @@ void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) thr


void LookAndFeel::clearDefaultLookAndFeel() throw() void LookAndFeel::clearDefaultLookAndFeel() throw()
{ {
using namespace LookAndFeelHelpers;

if (currentDefaultLF == defaultLF) if (currentDefaultLF == defaultLF)
currentDefaultLF = 0; currentDefaultLF = 0;


@@ -69481,7 +69550,7 @@ public:
// move rather than a real timer callback // move rather than a real timer callback


const Point<int> globalMousePos (Desktop::getMousePosition()); const Point<int> globalMousePos (Desktop::getMousePosition());
const Point<int> localMousePos (globalPositionToRelative (globalMousePos));
const Point<int> localMousePos (getLocalPoint (0, globalMousePos));


const uint32 now = Time::getMillisecondCounter(); const uint32 now = Time::getMillisecondCounter();


@@ -69649,7 +69718,7 @@ private:


void updateMouseOverStatus (const Point<int>& globalMousePos) void updateMouseOverStatus (const Point<int>& globalMousePos)
{ {
const Point<int> relPos (globalPositionToRelative (globalMousePos));
const Point<int> relPos (getLocalPoint (0, globalMousePos));
isOver = reallyContains (relPos.getX(), relPos.getY(), true); isOver = reallyContains (relPos.getX(), relPos.getY(), true);


if (activeSubMenu != 0) if (activeSubMenu != 0)
@@ -70633,7 +70702,7 @@ void ComponentDragger::startDraggingComponent (Component* const componentToDrag,
if (componentToDrag != 0) if (componentToDrag != 0)
{ {
constrainer = constrainer_; constrainer = constrainer_;
originalPos = componentToDrag->relativePositionToGlobal (Point<int>());
originalPos = componentToDrag->localPointToGlobal (Point<int>());
} }
} }


@@ -70648,7 +70717,7 @@ void ComponentDragger::dragComponent (Component* const componentToDrag, const Mo


const Component* const parentComp = componentToDrag->getParentComponent(); const Component* const parentComp = componentToDrag->getParentComponent();
if (parentComp != 0) if (parentComp != 0)
bounds.setPosition (parentComp->globalPositionToRelative (originalPos));
bounds.setPosition (parentComp->getLocalPoint (0, originalPos));


bounds.setPosition (bounds.getPosition() + e.getOffsetFromDragStart()); bounds.setPosition (bounds.getPosition() + e.getOffsetFromDragStart());


@@ -70737,7 +70806,7 @@ public:
} }
else else
{ {
const Point<int> relPos (hit->globalPositionToRelative (screenPos));
const Point<int> relPos (hit->getLocalPoint (0, screenPos));
hit = hit->getComponentAt (relPos.getX(), relPos.getY()); hit = hit->getComponentAt (relPos.getX(), relPos.getY());
} }


@@ -70751,7 +70820,7 @@ public:


if (ddt != 0 && ddt->isInterestedInDragSource (dragDescLocal, source)) if (ddt != 0 && ddt->isInterestedInDragSource (dragDescLocal, source))
{ {
relativePos = hit->globalPositionToRelative (screenPos);
relativePos = hit->getLocalPoint (0, screenPos);
return ddt; return ddt;
} }


@@ -70789,8 +70858,8 @@ public:
} }
else else
{ {
const Point<int> target (source->relativePositionToGlobal (source->getLocalBounds().getCentre()));
const Point<int> ourCentre (relativePositionToGlobal (getLocalBounds().getCentre()));
const Point<int> target (source->localPointToGlobal (source->getLocalBounds().getCentre()));
const Point<int> ourCentre (localPointToGlobal (getLocalBounds().getCentre()));


Desktop::getInstance().getAnimator().animateComponent (this, Desktop::getInstance().getAnimator().animateComponent (this,
getBounds() + (target - ourCentre), getBounds() + (target - ourCentre),
@@ -70826,7 +70895,7 @@ public:
Point<int> newPos (screenPos + imageOffset); Point<int> newPos (screenPos + imageOffset);


if (getParentComponent() != 0) if (getParentComponent() != 0)
newPos = getParentComponent()->globalPositionToRelative (newPos);
newPos = getParentComponent()->getLocalPoint (0, newPos);


//if (newX != getX() || newY != getY()) //if (newX != getX() || newY != getY())
{ {
@@ -70972,7 +71041,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription,
const int lo = 150; const int lo = 150;
const int hi = 400; const int hi = 400;


Point<int> relPos (sourceComponent->globalPositionToRelative (lastMouseDown));
Point<int> relPos (sourceComponent->getLocalPoint (0, lastMouseDown));
Point<int> clipped (dragImage.getBounds().getConstrainedPoint (relPos)); Point<int> clipped (dragImage.getBounds().getConstrainedPoint (relPos));


for (int y = dragImage.getHeight(); --y >= 0;) for (int y = dragImage.getHeight(); --y >= 0;)
@@ -71276,9 +71345,9 @@ const MouseEvent MouseEvent::getEventRelativeTo (Component* const otherComponent
return *this; return *this;
} }


return MouseEvent (source, eventComponent->relativePositionToOtherComponent (otherComponent, getPosition()),
return MouseEvent (source, otherComponent->getLocalPoint (eventComponent, getPosition()),
mods, otherComponent, originalComponent, eventTime, mods, otherComponent, originalComponent, eventTime,
eventComponent->relativePositionToOtherComponent (otherComponent, mouseDownPos),
otherComponent->getLocalPoint (eventComponent, mouseDownPos),
mouseDownTime, numberOfClicks, wasMovedSinceMouseDown); mouseDownTime, numberOfClicks, wasMovedSinceMouseDown);
} }


@@ -71354,7 +71423,7 @@ int MouseEvent::getScreenY() const


const Point<int> MouseEvent::getScreenPosition() const const Point<int> MouseEvent::getScreenPosition() const
{ {
return eventComponent->relativePositionToGlobal (Point<int> (x, y));
return eventComponent->localPointToGlobal (Point<int> (x, y));
} }


int MouseEvent::getMouseDownScreenX() const int MouseEvent::getMouseDownScreenX() const
@@ -71369,7 +71438,7 @@ int MouseEvent::getMouseDownScreenY() const


const Point<int> MouseEvent::getMouseDownScreenPosition() const const Point<int> MouseEvent::getMouseDownScreenPosition() const
{ {
return eventComponent->relativePositionToGlobal (mouseDownPos);
return eventComponent->localPointToGlobal (mouseDownPos);
} }


int MouseEvent::doubleClickTimeOutMs = 400; int MouseEvent::doubleClickTimeOutMs = 400;
@@ -71400,7 +71469,6 @@ public:
isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0), isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0),
mouseEventCounter (0), lastTime (0) mouseEventCounter (0), lastTime (0)
{ {
zerostruct (mouseDowns);
} }


~MouseInputSourceInternal() ~MouseInputSourceInternal()
@@ -71437,7 +71505,7 @@ public:
if (peer != 0) if (peer != 0)
{ {
Component* const comp = peer->getComponent(); Component* const comp = peer->getComponent();
const Point<int> relativePos (comp->globalPositionToRelative (screenPos));
const Point<int> relativePos (comp->getLocalPoint (0, screenPos));


// (the contains() call is needed to test for overlapping desktop windows) // (the contains() call is needed to test for overlapping desktop windows)
if (comp->contains (relativePos.getX(), relativePos.getY())) if (comp->contains (relativePos.getX(), relativePos.getY()))
@@ -71454,44 +71522,44 @@ public:


void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseEnter (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time);
} }


void sendMouseExit (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseExit (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseExit (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time);
} }


void sendMouseMove (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseMove (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseMove (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time);
} }


void sendMouseDown (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDown (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDown (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time);
} }


void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDrag (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time);
} }


void sendMouseUp (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseUp (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->globalPositionToRelative (screenPos), time, getCurrentModifiers());
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers());
} }


void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const int64 time, float x, float y) void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const int64 time, float x, float y)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseWheel (source, comp->globalPositionToRelative (screenPos), time, x, y);
//DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y);
} }


// (returns true if the button change caused a modal event loop) // (returns true if the button change caused a modal event loop)
@@ -71615,7 +71683,7 @@ public:
jassert (newPeer != 0); jassert (newPeer != 0);
lastTime = time; lastTime = time;
++mouseEventCounter; ++mouseEventCounter;
const Point<int> screenPos (newPeer->relativePositionToGlobal (positionWithinPeer));
const Point<int> screenPos (newPeer->localToGlobal (positionWithinPeer));


if (isDragging() && newMods.isAnyMouseButtonDown()) if (isDragging() && newMods.isAnyMouseButtonDown())
{ {
@@ -71643,7 +71711,7 @@ public:
jassert (peer != 0); jassert (peer != 0);
lastTime = time; lastTime = time;
++mouseEventCounter; ++mouseEventCounter;
const Point<int> screenPos (peer->relativePositionToGlobal (positionWithinPeer));
const Point<int> screenPos (peer->localToGlobal (positionWithinPeer));


setPeer (peer, screenPos, time); setPeer (peer, screenPos, time);
setScreenPos (screenPos, time, false); setScreenPos (screenPos, time, false);
@@ -71678,7 +71746,7 @@ public:


for (int i = 1; i < numElementsInArray (mouseDowns); ++i) for (int i = 1; i < numElementsInArray (mouseDowns); ++i)
{ {
if (mouseDowns[0].canBePartOfMultipleClickWith (mouseDowns[1], (int) (MouseEvent::getDoubleClickTimeout() * (1.0 + 0.25 * (i - 1)))))
if (mouseDowns[0].canBePartOfMultipleClickWith (mouseDowns[i], (int) (MouseEvent::getDoubleClickTimeout() * (1.0 + 0.25 * (i - 1)))))
++numClicks; ++numClicks;
else else
break; break;
@@ -71794,6 +71862,11 @@ private:


struct RecentMouseDown struct RecentMouseDown
{ {
RecentMouseDown()
: time (0), component (0)
{
}

Point<int> position; Point<int> position;
int64 time; int64 time;
Component* component; Component* component;
@@ -74035,9 +74108,9 @@ void BubbleComponent::setPosition (Component* componentToPointTo)
Point<int> pos; Point<int> pos;


if (getParentComponent() != 0) if (getParentComponent() != 0)
pos = componentToPointTo->relativePositionToOtherComponent (getParentComponent(), pos);
pos = getParentComponent()->getLocalPoint (componentToPointTo, pos);
else else
pos = componentToPointTo->relativePositionToGlobal (pos);
pos = componentToPointTo->localPointToGlobal (pos);


setPosition (Rectangle<int> (pos.getX(), pos.getY(), componentToPointTo->getWidth(), componentToPointTo->getHeight())); setPosition (Rectangle<int> (pos.getX(), pos.getY(), componentToPointTo->getWidth(), componentToPointTo->getHeight()));
} }
@@ -75173,16 +75246,16 @@ public:
return magnifierComp->getScreenPosition(); return magnifierComp->getScreenPosition();
} }


const Point<int> relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> localToGlobal (const Point<int>& relativePosition)
{ {
const double zoom = magnifierComp->getScaleFactor(); const double zoom = magnifierComp->getScaleFactor();
return magnifierComp->relativePositionToGlobal (Point<int> (roundToInt (relativePosition.getX() * zoom),
roundToInt (relativePosition.getY() * zoom)));
return magnifierComp->localPointToGlobal (Point<int> (roundToInt (relativePosition.getX() * zoom),
roundToInt (relativePosition.getY() * zoom)));
} }


const Point<int> globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> globalToLocal (const Point<int>& screenPosition)
{ {
const Point<int> p (magnifierComp->globalPositionToRelative (screenPosition));
const Point<int> p (magnifierComp->getLocalPoint (0, screenPosition));
const double zoom = magnifierComp->getScaleFactor(); const double zoom = magnifierComp->getScaleFactor();


return Point<int> (roundToInt (p.getX() / zoom), return Point<int> (roundToInt (p.getX() / zoom),
@@ -77376,8 +77449,7 @@ CallOutBox::CallOutBox (Component& contentComponent,
{ {
parentComponent->addChildComponent (this); parentComponent->addChildComponent (this);


updatePosition (componentToPointTo.getLocalBounds()
+ componentToPointTo.relativePositionToOtherComponent (parentComponent, Point<int>()),
updatePosition (parentComponent->getLocalArea (&componentToPointTo, componentToPointTo.getLocalBounds()),
parentComponent->getLocalBounds()); parentComponent->getLocalBounds());


setVisible (true); setVisible (true);
@@ -77953,6 +78025,16 @@ const Rectangle<int>& ComponentPeer::getNonFullScreenBounds() const throw()
return lastNonFullscreenBounds; return lastNonFullscreenBounds;
} }


const Rectangle<int> ComponentPeer::localToGlobal (const Rectangle<int>& relativePosition)
{
return relativePosition.withPosition (localToGlobal (relativePosition.getPosition()));
}

const Rectangle<int> ComponentPeer::globalToLocal (const Rectangle<int>& screenPosition)
{
return screenPosition.withPosition (globalToLocal (screenPosition.getPosition()));
}

namespace ComponentPeerHelpers namespace ComponentPeerHelpers
{ {
FileDragAndDropTarget* findDragAndDropTarget (Component* c, FileDragAndDropTarget* findDragAndDropTarget (Component* c,
@@ -77999,7 +78081,7 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<in
if (newTarget != 0) if (newTarget != 0)
{ {
dragAndDropTargetComponent = dynamic_cast <Component*> (newTarget); dragAndDropTargetComponent = dynamic_cast <Component*> (newTarget);
const Point<int> pos (component->relativePositionToOtherComponent (dragAndDropTargetComponent, position));
const Point<int> pos (dragAndDropTargetComponent->getLocalPoint (component, position));
newTarget->fileDragEnter (files, pos.getX(), pos.getY()); newTarget->fileDragEnter (files, pos.getX(), pos.getY());
} }
} }
@@ -78012,7 +78094,7 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<in
if (newTarget != 0) if (newTarget != 0)
{ {
Component* const targetComp = dynamic_cast <Component*> (newTarget); Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, position));
const Point<int> pos (targetComp->getLocalPoint (component, position));


newTarget->fileDragMove (files, pos.getX(), pos.getY()); newTarget->fileDragMove (files, pos.getX(), pos.getY());
} }
@@ -78050,7 +78132,7 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
return; return;
} }


const Point<int> pos (component->relativePositionToOtherComponent (targetComp, position));
const Point<int> pos (targetComp->getLocalPoint (component, position));
target->filesDropped (files, pos.getX(), pos.getY()); target->filesDropped (files, pos.getX(), pos.getY());
} }
} }
@@ -79270,7 +79352,7 @@ void TooltipWindow::showFor (const String& tip)
Point<int> mousePos (Desktop::getMousePosition()); Point<int> mousePos (Desktop::getMousePosition());


if (getParentComponent() != 0) if (getParentComponent() != 0)
mousePos = getParentComponent()->globalPositionToRelative (mousePos);
mousePos = getParentComponent()->getLocalPoint (0, mousePos);


int x, y, w, h; int x, y, w, h;
getLookAndFeel().getTooltipSize (tip, w, h); getLookAndFeel().getTooltipSize (tip, w, h);
@@ -79629,21 +79711,19 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const
} }
else else
{ {
Point<int> p (c->relativePositionToGlobal (Point<int> ((c->getWidth() - width) / 2,
(c->getHeight() - height) / 2)));

Point<int> targetCentre (c->localPointToGlobal (c->getLocalBounds().getCentre()));
Rectangle<int> parentArea (c->getParentMonitorArea()); Rectangle<int> parentArea (c->getParentMonitorArea());


if (getParentComponent() != 0) if (getParentComponent() != 0)
{ {
p = getParentComponent()->globalPositionToRelative (p);
parentArea.setBounds (0, 0, getParentWidth(), getParentHeight());
targetCentre = getParentComponent()->getLocalPoint (0, targetCentre);
parentArea = getParentComponent()->getLocalBounds();
} }


parentArea.reduce (12, 12); parentArea.reduce (12, 12);


setBounds (jlimit (parentArea.getX(), jmax (parentArea.getX(), parentArea.getRight() - width), p.getX()),
jlimit (parentArea.getY(), jmax (parentArea.getY(), parentArea.getBottom() - height), p.getY()),
setBounds (jlimit (parentArea.getX(), jmax (parentArea.getX(), parentArea.getRight() - width), targetCentre.getX() - width / 2),
jlimit (parentArea.getY(), jmax (parentArea.getY(), parentArea.getBottom() - height), targetCentre.getY() - height / 2),
width, height); width, height);
} }
} }
@@ -242097,12 +242177,12 @@ public:
r.top + windowBorder.getTop()); r.top + windowBorder.getTop());
} }


const Point<int> relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }


const Point<int> globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }
@@ -243179,7 +243259,7 @@ private:
HRESULT __stdcall DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect) HRESULT __stdcall DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{ {
updateFileList (pDataObject); updateFileList (pDataObject);
owner->handleFileDragMove (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY; *pdwEffect = DROPEFFECT_COPY;
return S_OK; return S_OK;
} }
@@ -243192,7 +243272,7 @@ private:


HRESULT __stdcall DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect) HRESULT __stdcall DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{ {
owner->handleFileDragMove (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY; *pdwEffect = DROPEFFECT_COPY;
return S_OK; return S_OK;
} }
@@ -243200,7 +243280,7 @@ private:
HRESULT __stdcall Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect) HRESULT __stdcall Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{ {
updateFileList (pDataObject); updateFileList (pDataObject);
owner->handleFileDragDrop (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragDrop (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY; *pdwEffect = DROPEFFECT_COPY;
return S_OK; return S_OK;
} }
@@ -244927,8 +245007,7 @@ public:


if (topComp->getPeer() != 0) if (topComp->getPeer() != 0)
{ {
const Point<int> pos (owner.relativePositionToOtherComponent (topComp, Point<int>()));

const Point<int> pos (topComp->getLocalPoint (&owner, Point<int>()));
owner.setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner.getWidth(), owner.getHeight())); owner.setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner.getWidth(), owner.getHeight()));
} }
} }
@@ -245027,7 +245106,7 @@ bool ActiveXControlComponent::createControl (const void* controlIID)


if (dynamic_cast <Win32ComponentPeer*> (peer) != 0) if (dynamic_cast <Win32ComponentPeer*> (peer) != 0)
{ {
const Point<int> pos (relativePositionToOtherComponent (getTopLevelComponent(), Point<int>()));
const Point<int> pos (getTopLevelComponent()->getLocalPoint (this, Point<int>()));
HWND hwnd = (HWND) peer->getNativeHandle(); HWND hwnd = (HWND) peer->getNativeHandle();


ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this)); ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this));
@@ -258534,12 +258613,12 @@ public:
const Rectangle<int> getBounds() const { return Rectangle<int> (wx, wy, ww, wh); } const Rectangle<int> getBounds() const { return Rectangle<int> (wx, wy, ww, wh); }
const Point<int> getScreenPosition() const { return Point<int> (wx, wy); } const Point<int> getScreenPosition() const { return Point<int> (wx, wy); }


const Point<int> relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }


const Point<int> globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }
@@ -267493,8 +267572,8 @@ public:
const Rectangle<int> getBounds() const; const Rectangle<int> getBounds() const;
const Rectangle<int> getBounds (const bool global) const; const Rectangle<int> getBounds (const bool global) const;
const Point<int> getScreenPosition() const; const Point<int> getScreenPosition() const;
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition);
const Point<int> globalPositionToRelative (const Point<int>& screenPosition);
const Point<int> localToGlobal (const Point<int>& relativePosition);
const Point<int> globalToLocal (const Point<int>& screenPosition);
void setAlpha (float newAlpha); void setAlpha (float newAlpha);
void setMinimised (bool shouldBeMinimised); void setMinimised (bool shouldBeMinimised);
bool isMinimised() const; bool isMinimised() const;
@@ -267910,12 +267989,12 @@ const Point<int> UIViewComponentPeer::getScreenPosition() const
return getBounds (true).getPosition(); return getBounds (true).getPosition();
} }


const Point<int> UIViewComponentPeer::relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> UIViewComponentPeer::localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }


const Point<int> UIViewComponentPeer::globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> UIViewComponentPeer::globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }
@@ -268232,7 +268311,7 @@ void UIViewComponentPeer::globalFocusChanged (Component*)
{ {
Component* comp = dynamic_cast<Component*> (target); Component* comp = dynamic_cast<Component*> (target);


Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>()));
Point<int> pos (component->getLocalPoint (comp, Point<int>()));
view->hiddenTextView.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); view->hiddenTextView.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0);


updateHiddenTextContent (target); updateHiddenTextContent (target);
@@ -269535,6 +269614,14 @@ public:
[webView reload: nil]; [webView reload: nil];
} }


void mouseMove (const MouseEvent&)
{
// WebKit doesn't capture mouse-moves itself, so it seems the only way to make
// them work is to push them via this non-public method..
if ([webView respondsToSelector: @selector (_updateMouseoverWithFakeEvent)])
[webView performSelector: @selector (_updateMouseoverWithFakeEvent)];
}

private: private:
WebView* webView; WebView* webView;
DownloadClickDetector* clickListener; DownloadClickDetector* clickListener;
@@ -272270,8 +272357,8 @@ public:
const Rectangle<int> getBounds (const bool global) const; const Rectangle<int> getBounds (const bool global) const;
const Rectangle<int> getBounds() const; const Rectangle<int> getBounds() const;
const Point<int> getScreenPosition() const; const Point<int> getScreenPosition() const;
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition);
const Point<int> globalPositionToRelative (const Point<int>& screenPosition);
const Point<int> localToGlobal (const Point<int>& relativePosition);
const Point<int> globalToLocal (const Point<int>& screenPosition);
void setAlpha (float newAlpha); void setAlpha (float newAlpha);
void setMinimised (bool shouldBeMinimised); void setMinimised (bool shouldBeMinimised);
bool isMinimised() const; bool isMinimised() const;
@@ -273145,12 +273232,12 @@ const Point<int> NSViewComponentPeer::getScreenPosition() const
return getBounds (true).getPosition(); return getBounds (true).getPosition();
} }


const Point<int> NSViewComponentPeer::relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> NSViewComponentPeer::localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }


const Point<int> NSViewComponentPeer::globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> NSViewComponentPeer::globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }
@@ -274050,7 +274137,7 @@ public:


if (topComp->getPeer() != 0) if (topComp->getPeer() != 0)
{ {
const Point<int> pos (owner->relativePositionToOtherComponent (topComp, Point<int>()));
const Point<int> pos (topComp->getLocalPoint (owner, Point<int>()));


NSRect r = NSMakeRect ((float) pos.getX(), (float) pos.getY(), (float) owner->getWidth(), (float) owner->getHeight()); NSRect r = NSMakeRect ((float) pos.getX(), (float) pos.getY(), (float) owner->getWidth(), (float) owner->getHeight());
r.origin.y = [[view superview] frame].size.height - (r.origin.y + r.size.height); r.origin.y = [[view superview] frame].size.height - (r.origin.y + r.size.height);
@@ -277330,6 +277417,14 @@ public:
[webView reload: nil]; [webView reload: nil];
} }


void mouseMove (const MouseEvent&)
{
// WebKit doesn't capture mouse-moves itself, so it seems the only way to make
// them work is to push them via this non-public method..
if ([webView respondsToSelector: @selector (_updateMouseoverWithFakeEvent)])
[webView performSelector: @selector (_updateMouseoverWithFakeEvent)];
}

private: private:
WebView* webView; WebView* webView;
DownloadClickDetector* clickListener; DownloadClickDetector* clickListener;


+ 112
- 49
juce_amalgamated.h View File

@@ -64,7 +64,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 87
#define JUCE_BUILDNUMBER 88


/** Current Juce version number. /** Current Juce version number.


@@ -6468,18 +6468,6 @@ public:
return referencedObject; return referencedObject;
} }


/** Returns true if this pointer refers to the given object. */
inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
{
return referencedObject == object;
}

/** Returns true if this pointer doesn't refer to the given object. */
inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
{
return referencedObject != object;
}

// the -> operator is called on the referenced object // the -> operator is called on the referenced object
inline ReferenceCountedObjectClass* operator->() const throw() inline ReferenceCountedObjectClass* operator->() const throw()
{ {
@@ -6499,6 +6487,48 @@ private:
ReferenceCountedObjectClass* referencedObject; ReferenceCountedObjectClass* referencedObject;
}; };


/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectClass* const object2) throw()
{
return object1.getObject() == object2;
}

/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1.getObject() == object2.getObject();
}

/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1 == object2.getObject();
}

/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectClass* object2) throw()
{
return object1.getObject() != object2;
}

/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1.getObject() != object2.getObject();
}

/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1 != object2.getObject();
}

#endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__ #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__
/*** End of inlined file: juce_ReferenceCountedObject.h ***/ /*** End of inlined file: juce_ReferenceCountedObject.h ***/


@@ -12545,7 +12575,7 @@ public:
void callChecked (const BailOutCheckerType& bailOutChecker, void callChecked (const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) ()) void (ListenerClass::*callbackFunction) ())
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (); (iter.getListener()->*callbackFunction) ();
} }


@@ -12553,7 +12583,7 @@ public:
template <LL_TEMPLATE(1)> template <LL_TEMPLATE(1)>
void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1); (iter.getListener()->*callbackFunction) (param1);
} }


@@ -12564,7 +12594,7 @@ public:
void (ListenerClass::*callbackFunction) (P1), void (ListenerClass::*callbackFunction) (P1),
LL_PARAM(1)) LL_PARAM(1))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1); (iter.getListener()->*callbackFunction) (param1);
} }


@@ -12573,7 +12603,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2), void call (void (ListenerClass::*callbackFunction) (P1, P2),
LL_PARAM(1), LL_PARAM(2)) LL_PARAM(1), LL_PARAM(2))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2); (iter.getListener()->*callbackFunction) (param1, param2);
} }


@@ -12584,7 +12614,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2), void (ListenerClass::*callbackFunction) (P1, P2),
LL_PARAM(1), LL_PARAM(2)) LL_PARAM(1), LL_PARAM(2))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2); (iter.getListener()->*callbackFunction) (param1, param2);
} }


@@ -12593,7 +12623,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3), void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3); (iter.getListener()->*callbackFunction) (param1, param2, param3);
} }


@@ -12604,7 +12634,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3), void (ListenerClass::*callbackFunction) (P1, P2, P3),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2, param3); (iter.getListener()->*callbackFunction) (param1, param2, param3);
} }


@@ -12613,7 +12643,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
} }


@@ -12624,7 +12654,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
} }


@@ -12633,7 +12663,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
} }


@@ -12644,7 +12674,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
} }


@@ -12663,15 +12693,15 @@ public:
{ {
public: public:


Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
: list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
Iterator (const ListType& list_)
: list (list_), index (list_.size())
{} {}


~Iterator() {} ~Iterator() {}


bool next() bool next()
{ {
if (index <= 0 || bailOutChecker.shouldBailOut())
if (index <= 0)
return false; return false;


const int listSize = list.size(); const int listSize = list.size();
@@ -12683,6 +12713,11 @@ public:
return index >= 0; return index >= 0;
} }


bool next (const BailOutCheckerType& bailOutChecker)
{
return (! bailOutChecker.shouldBailOut()) && next();
}

typename ListType::ListenerType* getListener() const throw() typename ListType::ListenerType* getListener() const throw()
{ {
return list.getListeners().getUnchecked (index); return list.getListeners().getUnchecked (index);
@@ -12690,7 +12725,6 @@ public:


private: private:
const ListType& list; const ListType& list;
const BailOutCheckerType& bailOutChecker;
int index; int index;


Iterator (const Iterator&); Iterator (const Iterator&);
@@ -26044,7 +26078,7 @@ public:


/** Destructor. /** Destructor.


Note that when a component is deleted, any child components it contain are NOT
Note that when a component is deleted, any child components it contains are NOT
automatically deleted. It's your responsibilty to manage their lifespan - you automatically deleted. It's your responsibilty to manage their lifespan - you
may want to use helper methods like deleteAllChildren(), or less haphazard may want to use helper methods like deleteAllChildren(), or less haphazard
approaches like using ScopedPointers or normal object aggregation to manage them. approaches like using ScopedPointers or normal object aggregation to manage them.
@@ -26278,12 +26312,12 @@ public:
bool includeSiblings) const; bool includeSiblings) const;


/** Returns this component's x co-ordinate relative the the screen's top-left origin. /** Returns this component's x co-ordinate relative the the screen's top-left origin.
@see getX, relativePositionToGlobal
@see getX, localPointToGlobal
*/ */
int getScreenX() const; int getScreenX() const;


/** Returns this component's y co-ordinate relative the the screen's top-left origin. /** Returns this component's y co-ordinate relative the the screen's top-left origin.
@see getY, relativePositionToGlobal
@see getY, localPointToGlobal
*/ */
int getScreenY() const; int getScreenY() const;


@@ -26297,24 +26331,33 @@ public:
*/ */
const Rectangle<int> getScreenBounds() const; const Rectangle<int> getScreenBounds() const;


/** Converts a position relative to this component's top-left into a screen co-ordinate.
@see globalPositionToRelative, relativePositionToOtherComponent
/** Converts a point to be relative to this component's coordinate space.

This takes a point relative to a different component, and returns its position relative to this
component. If the sourceComponent parameter is null, the source point is assumed to be a global
screen coordinate.
*/ */
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
const Point<int> getLocalPoint (const Component* sourceComponent,
const Point<int>& pointRelativeToSourceComponent) const;

/** Converts a rectangle to be relative to this component's coordinate space.


/** Converts a screen co-ordinate into a position relative to this component's top-left.
@see relativePositionToGlobal, relativePositionToOtherComponent
This takes a rectangle that is relative to a different component, and returns its position relative
to this component. If the sourceComponent parameter is null, the source rectangle is assumed to be
a screen coordinate.
*/ */
const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
const Rectangle<int> getLocalArea (const Component* sourceComponent,
const Rectangle<int>& areaRelativeToSourceComponent) const;


/** Converts a position relative to this component's top-left into a position
relative to another component's top-left.
If the targetComponent parameter is null, the coordinate is converted to global screen
coordinates.
@see relativePositionToGlobal, globalPositionToRelative
/** Converts a point relative to this component's top-left into a screen coordinate.
@see getLocalPoint, localAreaToGlobal
*/ */
const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
const Point<int>& positionRelativeToThis) const;
const Point<int> localPointToGlobal (const Point<int>& localPoint) const;

/** Converts a rectangle from this component's coordinate space to a screen coordinate.
@see getLocalPoint, localPointToGlobal
*/
const Rectangle<int> localAreaToGlobal (const Rectangle<int>& localArea) const;


/** Moves the component to a new position. /** Moves the component to a new position.


@@ -27910,6 +27953,21 @@ public:
BailOutChecker& operator= (const BailOutChecker&); BailOutChecker& operator= (const BailOutChecker&);
}; };


#ifndef DOXYGEN
/** @internal
This method is deprecated - use localPointToGlobal instead. */
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;

/** @internal
This method is deprecated - use getLocalPoint instead. */
const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;

/** @internal
This method is deprecated - use getLocalPoint instead. */
const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
const Point<int>& positionRelativeToThis) const;
#endif

juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator


private: private:
@@ -27952,7 +28010,7 @@ private:
bool bufferToImageFlag : 1; bool bufferToImageFlag : 1;
bool bringToFrontOnClickFlag : 1; bool bringToFrontOnClickFlag : 1;
bool repaintOnMouseActivityFlag : 1; bool repaintOnMouseActivityFlag : 1;
bool draggingFlag : 1;
bool mouseDownFlag : 1;
bool mouseOverFlag : 1; bool mouseOverFlag : 1;
bool mouseInsideFlag : 1; bool mouseInsideFlag : 1;
bool currentlyModalFlag : 1; bool currentlyModalFlag : 1;
@@ -40361,8 +40419,7 @@ protected:
This might return 0 if the data's unsuitable or corrupted. Otherwise it will return This might return 0 if the data's unsuitable or corrupted. Otherwise it will return
an XmlElement object that the caller must delete when no longer needed. an XmlElement object that the caller must delete when no longer needed.
*/ */
static XmlElement* getXmlFromBinary (const void* data,
int sizeInBytes);
static XmlElement* getXmlFromBinary (const void* data, int sizeInBytes);


/** @internal */ /** @internal */
AudioPlayHead* playHead; AudioPlayHead* playHead;
@@ -59103,10 +59160,16 @@ public:
virtual const Point<int> getScreenPosition() const = 0; virtual const Point<int> getScreenPosition() const = 0;


/** Converts a position relative to the top-left of this component to screen co-ordinates. */ /** Converts a position relative to the top-left of this component to screen co-ordinates. */
virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
virtual const Point<int> localToGlobal (const Point<int>& relativePosition) = 0;

/** Converts a rectangle relative to the top-left of this component to screen co-ordinates. */
virtual const Rectangle<int> localToGlobal (const Rectangle<int>& relativePosition);


/** Converts a screen co-ordinate to a position relative to the top-left of this component. */ /** Converts a screen co-ordinate to a position relative to the top-left of this component. */
virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
virtual const Point<int> globalToLocal (const Point<int>& screenPosition) = 0;

/** Converts a screen area to a position relative to the top-left of this component. */
virtual const Rectangle<int> globalToLocal (const Rectangle<int>& screenPosition);


/** Minimises the window. */ /** Minimises the window. */
virtual void setMinimised (bool shouldBeMinimised) = 0; virtual void setMinimised (bool shouldBeMinimised) = 0;


+ 1
- 1
src/audio/plugins/formats/juce_VSTPluginFormat.cpp View File

@@ -1198,7 +1198,7 @@ public:
if (topComp->getPeer() != 0) if (topComp->getPeer() != 0)
{ {
const Point<int> pos (relativePositionToOtherComponent (topComp, Point<int>()));
const Point<int> pos (topComp->getLocalPoint (this, Point<int>()));
recursiveResize = true; recursiveResize = true;


+ 1
- 2
src/audio/processors/juce_AudioProcessor.h View File

@@ -573,8 +573,7 @@ protected:
This might return 0 if the data's unsuitable or corrupted. Otherwise it will return This might return 0 if the data's unsuitable or corrupted. Otherwise it will return
an XmlElement object that the caller must delete when no longer needed. an XmlElement object that the caller must delete when no longer needed.
*/ */
static XmlElement* getXmlFromBinary (const void* data,
int sizeInBytes);
static XmlElement* getXmlFromBinary (const void* data, int sizeInBytes);
/** @internal */ /** @internal */
AudioPlayHead* playHead; AudioPlayHead* playHead;


+ 43
- 12
src/containers/juce_ReferenceCountedObject.h View File

@@ -220,18 +220,6 @@ public:
return referencedObject; return referencedObject;
} }
/** Returns true if this pointer refers to the given object. */
inline bool operator== (ReferenceCountedObjectClass* const object) const throw()
{
return referencedObject == object;
}
/** Returns true if this pointer doesn't refer to the given object. */
inline bool operator!= (ReferenceCountedObjectClass* const object) const throw()
{
return referencedObject != object;
}
// the -> operator is called on the referenced object // the -> operator is called on the referenced object
inline ReferenceCountedObjectClass* operator->() const throw() inline ReferenceCountedObjectClass* operator->() const throw()
{ {
@@ -252,4 +240,47 @@ private:
}; };
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectClass* const object2) throw()
{
return object1.getObject() == object2;
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1.getObject() == object2.getObject();
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator== (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1 == object2.getObject();
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, const ReferenceCountedObjectClass* object2) throw()
{
return object1.getObject() != object2;
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (const ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1.getObject() != object2.getObject();
}
/** Compares two ReferenceCountedObjectPointers. */
template <class ReferenceCountedObjectClass>
bool operator!= (ReferenceCountedObjectClass* object1, ReferenceCountedObjectPtr<ReferenceCountedObjectClass>& object2) throw()
{
return object1 != object2.getObject();
}
#endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__ #endif // __JUCE_REFERENCECOUNTEDOBJECT_JUCEHEADER__

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

@@ -33,7 +33,7 @@
*/ */
#define JUCE_MAJOR_VERSION 1 #define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 52 #define JUCE_MINOR_VERSION 52
#define JUCE_BUILDNUMBER 87
#define JUCE_BUILDNUMBER 88
/** Current Juce version number. /** Current Juce version number.


+ 19
- 15
src/events/juce_ListenerList.h View File

@@ -149,7 +149,7 @@ public:
void callChecked (const BailOutCheckerType& bailOutChecker, void callChecked (const BailOutCheckerType& bailOutChecker,
void (ListenerClass::*callbackFunction) ()) void (ListenerClass::*callbackFunction) ())
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (); (iter.getListener()->*callbackFunction) ();
} }
@@ -158,7 +158,7 @@ public:
template <LL_TEMPLATE(1)> template <LL_TEMPLATE(1)>
void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1)) void call (void (ListenerClass::*callbackFunction) (P1), LL_PARAM(1))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1); (iter.getListener()->*callbackFunction) (param1);
} }
@@ -169,7 +169,7 @@ public:
void (ListenerClass::*callbackFunction) (P1), void (ListenerClass::*callbackFunction) (P1),
LL_PARAM(1)) LL_PARAM(1))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1); (iter.getListener()->*callbackFunction) (param1);
} }
@@ -179,7 +179,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2), void call (void (ListenerClass::*callbackFunction) (P1, P2),
LL_PARAM(1), LL_PARAM(2)) LL_PARAM(1), LL_PARAM(2))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2); (iter.getListener()->*callbackFunction) (param1, param2);
} }
@@ -190,7 +190,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2), void (ListenerClass::*callbackFunction) (P1, P2),
LL_PARAM(1), LL_PARAM(2)) LL_PARAM(1), LL_PARAM(2))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2); (iter.getListener()->*callbackFunction) (param1, param2);
} }
@@ -200,7 +200,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3), void call (void (ListenerClass::*callbackFunction) (P1, P2, P3),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3); (iter.getListener()->*callbackFunction) (param1, param2, param3);
} }
@@ -211,7 +211,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3), void (ListenerClass::*callbackFunction) (P1, P2, P3),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2, param3); (iter.getListener()->*callbackFunction) (param1, param2, param3);
} }
@@ -221,7 +221,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
} }
@@ -232,7 +232,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4), void (ListenerClass::*callbackFunction) (P1, P2, P3, P4),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4);
} }
@@ -242,7 +242,7 @@ public:
void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), void call (void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
{ {
for (Iterator<DummyBailOutChecker, ThisType> iter (*this, DummyBailOutChecker()); iter.next();)
for (Iterator<DummyBailOutChecker, ThisType> iter (*this); iter.next();)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
} }
@@ -253,7 +253,7 @@ public:
void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5), void (ListenerClass::*callbackFunction) (P1, P2, P3, P4, P5),
LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5)) LL_PARAM(1), LL_PARAM(2), LL_PARAM(3), LL_PARAM(4), LL_PARAM(5))
{ {
for (Iterator<BailOutCheckerType, ThisType> iter (*this, bailOutChecker); iter.next();)
for (Iterator<BailOutCheckerType, ThisType> iter (*this); iter.next (bailOutChecker);)
(iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5); (iter.getListener()->*callbackFunction) (param1, param2, param3, param4, param5);
} }
@@ -275,8 +275,8 @@ public:
{ {
public: public:
//============================================================================== //==============================================================================
Iterator (const ListType& list_, const BailOutCheckerType& bailOutChecker_)
: list (list_), bailOutChecker (bailOutChecker_), index (list_.size())
Iterator (const ListType& list_)
: list (list_), index (list_.size())
{} {}
~Iterator() {} ~Iterator() {}
@@ -284,7 +284,7 @@ public:
//============================================================================== //==============================================================================
bool next() bool next()
{ {
if (index <= 0 || bailOutChecker.shouldBailOut())
if (index <= 0)
return false; return false;
const int listSize = list.size(); const int listSize = list.size();
@@ -296,6 +296,11 @@ public:
return index >= 0; return index >= 0;
} }
bool next (const BailOutCheckerType& bailOutChecker)
{
return (! bailOutChecker.shouldBailOut()) && next();
}
typename ListType::ListenerType* getListener() const throw() typename ListType::ListenerType* getListener() const throw()
{ {
return list.getListeners().getUnchecked (index); return list.getListeners().getUnchecked (index);
@@ -304,7 +309,6 @@ public:
//============================================================================== //==============================================================================
private: private:
const ListType& list; const ListType& list;
const BailOutCheckerType& bailOutChecker;
int index; int index;
Iterator (const Iterator&); Iterator (const Iterator&);


+ 2
- 2
src/gui/components/controls/juce_ListBox.cpp View File

@@ -878,7 +878,7 @@ const Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY)
if (rowComp != 0 && isRowSelected (firstRow + i)) if (rowComp != 0 && isRowSelected (firstRow + i))
{ {
const Point<int> pos (rowComp->relativePositionToOtherComponent (this, Point<int>()));
const Point<int> pos (getLocalPoint (rowComp, Point<int>()));
const Rectangle<int> rowRect (pos.getX(), pos.getY(), rowComp->getWidth(), rowComp->getHeight()); const Rectangle<int> rowRect (pos.getX(), pos.getY(), rowComp->getWidth(), rowComp->getHeight());
imageArea = imageArea.getUnion (rowRect); imageArea = imageArea.getUnion (rowRect);
} }
@@ -895,7 +895,7 @@ const Image ListBox::createSnapshotOfSelectedRows (int& imageX, int& imageY)
if (rowComp != 0 && isRowSelected (firstRow + i)) if (rowComp != 0 && isRowSelected (firstRow + i))
{ {
const Point<int> pos (rowComp->relativePositionToOtherComponent (this, Point<int>()));
const Point<int> pos (getLocalPoint (rowComp, Point<int>()));
Graphics g (snapshot); Graphics g (snapshot);
g.setOrigin (pos.getX() - imageX, pos.getY() - imageY); g.setOrigin (pos.getX() - imageX, pos.getY() - imageY);


+ 2
- 2
src/gui/components/controls/juce_Slider.cpp View File

@@ -1172,8 +1172,8 @@ void Slider::restoreMouseIfHidden()
{ {
const int pixelPos = (int) getLinearSliderPos (pos); const int pixelPos = (int) getLinearSliderPos (pos);
mousePos = relativePositionToGlobal (Point<int> (isHorizontal() ? pixelPos : (getWidth() / 2),
isVertical() ? pixelPos : (getHeight() / 2)));
mousePos = localPointToGlobal (Point<int> (isHorizontal() ? pixelPos : (getWidth() / 2),
isVertical() ? pixelPos : (getHeight() / 2)));
} }
Desktop::setMousePosition (mousePos); Desktop::setMousePosition (mousePos);


+ 1
- 1
src/gui/components/controls/juce_TreeView.cpp View File

@@ -625,7 +625,7 @@ TreeViewItem* TreeView::getItemAt (int y) const throw()
{ {
TreeViewContentComponent* const tc = static_cast <TreeViewContentComponent*> (viewport->getViewedComponent()); TreeViewContentComponent* const tc = static_cast <TreeViewContentComponent*> (viewport->getViewedComponent());
Rectangle<int> pos; Rectangle<int> pos;
return tc->findItemAt (relativePositionToOtherComponent (tc, Point<int> (0, y)).getY(), pos);
return tc->findItemAt (tc->getLocalPoint (this, Point<int> (0, y)).getY(), pos);
} }
TreeViewItem* TreeView::findItemFromIdentifierString (const String& identifierString) const TreeViewItem* TreeView::findItemFromIdentifierString (const String& identifierString) const


+ 113
- 49
src/gui/components/juce_Component.cpp View File

@@ -259,8 +259,7 @@ Component::~Component()
{ {
parentComponent_->removeChildComponent (this); parentComponent_->removeChildComponent (this);
} }
else if ((currentlyFocusedComponent == this)
|| isParentOf (currentlyFocusedComponent))
else if (currentlyFocusedComponent == this || isParentOf (currentlyFocusedComponent))
{ {
giveAwayFocus(); giveAwayFocus();
} }
@@ -434,7 +433,7 @@ void Component::addToDesktop (int styleWanted, void* nativeWindowToAttachTo)
jmax (1, getHeight())); jmax (1, getHeight()));
#endif #endif
const Point<int> topLeft (relativePositionToGlobal (Point<int> (0, 0)));
const Point<int> topLeft (getScreenPosition());
bool wasFullscreen = false; bool wasFullscreen = false;
bool wasMinimised = false; bool wasMinimised = false;
@@ -777,7 +776,7 @@ int Component::getScreenY() const
const Point<int> Component::getScreenPosition() const const Point<int> Component::getScreenPosition() const
{ {
return relativePositionToGlobal (Point<int>());
return localPointToGlobal (Point<int>());
} }
const Rectangle<int> Component::getScreenBounds() const const Rectangle<int> Component::getScreenBounds() const
@@ -785,53 +784,119 @@ const Rectangle<int> Component::getScreenBounds() const
return bounds_.withPosition (getScreenPosition()); return bounds_.withPosition (getScreenPosition());
} }
const Point<int> Component::relativePositionToGlobal (const Point<int>& relativePosition) const
{
return relativePositionToOtherComponent (0, relativePosition);
}
const Point<int> Component::globalPositionToRelative (const Point<int>& screenPosition) const
namespace CoordinateHelpers
{ {
if (flags.hasHeavyweightPeerFlag)
const Point<int> convertFromParentSpace (const Component* comp, const Point<int>& pointInParentSpace)
{ {
return getPeer()->globalPositionToRelative (screenPosition);
return pointInParentSpace - comp->getPosition();
} }
else
const Rectangle<int> convertFromParentSpace (const Component* comp, const Rectangle<int>& areaInParentSpace)
{ {
if (parentComponent_ != 0)
return parentComponent_->globalPositionToRelative (screenPosition) - getPosition();
return areaInParentSpace - comp->getPosition();
}
return screenPosition - getPosition();
const Point<int> convertToParentSpace (const Component* comp, const Point<int>& pointInLocalSpace)
{
return pointInLocalSpace + comp->getPosition();
} }
}
const Point<int> Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point<int>& positionRelativeToThis) const
{
Point<int> p (positionRelativeToThis);
const Component* c = this;
const Rectangle<int> convertToParentSpace (const Component* comp, const Rectangle<int>& areaInLocalSpace)
{
return areaInLocalSpace + comp->getPosition();
}
do
template <typename Type>
const Type convertFromDistantParentSpace (const Component* parent, const Component* target, Type coordInParent)
{ {
if (c == targetComponent)
return p;
const Component* const directParent = target->getParentComponent();
jassert (directParent != 0);
if (directParent == parent)
return convertFromParentSpace (target, coordInParent);
if (c->flags.hasHeavyweightPeerFlag)
return convertFromParentSpace (target, convertFromDistantParentSpace (parent, directParent, coordInParent));
}
template <typename Type>
const Type convertCoordinate (const Component* target, const Component* source, Type p)
{
while (source != 0)
{ {
p = c->getPeer()->relativePositionToGlobal (p);
break;
if (source == target)
return p;
if (source->isParentOf (target))
return convertFromDistantParentSpace (source, target, p);
if (source->isOnDesktop())
{
p = source->getPeer()->localToGlobal (p);
source = 0;
}
else
{
p = convertToParentSpace (source, p);
source = source->getParentComponent();
}
} }
p += c->getPosition();
c = c->parentComponent_;
jassert (source == 0);
if (target == 0)
return p;
const Component* const topLevelComp = target->getTopLevelComponent();
if (topLevelComp->isOnDesktop())
p = topLevelComp->getPeer()->globalToLocal (p);
else
p = convertFromParentSpace (topLevelComp, p);
if (topLevelComp == target)
return p;
return convertFromDistantParentSpace (topLevelComp, target, p);
} }
while (c != 0);
}
if (targetComponent != 0)
p = targetComponent->globalPositionToRelative (p);
const Point<int> Component::getLocalPoint (const Component* source, const Point<int>& point) const
{
return CoordinateHelpers::convertCoordinate (this, source, point);
}
const Rectangle<int> Component::getLocalArea (const Component* source, const Rectangle<int>& area) const
{
return CoordinateHelpers::convertCoordinate (this, source, area);
}
return p;
const Point<int> Component::localPointToGlobal (const Point<int>& point) const
{
return CoordinateHelpers::convertCoordinate (0, this, point);
} }
const Rectangle<int> Component::localAreaToGlobal (const Rectangle<int>& area) const
{
return CoordinateHelpers::convertCoordinate (0, this, area);
}
/* Deprecated methods... */
const Point<int> Component::relativePositionToGlobal (const Point<int>& relativePosition) const
{
return localPointToGlobal (relativePosition);
}
const Point<int> Component::globalPositionToRelative (const Point<int>& screenPosition) const
{
return getLocalPoint (0, screenPosition);
}
const Point<int> Component::relativePositionToOtherComponent (const Component* const targetComponent, const Point<int>& positionRelativeToThis) const
{
return targetComponent == 0 ? localPointToGlobal (positionRelativeToThis)
: targetComponent->getLocalPoint (this, positionRelativeToThis);
}
//============================================================================== //==============================================================================
void Component::setBounds (const int x, const int y, int w, int h) void Component::setBounds (const int x, const int y, int w, int h)
{ {
@@ -1922,7 +1987,7 @@ void Component::getVisibleArea (RectangleList& result, const bool includeSibling
{ {
const Component* const c = getTopLevelComponent(); const Component* const c = getTopLevelComponent();
c->subtractObscuredRegions (result, c->relativePositionToOtherComponent (this, Point<int>()),
c->subtractObscuredRegions (result, getLocalPoint (c, Point<int>()),
c->getLocalBounds(), this); c->getLocalBounds(), this);
} }
@@ -2142,7 +2207,7 @@ void Component::internalMouseEnter (MouseInputSource& source, const Point<int>&
{ {
flags.mouseInsideFlag = true; flags.mouseInsideFlag = true;
flags.mouseOverFlag = true; flags.mouseOverFlag = true;
flags.draggingFlag = false;
flags.mouseDownFlag = false;
BailOutChecker checker (this); BailOutChecker checker (this);
@@ -2167,7 +2232,7 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
{ {
BailOutChecker checker (this); BailOutChecker checker (this);
if (flags.draggingFlag)
if (flags.mouseDownFlag)
{ {
internalMouseUp (source, relativePos, time, source.getCurrentModifiers().getRawFlags()); internalMouseUp (source, relativePos, time, source.getCurrentModifiers().getRawFlags());
@@ -2179,7 +2244,7 @@ void Component::internalMouseExit (MouseInputSource& source, const Point<int>& r
{ {
flags.mouseInsideFlag = false; flags.mouseInsideFlag = false;
flags.mouseOverFlag = false; flags.mouseOverFlag = false;
flags.draggingFlag = false;
flags.mouseDownFlag = false;
if (flags.repaintOnMouseActivityFlag) if (flags.repaintOnMouseActivityFlag)
repaint(); repaint();
@@ -2308,7 +2373,7 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
return; return;
} }
flags.draggingFlag = true;
flags.mouseDownFlag = true;
flags.mouseOverFlag = true; flags.mouseOverFlag = true;
if (flags.repaintOnMouseActivityFlag) if (flags.repaintOnMouseActivityFlag)
@@ -2331,11 +2396,11 @@ void Component::internalMouseDown (MouseInputSource& source, const Point<int>& r
//============================================================================== //==============================================================================
void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers) void Component::internalMouseUp (MouseInputSource& source, const Point<int>& relativePos, const Time& time, const ModifierKeys& oldModifiers)
{ {
if (flags.draggingFlag)
if (flags.mouseDownFlag)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();
flags.draggingFlag = false;
flags.mouseDownFlag = false;
BailOutChecker checker (this); BailOutChecker checker (this);
@@ -2344,7 +2409,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel
const MouseEvent me (source, relativePos, const MouseEvent me (source, relativePos,
oldModifiers, this, this, time, oldModifiers, this, this, time,
globalPositionToRelative (source.getLastMouseDownPosition()),
getLocalPoint (0, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(), source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(), source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed()); source.hasMouseMovedSignificantlySincePressed());
@@ -2378,7 +2443,7 @@ void Component::internalMouseUp (MouseInputSource& source, const Point<int>& rel
void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time) void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& relativePos, const Time& time)
{ {
if (flags.draggingFlag)
if (flags.mouseDownFlag)
{ {
Desktop& desktop = Desktop::getInstance(); Desktop& desktop = Desktop::getInstance();
@@ -2388,7 +2453,7 @@ void Component::internalMouseDrag (MouseInputSource& source, const Point<int>& r
const MouseEvent me (source, relativePos, const MouseEvent me (source, relativePos,
source.getCurrentModifiers(), this, this, time, source.getCurrentModifiers(), this, this, time,
globalPositionToRelative (source.getLastMouseDownPosition()),
getLocalPoint (0, source.getLastMouseDownPosition()),
source.getLastMouseDownTime(), source.getLastMouseDownTime(),
source.getNumberOfMultipleClicks(), source.getNumberOfMultipleClicks(),
source.hasMouseMovedSignificantlySincePressed()); source.hasMouseMovedSignificantlySincePressed());
@@ -2411,8 +2476,7 @@ void Component::internalMouseMove (MouseInputSource& source, const Point<int>& r
BailOutChecker checker (this); BailOutChecker checker (this);
const MouseEvent me (source, relativePos, source.getCurrentModifiers(), const MouseEvent me (source, relativePos, source.getCurrentModifiers(),
this, this, time, relativePos,
time, 0, false);
this, this, time, relativePos, time, 0, false);
if (isCurrentlyBlockedByAnotherModalComponent()) if (isCurrentlyBlockedByAnotherModalComponent())
{ {
@@ -2825,12 +2889,12 @@ bool Component::isMouseOver() const throw()
bool Component::isMouseButtonDown() const throw() bool Component::isMouseButtonDown() const throw()
{ {
return flags.draggingFlag;
return flags.mouseDownFlag;
} }
bool Component::isMouseOverOrDragging() const throw() bool Component::isMouseOverOrDragging() const throw()
{ {
return flags.mouseOverFlag || flags.draggingFlag;
return flags.mouseOverFlag || flags.mouseDownFlag;
} }
bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw() bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw()
@@ -2840,14 +2904,14 @@ bool JUCE_CALLTYPE Component::isMouseButtonDownAnywhere() throw()
const Point<int> Component::getMouseXYRelative() const const Point<int> Component::getMouseXYRelative() const
{ {
return globalPositionToRelative (Desktop::getMousePosition());
return getLocalPoint (0, Desktop::getMousePosition());
} }
//============================================================================== //==============================================================================
const Rectangle<int> Component::getParentMonitorArea() const const Rectangle<int> Component::getParentMonitorArea() const
{ {
return Desktop::getInstance() return Desktop::getInstance()
.getMonitorAreaContaining (relativePositionToGlobal (getLocalBounds().getCentre()));
.getMonitorAreaContaining (localPointToGlobal (getLocalBounds().getCentre()));
} }
//============================================================================== //==============================================================================


+ 42
- 17
src/gui/components/juce_Component.h View File

@@ -73,7 +73,7 @@ public:
/** Destructor. /** Destructor.
Note that when a component is deleted, any child components it contain are NOT
Note that when a component is deleted, any child components it contains are NOT
automatically deleted. It's your responsibilty to manage their lifespan - you automatically deleted. It's your responsibilty to manage their lifespan - you
may want to use helper methods like deleteAllChildren(), or less haphazard may want to use helper methods like deleteAllChildren(), or less haphazard
approaches like using ScopedPointers or normal object aggregation to manage them. approaches like using ScopedPointers or normal object aggregation to manage them.
@@ -313,12 +313,12 @@ public:
//============================================================================== //==============================================================================
/** Returns this component's x co-ordinate relative the the screen's top-left origin. /** Returns this component's x co-ordinate relative the the screen's top-left origin.
@see getX, relativePositionToGlobal
@see getX, localPointToGlobal
*/ */
int getScreenX() const; int getScreenX() const;
/** Returns this component's y co-ordinate relative the the screen's top-left origin. /** Returns this component's y co-ordinate relative the the screen's top-left origin.
@see getY, relativePositionToGlobal
@see getY, localPointToGlobal
*/ */
int getScreenY() const; int getScreenY() const;
@@ -332,24 +332,33 @@ public:
*/ */
const Rectangle<int> getScreenBounds() const; const Rectangle<int> getScreenBounds() const;
/** Converts a position relative to this component's top-left into a screen co-ordinate.
@see globalPositionToRelative, relativePositionToOtherComponent
/** Converts a point to be relative to this component's coordinate space.
This takes a point relative to a different component, and returns its position relative to this
component. If the sourceComponent parameter is null, the source point is assumed to be a global
screen coordinate.
*/ */
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
const Point<int> getLocalPoint (const Component* sourceComponent,
const Point<int>& pointRelativeToSourceComponent) const;
/** Converts a screen co-ordinate into a position relative to this component's top-left.
@see relativePositionToGlobal, relativePositionToOtherComponent
/** Converts a rectangle to be relative to this component's coordinate space.
This takes a rectangle that is relative to a different component, and returns its position relative
to this component. If the sourceComponent parameter is null, the source rectangle is assumed to be
a screen coordinate.
*/ */
const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
const Rectangle<int> getLocalArea (const Component* sourceComponent,
const Rectangle<int>& areaRelativeToSourceComponent) const;
/** Converts a position relative to this component's top-left into a position
relative to another component's top-left.
If the targetComponent parameter is null, the coordinate is converted to global screen
coordinates.
@see relativePositionToGlobal, globalPositionToRelative
/** Converts a point relative to this component's top-left into a screen coordinate.
@see getLocalPoint, localAreaToGlobal
*/ */
const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
const Point<int>& positionRelativeToThis) const;
const Point<int> localPointToGlobal (const Point<int>& localPoint) const;
/** Converts a rectangle from this component's coordinate space to a screen coordinate.
@see getLocalPoint, localPointToGlobal
*/
const Rectangle<int> localAreaToGlobal (const Rectangle<int>& localArea) const;
//============================================================================== //==============================================================================
/** Moves the component to a new position. /** Moves the component to a new position.
@@ -1981,6 +1990,22 @@ public:
BailOutChecker& operator= (const BailOutChecker&); BailOutChecker& operator= (const BailOutChecker&);
}; };
//==============================================================================
#ifndef DOXYGEN
/** @internal
This method is deprecated - use localPointToGlobal instead. */
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) const;
/** @internal
This method is deprecated - use getLocalPoint instead. */
const Point<int> globalPositionToRelative (const Point<int>& screenPosition) const;
/** @internal
This method is deprecated - use getLocalPoint instead. */
const Point<int> relativePositionToOtherComponent (const Component* targetComponent,
const Point<int>& positionRelativeToThis) const;
#endif
//============================================================================== //==============================================================================
juce_UseDebuggingNewOperator juce_UseDebuggingNewOperator
@@ -2025,7 +2050,7 @@ private:
bool bufferToImageFlag : 1; bool bufferToImageFlag : 1;
bool bringToFrontOnClickFlag : 1; bool bringToFrontOnClickFlag : 1;
bool repaintOnMouseActivityFlag : 1; bool repaintOnMouseActivityFlag : 1;
bool draggingFlag : 1;
bool mouseDownFlag : 1;
bool mouseOverFlag : 1; bool mouseOverFlag : 1;
bool mouseInsideFlag : 1; bool mouseInsideFlag : 1;
bool currentlyModalFlag : 1; bool currentlyModalFlag : 1;


+ 2
- 2
src/gui/components/juce_Desktop.cpp View File

@@ -160,7 +160,7 @@ Component* Desktop::findComponentAt (const Point<int>& screenPosition) const
if (c->isVisible()) if (c->isVisible())
{ {
const Point<int> relative (c->globalPositionToRelative (screenPosition));
const Point<int> relative (c->getLocalPoint (0, screenPosition));
if (c->contains (relative.getX(), relative.getY())) if (c->contains (relative.getX(), relative.getY()))
return c->getComponentAt (relative.getX(), relative.getY()); return c->getComponentAt (relative.getX(), relative.getY());
@@ -305,7 +305,7 @@ void Desktop::sendMouseMove()
if (target != 0) if (target != 0)
{ {
Component::BailOutChecker checker (target); Component::BailOutChecker checker (target);
const Point<int> pos (target->globalPositionToRelative (lastFakeMouseMove));
const Point<int> pos (target->getLocalPoint (0, lastFakeMouseMove));
const Time now (Time::getCurrentTime()); const Time now (Time::getCurrentTime());
const MouseEvent me (getMainMouseSource(), pos, ModifierKeys::getCurrentModifiers(), const MouseEvent me (getMainMouseSource(), pos, ModifierKeys::getCurrentModifiers(),


+ 1
- 1
src/gui/components/layout/juce_ComponentMovementWatcher.cpp View File

@@ -88,7 +88,7 @@ void ComponentMovementWatcher::componentMovedOrResized (Component&, bool wasMove
if (wasMoved) if (wasMoved)
{ {
const Point<int> pos (component->relativePositionToOtherComponent (component->getTopLevelComponent(), Point<int>()));
const Point<int> pos (component->getTopLevelComponent()->getLocalPoint (component, Point<int>()));
wasMoved = lastBounds.getPosition() != pos; wasMoved = lastBounds.getPosition() != pos;
lastBounds.setPosition (pos); lastBounds.setPosition (pos);


+ 12
- 6
src/gui/components/lookandfeel/juce_LookAndFeel.cpp View File

@@ -155,6 +155,9 @@ namespace LookAndFeelHelpers
return tl; return tl;
} }
LookAndFeel* defaultLF = 0;
LookAndFeel* currentDefaultLF = 0;
} }
//============================================================================== //==============================================================================
@@ -309,6 +312,8 @@ LookAndFeel::LookAndFeel()
LookAndFeel::~LookAndFeel() LookAndFeel::~LookAndFeel()
{ {
if (this == LookAndFeelHelpers::currentDefaultLF)
setDefaultLookAndFeel (0);
} }
//============================================================================== //==============================================================================
@@ -344,21 +349,20 @@ bool LookAndFeel::isColourSpecified (const int colourId) const throw()
} }
//============================================================================== //==============================================================================
static LookAndFeel* defaultLF = 0;
static LookAndFeel* currentDefaultLF = 0;
LookAndFeel& LookAndFeel::getDefaultLookAndFeel() throw() LookAndFeel& LookAndFeel::getDefaultLookAndFeel() throw()
{ {
// if this happens, your app hasn't initialised itself properly.. if you're // if this happens, your app hasn't initialised itself properly.. if you're
// trying to hack your own main() function, have a look at // trying to hack your own main() function, have a look at
// JUCEApplication::initialiseForGUI() // JUCEApplication::initialiseForGUI()
jassert (currentDefaultLF != 0);
jassert (LookAndFeelHelpers::currentDefaultLF != 0);
return *currentDefaultLF;
return *LookAndFeelHelpers::currentDefaultLF;
} }
void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw() void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) throw()
{ {
using namespace LookAndFeelHelpers;
if (newDefaultLookAndFeel == 0) if (newDefaultLookAndFeel == 0)
{ {
if (defaultLF == 0) if (defaultLF == 0)
@@ -367,7 +371,7 @@ void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) thr
newDefaultLookAndFeel = defaultLF; newDefaultLookAndFeel = defaultLF;
} }
currentDefaultLF = newDefaultLookAndFeel;
LookAndFeelHelpers::currentDefaultLF = newDefaultLookAndFeel;
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;) for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
{ {
@@ -380,6 +384,8 @@ void LookAndFeel::setDefaultLookAndFeel (LookAndFeel* newDefaultLookAndFeel) thr
void LookAndFeel::clearDefaultLookAndFeel() throw() void LookAndFeel::clearDefaultLookAndFeel() throw()
{ {
using namespace LookAndFeelHelpers;
if (currentDefaultLF == defaultLF) if (currentDefaultLF == defaultLF)
currentDefaultLF = 0; currentDefaultLF = 0;


+ 2
- 2
src/gui/components/menus/juce_PopupMenu.cpp View File

@@ -580,7 +580,7 @@ public:
// move rather than a real timer callback // move rather than a real timer callback
const Point<int> globalMousePos (Desktop::getMousePosition()); const Point<int> globalMousePos (Desktop::getMousePosition());
const Point<int> localMousePos (globalPositionToRelative (globalMousePos));
const Point<int> localMousePos (getLocalPoint (0, globalMousePos));
const uint32 now = Time::getMillisecondCounter(); const uint32 now = Time::getMillisecondCounter();
@@ -750,7 +750,7 @@ private:
void updateMouseOverStatus (const Point<int>& globalMousePos) void updateMouseOverStatus (const Point<int>& globalMousePos)
{ {
const Point<int> relPos (globalPositionToRelative (globalMousePos));
const Point<int> relPos (getLocalPoint (0, globalMousePos));
isOver = reallyContains (relPos.getX(), relPos.getY(), true); isOver = reallyContains (relPos.getX(), relPos.getY(), true);
if (activeSubMenu != 0) if (activeSubMenu != 0)


+ 2
- 2
src/gui/components/mouse/juce_ComponentDragger.cpp View File

@@ -50,7 +50,7 @@ void ComponentDragger::startDraggingComponent (Component* const componentToDrag,
if (componentToDrag != 0) if (componentToDrag != 0)
{ {
constrainer = constrainer_; constrainer = constrainer_;
originalPos = componentToDrag->relativePositionToGlobal (Point<int>());
originalPos = componentToDrag->localPointToGlobal (Point<int>());
} }
} }
@@ -65,7 +65,7 @@ void ComponentDragger::dragComponent (Component* const componentToDrag, const Mo
const Component* const parentComp = componentToDrag->getParentComponent(); const Component* const parentComp = componentToDrag->getParentComponent();
if (parentComp != 0) if (parentComp != 0)
bounds.setPosition (parentComp->globalPositionToRelative (originalPos));
bounds.setPosition (parentComp->getLocalPoint (0, originalPos));
bounds.setPosition (bounds.getPosition() + e.getOffsetFromDragStart()); bounds.setPosition (bounds.getPosition() + e.getOffsetFromDragStart());


+ 6
- 6
src/gui/components/mouse/juce_DragAndDropContainer.cpp View File

@@ -110,7 +110,7 @@ public:
} }
else else
{ {
const Point<int> relPos (hit->globalPositionToRelative (screenPos));
const Point<int> relPos (hit->getLocalPoint (0, screenPos));
hit = hit->getComponentAt (relPos.getX(), relPos.getY()); hit = hit->getComponentAt (relPos.getX(), relPos.getY());
} }
@@ -124,7 +124,7 @@ public:
if (ddt != 0 && ddt->isInterestedInDragSource (dragDescLocal, source)) if (ddt != 0 && ddt->isInterestedInDragSource (dragDescLocal, source))
{ {
relativePos = hit->globalPositionToRelative (screenPos);
relativePos = hit->getLocalPoint (0, screenPos);
return ddt; return ddt;
} }
@@ -162,8 +162,8 @@ public:
} }
else else
{ {
const Point<int> target (source->relativePositionToGlobal (source->getLocalBounds().getCentre()));
const Point<int> ourCentre (relativePositionToGlobal (getLocalBounds().getCentre()));
const Point<int> target (source->localPointToGlobal (source->getLocalBounds().getCentre()));
const Point<int> ourCentre (localPointToGlobal (getLocalBounds().getCentre()));
Desktop::getInstance().getAnimator().animateComponent (this, Desktop::getInstance().getAnimator().animateComponent (this,
getBounds() + (target - ourCentre), getBounds() + (target - ourCentre),
@@ -199,7 +199,7 @@ public:
Point<int> newPos (screenPos + imageOffset); Point<int> newPos (screenPos + imageOffset);
if (getParentComponent() != 0) if (getParentComponent() != 0)
newPos = getParentComponent()->globalPositionToRelative (newPos);
newPos = getParentComponent()->getLocalPoint (0, newPos);
//if (newX != getX() || newY != getY()) //if (newX != getX() || newY != getY())
{ {
@@ -347,7 +347,7 @@ void DragAndDropContainer::startDragging (const String& sourceDescription,
const int lo = 150; const int lo = 150;
const int hi = 400; const int hi = 400;
Point<int> relPos (sourceComponent->globalPositionToRelative (lastMouseDown));
Point<int> relPos (sourceComponent->getLocalPoint (0, lastMouseDown));
Point<int> clipped (dragImage.getBounds().getConstrainedPoint (relPos)); Point<int> clipped (dragImage.getBounds().getConstrainedPoint (relPos));
for (int y = dragImage.getHeight(); --y >= 0;) for (int y = dragImage.getHeight(); --y >= 0;)


+ 4
- 4
src/gui/components/mouse/juce_MouseEvent.cpp View File

@@ -69,9 +69,9 @@ const MouseEvent MouseEvent::getEventRelativeTo (Component* const otherComponent
return *this; return *this;
} }
return MouseEvent (source, eventComponent->relativePositionToOtherComponent (otherComponent, getPosition()),
return MouseEvent (source, otherComponent->getLocalPoint (eventComponent, getPosition()),
mods, otherComponent, originalComponent, eventTime, mods, otherComponent, originalComponent, eventTime,
eventComponent->relativePositionToOtherComponent (otherComponent, mouseDownPos),
otherComponent->getLocalPoint (eventComponent, mouseDownPos),
mouseDownTime, numberOfClicks, wasMovedSinceMouseDown); mouseDownTime, numberOfClicks, wasMovedSinceMouseDown);
} }
@@ -149,7 +149,7 @@ int MouseEvent::getScreenY() const
const Point<int> MouseEvent::getScreenPosition() const const Point<int> MouseEvent::getScreenPosition() const
{ {
return eventComponent->relativePositionToGlobal (Point<int> (x, y));
return eventComponent->localPointToGlobal (Point<int> (x, y));
} }
int MouseEvent::getMouseDownScreenX() const int MouseEvent::getMouseDownScreenX() const
@@ -164,7 +164,7 @@ int MouseEvent::getMouseDownScreenY() const
const Point<int> MouseEvent::getMouseDownScreenPosition() const const Point<int> MouseEvent::getMouseDownScreenPosition() const
{ {
return eventComponent->relativePositionToGlobal (mouseDownPos);
return eventComponent->localPointToGlobal (mouseDownPos);
} }
//============================================================================== //==============================================================================


+ 23
- 19
src/gui/components/mouse/juce_MouseInputSource.cpp View File

@@ -45,7 +45,6 @@ public:
isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0), isUnboundedMouseModeOn (false), isCursorVisibleUntilOffscreen (false), currentCursorHandle (0),
mouseEventCounter (0), lastTime (0) mouseEventCounter (0), lastTime (0)
{ {
zerostruct (mouseDowns);
} }
~MouseInputSourceInternal() ~MouseInputSourceInternal()
@@ -83,7 +82,7 @@ public:
if (peer != 0) if (peer != 0)
{ {
Component* const comp = peer->getComponent(); Component* const comp = peer->getComponent();
const Point<int> relativePos (comp->globalPositionToRelative (screenPos));
const Point<int> relativePos (comp->getLocalPoint (0, screenPos));
// (the contains() call is needed to test for overlapping desktop windows) // (the contains() call is needed to test for overlapping desktop windows)
if (comp->contains (relativePos.getX(), relativePos.getY())) if (comp->contains (relativePos.getX(), relativePos.getY()))
@@ -101,44 +100,44 @@ public:
//============================================================================== //==============================================================================
void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseEnter (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseEnter (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " enter: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseEnter (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseExit (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseExit (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseExit (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " exit: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseExit (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseMove (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseMove (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseMove (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " move: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseMove (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseDown (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDown (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDown (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " down: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDown (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseDrag (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDrag (source, comp->globalPositionToRelative (screenPos), time);
//DBG ("Mouse " + String (source.getIndex()) + " drag: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseDrag (source, comp->getLocalPoint (0, screenPos), time);
} }
void sendMouseUp (Component* const comp, const Point<int>& screenPos, const int64 time) void sendMouseUp (Component* const comp, const Point<int>& screenPos, const int64 time)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->globalPositionToRelative (screenPos), time, getCurrentModifiers());
//DBG ("Mouse " + String (source.getIndex()) + " up: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseUp (source, comp->getLocalPoint (0, screenPos), time, getCurrentModifiers());
} }
void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const int64 time, float x, float y) void sendMouseWheel (Component* const comp, const Point<int>& screenPos, const int64 time, float x, float y)
{ {
//DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->globalPositionToRelative (screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseWheel (source, comp->globalPositionToRelative (screenPos), time, x, y);
//DBG ("Mouse " + String (source.getIndex()) + " wheel: " + comp->getLocalPoint (0, screenPos).toString() + " - Comp: " + String::toHexString ((int) comp));
comp->internalMouseWheel (source, comp->getLocalPoint (0, screenPos), time, x, y);
} }
//============================================================================== //==============================================================================
@@ -264,7 +263,7 @@ public:
jassert (newPeer != 0); jassert (newPeer != 0);
lastTime = time; lastTime = time;
++mouseEventCounter; ++mouseEventCounter;
const Point<int> screenPos (newPeer->relativePositionToGlobal (positionWithinPeer));
const Point<int> screenPos (newPeer->localToGlobal (positionWithinPeer));
if (isDragging() && newMods.isAnyMouseButtonDown()) if (isDragging() && newMods.isAnyMouseButtonDown())
{ {
@@ -292,7 +291,7 @@ public:
jassert (peer != 0); jassert (peer != 0);
lastTime = time; lastTime = time;
++mouseEventCounter; ++mouseEventCounter;
const Point<int> screenPos (peer->relativePositionToGlobal (positionWithinPeer));
const Point<int> screenPos (peer->localToGlobal (positionWithinPeer));
setPeer (peer, screenPos, time); setPeer (peer, screenPos, time);
setScreenPos (screenPos, time, false); setScreenPos (screenPos, time, false);
@@ -328,7 +327,7 @@ public:
for (int i = 1; i < numElementsInArray (mouseDowns); ++i) for (int i = 1; i < numElementsInArray (mouseDowns); ++i)
{ {
if (mouseDowns[0].canBePartOfMultipleClickWith (mouseDowns[1], (int) (MouseEvent::getDoubleClickTimeout() * (1.0 + 0.25 * (i - 1)))))
if (mouseDowns[0].canBePartOfMultipleClickWith (mouseDowns[i], (int) (MouseEvent::getDoubleClickTimeout() * (1.0 + 0.25 * (i - 1)))))
++numClicks; ++numClicks;
else else
break; break;
@@ -448,6 +447,11 @@ private:
struct RecentMouseDown struct RecentMouseDown
{ {
RecentMouseDown()
: time (0), component (0)
{
}
Point<int> position; Point<int> position;
int64 time; int64 time;
Component* component; Component* component;


+ 2
- 2
src/gui/components/special/juce_BubbleComponent.cpp View File

@@ -101,9 +101,9 @@ void BubbleComponent::setPosition (Component* componentToPointTo)
Point<int> pos; Point<int> pos;
if (getParentComponent() != 0) if (getParentComponent() != 0)
pos = componentToPointTo->relativePositionToOtherComponent (getParentComponent(), pos);
pos = getParentComponent()->getLocalPoint (componentToPointTo, pos);
else else
pos = componentToPointTo->relativePositionToGlobal (pos);
pos = componentToPointTo->localPointToGlobal (pos);
setPosition (Rectangle<int> (pos.getX(), pos.getY(), componentToPointTo->getWidth(), componentToPointTo->getHeight())); setPosition (Rectangle<int> (pos.getX(), pos.getY(), componentToPointTo->getWidth(), componentToPointTo->getHeight()));
} }


+ 5
- 5
src/gui/components/special/juce_MagnifierComponent.cpp View File

@@ -96,16 +96,16 @@ public:
return magnifierComp->getScreenPosition(); return magnifierComp->getScreenPosition();
} }
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> localToGlobal (const Point<int>& relativePosition)
{ {
const double zoom = magnifierComp->getScaleFactor(); const double zoom = magnifierComp->getScaleFactor();
return magnifierComp->relativePositionToGlobal (Point<int> (roundToInt (relativePosition.getX() * zoom),
roundToInt (relativePosition.getY() * zoom)));
return magnifierComp->localPointToGlobal (Point<int> (roundToInt (relativePosition.getX() * zoom),
roundToInt (relativePosition.getY() * zoom)));
} }
const Point<int> globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> globalToLocal (const Point<int>& screenPosition)
{ {
const Point<int> p (magnifierComp->globalPositionToRelative (screenPosition));
const Point<int> p (magnifierComp->getLocalPoint (0, screenPosition));
const double zoom = magnifierComp->getScaleFactor(); const double zoom = magnifierComp->getScaleFactor();
return Point<int> (roundToInt (p.getX() / zoom), return Point<int> (roundToInt (p.getX() / zoom),


+ 1
- 2
src/gui/components/windows/juce_CallOutBox.cpp View File

@@ -45,8 +45,7 @@ CallOutBox::CallOutBox (Component& contentComponent,
{ {
parentComponent->addChildComponent (this); parentComponent->addChildComponent (this);
updatePosition (componentToPointTo.getLocalBounds()
+ componentToPointTo.relativePositionToOtherComponent (parentComponent, Point<int>()),
updatePosition (parentComponent->getLocalArea (&componentToPointTo, componentToPointTo.getLocalBounds()),
parentComponent->getLocalBounds()); parentComponent->getLocalBounds());
setVisible (true); setVisible (true);


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

@@ -399,6 +399,16 @@ const Rectangle<int>& ComponentPeer::getNonFullScreenBounds() const throw()
return lastNonFullscreenBounds; return lastNonFullscreenBounds;
} }
const Rectangle<int> ComponentPeer::localToGlobal (const Rectangle<int>& relativePosition)
{
return relativePosition.withPosition (localToGlobal (relativePosition.getPosition()));
}
const Rectangle<int> ComponentPeer::globalToLocal (const Rectangle<int>& screenPosition)
{
return screenPosition.withPosition (globalToLocal (screenPosition.getPosition()));
}
//============================================================================== //==============================================================================
namespace ComponentPeerHelpers namespace ComponentPeerHelpers
{ {
@@ -446,7 +456,7 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<in
if (newTarget != 0) if (newTarget != 0)
{ {
dragAndDropTargetComponent = dynamic_cast <Component*> (newTarget); dragAndDropTargetComponent = dynamic_cast <Component*> (newTarget);
const Point<int> pos (component->relativePositionToOtherComponent (dragAndDropTargetComponent, position));
const Point<int> pos (dragAndDropTargetComponent->getLocalPoint (component, position));
newTarget->fileDragEnter (files, pos.getX(), pos.getY()); newTarget->fileDragEnter (files, pos.getX(), pos.getY());
} }
} }
@@ -459,7 +469,7 @@ void ComponentPeer::handleFileDragMove (const StringArray& files, const Point<in
if (newTarget != 0) if (newTarget != 0)
{ {
Component* const targetComp = dynamic_cast <Component*> (newTarget); Component* const targetComp = dynamic_cast <Component*> (newTarget);
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, position));
const Point<int> pos (targetComp->getLocalPoint (component, position));
newTarget->fileDragMove (files, pos.getX(), pos.getY()); newTarget->fileDragMove (files, pos.getX(), pos.getY());
} }
@@ -497,7 +507,7 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
return; return;
} }
const Point<int> pos (component->relativePositionToOtherComponent (targetComp, position));
const Point<int> pos (targetComp->getLocalPoint (component, position));
target->filesDropped (files, pos.getX(), pos.getY()); target->filesDropped (files, pos.getX(), pos.getY());
} }
} }


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

@@ -152,10 +152,16 @@ public:
virtual const Point<int> getScreenPosition() const = 0; virtual const Point<int> getScreenPosition() const = 0;
/** Converts a position relative to the top-left of this component to screen co-ordinates. */ /** Converts a position relative to the top-left of this component to screen co-ordinates. */
virtual const Point<int> relativePositionToGlobal (const Point<int>& relativePosition) = 0;
virtual const Point<int> localToGlobal (const Point<int>& relativePosition) = 0;
/** Converts a rectangle relative to the top-left of this component to screen co-ordinates. */
virtual const Rectangle<int> localToGlobal (const Rectangle<int>& relativePosition);
/** Converts a screen co-ordinate to a position relative to the top-left of this component. */ /** Converts a screen co-ordinate to a position relative to the top-left of this component. */
virtual const Point<int> globalPositionToRelative (const Point<int>& screenPosition) = 0;
virtual const Point<int> globalToLocal (const Point<int>& screenPosition) = 0;
/** Converts a screen area to a position relative to the top-left of this component. */
virtual const Rectangle<int> globalToLocal (const Rectangle<int>& screenPosition);
/** Minimises the window. */ /** Minimises the window. */
virtual void setMinimised (bool shouldBeMinimised) = 0; virtual void setMinimised (bool shouldBeMinimised) = 0;


+ 1
- 1
src/gui/components/windows/juce_TooltipWindow.cpp View File

@@ -87,7 +87,7 @@ void TooltipWindow::showFor (const String& tip)
Point<int> mousePos (Desktop::getMousePosition()); Point<int> mousePos (Desktop::getMousePosition());
if (getParentComponent() != 0) if (getParentComponent() != 0)
mousePos = getParentComponent()->globalPositionToRelative (mousePos);
mousePos = getParentComponent()->getLocalPoint (0, mousePos);
int x, y, w, h; int x, y, w, h;
getLookAndFeel().getTooltipSize (tip, w, h); getLookAndFeel().getTooltipSize (tip, w, h);


+ 5
- 7
src/gui/components/windows/juce_TopLevelWindow.cpp View File

@@ -291,21 +291,19 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const
} }
else else
{ {
Point<int> p (c->relativePositionToGlobal (Point<int> ((c->getWidth() - width) / 2,
(c->getHeight() - height) / 2)));
Point<int> targetCentre (c->localPointToGlobal (c->getLocalBounds().getCentre()));
Rectangle<int> parentArea (c->getParentMonitorArea()); Rectangle<int> parentArea (c->getParentMonitorArea());
if (getParentComponent() != 0) if (getParentComponent() != 0)
{ {
p = getParentComponent()->globalPositionToRelative (p);
parentArea.setBounds (0, 0, getParentWidth(), getParentHeight());
targetCentre = getParentComponent()->getLocalPoint (0, targetCentre);
parentArea = getParentComponent()->getLocalBounds();
} }
parentArea.reduce (12, 12); parentArea.reduce (12, 12);
setBounds (jlimit (parentArea.getX(), jmax (parentArea.getX(), parentArea.getRight() - width), p.getX()),
jlimit (parentArea.getY(), jmax (parentArea.getY(), parentArea.getBottom() - height), p.getY()),
setBounds (jlimit (parentArea.getX(), jmax (parentArea.getX(), parentArea.getRight() - width), targetCentre.getX() - width / 2),
jlimit (parentArea.getY(), jmax (parentArea.getY(), parentArea.getBottom() - height), targetCentre.getY() - height / 2),
width, height); width, height);
} }
} }


+ 572
- 572
src/native/linux/juce_linux_Fonts.cpp
File diff suppressed because it is too large
View File


+ 2
- 2
src/native/linux/juce_linux_Windowing.cpp View File

@@ -810,12 +810,12 @@ public:
const Rectangle<int> getBounds() const { return Rectangle<int> (wx, wy, ww, wh); } const Rectangle<int> getBounds() const { return Rectangle<int> (wx, wy, ww, wh); }
const Point<int> getScreenPosition() const { return Point<int> (wx, wy); } const Point<int> getScreenPosition() const { return Point<int> (wx, wy); }
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }
const Point<int> globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }


+ 5
- 5
src/native/mac/juce_iphone_UIViewComponentPeer.mm View File

@@ -109,8 +109,8 @@ public:
const Rectangle<int> getBounds() const; const Rectangle<int> getBounds() const;
const Rectangle<int> getBounds (const bool global) const; const Rectangle<int> getBounds (const bool global) const;
const Point<int> getScreenPosition() const; const Point<int> getScreenPosition() const;
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition);
const Point<int> globalPositionToRelative (const Point<int>& screenPosition);
const Point<int> localToGlobal (const Point<int>& relativePosition);
const Point<int> globalToLocal (const Point<int>& screenPosition);
void setAlpha (float newAlpha); void setAlpha (float newAlpha);
void setMinimised (bool shouldBeMinimised); void setMinimised (bool shouldBeMinimised);
bool isMinimised() const; bool isMinimised() const;
@@ -539,12 +539,12 @@ const Point<int> UIViewComponentPeer::getScreenPosition() const
return getBounds (true).getPosition(); return getBounds (true).getPosition();
} }
const Point<int> UIViewComponentPeer::relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> UIViewComponentPeer::localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }
const Point<int> UIViewComponentPeer::globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> UIViewComponentPeer::globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }
@@ -863,7 +863,7 @@ void UIViewComponentPeer::globalFocusChanged (Component*)
{ {
Component* comp = dynamic_cast<Component*> (target); Component* comp = dynamic_cast<Component*> (target);
Point<int> pos (comp->relativePositionToOtherComponent (component, Point<int>()));
Point<int> pos (component->getLocalPoint (comp, Point<int>()));
view->hiddenTextView.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0); view->hiddenTextView.frame = CGRectMake (pos.getX(), pos.getY(), 0, 0);
updateHiddenTextContent (target); updateHiddenTextContent (target);


+ 1
- 1
src/native/mac/juce_mac_NSViewComponent.mm View File

@@ -76,7 +76,7 @@ public:
if (topComp->getPeer() != 0) if (topComp->getPeer() != 0)
{ {
const Point<int> pos (owner->relativePositionToOtherComponent (topComp, Point<int>()));
const Point<int> pos (topComp->getLocalPoint (owner, Point<int>()));
NSRect r = NSMakeRect ((float) pos.getX(), (float) pos.getY(), (float) owner->getWidth(), (float) owner->getHeight()); NSRect r = NSMakeRect ((float) pos.getX(), (float) pos.getY(), (float) owner->getWidth(), (float) owner->getHeight());
r.origin.y = [[view superview] frame].size.height - (r.origin.y + r.size.height); r.origin.y = [[view superview] frame].size.height - (r.origin.y + r.size.height);


+ 4
- 4
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -158,8 +158,8 @@ public:
const Rectangle<int> getBounds (const bool global) const; const Rectangle<int> getBounds (const bool global) const;
const Rectangle<int> getBounds() const; const Rectangle<int> getBounds() const;
const Point<int> getScreenPosition() const; const Point<int> getScreenPosition() const;
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition);
const Point<int> globalPositionToRelative (const Point<int>& screenPosition);
const Point<int> localToGlobal (const Point<int>& relativePosition);
const Point<int> globalToLocal (const Point<int>& screenPosition);
void setAlpha (float newAlpha); void setAlpha (float newAlpha);
void setMinimised (bool shouldBeMinimised); void setMinimised (bool shouldBeMinimised);
bool isMinimised() const; bool isMinimised() const;
@@ -1050,12 +1050,12 @@ const Point<int> NSViewComponentPeer::getScreenPosition() const
return getBounds (true).getPosition(); return getBounds (true).getPosition();
} }
const Point<int> NSViewComponentPeer::relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> NSViewComponentPeer::localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }
const Point<int> NSViewComponentPeer::globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> NSViewComponentPeer::globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }


+ 8
- 0
src/native/mac/juce_mac_WebBrowserComponent.mm View File

@@ -153,6 +153,14 @@ public:
[webView reload: nil]; [webView reload: nil];
} }
void mouseMove (const MouseEvent&)
{
// WebKit doesn't capture mouse-moves itself, so it seems the only way to make
// them work is to push them via this non-public method..
if ([webView respondsToSelector: @selector (_updateMouseoverWithFakeEvent)])
[webView performSelector: @selector (_updateMouseoverWithFakeEvent)];
}
private: private:
WebView* webView; WebView* webView;
DownloadClickDetector* clickListener; DownloadClickDetector* clickListener;


+ 2
- 3
src/native/windows/juce_win32_ActiveXComponent.cpp View File

@@ -256,8 +256,7 @@ public:
if (topComp->getPeer() != 0) if (topComp->getPeer() != 0)
{ {
const Point<int> pos (owner.relativePositionToOtherComponent (topComp, Point<int>()));
const Point<int> pos (topComp->getLocalPoint (&owner, Point<int>()));
owner.setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner.getWidth(), owner.getHeight())); owner.setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), owner.getWidth(), owner.getHeight()));
} }
} }
@@ -356,7 +355,7 @@ bool ActiveXControlComponent::createControl (const void* controlIID)
if (dynamic_cast <Win32ComponentPeer*> (peer) != 0) if (dynamic_cast <Win32ComponentPeer*> (peer) != 0)
{ {
const Point<int> pos (relativePositionToOtherComponent (getTopLevelComponent(), Point<int>()));
const Point<int> pos (getTopLevelComponent()->getLocalPoint (this, Point<int>()));
HWND hwnd = (HWND) peer->getNativeHandle(); HWND hwnd = (HWND) peer->getNativeHandle();
ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this)); ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this));


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

@@ -649,12 +649,12 @@ public:
r.top + windowBorder.getTop()); r.top + windowBorder.getTop());
} }
const Point<int> relativePositionToGlobal (const Point<int>& relativePosition)
const Point<int> localToGlobal (const Point<int>& relativePosition)
{ {
return relativePosition + getScreenPosition(); return relativePosition + getScreenPosition();
} }
const Point<int> globalPositionToRelative (const Point<int>& screenPosition)
const Point<int> globalToLocal (const Point<int>& screenPosition)
{ {
return screenPosition - getScreenPosition(); return screenPosition - getScreenPosition();
} }
@@ -1745,7 +1745,7 @@ private:
HRESULT __stdcall DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect) HRESULT __stdcall DragEnter (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{ {
updateFileList (pDataObject); updateFileList (pDataObject);
owner->handleFileDragMove (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY; *pdwEffect = DROPEFFECT_COPY;
return S_OK; return S_OK;
} }
@@ -1758,7 +1758,7 @@ private:
HRESULT __stdcall DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect) HRESULT __stdcall DragOver (DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{ {
owner->handleFileDragMove (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragMove (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY; *pdwEffect = DROPEFFECT_COPY;
return S_OK; return S_OK;
} }
@@ -1766,7 +1766,7 @@ private:
HRESULT __stdcall Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect) HRESULT __stdcall Drop (IDataObject* pDataObject, DWORD /*grfKeyState*/, POINTL mousePos, DWORD* pdwEffect)
{ {
updateFileList (pDataObject); updateFileList (pDataObject);
owner->handleFileDragDrop (files, owner->globalPositionToRelative (Point<int> (mousePos.x, mousePos.y)));
owner->handleFileDragDrop (files, owner->globalToLocal (Point<int> (mousePos.x, mousePos.y)));
*pdwEffect = DROPEFFECT_COPY; *pdwEffect = DROPEFFECT_COPY;
return S_OK; return S_OK;
} }


Loading…
Cancel
Save