Browse Source

Added a few methods to Range, and used Ranges internally in Slider. Cleaned up a few files.

tags/2021-05-28
Julian Storer 16 years ago
parent
commit
8532475b9c
29 changed files with 379 additions and 306 deletions
  1. +2
    -2
      extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.h
  2. +92
    -94
      juce_amalgamated.cpp
  3. +77
    -53
      juce_amalgamated.h
  4. +33
    -0
      src/containers/juce_Range.h
  5. +2
    -2
      src/gui/components/filebrowser/juce_DirectoryContentsDisplayComponent.cpp
  6. +3
    -6
      src/gui/components/filebrowser/juce_DirectoryContentsDisplayComponent.h
  7. +2
    -2
      src/gui/components/filebrowser/juce_FileBrowserComponent.cpp
  8. +2
    -2
      src/gui/components/filebrowser/juce_FileBrowserComponent.h
  9. +3
    -3
      src/gui/components/filebrowser/juce_FileSearchPathListComponent.cpp
  10. +3
    -3
      src/gui/components/filebrowser/juce_FileSearchPathListComponent.h
  11. +5
    -5
      src/gui/components/filebrowser/juce_FileTreeComponent.cpp
  12. +1
    -1
      src/gui/components/filebrowser/juce_FileTreeComponent.h
  13. +3
    -3
      src/gui/components/filebrowser/juce_FilenameComponent.cpp
  14. +3
    -3
      src/gui/components/filebrowser/juce_FilenameComponent.h
  15. +2
    -2
      src/gui/components/filebrowser/juce_WildcardFileFilter.cpp
  16. +2
    -2
      src/gui/components/filebrowser/juce_WildcardFileFilter.h
  17. +3
    -3
      src/gui/components/keyboard/juce_KeyPress.cpp
  18. +4
    -4
      src/gui/components/keyboard/juce_KeyPress.h
  19. +11
    -13
      src/gui/components/keyboard/juce_KeyPressMappingSet.cpp
  20. +11
    -13
      src/gui/components/keyboard/juce_KeyPressMappingSet.h
  21. +2
    -2
      src/gui/components/keyboard/juce_KeyboardFocusTraverser.cpp
  22. +2
    -2
      src/gui/components/layout/juce_GroupComponent.cpp
  23. +2
    -2
      src/gui/components/layout/juce_GroupComponent.h
  24. +53
    -53
      src/gui/components/layout/juce_ScrollBar.cpp
  25. +52
    -27
      src/gui/components/layout/juce_ScrollBar.h
  26. +1
    -1
      src/native/linux/juce_linux_Windowing.cpp
  27. +1
    -1
      src/native/mac/juce_iphone_UIViewComponentPeer.mm
  28. +1
    -1
      src/native/mac/juce_mac_NSViewComponentPeer.mm
  29. +1
    -1
      src/native/windows/juce_win32_Windowing.cpp

+ 2
- 2
extras/Jucer (experimental)/Source/ui/Component Editor/jucer_ComponentEditor.h View File

@@ -38,7 +38,7 @@ class ComponentEditor : public DocumentEditorComponent
public:
//==============================================================================
ComponentEditor (OpenDocumentManager::Document* document,
Project* project,
Project* project,
ComponentDocument* componentDocument);
~ComponentEditor();
@@ -46,7 +46,7 @@ public:
//==============================================================================
void paint (Graphics& g);
void resized();
ComponentDocument& getDocument() const { return *componentDocument; }
private:


+ 92
- 94
juce_amalgamated.cpp View File

@@ -56153,12 +56153,12 @@ FileBrowserListener::~FileBrowserListener()
{
}

void DirectoryContentsDisplayComponent::addListener (FileBrowserListener* const listener) throw()
void DirectoryContentsDisplayComponent::addListener (FileBrowserListener* const listener)
{
listeners.add (listener);
}

void DirectoryContentsDisplayComponent::removeListener (FileBrowserListener* const listener) throw()
void DirectoryContentsDisplayComponent::removeListener (FileBrowserListener* const listener)
{
listeners.remove (listener);
}
@@ -56577,12 +56577,12 @@ FileBrowserComponent::~FileBrowserComponent()
thread.stopThread (10000);
}

void FileBrowserComponent::addListener (FileBrowserListener* const newListener) throw()
void FileBrowserComponent::addListener (FileBrowserListener* const newListener)
{
listeners.add (newListener);
}

void FileBrowserComponent::removeListener (FileBrowserListener* const listener) throw()
void FileBrowserComponent::removeListener (FileBrowserListener* const listener)
{
listeners.remove (listener);
}
@@ -57582,7 +57582,7 @@ void FilenameComponent::setTooltip (const String& newTooltip)
filenameBox->setTooltip (newTooltip);
}

void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory) throw()
void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory)
{
defaultBrowseFile = newDefaultDirectory;
}
@@ -57712,12 +57712,12 @@ void FilenameComponent::addRecentlyUsedFile (const File& file)
}
}

void FilenameComponent::addListener (FilenameComponentListener* const listener) throw()
void FilenameComponent::addListener (FilenameComponentListener* const listener)
{
listeners.add (listener);
}

void FilenameComponent::removeListener (FilenameComponentListener* const listener) throw()
void FilenameComponent::removeListener (FilenameComponentListener* const listener)
{
listeners.remove (listener);
}
@@ -57787,7 +57787,7 @@ FileSearchPathListComponent::~FileSearchPathListComponent()
deleteAllChildren();
}

void FileSearchPathListComponent::updateButtons() throw()
void FileSearchPathListComponent::updateButtons()
{
const bool anythingSelected = listBox->getNumSelectedRows() > 0;

@@ -57797,7 +57797,7 @@ void FileSearchPathListComponent::updateButtons() throw()
downButton->setEnabled (anythingSelected);
}

void FileSearchPathListComponent::changed() throw()
void FileSearchPathListComponent::changed()
{
listBox->updateContent();
listBox->repaint();
@@ -57813,7 +57813,7 @@ void FileSearchPathListComponent::setPath (const FileSearchPath& newPath)
}
}

void FileSearchPathListComponent::setDefaultBrowseTarget (const File& newDefaultDirectory) throw()
void FileSearchPathListComponent::setDefaultBrowseTarget (const File& newDefaultDirectory)
{
defaultBrowseTarget = newDefaultDirectory;
}
@@ -57985,7 +57985,7 @@ public:
DirectoryContentsList* const parentContentsList_,
const int indexInContentsList_,
const File& file_,
TimeSliceThread& thread_) throw()
TimeSliceThread& thread_)
: file (file_),
owner (owner_),
parentContentsList (parentContentsList_),
@@ -58010,7 +58010,7 @@ public:
}
}

~FileListTreeItem() throw()
~FileListTreeItem()
{
thread.removeTimeSliceClient (this);

@@ -58053,7 +58053,7 @@ public:
}
}

void setSubContentsList (DirectoryContentsList* newList) throw()
void setSubContentsList (DirectoryContentsList* newList)
{
jassert (subContentsList == 0);
subContentsList = newList;
@@ -58139,7 +58139,7 @@ private:
String fileSize;
String modTime;

void updateIcon (const bool onlyUpdateIfCached) throw()
void updateIcon (const bool onlyUpdateIfCached)
{
if (icon == 0)
{
@@ -58195,7 +58195,7 @@ void FileTreeComponent::scrollToTop()
getViewport()->getVerticalScrollBar()->setCurrentRangeStart (0);
}

void FileTreeComponent::setDragAndDropDescription (const String& description) throw()
void FileTreeComponent::setDragAndDropDescription (const String& description)
{
dragAndDropDescription = description;
}
@@ -58330,7 +58330,7 @@ bool WildcardFileFilter::isDirectorySuitable (const File& file) const
return match (file, directoryWildcards);
}

void WildcardFileFilter::parse (const String& pattern, StringArray& result) throw()
void WildcardFileFilter::parse (const String& pattern, StringArray& result)
{
result.addTokens (pattern.toLowerCase(), ";,", "\"'");

@@ -58344,7 +58344,7 @@ void WildcardFileFilter::parse (const String& pattern, StringArray& result) thro
result.set (i, "*");
}

bool WildcardFileFilter::match (const File& file, const StringArray& wildcards) throw()
bool WildcardFileFilter::match (const File& file, const StringArray& wildcards)
{
const String filename (file.getFileName());

@@ -58379,7 +58379,7 @@ namespace KeyboardFocusHelpers
public:
ScreenPositionComparator() {}

static int compareElements (const Component* const first, const Component* const second) throw()
static int compareElements (const Component* const first, const Component* const second)
{
int explicitOrder1 = first->getExplicitFocusOrder();
if (explicitOrder1 <= 0)
@@ -58429,7 +58429,7 @@ namespace KeyboardFocusHelpers
}
}

static Component* getIncrementedComponent (Component* const current, const int delta) throw()
static Component* getIncrementedComponent (Component* const current, const int delta)
{
Component* focusContainer = current->getParentComponent();

@@ -59032,7 +59032,7 @@ bool KeyPress::operator!= (const KeyPress& other) const throw()
return ! operator== (other);
}

bool KeyPress::isCurrentlyDown() const throw()
bool KeyPress::isCurrentlyDown() const
{
return isKeyCurrentlyDown (keyCode)
&& (ModifierKeys::getCurrentModifiers().getRawFlags() & ModifierKeys::allKeyboardModifiers)
@@ -59073,7 +59073,7 @@ namespace KeyPressHelpers
static const String numberPadPrefix() { return "numpad "; }
}

const KeyPress KeyPress::createFromDescription (const String& desc) throw()
const KeyPress KeyPress::createFromDescription (const String& desc)
{
int modifiers = 0;

@@ -59158,7 +59158,7 @@ const KeyPress KeyPress::createFromDescription (const String& desc) throw()
return KeyPress (key, ModifierKeys (modifiers), 0);
}

const String KeyPress::getTextDescription() const throw()
const String KeyPress::getTextDescription() const
{
String desc;

@@ -59226,7 +59226,7 @@ END_JUCE_NAMESPACE
/*** Start of inlined file: juce_KeyPressMappingSet.cpp ***/
BEGIN_JUCE_NAMESPACE

KeyPressMappingSet::KeyPressMappingSet (ApplicationCommandManager* const commandManager_) throw()
KeyPressMappingSet::KeyPressMappingSet (ApplicationCommandManager* const commandManager_)
: commandManager (commandManager_)
{
// A manager is needed to get the descriptions of commands, and will be called when
@@ -59236,7 +59236,7 @@ KeyPressMappingSet::KeyPressMappingSet (ApplicationCommandManager* const command
Desktop::getInstance().addFocusChangeListener (this);
}

KeyPressMappingSet::KeyPressMappingSet (const KeyPressMappingSet& other) throw()
KeyPressMappingSet::KeyPressMappingSet (const KeyPressMappingSet& other)
: commandManager (other.commandManager)
{
Desktop::getInstance().addFocusChangeListener (this);
@@ -59247,7 +59247,7 @@ KeyPressMappingSet::~KeyPressMappingSet()
Desktop::getInstance().removeFocusChangeListener (this);
}

const Array <KeyPress> KeyPressMappingSet::getKeyPressesAssignedToCommand (const CommandID commandID) const throw()
const Array <KeyPress> KeyPressMappingSet::getKeyPressesAssignedToCommand (const CommandID commandID) const
{
for (int i = 0; i < mappings.size(); ++i)
if (mappings.getUnchecked(i)->commandID == commandID)
@@ -59258,7 +59258,7 @@ const Array <KeyPress> KeyPressMappingSet::getKeyPressesAssignedToCommand (const

void KeyPressMappingSet::addKeyPress (const CommandID commandID,
const KeyPress& newKeyPress,
int insertIndex) throw()
int insertIndex)
{
// If you specify an upper-case letter but no shift key, how is the user supposed to press it!?
// Stick to lower-case letters when defining a keypress, to avoid ambiguity.
@@ -59298,7 +59298,7 @@ void KeyPressMappingSet::addKeyPress (const CommandID commandID,
}
}

void KeyPressMappingSet::resetToDefaultMappings() throw()
void KeyPressMappingSet::resetToDefaultMappings()
{
mappings.clear();

@@ -59316,7 +59316,7 @@ void KeyPressMappingSet::resetToDefaultMappings() throw()
sendChangeMessage (this);
}

void KeyPressMappingSet::resetToDefaultMapping (const CommandID commandID) throw()
void KeyPressMappingSet::resetToDefaultMapping (const CommandID commandID)
{
clearAllKeyPresses (commandID);

@@ -59329,7 +59329,7 @@ void KeyPressMappingSet::resetToDefaultMapping (const CommandID commandID) throw
}
}

void KeyPressMappingSet::clearAllKeyPresses() throw()
void KeyPressMappingSet::clearAllKeyPresses()
{
if (mappings.size() > 0)
{
@@ -59338,7 +59338,7 @@ void KeyPressMappingSet::clearAllKeyPresses() throw()
}
}

void KeyPressMappingSet::clearAllKeyPresses (const CommandID commandID) throw()
void KeyPressMappingSet::clearAllKeyPresses (const CommandID commandID)
{
for (int i = mappings.size(); --i >= 0;)
{
@@ -59350,7 +59350,7 @@ void KeyPressMappingSet::clearAllKeyPresses (const CommandID commandID) throw()
}
}

void KeyPressMappingSet::removeKeyPress (const KeyPress& keypress) throw()
void KeyPressMappingSet::removeKeyPress (const KeyPress& keypress)
{
if (keypress.isValid())
{
@@ -59370,8 +59370,7 @@ void KeyPressMappingSet::removeKeyPress (const KeyPress& keypress) throw()
}
}

void KeyPressMappingSet::removeKeyPress (const CommandID commandID,
const int keyPressIndex) throw()
void KeyPressMappingSet::removeKeyPress (const CommandID commandID, const int keyPressIndex)
{
for (int i = mappings.size(); --i >= 0;)
{
@@ -59393,8 +59392,7 @@ CommandID KeyPressMappingSet::findCommandForKeyPress (const KeyPress& keyPress)
return 0;
}

bool KeyPressMappingSet::containsMapping (const CommandID commandID,
const KeyPress& keyPress) const throw()
bool KeyPressMappingSet::containsMapping (const CommandID commandID, const KeyPress& keyPress) const throw()
{
for (int i = mappings.size(); --i >= 0;)
if (mappings.getUnchecked(i)->commandID == commandID)
@@ -60308,7 +60306,7 @@ GroupComponent::~GroupComponent()
{
}

void GroupComponent::setText (const String& newText) throw()
void GroupComponent::setText (const String& newText)
{
if (text != newText)
{
@@ -60317,7 +60315,7 @@ void GroupComponent::setText (const String& newText) throw()
}
}

const String GroupComponent::getText() const throw()
const String GroupComponent::getText() const
{
return text;
}
@@ -61112,8 +61110,7 @@ class ScrollbarButton : public Button
public:
int direction;

ScrollbarButton (const int direction_,
ScrollBar& owner_) throw()
ScrollbarButton (const int direction_, ScrollBar& owner_)
: Button (String::empty),
direction (direction_),
owner (owner_)
@@ -61125,9 +61122,7 @@ public:
{
}

void paintButton (Graphics& g,
bool isMouseOver,
bool isMouseDown)
void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown)
{
getLookAndFeel()
.drawScrollbarButton (g, owner,
@@ -61153,10 +61148,8 @@ private:

ScrollBar::ScrollBar (const bool vertical_,
const bool buttonsAreVisible)
: minimum (0.0),
maximum (1.0),
rangeStart (0.0),
rangeSize (0.1),
: totalRange (0.0, 1.0),
visibleRange (0.0, 0.1),
singleStepSize (0.1),
thumbAreaStart (0),
thumbAreaSize (0),
@@ -61182,68 +61175,73 @@ ScrollBar::~ScrollBar()
deleteAllChildren();
}

void ScrollBar::setRangeLimits (const double newMinimum,
const double newMaximum) throw()
void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit)
{
minimum = newMinimum;
maximum = newMaximum;

jassert (maximum >= minimum); // these can't be the wrong way round!
if (totalRange != newRangeLimit)
{
totalRange = newRangeLimit;
setCurrentRange (visibleRange);
updateThumbPosition();
}
}

setCurrentRangeStart (rangeStart);
updateThumbPosition();
void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum)
{
jassert (newMaximum >= newMinimum); // these can't be the wrong way round!
setRangeLimits (Range<double> (newMinimum, newMaximum));
}

void ScrollBar::setCurrentRange (double newStart,
double newSize) throw()
void ScrollBar::setCurrentRange (const Range<double>& newRange)
{
newSize = jlimit (0.0, maximum - minimum, newSize);
newStart = jlimit (minimum, maximum - newSize, newStart);
const Range<double> constrainedRange (totalRange.constrainRange (newRange));

if (rangeStart != newStart
|| rangeSize != newSize)
if (visibleRange != constrainedRange)
{
rangeStart = newStart;
rangeSize = newSize;
visibleRange = constrainedRange;

updateThumbPosition();
triggerAsyncUpdate();
}
}

void ScrollBar::setCurrentRangeStart (double newStart) throw()
void ScrollBar::setCurrentRange (const double newStart, const double newSize)
{
setCurrentRange (Range<double> (newStart, newStart + newSize));
}

void ScrollBar::setCurrentRangeStart (const double newStart)
{
setCurrentRange (newStart, rangeSize);
setCurrentRange (visibleRange.movedToStartAt (newStart));
}

void ScrollBar::setSingleStepSize (const double newSingleStepSize) throw()
void ScrollBar::setSingleStepSize (const double newSingleStepSize)
{
singleStepSize = newSingleStepSize;
}

void ScrollBar::moveScrollbarInSteps (const int howManySteps) throw()
void ScrollBar::moveScrollbarInSteps (const int howManySteps)
{
setCurrentRangeStart (rangeStart + howManySteps * singleStepSize);
setCurrentRange (visibleRange + howManySteps * singleStepSize);
}

void ScrollBar::moveScrollbarInPages (const int howManyPages) throw()
void ScrollBar::moveScrollbarInPages (const int howManyPages)
{
setCurrentRangeStart (rangeStart + howManyPages * rangeSize);
setCurrentRange (visibleRange + howManyPages * visibleRange.getLength());
}

void ScrollBar::scrollToTop() throw()
void ScrollBar::scrollToTop()
{
setCurrentRangeStart (minimum);
setCurrentRange (visibleRange.movedToStartAt (getMinimumRangeLimit()));
}

void ScrollBar::scrollToBottom() throw()
void ScrollBar::scrollToBottom()
{
setCurrentRangeStart (maximum - rangeSize);
setCurrentRange (visibleRange.movedToEndAt (getMaximumRangeLimit()));
}

void ScrollBar::setButtonRepeatSpeed (const int initialDelayInMillisecs_,
const int repeatDelayInMillisecs_,
const int minimumDelayInMillisecs_) throw()
const int minimumDelayInMillisecs_)
{
initialDelayInMillisecs = initialDelayInMillisecs_;
repeatDelayInMillisecs = repeatDelayInMillisecs_;
@@ -61256,25 +61254,25 @@ void ScrollBar::setButtonRepeatSpeed (const int initialDelayInMillisecs_,
}
}

void ScrollBar::addListener (ScrollBarListener* const listener) throw()
void ScrollBar::addListener (ScrollBarListener* const listener)
{
listeners.add (listener);
}

void ScrollBar::removeListener (ScrollBarListener* const listener) throw()
void ScrollBar::removeListener (ScrollBarListener* const listener)
{
listeners.remove (listener);
}

void ScrollBar::handleAsyncUpdate()
{
listeners.call (&ScrollBarListener::scrollBarMoved, this, rangeStart);
listeners.call (&ScrollBarListener::scrollBarMoved, this, visibleRange.getStart());
}

void ScrollBar::updateThumbPosition() throw()
void ScrollBar::updateThumbPosition()
{
int newThumbSize = roundToInt ((maximum > minimum) ? (rangeSize * thumbAreaSize) / (maximum - minimum)
: thumbAreaSize);
int newThumbSize = roundToInt (totalRange.getLength() > 0 ? (visibleRange.getLength() * thumbAreaSize) / totalRange.getLength()
: thumbAreaSize);

if (newThumbSize < getLookAndFeel().getMinimumScrollbarThumbSize (*this))
newThumbSize = jmin (getLookAndFeel().getMinimumScrollbarThumbSize (*this), thumbAreaSize - 1);
@@ -61284,11 +61282,11 @@ void ScrollBar::updateThumbPosition() throw()

int newThumbStart = thumbAreaStart;

if (maximum - minimum > rangeSize)
newThumbStart += roundToInt (((rangeStart - minimum) * (thumbAreaSize - newThumbSize))
/ ((maximum - minimum) - rangeSize));
if (totalRange.getLength() > visibleRange.getLength())
newThumbStart += roundToInt (((visibleRange.getStart() - totalRange.getStart()) * (thumbAreaSize - newThumbSize))
/ (totalRange.getLength() - visibleRange.getLength()));

setVisible (alwaysVisible || (maximum - minimum > rangeSize && rangeSize > 0.0));
setVisible (alwaysVisible || (totalRange.getLength() > visibleRange.getLength() && visibleRange.getLength() > 0.0));

if (thumbStart != newThumbStart || thumbSize != newThumbSize)
{
@@ -61305,7 +61303,7 @@ void ScrollBar::updateThumbPosition() throw()
}
}

void ScrollBar::setOrientation (const bool shouldBeVertical) throw()
void ScrollBar::setOrientation (const bool shouldBeVertical)
{
if (vertical != shouldBeVertical)
{
@@ -61418,7 +61416,7 @@ void ScrollBar::mouseDown (const MouseEvent& e)
isDraggingThumb = false;
lastMousePos = vertical ? e.y : e.x;
dragStartMousePos = lastMousePos;
dragStartRange = rangeStart;
dragStartRange = visibleRange.getStart();

if (dragStartMousePos < thumbStart)
{
@@ -61444,7 +61442,7 @@ void ScrollBar::mouseDrag (const MouseEvent& e)
const int deltaPixels = ((vertical) ? e.y : e.x) - dragStartMousePos;

setCurrentRangeStart (dragStartRange
+ deltaPixels * ((maximum - minimum) - rangeSize)
+ deltaPixels * (totalRange.getLength() - visibleRange.getLength())
/ (thumbAreaSize - thumbSize));
}
else
@@ -61471,7 +61469,7 @@ void ScrollBar::mouseWheelMove (const MouseEvent&,
else if (increment > 0)
increment = jmax (increment * 10.0f, 1.0f);

setCurrentRangeStart (rangeStart - singleStepSize * increment);
setCurrentRange (visibleRange - singleStepSize * increment);
}

void ScrollBar::timerCallback()
@@ -61481,9 +61479,9 @@ void ScrollBar::timerCallback()
startTimer (40);

if (lastMousePos < thumbStart)
setCurrentRangeStart (rangeStart - rangeSize);
setCurrentRange (visibleRange - visibleRange.getLength());
else if (lastMousePos > thumbStart + thumbSize)
setCurrentRangeStart (rangeStart + rangeSize);
setCurrentRangeStart (visibleRange.getEnd());
}
else
{
@@ -213869,7 +213867,7 @@ private:

long improbableWindowNumber = 0xf965aa01; // also referenced by messaging.cpp

bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
SHORT k = (SHORT) keyCode;

@@ -230844,7 +230842,7 @@ namespace Keys
static const int extendedKeyModifier = 0x10000000;
}

bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
int keysym;

@@ -240391,7 +240389,7 @@ END_JUCE_NAMESPACE
owner->drawRect (r);
}

bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
return false;
}
@@ -245632,7 +245630,7 @@ ModifierKeys NSViewComponentPeer::currentModifiers;
ComponentPeer* NSViewComponentPeer::currentlyFocusedPeer = 0;
VoidArray NSViewComponentPeer::keysCurrentlyDown;

bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
if (NSViewComponentPeer::keysCurrentlyDown.contains ((void*) keyCode))
return true;


+ 77
- 53
juce_amalgamated.h View File

@@ -4857,6 +4857,11 @@ public:
return Range (newStart, jmax (newStart, end));
}

const Range movedToStartAt (const ValueType newStart) const throw()
{
return Range (newStart, newStart + getLength());
}

void setEnd (const ValueType newEnd) throw()
{
end = newEnd;
@@ -4869,6 +4874,11 @@ public:
return Range (jmin (start, newEnd), newEnd);
}

const Range movedToEndAt (const ValueType newEnd) const throw()
{
return Range (newEnd - getLength(), newEnd);
}

void setLength (const ValueType newLength) throw()
{
end = start + jmax (ValueType(), newLength);
@@ -4903,6 +4913,9 @@ public:
return Range (start - amountToSubtract, end - amountToSubtract);
}

bool operator== (const Range& other) const throw() { return start == other.start && end == other.end; }
bool operator!= (const Range& other) const throw() { return start != other.start || end != other.end; }

bool contains (const ValueType position) const throw()
{
return position >= start && position < end;
@@ -4930,6 +4943,14 @@ public:
jmax (end, other.end));
}

const Range constrainRange (const Range& rangeToConstrain) const throw()
{
const ValueType otherLen = rangeToConstrain.getLength();
return otherLen >= getLength()
? *this
: rangeToConstrain.movedToStartAt (jlimit (start, end - otherLen, rangeToConstrain.getStart()));
}

juce_UseDebuggingNewOperator

private:
@@ -9735,13 +9756,13 @@ public:

bool isKeyCode (int keyCodeToCompare) const throw() { return keyCode == keyCodeToCompare; }

static const KeyPress createFromDescription (const String& textVersion) throw();
static const KeyPress createFromDescription (const String& textVersion);

const String getTextDescription() const throw();
const String getTextDescription() const;

bool isCurrentlyDown() const throw();
bool isCurrentlyDown() const;

static bool isKeyCurrentlyDown (int keyCode) throw();
static bool isKeyCurrentlyDown (int keyCode);

// Key codes
//
@@ -16082,41 +16103,47 @@ public:

bool isVertical() const throw() { return vertical; }

void setOrientation (bool shouldBeVertical) throw();
void setOrientation (bool shouldBeVertical);

void setButtonVisibility (bool buttonsAreVisible);

void setAutoHide (bool shouldHideWhenFullRange);

void setRangeLimits (double minimum,
double maximum) throw();
void setRangeLimits (const Range<double>& newRangeLimit);

double getMinimumRangeLimit() const throw() { return minimum; }
void setRangeLimits (double minimum, double maximum);

double getMaximumRangeLimit() const throw() { return maximum; }
const Range<double> getRangeLimit() const throw() { return totalRange; }

void setCurrentRange (double newStart,
double newSize) throw();
double getMinimumRangeLimit() const throw() { return totalRange.getStart(); }

void setCurrentRangeStart (double newStart) throw();
double getMaximumRangeLimit() const throw() { return totalRange.getEnd(); }

double getCurrentRangeStart() const throw() { return rangeStart; }
void setCurrentRange (const Range<double>& newRange);

double getCurrentRangeSize() const throw() { return rangeSize; }
void setCurrentRange (double newStart, double newSize);

void setSingleStepSize (double newSingleStepSize) throw();
void setCurrentRangeStart (double newStart);

void moveScrollbarInSteps (int howManySteps) throw();
const Range<double> getCurrentRange() const throw() { return visibleRange; }

void moveScrollbarInPages (int howManyPages) throw();
double getCurrentRangeStart() const throw() { return visibleRange.getStart(); }

void scrollToTop() throw();
double getCurrentRangeSize() const throw() { return visibleRange.getLength(); }

void scrollToBottom() throw();
void setSingleStepSize (double newSingleStepSize);

void moveScrollbarInSteps (int howManySteps);

void moveScrollbarInPages (int howManyPages);

void scrollToTop();

void scrollToBottom();

void setButtonRepeatSpeed (int initialDelayInMillisecs,
int repeatDelayInMillisecs,
int minimumDelayInMillisecs = -1) throw();
int minimumDelayInMillisecs = -1);

enum ColourIds
{
@@ -16125,9 +16152,9 @@ public:
trackColourId = 0x1000401 /**< A base colour to use for the slot area of the bar. The look and feel will probably use variations on this colour. */
};

void addListener (ScrollBarListener* listener) throw();
void addListener (ScrollBarListener* listener);

void removeListener (ScrollBarListener* listener) throw();
void removeListener (ScrollBarListener* listener);

bool keyPressed (const KeyPress& key);
void mouseWheelMove (const MouseEvent& e, float wheelIncrementX, float wheelIncrementY);
@@ -16143,8 +16170,7 @@ public:

private:

double minimum, maximum;
double rangeStart, rangeSize;
Range <double> totalRange, visibleRange;
double singleStepSize, dragStartRange;
int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
int dragStartMousePos, lastMousePos;
@@ -16154,7 +16180,7 @@ private:
Button* downButton;
ListenerList <ScrollBarListener> listeners;

void updateThumbPosition() throw();
void updateThumbPosition();
void timerCallback();

ScrollBar (const ScrollBar&);
@@ -22337,9 +22363,9 @@ public:

virtual void scrollToTop() = 0;

void addListener (FileBrowserListener* listener) throw();
void addListener (FileBrowserListener* listener);

void removeListener (FileBrowserListener* listener) throw();
void removeListener (FileBrowserListener* listener);

enum ColourIds
{
@@ -22452,9 +22478,9 @@ public:

bool isSaveMode() const throw();

void addListener (FileBrowserListener* listener) throw();
void addListener (FileBrowserListener* listener);

void removeListener (FileBrowserListener* listener) throw();
void removeListener (FileBrowserListener* listener);

void resized();
void buttonClicked (Button* b);
@@ -23271,7 +23297,7 @@ public:

void setFilenameIsEditable (bool shouldBeEditable);

void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
void setDefaultBrowseTarget (const File& newDefaultDirectory);

const StringArray getRecentlyUsedFilenames() const;

@@ -23283,9 +23309,9 @@ public:

void setBrowseButtonText (const String& browseButtonText);

void addListener (FilenameComponentListener* listener) throw();
void addListener (FilenameComponentListener* listener);

void removeListener (FilenameComponentListener* listener) throw();
void removeListener (FilenameComponentListener* listener);

void setTooltip (const String& newTooltip);

@@ -23348,7 +23374,7 @@ public:

void setPath (const FileSearchPath& newPath);

void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
void setDefaultBrowseTarget (const File& newDefaultDirectory);

enum ColourIds
{
@@ -23382,8 +23408,8 @@ private:
Button* upButton;
Button* downButton;

void changed() throw();
void updateButtons() throw();
void changed();
void updateButtons();

FileSearchPathListComponent (const FileSearchPathListComponent&);
FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);
@@ -23415,7 +23441,7 @@ public:

void scrollToTop();

void setDragAndDropDescription (const String& description) throw();
void setDragAndDropDescription (const String& description);

const String& getDragAndDropDescription() const throw() { return dragAndDropDescription; }

@@ -23495,8 +23521,8 @@ public:
private:
StringArray fileWildcards, directoryWildcards;

static void parse (const String& pattern, StringArray& result) throw();
static bool match (const File& file, const StringArray& wildcards) throw();
static void parse (const String& pattern, StringArray& result);
static bool match (const File& file, const StringArray& wildcards);
};

#endif // __JUCE_WILDCARDFILEFILTER_JUCEHEADER__
@@ -23536,35 +23562,33 @@ class JUCE_API KeyPressMappingSet : public KeyListener,
{
public:

explicit KeyPressMappingSet (ApplicationCommandManager* commandManager) throw();
explicit KeyPressMappingSet (ApplicationCommandManager* commandManager);

KeyPressMappingSet (const KeyPressMappingSet& other) throw();
KeyPressMappingSet (const KeyPressMappingSet& other);

~KeyPressMappingSet();

ApplicationCommandManager* getCommandManager() const throw() { return commandManager; }

const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const throw();
const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const;

void addKeyPress (CommandID commandID,
const KeyPress& newKeyPress,
int insertIndex = -1) throw();
int insertIndex = -1);

void resetToDefaultMappings() throw();
void resetToDefaultMappings();

void resetToDefaultMapping (CommandID commandID) throw();
void resetToDefaultMapping (CommandID commandID);

void clearAllKeyPresses() throw();
void clearAllKeyPresses();

void clearAllKeyPresses (CommandID commandID) throw();
void clearAllKeyPresses (CommandID commandID);

void removeKeyPress (CommandID commandID,
int keyPressIndex) throw();
void removeKeyPress (CommandID commandID, int keyPressIndex);

void removeKeyPress (const KeyPress& keypress) throw();
void removeKeyPress (const KeyPress& keypress);

bool containsMapping (CommandID commandID,
const KeyPress& keyPress) const throw();
bool containsMapping (CommandID commandID, const KeyPress& keyPress) const throw();

CommandID findCommandForKeyPress (const KeyPress& keyPress) const throw();

@@ -23748,9 +23772,9 @@ public:

~GroupComponent();

void setText (const String& newText) throw();
void setText (const String& newText);

const String getText() const throw();
const String getText() const;

void setTextLabelPosition (const Justification& justification);



+ 33
- 0
src/containers/juce_Range.h View File

@@ -117,6 +117,12 @@ public:
return Range (newStart, jmax (newStart, end));
}
/** Returns a range with the same length as this one, but moved to have the given start position. */
const Range movedToStartAt (const ValueType newStart) const throw()
{
return Range (newStart, newStart + getLength());
}
/** Changes the end position of the range, leaving the start unchanged.
If the new end position is below the current start of the range, the start point
will be pushed back to equal the new end point.
@@ -137,6 +143,12 @@ public:
return Range (jmin (start, newEnd), newEnd);
}
/** Returns a range with the same length as this one, but moved to have the given start position. */
const Range movedToEndAt (const ValueType newEnd) const throw()
{
return Range (newEnd - getLength(), newEnd);
}
/** Changes the length of the range.
Lengths less than zero are treated as zero.
*/
@@ -185,6 +197,9 @@ public:
return Range (start - amountToSubtract, end - amountToSubtract);
}
bool operator== (const Range& other) const throw() { return start == other.start && end == other.end; }
bool operator!= (const Range& other) const throw() { return start != other.start || end != other.end; }
//==============================================================================
/** Returns true if the given position lies inside this range. */
bool contains (const ValueType position) const throw()
@@ -219,6 +234,24 @@ public:
jmax (end, other.end));
}
/** Returns a given range, after moving it forwards or backwards to fit it
within this range.
If the supplied range has a greater length than this one, the return value
will be this range.
Otherwise, if the supplied range is smaller than this one, the return value
will be the new range, shifted forwards or backwards so that it doesn't extend
beyond this one, but keeping its original length.
*/
const Range constrainRange (const Range& rangeToConstrain) const throw()
{
const ValueType otherLen = rangeToConstrain.getLength();
return otherLen >= getLength()
? *this
: rangeToConstrain.movedToStartAt (jlimit (start, end - otherLen, rangeToConstrain.getStart()));
}
//==============================================================================
juce_UseDebuggingNewOperator


+ 2
- 2
src/gui/components/filebrowser/juce_DirectoryContentsDisplayComponent.cpp View File

@@ -45,12 +45,12 @@ FileBrowserListener::~FileBrowserListener()
{
}
void DirectoryContentsDisplayComponent::addListener (FileBrowserListener* const listener) throw()
void DirectoryContentsDisplayComponent::addListener (FileBrowserListener* const listener)
{
listeners.add (listener);
}
void DirectoryContentsDisplayComponent::removeListener (FileBrowserListener* const listener) throw()
void DirectoryContentsDisplayComponent::removeListener (FileBrowserListener* const listener)
{
listeners.remove (listener);
}


+ 3
- 6
src/gui/components/filebrowser/juce_DirectoryContentsDisplayComponent.h View File

@@ -41,8 +41,7 @@ class JUCE_API DirectoryContentsDisplayComponent
{
public:
//==============================================================================
/**
*/
/** Creates a DirectoryContentsDisplayComponent for a given list of files. */
DirectoryContentsDisplayComponent (DirectoryContentsList& listToShow);
/** Destructor. */
@@ -65,16 +64,14 @@ public:
//==============================================================================
/** Adds a listener to be told when files are selected or clicked.
@see removeListener
*/
void addListener (FileBrowserListener* listener) throw();
void addListener (FileBrowserListener* listener);
/** Removes a listener.
@see addListener
*/
void removeListener (FileBrowserListener* listener) throw();
void removeListener (FileBrowserListener* listener);
//==============================================================================


+ 2
- 2
src/gui/components/filebrowser/juce_FileBrowserComponent.cpp View File

@@ -150,12 +150,12 @@ FileBrowserComponent::~FileBrowserComponent()
}
//==============================================================================
void FileBrowserComponent::addListener (FileBrowserListener* const newListener) throw()
void FileBrowserComponent::addListener (FileBrowserListener* const newListener)
{
listeners.add (newListener);
}
void FileBrowserComponent::removeListener (FileBrowserListener* const listener) throw()
void FileBrowserComponent::removeListener (FileBrowserListener* const listener)
{
listeners.remove (listener);
}


+ 2
- 2
src/gui/components/filebrowser/juce_FileBrowserComponent.h View File

@@ -160,13 +160,13 @@ public:
@see removeListener
*/
void addListener (FileBrowserListener* listener) throw();
void addListener (FileBrowserListener* listener);
/** Removes a listener.
@see addListener
*/
void removeListener (FileBrowserListener* listener) throw();
void removeListener (FileBrowserListener* listener);
//==============================================================================


+ 3
- 3
src/gui/components/filebrowser/juce_FileSearchPathListComponent.cpp View File

@@ -89,7 +89,7 @@ FileSearchPathListComponent::~FileSearchPathListComponent()
deleteAllChildren();
}
void FileSearchPathListComponent::updateButtons() throw()
void FileSearchPathListComponent::updateButtons()
{
const bool anythingSelected = listBox->getNumSelectedRows() > 0;
@@ -99,7 +99,7 @@ void FileSearchPathListComponent::updateButtons() throw()
downButton->setEnabled (anythingSelected);
}
void FileSearchPathListComponent::changed() throw()
void FileSearchPathListComponent::changed()
{
listBox->updateContent();
listBox->repaint();
@@ -116,7 +116,7 @@ void FileSearchPathListComponent::setPath (const FileSearchPath& newPath)
}
}
void FileSearchPathListComponent::setDefaultBrowseTarget (const File& newDefaultDirectory) throw()
void FileSearchPathListComponent::setDefaultBrowseTarget (const File& newDefaultDirectory)
{
defaultBrowseTarget = newDefaultDirectory;
}


+ 3
- 3
src/gui/components/filebrowser/juce_FileSearchPathListComponent.h View File

@@ -66,7 +66,7 @@ public:
This is only used if the current file hasn't been set.
*/
void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
void setDefaultBrowseTarget (const File& newDefaultDirectory);
/** A set of colour IDs to use to change the colour of various aspects of the label.
@@ -120,8 +120,8 @@ private:
Button* upButton;
Button* downButton;
void changed() throw();
void updateButtons() throw();
void changed();
void updateButtons();
FileSearchPathListComponent (const FileSearchPathListComponent&);
FileSearchPathListComponent& operator= (const FileSearchPathListComponent&);


+ 5
- 5
src/gui/components/filebrowser/juce_FileTreeComponent.cpp View File

@@ -47,7 +47,7 @@ public:
DirectoryContentsList* const parentContentsList_,
const int indexInContentsList_,
const File& file_,
TimeSliceThread& thread_) throw()
TimeSliceThread& thread_)
: file (file_),
owner (owner_),
parentContentsList (parentContentsList_),
@@ -72,7 +72,7 @@ public:
}
}
~FileListTreeItem() throw()
~FileListTreeItem()
{
thread.removeTimeSliceClient (this);
@@ -116,7 +116,7 @@ public:
}
}
void setSubContentsList (DirectoryContentsList* newList) throw()
void setSubContentsList (DirectoryContentsList* newList)
{
jassert (subContentsList == 0);
subContentsList = newList;
@@ -203,7 +203,7 @@ private:
String fileSize;
String modTime;
void updateIcon (const bool onlyUpdateIfCached) throw()
void updateIcon (const bool onlyUpdateIfCached)
{
if (icon == 0)
{
@@ -261,7 +261,7 @@ void FileTreeComponent::scrollToTop()
getViewport()->getVerticalScrollBar()->setCurrentRangeStart (0);
}
void FileTreeComponent::setDragAndDropDescription (const String& description) throw()
void FileTreeComponent::setDragAndDropDescription (const String& description)
{
dragAndDropDescription = description;
}


+ 1
- 1
src/gui/components/filebrowser/juce_FileTreeComponent.h View File

@@ -74,7 +74,7 @@ public:
The string that you pass in here will be returned by the getDragSourceDescription()
of the items in the tree. For more info, see TreeViewItem::getDragSourceDescription().
*/
void setDragAndDropDescription (const String& description) throw();
void setDragAndDropDescription (const String& description);
/** Returns the last value that was set by setDragAndDropDescription().
*/


+ 3
- 3
src/gui/components/filebrowser/juce_FilenameComponent.cpp View File

@@ -105,7 +105,7 @@ void FilenameComponent::setTooltip (const String& newTooltip)
filenameBox->setTooltip (newTooltip);
}
void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory) throw()
void FilenameComponent::setDefaultBrowseTarget (const File& newDefaultDirectory)
{
defaultBrowseFile = newDefaultDirectory;
}
@@ -237,12 +237,12 @@ void FilenameComponent::addRecentlyUsedFile (const File& file)
}
//==============================================================================
void FilenameComponent::addListener (FilenameComponentListener* const listener) throw()
void FilenameComponent::addListener (FilenameComponentListener* const listener)
{
listeners.add (listener);
}
void FilenameComponent::removeListener (FilenameComponentListener* const listener) throw()
void FilenameComponent::removeListener (FilenameComponentListener* const listener)
{
listeners.remove (listener);
}


+ 3
- 3
src/gui/components/filebrowser/juce_FilenameComponent.h View File

@@ -131,7 +131,7 @@ public:
This is only used if the current file hasn't been set.
*/
void setDefaultBrowseTarget (const File& newDefaultDirectory) throw();
void setDefaultBrowseTarget (const File& newDefaultDirectory);
/** Returns all the entries on the recent files list.
@@ -174,10 +174,10 @@ public:
//==============================================================================
/** Adds a listener that will be called when the selected file is changed. */
void addListener (FilenameComponentListener* listener) throw();
void addListener (FilenameComponentListener* listener);
/** Removes a previously-registered listener. */
void removeListener (FilenameComponentListener* listener) throw();
void removeListener (FilenameComponentListener* listener);
/** Gives the component a tooltip. */
void setTooltip (const String& newTooltip);


+ 2
- 2
src/gui/components/filebrowser/juce_WildcardFileFilter.cpp View File

@@ -56,7 +56,7 @@ bool WildcardFileFilter::isDirectorySuitable (const File& file) const
}
//==============================================================================
void WildcardFileFilter::parse (const String& pattern, StringArray& result) throw()
void WildcardFileFilter::parse (const String& pattern, StringArray& result)
{
result.addTokens (pattern.toLowerCase(), ";,", "\"'");
@@ -70,7 +70,7 @@ void WildcardFileFilter::parse (const String& pattern, StringArray& result) thro
result.set (i, "*");
}
bool WildcardFileFilter::match (const File& file, const StringArray& wildcards) throw()
bool WildcardFileFilter::match (const File& file, const StringArray& wildcards)
{
const String filename (file.getFileName());


+ 2
- 2
src/gui/components/filebrowser/juce_WildcardFileFilter.h View File

@@ -72,8 +72,8 @@ public:
private:
StringArray fileWildcards, directoryWildcards;
static void parse (const String& pattern, StringArray& result) throw();
static bool match (const File& file, const StringArray& wildcards) throw();
static void parse (const String& pattern, StringArray& result);
static bool match (const File& file, const StringArray& wildcards);
};


+ 3
- 3
src/gui/components/keyboard/juce_KeyPress.cpp View File

@@ -88,7 +88,7 @@ bool KeyPress::operator!= (const KeyPress& other) const throw()
return ! operator== (other);
}
bool KeyPress::isCurrentlyDown() const throw()
bool KeyPress::isCurrentlyDown() const
{
return isKeyCurrentlyDown (keyCode)
&& (ModifierKeys::getCurrentModifiers().getRawFlags() & ModifierKeys::allKeyboardModifiers)
@@ -131,7 +131,7 @@ namespace KeyPressHelpers
}
//==============================================================================
const KeyPress KeyPress::createFromDescription (const String& desc) throw()
const KeyPress KeyPress::createFromDescription (const String& desc)
{
int modifiers = 0;
@@ -216,7 +216,7 @@ const KeyPress KeyPress::createFromDescription (const String& desc) throw()
return KeyPress (key, ModifierKeys (modifiers), 0);
}
const String KeyPress::getTextDescription() const throw()
const String KeyPress::getTextDescription() const
{
String desc;


+ 4
- 4
src/gui/components/keyboard/juce_KeyPress.h View File

@@ -137,7 +137,7 @@ public:
@see getTextDescription
*/
static const KeyPress createFromDescription (const String& textVersion) throw();
static const KeyPress createFromDescription (const String& textVersion);
/** Creates a textual description of the key combination.
@@ -146,7 +146,7 @@ public:
To store a keypress in a file, use this method, along with createFromDescription()
to retrieve it later.
*/
const String getTextDescription() const throw();
const String getTextDescription() const;
//==============================================================================
/** Checks whether the user is currently holding down the keys that make up this
@@ -156,14 +156,14 @@ public:
down - e.g. if the keypress is CTRL+X and the user is actually holding CTRL+ALT+x
then it will be false.
*/
bool isCurrentlyDown() const throw();
bool isCurrentlyDown() const;
/** Checks whether a particular key is held down, irrespective of modifiers.
The values for key codes can either be one of the special constants defined in
this class, or an 8-bit character code.
*/
static bool isKeyCurrentlyDown (int keyCode) throw();
static bool isKeyCurrentlyDown (int keyCode);
//==============================================================================
// Key codes


+ 11
- 13
src/gui/components/keyboard/juce_KeyPressMappingSet.cpp View File

@@ -34,7 +34,7 @@ BEGIN_JUCE_NAMESPACE
//==============================================================================
KeyPressMappingSet::KeyPressMappingSet (ApplicationCommandManager* const commandManager_) throw()
KeyPressMappingSet::KeyPressMappingSet (ApplicationCommandManager* const commandManager_)
: commandManager (commandManager_)
{
// A manager is needed to get the descriptions of commands, and will be called when
@@ -44,7 +44,7 @@ KeyPressMappingSet::KeyPressMappingSet (ApplicationCommandManager* const command
Desktop::getInstance().addFocusChangeListener (this);
}
KeyPressMappingSet::KeyPressMappingSet (const KeyPressMappingSet& other) throw()
KeyPressMappingSet::KeyPressMappingSet (const KeyPressMappingSet& other)
: commandManager (other.commandManager)
{
Desktop::getInstance().addFocusChangeListener (this);
@@ -56,7 +56,7 @@ KeyPressMappingSet::~KeyPressMappingSet()
}
//==============================================================================
const Array <KeyPress> KeyPressMappingSet::getKeyPressesAssignedToCommand (const CommandID commandID) const throw()
const Array <KeyPress> KeyPressMappingSet::getKeyPressesAssignedToCommand (const CommandID commandID) const
{
for (int i = 0; i < mappings.size(); ++i)
if (mappings.getUnchecked(i)->commandID == commandID)
@@ -67,7 +67,7 @@ const Array <KeyPress> KeyPressMappingSet::getKeyPressesAssignedToCommand (const
void KeyPressMappingSet::addKeyPress (const CommandID commandID,
const KeyPress& newKeyPress,
int insertIndex) throw()
int insertIndex)
{
// If you specify an upper-case letter but no shift key, how is the user supposed to press it!?
// Stick to lower-case letters when defining a keypress, to avoid ambiguity.
@@ -107,7 +107,7 @@ void KeyPressMappingSet::addKeyPress (const CommandID commandID,
}
}
void KeyPressMappingSet::resetToDefaultMappings() throw()
void KeyPressMappingSet::resetToDefaultMappings()
{
mappings.clear();
@@ -125,7 +125,7 @@ void KeyPressMappingSet::resetToDefaultMappings() throw()
sendChangeMessage (this);
}
void KeyPressMappingSet::resetToDefaultMapping (const CommandID commandID) throw()
void KeyPressMappingSet::resetToDefaultMapping (const CommandID commandID)
{
clearAllKeyPresses (commandID);
@@ -138,7 +138,7 @@ void KeyPressMappingSet::resetToDefaultMapping (const CommandID commandID) throw
}
}
void KeyPressMappingSet::clearAllKeyPresses() throw()
void KeyPressMappingSet::clearAllKeyPresses()
{
if (mappings.size() > 0)
{
@@ -147,7 +147,7 @@ void KeyPressMappingSet::clearAllKeyPresses() throw()
}
}
void KeyPressMappingSet::clearAllKeyPresses (const CommandID commandID) throw()
void KeyPressMappingSet::clearAllKeyPresses (const CommandID commandID)
{
for (int i = mappings.size(); --i >= 0;)
{
@@ -159,7 +159,7 @@ void KeyPressMappingSet::clearAllKeyPresses (const CommandID commandID) throw()
}
}
void KeyPressMappingSet::removeKeyPress (const KeyPress& keypress) throw()
void KeyPressMappingSet::removeKeyPress (const KeyPress& keypress)
{
if (keypress.isValid())
{
@@ -179,8 +179,7 @@ void KeyPressMappingSet::removeKeyPress (const KeyPress& keypress) throw()
}
}
void KeyPressMappingSet::removeKeyPress (const CommandID commandID,
const int keyPressIndex) throw()
void KeyPressMappingSet::removeKeyPress (const CommandID commandID, const int keyPressIndex)
{
for (int i = mappings.size(); --i >= 0;)
{
@@ -203,8 +202,7 @@ CommandID KeyPressMappingSet::findCommandForKeyPress (const KeyPress& keyPress)
return 0;
}
bool KeyPressMappingSet::containsMapping (const CommandID commandID,
const KeyPress& keyPress) const throw()
bool KeyPressMappingSet::containsMapping (const CommandID commandID, const KeyPress& keyPress) const throw()
{
for (int i = mappings.size(); --i >= 0;)
if (mappings.getUnchecked(i)->commandID == commandID)


+ 11
- 13
src/gui/components/keyboard/juce_KeyPressMappingSet.h View File

@@ -107,10 +107,10 @@ public:
@see ApplicationCommandManager
*/
explicit KeyPressMappingSet (ApplicationCommandManager* commandManager) throw();
explicit KeyPressMappingSet (ApplicationCommandManager* commandManager);
/** Creates an copy of a KeyPressMappingSet. */
KeyPressMappingSet (const KeyPressMappingSet& other) throw();
KeyPressMappingSet (const KeyPressMappingSet& other);
/** Destructor. */
~KeyPressMappingSet();
@@ -123,7 +123,7 @@ public:
@param commandID the command's ID
*/
const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const throw();
const Array <KeyPress> getKeyPressesAssignedToCommand (CommandID commandID) const;
/** Assigns a keypress to a command.
@@ -140,41 +140,39 @@ public:
*/
void addKeyPress (CommandID commandID,
const KeyPress& newKeyPress,
int insertIndex = -1) throw();
int insertIndex = -1);
/** Reset all mappings to the defaults, as dictated by the ApplicationCommandManager.
@see resetToDefaultMapping
*/
void resetToDefaultMappings() throw();
void resetToDefaultMappings();
/** Resets all key-mappings to the defaults for a particular command.
@see resetToDefaultMappings
*/
void resetToDefaultMapping (CommandID commandID) throw();
void resetToDefaultMapping (CommandID commandID);
/** Removes all keypresses that are assigned to any commands. */
void clearAllKeyPresses() throw();
void clearAllKeyPresses();
/** Removes all keypresses that are assigned to a particular command. */
void clearAllKeyPresses (CommandID commandID) throw();
void clearAllKeyPresses (CommandID commandID);
/** Removes one of the keypresses that are assigned to a command.
See the getKeyPressesAssignedToCommand() for the list of keypresses to
which the keyPressIndex refers.
*/
void removeKeyPress (CommandID commandID,
int keyPressIndex) throw();
void removeKeyPress (CommandID commandID, int keyPressIndex);
/** Removes a keypress from any command that it may be assigned to.
*/
void removeKeyPress (const KeyPress& keypress) throw();
void removeKeyPress (const KeyPress& keypress);
/** Returns true if the given command is linked to this key. */
bool containsMapping (CommandID commandID,
const KeyPress& keyPress) const throw();
bool containsMapping (CommandID commandID, const KeyPress& keyPress) const throw();
//==============================================================================
/** Looks for a command that corresponds to a keypress.


+ 2
- 2
src/gui/components/keyboard/juce_KeyboardFocusTraverser.cpp View File

@@ -50,7 +50,7 @@ namespace KeyboardFocusHelpers
public:
ScreenPositionComparator() {}
static int compareElements (const Component* const first, const Component* const second) throw()
static int compareElements (const Component* const first, const Component* const second)
{
int explicitOrder1 = first->getExplicitFocusOrder();
if (explicitOrder1 <= 0)
@@ -100,7 +100,7 @@ namespace KeyboardFocusHelpers
}
}
static Component* getIncrementedComponent (Component* const current, const int delta) throw()
static Component* getIncrementedComponent (Component* const current, const int delta)
{
Component* focusContainer = current->getParentComponent();


+ 2
- 2
src/gui/components/layout/juce_GroupComponent.cpp View File

@@ -46,7 +46,7 @@ GroupComponent::~GroupComponent()
}
//==============================================================================
void GroupComponent::setText (const String& newText) throw()
void GroupComponent::setText (const String& newText)
{
if (text != newText)
{
@@ -55,7 +55,7 @@ void GroupComponent::setText (const String& newText) throw()
}
}
const String GroupComponent::getText() const throw()
const String GroupComponent::getText() const
{
return text;
}


+ 2
- 2
src/gui/components/layout/juce_GroupComponent.h View File

@@ -52,10 +52,10 @@ public:
//==============================================================================
/** Changes the text that's shown at the top of the component. */
void setText (const String& newText) throw();
void setText (const String& newText);
/** Returns the currently displayed text label. */
const String getText() const throw();
const String getText() const;
/** Sets the positioning of the text label.


+ 53
- 53
src/gui/components/layout/juce_ScrollBar.cpp View File

@@ -38,8 +38,7 @@ class ScrollbarButton : public Button
public:
int direction;
ScrollbarButton (const int direction_,
ScrollBar& owner_) throw()
ScrollbarButton (const int direction_, ScrollBar& owner_)
: Button (String::empty),
direction (direction_),
owner (owner_)
@@ -51,9 +50,7 @@ public:
{
}
void paintButton (Graphics& g,
bool isMouseOver,
bool isMouseDown)
void paintButton (Graphics& g, bool isMouseOver, bool isMouseDown)
{
getLookAndFeel()
.drawScrollbarButton (g, owner,
@@ -82,10 +79,8 @@ private:
//==============================================================================
ScrollBar::ScrollBar (const bool vertical_,
const bool buttonsAreVisible)
: minimum (0.0),
maximum (1.0),
rangeStart (0.0),
rangeSize (0.1),
: totalRange (0.0, 1.0),
visibleRange (0.0, 0.1),
singleStepSize (0.1),
thumbAreaStart (0),
thumbAreaSize (0),
@@ -112,68 +107,73 @@ ScrollBar::~ScrollBar()
}
//==============================================================================
void ScrollBar::setRangeLimits (const double newMinimum,
const double newMaximum) throw()
void ScrollBar::setRangeLimits (const Range<double>& newRangeLimit)
{
minimum = newMinimum;
maximum = newMaximum;
jassert (maximum >= minimum); // these can't be the wrong way round!
if (totalRange != newRangeLimit)
{
totalRange = newRangeLimit;
setCurrentRange (visibleRange);
updateThumbPosition();
}
}
setCurrentRangeStart (rangeStart);
updateThumbPosition();
void ScrollBar::setRangeLimits (const double newMinimum, const double newMaximum)
{
jassert (newMaximum >= newMinimum); // these can't be the wrong way round!
setRangeLimits (Range<double> (newMinimum, newMaximum));
}
void ScrollBar::setCurrentRange (double newStart,
double newSize) throw()
void ScrollBar::setCurrentRange (const Range<double>& newRange)
{
newSize = jlimit (0.0, maximum - minimum, newSize);
newStart = jlimit (minimum, maximum - newSize, newStart);
const Range<double> constrainedRange (totalRange.constrainRange (newRange));
if (rangeStart != newStart
|| rangeSize != newSize)
if (visibleRange != constrainedRange)
{
rangeStart = newStart;
rangeSize = newSize;
visibleRange = constrainedRange;
updateThumbPosition();
triggerAsyncUpdate();
}
}
void ScrollBar::setCurrentRangeStart (double newStart) throw()
void ScrollBar::setCurrentRange (const double newStart, const double newSize)
{
setCurrentRange (Range<double> (newStart, newStart + newSize));
}
void ScrollBar::setCurrentRangeStart (const double newStart)
{
setCurrentRange (newStart, rangeSize);
setCurrentRange (visibleRange.movedToStartAt (newStart));
}
void ScrollBar::setSingleStepSize (const double newSingleStepSize) throw()
void ScrollBar::setSingleStepSize (const double newSingleStepSize)
{
singleStepSize = newSingleStepSize;
}
void ScrollBar::moveScrollbarInSteps (const int howManySteps) throw()
void ScrollBar::moveScrollbarInSteps (const int howManySteps)
{
setCurrentRangeStart (rangeStart + howManySteps * singleStepSize);
setCurrentRange (visibleRange + howManySteps * singleStepSize);
}
void ScrollBar::moveScrollbarInPages (const int howManyPages) throw()
void ScrollBar::moveScrollbarInPages (const int howManyPages)
{
setCurrentRangeStart (rangeStart + howManyPages * rangeSize);
setCurrentRange (visibleRange + howManyPages * visibleRange.getLength());
}
void ScrollBar::scrollToTop() throw()
void ScrollBar::scrollToTop()
{
setCurrentRangeStart (minimum);
setCurrentRange (visibleRange.movedToStartAt (getMinimumRangeLimit()));
}
void ScrollBar::scrollToBottom() throw()
void ScrollBar::scrollToBottom()
{
setCurrentRangeStart (maximum - rangeSize);
setCurrentRange (visibleRange.movedToEndAt (getMaximumRangeLimit()));
}
void ScrollBar::setButtonRepeatSpeed (const int initialDelayInMillisecs_,
const int repeatDelayInMillisecs_,
const int minimumDelayInMillisecs_) throw()
const int minimumDelayInMillisecs_)
{
initialDelayInMillisecs = initialDelayInMillisecs_;
repeatDelayInMillisecs = repeatDelayInMillisecs_;
@@ -187,26 +187,26 @@ void ScrollBar::setButtonRepeatSpeed (const int initialDelayInMillisecs_,
}
//==============================================================================
void ScrollBar::addListener (ScrollBarListener* const listener) throw()
void ScrollBar::addListener (ScrollBarListener* const listener)
{
listeners.add (listener);
}
void ScrollBar::removeListener (ScrollBarListener* const listener) throw()
void ScrollBar::removeListener (ScrollBarListener* const listener)
{
listeners.remove (listener);
}
void ScrollBar::handleAsyncUpdate()
{
listeners.call (&ScrollBarListener::scrollBarMoved, this, rangeStart);
listeners.call (&ScrollBarListener::scrollBarMoved, this, visibleRange.getStart());
}
//==============================================================================
void ScrollBar::updateThumbPosition() throw()
void ScrollBar::updateThumbPosition()
{
int newThumbSize = roundToInt ((maximum > minimum) ? (rangeSize * thumbAreaSize) / (maximum - minimum)
: thumbAreaSize);
int newThumbSize = roundToInt (totalRange.getLength() > 0 ? (visibleRange.getLength() * thumbAreaSize) / totalRange.getLength()
: thumbAreaSize);
if (newThumbSize < getLookAndFeel().getMinimumScrollbarThumbSize (*this))
newThumbSize = jmin (getLookAndFeel().getMinimumScrollbarThumbSize (*this), thumbAreaSize - 1);
@@ -216,11 +216,11 @@ void ScrollBar::updateThumbPosition() throw()
int newThumbStart = thumbAreaStart;
if (maximum - minimum > rangeSize)
newThumbStart += roundToInt (((rangeStart - minimum) * (thumbAreaSize - newThumbSize))
/ ((maximum - minimum) - rangeSize));
if (totalRange.getLength() > visibleRange.getLength())
newThumbStart += roundToInt (((visibleRange.getStart() - totalRange.getStart()) * (thumbAreaSize - newThumbSize))
/ (totalRange.getLength() - visibleRange.getLength()));
setVisible (alwaysVisible || (maximum - minimum > rangeSize && rangeSize > 0.0));
setVisible (alwaysVisible || (totalRange.getLength() > visibleRange.getLength() && visibleRange.getLength() > 0.0));
if (thumbStart != newThumbStart || thumbSize != newThumbSize)
{
@@ -237,7 +237,7 @@ void ScrollBar::updateThumbPosition() throw()
}
}
void ScrollBar::setOrientation (const bool shouldBeVertical) throw()
void ScrollBar::setOrientation (const bool shouldBeVertical)
{
if (vertical != shouldBeVertical)
{
@@ -351,7 +351,7 @@ void ScrollBar::mouseDown (const MouseEvent& e)
isDraggingThumb = false;
lastMousePos = vertical ? e.y : e.x;
dragStartMousePos = lastMousePos;
dragStartRange = rangeStart;
dragStartRange = visibleRange.getStart();
if (dragStartMousePos < thumbStart)
{
@@ -377,7 +377,7 @@ void ScrollBar::mouseDrag (const MouseEvent& e)
const int deltaPixels = ((vertical) ? e.y : e.x) - dragStartMousePos;
setCurrentRangeStart (dragStartRange
+ deltaPixels * ((maximum - minimum) - rangeSize)
+ deltaPixels * (totalRange.getLength() - visibleRange.getLength())
/ (thumbAreaSize - thumbSize));
}
else
@@ -404,7 +404,7 @@ void ScrollBar::mouseWheelMove (const MouseEvent&,
else if (increment > 0)
increment = jmax (increment * 10.0f, 1.0f);
setCurrentRangeStart (rangeStart - singleStepSize * increment);
setCurrentRange (visibleRange - singleStepSize * increment);
}
void ScrollBar::timerCallback()
@@ -414,9 +414,9 @@ void ScrollBar::timerCallback()
startTimer (40);
if (lastMousePos < thumbStart)
setCurrentRangeStart (rangeStart - rangeSize);
setCurrentRange (visibleRange - visibleRange.getLength());
else if (lastMousePos > thumbStart + thumbSize)
setCurrentRangeStart (rangeStart + rangeSize);
setCurrentRangeStart (visibleRange.getEnd());
}
else
{


+ 52
- 27
src/gui/components/layout/juce_ScrollBar.h View File

@@ -27,6 +27,7 @@
#define __JUCE_SCROLLBAR_JUCEHEADER__
#include "../../../events/juce_AsyncUpdater.h"
#include "../../../containers/juce_Range.h"
#include "../../../events/juce_Timer.h"
#include "../buttons/juce_Button.h"
class ScrollBar;
@@ -105,7 +106,7 @@ public:
@param shouldBeVertical true makes it vertical; false makes it horizontal.
*/
void setOrientation (bool shouldBeVertical) throw();
void setOrientation (bool shouldBeVertical);
/** Shows or hides the scrollbar's buttons. */
void setButtonVisibility (bool buttonsAreVisible);
@@ -121,27 +122,50 @@ public:
//==============================================================================
/** Sets the minimum and maximum values that the bar will move between.
The bar's thumb will always be constrained so that the top of the thumb
will be >= minimum, and the bottom of the thumb <= maximum.
The bar's thumb will always be constrained so that the entire thumb lies
within this range.
@see setCurrentRange
*/
void setRangeLimits (double minimum,
double maximum) throw();
void setRangeLimits (const Range<double>& newRangeLimit);
/** Sets the minimum and maximum values that the bar will move between.
The bar's thumb will always be constrained so that the entire thumb lies
within this range.
@see setCurrentRange
*/
void setRangeLimits (double minimum, double maximum);
/** Returns the current limits on the thumb position.
@see setRangeLimits
*/
const Range<double> getRangeLimit() const throw() { return totalRange; }
/** Returns the lower value that the thumb can be set to.
This is the value set by setRangeLimits().
*/
double getMinimumRangeLimit() const throw() { return minimum; }
double getMinimumRangeLimit() const throw() { return totalRange.getStart(); }
/** Returns the upper value that the thumb can be set to.
This is the value set by setRangeLimits().
*/
double getMaximumRangeLimit() const throw() { return maximum; }
double getMaximumRangeLimit() const throw() { return totalRange.getEnd(); }
//==============================================================================
/** Changes the position of the scrollbar's 'thumb'.
If this method call actually changes the scrollbar's position, it will trigger an
asynchronous call to ScrollBarListener::scrollBarMoved() for all the listeners that
are registered.
@see getCurrentRange. setCurrentRangeStart
*/
void setCurrentRange (const Range<double>& newRange);
/** Changes the position of the scrollbar's 'thumb'.
This sets both the position and size of the thumb - to just set the position without
@@ -159,8 +183,7 @@ public:
size is beyond these limits, it will be clipped.
@see setCurrentRangeStart, getCurrentRangeStart, getCurrentRangeSize
*/
void setCurrentRange (double newStart,
double newSize) throw();
void setCurrentRange (double newStart, double newSize);
/** Moves the bar's thumb position.
@@ -173,19 +196,22 @@ public:
@see setCurrentRange
*/
void setCurrentRangeStart (double newStart) throw();
void setCurrentRangeStart (double newStart);
/** Returns the position of the top of the thumb.
/** Returns the current thumb range.
@see getCurrentRange, setCurrentRange
*/
const Range<double> getCurrentRange() const throw() { return visibleRange; }
@see setCurrentRangeStart
/** Returns the position of the top of the thumb.
@see getCurrentRange, setCurrentRangeStart
*/
double getCurrentRangeStart() const throw() { return rangeStart; }
double getCurrentRangeStart() const throw() { return visibleRange.getStart(); }
/** Returns the current size of the thumb.
@see setCurrentRange
@see getCurrentRange, setCurrentRange
*/
double getCurrentRangeSize() const throw() { return rangeSize; }
double getCurrentRangeSize() const throw() { return visibleRange.getLength(); }
//==============================================================================
/** Sets the amount by which the up and down buttons will move the bar.
@@ -193,7 +219,7 @@ public:
The value here is in terms of the total range, and is added or subtracted
from the thumb position when the user clicks an up/down (or left/right) button.
*/
void setSingleStepSize (double newSingleStepSize) throw();
void setSingleStepSize (double newSingleStepSize);
/** Moves the scrollbar by a number of single-steps.
@@ -203,7 +229,7 @@ public:
A positive value here will move the bar down or to the right, a negative
value moves it up or to the left.
*/
void moveScrollbarInSteps (int howManySteps) throw();
void moveScrollbarInSteps (int howManySteps);
/** Moves the scroll bar up or down in pages.
@@ -213,19 +239,19 @@ public:
A positive value here will move the bar down or to the right, a negative
value moves it up or to the left.
*/
void moveScrollbarInPages (int howManyPages) throw();
void moveScrollbarInPages (int howManyPages);
/** Scrolls to the top (or left).
This is the same as calling setCurrentRangeStart (getMinimumRangeLimit());
*/
void scrollToTop() throw();
void scrollToTop();
/** Scrolls to the bottom (or right).
This is the same as calling setCurrentRangeStart (getMaximumRangeLimit() - getCurrentRangeSize());
*/
void scrollToBottom() throw();
void scrollToBottom();
/** Changes the delay before the up and down buttons autorepeat when they are held
down.
@@ -236,7 +262,7 @@ public:
*/
void setButtonRepeatSpeed (int initialDelayInMillisecs,
int repeatDelayInMillisecs,
int minimumDelayInMillisecs = -1) throw();
int minimumDelayInMillisecs = -1);
//==============================================================================
/** A set of colour IDs to use to change the colour of various aspects of the component.
@@ -255,10 +281,10 @@ public:
//==============================================================================
/** Registers a listener that will be called when the scrollbar is moved. */
void addListener (ScrollBarListener* listener) throw();
void addListener (ScrollBarListener* listener);
/** Deregisters a previously-registered listener. */
void removeListener (ScrollBarListener* listener) throw();
void removeListener (ScrollBarListener* listener);
//==============================================================================
/** @internal */
@@ -284,8 +310,7 @@ public:
private:
//==============================================================================
double minimum, maximum;
double rangeStart, rangeSize;
Range <double> totalRange, visibleRange;
double singleStepSize, dragStartRange;
int thumbAreaStart, thumbAreaSize, thumbStart, thumbSize;
int dragStartMousePos, lastMousePos;
@@ -295,7 +320,7 @@ private:
Button* downButton;
ListenerList <ScrollBarListener> listeners;
void updateThumbPosition() throw();
void updateThumbPosition();
void timerCallback();
ScrollBar (const ScrollBar&);


+ 1
- 1
src/native/linux/juce_linux_Windowing.cpp View File

@@ -119,7 +119,7 @@ namespace Keys
static const int extendedKeyModifier = 0x10000000;
}
bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
int keysym;


+ 1
- 1
src/native/mac/juce_iphone_UIViewComponentPeer.mm View File

@@ -192,7 +192,7 @@ END_JUCE_NAMESPACE
}
//==============================================================================
bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
return false;
}


+ 1
- 1
src/native/mac/juce_mac_NSViewComponentPeer.mm View File

@@ -758,7 +758,7 @@ ComponentPeer* NSViewComponentPeer::currentlyFocusedPeer = 0;
VoidArray NSViewComponentPeer::keysCurrentlyDown;
//==============================================================================
bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
if (NSViewComponentPeer::keysCurrentlyDown.contains ((void*) keyCode))
return true;


+ 1
- 1
src/native/windows/juce_win32_Windowing.cpp View File

@@ -330,7 +330,7 @@ long improbableWindowNumber = 0xf965aa01; // also referenced by messaging.cpp
//==============================================================================
bool KeyPress::isKeyCurrentlyDown (const int keyCode) throw()
bool KeyPress::isKeyCurrentlyDown (const int keyCode)
{
SHORT k = (SHORT) keyCode;


Loading…
Cancel
Save