diff --git a/juce_amalgamated.cpp b/juce_amalgamated.cpp index 3262ec6314..3f7a0e0d35 100644 --- a/juce_amalgamated.cpp +++ b/juce_amalgamated.cpp @@ -42301,6 +42301,21 @@ END_JUCE_NAMESPACE BEGIN_JUCE_NAMESPACE +class Button::RepeatTimer : public Timer +{ +public: + RepeatTimer (Button& owner_) : owner (owner_) {} + void timerCallback() { owner.repeatTimerCallback(); } + + juce_UseDebuggingNewOperator + +private: + Button& owner; + + RepeatTimer (const RepeatTimer&); + RepeatTimer& operator= (const RepeatTimer&); +}; + Button::Button (const String& name) : Component (name), keySource (0), @@ -42338,7 +42353,7 @@ Button::~Button() clearShortcuts(); } -void Button::setButtonText (const String& newText) throw() +void Button::setButtonText (const String& newText) { if (text != newText) { @@ -42379,7 +42394,7 @@ const String Button::getTooltip() return SettableTooltipClient::getTooltip(); } -void Button::setConnectedEdges (const int connectedEdgeFlags_) throw() +void Button::setConnectedEdges (const int connectedEdgeFlags_) { if (connectedEdgeFlags != connectedEdgeFlags_) { @@ -42474,7 +42489,7 @@ void Button::enablementChanged() repaint(); } -Button::ButtonState Button::updateState (const MouseEvent* const e) throw() +Button::ButtonState Button::updateState (const MouseEvent* const e) { ButtonState state = buttonNormal; @@ -42572,7 +42587,7 @@ void Button::internalClickCallback (const ModifierKeys& modifiers) sendClickMessage (modifiers); } -void Button::flashButtonState() throw() +void Button::flashButtonState() { if (isEnabled()) { @@ -42598,7 +42613,7 @@ void Button::handleCommandMessage (int commandId) } } -void Button::addButtonListener (ButtonListener* const newListener) throw() +void Button::addButtonListener (ButtonListener* const newListener) { jassert (newListener != 0); jassert (! buttonListeners.contains (newListener)); // trying to add a listener to the list twice! @@ -42607,7 +42622,7 @@ void Button::addButtonListener (ButtonListener* const newListener) throw() buttonListeners.add (newListener); } -void Button::removeButtonListener (ButtonListener* const listener) throw() +void Button::removeButtonListener (ButtonListener* const listener) { jassert (buttonListeners.contains (listener)); // trying to remove a listener that isn't on the list! @@ -42839,7 +42854,7 @@ void Button::clearShortcuts() parentHierarchyChanged(); } -bool Button::isShortcutPressed() const throw() +bool Button::isShortcutPressed() const { if (! isCurrentlyBlockedByAnotherModalComponent()) { @@ -42851,7 +42866,7 @@ bool Button::isShortcutPressed() const throw() return false; } -bool Button::isRegisteredForShortcut (const KeyPress& key) const throw() +bool Button::isRegisteredForShortcut (const KeyPress& key) const { for (int i = shortcuts.size(); --i >= 0;) if (key == shortcuts.getReference(i)) @@ -42910,7 +42925,7 @@ void Button::setRepeatSpeed (const int initialDelayMillisecs, autoRepeatMinimumDelay = jmin (autoRepeatSpeed, minimumDelayInMillisecs); } -void Button::repeatTimerCallback() throw() +void Button::repeatTimerCallback() { if (needsRepainting) { @@ -42955,34 +42970,10 @@ void Button::repeatTimerCallback() throw() } } -class InternalButtonRepeatTimer : public Timer -{ -public: - InternalButtonRepeatTimer (Button& owner_) throw() - : owner (owner_) - { - } - - ~InternalButtonRepeatTimer() - { - } - - void timerCallback() - { - owner.repeatTimerCallback(); - } - -private: - Button& owner; - - InternalButtonRepeatTimer (const InternalButtonRepeatTimer&); - const InternalButtonRepeatTimer& operator= (const InternalButtonRepeatTimer&); -}; - -Timer& Button::getRepeatTimer() throw() +Button::RepeatTimer& Button::getRepeatTimer() { if (repeatTimer == 0) - repeatTimer = new InternalButtonRepeatTimer (*this); + repeatTimer = new RepeatTimer (*this); return *repeatTimer; } diff --git a/juce_amalgamated.h b/juce_amalgamated.h index 9157d3e072..973aaaa05a 100644 --- a/juce_amalgamated.h +++ b/juce_amalgamated.h @@ -15272,9 +15272,9 @@ protected: public: virtual ~Button(); - void setButtonText (const String& newText) throw(); + void setButtonText (const String& newText); - const String getButtonText() const throw() { return text; } + const String getButtonText() const { return text; } bool isDown() const throw(); @@ -15295,9 +15295,9 @@ public: int getRadioGroupId() const throw() { return radioGroupId; } - void addButtonListener (ButtonListener* const newListener) throw(); + void addButtonListener (ButtonListener* const newListener); - void removeButtonListener (ButtonListener* const listener) throw(); + void removeButtonListener (ButtonListener* const listener); virtual void triggerClick(); @@ -15311,7 +15311,7 @@ public: void clearShortcuts(); - bool isRegisteredForShortcut (const KeyPress& key) const throw(); + bool isRegisteredForShortcut (const KeyPress& key) const; void setRepeatSpeed (const int initialDelayInMillisecs, const int repeatDelayInMillisecs, @@ -15336,7 +15336,7 @@ public: ConnectedOnBottom = 8 }; - void setConnectedEdges (const int connectedEdgeFlags) throw(); + void setConnectedEdges (const int connectedEdgeFlags); int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; } @@ -15397,8 +15397,9 @@ private: String text; SortedSet buttonListeners; - friend class InternalButtonRepeatTimer; - ScopedPointer repeatTimer; + class RepeatTimer; + friend class ScopedPointer ; + ScopedPointer repeatTimer; uint32 buttonPressTime, lastTimeCallbackTime; ApplicationCommandManager* commandManagerToUse; int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay; @@ -15414,14 +15415,14 @@ private: bool triggerOnMouseDown : 1; bool generateTooltip : 1; - void repeatTimerCallback() throw(); - Timer& getRepeatTimer() throw(); + void repeatTimerCallback(); + RepeatTimer& getRepeatTimer(); - ButtonState updateState (const MouseEvent* const e) throw(); - bool isShortcutPressed() const throw(); + ButtonState updateState (const MouseEvent* const e); + bool isShortcutPressed() const; void turnOffOtherButtonsInGroup (const bool sendChangeNotification); - void flashButtonState() throw(); + void flashButtonState(); void sendClickMessage (const ModifierKeys& modifiers); void sendStateMessage(); @@ -23530,7 +23531,7 @@ private: MenuBarModel* menuBarModel; class ButtonListenerProxy; - friend class ButtonListenerProxy; + friend class ScopedPointer ; ScopedPointer buttonListener; void repaintTitleBar(); diff --git a/src/gui/components/buttons/juce_Button.cpp b/src/gui/components/buttons/juce_Button.cpp index 22e3718063..901e3df448 100644 --- a/src/gui/components/buttons/juce_Button.cpp +++ b/src/gui/components/buttons/juce_Button.cpp @@ -31,8 +31,25 @@ BEGIN_JUCE_NAMESPACE #include "../juce_ComponentDeletionWatcher.h" #include "../keyboard/juce_KeyPressMappingSet.h" #include "../../../text/juce_LocalisedStrings.h" +#include "../../../events/juce_Timer.h" +//============================================================================== +class Button::RepeatTimer : public Timer +{ +public: + RepeatTimer (Button& owner_) : owner (owner_) {} + void timerCallback() { owner.repeatTimerCallback(); } + + juce_UseDebuggingNewOperator + +private: + Button& owner; + + RepeatTimer (const RepeatTimer&); + RepeatTimer& operator= (const RepeatTimer&); +}; + //============================================================================== Button::Button (const String& name) : Component (name), @@ -72,7 +89,7 @@ Button::~Button() } //============================================================================== -void Button::setButtonText (const String& newText) throw() +void Button::setButtonText (const String& newText) { if (text != newText) { @@ -113,7 +130,7 @@ const String Button::getTooltip() return SettableTooltipClient::getTooltip(); } -void Button::setConnectedEdges (const int connectedEdgeFlags_) throw() +void Button::setConnectedEdges (const int connectedEdgeFlags_) { if (connectedEdgeFlags != connectedEdgeFlags_) { @@ -210,7 +227,7 @@ void Button::enablementChanged() repaint(); } -Button::ButtonState Button::updateState (const MouseEvent* const e) throw() +Button::ButtonState Button::updateState (const MouseEvent* const e) { ButtonState state = buttonNormal; @@ -309,7 +326,7 @@ void Button::internalClickCallback (const ModifierKeys& modifiers) sendClickMessage (modifiers); } -void Button::flashButtonState() throw() +void Button::flashButtonState() { if (isEnabled()) { @@ -336,7 +353,7 @@ void Button::handleCommandMessage (int commandId) } //============================================================================== -void Button::addButtonListener (ButtonListener* const newListener) throw() +void Button::addButtonListener (ButtonListener* const newListener) { jassert (newListener != 0); jassert (! buttonListeners.contains (newListener)); // trying to add a listener to the list twice! @@ -345,7 +362,7 @@ void Button::addButtonListener (ButtonListener* const newListener) throw() buttonListeners.add (newListener); } -void Button::removeButtonListener (ButtonListener* const listener) throw() +void Button::removeButtonListener (ButtonListener* const listener) { jassert (buttonListeners.contains (listener)); // trying to remove a listener that isn't on the list! @@ -582,7 +599,7 @@ void Button::clearShortcuts() parentHierarchyChanged(); } -bool Button::isShortcutPressed() const throw() +bool Button::isShortcutPressed() const { if (! isCurrentlyBlockedByAnotherModalComponent()) { @@ -594,7 +611,7 @@ bool Button::isShortcutPressed() const throw() return false; } -bool Button::isRegisteredForShortcut (const KeyPress& key) const throw() +bool Button::isRegisteredForShortcut (const KeyPress& key) const { for (int i = shortcuts.size(); --i >= 0;) if (key == shortcuts.getReference(i)) @@ -654,7 +671,7 @@ void Button::setRepeatSpeed (const int initialDelayMillisecs, autoRepeatMinimumDelay = jmin (autoRepeatSpeed, minimumDelayInMillisecs); } -void Button::repeatTimerCallback() throw() +void Button::repeatTimerCallback() { if (needsRepainting) { @@ -699,34 +716,10 @@ void Button::repeatTimerCallback() throw() } } -class InternalButtonRepeatTimer : public Timer -{ -public: - InternalButtonRepeatTimer (Button& owner_) throw() - : owner (owner_) - { - } - - ~InternalButtonRepeatTimer() - { - } - - void timerCallback() - { - owner.repeatTimerCallback(); - } - -private: - Button& owner; - - InternalButtonRepeatTimer (const InternalButtonRepeatTimer&); - const InternalButtonRepeatTimer& operator= (const InternalButtonRepeatTimer&); -}; - -Timer& Button::getRepeatTimer() throw() +Button::RepeatTimer& Button::getRepeatTimer() { if (repeatTimer == 0) - repeatTimer = new InternalButtonRepeatTimer (*this); + repeatTimer = new RepeatTimer (*this); return *repeatTimer; } diff --git a/src/gui/components/buttons/juce_Button.h b/src/gui/components/buttons/juce_Button.h index ca537960b2..67c776a958 100644 --- a/src/gui/components/buttons/juce_Button.h +++ b/src/gui/components/buttons/juce_Button.h @@ -32,7 +32,6 @@ #include "../../../containers/juce_SortedSet.h" #include "../../../containers/juce_Value.h" #include "../windows/juce_TooltipWindow.h" -#include "../../../events/juce_Timer.h" class Button; @@ -91,13 +90,13 @@ public: @see getButtonText */ - void setButtonText (const String& newText) throw(); + void setButtonText (const String& newText); /** Returns the text displayed in the button. @see setButtonText */ - const String getButtonText() const throw() { return text; } + const String getButtonText() const { return text; } //============================================================================== /** Returns true if the button is currently being held down by the mouse. @@ -198,13 +197,13 @@ public: @see removeButtonListener */ - void addButtonListener (ButtonListener* const newListener) throw(); + void addButtonListener (ButtonListener* const newListener); /** Removes a previously-registered button listener @see addButtonListener */ - void removeButtonListener (ButtonListener* const listener) throw(); + void removeButtonListener (ButtonListener* const listener); //============================================================================== /** Causes the button to act as if it's been clicked. @@ -261,7 +260,7 @@ public: @see addShortcut */ - bool isRegisteredForShortcut (const KeyPress& key) const throw(); + bool isRegisteredForShortcut (const KeyPress& key) const; //============================================================================== /** Sets an auto-repeat speed for the button when it is held down. @@ -334,7 +333,7 @@ public: LookAndFeel can choose to ignore it if it's not relevent for this type of button. */ - void setConnectedEdges (const int connectedEdgeFlags) throw(); + void setConnectedEdges (const int connectedEdgeFlags); /** Returns the set of flags passed into setConnectedEdges(). */ int getConnectedEdgeFlags() const throw() { return connectedEdgeFlags; } @@ -474,8 +473,9 @@ private: String text; SortedSet buttonListeners; - friend class InternalButtonRepeatTimer; - ScopedPointer repeatTimer; + class RepeatTimer; + friend class ScopedPointer ; + ScopedPointer repeatTimer; uint32 buttonPressTime, lastTimeCallbackTime; ApplicationCommandManager* commandManagerToUse; int autoRepeatDelay, autoRepeatSpeed, autoRepeatMinimumDelay; @@ -491,14 +491,14 @@ private: bool triggerOnMouseDown : 1; bool generateTooltip : 1; - void repeatTimerCallback() throw(); - Timer& getRepeatTimer() throw(); + void repeatTimerCallback(); + RepeatTimer& getRepeatTimer(); - ButtonState updateState (const MouseEvent* const e) throw(); - bool isShortcutPressed() const throw(); + ButtonState updateState (const MouseEvent* const e); + bool isShortcutPressed() const; void turnOffOtherButtonsInGroup (const bool sendChangeNotification); - void flashButtonState() throw(); + void flashButtonState(); void sendClickMessage (const ModifierKeys& modifiers); void sendStateMessage(); diff --git a/src/gui/components/windows/juce_DocumentWindow.h b/src/gui/components/windows/juce_DocumentWindow.h index d4c6fa88bd..fc31eaeb06 100644 --- a/src/gui/components/windows/juce_DocumentWindow.h +++ b/src/gui/components/windows/juce_DocumentWindow.h @@ -254,7 +254,7 @@ private: MenuBarModel* menuBarModel; class ButtonListenerProxy; - friend class ButtonListenerProxy; + friend class ScopedPointer ; ScopedPointer buttonListener; void repaintTitleBar();