Browse Source

Cleaned up some comments and uses of setContentComponent().

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
bd19111417
12 changed files with 44 additions and 56 deletions
  1. +2
    -2
      extras/audio plugin host/Source/GraphEditorPanel.cpp
  2. +6
    -6
      extras/audio plugin host/Source/MainHostWindow.cpp
  3. +3
    -3
      extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp
  4. +2
    -2
      extras/example projects/Source/Main.cpp
  5. +2
    -2
      extras/the jucer/src/ui/jucer_MainWindow.cpp
  6. +1
    -1
      extras/the jucer/src/ui/jucer_PrefsPanel.cpp
  7. +2
    -2
      juce_amalgamated.cpp
  8. +12
    -18
      juce_amalgamated.h
  9. +4
    -5
      src/gui/components/windows/juce_DialogWindow.h
  10. +1
    -3
      src/gui/components/windows/juce_DocumentWindow.h
  11. +2
    -2
      src/gui/components/windows/juce_ResizableWindow.cpp
  12. +7
    -10
      src/gui/components/windows/juce_ResizableWindow.h

+ 2
- 2
extras/audio plugin host/Source/GraphEditorPanel.cpp View File

@@ -43,7 +43,7 @@ PluginWindow::PluginWindow (Component* const uiComp,
{
setSize (400, 300);
setContentComponent (uiComp, true, true);
setContentOwned (uiComp, true);
setTopLeftPosition (owner->properties.getWithDefault ("uiLastX", Random::getSystemRandom().nextInt (500)),
owner->properties.getWithDefault ("uiLastY", Random::getSystemRandom().nextInt (500)));
@@ -104,7 +104,7 @@ PluginWindow* PluginWindow::getWindowFor (AudioProcessorGraph::Node* node,
PluginWindow::~PluginWindow()
{
activePluginWindows.removeValue (this);
setContentComponent (0);
clearContentComponent();
}
void PluginWindow::moved()


+ 6
- 6
extras/audio plugin host/Source/MainHostWindow.cpp View File

@@ -41,9 +41,9 @@ public:
const File deadMansPedalFile (ApplicationProperties::getInstance()->getUserSettings()
->getFile().getSiblingFile ("RecentlyCrashedPluginsList"));
setContentComponent (new PluginListComponent (knownPluginList,
deadMansPedalFile,
ApplicationProperties::getInstance()->getUserSettings()), true, true);
setContentOwned (new PluginListComponent (knownPluginList,
deadMansPedalFile,
ApplicationProperties::getInstance()->getUserSettings()), true);
setResizable (true, false);
setResizeLimits (300, 400, 800, 1500);
@@ -57,7 +57,7 @@ public:
{
ApplicationProperties::getInstance()->getUserSettings()->setValue ("listWindowPos", getWindowStateAsString());
setContentComponent (0);
clearContentComponent();
jassert (currentPluginListWindow == this);
currentPluginListWindow = 0;
@@ -90,7 +90,7 @@ MainHostWindow::MainHostWindow()
setResizeLimits (500, 400, 10000, 10000);
centreWithSize (800, 600);
setContentComponent (new GraphDocumentComponent (&deviceManager));
setContentOwned (new GraphDocumentComponent (&deviceManager), false);
restoreWindowStateFromString (ApplicationProperties::getInstance()->getUserSettings()->getValue ("mainWindowPos"));
@@ -138,7 +138,7 @@ MainHostWindow::~MainHostWindow()
knownPluginList.removeChangeListener (this);
ApplicationProperties::getInstance()->getUserSettings()->setValue ("mainWindowPos", getWindowStateAsString());
setContentComponent (0);
clearContentComponent();
}
void MainHostWindow::closeButtonPressed()


+ 3
- 3
extras/audio plugins/wrapper/Standalone/juce_StandaloneFilterWindow.cpp View File

@@ -83,7 +83,7 @@ StandaloneFilterWindow::StandaloneFilterWindow (const String& title,
}
}
setContentComponent (filter->createEditorIfNeeded(), true, true);
setContentOwned (filter->createEditorIfNeeded(), true);
const int x = globalSettings->getIntValue ("windowX", -100);
const int y = globalSettings->getIntValue ("windowY", -100);
@@ -138,7 +138,7 @@ void StandaloneFilterWindow::deleteFilter()
if (filter != 0 && getContentComponent() != 0)
{
filter->editorBeingDeleted (dynamic_cast <AudioProcessorEditor*> (getContentComponent()));
setContentComponent (0, true);
clearContentComponent();
}
filter = 0;
@@ -155,7 +155,7 @@ void StandaloneFilterWindow::resetFilter()
if (deviceManager != 0)
deviceManager->setFilter (filter);
setContentComponent (filter->createEditorIfNeeded(), true, true);
setContentOwned (filter->createEditorIfNeeded(), true);
}
PropertySet* const globalSettings = getGlobalSettings();


+ 2
- 2
extras/example projects/Source/Main.cpp View File

@@ -21,7 +21,7 @@ class HelloWorldWindow : public DocumentWindow
public:
//==============================================================================
HelloWorldWindow()
: DocumentWindow (T("JUCE Hello World!"),
: DocumentWindow ("JUCE Hello World!",
Colours::lightgrey,
DocumentWindow::allButtons,
true)
@@ -31,7 +31,7 @@ public:
MainComponent* const contentComponent = new MainComponent();
setContentComponent (contentComponent, true, true);
setContentOwned (contentComponent, true);
centreWithSize (getWidth(), getHeight());


+ 2
- 2
extras/the jucer/src/ui/jucer_MainWindow.cpp View File

@@ -68,7 +68,7 @@ MainWindow::MainWindow()
if (oldLook == 0)
oldLook = new OldSchoolLookAndFeel();
setContentComponent (multiDocHolder = new MultiDocHolder());
setContentOwned (multiDocHolder = new MultiDocHolder(), false);
setApplicationCommandManagerToWatch (commandManager);
@@ -131,7 +131,7 @@ MainWindow::~MainWindow()
StoredSettings::getInstance()->getProps()
.setValue (T("lastMainWindowPos"), getWindowStateAsString());
setContentComponent (0);
clearContentComponent();
LookAndFeel::setDefaultLookAndFeel (0);
deleteAndZero (oldLook);


+ 1
- 1
extras/the jucer/src/ui/jucer_PrefsPanel.cpp View File

@@ -162,7 +162,7 @@ PrefsPanel::PrefsPanel()
PrefsTabComp* const p = new PrefsTabComp();
p->setSize (456, 510);
setContentComponent (p, true, true);
setContentOwned (p, true);
if (! restoreWindowStateFromString (prefsWindowPos))
centreAroundComponent (0, getWidth(), getHeight());


+ 2
- 2
juce_amalgamated.cpp View File

@@ -78605,7 +78605,7 @@ void ResizableWindow::addChildComponent (Component* const child, int zOrder)

If you really know what you're doing and want to avoid this assertion, just call
Component::addChildComponent directly.
*/
*/
jassertfalse;

Component::addChildComponent (child, zOrder);
@@ -78622,7 +78622,7 @@ void ResizableWindow::addAndMakeVisible (Component* const child, int zOrder)

If you really know what you're doing and want to avoid this assertion, just call
Component::addAndMakeVisible directly.
*/
*/
jassertfalse;

Component::addAndMakeVisible (child, zOrder);


+ 12
- 18
juce_amalgamated.h View File

@@ -55305,8 +55305,8 @@ private:
/**
A base class for top-level windows that can be dragged around and resized.

To add content to the window, use its setContentComponent() method to
give it a component that will remain positioned inside it (leaving a gap around
To add content to the window, use its setContentOwned() or setContentNonOwned() methods
to give it a component that will remain positioned inside it (leaving a gap around
the edges for a border).

It's not advisable to add child components directly to a ResizableWindow: put them
@@ -55349,9 +55349,7 @@ public:
bool addToDesktop);

/** Destructor.

If a content component has been set with setContentComponent(), it
will be deleted.
If a content component has been set with setContentOwned(), it will be deleted.
*/
~ResizableWindow();

@@ -55492,10 +55490,10 @@ public:

/** Returns the current content component.

This will be the component set by setContentComponent(), or 0 if none
This will be the component set by setContentOwned() or setContentNonOwned, or 0 if none
has yet been specified.

@see setContentComponent
@see setContentOwned, setContentNonOwned
*/
Component* getContentComponent() const throw() { return contentComponent; }

@@ -55604,20 +55602,19 @@ protected:

#if JUCE_DEBUG
/** Overridden to warn people about adding components directly to this component
instead of using setContentComponent().
instead of using setContentOwned().

If you know what you're doing and are sure you really want to add a component, specify
a base-class method call to Component::addAndMakeVisible(), to side-step this warning.
*/
void addChildComponent (Component* child, int zOrder = -1);
/** Overridden to warn people about adding components directly to this component
instead of using setContentComponent().
instead of using setContentOwned().

If you know what you're doing and are sure you really want to add a component, specify
a base-class method call to Component::addAndMakeVisible(), to side-step this warning.
*/
void addAndMakeVisible (Component* child, int zOrder = -1);

#endif

ScopedPointer <ResizableCornerComponent> resizableCorner;
@@ -58342,9 +58339,7 @@ public:
bool addToDesktop = true);

/** Destructor.

If a content component has been set with setContentComponent(), it
will be deleted.
If a content component has been set with setContentOwned(), it will be deleted.
*/
~DocumentWindow();

@@ -63721,8 +63716,9 @@ private:
Any of the methods available to a DocumentWindow or ResizableWindow are also
available to this, so it can be made resizable, have a menu bar, etc.

To add items to the box, see the ResizableWindow::setContentComponent() method.
Don't add components directly to this class - always put them in a content component!
To add items to the box, see the ResizableWindow::setContentOwned() or
ResizableWindow::setContentNonOwned() methods. Don't add components directly to this
class - always put them in a content component!

You'll need to override the DocumentWindow::closeButtonPressed() method to handle
the user clicking the close button - for more info, see the DocumentWindow
@@ -63751,9 +63747,7 @@ public:
bool addToDesktop = true);

/** Destructor.

If a content component has been set with setContentComponent(), it
will be deleted.
If a content component has been set with setContentOwned(), it will be deleted.
*/
~DialogWindow();



+ 4
- 5
src/gui/components/windows/juce_DialogWindow.h View File

@@ -40,8 +40,9 @@
Any of the methods available to a DocumentWindow or ResizableWindow are also
available to this, so it can be made resizable, have a menu bar, etc.
To add items to the box, see the ResizableWindow::setContentComponent() method.
Don't add components directly to this class - always put them in a content component!
To add items to the box, see the ResizableWindow::setContentOwned() or
ResizableWindow::setContentNonOwned() methods. Don't add components directly to this
class - always put them in a content component!
You'll need to override the DocumentWindow::closeButtonPressed() method to handle
the user clicking the close button - for more info, see the DocumentWindow
@@ -70,9 +71,7 @@ public:
bool addToDesktop = true);
/** Destructor.
If a content component has been set with setContentComponent(), it
will be deleted.
If a content component has been set with setContentOwned(), it will be deleted.
*/
~DialogWindow();


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

@@ -95,9 +95,7 @@ public:
bool addToDesktop = true);
/** Destructor.
If a content component has been set with setContentComponent(), it
will be deleted.
If a content component has been set with setContentOwned(), it will be deleted.
*/
~DocumentWindow();


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

@@ -592,7 +592,7 @@ void ResizableWindow::addChildComponent (Component* const child, int zOrder)
If you really know what you're doing and want to avoid this assertion, just call
Component::addChildComponent directly.
*/
*/
jassertfalse;
Component::addChildComponent (child, zOrder);
@@ -609,7 +609,7 @@ void ResizableWindow::addAndMakeVisible (Component* const child, int zOrder)
If you really know what you're doing and want to avoid this assertion, just call
Component::addAndMakeVisible directly.
*/
*/
jassertfalse;
Component::addAndMakeVisible (child, zOrder);


+ 7
- 10
src/gui/components/windows/juce_ResizableWindow.h View File

@@ -36,8 +36,8 @@
/**
A base class for top-level windows that can be dragged around and resized.
To add content to the window, use its setContentComponent() method to
give it a component that will remain positioned inside it (leaving a gap around
To add content to the window, use its setContentOwned() or setContentNonOwned() methods
to give it a component that will remain positioned inside it (leaving a gap around
the edges for a border).
It's not advisable to add child components directly to a ResizableWindow: put them
@@ -80,9 +80,7 @@ public:
bool addToDesktop);
/** Destructor.
If a content component has been set with setContentComponent(), it
will be deleted.
If a content component has been set with setContentOwned(), it will be deleted.
*/
~ResizableWindow();
@@ -230,10 +228,10 @@ public:
//==============================================================================
/** Returns the current content component.
This will be the component set by setContentComponent(), or 0 if none
This will be the component set by setContentOwned() or setContentNonOwned, or 0 if none
has yet been specified.
@see setContentComponent
@see setContentOwned, setContentNonOwned
*/
Component* getContentComponent() const throw() { return contentComponent; }
@@ -344,20 +342,19 @@ protected:
#if JUCE_DEBUG
/** Overridden to warn people about adding components directly to this component
instead of using setContentComponent().
instead of using setContentOwned().
If you know what you're doing and are sure you really want to add a component, specify
a base-class method call to Component::addAndMakeVisible(), to side-step this warning.
*/
void addChildComponent (Component* child, int zOrder = -1);
/** Overridden to warn people about adding components directly to this component
instead of using setContentComponent().
instead of using setContentOwned().
If you know what you're doing and are sure you really want to add a component, specify
a base-class method call to Component::addAndMakeVisible(), to side-step this warning.
*/
void addAndMakeVisible (Component* child, int zOrder = -1);
#endif
ScopedPointer <ResizableCornerComponent> resizableCorner;


Loading…
Cancel
Save