| @@ -133,7 +133,7 @@ void juce_setThreadPriority (void* handle, int priority) throw() | |||||
| } | } | ||||
| } | } | ||||
| void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) | |||||
| void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) throw() | |||||
| { | { | ||||
| #if SUPPORT_AFFINITIES | #if SUPPORT_AFFINITIES | ||||
| cpu_set_t affinity; | cpu_set_t affinity; | ||||
| @@ -302,7 +302,7 @@ void ModifierKeys::updateCurrentModifiers() | |||||
| currentModifierFlags = currentModifiers; | currentModifierFlags = currentModifiers; | ||||
| } | } | ||||
| const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() | |||||
| const ModifierKeys ModifierKeys::getCurrentModifiersRealtime() throw() | |||||
| { | { | ||||
| int x, y, mouseMods; | int x, y, mouseMods; | ||||
| getMousePos (x, y, mouseMods); | getMousePos (x, y, mouseMods); | ||||
| @@ -3090,6 +3090,8 @@ const int KeyPress::numberPadMultiply = (XK_KP_Multiply & 0xff)| extendedK | |||||
| const int KeyPress::numberPadDivide = (XK_KP_Divide & 0xff)| extendedKeyModifier; | const int KeyPress::numberPadDivide = (XK_KP_Divide & 0xff)| extendedKeyModifier; | ||||
| const int KeyPress::numberPadSeparator = (XK_KP_Separator & 0xff)| extendedKeyModifier; | const int KeyPress::numberPadSeparator = (XK_KP_Separator & 0xff)| extendedKeyModifier; | ||||
| const int KeyPress::numberPadDecimalPoint = (XK_KP_Decimal & 0xff)| extendedKeyModifier; | const int KeyPress::numberPadDecimalPoint = (XK_KP_Decimal & 0xff)| extendedKeyModifier; | ||||
| const int KeyPress::numberPadEquals = (XK_KP_Equal & 0xff)| extendedKeyModifier; | |||||
| const int KeyPress::numberPadDelete = (XK_KP_Delete & 0xff)| extendedKeyModifier; | |||||
| const int KeyPress::playKey = (0xffeeff00) | extendedKeyModifier; | const int KeyPress::playKey = (0xffeeff00) | extendedKeyModifier; | ||||
| const int KeyPress::stopKey = (0xffeeff01) | extendedKeyModifier; | const int KeyPress::stopKey = (0xffeeff01) | extendedKeyModifier; | ||||
| const int KeyPress::fastForwardKey = (0xffeeff02) | extendedKeyModifier; | const int KeyPress::fastForwardKey = (0xffeeff02) | extendedKeyModifier; | ||||
| @@ -207,7 +207,7 @@ void Thread::yield() throw() | |||||
| sched_yield(); | sched_yield(); | ||||
| } | } | ||||
| void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) | |||||
| void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) throw() | |||||
| { | { | ||||
| // xxx | // xxx | ||||
| jassertfalse | jassertfalse | ||||
| @@ -61,7 +61,6 @@ BEGIN_JUCE_NAMESPACE | |||||
| #include "../../../src/juce_core/io/files/juce_File.h" | #include "../../../src/juce_core/io/files/juce_File.h" | ||||
| #include "../../../src/juce_core/basics/juce_SystemStats.h" | #include "../../../src/juce_core/basics/juce_SystemStats.h" | ||||
| #include "juce_win32_DynamicLibraryLoader.h" | |||||
| extern void juce_updateMultiMonitorInfo() throw(); | extern void juce_updateMultiMonitorInfo() throw(); | ||||
| @@ -208,7 +208,7 @@ void juce_setThreadPriority (void* threadHandle, int priority) throw() | |||||
| SetThreadPriority (threadHandle, pri); | SetThreadPriority (threadHandle, pri); | ||||
| } | } | ||||
| void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) | |||||
| void Thread::setCurrentThreadAffinityMask (const uint32 affinityMask) throw() | |||||
| { | { | ||||
| SetThreadAffinityMask (GetCurrentThread(), affinityMask); | SetThreadAffinityMask (GetCurrentThread(), affinityMask); | ||||
| } | } | ||||
| @@ -1,194 +1,194 @@ | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-7 by Raw Material Software ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the | |||||
| GNU General Public License, as published by the Free Software Foundation; | |||||
| either version 2 of the License, or (at your option) any later version. | |||||
| JUCE is distributed in the hope that it will be useful, | |||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| GNU General Public License for more details. | |||||
| You should have received a copy of the GNU General Public License | |||||
| along with JUCE; if not, visit www.gnu.org/licenses or write to the | |||||
| Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |||||
| Boston, MA 02111-1307 USA | |||||
| ------------------------------------------------------------------------------ | |||||
| If you'd like to release a closed-source product which uses JUCE, commercial | |||||
| licenses are also available: visit www.rawmaterialsoftware.com/juce for | |||||
| more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| #include "DemoEditorComponent.h" | |||||
| //============================================================================== | |||||
| // quick-and-dirty function to format a timecode string | |||||
| static const String timeToTimecodeString (const double seconds) | |||||
| { | |||||
| const double absSecs = fabs (seconds); | |||||
| const tchar* const sign = (seconds < 0) ? T("-") : T(""); | |||||
| const int hours = (int) (absSecs / (60.0 * 60.0)); | |||||
| const int mins = ((int) (absSecs / 60.0)) % 60; | |||||
| const int secs = ((int) absSecs) % 60; | |||||
| return String::formatted (T("%s%02d:%02d:%02d:%03d"), | |||||
| sign, hours, mins, secs, | |||||
| roundDoubleToInt (absSecs * 1000) % 1000); | |||||
| } | |||||
| // quick-and-dirty function to format a bars/beats string | |||||
| static const String ppqToBarsBeatsString (const double ppq, | |||||
| const double lastBarPPQ, | |||||
| const int numerator, | |||||
| const int denominator) | |||||
| { | |||||
| if (numerator == 0 || denominator == 0) | |||||
| return T("1|1|0"); | |||||
| const int ppqPerBar = (numerator * 4 / denominator); | |||||
| const double beats = (fmod (ppq, ppqPerBar) / ppqPerBar) * numerator; | |||||
| const int bar = ((int) ppq) / ppqPerBar + 1; | |||||
| const int beat = ((int) beats) + 1; | |||||
| const int ticks = ((int) (fmod (beats, 1.0) * 960.0)); | |||||
| String s; | |||||
| s << bar << T('|') << beat << T('|') << ticks; | |||||
| return s; | |||||
| } | |||||
| //============================================================================== | |||||
| DemoEditorComponent::DemoEditorComponent (DemoJuceFilter* const ownerFilter) | |||||
| : AudioFilterEditor (ownerFilter) | |||||
| { | |||||
| // create our gain slider.. | |||||
| addAndMakeVisible (gainSlider = new Slider (T("gain"))); | |||||
| gainSlider->addListener (this); | |||||
| gainSlider->setRange (0.0, 1.0, 0.01); | |||||
| gainSlider->setTooltip (T("changes the volume of the audio that runs through the plugin..")); | |||||
| // get the gain parameter from the filter and use it to set up our slider | |||||
| gainSlider->setValue (ownerFilter->getParameter (0), false); | |||||
| // create and add the midi keyboard component.. | |||||
| addAndMakeVisible (midiKeyboard | |||||
| = new MidiKeyboardComponent (ownerFilter->keyboardState, | |||||
| MidiKeyboardComponent::horizontalKeyboard)); | |||||
| // add a label that will display the current timecode and status.. | |||||
| addAndMakeVisible (infoLabel = new Label (String::empty, String::empty)); | |||||
| // add the triangular resizer component for the bottom-right of the UI | |||||
| addAndMakeVisible (resizer = new ResizableCornerComponent (this, &resizeLimits)); | |||||
| resizeLimits.setSizeLimits (150, 150, 800, 300); | |||||
| // set our component's initial size to be the last one that was stored in the filter's settings | |||||
| setSize (ownerFilter->lastUIWidth, | |||||
| ownerFilter->lastUIHeight); | |||||
| // register ourselves with the filter - it will use its ChangeBroadcaster base | |||||
| // class to tell us when something has changed, and this will call our changeListenerCallback() | |||||
| // method. | |||||
| ownerFilter->addChangeListener (this); | |||||
| } | |||||
| DemoEditorComponent::~DemoEditorComponent() | |||||
| { | |||||
| getFilter()->removeChangeListener (this); | |||||
| deleteAllChildren(); | |||||
| } | |||||
| //============================================================================== | |||||
| void DemoEditorComponent::paint (Graphics& g) | |||||
| { | |||||
| // just clear the window | |||||
| g.fillAll (Colour::greyLevel (0.9f)); | |||||
| } | |||||
| void DemoEditorComponent::resized() | |||||
| { | |||||
| gainSlider->setBounds (10, 10, 200, 22); | |||||
| infoLabel->setBounds (10, 35, 450, 20); | |||||
| const int keyboardHeight = 70; | |||||
| midiKeyboard->setBounds (4, getHeight() - keyboardHeight - 4, | |||||
| getWidth() - 8, keyboardHeight); | |||||
| resizer->setBounds (getWidth() - 16, getHeight() - 16, 16, 16); | |||||
| // if we've been resized, tell the filter so that it can store the new size | |||||
| // in its settings | |||||
| getFilter()->lastUIWidth = getWidth(); | |||||
| getFilter()->lastUIHeight = getHeight(); | |||||
| } | |||||
| //============================================================================== | |||||
| void DemoEditorComponent::changeListenerCallback (void* source) | |||||
| { | |||||
| // this is the filter telling us that it's changed, so we'll update our | |||||
| // display of the time, midi message, etc. | |||||
| updateParametersFromFilter(); | |||||
| } | |||||
| void DemoEditorComponent::sliderValueChanged (Slider*) | |||||
| { | |||||
| getFilter()->setParameterNotifyingHost (0, (float) gainSlider->getValue()); | |||||
| } | |||||
| //============================================================================== | |||||
| void DemoEditorComponent::updateParametersFromFilter() | |||||
| { | |||||
| DemoJuceFilter* const filter = getFilter(); | |||||
| // we use this lock to make sure the processBlock() method isn't writing to the | |||||
| // lastMidiMessage variable while we're trying to read it, but be extra-careful to | |||||
| // only hold the lock for a minimum amount of time.. | |||||
| filter->getCallbackLock().enter(); | |||||
| // take a local copy of the info we need while we've got the lock.. | |||||
| const AudioFilterBase::CurrentPositionInfo positionInfo (filter->lastPosInfo); | |||||
| const float newGain = filter->getParameter (0); | |||||
| // ..release the lock ASAP | |||||
| filter->getCallbackLock().exit(); | |||||
| // ..and after releasing the lock, we're free to do the time-consuming UI stuff.. | |||||
| String infoText; | |||||
| infoText << String (positionInfo.bpm, 2) << T(" bpm, ") | |||||
| << positionInfo.timeSigNumerator << T("/") << positionInfo.timeSigDenominator | |||||
| << T(" - ") << timeToTimecodeString (positionInfo.timeInSeconds) | |||||
| << T(" - ") << ppqToBarsBeatsString (positionInfo.ppqPosition, | |||||
| positionInfo.ppqPositionOfLastBarStart, | |||||
| positionInfo.timeSigNumerator, | |||||
| positionInfo.timeSigDenominator); | |||||
| if (positionInfo.isPlaying) | |||||
| infoText << T(" (playing)"); | |||||
| infoLabel->setText (infoText, false); | |||||
| /* Update our slider. | |||||
| (note that it's important here to tell the slider not to send a change | |||||
| message, because that would cause it to call the filter with a parameter | |||||
| change message again, and the values would drift out. | |||||
| */ | |||||
| gainSlider->setValue (newGain, false); | |||||
| setSize (filter->lastUIWidth, | |||||
| filter->lastUIHeight); | |||||
| } | |||||
| /* | |||||
| ============================================================================== | |||||
| This file is part of the JUCE library - "Jules' Utility Class Extensions" | |||||
| Copyright 2004-7 by Raw Material Software ltd. | |||||
| ------------------------------------------------------------------------------ | |||||
| JUCE can be redistributed and/or modified under the terms of the | |||||
| GNU General Public License, as published by the Free Software Foundation; | |||||
| either version 2 of the License, or (at your option) any later version. | |||||
| JUCE is distributed in the hope that it will be useful, | |||||
| but WITHOUT ANY WARRANTY; without even the implied warranty of | |||||
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||||
| GNU General Public License for more details. | |||||
| You should have received a copy of the GNU General Public License | |||||
| along with JUCE; if not, visit www.gnu.org/licenses or write to the | |||||
| Free Software Foundation, Inc., 59 Temple Place, Suite 330, | |||||
| Boston, MA 02111-1307 USA | |||||
| ------------------------------------------------------------------------------ | |||||
| If you'd like to release a closed-source product which uses JUCE, commercial | |||||
| licenses are also available: visit www.rawmaterialsoftware.com/juce for | |||||
| more information. | |||||
| ============================================================================== | |||||
| */ | |||||
| #include "DemoEditorComponent.h" | |||||
| //============================================================================== | |||||
| // quick-and-dirty function to format a timecode string | |||||
| static const String timeToTimecodeString (const double seconds) | |||||
| { | |||||
| const double absSecs = fabs (seconds); | |||||
| const tchar* const sign = (seconds < 0) ? T("-") : T(""); | |||||
| const int hours = (int) (absSecs / (60.0 * 60.0)); | |||||
| const int mins = ((int) (absSecs / 60.0)) % 60; | |||||
| const int secs = ((int) absSecs) % 60; | |||||
| return String::formatted (T("%s%02d:%02d:%02d:%03d"), | |||||
| sign, hours, mins, secs, | |||||
| roundDoubleToInt (absSecs * 1000) % 1000); | |||||
| } | |||||
| // quick-and-dirty function to format a bars/beats string | |||||
| static const String ppqToBarsBeatsString (const double ppq, | |||||
| const double lastBarPPQ, | |||||
| const int numerator, | |||||
| const int denominator) | |||||
| { | |||||
| if (numerator == 0 || denominator == 0) | |||||
| return T("1|1|0"); | |||||
| const int ppqPerBar = (numerator * 4 / denominator); | |||||
| const double beats = (fmod (ppq, ppqPerBar) / ppqPerBar) * numerator; | |||||
| const int bar = ((int) ppq) / ppqPerBar + 1; | |||||
| const int beat = ((int) beats) + 1; | |||||
| const int ticks = ((int) (fmod (beats, 1.0) * 960.0)); | |||||
| String s; | |||||
| s << bar << T('|') << beat << T('|') << ticks; | |||||
| return s; | |||||
| } | |||||
| //============================================================================== | |||||
| DemoEditorComponent::DemoEditorComponent (DemoJuceFilter* const ownerFilter) | |||||
| : AudioFilterEditor (ownerFilter) | |||||
| { | |||||
| // create our gain slider.. | |||||
| addAndMakeVisible (gainSlider = new Slider (T("gain"))); | |||||
| gainSlider->addListener (this); | |||||
| gainSlider->setRange (0.0, 1.0, 0.01); | |||||
| gainSlider->setTooltip (T("changes the volume of the audio that runs through the plugin..")); | |||||
| // get the gain parameter from the filter and use it to set up our slider | |||||
| gainSlider->setValue (ownerFilter->getParameter (0), false); | |||||
| // create and add the midi keyboard component.. | |||||
| addAndMakeVisible (midiKeyboard | |||||
| = new MidiKeyboardComponent (ownerFilter->keyboardState, | |||||
| MidiKeyboardComponent::horizontalKeyboard)); | |||||
| // add a label that will display the current timecode and status.. | |||||
| addAndMakeVisible (infoLabel = new Label (String::empty, String::empty)); | |||||
| // add the triangular resizer component for the bottom-right of the UI | |||||
| addAndMakeVisible (resizer = new ResizableCornerComponent (this, &resizeLimits)); | |||||
| resizeLimits.setSizeLimits (150, 150, 800, 300); | |||||
| // set our component's initial size to be the last one that was stored in the filter's settings | |||||
| setSize (ownerFilter->lastUIWidth, | |||||
| ownerFilter->lastUIHeight); | |||||
| // register ourselves with the filter - it will use its ChangeBroadcaster base | |||||
| // class to tell us when something has changed, and this will call our changeListenerCallback() | |||||
| // method. | |||||
| ownerFilter->addChangeListener (this); | |||||
| } | |||||
| DemoEditorComponent::~DemoEditorComponent() | |||||
| { | |||||
| getFilter()->removeChangeListener (this); | |||||
| deleteAllChildren(); | |||||
| } | |||||
| //============================================================================== | |||||
| void DemoEditorComponent::paint (Graphics& g) | |||||
| { | |||||
| // just clear the window | |||||
| g.fillAll (Colour::greyLevel (0.9f)); | |||||
| } | |||||
| void DemoEditorComponent::resized() | |||||
| { | |||||
| gainSlider->setBounds (10, 10, 200, 22); | |||||
| infoLabel->setBounds (10, 35, 450, 20); | |||||
| const int keyboardHeight = 70; | |||||
| midiKeyboard->setBounds (4, getHeight() - keyboardHeight - 4, | |||||
| getWidth() - 8, keyboardHeight); | |||||
| resizer->setBounds (getWidth() - 16, getHeight() - 16, 16, 16); | |||||
| // if we've been resized, tell the filter so that it can store the new size | |||||
| // in its settings | |||||
| getFilter()->lastUIWidth = getWidth(); | |||||
| getFilter()->lastUIHeight = getHeight(); | |||||
| } | |||||
| //============================================================================== | |||||
| void DemoEditorComponent::changeListenerCallback (void* source) | |||||
| { | |||||
| // this is the filter telling us that it's changed, so we'll update our | |||||
| // display of the time, midi message, etc. | |||||
| updateParametersFromFilter(); | |||||
| } | |||||
| void DemoEditorComponent::sliderValueChanged (Slider*) | |||||
| { | |||||
| getFilter()->setParameterNotifyingHost (0, (float) gainSlider->getValue()); | |||||
| } | |||||
| //============================================================================== | |||||
| void DemoEditorComponent::updateParametersFromFilter() | |||||
| { | |||||
| DemoJuceFilter* const filter = getFilter(); | |||||
| // we use this lock to make sure the processBlock() method isn't writing to the | |||||
| // lastMidiMessage variable while we're trying to read it, but be extra-careful to | |||||
| // only hold the lock for a minimum amount of time.. | |||||
| filter->getCallbackLock().enter(); | |||||
| // take a local copy of the info we need while we've got the lock.. | |||||
| const AudioFilterBase::CurrentPositionInfo positionInfo (filter->lastPosInfo); | |||||
| const float newGain = filter->getParameter (0); | |||||
| // ..release the lock ASAP | |||||
| filter->getCallbackLock().exit(); | |||||
| // ..and after releasing the lock, we're free to do the time-consuming UI stuff.. | |||||
| String infoText; | |||||
| infoText << String (positionInfo.bpm, 2) << T(" bpm, ") | |||||
| << positionInfo.timeSigNumerator << T("/") << positionInfo.timeSigDenominator | |||||
| << T(" - ") << timeToTimecodeString (positionInfo.timeInSeconds) | |||||
| << T(" - ") << ppqToBarsBeatsString (positionInfo.ppqPosition, | |||||
| positionInfo.ppqPositionOfLastBarStart, | |||||
| positionInfo.timeSigNumerator, | |||||
| positionInfo.timeSigDenominator); | |||||
| if (positionInfo.isPlaying) | |||||
| infoText << T(" (playing)"); | |||||
| infoLabel->setText (infoText, false); | |||||
| /* Update our slider. | |||||
| (note that it's important here to tell the slider not to send a change | |||||
| message, because that would cause it to call the filter with a parameter | |||||
| change message again, and the values would drift out. | |||||
| */ | |||||
| gainSlider->setValue (newGain, false); | |||||
| setSize (filter->lastUIWidth, | |||||
| filter->lastUIHeight); | |||||
| } | |||||
| @@ -164,7 +164,7 @@ void MidiKeyboardState::processNextMidiBuffer (MidiBuffer& buffer, | |||||
| const bool injectIndirectEvents) | const bool injectIndirectEvents) | ||||
| { | { | ||||
| MidiBuffer::Iterator i (buffer); | MidiBuffer::Iterator i (buffer); | ||||
| MidiMessage message (0, 0.0); | |||||
| MidiMessage message (0xf4, 0.0); | |||||
| int time; | int time; | ||||
| const ScopedLock sl (lock); | const ScopedLock sl (lock); | ||||
| @@ -188,9 +188,29 @@ const KeyPress KeyPress::createFromDescription (const String& desc) | |||||
| if (key == 0) | if (key == 0) | ||||
| { | { | ||||
| // see if it's a numpad key.. | // see if it's a numpad key.. | ||||
| for (int i = 0; i < 10; ++i) | |||||
| if (desc.containsWholeWordIgnoreCase (numberPadPrefix + String (i))) | |||||
| key = numberPad0 + i; | |||||
| if (desc.containsIgnoreCase (numberPadPrefix)) | |||||
| { | |||||
| const tchar lastChar = desc.trimEnd().getLastCharacter(); | |||||
| if (lastChar >= T('0') && lastChar <= T('9')) | |||||
| key = numberPad0 + lastChar - T('0'); | |||||
| else if (lastChar == T('+')) | |||||
| key = numberPadAdd; | |||||
| else if (lastChar == T('-')) | |||||
| key = numberPadSubtract; | |||||
| else if (lastChar == T('*')) | |||||
| key = numberPadMultiply; | |||||
| else if (lastChar == T('/')) | |||||
| key = numberPadDivide; | |||||
| else if (lastChar == T('.')) | |||||
| key = numberPadDecimalPoint; | |||||
| else if (lastChar == T('=')) | |||||
| key = numberPadEquals; | |||||
| else if (desc.endsWith (T("separator"))) | |||||
| key = numberPadSeparator; | |||||
| else if (desc.endsWith (T("delete"))) | |||||
| key = numberPadDelete; | |||||
| } | |||||
| if (key == 0) | if (key == 0) | ||||
| { | { | ||||
| @@ -208,13 +228,9 @@ const KeyPress KeyPress::createFromDescription (const String& desc) | |||||
| .getHexValue32(); | .getHexValue32(); | ||||
| if (hexCode > 0) | if (hexCode > 0) | ||||
| { | |||||
| key = hexCode; | key = hexCode; | ||||
| } | |||||
| else | else | ||||
| { | |||||
| key = CharacterFunctions::toUpperCase (desc.getLastCharacter()); | key = CharacterFunctions::toUpperCase (desc.getLastCharacter()); | ||||
| } | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -257,6 +273,20 @@ const String KeyPress::getTextDescription() const | |||||
| desc << numberPadPrefix << (keyCode - numberPad0); | desc << numberPadPrefix << (keyCode - numberPad0); | ||||
| else if (keyCode >= 33 && keyCode < 176) | else if (keyCode >= 33 && keyCode < 176) | ||||
| desc += CharacterFunctions::toUpperCase ((tchar) keyCode); | desc += CharacterFunctions::toUpperCase ((tchar) keyCode); | ||||
| else if (keyCode == numberPadAdd) | |||||
| desc << numberPadPrefix << '+'; | |||||
| else if (keyCode == numberPadSubtract) | |||||
| desc << numberPadPrefix << '-'; | |||||
| else if (keyCode == numberPadMultiply) | |||||
| desc << numberPadPrefix << '*'; | |||||
| else if (keyCode == numberPadDivide) | |||||
| desc << numberPadPrefix << '/'; | |||||
| else if (keyCode == numberPadSeparator) | |||||
| desc << numberPadPrefix << "separator"; | |||||
| else if (keyCode == numberPadDecimalPoint) | |||||
| desc << numberPadPrefix << '.'; | |||||
| else if (keyCode == numberPadDelete) | |||||
| desc << numberPadPrefix << "delete"; | |||||
| else | else | ||||
| desc << '#' << String::toHexString (keyCode); | desc << '#' << String::toHexString (keyCode); | ||||
| } | } | ||||
| @@ -231,6 +231,8 @@ public: | |||||
| static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */ | static const int numberPadDivide; /**< key-code for the divide sign on the numeric keypad. */ | ||||
| static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */ | static const int numberPadSeparator; /**< key-code for the comma on the numeric keypad. */ | ||||
| static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */ | static const int numberPadDecimalPoint; /**< key-code for the decimal point sign on the numeric keypad. */ | ||||
| static const int numberPadEquals; /**< key-code for the equals key on the numeric keypad. */ | |||||
| static const int numberPadDelete; /**< key-code for the delete key on the numeric keypad. */ | |||||
| static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */ | static const int playKey; /**< key-code for a multimedia 'play' key, (not all keyboards will have one) */ | ||||
| static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */ | static const int stopKey; /**< key-code for a multimedia 'stop' key, (not all keyboards will have one) */ | ||||
| @@ -36,32 +36,6 @@ BEGIN_JUCE_NAMESPACE | |||||
| #include "juce_ModifierKeys.h" | #include "juce_ModifierKeys.h" | ||||
| //============================================================================== | |||||
| const int ModifierKeys::shiftModifier = 1; | |||||
| const int ModifierKeys::ctrlModifier = 2; | |||||
| const int ModifierKeys::altModifier = 4; | |||||
| const int ModifierKeys::leftButtonModifier = 16; | |||||
| const int ModifierKeys::rightButtonModifier = 32; | |||||
| const int ModifierKeys::middleButtonModifier = 64; | |||||
| #if JUCE_MAC | |||||
| const int ModifierKeys::commandModifier = 8; | |||||
| const int ModifierKeys::popupMenuClickModifier = ModifierKeys::rightButtonModifier | |||||
| | ModifierKeys::ctrlModifier; | |||||
| #else | |||||
| const int ModifierKeys::commandModifier = ModifierKeys::ctrlModifier; | |||||
| const int ModifierKeys::popupMenuClickModifier = ModifierKeys::rightButtonModifier; | |||||
| #endif | |||||
| const int ModifierKeys::allKeyboardModifiers = ModifierKeys::shiftModifier | |||||
| | ModifierKeys::ctrlModifier | |||||
| | ModifierKeys::altModifier | |||||
| | ModifierKeys::commandModifier; | |||||
| const int ModifierKeys::allMouseButtonModifiers = ModifierKeys::leftButtonModifier | |||||
| | ModifierKeys::rightButtonModifier | |||||
| | ModifierKeys::middleButtonModifier; | |||||
| //============================================================================== | //============================================================================== | ||||
| ModifierKeys::ModifierKeys (const int flags_) throw() | ModifierKeys::ModifierKeys (const int flags_) throw() | ||||
| : flags (flags_) | : flags (flags_) | ||||
| @@ -113,39 +113,57 @@ public: | |||||
| inline bool isAltDown() const throw() { return (flags & altModifier) != 0; } | inline bool isAltDown() const throw() { return (flags & altModifier) != 0; } | ||||
| //============================================================================== | //============================================================================== | ||||
| // modifier bitmasks | |||||
| /** Shift key flag. */ | |||||
| static const int shiftModifier; | |||||
| /** CTRL key flag. */ | |||||
| static const int ctrlModifier; | |||||
| /** ALT key flag. */ | |||||
| static const int altModifier; | |||||
| /** Left mouse button flag. */ | |||||
| static const int leftButtonModifier; | |||||
| /** Right mouse button flag. */ | |||||
| static const int rightButtonModifier; | |||||
| /** Middle mouse button flag. */ | |||||
| static const int middleButtonModifier; | |||||
| /** Command key flag - on windows this is the same as the CTRL key flag. */ | |||||
| static const int commandModifier; | |||||
| /** Popup menu flag - on windows this is the same as rightButtonModifier, on the | |||||
| Mac it's the same as (rightButtonModifier | ctrlModifier). */ | |||||
| static const int popupMenuClickModifier; | |||||
| /** Represents a combination of all the shift, alt, ctrl and command key modifiers. */ | |||||
| static const int allKeyboardModifiers; | |||||
| /** Represents a combination of all the mouse buttons at once. */ | |||||
| static const int allMouseButtonModifiers; | |||||
| /** Flags that represent the different keys. */ | |||||
| enum Flags | |||||
| { | |||||
| /** Shift key flag. */ | |||||
| shiftModifier = 1, | |||||
| /** CTRL key flag. */ | |||||
| ctrlModifier = 2, | |||||
| /** ALT key flag. */ | |||||
| altModifier = 4, | |||||
| /** Left mouse button flag. */ | |||||
| leftButtonModifier = 16, | |||||
| /** Right mouse button flag. */ | |||||
| rightButtonModifier = 32, | |||||
| /** Middle mouse button flag. */ | |||||
| middleButtonModifier = 64, | |||||
| #if JUCE_MAC | |||||
| /** Command key flag - on windows this is the same as the CTRL key flag. */ | |||||
| commandModifier = 8, | |||||
| /** Popup menu flag - on windows this is the same as rightButtonModifier, on the | |||||
| Mac it's the same as (rightButtonModifier | ctrlModifier). */ | |||||
| popupMenuClickModifier = rightButtonModifier | ctrlModifier, | |||||
| #else | |||||
| /** Command key flag - on windows this is the same as the CTRL key flag. */ | |||||
| commandModifier = ctrlModifier, | |||||
| /** Popup menu flag - on windows this is the same as rightButtonModifier, on the | |||||
| Mac it's the same as (rightButtonModifier | ctrlModifier). */ | |||||
| popupMenuClickModifier = rightButtonModifier, | |||||
| #endif | |||||
| /** Represents a combination of all the shift, alt, ctrl and command key modifiers. */ | |||||
| allKeyboardModifiers = shiftModifier | ctrlModifier | altModifier | commandModifier, | |||||
| /** Represents a combination of all the mouse buttons at once. */ | |||||
| allMouseButtonModifiers = leftButtonModifier | rightButtonModifier | middleButtonModifier, | |||||
| }; | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns the raw flags for direct testing. */ | /** Returns the raw flags for direct testing. */ | ||||
| inline int getRawFlags() const throw() { return flags; } | |||||
| inline int getRawFlags() const throw() { return flags; } | |||||
| /** Tests a combination of flags and returns true if any of them are set. */ | /** Tests a combination of flags and returns true if any of them are set. */ | ||||
| inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; } | |||||
| inline bool testFlags (const int flagsToTest) const throw() { return (flags & flagsToTest) != 0; } | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Creates a ModifierKeys object to represent the last-known state of the | /** Creates a ModifierKeys object to represent the last-known state of the | ||||
| @@ -165,7 +183,7 @@ public: | |||||
| This is only needed in special circumstances for up-to-date modifier information | This is only needed in special circumstances for up-to-date modifier information | ||||
| at times when the app's event loop isn't running normally. | at times when the app's event loop isn't running normally. | ||||
| */ | */ | ||||
| static const ModifierKeys getCurrentModifiersRealtime(); | |||||
| static const ModifierKeys getCurrentModifiersRealtime() throw(); | |||||
| private: | private: | ||||
| @@ -48,7 +48,7 @@ XmlInputSource::~XmlInputSource() | |||||
| //============================================================================== | //============================================================================== | ||||
| static bool isXmlIdentifierChar_Slow (const tchar c) | |||||
| static bool isXmlIdentifierChar_Slow (const tchar c) throw() | |||||
| { | { | ||||
| return CharacterFunctions::isLetterOrDigit (c) | return CharacterFunctions::isLetterOrDigit (c) | ||||
| || c == T('_') | || c == T('_') | ||||
| @@ -40,7 +40,7 @@ BEGIN_JUCE_NAMESPACE | |||||
| //============================================================================== | //============================================================================== | ||||
| XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) | |||||
| XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) throw() | |||||
| : name (other.name), | : name (other.name), | ||||
| value (other.value), | value (other.value), | ||||
| next (0) | next (0) | ||||
| @@ -48,7 +48,7 @@ XmlElement::XmlAttributeNode::XmlAttributeNode (const XmlAttributeNode& other) | |||||
| } | } | ||||
| XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, | XmlElement::XmlAttributeNode::XmlAttributeNode (const String& name_, | ||||
| const String& value_) | |||||
| const String& value_) throw() | |||||
| : name (name_), | : name (name_), | ||||
| value (value_), | value (value_), | ||||
| next (0) | next (0) | ||||
| @@ -1057,7 +1057,7 @@ XmlElement* XmlElement::findParentElementOf (const XmlElement* const elementToLo | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| XmlElement** XmlElement::getChildElementsAsArray (const int num) const | |||||
| XmlElement** XmlElement::getChildElementsAsArray (const int num) const throw() | |||||
| { | { | ||||
| XmlElement** const elems = new XmlElement* [num]; | XmlElement** const elems = new XmlElement* [num]; | ||||
| @@ -1073,7 +1073,7 @@ XmlElement** XmlElement::getChildElementsAsArray (const int num) const | |||||
| return elems; | return elems; | ||||
| } | } | ||||
| void XmlElement::reorderChildElements (XmlElement** const elems, const int num) | |||||
| void XmlElement::reorderChildElements (XmlElement** const elems, const int num) throw() | |||||
| { | { | ||||
| XmlElement* e = firstChildElement = elems[0]; | XmlElement* e = firstChildElement = elems[0]; | ||||
| @@ -657,8 +657,8 @@ private: | |||||
| struct XmlAttributeNode | struct XmlAttributeNode | ||||
| { | { | ||||
| XmlAttributeNode (const XmlAttributeNode& other); | |||||
| XmlAttributeNode (const String& name, const String& value); | |||||
| XmlAttributeNode (const XmlAttributeNode& other) throw(); | |||||
| XmlAttributeNode (const String& name, const String& value) throw(); | |||||
| String name, value; | String name, value; | ||||
| XmlAttributeNode* next; | XmlAttributeNode* next; | ||||
| @@ -673,8 +673,8 @@ private: | |||||
| void writeElementAsText (OutputStream& out, const int indentationLevel) const throw(); | void writeElementAsText (OutputStream& out, const int indentationLevel) const throw(); | ||||
| XmlElement** getChildElementsAsArray (const int) const; | |||||
| void reorderChildElements (XmlElement** const, const int); | |||||
| XmlElement** getChildElementsAsArray (const int) const throw(); | |||||
| void reorderChildElements (XmlElement** const, const int) throw(); | |||||
| }; | }; | ||||
| @@ -50,7 +50,7 @@ static VoidArray runningThreads (4); | |||||
| static CriticalSection runningThreadsLock; | static CriticalSection runningThreadsLock; | ||||
| //============================================================================== | //============================================================================== | ||||
| void Thread::threadEntryPoint (Thread* thread) | |||||
| void Thread::threadEntryPoint (Thread* const thread) throw() | |||||
| { | { | ||||
| runningThreadsLock.enter(); | runningThreadsLock.enter(); | ||||
| runningThreads.add (thread); | runningThreads.add (thread); | ||||
| @@ -106,7 +106,7 @@ Thread::~Thread() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void Thread::startThread() | |||||
| void Thread::startThread() throw() | |||||
| { | { | ||||
| const ScopedLock sl (startStopLock); | const ScopedLock sl (startStopLock); | ||||
| @@ -120,7 +120,7 @@ void Thread::startThread() | |||||
| } | } | ||||
| } | } | ||||
| void Thread::startThread (const int priority) | |||||
| void Thread::startThread (const int priority) throw() | |||||
| { | { | ||||
| const ScopedLock sl (startStopLock); | const ScopedLock sl (startStopLock); | ||||
| @@ -146,7 +146,7 @@ void Thread::signalThreadShouldExit() throw() | |||||
| threadShouldExit_ = true; | threadShouldExit_ = true; | ||||
| } | } | ||||
| bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const | |||||
| bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const throw() | |||||
| { | { | ||||
| // Doh! So how exactly do you expect this thread to wait for itself to stop?? | // Doh! So how exactly do you expect this thread to wait for itself to stop?? | ||||
| jassert (getThreadId() != getCurrentThreadId()); | jassert (getThreadId() != getCurrentThreadId()); | ||||
| @@ -165,7 +165,7 @@ bool Thread::waitForThreadToExit (const int timeOutMilliseconds) const | |||||
| return true; | return true; | ||||
| } | } | ||||
| void Thread::stopThread (const int timeOutMilliseconds) | |||||
| void Thread::stopThread (const int timeOutMilliseconds) throw() | |||||
| { | { | ||||
| const ScopedLock sl (startStopLock); | const ScopedLock sl (startStopLock); | ||||
| @@ -196,7 +196,7 @@ void Thread::stopThread (const int timeOutMilliseconds) | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| void Thread::setPriority (const int priority) | |||||
| void Thread::setPriority (const int priority) throw() | |||||
| { | { | ||||
| const ScopedLock sl (startStopLock); | const ScopedLock sl (startStopLock); | ||||
| @@ -204,12 +204,12 @@ void Thread::setPriority (const int priority) | |||||
| juce_setThreadPriority (threadHandle_, priority); | juce_setThreadPriority (threadHandle_, priority); | ||||
| } | } | ||||
| void Thread::setCurrentThreadPriority (const int priority) | |||||
| void Thread::setCurrentThreadPriority (const int priority) throw() | |||||
| { | { | ||||
| juce_setThreadPriority (0, priority); | juce_setThreadPriority (0, priority); | ||||
| } | } | ||||
| void Thread::setAffinityMask (const uint32 affinityMask) | |||||
| void Thread::setAffinityMask (const uint32 affinityMask) throw() | |||||
| { | { | ||||
| affinityMask_ = affinityMask; | affinityMask_ = affinityMask; | ||||
| } | } | ||||
| @@ -231,12 +231,12 @@ void Thread::notify() const throw() | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| int Thread::getNumRunningThreads() | |||||
| int Thread::getNumRunningThreads() throw() | |||||
| { | { | ||||
| return runningThreads.size(); | return runningThreads.size(); | ||||
| } | } | ||||
| void Thread::stopAllThreads (const int timeoutInMillisecs) | |||||
| void Thread::stopAllThreads (const int timeoutInMillisecs) throw() | |||||
| { | { | ||||
| while (getNumRunningThreads() > 0) | while (getNumRunningThreads() > 0) | ||||
| { | { | ||||
| @@ -92,7 +92,7 @@ public: | |||||
| @see stopThread | @see stopThread | ||||
| */ | */ | ||||
| void startThread(); | |||||
| void startThread() throw(); | |||||
| /** Starts the thread with a given priority. | /** Starts the thread with a given priority. | ||||
| @@ -101,7 +101,7 @@ public: | |||||
| @see startThread, setPriority | @see startThread, setPriority | ||||
| */ | */ | ||||
| void startThread (const int priority); | |||||
| void startThread (const int priority) throw(); | |||||
| /** Attempts to stop the thread running. | /** Attempts to stop the thread running. | ||||
| @@ -121,7 +121,7 @@ public: | |||||
| value in here will wait forever. | value in here will wait forever. | ||||
| @see signalThreadShouldExit, threadShouldExit, waitForThreadToExit, isThreadRunning | @see signalThreadShouldExit, threadShouldExit, waitForThreadToExit, isThreadRunning | ||||
| */ | */ | ||||
| void stopThread (const int timeOutMilliseconds); | |||||
| void stopThread (const int timeOutMilliseconds) throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Returns true if the thread is currently active */ | /** Returns true if the thread is currently active */ | ||||
| @@ -154,7 +154,7 @@ public: | |||||
| is less than zero, it will wait forever. | is less than zero, it will wait forever. | ||||
| @returns true if the thread exits, or false if the timeout expires first. | @returns true if the thread exits, or false if the timeout expires first. | ||||
| */ | */ | ||||
| bool waitForThreadToExit (const int timeOutMilliseconds) const; | |||||
| bool waitForThreadToExit (const int timeOutMilliseconds) const throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Changes the thread's priority. | /** Changes the thread's priority. | ||||
| @@ -162,7 +162,7 @@ public: | |||||
| @param priority the new priority, in the range 0 (lowest) to 10 (highest). A priority | @param priority the new priority, in the range 0 (lowest) to 10 (highest). A priority | ||||
| of 5 is normal. | of 5 is normal. | ||||
| */ | */ | ||||
| void setPriority (const int priority); | |||||
| void setPriority (const int priority) throw(); | |||||
| /** Changes the priority of the caller thread. | /** Changes the priority of the caller thread. | ||||
| @@ -170,7 +170,7 @@ public: | |||||
| @see setPriority | @see setPriority | ||||
| */ | */ | ||||
| static void setCurrentThreadPriority (const int priority); | |||||
| static void setCurrentThreadPriority (const int priority) throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Sets the affinity mask for the thread. | /** Sets the affinity mask for the thread. | ||||
| @@ -180,7 +180,7 @@ public: | |||||
| @see setCurrentThreadAffinityMask | @see setCurrentThreadAffinityMask | ||||
| */ | */ | ||||
| void setAffinityMask (const uint32 affinityMask); | |||||
| void setAffinityMask (const uint32 affinityMask) throw(); | |||||
| /** Changes the affinity mask for the caller thread. | /** Changes the affinity mask for the caller thread. | ||||
| @@ -188,7 +188,7 @@ public: | |||||
| @see setAffinityMask | @see setAffinityMask | ||||
| */ | */ | ||||
| static void setCurrentThreadAffinityMask (const uint32 affinityMask); | |||||
| static void setCurrentThreadAffinityMask (const uint32 affinityMask) throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| // this can be called from any thread that needs to pause.. | // this can be called from any thread that needs to pause.. | ||||
| @@ -248,13 +248,13 @@ public: | |||||
| @returns the number of Thread objects known to be currently running. | @returns the number of Thread objects known to be currently running. | ||||
| @see stopAllThreads | @see stopAllThreads | ||||
| */ | */ | ||||
| static int getNumRunningThreads(); | |||||
| static int getNumRunningThreads() throw(); | |||||
| /** Tries to stop all currently-running threads. | /** Tries to stop all currently-running threads. | ||||
| This will attempt to stop all the threads known to be running at the moment. | This will attempt to stop all the threads known to be running at the moment. | ||||
| */ | */ | ||||
| static void stopAllThreads (const int timeoutInMillisecs); | |||||
| static void stopAllThreads (const int timeoutInMillisecs) throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| @@ -271,7 +271,7 @@ private: | |||||
| bool volatile threadShouldExit_; | bool volatile threadShouldExit_; | ||||
| friend void JUCE_API juce_threadEntryPoint (void*); | friend void JUCE_API juce_threadEntryPoint (void*); | ||||
| static void threadEntryPoint (Thread* thread); | |||||
| static void threadEntryPoint (Thread* thread) throw(); | |||||
| Thread (const Thread&); | Thread (const Thread&); | ||||
| const Thread& operator= (const Thread&); | const Thread& operator= (const Thread&); | ||||