Browse Source

Small fixes for MSVC compiler problems.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
fc04109434
4 changed files with 46 additions and 42 deletions
  1. +23
    -21
      juce_amalgamated.cpp
  2. +1
    -1
      src/gui/components/juce_Component.cpp
  3. +1
    -1
      src/gui/components/windows/juce_ComponentPeer.cpp
  4. +21
    -19
      src/gui/components/windows/juce_DialogWindow.cpp

+ 23
- 21
juce_amalgamated.cpp View File

@@ -41200,7 +41200,7 @@ void Component::exitModalState (const int returnValue)


void messageCallback() void messageCallback()
{ {
if (target != 0)
if (target.getComponent() != 0) // (getComponent() required for VS2003 bug)
target->exitModalState (result); target->exitModalState (result);
} }


@@ -77630,7 +77630,7 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
Point<int> position; Point<int> position;
StringArray files; 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(); (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, int DialogWindow::showModalDialog (const String& dialogTitle,
Component* contentComponent, Component* contentComponent,
Component* componentToCentreAround, Component* componentToCentreAround,
@@ -77712,25 +77733,6 @@ int DialogWindow::showModalDialog (const String& dialogTitle,
const bool shouldBeResizable, const bool shouldBeResizable,
const bool useBottomRightCornerResizer) 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); TempDialogWindow dw (dialogTitle, colour, escapeKeyTriggersCloseButton);


dw.setContentComponent (contentComponent, true, true); dw.setContentComponent (contentComponent, true, true);


+ 1
- 1
src/gui/components/juce_Component.cpp View File

@@ -1559,7 +1559,7 @@ void Component::exitModalState (const int returnValue)
void messageCallback() void messageCallback()
{ {
if (target != 0)
if (target.getComponent() != 0) // (getComponent() required for VS2003 bug)
target->exitModalState (result); target->exitModalState (result);
} }


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

@@ -528,7 +528,7 @@ void ComponentPeer::handleFileDragDrop (const StringArray& files, const Point<in
Point<int> position; Point<int> position;
StringArray files; 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(); (new AsyncFileDropMessage (targetComp, targetComp->getLocalPoint (component, position), files))->post();


+ 21
- 19
src/gui/components/windows/juce_DialogWindow.cpp View File

@@ -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, int DialogWindow::showModalDialog (const String& dialogTitle,
@@ -70,25 +91,6 @@ int DialogWindow::showModalDialog (const String& dialogTitle,
const bool shouldBeResizable, const bool shouldBeResizable,
const bool useBottomRightCornerResizer) 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); TempDialogWindow dw (dialogTitle, colour, escapeKeyTriggersCloseButton);
dw.setContentComponent (contentComponent, true, true); dw.setContentComponent (contentComponent, true, true);


Loading…
Cancel
Save