From fc041094342727a630627ab5015fb6dcb51c8faa Mon Sep 17 00:00:00 2001 From: Julian Storer Date: Wed, 1 Dec 2010 09:42:36 +0000 Subject: [PATCH] Small fixes for MSVC compiler problems. --- juce_amalgamated.cpp | 44 ++++++++++--------- src/gui/components/juce_Component.cpp | 2 +- .../components/windows/juce_ComponentPeer.cpp | 2 +- .../components/windows/juce_DialogWindow.cpp | 40 +++++++++-------- 4 files changed, 46 insertions(+), 42 deletions(-) diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 61e251ca46..8e122f63f5 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -41200,7 +41200,7 @@ void Component::exitModalState (const int returnValue) void messageCallback() { - if (target != 0) + if (target.getComponent() != 0) // (getComponent() required for VS2003 bug) target->exitModalState (result); } @@ -77630,7 +77630,7 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point position; StringArray files; - JUCE_DECLARE_NON_COPYABLE (AsyncFileDropMessage); + // (NB: don't make this non-copyable, which messes up in VC) }; (new AsyncFileDropMessage (targetComp, targetComp->getLocalPoint (component, position), files))->post(); @@ -77704,6 +77704,27 @@ void DialogWindow::resized() } } +// (Sadly, this can't be made a local class inside the showModalDialog function, because the +// VC compiler complains about the undefined copy constructor) +class TempDialogWindow : public DialogWindow +{ +public: + TempDialogWindow (const String& title, const Colour& colour, const bool escapeCloses) + : DialogWindow (title, colour, escapeCloses, true) + { + if (! JUCEApplication::isStandaloneApp()) + setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level + } + + void closeButtonPressed() + { + setVisible (false); + } + +private: + JUCE_DECLARE_NON_COPYABLE (TempDialogWindow); +}; + int DialogWindow::showModalDialog (const String& dialogTitle, Component* contentComponent, Component* componentToCentreAround, @@ -77712,25 +77733,6 @@ int DialogWindow::showModalDialog (const String& dialogTitle, const bool shouldBeResizable, const bool useBottomRightCornerResizer) { - class TempDialogWindow : public DialogWindow - { - public: - TempDialogWindow (const String& title, const Colour& colour, const bool escapeCloses) - : DialogWindow (title, colour, escapeCloses, true) - { - if (! JUCEApplication::isStandaloneApp()) - setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level - } - - void closeButtonPressed() - { - setVisible (false); - } - - private: - JUCE_DECLARE_NON_COPYABLE (TempDialogWindow); - }; - TempDialogWindow dw (dialogTitle, colour, escapeKeyTriggersCloseButton); dw.setContentComponent (contentComponent, true, true); diff --git a/src/gui/components/juce_Component.cpp b/src/gui/components/juce_Component.cpp index 1c45425c06..3c31cce1a9 100644 --- a/src/gui/components/juce_Component.cpp +++ b/src/gui/components/juce_Component.cpp @@ -1559,7 +1559,7 @@ void Component::exitModalState (const int returnValue) void messageCallback() { - if (target != 0) + if (target.getComponent() != 0) // (getComponent() required for VS2003 bug) target->exitModalState (result); } diff --git a/src/gui/components/windows/juce_ComponentPeer.cpp b/src/gui/components/windows/juce_ComponentPeer.cpp index f0606d8928..91125834d1 100644 --- a/src/gui/components/windows/juce_ComponentPeer.cpp +++ b/src/gui/components/windows/juce_ComponentPeer.cpp @@ -528,7 +528,7 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point position; StringArray files; - JUCE_DECLARE_NON_COPYABLE (AsyncFileDropMessage); + // (NB: don't make this non-copyable, which messes up in VC) }; (new AsyncFileDropMessage (targetComp, targetComp->getLocalPoint (component, position), files))->post(); diff --git a/src/gui/components/windows/juce_DialogWindow.cpp b/src/gui/components/windows/juce_DialogWindow.cpp index fec6e322ea..ae7451c8cd 100644 --- a/src/gui/components/windows/juce_DialogWindow.cpp +++ b/src/gui/components/windows/juce_DialogWindow.cpp @@ -60,6 +60,27 @@ void DialogWindow::resized() } } +// (Sadly, this can't be made a local class inside the showModalDialog function, because the +// VC compiler complains about the undefined copy constructor) +class TempDialogWindow : public DialogWindow +{ +public: + TempDialogWindow (const String& title, const Colour& colour, const bool escapeCloses) + : DialogWindow (title, colour, escapeCloses, true) + { + if (! JUCEApplication::isStandaloneApp()) + setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level + } + + void closeButtonPressed() + { + setVisible (false); + } + +private: + JUCE_DECLARE_NON_COPYABLE (TempDialogWindow); +}; + //============================================================================== int DialogWindow::showModalDialog (const String& dialogTitle, @@ -70,25 +91,6 @@ int DialogWindow::showModalDialog (const String& dialogTitle, const bool shouldBeResizable, const bool useBottomRightCornerResizer) { - class TempDialogWindow : public DialogWindow - { - public: - TempDialogWindow (const String& title, const Colour& colour, const bool escapeCloses) - : DialogWindow (title, colour, escapeCloses, true) - { - if (! JUCEApplication::isStandaloneApp()) - setAlwaysOnTop (true); // for a plugin, make it always-on-top because the host windows are often top-level - } - - void closeButtonPressed() - { - setVisible (false); - } - - private: - JUCE_DECLARE_NON_COPYABLE (TempDialogWindow); - }; - TempDialogWindow dw (dialogTitle, colour, escapeKeyTriggersCloseButton); dw.setContentComponent (contentComponent, true, true);