Browse Source

Minor clean-ups

tags/2021-05-28
jules 10 years ago
parent
commit
66d413c32b
8 changed files with 54 additions and 54 deletions
  1. +6
    -6
      extras/audio plugin host/Source/HostStartup.cpp
  2. +7
    -7
      extras/example projects/Source/Main.cpp
  3. +4
    -4
      modules/juce_events/messages/juce_ApplicationBase.h
  4. +4
    -4
      modules/juce_gui_basics/application/juce_Application.h
  5. +11
    -11
      modules/juce_gui_basics/components/juce_Component.cpp
  6. +19
    -19
      modules/juce_gui_basics/components/juce_Component.h
  7. +1
    -1
      modules/juce_gui_basics/mouse/juce_MouseCursor.cpp
  8. +2
    -2
      modules/juce_gui_basics/mouse/juce_MouseCursor.h

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

@@ -37,7 +37,7 @@ class PluginHostApp : public JUCEApplication
public: public:
PluginHostApp() {} PluginHostApp() {}
void initialise (const String& commandLine)
void initialise (const String& commandLine) override
{ {
// initialise our settings file.. // initialise our settings file..
@@ -66,14 +66,14 @@ public:
.getChildFile (commandLine), true); .getChildFile (commandLine), true);
} }
void shutdown()
void shutdown() override
{ {
mainWindow = nullptr; mainWindow = nullptr;
appProperties = nullptr; appProperties = nullptr;
LookAndFeel::setDefaultLookAndFeel (nullptr); LookAndFeel::setDefaultLookAndFeel (nullptr);
} }
void systemRequestedQuit()
void systemRequestedQuit() override
{ {
if (mainWindow != nullptr) if (mainWindow != nullptr)
mainWindow->tryToQuitApplication(); mainWindow->tryToQuitApplication();
@@ -81,9 +81,9 @@ public:
JUCEApplicationBase::quit(); JUCEApplicationBase::quit();
} }
const String getApplicationName() { return "Juce Plug-In Host"; }
const String getApplicationVersion() { return ProjectInfo::versionString; }
bool moreThanOneInstanceAllowed() { return true; }
const String getApplicationName() override { return "Juce Plug-In Host"; }
const String getApplicationVersion() override { return ProjectInfo::versionString; }
bool moreThanOneInstanceAllowed() override { return true; }
ApplicationCommandManager commandManager; ApplicationCommandManager commandManager;
ScopedPointer<ApplicationProperties> appProperties; ScopedPointer<ApplicationProperties> appProperties;


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

@@ -42,7 +42,7 @@ public:
} }
//============================================================================== //==============================================================================
void closeButtonPressed()
void closeButtonPressed() override
{ {
// When the user presses the close button, we'll tell the app to quit. This // When the user presses the close button, we'll tell the app to quit. This
// HelloWorldWindow object will be deleted by the JUCEHelloWorldApplication class. // HelloWorldWindow object will be deleted by the JUCEHelloWorldApplication class.
@@ -61,7 +61,7 @@ public:
JUCEHelloWorldApplication() {} JUCEHelloWorldApplication() {}
//============================================================================== //==============================================================================
void initialise (const String& commandLine)
void initialise (const String& commandLine) override
{ {
// For this demo, we'll just create the main window... // For this demo, we'll just create the main window...
helloWorldWindow = new HelloWorldWindow(); helloWorldWindow = new HelloWorldWindow();
@@ -75,7 +75,7 @@ public:
*/ */
} }
void shutdown()
void shutdown() override
{ {
// This method is where you should clear-up your app's resources.. // This method is where you should clear-up your app's resources..
@@ -85,24 +85,24 @@ public:
} }
//============================================================================== //==============================================================================
const String getApplicationName()
const String getApplicationName() override
{ {
return "Hello World for JUCE"; return "Hello World for JUCE";
} }
const String getApplicationVersion()
const String getApplicationVersion() override
{ {
// The ProjectInfo::versionString value is automatically updated by the Jucer, and // The ProjectInfo::versionString value is automatically updated by the Jucer, and
// can be found in the JuceHeader.h file that it generates for our project. // can be found in the JuceHeader.h file that it generates for our project.
return ProjectInfo::versionString; return ProjectInfo::versionString;
} }
bool moreThanOneInstanceAllowed()
bool moreThanOneInstanceAllowed() override
{ {
return true; return true;
} }
void anotherInstanceStarted (const String& commandLine)
void anotherInstanceStarted (const String& commandLine) override
{ {
} }


+ 4
- 4
modules/juce_events/messages/juce_ApplicationBase.h View File

@@ -50,24 +50,24 @@
MyJUCEApp() {} MyJUCEApp() {}
~MyJUCEApp() {} ~MyJUCEApp() {}
void initialise (const String& commandLine)
void initialise (const String& commandLine) override
{ {
myMainWindow = new MyApplicationWindow(); myMainWindow = new MyApplicationWindow();
myMainWindow->setBounds (100, 100, 400, 500); myMainWindow->setBounds (100, 100, 400, 500);
myMainWindow->setVisible (true); myMainWindow->setVisible (true);
} }
void shutdown()
void shutdown() override
{ {
myMainWindow = nullptr; myMainWindow = nullptr;
} }
const String getApplicationName()
const String getApplicationName() override
{ {
return "Super JUCE-o-matic"; return "Super JUCE-o-matic";
} }
const String getApplicationVersion()
const String getApplicationVersion() override
{ {
return "1.0"; return "1.0";
} }


+ 4
- 4
modules/juce_gui_basics/application/juce_Application.h View File

@@ -53,24 +53,24 @@
MyJUCEApp() {} MyJUCEApp() {}
~MyJUCEApp() {} ~MyJUCEApp() {}
void initialise (const String& commandLine)
void initialise (const String& commandLine) override
{ {
myMainWindow = new MyApplicationWindow(); myMainWindow = new MyApplicationWindow();
myMainWindow->setBounds (100, 100, 400, 500); myMainWindow->setBounds (100, 100, 400, 500);
myMainWindow->setVisible (true); myMainWindow->setVisible (true);
} }
void shutdown()
void shutdown() override
{ {
myMainWindow = nullptr; myMainWindow = nullptr;
} }
const String getApplicationName()
const String getApplicationName() override
{ {
return "Super JUCE-o-matic"; return "Super JUCE-o-matic";
} }
const String getApplicationVersion()
const String getApplicationVersion() override
{ {
return "1.0"; return "1.0";
} }


+ 11
- 11
modules/juce_gui_basics/components/juce_Component.cpp View File

@@ -141,7 +141,7 @@ public:
} }
private: private:
Array <MouseListener*> listeners;
Array<MouseListener*> listeners;
int numDeepMouseListeners; int numDeepMouseListeners;
class BailOutChecker2 class BailOutChecker2
@@ -256,7 +256,7 @@ struct Component::ComponentHelpers
#if JUCE_MODAL_LOOPS_PERMITTED #if JUCE_MODAL_LOOPS_PERMITTED
static void* runModalLoopCallback (void* userData) static void* runModalLoopCallback (void* userData)
{ {
return (void*) (pointer_sized_int) static_cast <Component*> (userData)->runModalLoop();
return (void*) (pointer_sized_int) static_cast<Component*> (userData)->runModalLoop();
} }
#endif #endif
@@ -480,7 +480,7 @@ struct Component::ComponentHelpers
}; };
//============================================================================== //==============================================================================
Component::Component()
Component::Component() noexcept
: parentComponent (nullptr), : parentComponent (nullptr),
lookAndFeel (nullptr), lookAndFeel (nullptr),
effect (nullptr), effect (nullptr),
@@ -489,7 +489,7 @@ Component::Component()
{ {
} }
Component::Component (const String& name)
Component::Component (const String& name) noexcept
: componentName (name), : componentName (name),
parentComponent (nullptr), parentComponent (nullptr),
lookAndFeel (nullptr), lookAndFeel (nullptr),
@@ -880,7 +880,7 @@ void Component::setBufferedToImage (const bool shouldBeBuffered)
// so by calling setBufferedToImage, you'll be deleting the custom one - this is almost certainly // so by calling setBufferedToImage, you'll be deleting the custom one - this is almost certainly
// not what you wanted to happen... If you really do know what you're doing here, and want to // not what you wanted to happen... If you really do know what you're doing here, and want to
// avoid this assertion, just call setCachedComponentImage (nullptr) before setBufferedToImage(). // avoid this assertion, just call setCachedComponentImage (nullptr) before setBufferedToImage().
jassert (cachedImage == nullptr || dynamic_cast <StandardCachedComponentImage*> (cachedImage.get()) != nullptr);
jassert (cachedImage == nullptr || dynamic_cast<StandardCachedComponentImage*> (cachedImage.get()) != nullptr);
if (shouldBeBuffered) if (shouldBeBuffered)
{ {
@@ -1643,7 +1643,7 @@ Component* Component::getChildComponent (const int index) const noexcept
int Component::getIndexOfChildComponent (const Component* const child) const noexcept int Component::getIndexOfChildComponent (const Component* const child) const noexcept
{ {
return childComponentList.indexOf (const_cast <Component*> (child));
return childComponentList.indexOf (const_cast<Component*> (child));
} }
Component* Component::findChildWithID (StringRef targetID) const noexcept Component* Component::findChildWithID (StringRef targetID) const noexcept
@@ -1665,7 +1665,7 @@ Component* Component::getTopLevelComponent() const noexcept
while (comp->parentComponent != nullptr) while (comp->parentComponent != nullptr)
comp = comp->parentComponent; comp = comp->parentComponent;
return const_cast <Component*> (comp);
return const_cast<Component*> (comp);
} }
bool Component::isParentOf (const Component* possibleChild) const noexcept bool Component::isParentOf (const Component* possibleChild) const noexcept
@@ -2205,7 +2205,7 @@ void Component::sendLookAndFeelChange()
Colour Component::findColour (const int colourId, const bool inheritFromParent) const Colour Component::findColour (const int colourId, const bool inheritFromParent) const
{ {
if (const var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId))) if (const var* const v = properties.getVarPointer (ComponentHelpers::getColourPropertyId (colourId)))
return Colour ((uint32) static_cast <int> (*v));
return Colour ((uint32) static_cast<int> (*v));
if (inheritFromParent && parentComponent != nullptr if (inheritFromParent && parentComponent != nullptr
&& (lookAndFeel == nullptr || ! lookAndFeel->isColourSpecified (colourId))) && (lookAndFeel == nullptr || ! lookAndFeel->isColourSpecified (colourId)))
@@ -2856,7 +2856,7 @@ void Component::grabFocusInternal (const FocusChangeType cause, const bool canTr
else else
{ {
// find the default child component.. // find the default child component..
ScopedPointer <KeyboardFocusTraverser> traverser (createFocusTraverser());
ScopedPointer<KeyboardFocusTraverser> traverser (createFocusTraverser());
if (traverser != nullptr) if (traverser != nullptr)
{ {
@@ -2898,7 +2898,7 @@ void Component::moveKeyboardFocusToSibling (const bool moveToNext)
if (parentComponent != nullptr) if (parentComponent != nullptr)
{ {
ScopedPointer <KeyboardFocusTraverser> traverser (createFocusTraverser());
ScopedPointer<KeyboardFocusTraverser> traverser (createFocusTraverser());
if (traverser != nullptr) if (traverser != nullptr)
{ {
@@ -3052,7 +3052,7 @@ Point<int> Component::getMouseXYRelative() const
void Component::addKeyListener (KeyListener* const newListener) void Component::addKeyListener (KeyListener* const newListener)
{ {
if (keyListeners == nullptr) if (keyListeners == nullptr)
keyListeners = new Array <KeyListener*>();
keyListeners = new Array<KeyListener*>();
keyListeners->addIfNotAlreadyThere (newListener); keyListeners->addIfNotAlreadyThere (newListener);
} }


+ 19
- 19
modules/juce_gui_basics/components/juce_Component.h View File

@@ -46,7 +46,7 @@ public:
subclass of Component or use one of the other types of component from subclass of Component or use one of the other types of component from
the library. the library.
*/ */
Component();
Component() noexcept;
/** Destructor. /** Destructor.
@@ -66,7 +66,7 @@ public:
/** Creates a component, setting its name at the same time. /** Creates a component, setting its name at the same time.
@see getName, setName @see getName, setName
*/ */
explicit Component (const String& componentName);
explicit Component (const String& componentName) noexcept;
/** Returns the name of this component. /** Returns the name of this component.
@see setName @see setName
@@ -807,7 +807,7 @@ public:
TargetClass* findParentComponentOfClass() const TargetClass* findParentComponentOfClass() const
{ {
for (Component* p = parentComponent; p != nullptr; p = p->parentComponent) for (Component* p = parentComponent; p != nullptr; p = p->parentComponent)
if (TargetClass* const target = dynamic_cast <TargetClass*> (p))
if (TargetClass* const target = dynamic_cast<TargetClass*> (p))
return target; return target;
return nullptr; return nullptr;
@@ -2136,31 +2136,31 @@ public:
SafePointer() noexcept {} SafePointer() noexcept {}
/** Creates a SafePointer that points at the given component. */ /** Creates a SafePointer that points at the given component. */
SafePointer (ComponentType* const component) : weakRef (component) {}
SafePointer (ComponentType* component) : weakRef (component) {}
/** Creates a copy of another SafePointer. */ /** Creates a copy of another SafePointer. */
SafePointer (const SafePointer& other) noexcept : weakRef (other.weakRef) {}
SafePointer (const SafePointer& other) noexcept : weakRef (other.weakRef) {}
/** Copies another pointer to this one. */ /** Copies another pointer to this one. */
SafePointer& operator= (const SafePointer& other) { weakRef = other.weakRef; return *this; }
SafePointer& operator= (const SafePointer& other) { weakRef = other.weakRef; return *this; }
/** Copies another pointer to this one. */ /** Copies another pointer to this one. */
SafePointer& operator= (ComponentType* const newComponent) { weakRef = newComponent; return *this; }
SafePointer& operator= (ComponentType* newComponent) { weakRef = newComponent; return *this; }
/** Returns the component that this pointer refers to, or null if the component no longer exists. */ /** Returns the component that this pointer refers to, or null if the component no longer exists. */
ComponentType* getComponent() const noexcept { return dynamic_cast <ComponentType*> (weakRef.get()); }
ComponentType* getComponent() const noexcept { return dynamic_cast<ComponentType*> (weakRef.get()); }
/** Returns the component that this pointer refers to, or null if the component no longer exists. */ /** Returns the component that this pointer refers to, or null if the component no longer exists. */
operator ComponentType*() const noexcept { return getComponent(); }
operator ComponentType*() const noexcept { return getComponent(); }
/** Returns the component that this pointer refers to, or null if the component no longer exists. */ /** Returns the component that this pointer refers to, or null if the component no longer exists. */
ComponentType* operator->() noexcept { return getComponent(); }
ComponentType* operator->() noexcept { return getComponent(); }
/** Returns the component that this pointer refers to, or null if the component no longer exists. */ /** Returns the component that this pointer refers to, or null if the component no longer exists. */
const ComponentType* operator->() const noexcept { return getComponent(); }
const ComponentType* operator->() const noexcept { return getComponent(); }
/** If the component is valid, this deletes it and sets this pointer to null. */ /** If the component is valid, this deletes it and sets this pointer to null. */
void deleteAndZero() { delete getComponent(); }
void deleteAndZero() { delete getComponent(); }
bool operator== (ComponentType* component) const noexcept { return weakRef == component; } bool operator== (ComponentType* component) const noexcept { return weakRef == component; }
bool operator!= (ComponentType* component) const noexcept { return weakRef != component; } bool operator!= (ComponentType* component) const noexcept { return weakRef != component; }
@@ -2268,20 +2268,20 @@ private:
String componentName, componentID; String componentName, componentID;
Component* parentComponent; Component* parentComponent;
Rectangle<int> bounds; Rectangle<int> bounds;
ScopedPointer <Positioner> positioner;
ScopedPointer <AffineTransform> affineTransform;
Array <Component*> childComponentList;
ScopedPointer<Positioner> positioner;
ScopedPointer<AffineTransform> affineTransform;
Array<Component*> childComponentList;
LookAndFeel* lookAndFeel; LookAndFeel* lookAndFeel;
MouseCursor cursor; MouseCursor cursor;
ImageEffectFilter* effect; ImageEffectFilter* effect;
ScopedPointer <CachedComponentImage> cachedImage;
ScopedPointer<CachedComponentImage> cachedImage;
class MouseListenerList; class MouseListenerList;
friend class MouseListenerList; friend class MouseListenerList;
friend struct ContainerDeletePolicy<MouseListenerList>; friend struct ContainerDeletePolicy<MouseListenerList>;
ScopedPointer <MouseListenerList> mouseListeners;
ScopedPointer <Array <KeyListener*> > keyListeners;
ListenerList <ComponentListener> componentListeners;
ScopedPointer<MouseListenerList> mouseListeners;
ScopedPointer<Array<KeyListener*> > keyListeners;
ListenerList<ComponentListener> componentListeners;
NamedValueSet properties; NamedValueSet properties;
friend class WeakReference<Component>; friend class WeakReference<Component>;


+ 1
- 1
modules/juce_gui_basics/mouse/juce_MouseCursor.cpp View File

@@ -128,7 +128,7 @@ private:
SpinLock MouseCursor::SharedCursorHandle::lock; SpinLock MouseCursor::SharedCursorHandle::lock;
//============================================================================== //==============================================================================
MouseCursor::MouseCursor()
MouseCursor::MouseCursor() noexcept
: cursorHandle (nullptr) : cursorHandle (nullptr)
{ {
} }


+ 2
- 2
modules/juce_gui_basics/mouse/juce_MouseCursor.h View File

@@ -72,10 +72,10 @@ public:
//============================================================================== //==============================================================================
/** Creates the standard arrow cursor. */ /** Creates the standard arrow cursor. */
MouseCursor();
MouseCursor() noexcept;
/** Creates one of the standard mouse cursor */ /** Creates one of the standard mouse cursor */
MouseCursor (StandardCursorType type);
MouseCursor (StandardCursorType);
/** Creates a custom cursor from an image. /** Creates a custom cursor from an image.


Loading…
Cancel
Save